1212"""
1313
1414PLAIN_URLS = (
15- ' https://' ,
16- ' http://' ,
15+ " https://" ,
16+ " http://" ,
1717)
1818
1919VCS_URLS = (
20- 'git://' ,
21- 'git+git://' ,
22- 'git+https://' ,
23- 'git+http://' ,
24-
25- 'hg://' ,
26- 'hg+http://' ,
27- 'hg+https://' ,
28-
29- 'svn://' ,
30- 'svn+https://' ,
31- 'svn+http://' ,
20+ "git://" ,
21+ "git+git://" ,
22+ "git+https://" ,
23+ "git+http://" ,
24+ "hg://" ,
25+ "hg+http://" ,
26+ "hg+https://" ,
27+ "svn://" ,
28+ "svn+https://" ,
29+ "svn+http://" ,
3230)
3331
3432
@@ -77,34 +75,35 @@ def normalize_vcs_url(repo_url, vcs_tool=None):
7775 if repo_url .startswith (VCS_URLS + PLAIN_URLS ):
7876 return repo_url
7977
80- if repo_url .startswith (' git@' ):
81- tool , _ , right = repo_url .partition ('@' )
82- if ':' in repo_url :
83- host , _ , repo = right .partition (':' )
78+ if repo_url .startswith (" git@" ):
79+ tool , _ , right = repo_url .partition ("@" )
80+ if ":" in repo_url :
81+ host , _ , repo = right .partition (":" )
8482 else :
8583 # git@github.com/Filirom1/npm2aur.git
86- host , _ , repo = right .partition ('/' )
84+ host , _ , repo = right .partition ("/" )
8785
88- if any (r in host for r in (' bitbucket' , ' gitlab' , ' github' )):
89- scheme = ' https'
86+ if any (r in host for r in (" bitbucket" , " gitlab" , " github" )):
87+ scheme = " https"
9088 else :
91- scheme = ' git'
89+ scheme = " git"
9290
93- return ' %(scheme)s://%(host)s/%(repo)s' % locals ()
91+ return " %(scheme)s://%(host)s/%(repo)s" % locals ()
9492
9593 # FIXME: where these URL schemes come from??
96- if repo_url .startswith ((' bitbucket:' , ' gitlab:' , ' github:' , ' gist:' )):
94+ if repo_url .startswith ((" bitbucket:" , " gitlab:" , " github:" , " gist:" )):
9795 hoster_urls = {
98- 'bitbucket' : 'https://bitbucket.org/%(repo)s' ,
99- 'github' : 'https://github.com/%(repo)s' ,
100- 'gitlab' : 'https://gitlab.com/%(repo)s' ,
101- 'gist' : 'https://gist.github.com/%(repo)s' , }
102- hoster , _ , repo = repo_url .partition (':' )
96+ "bitbucket" : "https://bitbucket.org/%(repo)s" ,
97+ "github" : "https://github.com/%(repo)s" ,
98+ "gitlab" : "https://gitlab.com/%(repo)s" ,
99+ "gist" : "https://gist.github.com/%(repo)s" ,
100+ }
101+ hoster , _ , repo = repo_url .partition (":" )
103102 return hoster_urls [hoster ] % locals ()
104103
105- if len (repo_url .split ('/' )) == 2 :
104+ if len (repo_url .split ("/" )) == 2 :
106105 # implicit github, but that's only on NPM?
107- return f' https://github.com/{ repo_url } '
106+ return f" https://github.com/{ repo_url } "
108107
109108 return repo_url
110109
@@ -113,14 +112,14 @@ def build_description(summary, description):
113112 """
114113 Return a description string from a summary and description
115114 """
116- summary = (summary or '' ).strip ()
117- description = (description or '' ).strip ()
115+ summary = (summary or "" ).strip ()
116+ description = (description or "" ).strip ()
118117
119118 if not description :
120119 description = summary
121120 else :
122121 if summary and summary not in description :
123- description = ' \n ' .join ([summary , description ])
122+ description = " \n " .join ([summary , description ])
124123
125124 return description
126125
@@ -164,7 +163,7 @@ def find_root_resource(path, resource, codebase):
164163 """
165164 if not resource .path .endswith (path ):
166165 return
167- for _seg in path .split ('/' ):
166+ for _seg in path .split ("/" ):
168167 resource = resource .parent (codebase )
169168 if not resource :
170169 return
@@ -176,6 +175,7 @@ def yield_dependencies_from_package_data(package_data, datafile_path, package_ui
176175 Yield a Dependency for each dependency from ``package_data.dependencies``
177176 """
178177 from _packagedcode import models
178+
179179 dependent_packages = package_data .dependencies
180180 if dependent_packages :
181181 yield from models .Dependency .from_dependent_packages (
@@ -191,6 +191,7 @@ def yield_dependencies_from_package_resource(resource, package_uid=None):
191191 Yield a Dependency for each dependency from each package from``resource.package_data``
192192 """
193193 from _packagedcode import models
194+
194195 for pkg_data in resource .package_data :
195196 pkg_data = models .PackageData .from_dict (pkg_data )
196197 yield from yield_dependencies_from_package_data (pkg_data , resource .path , package_uid )
0 commit comments