Skip to content

Commit fa77c7c

Browse files
committed
Style corrections
Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
1 parent 63a1789 commit fa77c7c

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

vulnerabilities/scraper/npm.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
NPM_URL = 'https://registry.npmjs.org{}'
3131
PAGE = '/-/npm/v1/security/advisories?page=0'
3232

33+
3334
def get_all_versions(package_name):
3435
"""
3536
Returns all versions available for a module
@@ -40,7 +41,7 @@ def get_all_versions(package_name):
4041
with urlopen(package_url) as response:
4142
data = json.load(response)
4243
except HTTPError as e:
43-
if e.code == 404 :
44+
if e.code == 404:
4445
return []
4546
else:
4647
raise
@@ -88,7 +89,7 @@ def extract_data(JSON):
8889
obj.get('vulnerable_versions', ''),
8990
obj.get('patched_versions', '')
9091
)
91-
if affected_versions == fixed_versions == [] :
92+
if affected_versions == fixed_versions == []:
9293
continue
9394
# NPM registry has no data regarding this package finally we skip these
9495

@@ -112,15 +113,15 @@ def scrape_vulnerabilities():
112113
nextpage = PAGE
113114
while nextpage:
114115
try:
115-
cururl = NPM_URL.format(nextpage)
116+
cururl = NPM_URL.format(nextpage)
116117
response = json.load(urlopen(cururl))
117118
package_vulnerabilities.extend(extract_data(response))
118-
nextpage = response.get('urls', {}).get('next')
119+
nextpage = response.get('urls', {}).get('next')
119120

120121
except HTTPError as error:
121-
if error.code == 404 :
122+
if error.code == 404:
122123
break
123-
else :
124+
else:
124125
raise
125126

126127
return package_vulnerabilities

0 commit comments

Comments
 (0)