-
Notifications
You must be signed in to change notification settings - Fork 1
Make everything validate flake8-docstrings #357
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found a few missplellings.
lega/utils/db.py
Outdated
def mark_completed(file_id): | ||
"""Mark file in completed.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be "Mark file completed" (possibly "as completed").
lega/utils/exceptions.py
Outdated
def __str__(self): # Informal description | ||
"""Return readale informal description.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
readable with a b. Applies to all of the __str__
methods in this file.
lega/utils/logging.py
Outdated
class JSONFormatter(Formatter): | ||
"""Json Logs formattingself. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formattingself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Auto complete back stabbed me me on this.
lega/utils/storage.py
Outdated
|
||
def __init__(self, s3, bucket, path, mode='rb', blocksize=1 << 22): # 1<<22 = 4194304 = 4MB | ||
"""Initialise class.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm more a fan of american spelling (with a z), but whatever.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok.
lega/ingest.py
Outdated
@db.catch_error | ||
@db.crypt4gh_to_user_errors | ||
def work(fs, channel, data): | ||
'''Reads a message, splits the header and sends the remainder to the backend store.''' | ||
|
||
"""Read a message, splits the header and sends the remainder to the backend store.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new text is inconsistent.
lega/keyserver.py
Outdated
@routes.get('/active/{key_type}') | ||
async def retrieve_active_key(request): | ||
"""Retrive the active key from the cache and serve it via HTTPS.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: Retrieve
lega/keyserver.py
Outdated
@@ -179,15 +189,15 @@ def _unlock_key(name, active=None, path=None, expire=None, passphrase=None, **kw | |||
|
|||
@routes.get('/admin/ttl') | |||
async def check_ttl(request): | |||
"""Evict from the cache if TTL expired | |||
and return the keys that survived""" # ehh...why? /Fred | |||
"""Evict from the cache if TTL expired and return the keys that survived.""" # ehh...why? /Fred |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stefan, can you address the comment at the end?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That endpoint is something we thought of when designing the keyserver and we kept it there.
the use case was to see which keys are active.
It is not subject of this PR, but most likely it will be removed as it is deprecated.
lega/utils/db.py
Outdated
###################################### | ||
# DB connection # | ||
###################################### | ||
def fetch_args(d): | ||
"""Initializing a connection to db.""" | ||
"""Initialize a connection to db.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it doesn't
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the log below started with Initializing a connection to...
and got me confused.
lega/utils/storage.py
Outdated
@@ -20,33 +18,39 @@ class FileStorage(): | |||
"""Vault storage on disk and related I/O.""" | |||
|
|||
def __init__(self): | |||
"""Initialize POSIX storage at a path.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initialize backend storage to a POSIX file system's path
Make everything validate flake8-docstrings
A continuation of this PR #350
It might look like a lot has changed, however this PR add missing documentation to function, classes and makes sure every one of them adheres to the PEP 257 docstring conventions.
Ignored rules (a bit biased on them, so we can discuss if we should ignore more or less):
E226,D203,D212,D213,D404,D100,D104
Documentation of the functions is minimal and any changes or suggestion to the descriptions are welcomed.