remove pep8 corrections

This commit is contained in:
Christian Barra
2017-01-03 14:30:36 +01:00
parent b6e293c38e
commit 6694cb42c8

View File

@@ -32,8 +32,11 @@ from .utils import (
class JSONDict(TypeDecorator): class JSONDict(TypeDecorator):
"""Represents an immutable structure as a json-encoded string. """Represents an immutable structure as a json-encoded string.
Usage:: Usage::
JSONEncodedDict(255) JSONEncodedDict(255)
""" """
impl = TEXT impl = TEXT
@@ -56,6 +59,7 @@ Base.log = app_log
class Server(Base): class Server(Base):
"""The basic state of a server """The basic state of a server
connection and cookie info connection and cookie info
""" """
__tablename__ = 'servers' __tablename__ = 'servers'
@@ -98,6 +102,7 @@ class Server(Base):
@property @property
def bind_url(self): def bind_url(self):
"""representation of URL used for binding """representation of URL used for binding
Never used in APIs, only logging, Never used in APIs, only logging,
since it can be non-connectable value, such as '', meaning all interfaces. since it can be non-connectable value, such as '', meaning all interfaces.
""" """
@@ -120,6 +125,7 @@ class Server(Base):
class Proxy(Base): class Proxy(Base):
"""A configurable-http-proxy instance. """A configurable-http-proxy instance.
A proxy consists of the API server info and the public-facing server info, A proxy consists of the API server info and the public-facing server info,
plus an auth token for configuring the proxy table. plus an auth token for configuring the proxy table.
""" """
@@ -218,6 +224,7 @@ class Proxy(Base):
@gen.coroutine @gen.coroutine
def add_all_services(self, service_dict): def add_all_services(self, service_dict):
"""Update the proxy table from the database. """Update the proxy table from the database.
Used when loading up a new proxy. Used when loading up a new proxy.
""" """
db = inspect(self).session db = inspect(self).session
@@ -233,6 +240,7 @@ class Proxy(Base):
@gen.coroutine @gen.coroutine
def add_all_users(self, user_dict): def add_all_users(self, user_dict):
"""Update the proxy table from the database. """Update the proxy table from the database.
Used when loading up a new proxy. Used when loading up a new proxy.
""" """
db = inspect(self).session db = inspect(self).session
@@ -293,7 +301,9 @@ class Proxy(Base):
class Hub(Base): class Hub(Base):
"""Bring it all together at the hub. """Bring it all together at the hub.
The Hub is a server, plus its API path suffix The Hub is a server, plus its API path suffix
the api_url is the full URL plus the api_path suffix on the end the api_url is the full URL plus the api_path suffix on the end
of the server base_url. of the server base_url.
""" """
@@ -344,15 +354,20 @@ class Group(Base):
class User(Base): class User(Base):
"""The User table """The User table
Each user can have more than a single server, Each user can have more than a single server,
and multiple tokens used for authorization. and multiple tokens used for authorization.
API tokens grant access to the Hub's REST API. API tokens grant access to the Hub's REST API.
These are used by single-user servers to authenticate requests, These are used by single-user servers to authenticate requests,
and external services to manipulate the Hub. and external services to manipulate the Hub.
Cookies are set with a single ID. Cookies are set with a single ID.
Resetting the Cookie ID invalidates all cookies, forcing user to login again. Resetting the Cookie ID invalidates all cookies, forcing user to login again.
A `state` column contains a JSON dict, A `state` column contains a JSON dict,
used for restoring state of a Spawner. used for restoring state of a Spawner.
`server` returns the first entry for the users' servers. `server` returns the first entry for the users' servers.
'servers' is a list that contains a reference to the ser's Servers. 'servers' is a list that contains a reference to the ser's Servers.
""" """
@@ -449,15 +464,20 @@ class UserServer(Base):
class Service(Base): class Service(Base):
"""A service run with JupyterHub """A service run with JupyterHub
A service is similar to a User without a Spawner. A service is similar to a User without a Spawner.
A service can have API tokens for accessing the Hub's API A service can have API tokens for accessing the Hub's API
It has: It has:
- name - name
- admin - admin
- api tokens - api tokens
- server (if proxied http endpoint) - server (if proxied http endpoint)
In addition to what it has in common with users, a Service has extra info: In addition to what it has in common with users, a Service has extra info:
- pid: the process id (if managed) - pid: the process id (if managed)
""" """
__tablename__ = 'services' __tablename__ = 'services'
id = Column(Integer, primary_key=True, autoincrement=True) id = Column(Integer, primary_key=True, autoincrement=True)
@@ -482,6 +502,7 @@ class Service(Base):
@classmethod @classmethod
def find(cls, db, name): def find(cls, db, name):
"""Find a service by name. """Find a service by name.
Returns None if not found. Returns None if not found.
""" """
return db.query(cls).filter(cls.name==name).first() return db.query(cls).filter(cls.name==name).first()
@@ -539,6 +560,7 @@ class APIToken(Base):
@classmethod @classmethod
def find(cls, db, token, *, kind=None): def find(cls, db, token, *, kind=None):
"""Find a token object by value. """Find a token object by value.
Returns None if not found. Returns None if not found.
`kind='user'` only returns API tokens for users `kind='user'` only returns API tokens for users