88import shutil
99import subprocess
1010import sys
11- import traceback
1211import zipfile
1312import hashlib
1413
@@ -132,10 +131,11 @@ def dependency_string(self):
132131 return xml
133132
134133 def get_coordinates (self ):
135- return ([self .groupId , self .artifactId ]
134+ return (
135+ [self .groupId , self .artifactId ]
136136 + ([self .version ] if self .version != Endpoint .VERSION_MANAGED else [])
137137 + ([self .classifier ] if self .classifier else [])
138- )
138+ )
139139
140140 def is_endpoint (string ):
141141 endpoint_elements = (
@@ -215,7 +215,7 @@ def link(source, link_name, link_type="auto"):
215215 raise e
216216 try :
217217 return link (source = source , link_name = link_name , link_type = "soft" )
218- except OSError as e :
218+ except OSError :
219219 pass
220220
221221 return link (source = source , link_name = link_name , link_type = "copy" )
@@ -232,17 +232,6 @@ def m2_path():
232232 return os .getenv ("M2_REPO" , (pathlib .Path .home () / ".m2" ).absolute ())
233233
234234
235- def expand (string , ** shortcuts ):
236-
237- for (k , v ) in shortcuts .items ():
238- if string in k :
239- return "{}{}" .format (
240- v ,
241- )
242-
243- return string
244-
245-
246235def launch_java (
247236 jar_dir ,
248237 jvm_args ,
@@ -297,7 +286,12 @@ def find_endpoint(argv, shortcuts={}):
297286
298287
299288def jgo_parser (log_levels = _default_log_levels ):
300-
289+ usage = (
290+ "usage: jgo [-v] [-u] [-U] [-m] [-q] [--log-level] [--ignore-jgorc]\n "
291+ " [--link-type type] [--additional-jars jar [jar ...]]\n "
292+ " [--additional-endpoints endpoint [endpoint ...]]\n "
293+ " [JVM_OPTIONS [JVM_OPTIONS ...]] <endpoint> [main-args]"
294+ )
301295 epilog = """
302296The endpoint should have one of the following formats:
303297
@@ -315,10 +309,7 @@ def jgo_parser(log_levels=_default_log_levels):
315309
316310 parser = argparse .ArgumentParser (
317311 description = "Run Java main class from Maven coordinates." ,
318- usage = "jgo [-v] [-u] [-U] [-m] [-q] [--log-level] [--ignore-jgorc]\n " +
319- " [--link-type type] [--additional-jars jar [jar ...]]\n " +
320- " [--additional-endpoints endpoint [endpoint ...]]\n " +
321- " [JVM_OPTIONS [JVM_OPTIONS ...]] <endpoint> [main-args]" ,
312+ usage = usage [len ("usage: " ) :],
322313 epilog = epilog ,
323314 formatter_class = argparse .RawTextHelpFormatter ,
324315 )
@@ -378,8 +369,8 @@ def jgo_parser(log_levels=_default_log_levels):
378369 "--link-type" ,
379370 default = None ,
380371 type = str ,
381- help = "How to link from local Maven repository into jgo cache.\n " +
382- "Defaults to the `links' setting in ~/.jgorc or 'auto' if not specified." ,
372+ help = "How to link from local Maven repository into jgo cache.\n "
373+ + "Defaults to the `links' setting in ~/.jgorc or 'auto' if not specified." ,
383374 choices = ("hard" , "soft" , "copy" , "auto" ),
384375 )
385376 parser .add_argument (
@@ -656,7 +647,7 @@ def resolve_dependencies(
656647 if e .stderr :
657648 err_lines += e .stderr .decode ().splitlines ()
658649 for l in err_lines :
659- if l .startswith (' [ERROR]' ):
650+ if l .startswith (" [ERROR]" ):
660651 _logger .error ("\t %s" , l )
661652 else :
662653 _logger .debug ("\t %s" , l )
@@ -703,8 +694,8 @@ def resolve_dependencies(
703694 jar_file_in_workspace ,
704695 link_type = link_type ,
705696 )
706- except FileExistsError as e :
707- # Do not throw exceptionif target file exists.
697+ except FileExistsError :
698+ # Do not throw exception if target file exists.
708699 pass
709700 pathlib .Path (build_success_file ).touch (exist_ok = True )
710701 return primary_endpoint , workspace
0 commit comments