Skip to content

Commit 0cdf3b9

Browse files
committed
pep8: Fixed style issues.
1 parent 6a7c42b commit 0cdf3b9

File tree

8 files changed

+26
-22
lines changed

8 files changed

+26
-22
lines changed

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[pep8]
2+
ignore = E402

src/victims_web/config.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858

5959
# CSRF Protection
6060
CSRF_COOKIE_NAME = 'victimsc'
61-
#CSRF_COOKIE_TIMEOUT = timedelta(1)
61+
# CSRF_COOKIE_TIMEOUT = timedelta(1)
6262
CSRF_DISABLED = False
6363

6464
# Captcha
@@ -102,8 +102,9 @@
102102
}
103103

104104
# Optional settings
105-
## Sentry Configuration
106-
#SENTRY_DSN = ''
105+
106+
# Sentry Configuration
107+
# SENTRY_DSN = ''
107108

108109
# Load custom configuration if available, this will override defaults above
109110
CFG_KEY = 'VICTIMS_CONFIG'
@@ -124,18 +125,18 @@
124125

125126
SESSION_COOKIE_SECURE = not DEBUG
126127

127-
## We do not need https when debugging
128+
# We do not need https when debugging
128129
if DEBUG:
129130
PREFERRED_URL_SCHEME = 'http'
130131
else:
131132
PREFERRED_URL_SCHEME = 'https'
132133

133-
## Create any required directories
134+
# Create any required directories
134135
for folder in [LOG_FOLDER, UPLOAD_FOLDER, DOWNLOAD_FOLDER, CACHE_DIR]:
135136
if not isdir(folder):
136137
makedirs(folder)
137138

138-
## Debug Toolbar
139+
# Debug Toolbar
139140
if DEBUG:
140141
DEBUG_TB_HOSTS = '127.0.0.1'
141142
DEBUG_TB_PROFILER_ENABLED = True

src/victims_web/handlers/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ class RegistrationForm(Form):
202202
"""
203203
Registration Form
204204
"""
205-
username = fields.StringField('Username', [
205+
username = fields.StringField('Username', [
206206
validators.Regexp('^[\w\.]*$', message='Invalid Username'),
207207
validators.required(),
208208
UserName(),

src/victims_web/models.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
from flask.ext.bcrypt import generate_password_hash
3434
from flask.ext.mongoengine import Document
35+
from mongoengine.base import BaseDocument
3536
from mongoengine import (
3637
StringField, DateTimeField, DictField, BooleanField, EmbeddedDocument,
3738
EmbeddedDocumentField, ListField, EmailField
@@ -307,7 +308,7 @@ def validkeys(self):
307308
return HASHING_ALGORITHMS
308309

309310

310-
class Hash(JsonifyMixin, EmbeddedDocument, ValidatedDocument):
311+
class Hash(JsonifyMixin, EmbeddedDocument, BaseDocument):
311312
"""
312313
A hash record.
313314
"""
@@ -464,8 +465,8 @@ def add_comment(self, comment):
464465
ValidatedDocument.save(self)
465466

466467
def valid_entry(self):
467-
if (not self.group
468-
or len(self.group.strip()) == 0):
468+
if (not self.group or
469+
len(self.group.strip()) == 0):
469470
self.add_comment('[auto] no group specified')
470471
return False
471472
if len(self.cves) == 0:

src/victims_web/plugin/downloader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class DownloadException(Exception):
4141

4242

4343
def download(url, target, async=False, close_target=False, quiet=True):
44-
### download file to target (target is a file-like object)
44+
# download file to target (target is a file-like object)
4545
if async:
4646
_pool.submit(url, target)
4747
else:

src/victims_web/plugin/github.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def _rest(self, service, endpoint, **kwargs):
4848
def get_commits(self, **kwargs):
4949
return self._rest('repos', 'commits', **kwargs)
5050

51-
#/repos/:owner/:repo/commits/:sha
51+
# /repos/:owner/:repo/commits/:sha
5252
def get_commit(self, sha, **kwargs):
5353
return self._rest('repos', 'commits/%s' % (sha), **kwargs)
5454

src/victims_web/plugin/maven.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ def to_maven_snapshot_name(self, ext):
7777
def __eq__(self, other):
7878
if isinstance(other, Artifact):
7979
return (
80-
other.group == self.group
81-
and other.artifact == self.artifact
82-
and other.version == self.version
80+
other.group == self.group and
81+
other.artifact == self.artifact and
82+
other.version == self.version
8383
)
8484
else:
8585
return False
@@ -94,14 +94,14 @@ def is_snapshot(self):
9494
return self.version.find('SNAPSHOT') > 0
9595

9696
def is_same_artifact(self, other):
97-
## need to support wildcard
97+
# TODO: need to support wildcard
9898
group_match = True if (
99-
self.group == '*'
100-
or other.group == '*'
99+
self.group == '*' or
100+
other.group == '*'
101101
) else self.group == other.group
102102
artif_match = True if (
103-
self.artifact == '*'
104-
or other.artifact == '*'
103+
self.artifact == '*' or
104+
other.artifact == '*'
105105
) else self.artifact == other.artifact
106106
return group_match and artif_match
107107

@@ -184,7 +184,7 @@ def download_pom(self, artifact):
184184
try:
185185
logger.info('[Checking] pom file %s' % maven_path)
186186
data = download_string(maven_path)
187-
## cache
187+
# cache
188188
self.pom_cache[artifact] = data
189189
return data
190190
except DownloadException:

src/victims_web/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def hash_submission(submission_id):
3838
config.LOGGER.debug('Submission %s not found.' % (submission_id))
3939
return
4040

41-
if not submission.entry is None:
41+
if submission.entry is not None:
4242
submission.add_comment('Entry alread exits. Skipping hashing.')
4343
return
4444

0 commit comments

Comments
 (0)