id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
241,100
olsoneric/pedemath
pedemath/vec2.py
dot_v2
def dot_v2(vec1, vec2): """Return the dot product of two vectors""" return vec1.x * vec2.x + vec1.y * vec2.y
python
def dot_v2(vec1, vec2): """Return the dot product of two vectors""" return vec1.x * vec2.x + vec1.y * vec2.y
[ "def", "dot_v2", "(", "vec1", ",", "vec2", ")", ":", "return", "vec1", ".", "x", "*", "vec2", ".", "x", "+", "vec1", ".", "y", "*", "vec2", ".", "y" ]
Return the dot product of two vectors
[ "Return", "the", "dot", "product", "of", "two", "vectors" ]
4bffcfe7089e421d603eb0a9708b84789c2d16be
https://github.com/olsoneric/pedemath/blob/4bffcfe7089e421d603eb0a9708b84789c2d16be/pedemath/vec2.py#L74-L77
241,101
olsoneric/pedemath
pedemath/vec2.py
cross_v2
def cross_v2(vec1, vec2): """Return the crossproduct of the two vectors as a Vec2. Cross product doesn't really make sense in 2D, but return the Z component of the 3d result. """ return vec1.y * vec2.x - vec1.x * vec2.y
python
def cross_v2(vec1, vec2): """Return the crossproduct of the two vectors as a Vec2. Cross product doesn't really make sense in 2D, but return the Z component of the 3d result. """ return vec1.y * vec2.x - vec1.x * vec2.y
[ "def", "cross_v2", "(", "vec1", ",", "vec2", ")", ":", "return", "vec1", ".", "y", "*", "vec2", ".", "x", "-", "vec1", ".", "x", "*", "vec2", ".", "y" ]
Return the crossproduct of the two vectors as a Vec2. Cross product doesn't really make sense in 2D, but return the Z component of the 3d result.
[ "Return", "the", "crossproduct", "of", "the", "two", "vectors", "as", "a", "Vec2", ".", "Cross", "product", "doesn", "t", "really", "make", "sense", "in", "2D", "but", "return", "the", "Z", "component", "of", "the", "3d", "result", "." ]
4bffcfe7089e421d603eb0a9708b84789c2d16be
https://github.com/olsoneric/pedemath/blob/4bffcfe7089e421d603eb0a9708b84789c2d16be/pedemath/vec2.py#L80-L86
241,102
olsoneric/pedemath
pedemath/vec2.py
Vec2.truncate
def truncate(self, max_length): """Truncate this vector so it's length does not exceed max.""" if self.length() > max_length: # If it's longer than the max_length, scale to the max_length. self.scale(max_length / self.length())
python
def truncate(self, max_length): """Truncate this vector so it's length does not exceed max.""" if self.length() > max_length: # If it's longer than the max_length, scale to the max_length. self.scale(max_length / self.length())
[ "def", "truncate", "(", "self", ",", "max_length", ")", ":", "if", "self", ".", "length", "(", ")", ">", "max_length", ":", "# If it's longer than the max_length, scale to the max_length.", "self", ".", "scale", "(", "max_length", "/", "self", ".", "length", "("...
Truncate this vector so it's length does not exceed max.
[ "Truncate", "this", "vector", "so", "it", "s", "length", "does", "not", "exceed", "max", "." ]
4bffcfe7089e421d603eb0a9708b84789c2d16be
https://github.com/olsoneric/pedemath/blob/4bffcfe7089e421d603eb0a9708b84789c2d16be/pedemath/vec2.py#L208-L214
241,103
olsoneric/pedemath
pedemath/vec2.py
Vec2.get_scaled_v2
def get_scaled_v2(self, amount): """Return a new Vec2 with x and y multiplied by amount.""" return Vec2(self.x * amount, self.y * amount)
python
def get_scaled_v2(self, amount): """Return a new Vec2 with x and y multiplied by amount.""" return Vec2(self.x * amount, self.y * amount)
[ "def", "get_scaled_v2", "(", "self", ",", "amount", ")", ":", "return", "Vec2", "(", "self", ".", "x", "*", "amount", ",", "self", ".", "y", "*", "amount", ")" ]
Return a new Vec2 with x and y multiplied by amount.
[ "Return", "a", "new", "Vec2", "with", "x", "and", "y", "multiplied", "by", "amount", "." ]
4bffcfe7089e421d603eb0a9708b84789c2d16be
https://github.com/olsoneric/pedemath/blob/4bffcfe7089e421d603eb0a9708b84789c2d16be/pedemath/vec2.py#L236-L239
241,104
olsoneric/pedemath
pedemath/vec2.py
Vec2.dot
def dot(self, vec): """Return the dot product of self and another Vec2.""" return self.x * vec.x + self.y * vec.y
python
def dot(self, vec): """Return the dot product of self and another Vec2.""" return self.x * vec.x + self.y * vec.y
[ "def", "dot", "(", "self", ",", "vec", ")", ":", "return", "self", ".", "x", "*", "vec", ".", "x", "+", "self", ".", "y", "*", "vec", ".", "y" ]
Return the dot product of self and another Vec2.
[ "Return", "the", "dot", "product", "of", "self", "and", "another", "Vec2", "." ]
4bffcfe7089e421d603eb0a9708b84789c2d16be
https://github.com/olsoneric/pedemath/blob/4bffcfe7089e421d603eb0a9708b84789c2d16be/pedemath/vec2.py#L273-L276
241,105
olsoneric/pedemath
pedemath/vec2.py
Vec2.cross
def cross(self, vec): """Return the 2d cross product of self with another vector. Cross product doesn't make sense in 2D, but return the Z component of the 3d result. """ return self.x * vec.y - vec.x * self.y
python
def cross(self, vec): """Return the 2d cross product of self with another vector. Cross product doesn't make sense in 2D, but return the Z component of the 3d result. """ return self.x * vec.y - vec.x * self.y
[ "def", "cross", "(", "self", ",", "vec", ")", ":", "return", "self", ".", "x", "*", "vec", ".", "y", "-", "vec", ".", "x", "*", "self", ".", "y" ]
Return the 2d cross product of self with another vector. Cross product doesn't make sense in 2D, but return the Z component of the 3d result.
[ "Return", "the", "2d", "cross", "product", "of", "self", "with", "another", "vector", ".", "Cross", "product", "doesn", "t", "make", "sense", "in", "2D", "but", "return", "the", "Z", "component", "of", "the", "3d", "result", "." ]
4bffcfe7089e421d603eb0a9708b84789c2d16be
https://github.com/olsoneric/pedemath/blob/4bffcfe7089e421d603eb0a9708b84789c2d16be/pedemath/vec2.py#L278-L284
241,106
klmitch/appathy
appathy/controller.py
Controller._get_action
def _get_action(self, action): """ Retrieve a descriptor for the named action. Caches descriptors for efficiency. """ # If we don't have an action named that, bail out if action not in self.wsgi_actions: return None # Generate an ActionDescriptor if...
python
def _get_action(self, action): """ Retrieve a descriptor for the named action. Caches descriptors for efficiency. """ # If we don't have an action named that, bail out if action not in self.wsgi_actions: return None # Generate an ActionDescriptor if...
[ "def", "_get_action", "(", "self", ",", "action", ")", ":", "# If we don't have an action named that, bail out", "if", "action", "not", "in", "self", ".", "wsgi_actions", ":", "return", "None", "# Generate an ActionDescriptor if necessary", "if", "action", "not", "in", ...
Retrieve a descriptor for the named action. Caches descriptors for efficiency.
[ "Retrieve", "a", "descriptor", "for", "the", "named", "action", ".", "Caches", "descriptors", "for", "efficiency", "." ]
a10aa7d21d38622e984a8fe106ab37114af90dc2
https://github.com/klmitch/appathy/blob/a10aa7d21d38622e984a8fe106ab37114af90dc2/appathy/controller.py#L221-L239
241,107
klmitch/appathy
appathy/controller.py
Controller._route
def _route(self, action, method): """ Given an action method, generates a route for it. """ # First thing, determine the path for the method path = method._wsgi_path methods = None if path is None: map_rule = self.wsgi_method_map.get(method.__name__) ...
python
def _route(self, action, method): """ Given an action method, generates a route for it. """ # First thing, determine the path for the method path = method._wsgi_path methods = None if path is None: map_rule = self.wsgi_method_map.get(method.__name__) ...
[ "def", "_route", "(", "self", ",", "action", ",", "method", ")", ":", "# First thing, determine the path for the method", "path", "=", "method", ".", "_wsgi_path", "methods", "=", "None", "if", "path", "is", "None", ":", "map_rule", "=", "self", ".", "wsgi_met...
Given an action method, generates a route for it.
[ "Given", "an", "action", "method", "generates", "a", "route", "for", "it", "." ]
a10aa7d21d38622e984a8fe106ab37114af90dc2
https://github.com/klmitch/appathy/blob/a10aa7d21d38622e984a8fe106ab37114af90dc2/appathy/controller.py#L241-L279
241,108
Deisss/python-sockjsroom
sockjsroom/socketHandler.py
SockJSDefaultHandler.on_message
def on_message(self, data): """ Parsing data, and try to call responding message """ # Trying to parse response data = json.loads(data) if not data["name"] is None: logging.debug("%s: receiving message %s" % (data["name"], data["data"])) fct = getattr(self, "on_" ...
python
def on_message(self, data): """ Parsing data, and try to call responding message """ # Trying to parse response data = json.loads(data) if not data["name"] is None: logging.debug("%s: receiving message %s" % (data["name"], data["data"])) fct = getattr(self, "on_" ...
[ "def", "on_message", "(", "self", ",", "data", ")", ":", "# Trying to parse response", "data", "=", "json", ".", "loads", "(", "data", ")", "if", "not", "data", "[", "\"name\"", "]", "is", "None", ":", "logging", ".", "debug", "(", "\"%s: receiving message...
Parsing data, and try to call responding message
[ "Parsing", "data", "and", "try", "to", "call", "responding", "message" ]
7c20187571d39e7fede848dc98f954235ca77241
https://github.com/Deisss/python-sockjsroom/blob/7c20187571d39e7fede848dc98f954235ca77241/sockjsroom/socketHandler.py#L26-L41
241,109
Deisss/python-sockjsroom
sockjsroom/socketHandler.py
SockJSRoomHandler.join
def join(self, _id): """ Join a room """ if not SockJSRoomHandler._room.has_key(self._gcls() + _id): SockJSRoomHandler._room[self._gcls() + _id] = set() SockJSRoomHandler._room[self._gcls() + _id].add(self)
python
def join(self, _id): """ Join a room """ if not SockJSRoomHandler._room.has_key(self._gcls() + _id): SockJSRoomHandler._room[self._gcls() + _id] = set() SockJSRoomHandler._room[self._gcls() + _id].add(self)
[ "def", "join", "(", "self", ",", "_id", ")", ":", "if", "not", "SockJSRoomHandler", ".", "_room", ".", "has_key", "(", "self", ".", "_gcls", "(", ")", "+", "_id", ")", ":", "SockJSRoomHandler", ".", "_room", "[", "self", ".", "_gcls", "(", ")", "+"...
Join a room
[ "Join", "a", "room" ]
7c20187571d39e7fede848dc98f954235ca77241
https://github.com/Deisss/python-sockjsroom/blob/7c20187571d39e7fede848dc98f954235ca77241/sockjsroom/socketHandler.py#L61-L65
241,110
Deisss/python-sockjsroom
sockjsroom/socketHandler.py
SockJSRoomHandler.leave
def leave(self, _id): """ Leave a room """ if SockJSRoomHandler._room.has_key(self._gcls() + _id): SockJSRoomHandler._room[self._gcls() + _id].remove(self) if len(SockJSRoomHandler._room[self._gcls() + _id]) == 0: del SockJSRoomHandler._room[self._gcls() + _id]
python
def leave(self, _id): """ Leave a room """ if SockJSRoomHandler._room.has_key(self._gcls() + _id): SockJSRoomHandler._room[self._gcls() + _id].remove(self) if len(SockJSRoomHandler._room[self._gcls() + _id]) == 0: del SockJSRoomHandler._room[self._gcls() + _id]
[ "def", "leave", "(", "self", ",", "_id", ")", ":", "if", "SockJSRoomHandler", ".", "_room", ".", "has_key", "(", "self", ".", "_gcls", "(", ")", "+", "_id", ")", ":", "SockJSRoomHandler", ".", "_room", "[", "self", ".", "_gcls", "(", ")", "+", "_id...
Leave a room
[ "Leave", "a", "room" ]
7c20187571d39e7fede848dc98f954235ca77241
https://github.com/Deisss/python-sockjsroom/blob/7c20187571d39e7fede848dc98f954235ca77241/sockjsroom/socketHandler.py#L67-L72
241,111
Deisss/python-sockjsroom
sockjsroom/socketHandler.py
SockJSRoomHandler.getRoom
def getRoom(self, _id): """ Retrieve a room from it's id """ if SockJSRoomHandler._room.has_key(self._gcls() + _id): return SockJSRoomHandler._room[self._gcls() + _id] return None
python
def getRoom(self, _id): """ Retrieve a room from it's id """ if SockJSRoomHandler._room.has_key(self._gcls() + _id): return SockJSRoomHandler._room[self._gcls() + _id] return None
[ "def", "getRoom", "(", "self", ",", "_id", ")", ":", "if", "SockJSRoomHandler", ".", "_room", ".", "has_key", "(", "self", ".", "_gcls", "(", ")", "+", "_id", ")", ":", "return", "SockJSRoomHandler", ".", "_room", "[", "self", ".", "_gcls", "(", ")",...
Retrieve a room from it's id
[ "Retrieve", "a", "room", "from", "it", "s", "id" ]
7c20187571d39e7fede848dc98f954235ca77241
https://github.com/Deisss/python-sockjsroom/blob/7c20187571d39e7fede848dc98f954235ca77241/sockjsroom/socketHandler.py#L74-L78
241,112
Deisss/python-sockjsroom
sockjsroom/socketHandler.py
SockJSRoomHandler.publishToRoom
def publishToRoom(self, roomId, name, data, userList=None): """ Publish to given room data submitted """ if userList is None: userList = self.getRoom(roomId) # Publish data to all room users logging.debug("%s: broadcasting (name: %s, data: %s, number of users: %s)" % (self._...
python
def publishToRoom(self, roomId, name, data, userList=None): """ Publish to given room data submitted """ if userList is None: userList = self.getRoom(roomId) # Publish data to all room users logging.debug("%s: broadcasting (name: %s, data: %s, number of users: %s)" % (self._...
[ "def", "publishToRoom", "(", "self", ",", "roomId", ",", "name", ",", "data", ",", "userList", "=", "None", ")", ":", "if", "userList", "is", "None", ":", "userList", "=", "self", ".", "getRoom", "(", "roomId", ")", "# Publish data to all room users", "log...
Publish to given room data submitted
[ "Publish", "to", "given", "room", "data", "submitted" ]
7c20187571d39e7fede848dc98f954235ca77241
https://github.com/Deisss/python-sockjsroom/blob/7c20187571d39e7fede848dc98f954235ca77241/sockjsroom/socketHandler.py#L80-L90
241,113
Deisss/python-sockjsroom
sockjsroom/socketHandler.py
SockJSRoomHandler.publishToOther
def publishToOther(self, roomId, name, data): """ Publish to only other people than myself """ tmpList = self.getRoom(roomId) # Select everybody except me userList = [x for x in tmpList if x is not self] self.publishToRoom(roomId, name, data, userList)
python
def publishToOther(self, roomId, name, data): """ Publish to only other people than myself """ tmpList = self.getRoom(roomId) # Select everybody except me userList = [x for x in tmpList if x is not self] self.publishToRoom(roomId, name, data, userList)
[ "def", "publishToOther", "(", "self", ",", "roomId", ",", "name", ",", "data", ")", ":", "tmpList", "=", "self", ".", "getRoom", "(", "roomId", ")", "# Select everybody except me", "userList", "=", "[", "x", "for", "x", "in", "tmpList", "if", "x", "is", ...
Publish to only other people than myself
[ "Publish", "to", "only", "other", "people", "than", "myself" ]
7c20187571d39e7fede848dc98f954235ca77241
https://github.com/Deisss/python-sockjsroom/blob/7c20187571d39e7fede848dc98f954235ca77241/sockjsroom/socketHandler.py#L92-L97
241,114
Deisss/python-sockjsroom
sockjsroom/socketHandler.py
SockJSRoomHandler.publishToMyself
def publishToMyself(self, roomId, name, data): """ Publish to only myself """ self.publishToRoom(roomId, name, data, [self])
python
def publishToMyself(self, roomId, name, data): """ Publish to only myself """ self.publishToRoom(roomId, name, data, [self])
[ "def", "publishToMyself", "(", "self", ",", "roomId", ",", "name", ",", "data", ")", ":", "self", ".", "publishToRoom", "(", "roomId", ",", "name", ",", "data", ",", "[", "self", "]", ")" ]
Publish to only myself
[ "Publish", "to", "only", "myself" ]
7c20187571d39e7fede848dc98f954235ca77241
https://github.com/Deisss/python-sockjsroom/blob/7c20187571d39e7fede848dc98f954235ca77241/sockjsroom/socketHandler.py#L99-L101
241,115
Deisss/python-sockjsroom
sockjsroom/socketHandler.py
SockJSRoomHandler.isInRoom
def isInRoom(self, _id): """ Check a given user is in given room """ if SockJSRoomHandler._room.has_key(self._gcls() + _id): if self in SockJSRoomHandler._room[self._gcls() + _id]: return True return False
python
def isInRoom(self, _id): """ Check a given user is in given room """ if SockJSRoomHandler._room.has_key(self._gcls() + _id): if self in SockJSRoomHandler._room[self._gcls() + _id]: return True return False
[ "def", "isInRoom", "(", "self", ",", "_id", ")", ":", "if", "SockJSRoomHandler", ".", "_room", ".", "has_key", "(", "self", ".", "_gcls", "(", ")", "+", "_id", ")", ":", "if", "self", "in", "SockJSRoomHandler", ".", "_room", "[", "self", ".", "_gcls"...
Check a given user is in given room
[ "Check", "a", "given", "user", "is", "in", "given", "room" ]
7c20187571d39e7fede848dc98f954235ca77241
https://github.com/Deisss/python-sockjsroom/blob/7c20187571d39e7fede848dc98f954235ca77241/sockjsroom/socketHandler.py#L103-L108
241,116
dcrosta/sendlib
sendlib.py
Data.readline
def readline(self, size=None): """ Read a line from the stream, including the trailing new line character. If `size` is set, don't read more than `size` bytes, even if the result does not represent a complete line. The last line read may not include a trailing new line ...
python
def readline(self, size=None): """ Read a line from the stream, including the trailing new line character. If `size` is set, don't read more than `size` bytes, even if the result does not represent a complete line. The last line read may not include a trailing new line ...
[ "def", "readline", "(", "self", ",", "size", "=", "None", ")", ":", "if", "self", ".", "_pos", ">=", "self", ".", "length", ":", "return", "''", "if", "size", ":", "amount", "=", "min", "(", "size", ",", "(", "self", ".", "length", "-", "self", ...
Read a line from the stream, including the trailing new line character. If `size` is set, don't read more than `size` bytes, even if the result does not represent a complete line. The last line read may not include a trailing new line character if one was not present in the unde...
[ "Read", "a", "line", "from", "the", "stream", "including", "the", "trailing", "new", "line", "character", ".", "If", "size", "is", "set", "don", "t", "read", "more", "than", "size", "bytes", "even", "if", "the", "result", "does", "not", "represent", "a",...
51ea5412a70cf83a62d51d5c515c0eeac725aea0
https://github.com/dcrosta/sendlib/blob/51ea5412a70cf83a62d51d5c515c0eeac725aea0/sendlib.py#L338-L356
241,117
JNRowe/jnrbase
jnrbase/git.py
find_tag
def find_tag(__matcher: str = 'v[0-9]*', *, strict: bool = True, git_dir: str = '.') -> str: """Find closest tag for a git repository. Note: This defaults to `Semantic Version`_ tag matching. Args: __matcher: Glob-style tag pattern to match strict: Allow commit-ish, if...
python
def find_tag(__matcher: str = 'v[0-9]*', *, strict: bool = True, git_dir: str = '.') -> str: """Find closest tag for a git repository. Note: This defaults to `Semantic Version`_ tag matching. Args: __matcher: Glob-style tag pattern to match strict: Allow commit-ish, if...
[ "def", "find_tag", "(", "__matcher", ":", "str", "=", "'v[0-9]*'", ",", "*", ",", "strict", ":", "bool", "=", "True", ",", "git_dir", ":", "str", "=", "'.'", ")", "->", "str", ":", "command", "=", "'git describe --abbrev=12 --dirty'", ".", "split", "(", ...
Find closest tag for a git repository. Note: This defaults to `Semantic Version`_ tag matching. Args: __matcher: Glob-style tag pattern to match strict: Allow commit-ish, if no tag found git_dir: Repository to search Returns: Matching tag name .. _Semantic Vers...
[ "Find", "closest", "tag", "for", "a", "git", "repository", "." ]
ae505ef69a9feb739b5f4e62c5a8e6533104d3ea
https://github.com/JNRowe/jnrbase/blob/ae505ef69a9feb739b5f4e62c5a8e6533104d3ea/jnrbase/git.py#L26-L52
241,118
minus7/asif
asif/bot.py
Channel.on_message
def on_message(self, *args, accept_query=False, matcher=None, **kwargs): """ Convenience wrapper of `Client.on_message` pre-bound with `channel=self.name`. """ if accept_query: def new_matcher(msg: Message): ret = True if matcher: ...
python
def on_message(self, *args, accept_query=False, matcher=None, **kwargs): """ Convenience wrapper of `Client.on_message` pre-bound with `channel=self.name`. """ if accept_query: def new_matcher(msg: Message): ret = True if matcher: ...
[ "def", "on_message", "(", "self", ",", "*", "args", ",", "accept_query", "=", "False", ",", "matcher", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "accept_query", ":", "def", "new_matcher", "(", "msg", ":", "Message", ")", ":", "ret", "=", ...
Convenience wrapper of `Client.on_message` pre-bound with `channel=self.name`.
[ "Convenience", "wrapper", "of", "Client", ".", "on_message", "pre", "-", "bound", "with", "channel", "=", "self", ".", "name", "." ]
0d8acc5306ba93386ec679f69d466b56f099b877
https://github.com/minus7/asif/blob/0d8acc5306ba93386ec679f69d466b56f099b877/asif/bot.py#L56-L74
241,119
minus7/asif
asif/bot.py
Client.await_message
def await_message(self, *args, **kwargs) -> 'asyncio.Future[Message]': """ Block until a message matches. See `on_message` """ fut = asyncio.Future() @self.on_message(*args, **kwargs) async def handler(message): fut.set_result(message) # remove handler...
python
def await_message(self, *args, **kwargs) -> 'asyncio.Future[Message]': """ Block until a message matches. See `on_message` """ fut = asyncio.Future() @self.on_message(*args, **kwargs) async def handler(message): fut.set_result(message) # remove handler...
[ "def", "await_message", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "'asyncio.Future[Message]'", ":", "fut", "=", "asyncio", ".", "Future", "(", ")", "@", "self", ".", "on_message", "(", "*", "args", ",", "*", "*", "kwargs", ")...
Block until a message matches. See `on_message`
[ "Block", "until", "a", "message", "matches", ".", "See", "on_message" ]
0d8acc5306ba93386ec679f69d466b56f099b877
https://github.com/minus7/asif/blob/0d8acc5306ba93386ec679f69d466b56f099b877/asif/bot.py#L287-L297
241,120
minus7/asif
asif/bot.py
Client.await_command
def await_command(self, *args, **kwargs) -> 'asyncio.Future[IrcMessage]': """ Block until a command matches. See `on_command` """ fut = asyncio.Future() @self.on_command(*args, **kwargs) async def handler(msg): fut.set_result(msg) # remove handler when...
python
def await_command(self, *args, **kwargs) -> 'asyncio.Future[IrcMessage]': """ Block until a command matches. See `on_command` """ fut = asyncio.Future() @self.on_command(*args, **kwargs) async def handler(msg): fut.set_result(msg) # remove handler when...
[ "def", "await_command", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "'asyncio.Future[IrcMessage]'", ":", "fut", "=", "asyncio", ".", "Future", "(", ")", "@", "self", ".", "on_command", "(", "*", "args", ",", "*", "*", "kwargs", ...
Block until a command matches. See `on_command`
[ "Block", "until", "a", "command", "matches", ".", "See", "on_command" ]
0d8acc5306ba93386ec679f69d466b56f099b877
https://github.com/minus7/asif/blob/0d8acc5306ba93386ec679f69d466b56f099b877/asif/bot.py#L348-L358
241,121
minus7/asif
asif/bot.py
Client.message
async def message(self, recipient: str, text: str, notice: bool=False) -> None: """ Lower level messaging function used by User and Channel """ await self._send(cc.PRIVMSG if not notice else cc.NOTICE, recipient, rest=text)
python
async def message(self, recipient: str, text: str, notice: bool=False) -> None: """ Lower level messaging function used by User and Channel """ await self._send(cc.PRIVMSG if not notice else cc.NOTICE, recipient, rest=text)
[ "async", "def", "message", "(", "self", ",", "recipient", ":", "str", ",", "text", ":", "str", ",", "notice", ":", "bool", "=", "False", ")", "->", "None", ":", "await", "self", ".", "_send", "(", "cc", ".", "PRIVMSG", "if", "not", "notice", "else"...
Lower level messaging function used by User and Channel
[ "Lower", "level", "messaging", "function", "used", "by", "User", "and", "Channel" ]
0d8acc5306ba93386ec679f69d466b56f099b877
https://github.com/minus7/asif/blob/0d8acc5306ba93386ec679f69d466b56f099b877/asif/bot.py#L389-L393
241,122
minus7/asif
asif/bot.py
Client._bg
def _bg(self, coro: coroutine) -> asyncio.Task: """Run coro in background, log errors""" async def runner(): try: await coro except: self._log.exception("async: Coroutine raised exception") return asyncio.ensure_future(runner())
python
def _bg(self, coro: coroutine) -> asyncio.Task: """Run coro in background, log errors""" async def runner(): try: await coro except: self._log.exception("async: Coroutine raised exception") return asyncio.ensure_future(runner())
[ "def", "_bg", "(", "self", ",", "coro", ":", "coroutine", ")", "->", "asyncio", ".", "Task", ":", "async", "def", "runner", "(", ")", ":", "try", ":", "await", "coro", "except", ":", "self", ".", "_log", ".", "exception", "(", "\"async: Coroutine raise...
Run coro in background, log errors
[ "Run", "coro", "in", "background", "log", "errors" ]
0d8acc5306ba93386ec679f69d466b56f099b877
https://github.com/minus7/asif/blob/0d8acc5306ba93386ec679f69d466b56f099b877/asif/bot.py#L450-L457
241,123
minus7/asif
asif/bot.py
Module._populate
def _populate(self, client): """ Populate module with the client when available """ self.client = client for fn in self._buffered_calls: self._log.debug("Executing buffered call {}".format(fn)) fn()
python
def _populate(self, client): """ Populate module with the client when available """ self.client = client for fn in self._buffered_calls: self._log.debug("Executing buffered call {}".format(fn)) fn()
[ "def", "_populate", "(", "self", ",", "client", ")", ":", "self", ".", "client", "=", "client", "for", "fn", "in", "self", ".", "_buffered_calls", ":", "self", ".", "_log", ".", "debug", "(", "\"Executing buffered call {}\"", ".", "format", "(", "fn", ")...
Populate module with the client when available
[ "Populate", "module", "with", "the", "client", "when", "available" ]
0d8acc5306ba93386ec679f69d466b56f099b877
https://github.com/minus7/asif/blob/0d8acc5306ba93386ec679f69d466b56f099b877/asif/bot.py#L680-L687
241,124
b3j0f/schema
b3j0f/schema/utils.py
datatype2schemacls
def datatype2schemacls( _datatype, _registry=None, _factory=None, _force=True, _besteffort=True, **kwargs ): """Get a schema class which has been associated to input data type by the registry or the factory in this order. :param type datatype: data type from where get associated schema. ...
python
def datatype2schemacls( _datatype, _registry=None, _factory=None, _force=True, _besteffort=True, **kwargs ): """Get a schema class which has been associated to input data type by the registry or the factory in this order. :param type datatype: data type from where get associated schema. ...
[ "def", "datatype2schemacls", "(", "_datatype", ",", "_registry", "=", "None", ",", "_factory", "=", "None", ",", "_force", "=", "True", ",", "_besteffort", "=", "True", ",", "*", "*", "kwargs", ")", ":", "result", "=", "None", "gdbt", "=", "getbydatatype...
Get a schema class which has been associated to input data type by the registry or the factory in this order. :param type datatype: data type from where get associated schema. :param SchemaRegisgry _registry: registry from where call the getbydatatype . Default is the global registry. :param Sc...
[ "Get", "a", "schema", "class", "which", "has", "been", "associated", "to", "input", "data", "type", "by", "the", "registry", "or", "the", "factory", "in", "this", "order", "." ]
1c88c23337f5fef50254e65bd407112c43396dd9
https://github.com/b3j0f/schema/blob/1c88c23337f5fef50254e65bd407112c43396dd9/b3j0f/schema/utils.py#L51-L87
241,125
b3j0f/schema
b3j0f/schema/utils.py
data2schema
def data2schema( _data=None, _force=False, _besteffort=True, _registry=None, _factory=None, _buildkwargs=None, **kwargs ): """Get the schema able to instanciate input data. The default value of schema will be data. Can be used such as a decorator: ..code-block:: python @data2...
python
def data2schema( _data=None, _force=False, _besteffort=True, _registry=None, _factory=None, _buildkwargs=None, **kwargs ): """Get the schema able to instanciate input data. The default value of schema will be data. Can be used such as a decorator: ..code-block:: python @data2...
[ "def", "data2schema", "(", "_data", "=", "None", ",", "_force", "=", "False", ",", "_besteffort", "=", "True", ",", "_registry", "=", "None", ",", "_factory", "=", "None", ",", "_buildkwargs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "_d...
Get the schema able to instanciate input data. The default value of schema will be data. Can be used such as a decorator: ..code-block:: python @data2schema def example(): pass # return a function schema @data2schema(_registry=myregistry) def example(): pass # return a...
[ "Get", "the", "schema", "able", "to", "instanciate", "input", "data", "." ]
1c88c23337f5fef50254e65bd407112c43396dd9
https://github.com/b3j0f/schema/blob/1c88c23337f5fef50254e65bd407112c43396dd9/b3j0f/schema/utils.py#L90-L160
241,126
b3j0f/schema
b3j0f/schema/utils.py
data2schemacls
def data2schemacls(_data, **kwargs): """Convert a data to a schema cls. :param data: object or dictionary from where get a schema cls. :return: schema class. :rtype: type """ content = {} for key in list(kwargs): # fill kwargs kwargs[key] = data2schema(kwargs[key]) if isinsta...
python
def data2schemacls(_data, **kwargs): """Convert a data to a schema cls. :param data: object or dictionary from where get a schema cls. :return: schema class. :rtype: type """ content = {} for key in list(kwargs): # fill kwargs kwargs[key] = data2schema(kwargs[key]) if isinsta...
[ "def", "data2schemacls", "(", "_data", ",", "*", "*", "kwargs", ")", ":", "content", "=", "{", "}", "for", "key", "in", "list", "(", "kwargs", ")", ":", "# fill kwargs", "kwargs", "[", "key", "]", "=", "data2schema", "(", "kwargs", "[", "key", "]", ...
Convert a data to a schema cls. :param data: object or dictionary from where get a schema cls. :return: schema class. :rtype: type
[ "Convert", "a", "data", "to", "a", "schema", "cls", "." ]
1c88c23337f5fef50254e65bd407112c43396dd9
https://github.com/b3j0f/schema/blob/1c88c23337f5fef50254e65bd407112c43396dd9/b3j0f/schema/utils.py#L163-L198
241,127
b3j0f/schema
b3j0f/schema/utils.py
validate
def validate(schema, data, owner=None): """Validate input data with input schema. :param Schema schema: schema able to validate input data. :param data: data to validate. :param Schema owner: input schema parent schema. :raises: Exception if the data is not validated. """ schema._validate(d...
python
def validate(schema, data, owner=None): """Validate input data with input schema. :param Schema schema: schema able to validate input data. :param data: data to validate. :param Schema owner: input schema parent schema. :raises: Exception if the data is not validated. """ schema._validate(d...
[ "def", "validate", "(", "schema", ",", "data", ",", "owner", "=", "None", ")", ":", "schema", ".", "_validate", "(", "data", "=", "data", ",", "owner", "=", "owner", ")" ]
Validate input data with input schema. :param Schema schema: schema able to validate input data. :param data: data to validate. :param Schema owner: input schema parent schema. :raises: Exception if the data is not validated.
[ "Validate", "input", "data", "with", "input", "schema", "." ]
1c88c23337f5fef50254e65bd407112c43396dd9
https://github.com/b3j0f/schema/blob/1c88c23337f5fef50254e65bd407112c43396dd9/b3j0f/schema/utils.py#L235-L243
241,128
b3j0f/schema
b3j0f/schema/utils.py
dump
def dump(schema): """Get a serialized value of input schema. :param Schema schema: schema to serialize. :rtype: dict """ result = {} for name, _ in iteritems(schema.getschemas()): if hasattr(schema, name): val = getattr(schema, name) if isinstance(val, Dynamic...
python
def dump(schema): """Get a serialized value of input schema. :param Schema schema: schema to serialize. :rtype: dict """ result = {} for name, _ in iteritems(schema.getschemas()): if hasattr(schema, name): val = getattr(schema, name) if isinstance(val, Dynamic...
[ "def", "dump", "(", "schema", ")", ":", "result", "=", "{", "}", "for", "name", ",", "_", "in", "iteritems", "(", "schema", ".", "getschemas", "(", ")", ")", ":", "if", "hasattr", "(", "schema", ",", "name", ")", ":", "val", "=", "getattr", "(", ...
Get a serialized value of input schema. :param Schema schema: schema to serialize. :rtype: dict
[ "Get", "a", "serialized", "value", "of", "input", "schema", "." ]
1c88c23337f5fef50254e65bd407112c43396dd9
https://github.com/b3j0f/schema/blob/1c88c23337f5fef50254e65bd407112c43396dd9/b3j0f/schema/utils.py#L246-L267
241,129
b3j0f/schema
b3j0f/schema/utils.py
updatecontent
def updatecontent(schemacls=None, updateparents=True, exclude=None): """Transform all schema class attributes to schemas. It can be used such as a decorator in order to ensure to update attributes with the decorated schema but take care to the limitation to use old style method call for overidden metho...
python
def updatecontent(schemacls=None, updateparents=True, exclude=None): """Transform all schema class attributes to schemas. It can be used such as a decorator in order to ensure to update attributes with the decorated schema but take care to the limitation to use old style method call for overidden metho...
[ "def", "updatecontent", "(", "schemacls", "=", "None", ",", "updateparents", "=", "True", ",", "exclude", "=", "None", ")", ":", "if", "schemacls", "is", "None", ":", "return", "lambda", "schemacls", ":", "updatecontent", "(", "schemacls", "=", "schemacls", ...
Transform all schema class attributes to schemas. It can be used such as a decorator in order to ensure to update attributes with the decorated schema but take care to the limitation to use old style method call for overidden methods. .. example: @updatecontent # update content at the end of ...
[ "Transform", "all", "schema", "class", "attributes", "to", "schemas", "." ]
1c88c23337f5fef50254e65bd407112c43396dd9
https://github.com/b3j0f/schema/blob/1c88c23337f5fef50254e65bd407112c43396dd9/b3j0f/schema/utils.py#L309-L390
241,130
ryanleland/Akispy
akispy/__init__.py
Connection.verify_key
def verify_key(self, url): """For verifying your API key. Provide the URL of your site or blog you will be checking spam from. """ response = self._request('verify-key', { 'blog': url, 'key': self._key }) if response.stat...
python
def verify_key(self, url): """For verifying your API key. Provide the URL of your site or blog you will be checking spam from. """ response = self._request('verify-key', { 'blog': url, 'key': self._key }) if response.stat...
[ "def", "verify_key", "(", "self", ",", "url", ")", ":", "response", "=", "self", ".", "_request", "(", "'verify-key'", ",", "{", "'blog'", ":", "url", ",", "'key'", ":", "self", ".", "_key", "}", ")", "if", "response", ".", "status", "is", "200", "...
For verifying your API key. Provide the URL of your site or blog you will be checking spam from.
[ "For", "verifying", "your", "API", "key", ".", "Provide", "the", "URL", "of", "your", "site", "or", "blog", "you", "will", "be", "checking", "spam", "from", "." ]
dbbb85a1d1b027051e11179289cc9067cb90baf6
https://github.com/ryanleland/Akispy/blob/dbbb85a1d1b027051e11179289cc9067cb90baf6/akispy/__init__.py#L29-L44
241,131
ryanleland/Akispy
akispy/__init__.py
Connection.comment_check
def comment_check(self, params): """For checking comments.""" # Check required params for comment-check for required in ['blog', 'user_ip', 'user_agent']: if required not in params: raise MissingParams(required) response = self._request('comment-che...
python
def comment_check(self, params): """For checking comments.""" # Check required params for comment-check for required in ['blog', 'user_ip', 'user_agent']: if required not in params: raise MissingParams(required) response = self._request('comment-che...
[ "def", "comment_check", "(", "self", ",", "params", ")", ":", "# Check required params for comment-check", "for", "required", "in", "[", "'blog'", ",", "'user_ip'", ",", "'user_agent'", "]", ":", "if", "required", "not", "in", "params", ":", "raise", "MissingPar...
For checking comments.
[ "For", "checking", "comments", "." ]
dbbb85a1d1b027051e11179289cc9067cb90baf6
https://github.com/ryanleland/Akispy/blob/dbbb85a1d1b027051e11179289cc9067cb90baf6/akispy/__init__.py#L46-L60
241,132
ryanleland/Akispy
akispy/__init__.py
Connection.submit_ham
def submit_ham(self, params): """For submitting a ham comment to Akismet.""" # Check required params for submit-ham for required in ['blog', 'user_ip', 'user_agent']: if required not in params: raise MissingParams(required) response = self._request(...
python
def submit_ham(self, params): """For submitting a ham comment to Akismet.""" # Check required params for submit-ham for required in ['blog', 'user_ip', 'user_agent']: if required not in params: raise MissingParams(required) response = self._request(...
[ "def", "submit_ham", "(", "self", ",", "params", ")", ":", "# Check required params for submit-ham", "for", "required", "in", "[", "'blog'", ",", "'user_ip'", ",", "'user_agent'", "]", ":", "if", "required", "not", "in", "params", ":", "raise", "MissingParams", ...
For submitting a ham comment to Akismet.
[ "For", "submitting", "a", "ham", "comment", "to", "Akismet", "." ]
dbbb85a1d1b027051e11179289cc9067cb90baf6
https://github.com/ryanleland/Akispy/blob/dbbb85a1d1b027051e11179289cc9067cb90baf6/akispy/__init__.py#L77-L90
241,133
ryanleland/Akispy
akispy/__init__.py
Connection._request
def _request(self, function, params, method='POST', headers={}): """Builds a request object.""" if method is 'POST': params = urllib.parse.urlencode(params) headers = { "Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain" } path = ...
python
def _request(self, function, params, method='POST', headers={}): """Builds a request object.""" if method is 'POST': params = urllib.parse.urlencode(params) headers = { "Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain" } path = ...
[ "def", "_request", "(", "self", ",", "function", ",", "params", ",", "method", "=", "'POST'", ",", "headers", "=", "{", "}", ")", ":", "if", "method", "is", "'POST'", ":", "params", "=", "urllib", ".", "parse", ".", "urlencode", "(", "params", ")", ...
Builds a request object.
[ "Builds", "a", "request", "object", "." ]
dbbb85a1d1b027051e11179289cc9067cb90baf6
https://github.com/ryanleland/Akispy/blob/dbbb85a1d1b027051e11179289cc9067cb90baf6/akispy/__init__.py#L92-L102
241,134
Apitax/Apitax
apitax/api/controllers/migrations/apitax_controller.py
refresh_token
def refresh_token(): # noqa: E501 """Refreshes login token using refresh token Refreshes login token using refresh token # noqa: E501 :rtype: UserAuth """ current_user = get_jwt_identity() if not current_user: return ErrorResponse(status=401, message="Not logged in") access_token...
python
def refresh_token(): # noqa: E501 """Refreshes login token using refresh token Refreshes login token using refresh token # noqa: E501 :rtype: UserAuth """ current_user = get_jwt_identity() if not current_user: return ErrorResponse(status=401, message="Not logged in") access_token...
[ "def", "refresh_token", "(", ")", ":", "# noqa: E501", "current_user", "=", "get_jwt_identity", "(", ")", "if", "not", "current_user", ":", "return", "ErrorResponse", "(", "status", "=", "401", ",", "message", "=", "\"Not logged in\"", ")", "access_token", "=", ...
Refreshes login token using refresh token Refreshes login token using refresh token # noqa: E501 :rtype: UserAuth
[ "Refreshes", "login", "token", "using", "refresh", "token" ]
3883e45f17e01eba4edac9d1bba42f0e7a748682
https://github.com/Apitax/Apitax/blob/3883e45f17e01eba4edac9d1bba42f0e7a748682/apitax/api/controllers/migrations/apitax_controller.py#L182-L194
241,135
b3j0f/schema
b3j0f/schema/lang/factory.py
build
def build(_resource, _cache=True, **kwargs): """Build a schema from input _resource. :param _resource: object from where get the right schema. :param bool _cache: use cache system. :rtype: Schema. """ return _SCHEMAFACTORY.build(_resource=_resource, _cache=True, **kwargs)
python
def build(_resource, _cache=True, **kwargs): """Build a schema from input _resource. :param _resource: object from where get the right schema. :param bool _cache: use cache system. :rtype: Schema. """ return _SCHEMAFACTORY.build(_resource=_resource, _cache=True, **kwargs)
[ "def", "build", "(", "_resource", ",", "_cache", "=", "True", ",", "*", "*", "kwargs", ")", ":", "return", "_SCHEMAFACTORY", ".", "build", "(", "_resource", "=", "_resource", ",", "_cache", "=", "True", ",", "*", "*", "kwargs", ")" ]
Build a schema from input _resource. :param _resource: object from where get the right schema. :param bool _cache: use cache system. :rtype: Schema.
[ "Build", "a", "schema", "from", "input", "_resource", "." ]
1c88c23337f5fef50254e65bd407112c43396dd9
https://github.com/b3j0f/schema/blob/1c88c23337f5fef50254e65bd407112c43396dd9/b3j0f/schema/lang/factory.py#L185-L192
241,136
b3j0f/schema
b3j0f/schema/lang/factory.py
SchemaFactory.registerbuilder
def registerbuilder(self, builder, name=None): """Register a schema builder with a key name. Can be used such as a decorator where the builder can be the name for a short use. :param SchemaBuilder builder: schema builder. :param str name: builder name. Default is builder name o...
python
def registerbuilder(self, builder, name=None): """Register a schema builder with a key name. Can be used such as a decorator where the builder can be the name for a short use. :param SchemaBuilder builder: schema builder. :param str name: builder name. Default is builder name o...
[ "def", "registerbuilder", "(", "self", ",", "builder", ",", "name", "=", "None", ")", ":", "if", "name", "is", "None", ":", "name", "=", "uuid", "(", ")", "self", ".", "_builders", "[", "name", "]", "=", "builder", "return", "builder" ]
Register a schema builder with a key name. Can be used such as a decorator where the builder can be the name for a short use. :param SchemaBuilder builder: schema builder. :param str name: builder name. Default is builder name or generated.
[ "Register", "a", "schema", "builder", "with", "a", "key", "name", "." ]
1c88c23337f5fef50254e65bd407112c43396dd9
https://github.com/b3j0f/schema/blob/1c88c23337f5fef50254e65bd407112c43396dd9/b3j0f/schema/lang/factory.py#L54-L68
241,137
b3j0f/schema
b3j0f/schema/lang/factory.py
SchemaFactory.build
def build(self, _resource, _cache=True, updatecontent=True, **kwargs): """Build a schema class from input _resource. :param _resource: object from where get the right schema. :param bool _cache: use _cache system. :param bool updatecontent: if True (default) update result. :rtyp...
python
def build(self, _resource, _cache=True, updatecontent=True, **kwargs): """Build a schema class from input _resource. :param _resource: object from where get the right schema. :param bool _cache: use _cache system. :param bool updatecontent: if True (default) update result. :rtyp...
[ "def", "build", "(", "self", ",", "_resource", ",", "_cache", "=", "True", ",", "updatecontent", "=", "True", ",", "*", "*", "kwargs", ")", ":", "result", "=", "None", "if", "_cache", "and", "_resource", "in", "self", ".", "_schemasbyresource", ":", "r...
Build a schema class from input _resource. :param _resource: object from where get the right schema. :param bool _cache: use _cache system. :param bool updatecontent: if True (default) update result. :rtype: Schema.
[ "Build", "a", "schema", "class", "from", "input", "_resource", "." ]
1c88c23337f5fef50254e65bd407112c43396dd9
https://github.com/b3j0f/schema/blob/1c88c23337f5fef50254e65bd407112c43396dd9/b3j0f/schema/lang/factory.py#L93-L127
241,138
formwork-io/lazarus
lazarus/__init__.py
stop
def stop(): '''Stops lazarus, regardless of which mode it was started in. For example: >>> import lazarus >>> lazarus.default() >>> lazarus.stop() ''' global _active if not _active: msg = 'lazarus is not active' raise RuntimeWarning(msg) _observer.stop()...
python
def stop(): '''Stops lazarus, regardless of which mode it was started in. For example: >>> import lazarus >>> lazarus.default() >>> lazarus.stop() ''' global _active if not _active: msg = 'lazarus is not active' raise RuntimeWarning(msg) _observer.stop()...
[ "def", "stop", "(", ")", ":", "global", "_active", "if", "not", "_active", ":", "msg", "=", "'lazarus is not active'", "raise", "RuntimeWarning", "(", "msg", ")", "_observer", ".", "stop", "(", ")", "_observer", ".", "join", "(", ")", "_deactivate", "(", ...
Stops lazarus, regardless of which mode it was started in. For example: >>> import lazarus >>> lazarus.default() >>> lazarus.stop()
[ "Stops", "lazarus", "regardless", "of", "which", "mode", "it", "was", "started", "in", "." ]
b2b6120fe06d69c23b4f41d55b6d71860a9fdeaa
https://github.com/formwork-io/lazarus/blob/b2b6120fe06d69c23b4f41d55b6d71860a9fdeaa/lazarus/__init__.py#L32-L47
241,139
formwork-io/lazarus
lazarus/__init__.py
_restart
def _restart(): '''Schedule the restart; returning True if cancelled, False otherwise.''' if _restart_cb: # https://github.com/formwork-io/lazarus/issues/2 if _restart_cb() is not None: # restart cancelled return True def down_watchdog(): _observer.stop() ...
python
def _restart(): '''Schedule the restart; returning True if cancelled, False otherwise.''' if _restart_cb: # https://github.com/formwork-io/lazarus/issues/2 if _restart_cb() is not None: # restart cancelled return True def down_watchdog(): _observer.stop() ...
[ "def", "_restart", "(", ")", ":", "if", "_restart_cb", ":", "# https://github.com/formwork-io/lazarus/issues/2", "if", "_restart_cb", "(", ")", "is", "not", "None", ":", "# restart cancelled", "return", "True", "def", "down_watchdog", "(", ")", ":", "_observer", "...
Schedule the restart; returning True if cancelled, False otherwise.
[ "Schedule", "the", "restart", ";", "returning", "True", "if", "cancelled", "False", "otherwise", "." ]
b2b6120fe06d69c23b4f41d55b6d71860a9fdeaa
https://github.com/formwork-io/lazarus/blob/b2b6120fe06d69c23b4f41d55b6d71860a9fdeaa/lazarus/__init__.py#L66-L90
241,140
formwork-io/lazarus
lazarus/__init__.py
default
def default(restart_cb=None, restart_func=None, close_fds=True): '''Sets up lazarus in default mode. See the :py:func:`custom` function for a more powerful mode of use. The default mode of lazarus is to watch all modules rooted at ``PYTHONPATH`` for changes and restart when they take place. Keywo...
python
def default(restart_cb=None, restart_func=None, close_fds=True): '''Sets up lazarus in default mode. See the :py:func:`custom` function for a more powerful mode of use. The default mode of lazarus is to watch all modules rooted at ``PYTHONPATH`` for changes and restart when they take place. Keywo...
[ "def", "default", "(", "restart_cb", "=", "None", ",", "restart_func", "=", "None", ",", "close_fds", "=", "True", ")", ":", "if", "_active", ":", "msg", "=", "'lazarus is already active'", "raise", "RuntimeWarning", "(", "msg", ")", "_python_path", "=", "os...
Sets up lazarus in default mode. See the :py:func:`custom` function for a more powerful mode of use. The default mode of lazarus is to watch all modules rooted at ``PYTHONPATH`` for changes and restart when they take place. Keyword arguments: restart_cb -- Callback invoked prior to restartin...
[ "Sets", "up", "lazarus", "in", "default", "mode", "." ]
b2b6120fe06d69c23b4f41d55b6d71860a9fdeaa
https://github.com/formwork-io/lazarus/blob/b2b6120fe06d69c23b4f41d55b6d71860a9fdeaa/lazarus/__init__.py#L119-L210
241,141
formwork-io/lazarus
lazarus/__init__.py
custom
def custom(srcpaths, event_cb=None, poll_interval=1, recurse=True, restart_cb=None, restart_func=None, close_fds=True): '''Sets up lazarus in custom mode. See the :py:func:`default` function for a simpler mode of use. The custom mode of lazarus is to watch all modules rooted at any of the s...
python
def custom(srcpaths, event_cb=None, poll_interval=1, recurse=True, restart_cb=None, restart_func=None, close_fds=True): '''Sets up lazarus in custom mode. See the :py:func:`default` function for a simpler mode of use. The custom mode of lazarus is to watch all modules rooted at any of the s...
[ "def", "custom", "(", "srcpaths", ",", "event_cb", "=", "None", ",", "poll_interval", "=", "1", ",", "recurse", "=", "True", ",", "restart_cb", "=", "None", ",", "restart_func", "=", "None", ",", "close_fds", "=", "True", ")", ":", "if", "_active", ":"...
Sets up lazarus in custom mode. See the :py:func:`default` function for a simpler mode of use. The custom mode of lazarus is to watch all modules rooted at any of the source paths provided for changes and restart when they take place. Keyword arguments: event_cb -- Callback invoked when a fi...
[ "Sets", "up", "lazarus", "in", "custom", "mode", "." ]
b2b6120fe06d69c23b4f41d55b6d71860a9fdeaa
https://github.com/formwork-io/lazarus/blob/b2b6120fe06d69c23b4f41d55b6d71860a9fdeaa/lazarus/__init__.py#L213-L337
241,142
0compute/xtraceback
xtraceback/xtraceback.py
XTraceback.tty_stream
def tty_stream(self): """ Whether or not our stream is a tty """ return hasattr(self.options.stream, "isatty") \ and self.options.stream.isatty()
python
def tty_stream(self): """ Whether or not our stream is a tty """ return hasattr(self.options.stream, "isatty") \ and self.options.stream.isatty()
[ "def", "tty_stream", "(", "self", ")", ":", "return", "hasattr", "(", "self", ".", "options", ".", "stream", ",", "\"isatty\"", ")", "and", "self", ".", "options", ".", "stream", ".", "isatty", "(", ")" ]
Whether or not our stream is a tty
[ "Whether", "or", "not", "our", "stream", "is", "a", "tty" ]
5f4ae11cf21e6eea830d79aed66d3cd91bd013cd
https://github.com/0compute/xtraceback/blob/5f4ae11cf21e6eea830d79aed66d3cd91bd013cd/xtraceback/xtraceback.py#L107-L112
241,143
0compute/xtraceback
xtraceback/xtraceback.py
XTraceback.color
def color(self): """ Whether or not color should be output """ return self.tty_stream if self.options.color is None \ else self.options.color
python
def color(self): """ Whether or not color should be output """ return self.tty_stream if self.options.color is None \ else self.options.color
[ "def", "color", "(", "self", ")", ":", "return", "self", ".", "tty_stream", "if", "self", ".", "options", ".", "color", "is", "None", "else", "self", ".", "options", ".", "color" ]
Whether or not color should be output
[ "Whether", "or", "not", "color", "should", "be", "output" ]
5f4ae11cf21e6eea830d79aed66d3cd91bd013cd
https://github.com/0compute/xtraceback/blob/5f4ae11cf21e6eea830d79aed66d3cd91bd013cd/xtraceback/xtraceback.py#L115-L120
241,144
bitlabstudio/django-unshorten
unshorten/decorators.py
api_auth
def api_auth(func): """ If the user is not logged in, this decorator looks for basic HTTP auth data in the request header. """ @wraps(func) def _decorator(request, *args, **kwargs): authentication = APIAuthentication(request) if authentication.authenticate(): return ...
python
def api_auth(func): """ If the user is not logged in, this decorator looks for basic HTTP auth data in the request header. """ @wraps(func) def _decorator(request, *args, **kwargs): authentication = APIAuthentication(request) if authentication.authenticate(): return ...
[ "def", "api_auth", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "_decorator", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "authentication", "=", "APIAuthentication", "(", "request", ")", "if", "authentication", ...
If the user is not logged in, this decorator looks for basic HTTP auth data in the request header.
[ "If", "the", "user", "is", "not", "logged", "in", "this", "decorator", "looks", "for", "basic", "HTTP", "auth", "data", "in", "the", "request", "header", "." ]
6d184de908bb9df3aad5ac3fd9732d976afb6953
https://github.com/bitlabstudio/django-unshorten/blob/6d184de908bb9df3aad5ac3fd9732d976afb6953/unshorten/decorators.py#L9-L21
241,145
biocore/mustached-octo-ironman
moi/job.py
_status_change
def _status_change(id, new_status): """Update the status of a job The status associated with the id is updated, an update command is issued to the job's pubsub, and and the old status is returned. Parameters ---------- id : str The job ID new_status : str The status change ...
python
def _status_change(id, new_status): """Update the status of a job The status associated with the id is updated, an update command is issued to the job's pubsub, and and the old status is returned. Parameters ---------- id : str The job ID new_status : str The status change ...
[ "def", "_status_change", "(", "id", ",", "new_status", ")", ":", "job_info", "=", "json", ".", "loads", "(", "r_client", ".", "get", "(", "id", ")", ")", "old_status", "=", "job_info", "[", "'status'", "]", "job_info", "[", "'status'", "]", "=", "new_s...
Update the status of a job The status associated with the id is updated, an update command is issued to the job's pubsub, and and the old status is returned. Parameters ---------- id : str The job ID new_status : str The status change Returns ------- str Th...
[ "Update", "the", "status", "of", "a", "job" ]
54128d8fdff327e1b7ffd9bb77bf38c3df9526d7
https://github.com/biocore/mustached-octo-ironman/blob/54128d8fdff327e1b7ffd9bb77bf38c3df9526d7/moi/job.py#L57-L80
241,146
biocore/mustached-octo-ironman
moi/job.py
_deposit_payload
def _deposit_payload(to_deposit): """Store job info, and publish an update Parameters ---------- to_deposit : dict The job info """ pubsub = to_deposit['pubsub'] id = to_deposit['id'] with r_client.pipeline() as pipe: pipe.set(id, json.dumps(to_deposit), ex=REDIS_KEY_T...
python
def _deposit_payload(to_deposit): """Store job info, and publish an update Parameters ---------- to_deposit : dict The job info """ pubsub = to_deposit['pubsub'] id = to_deposit['id'] with r_client.pipeline() as pipe: pipe.set(id, json.dumps(to_deposit), ex=REDIS_KEY_T...
[ "def", "_deposit_payload", "(", "to_deposit", ")", ":", "pubsub", "=", "to_deposit", "[", "'pubsub'", "]", "id", "=", "to_deposit", "[", "'id'", "]", "with", "r_client", ".", "pipeline", "(", ")", "as", "pipe", ":", "pipe", ".", "set", "(", "id", ",", ...
Store job info, and publish an update Parameters ---------- to_deposit : dict The job info
[ "Store", "job", "info", "and", "publish", "an", "update" ]
54128d8fdff327e1b7ffd9bb77bf38c3df9526d7
https://github.com/biocore/mustached-octo-ironman/blob/54128d8fdff327e1b7ffd9bb77bf38c3df9526d7/moi/job.py#L83-L98
241,147
biocore/mustached-octo-ironman
moi/job.py
_redis_wrap
def _redis_wrap(job_info, func, *args, **kwargs): """Wrap something to compute The function that will have available, via kwargs['moi_update_status'], a method to modify the job status. This method can be used within the executing function by: old_status = kwargs['moi_update_status']('my new s...
python
def _redis_wrap(job_info, func, *args, **kwargs): """Wrap something to compute The function that will have available, via kwargs['moi_update_status'], a method to modify the job status. This method can be used within the executing function by: old_status = kwargs['moi_update_status']('my new s...
[ "def", "_redis_wrap", "(", "job_info", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "status_changer", "=", "partial", "(", "_status_change", ",", "job_info", "[", "'id'", "]", ")", "kwargs", "[", "'moi_update_status'", "]", "=", "sta...
Wrap something to compute The function that will have available, via kwargs['moi_update_status'], a method to modify the job status. This method can be used within the executing function by: old_status = kwargs['moi_update_status']('my new status') Parameters ---------- job_info : dic...
[ "Wrap", "something", "to", "compute" ]
54128d8fdff327e1b7ffd9bb77bf38c3df9526d7
https://github.com/biocore/mustached-octo-ironman/blob/54128d8fdff327e1b7ffd9bb77bf38c3df9526d7/moi/job.py#L101-L154
241,148
biocore/mustached-octo-ironman
moi/job.py
submit
def submit(ctx_name, parent_id, name, url, func, *args, **kwargs): """Submit through a context Parameters ---------- ctx_name : str The name of the context to submit through parent_id : str The ID of the group that the job is a part of. name : str The name of the job ...
python
def submit(ctx_name, parent_id, name, url, func, *args, **kwargs): """Submit through a context Parameters ---------- ctx_name : str The name of the context to submit through parent_id : str The ID of the group that the job is a part of. name : str The name of the job ...
[ "def", "submit", "(", "ctx_name", ",", "parent_id", ",", "name", ",", "url", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "ctx_name", ",", "Context", ")", ":", "ctx", "=", "ctx_name", "else", ":", "ctx"...
Submit through a context Parameters ---------- ctx_name : str The name of the context to submit through parent_id : str The ID of the group that the job is a part of. name : str The name of the job url : str The handler that can take the results (e.g., /beta_dive...
[ "Submit", "through", "a", "context" ]
54128d8fdff327e1b7ffd9bb77bf38c3df9526d7
https://github.com/biocore/mustached-octo-ironman/blob/54128d8fdff327e1b7ffd9bb77bf38c3df9526d7/moi/job.py#L157-L188
241,149
biocore/mustached-octo-ironman
moi/job.py
_submit
def _submit(ctx, parent_id, name, url, func, *args, **kwargs): """Submit a function to a cluster Parameters ---------- parent_id : str The ID of the group that the job is a part of. name : str The name of the job url : str The handler that can take the results (e.g., /be...
python
def _submit(ctx, parent_id, name, url, func, *args, **kwargs): """Submit a function to a cluster Parameters ---------- parent_id : str The ID of the group that the job is a part of. name : str The name of the job url : str The handler that can take the results (e.g., /be...
[ "def", "_submit", "(", "ctx", ",", "parent_id", ",", "name", ",", "url", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "parent_info", "=", "r_client", ".", "get", "(", "parent_id", ")", "if", "parent_info", "is", "None", ":", "p...
Submit a function to a cluster Parameters ---------- parent_id : str The ID of the group that the job is a part of. name : str The name of the job url : str The handler that can take the results (e.g., /beta_diversity/) func : function The function to execute. An...
[ "Submit", "a", "function", "to", "a", "cluster" ]
54128d8fdff327e1b7ffd9bb77bf38c3df9526d7
https://github.com/biocore/mustached-octo-ironman/blob/54128d8fdff327e1b7ffd9bb77bf38c3df9526d7/moi/job.py#L191-L235
241,150
andreycizov/python-xrpc
xrpc/trace.py
trc
def trc(postfix: Optional[str] = None, *, depth=1) -> logging.Logger: """ Automatically generate a logger from the calling function :param postfix: append another logger name on top this :param depth: depth of the call stack at which to capture the caller name :return: instance of a logger with a c...
python
def trc(postfix: Optional[str] = None, *, depth=1) -> logging.Logger: """ Automatically generate a logger from the calling function :param postfix: append another logger name on top this :param depth: depth of the call stack at which to capture the caller name :return: instance of a logger with a c...
[ "def", "trc", "(", "postfix", ":", "Optional", "[", "str", "]", "=", "None", ",", "*", ",", "depth", "=", "1", ")", "->", "logging", ".", "Logger", ":", "x", "=", "inspect", ".", "stack", "(", ")", "[", "depth", "]", "code", "=", "x", "[", "0...
Automatically generate a logger from the calling function :param postfix: append another logger name on top this :param depth: depth of the call stack at which to capture the caller name :return: instance of a logger with a correct path to a current caller
[ "Automatically", "generate", "a", "logger", "from", "the", "calling", "function" ]
4f916383cda7de3272962f3ba07a64f7ec451098
https://github.com/andreycizov/python-xrpc/blob/4f916383cda7de3272962f3ba07a64f7ec451098/xrpc/trace.py#L32-L55
241,151
mdeous/fatbotslim
fatbotslim/irc/tcp.py
TCP._recv_loop
def _recv_loop(self): """ Waits for data forever and feeds the input queue. """ while True: try: data = self._socket.recv(4096) self._ibuffer += data while '\r\n' in self._ibuffer: line, self._ibuffer = self....
python
def _recv_loop(self): """ Waits for data forever and feeds the input queue. """ while True: try: data = self._socket.recv(4096) self._ibuffer += data while '\r\n' in self._ibuffer: line, self._ibuffer = self....
[ "def", "_recv_loop", "(", "self", ")", ":", "while", "True", ":", "try", ":", "data", "=", "self", ".", "_socket", ".", "recv", "(", "4096", ")", "self", ".", "_ibuffer", "+=", "data", "while", "'\\r\\n'", "in", "self", ".", "_ibuffer", ":", "line", ...
Waits for data forever and feeds the input queue.
[ "Waits", "for", "data", "forever", "and", "feeds", "the", "input", "queue", "." ]
341595d24454a79caee23750eac271f9d0626c88
https://github.com/mdeous/fatbotslim/blob/341595d24454a79caee23750eac271f9d0626c88/fatbotslim/irc/tcp.py#L73-L85
241,152
mdeous/fatbotslim
fatbotslim/irc/tcp.py
TCP._send_loop
def _send_loop(self): """ Waits for data in the output queue to send. """ while True: try: line = self.oqueue.get().splitlines()[0][:500] self._obuffer += line + '\r\n' while self._obuffer: sent = self._socke...
python
def _send_loop(self): """ Waits for data in the output queue to send. """ while True: try: line = self.oqueue.get().splitlines()[0][:500] self._obuffer += line + '\r\n' while self._obuffer: sent = self._socke...
[ "def", "_send_loop", "(", "self", ")", ":", "while", "True", ":", "try", ":", "line", "=", "self", ".", "oqueue", ".", "get", "(", ")", ".", "splitlines", "(", ")", "[", "0", "]", "[", ":", "500", "]", "self", ".", "_obuffer", "+=", "line", "+"...
Waits for data in the output queue to send.
[ "Waits", "for", "data", "in", "the", "output", "queue", "to", "send", "." ]
341595d24454a79caee23750eac271f9d0626c88
https://github.com/mdeous/fatbotslim/blob/341595d24454a79caee23750eac271f9d0626c88/fatbotslim/irc/tcp.py#L87-L99
241,153
mdeous/fatbotslim
fatbotslim/irc/tcp.py
SSL._create_socket
def _create_socket(self): """ Creates a new SSL enabled socket and sets its timeout. """ log.warning('No certificate check is performed for SSL connections') s = super(SSL, self)._create_socket() return wrap_socket(s)
python
def _create_socket(self): """ Creates a new SSL enabled socket and sets its timeout. """ log.warning('No certificate check is performed for SSL connections') s = super(SSL, self)._create_socket() return wrap_socket(s)
[ "def", "_create_socket", "(", "self", ")", ":", "log", ".", "warning", "(", "'No certificate check is performed for SSL connections'", ")", "s", "=", "super", "(", "SSL", ",", "self", ")", ".", "_create_socket", "(", ")", "return", "wrap_socket", "(", "s", ")"...
Creates a new SSL enabled socket and sets its timeout.
[ "Creates", "a", "new", "SSL", "enabled", "socket", "and", "sets", "its", "timeout", "." ]
341595d24454a79caee23750eac271f9d0626c88
https://github.com/mdeous/fatbotslim/blob/341595d24454a79caee23750eac271f9d0626c88/fatbotslim/irc/tcp.py#L125-L131
241,154
openstack/stacktach-stackdistiller
stackdistiller/distiller.py
load_config
def load_config(filename): """Load the event definitions from yaml config file.""" logger.debug("Event Definitions configuration file: %s", filename) with open(filename, 'r') as cf: config = cf.read() try: events_config = yaml.safe_load(config) except yaml.YAMLError as err: ...
python
def load_config(filename): """Load the event definitions from yaml config file.""" logger.debug("Event Definitions configuration file: %s", filename) with open(filename, 'r') as cf: config = cf.read() try: events_config = yaml.safe_load(config) except yaml.YAMLError as err: ...
[ "def", "load_config", "(", "filename", ")", ":", "logger", ".", "debug", "(", "\"Event Definitions configuration file: %s\"", ",", "filename", ")", "with", "open", "(", "filename", ",", "'r'", ")", "as", "cf", ":", "config", "=", "cf", ".", "read", "(", ")...
Load the event definitions from yaml config file.
[ "Load", "the", "event", "definitions", "from", "yaml", "config", "file", "." ]
38cc32994cc5411c3f7c76f31ef3ea8b3245e871
https://github.com/openstack/stacktach-stackdistiller/blob/38cc32994cc5411c3f7c76f31ef3ea8b3245e871/stackdistiller/distiller.py#L47-L72
241,155
openstack/stacktach-stackdistiller
stackdistiller/distiller.py
EventDefinition._extract_when
def _extract_when(body): """Extract the generated datetime from the notification.""" # NOTE: I am keeping the logic the same as it was in openstack # code, However, *ALL* notifications should have a 'timestamp' # field, it's part of the notification envelope spec. If this was # ...
python
def _extract_when(body): """Extract the generated datetime from the notification.""" # NOTE: I am keeping the logic the same as it was in openstack # code, However, *ALL* notifications should have a 'timestamp' # field, it's part of the notification envelope spec. If this was # ...
[ "def", "_extract_when", "(", "body", ")", ":", "# NOTE: I am keeping the logic the same as it was in openstack", "# code, However, *ALL* notifications should have a 'timestamp'", "# field, it's part of the notification envelope spec. If this was", "# put here because some openstack project is gene...
Extract the generated datetime from the notification.
[ "Extract", "the", "generated", "datetime", "from", "the", "notification", "." ]
38cc32994cc5411c3f7c76f31ef3ea8b3245e871
https://github.com/openstack/stacktach-stackdistiller/blob/38cc32994cc5411c3f7c76f31ef3ea8b3245e871/stackdistiller/distiller.py#L259-L271
241,156
ErikBjare/pyzenobase
pyzenobase/zenobase_api.py
ZenobaseAPI.list_buckets
def list_buckets(self, offset=0, limit=100): """Limit breaks above 100""" # TODO: If limit > 100, do multiple fetches if limit > 100: raise Exception("Zenobase can't handle limits over 100") return self._get("/users/{}/buckets/?order=label&offset={}&limit={}".format(self.clie...
python
def list_buckets(self, offset=0, limit=100): """Limit breaks above 100""" # TODO: If limit > 100, do multiple fetches if limit > 100: raise Exception("Zenobase can't handle limits over 100") return self._get("/users/{}/buckets/?order=label&offset={}&limit={}".format(self.clie...
[ "def", "list_buckets", "(", "self", ",", "offset", "=", "0", ",", "limit", "=", "100", ")", ":", "# TODO: If limit > 100, do multiple fetches", "if", "limit", ">", "100", ":", "raise", "Exception", "(", "\"Zenobase can't handle limits over 100\"", ")", "return", "...
Limit breaks above 100
[ "Limit", "breaks", "above", "100" ]
eb0572c7441a350bf5578bc5287f3be53d32ea19
https://github.com/ErikBjare/pyzenobase/blob/eb0572c7441a350bf5578bc5287f3be53d32ea19/pyzenobase/zenobase_api.py#L54-L59
241,157
TkTech/pytextql
pytextql/core.py
_create_table
def _create_table(db, table_name, columns, overwrite=False): """ Create's `table_name` in `db` if it does not already exist, and adds any missing columns. :param db: An active SQLite3 Connection. :param table_name: The (unicode) name of the table to setup. :param columns: An iterable of column ...
python
def _create_table(db, table_name, columns, overwrite=False): """ Create's `table_name` in `db` if it does not already exist, and adds any missing columns. :param db: An active SQLite3 Connection. :param table_name: The (unicode) name of the table to setup. :param columns: An iterable of column ...
[ "def", "_create_table", "(", "db", ",", "table_name", ",", "columns", ",", "overwrite", "=", "False", ")", ":", "with", "contextlib", ".", "closing", "(", "db", ".", "cursor", "(", ")", ")", "as", "c", ":", "table_exists", "=", "c", ".", "execute", "...
Create's `table_name` in `db` if it does not already exist, and adds any missing columns. :param db: An active SQLite3 Connection. :param table_name: The (unicode) name of the table to setup. :param columns: An iterable of column names to ensure exist. :param overwrite: If ``True`` and the table al...
[ "Create", "s", "table_name", "in", "db", "if", "it", "does", "not", "already", "exist", "and", "adds", "any", "missing", "columns", "." ]
e054a7a4df7262deaca49bdbf748c00acf011b51
https://github.com/TkTech/pytextql/blob/e054a7a4df7262deaca49bdbf748c00acf011b51/pytextql/core.py#L104-L159
241,158
armstrong/armstrong.apps.images
fabfile.py
update_colorbox
def update_colorbox(): """Update Colorbox code from vendor tree""" base_name = os.path.dirname(__file__) destination = os.path.join(base_name, "armstrong", "apps", "images", "static", "colorbox") colorbox_source = os.path.join(base_name, "vendor", "colorbox") colorbox_files = [ os.path.join(...
python
def update_colorbox(): """Update Colorbox code from vendor tree""" base_name = os.path.dirname(__file__) destination = os.path.join(base_name, "armstrong", "apps", "images", "static", "colorbox") colorbox_source = os.path.join(base_name, "vendor", "colorbox") colorbox_files = [ os.path.join(...
[ "def", "update_colorbox", "(", ")", ":", "base_name", "=", "os", ".", "path", ".", "dirname", "(", "__file__", ")", "destination", "=", "os", ".", "path", ".", "join", "(", "base_name", ",", "\"armstrong\"", ",", "\"apps\"", ",", "\"images\"", ",", "\"st...
Update Colorbox code from vendor tree
[ "Update", "Colorbox", "code", "from", "vendor", "tree" ]
f334697ee6e2273deac12092069d02119d913e67
https://github.com/armstrong/armstrong.apps.images/blob/f334697ee6e2273deac12092069d02119d913e67/fabfile.py#L40-L53
241,159
frigg/frigg-worker
frigg_worker/environment_variables.py
environment_variables_for_task
def environment_variables_for_task(task): """ This will build a dict with all the environment variables that should be present when running a build or deployment. :param task: A dict of the json payload with information about the build task. :return: A dict of environment variables...
python
def environment_variables_for_task(task): """ This will build a dict with all the environment variables that should be present when running a build or deployment. :param task: A dict of the json payload with information about the build task. :return: A dict of environment variables...
[ "def", "environment_variables_for_task", "(", "task", ")", ":", "env", "=", "{", "'CI'", ":", "'frigg'", ",", "'FRIGG'", ":", "'true'", ",", "'FRIGG_CI'", ":", "'true'", ",", "'GH_TOKEN'", ":", "task", "[", "'gh_token'", "]", ",", "'FRIGG_BUILD_BRANCH'", ":"...
This will build a dict with all the environment variables that should be present when running a build or deployment. :param task: A dict of the json payload with information about the build task. :return: A dict of environment variables.
[ "This", "will", "build", "a", "dict", "with", "all", "the", "environment", "variables", "that", "should", "be", "present", "when", "running", "a", "build", "or", "deployment", "." ]
8c215cd8f5a27ff9f5a4fedafe93d2ef0fbca86c
https://github.com/frigg/frigg-worker/blob/8c215cd8f5a27ff9f5a4fedafe93d2ef0fbca86c/frigg_worker/environment_variables.py#L4-L38
241,160
WTRMQDev/lnoise
lnoise/noisetypes.py
Hash.hkdf
def hkdf(self, chaining_key, input_key_material, dhlen=64): """Hash-based key derivation function Takes a ``chaining_key'' byte sequence of len HASHLEN, and an ``input_key_material'' byte sequence with length either zero bytes, 32 bytes or dhlen bytes. Returns two byte sequence...
python
def hkdf(self, chaining_key, input_key_material, dhlen=64): """Hash-based key derivation function Takes a ``chaining_key'' byte sequence of len HASHLEN, and an ``input_key_material'' byte sequence with length either zero bytes, 32 bytes or dhlen bytes. Returns two byte sequence...
[ "def", "hkdf", "(", "self", ",", "chaining_key", ",", "input_key_material", ",", "dhlen", "=", "64", ")", ":", "if", "len", "(", "chaining_key", ")", "!=", "self", ".", "HASHLEN", ":", "raise", "HashError", "(", "\"Incorrect chaining key length\"", ")", "if"...
Hash-based key derivation function Takes a ``chaining_key'' byte sequence of len HASHLEN, and an ``input_key_material'' byte sequence with length either zero bytes, 32 bytes or dhlen bytes. Returns two byte sequences of length HASHLEN
[ "Hash", "-", "based", "key", "derivation", "function" ]
7f8d9faf135025a6aac50131d14a34d1009e8cdd
https://github.com/WTRMQDev/lnoise/blob/7f8d9faf135025a6aac50131d14a34d1009e8cdd/lnoise/noisetypes.py#L69-L85
241,161
WTRMQDev/lnoise
lnoise/noisetypes.py
NoiseBuffer.append
def append(self, val): """Append byte string val to buffer If the result exceeds the length of the buffer, behavior depends on whether instance was initialized as strict. In strict mode, a ValueError is raised. In non-strict mode, the buffer is extended as necessary. """ ...
python
def append(self, val): """Append byte string val to buffer If the result exceeds the length of the buffer, behavior depends on whether instance was initialized as strict. In strict mode, a ValueError is raised. In non-strict mode, the buffer is extended as necessary. """ ...
[ "def", "append", "(", "self", ",", "val", ")", ":", "new_len", "=", "self", ".", "length", "+", "len", "(", "val", ")", "to_add", "=", "new_len", "-", "len", "(", "self", ".", "bfr", ")", "if", "self", ".", "strict", "and", "to_add", ">", "0", ...
Append byte string val to buffer If the result exceeds the length of the buffer, behavior depends on whether instance was initialized as strict. In strict mode, a ValueError is raised. In non-strict mode, the buffer is extended as necessary.
[ "Append", "byte", "string", "val", "to", "buffer", "If", "the", "result", "exceeds", "the", "length", "of", "the", "buffer", "behavior", "depends", "on", "whether", "instance", "was", "initialized", "as", "strict", ".", "In", "strict", "mode", "a", "ValueErr...
7f8d9faf135025a6aac50131d14a34d1009e8cdd
https://github.com/WTRMQDev/lnoise/blob/7f8d9faf135025a6aac50131d14a34d1009e8cdd/lnoise/noisetypes.py#L113-L125
241,162
klmitch/tendril
tendril/utils.py
addr_info
def addr_info(addr): """ Interprets an address in standard tuple format to determine if it is valid, and, if so, which socket family it is. Returns the socket family. """ # If it's a string, it's in the UNIX family if isinstance(addr, basestring): return socket.AF_UNIX # Verif...
python
def addr_info(addr): """ Interprets an address in standard tuple format to determine if it is valid, and, if so, which socket family it is. Returns the socket family. """ # If it's a string, it's in the UNIX family if isinstance(addr, basestring): return socket.AF_UNIX # Verif...
[ "def", "addr_info", "(", "addr", ")", ":", "# If it's a string, it's in the UNIX family", "if", "isinstance", "(", "addr", ",", "basestring", ")", ":", "return", "socket", ".", "AF_UNIX", "# Verify that addr is a tuple", "if", "not", "isinstance", "(", "addr", ",", ...
Interprets an address in standard tuple format to determine if it is valid, and, if so, which socket family it is. Returns the socket family.
[ "Interprets", "an", "address", "in", "standard", "tuple", "format", "to", "determine", "if", "it", "is", "valid", "and", "if", "so", "which", "socket", "family", "it", "is", ".", "Returns", "the", "socket", "family", "." ]
207102c83e88f8f1fa7ba605ef0aab2ae9078b36
https://github.com/klmitch/tendril/blob/207102c83e88f8f1fa7ba605ef0aab2ae9078b36/tendril/utils.py#L113-L158
241,163
anjos/rrbob
rr/algorithm.py
make_labels
def make_labels(X): """Helper function that generates a single 1D numpy.ndarray with labels which are good targets for stock logistic regression. Parameters: X (numpy.ndarray): The input data matrix. This must be a numpy.ndarray with 3 dimensions or an iterable containing 2 numpy.ndarrays with 2 ...
python
def make_labels(X): """Helper function that generates a single 1D numpy.ndarray with labels which are good targets for stock logistic regression. Parameters: X (numpy.ndarray): The input data matrix. This must be a numpy.ndarray with 3 dimensions or an iterable containing 2 numpy.ndarrays with 2 ...
[ "def", "make_labels", "(", "X", ")", ":", "return", "numpy", ".", "hstack", "(", "[", "k", "*", "numpy", ".", "ones", "(", "len", "(", "X", "[", "k", "]", ")", ",", "dtype", "=", "int", ")", "for", "k", "in", "range", "(", "len", "(", "X", ...
Helper function that generates a single 1D numpy.ndarray with labels which are good targets for stock logistic regression. Parameters: X (numpy.ndarray): The input data matrix. This must be a numpy.ndarray with 3 dimensions or an iterable containing 2 numpy.ndarrays with 2 dimensions each. Each c...
[ "Helper", "function", "that", "generates", "a", "single", "1D", "numpy", ".", "ndarray", "with", "labels", "which", "are", "good", "targets", "for", "stock", "logistic", "regression", "." ]
d32d35bab2aa2698d3caa923fd02afb6d67f3235
https://github.com/anjos/rrbob/blob/d32d35bab2aa2698d3caa923fd02afb6d67f3235/rr/algorithm.py#L13-L34
241,164
anjos/rrbob
rr/algorithm.py
add_bias
def add_bias(X): """Helper function to add a bias column to the input array X Parameters: X (numpy.ndarray): The input data matrix. This must be a numpy.ndarray with 2 dimension wheres every row corresponds to one example of the data set, every column, one different feature. Returns: num...
python
def add_bias(X): """Helper function to add a bias column to the input array X Parameters: X (numpy.ndarray): The input data matrix. This must be a numpy.ndarray with 2 dimension wheres every row corresponds to one example of the data set, every column, one different feature. Returns: num...
[ "def", "add_bias", "(", "X", ")", ":", "return", "numpy", ".", "hstack", "(", "(", "numpy", ".", "ones", "(", "(", "len", "(", "X", ")", ",", "1", ")", ",", "dtype", "=", "X", ".", "dtype", ")", ",", "X", ")", ")" ]
Helper function to add a bias column to the input array X Parameters: X (numpy.ndarray): The input data matrix. This must be a numpy.ndarray with 2 dimension wheres every row corresponds to one example of the data set, every column, one different feature. Returns: numpy.ndarray: The same i...
[ "Helper", "function", "to", "add", "a", "bias", "column", "to", "the", "input", "array", "X" ]
d32d35bab2aa2698d3caa923fd02afb6d67f3235
https://github.com/anjos/rrbob/blob/d32d35bab2aa2698d3caa923fd02afb6d67f3235/rr/algorithm.py#L37-L55
241,165
anjos/rrbob
rr/algorithm.py
MultiClassTrainer.train
def train(self, X): """ Trains multiple logistic regression classifiers to handle the multiclass problem posed by ``X`` X (numpy.ndarray): The input data matrix. This must be a numpy.ndarray with 3 dimensions or an iterable containing 2 numpy.ndarrays with 2 dimensions each. Each corr...
python
def train(self, X): """ Trains multiple logistic regression classifiers to handle the multiclass problem posed by ``X`` X (numpy.ndarray): The input data matrix. This must be a numpy.ndarray with 3 dimensions or an iterable containing 2 numpy.ndarrays with 2 dimensions each. Each corr...
[ "def", "train", "(", "self", ",", "X", ")", ":", "_trainer", "=", "bob", ".", "learn", ".", "linear", ".", "CGLogRegTrainer", "(", "*", "*", "{", "'lambda'", ":", "self", ".", "regularizer", "}", ")", "if", "len", "(", "X", ")", "==", "2", ":", ...
Trains multiple logistic regression classifiers to handle the multiclass problem posed by ``X`` X (numpy.ndarray): The input data matrix. This must be a numpy.ndarray with 3 dimensions or an iterable containing 2 numpy.ndarrays with 2 dimensions each. Each correspond to the data for one of th...
[ "Trains", "multiple", "logistic", "regression", "classifiers", "to", "handle", "the", "multiclass", "problem", "posed", "by", "X" ]
d32d35bab2aa2698d3caa923fd02afb6d67f3235
https://github.com/anjos/rrbob/blob/d32d35bab2aa2698d3caa923fd02afb6d67f3235/rr/algorithm.py#L136-L169
241,166
robertchase/ergaleia
ergaleia/nested_get.py
nested_get
def nested_get(d, keys, default=None, required=False, as_list=False): """ Multi-level dict get helper Parameters: d - dict instance keys - iterable of keys or dot-delimited str of keys (see Note 1) default - value if index fails ...
python
def nested_get(d, keys, default=None, required=False, as_list=False): """ Multi-level dict get helper Parameters: d - dict instance keys - iterable of keys or dot-delimited str of keys (see Note 1) default - value if index fails ...
[ "def", "nested_get", "(", "d", ",", "keys", ",", "default", "=", "None", ",", "required", "=", "False", ",", "as_list", "=", "False", ")", ":", "if", "isinstance", "(", "keys", ",", "str", ")", ":", "keys", "=", "keys", ".", "split", "(", "'.'", ...
Multi-level dict get helper Parameters: d - dict instance keys - iterable of keys or dot-delimited str of keys (see Note 1) default - value if index fails required - require every index to work (see Note 2) as_list ...
[ "Multi", "-", "level", "dict", "get", "helper" ]
df8e9a4b18c563022a503faa27e822c9a5755490
https://github.com/robertchase/ergaleia/blob/df8e9a4b18c563022a503faa27e822c9a5755490/ergaleia/nested_get.py#L8-L51
241,167
zagfai/webtul
webtul/utils.py
recur
def recur(obj, type_func_tuple_list=()): '''recuring dealing an object''' for obj_type, func in type_func_tuple_list: if type(obj) == type(obj_type): return func(obj) # by default, we wolud recurring list, tuple and dict if isinstance(obj, list) or isinstance(obj, tuple): n_o...
python
def recur(obj, type_func_tuple_list=()): '''recuring dealing an object''' for obj_type, func in type_func_tuple_list: if type(obj) == type(obj_type): return func(obj) # by default, we wolud recurring list, tuple and dict if isinstance(obj, list) or isinstance(obj, tuple): n_o...
[ "def", "recur", "(", "obj", ",", "type_func_tuple_list", "=", "(", ")", ")", ":", "for", "obj_type", ",", "func", "in", "type_func_tuple_list", ":", "if", "type", "(", "obj", ")", "==", "type", "(", "obj_type", ")", ":", "return", "func", "(", "obj", ...
recuring dealing an object
[ "recuring", "dealing", "an", "object" ]
58c49928070b56ef54a45b4af20d800b269ad8ce
https://github.com/zagfai/webtul/blob/58c49928070b56ef54a45b4af20d800b269ad8ce/webtul/utils.py#L32-L48
241,168
zagfai/webtul
webtul/utils.py
browser_cache
def browser_cache(seconds): """Decorator for browser cache. Only for webpy @browser_cache( seconds ) before GET/POST function. """ import web def wrap(f): def wrapped_f(*args): last_time_str = web.ctx.env.get('HTTP_IF_MODIFIED_SINCE', '') last_time = web.net.parsehttp...
python
def browser_cache(seconds): """Decorator for browser cache. Only for webpy @browser_cache( seconds ) before GET/POST function. """ import web def wrap(f): def wrapped_f(*args): last_time_str = web.ctx.env.get('HTTP_IF_MODIFIED_SINCE', '') last_time = web.net.parsehttp...
[ "def", "browser_cache", "(", "seconds", ")", ":", "import", "web", "def", "wrap", "(", "f", ")", ":", "def", "wrapped_f", "(", "*", "args", ")", ":", "last_time_str", "=", "web", ".", "ctx", ".", "env", ".", "get", "(", "'HTTP_IF_MODIFIED_SINCE'", ",",...
Decorator for browser cache. Only for webpy @browser_cache( seconds ) before GET/POST function.
[ "Decorator", "for", "browser", "cache", ".", "Only", "for", "webpy" ]
58c49928070b56ef54a45b4af20d800b269ad8ce
https://github.com/zagfai/webtul/blob/58c49928070b56ef54a45b4af20d800b269ad8ce/webtul/utils.py#L50-L68
241,169
jalanb/pysyte
pysyte/splits.py
join
def join(items, separator=None): """Join the items into a string using the separator Converts items to strings if needed >>> join([1, 2, 3]) '1,2,3' """ if not items: return '' if separator is None: separator = _default_separator() return separator.join([str(item) for i...
python
def join(items, separator=None): """Join the items into a string using the separator Converts items to strings if needed >>> join([1, 2, 3]) '1,2,3' """ if not items: return '' if separator is None: separator = _default_separator() return separator.join([str(item) for i...
[ "def", "join", "(", "items", ",", "separator", "=", "None", ")", ":", "if", "not", "items", ":", "return", "''", "if", "separator", "is", "None", ":", "separator", "=", "_default_separator", "(", ")", "return", "separator", ".", "join", "(", "[", "str"...
Join the items into a string using the separator Converts items to strings if needed >>> join([1, 2, 3]) '1,2,3'
[ "Join", "the", "items", "into", "a", "string", "using", "the", "separator" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/splits.py#L17-L29
241,170
jalanb/pysyte
pysyte/splits.py
split
def split(string, separator_regexp=None, maxsplit=0): """Split a string to a list >>> split('fred, was, here') ['fred', ' was', ' here'] """ if not string: return [] if separator_regexp is None: separator_regexp = _default_separator() if not separator_regexp: return ...
python
def split(string, separator_regexp=None, maxsplit=0): """Split a string to a list >>> split('fred, was, here') ['fred', ' was', ' here'] """ if not string: return [] if separator_regexp is None: separator_regexp = _default_separator() if not separator_regexp: return ...
[ "def", "split", "(", "string", ",", "separator_regexp", "=", "None", ",", "maxsplit", "=", "0", ")", ":", "if", "not", "string", ":", "return", "[", "]", "if", "separator_regexp", "is", "None", ":", "separator_regexp", "=", "_default_separator", "(", ")", ...
Split a string to a list >>> split('fred, was, here') ['fred', ' was', ' here']
[ "Split", "a", "string", "to", "a", "list" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/splits.py#L41-L53
241,171
jalanb/pysyte
pysyte/splits.py
split_and_strip
def split_and_strip(string, separator_regexp=None, maxsplit=0): """Split a string into items and trim any excess spaces from the items >>> split_and_strip('fred, was, here ') ['fred', 'was', 'here'] """ if not string: return [''] if separator_regexp is None: separator_regexp = ...
python
def split_and_strip(string, separator_regexp=None, maxsplit=0): """Split a string into items and trim any excess spaces from the items >>> split_and_strip('fred, was, here ') ['fred', 'was', 'here'] """ if not string: return [''] if separator_regexp is None: separator_regexp = ...
[ "def", "split_and_strip", "(", "string", ",", "separator_regexp", "=", "None", ",", "maxsplit", "=", "0", ")", ":", "if", "not", "string", ":", "return", "[", "''", "]", "if", "separator_regexp", "is", "None", ":", "separator_regexp", "=", "_default_separato...
Split a string into items and trim any excess spaces from the items >>> split_and_strip('fred, was, here ') ['fred', 'was', 'here']
[ "Split", "a", "string", "into", "items", "and", "trim", "any", "excess", "spaces", "from", "the", "items" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/splits.py#L56-L69
241,172
jalanb/pysyte
pysyte/splits.py
split_and_strip_without
def split_and_strip_without(string, exclude, separator_regexp=None): """Split a string into items, and trim any excess spaces Any items in exclude are not in the returned list >>> split_and_strip_without('fred, was, here ', ['was']) ['fred', 'here'] """ result = split_and_strip(string, separa...
python
def split_and_strip_without(string, exclude, separator_regexp=None): """Split a string into items, and trim any excess spaces Any items in exclude are not in the returned list >>> split_and_strip_without('fred, was, here ', ['was']) ['fred', 'here'] """ result = split_and_strip(string, separa...
[ "def", "split_and_strip_without", "(", "string", ",", "exclude", ",", "separator_regexp", "=", "None", ")", ":", "result", "=", "split_and_strip", "(", "string", ",", "separator_regexp", ")", "if", "not", "exclude", ":", "return", "result", "return", "[", "x",...
Split a string into items, and trim any excess spaces Any items in exclude are not in the returned list >>> split_and_strip_without('fred, was, here ', ['was']) ['fred', 'here']
[ "Split", "a", "string", "into", "items", "and", "trim", "any", "excess", "spaces" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/splits.py#L72-L83
241,173
jalanb/pysyte
pysyte/splits.py
split_by_count
def split_by_count(items, count, filler=None): """Split the items into tuples of count items each >>> split_by_count([0,1,2,3], 2) [(0, 1), (2, 3)] If there are a mutiple of count items then filler makes no difference >>> split_by_count([0,1,2,7,8,9], 3, 0) == split_by_count([0,1,2,7,8,9], 3) ...
python
def split_by_count(items, count, filler=None): """Split the items into tuples of count items each >>> split_by_count([0,1,2,3], 2) [(0, 1), (2, 3)] If there are a mutiple of count items then filler makes no difference >>> split_by_count([0,1,2,7,8,9], 3, 0) == split_by_count([0,1,2,7,8,9], 3) ...
[ "def", "split_by_count", "(", "items", ",", "count", ",", "filler", "=", "None", ")", ":", "if", "filler", "is", "not", "None", ":", "items", "=", "items", "[", ":", "]", "while", "len", "(", "items", ")", "%", "count", ":", "items", ".", "append",...
Split the items into tuples of count items each >>> split_by_count([0,1,2,3], 2) [(0, 1), (2, 3)] If there are a mutiple of count items then filler makes no difference >>> split_by_count([0,1,2,7,8,9], 3, 0) == split_by_count([0,1,2,7,8,9], 3) True If there are not a multiple of count items, ...
[ "Split", "the", "items", "into", "tuples", "of", "count", "items", "each" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/splits.py#L97-L121
241,174
jalanb/pysyte
pysyte/splits.py
rejoin
def rejoin(string, separator_regexp=None, spaced=False): """Split a string and then rejoin it Spaces are interspersed between items only if spaced is True >>> rejoin('fred, was, here ') 'fred,was,here' """ strings = split_and_strip(string) if separator_regexp is None: separator_re...
python
def rejoin(string, separator_regexp=None, spaced=False): """Split a string and then rejoin it Spaces are interspersed between items only if spaced is True >>> rejoin('fred, was, here ') 'fred,was,here' """ strings = split_and_strip(string) if separator_regexp is None: separator_re...
[ "def", "rejoin", "(", "string", ",", "separator_regexp", "=", "None", ",", "spaced", "=", "False", ")", ":", "strings", "=", "split_and_strip", "(", "string", ")", "if", "separator_regexp", "is", "None", ":", "separator_regexp", "=", "_default_separator", "(",...
Split a string and then rejoin it Spaces are interspersed between items only if spaced is True >>> rejoin('fred, was, here ') 'fred,was,here'
[ "Split", "a", "string", "and", "then", "rejoin", "it" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/splits.py#L172-L184
241,175
Bystroushaak/BalancedDiscStorage
src/BalancedDiscStorage/balanced_disc_storage_z.py
BalancedDiscStorageZ.add_archive_as_dir
def add_archive_as_dir(self, zip_file_obj): """ Add archive to the storage and unpack it. Args: zip_file_obj (file): Opened file-like object. Returns: obj: Path where the `zip_file_obj` was unpacked wrapped in \ :class:`.PathAndHash` structure. ...
python
def add_archive_as_dir(self, zip_file_obj): """ Add archive to the storage and unpack it. Args: zip_file_obj (file): Opened file-like object. Returns: obj: Path where the `zip_file_obj` was unpacked wrapped in \ :class:`.PathAndHash` structure. ...
[ "def", "add_archive_as_dir", "(", "self", ",", "zip_file_obj", ")", ":", "BalancedDiscStorage", ".", "_check_interface", "(", "zip_file_obj", ")", "file_hash", "=", "self", ".", "_get_hash", "(", "zip_file_obj", ")", "dir_path", "=", "self", ".", "_create_dir_path...
Add archive to the storage and unpack it. Args: zip_file_obj (file): Opened file-like object. Returns: obj: Path where the `zip_file_obj` was unpacked wrapped in \ :class:`.PathAndHash` structure. Raises: ValueError: If there is too many fi...
[ "Add", "archive", "to", "the", "storage", "and", "unpack", "it", "." ]
d96854e2afdd70c814b16d177ff6308841b34b24
https://github.com/Bystroushaak/BalancedDiscStorage/blob/d96854e2afdd70c814b16d177ff6308841b34b24/src/BalancedDiscStorage/balanced_disc_storage_z.py#L57-L90
241,176
aquatix/python-utilkit
utilkit/printutil.py
to_even_columns
def to_even_columns(data, headers=None): """ Nicely format the 2-dimensional list into evenly spaced columns """ result = '' col_width = max(len(word) for row in data for word in row) + 2 # padding if headers: header_width = max(len(word) for row in headers for word in row) + 2 ...
python
def to_even_columns(data, headers=None): """ Nicely format the 2-dimensional list into evenly spaced columns """ result = '' col_width = max(len(word) for row in data for word in row) + 2 # padding if headers: header_width = max(len(word) for row in headers for word in row) + 2 ...
[ "def", "to_even_columns", "(", "data", ",", "headers", "=", "None", ")", ":", "result", "=", "''", "col_width", "=", "max", "(", "len", "(", "word", ")", "for", "row", "in", "data", "for", "word", "in", "row", ")", "+", "2", "# padding", "if", "hea...
Nicely format the 2-dimensional list into evenly spaced columns
[ "Nicely", "format", "the", "2", "-", "dimensional", "list", "into", "evenly", "spaced", "columns" ]
1b4a4175381d2175592208619315f399610f915c
https://github.com/aquatix/python-utilkit/blob/1b4a4175381d2175592208619315f399610f915c/utilkit/printutil.py#L6-L22
241,177
aquatix/python-utilkit
utilkit/printutil.py
to_smart_columns
def to_smart_columns(data, headers=None, padding=2): """ Nicely format the 2-dimensional list into columns """ result = '' col_widths = [] for row in data: col_counter = 0 for word in row: try: col_widths[col_counter] = max(len(word), col_widths[col_co...
python
def to_smart_columns(data, headers=None, padding=2): """ Nicely format the 2-dimensional list into columns """ result = '' col_widths = [] for row in data: col_counter = 0 for word in row: try: col_widths[col_counter] = max(len(word), col_widths[col_co...
[ "def", "to_smart_columns", "(", "data", ",", "headers", "=", "None", ",", "padding", "=", "2", ")", ":", "result", "=", "''", "col_widths", "=", "[", "]", "for", "row", "in", "data", ":", "col_counter", "=", "0", "for", "word", "in", "row", ":", "t...
Nicely format the 2-dimensional list into columns
[ "Nicely", "format", "the", "2", "-", "dimensional", "list", "into", "columns" ]
1b4a4175381d2175592208619315f399610f915c
https://github.com/aquatix/python-utilkit/blob/1b4a4175381d2175592208619315f399610f915c/utilkit/printutil.py#L25-L67
241,178
aquatix/python-utilkit
utilkit/printutil.py
progress_bar
def progress_bar(items_total, items_progress, columns=40, base_char='.', progress_char='#', percentage=False, prefix='', postfix=''): """ Print a progress bar of width `columns` """ bins_total = int(float(items_total) / columns) + 1 bins_progress = int((float(items_progress) / float(items_total)) * ...
python
def progress_bar(items_total, items_progress, columns=40, base_char='.', progress_char='#', percentage=False, prefix='', postfix=''): """ Print a progress bar of width `columns` """ bins_total = int(float(items_total) / columns) + 1 bins_progress = int((float(items_progress) / float(items_total)) * ...
[ "def", "progress_bar", "(", "items_total", ",", "items_progress", ",", "columns", "=", "40", ",", "base_char", "=", "'.'", ",", "progress_char", "=", "'#'", ",", "percentage", "=", "False", ",", "prefix", "=", "''", ",", "postfix", "=", "''", ")", ":", ...
Print a progress bar of width `columns`
[ "Print", "a", "progress", "bar", "of", "width", "columns" ]
1b4a4175381d2175592208619315f399610f915c
https://github.com/aquatix/python-utilkit/blob/1b4a4175381d2175592208619315f399610f915c/utilkit/printutil.py#L70-L84
241,179
aquatix/python-utilkit
utilkit/printutil.py
merge_x_y
def merge_x_y(collection_x, collection_y, filter_none=False): """ Merge two lists, creating a dictionary with key `label` and a set x and y """ data = {} for item in collection_x: #print item[0:-1] #print item[-1] label = datetimeutil.tuple_to_string(item[0:-1]) if fi...
python
def merge_x_y(collection_x, collection_y, filter_none=False): """ Merge two lists, creating a dictionary with key `label` and a set x and y """ data = {} for item in collection_x: #print item[0:-1] #print item[-1] label = datetimeutil.tuple_to_string(item[0:-1]) if fi...
[ "def", "merge_x_y", "(", "collection_x", ",", "collection_y", ",", "filter_none", "=", "False", ")", ":", "data", "=", "{", "}", "for", "item", "in", "collection_x", ":", "#print item[0:-1]", "#print item[-1]", "label", "=", "datetimeutil", ".", "tuple_to_string...
Merge two lists, creating a dictionary with key `label` and a set x and y
[ "Merge", "two", "lists", "creating", "a", "dictionary", "with", "key", "label", "and", "a", "set", "x", "and", "y" ]
1b4a4175381d2175592208619315f399610f915c
https://github.com/aquatix/python-utilkit/blob/1b4a4175381d2175592208619315f399610f915c/utilkit/printutil.py#L87-L110
241,180
aquatix/python-utilkit
utilkit/printutil.py
x_vs_y
def x_vs_y(collection_x, collection_y, title_x=None, title_y=None, width=43, filter_none=False): """ Print a histogram with bins for x to the left and bins of y to the right """ data = merge_x_y(collection_x, collection_y, filter_none) max_value = get_max_x_y(data) bins_total = int(float(max_va...
python
def x_vs_y(collection_x, collection_y, title_x=None, title_y=None, width=43, filter_none=False): """ Print a histogram with bins for x to the left and bins of y to the right """ data = merge_x_y(collection_x, collection_y, filter_none) max_value = get_max_x_y(data) bins_total = int(float(max_va...
[ "def", "x_vs_y", "(", "collection_x", ",", "collection_y", ",", "title_x", "=", "None", ",", "title_y", "=", "None", ",", "width", "=", "43", ",", "filter_none", "=", "False", ")", ":", "data", "=", "merge_x_y", "(", "collection_x", ",", "collection_y", ...
Print a histogram with bins for x to the left and bins of y to the right
[ "Print", "a", "histogram", "with", "bins", "for", "x", "to", "the", "left", "and", "bins", "of", "y", "to", "the", "right" ]
1b4a4175381d2175592208619315f399610f915c
https://github.com/aquatix/python-utilkit/blob/1b4a4175381d2175592208619315f399610f915c/utilkit/printutil.py#L123-L147
241,181
Amsterdam/authorization_django
authorization_django/config.py
settings
def settings(): """ Fetch the middleware settings. :return dict: settings """ # Get the user-provided settings user_settings = dict(getattr(django_settings, _settings_key, {})) user_settings_keys = set(user_settings.keys()) # Check for required but missing settings missing = _required_s...
python
def settings(): """ Fetch the middleware settings. :return dict: settings """ # Get the user-provided settings user_settings = dict(getattr(django_settings, _settings_key, {})) user_settings_keys = set(user_settings.keys()) # Check for required but missing settings missing = _required_s...
[ "def", "settings", "(", ")", ":", "# Get the user-provided settings", "user_settings", "=", "dict", "(", "getattr", "(", "django_settings", ",", "_settings_key", ",", "{", "}", ")", ")", "user_settings_keys", "=", "set", "(", "user_settings", ".", "keys", "(", ...
Fetch the middleware settings. :return dict: settings
[ "Fetch", "the", "middleware", "settings", "." ]
71da52b38a7f5a16a2bde8f8ea97b3c11ccb1be1
https://github.com/Amsterdam/authorization_django/blob/71da52b38a7f5a16a2bde8f8ea97b3c11ccb1be1/authorization_django/config.py#L79-L102
241,182
selenol/selenol-python
selenol_python/services.py
SelenolClient.run
def run(self): """Run the service in infinitive loop processing requests.""" try: while True: message = self.connection.recv() result = self.on_message(message) if result: self.connection.send(result) except SelenolW...
python
def run(self): """Run the service in infinitive loop processing requests.""" try: while True: message = self.connection.recv() result = self.on_message(message) if result: self.connection.send(result) except SelenolW...
[ "def", "run", "(", "self", ")", ":", "try", ":", "while", "True", ":", "message", "=", "self", ".", "connection", ".", "recv", "(", ")", "result", "=", "self", ".", "on_message", "(", "message", ")", "if", "result", ":", "self", ".", "connection", ...
Run the service in infinitive loop processing requests.
[ "Run", "the", "service", "in", "infinitive", "loop", "processing", "requests", "." ]
53775fdfc95161f4aca350305cb3459e6f2f808d
https://github.com/selenol/selenol-python/blob/53775fdfc95161f4aca350305cb3459e6f2f808d/selenol_python/services.py#L39-L49
241,183
selenol/selenol-python
selenol_python/services.py
SelenolService.on_message
def on_message(self, message): """Message from the backend has been received. :param message: Message string received. """ work_unit = SelenolMessage(message) request_id = work_unit.request_id if message['reason'] == ['selenol', 'request']: try: ...
python
def on_message(self, message): """Message from the backend has been received. :param message: Message string received. """ work_unit = SelenolMessage(message) request_id = work_unit.request_id if message['reason'] == ['selenol', 'request']: try: ...
[ "def", "on_message", "(", "self", ",", "message", ")", ":", "work_unit", "=", "SelenolMessage", "(", "message", ")", "request_id", "=", "work_unit", ".", "request_id", "if", "message", "[", "'reason'", "]", "==", "[", "'selenol'", ",", "'request'", "]", ":...
Message from the backend has been received. :param message: Message string received.
[ "Message", "from", "the", "backend", "has", "been", "received", "." ]
53775fdfc95161f4aca350305cb3459e6f2f808d
https://github.com/selenol/selenol-python/blob/53775fdfc95161f4aca350305cb3459e6f2f808d/selenol_python/services.py#L115-L151
241,184
selenol/selenol-python
selenol_python/services.py
SelenolService.event
def event(self, request_id, trigger, event, message): """Create an event in the backend to be triggered given a circumstance. :param request_id: Request ID of a involved session. :param trigger: Circumstance that will trigger the event. :param event: Reason of the message that will be c...
python
def event(self, request_id, trigger, event, message): """Create an event in the backend to be triggered given a circumstance. :param request_id: Request ID of a involved session. :param trigger: Circumstance that will trigger the event. :param event: Reason of the message that will be c...
[ "def", "event", "(", "self", ",", "request_id", ",", "trigger", ",", "event", ",", "message", ")", ":", "self", ".", "connection", ".", "send", "(", "{", "'reason'", ":", "[", "'request'", ",", "'event'", "]", ",", "'request_id'", ":", "request_id", ",...
Create an event in the backend to be triggered given a circumstance. :param request_id: Request ID of a involved session. :param trigger: Circumstance that will trigger the event. :param event: Reason of the message that will be created. :param message: Content of the message that will ...
[ "Create", "an", "event", "in", "the", "backend", "to", "be", "triggered", "given", "a", "circumstance", "." ]
53775fdfc95161f4aca350305cb3459e6f2f808d
https://github.com/selenol/selenol-python/blob/53775fdfc95161f4aca350305cb3459e6f2f808d/selenol_python/services.py#L172-L190
241,185
selenol/selenol-python
selenol_python/services.py
SelenolService.send
def send(self, event, message): """Send a message to the backend. :param reason: Reason of the message. :param message: Message content. """ self.connection.send({ 'reason': ['request', 'send'], 'content': { 'reason': event, ...
python
def send(self, event, message): """Send a message to the backend. :param reason: Reason of the message. :param message: Message content. """ self.connection.send({ 'reason': ['request', 'send'], 'content': { 'reason': event, ...
[ "def", "send", "(", "self", ",", "event", ",", "message", ")", ":", "self", ".", "connection", ".", "send", "(", "{", "'reason'", ":", "[", "'request'", ",", "'send'", "]", ",", "'content'", ":", "{", "'reason'", ":", "event", ",", "'request_id'", ":...
Send a message to the backend. :param reason: Reason of the message. :param message: Message content.
[ "Send", "a", "message", "to", "the", "backend", "." ]
53775fdfc95161f4aca350305cb3459e6f2f808d
https://github.com/selenol/selenol-python/blob/53775fdfc95161f4aca350305cb3459e6f2f808d/selenol_python/services.py#L192-L206
241,186
Infinidat/infi.recipe.console_scripts
src/infi/recipe/console_scripts/__init__.py
_get_matching_dist_in_location
def _get_matching_dist_in_location(dist, location): """ Check if `locations` contain only the one intended dist. Return the dist with metadata in the new location. """ # Getting the dist from the environment causes the # distribution meta data to be read. Cloning isn't # good enough. im...
python
def _get_matching_dist_in_location(dist, location): """ Check if `locations` contain only the one intended dist. Return the dist with metadata in the new location. """ # Getting the dist from the environment causes the # distribution meta data to be read. Cloning isn't # good enough. im...
[ "def", "_get_matching_dist_in_location", "(", "dist", ",", "location", ")", ":", "# Getting the dist from the environment causes the", "# distribution meta data to be read. Cloning isn't", "# good enough.", "import", "pkg_resources", "env", "=", "pkg_resources", ".", "Environment"...
Check if `locations` contain only the one intended dist. Return the dist with metadata in the new location.
[ "Check", "if", "locations", "contain", "only", "the", "one", "intended", "dist", ".", "Return", "the", "dist", "with", "metadata", "in", "the", "new", "location", "." ]
7beab59537654ee475527dbbd59b0aa49348ebd3
https://github.com/Infinidat/infi.recipe.console_scripts/blob/7beab59537654ee475527dbbd59b0aa49348ebd3/src/infi/recipe/console_scripts/__init__.py#L98-L113
241,187
krukas/Trionyx
trionyx/trionyx/views/core.py
ModelClassMixin.get_model_class
def get_model_class(self): """Get model class""" if getattr(self, 'model', None): return self.model elif getattr(self, 'object', None): return self.object.__class__ elif 'app' in self.kwargs and 'model' in self.kwargs: return apps.get_model(self.kwargs...
python
def get_model_class(self): """Get model class""" if getattr(self, 'model', None): return self.model elif getattr(self, 'object', None): return self.object.__class__ elif 'app' in self.kwargs and 'model' in self.kwargs: return apps.get_model(self.kwargs...
[ "def", "get_model_class", "(", "self", ")", ":", "if", "getattr", "(", "self", ",", "'model'", ",", "None", ")", ":", "return", "self", ".", "model", "elif", "getattr", "(", "self", ",", "'object'", ",", "None", ")", ":", "return", "self", ".", "obje...
Get model class
[ "Get", "model", "class" ]
edac132cc0797190153f2e60bc7e88cb50e80da6
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/trionyx/views/core.py#L55-L66
241,188
krukas/Trionyx
trionyx/trionyx/views/core.py
ModelClassMixin.get_model_config
def get_model_config(self): """Get Trionyx model config""" if not hasattr(self, '__config'): setattr(self, '__config', models_config.get_config(self.get_model_class())) return getattr(self, '__config', None)
python
def get_model_config(self): """Get Trionyx model config""" if not hasattr(self, '__config'): setattr(self, '__config', models_config.get_config(self.get_model_class())) return getattr(self, '__config', None)
[ "def", "get_model_config", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'__config'", ")", ":", "setattr", "(", "self", ",", "'__config'", ",", "models_config", ".", "get_config", "(", "self", ".", "get_model_class", "(", ")", ")", ")...
Get Trionyx model config
[ "Get", "Trionyx", "model", "config" ]
edac132cc0797190153f2e60bc7e88cb50e80da6
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/trionyx/views/core.py#L68-L72
241,189
krukas/Trionyx
trionyx/trionyx/views/core.py
ModelPermission.dispatch
def dispatch(self, request, *args, **kwargs): """Validate if user can use view""" if False: # TODO do permission check based on Model raise PermissionDenied return super().dispatch(request, *args, **kwargs)
python
def dispatch(self, request, *args, **kwargs): """Validate if user can use view""" if False: # TODO do permission check based on Model raise PermissionDenied return super().dispatch(request, *args, **kwargs)
[ "def", "dispatch", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "False", ":", "# TODO do permission check based on Model", "raise", "PermissionDenied", "return", "super", "(", ")", ".", "dispatch", "(", "request", "...
Validate if user can use view
[ "Validate", "if", "user", "can", "use", "view" ]
edac132cc0797190153f2e60bc7e88cb50e80da6
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/trionyx/views/core.py#L78-L82
241,190
krukas/Trionyx
trionyx/trionyx/views/core.py
SessionValueMixin.get_session_value
def get_session_value(self, name, default=None): """Get value from session""" session_name = 'list_{}_{}_{}'.format(self.kwargs.get('app'), self.kwargs.get('model'), name) return self.request.session.get(session_name, default)
python
def get_session_value(self, name, default=None): """Get value from session""" session_name = 'list_{}_{}_{}'.format(self.kwargs.get('app'), self.kwargs.get('model'), name) return self.request.session.get(session_name, default)
[ "def", "get_session_value", "(", "self", ",", "name", ",", "default", "=", "None", ")", ":", "session_name", "=", "'list_{}_{}_{}'", ".", "format", "(", "self", ".", "kwargs", ".", "get", "(", "'app'", ")", ",", "self", ".", "kwargs", ".", "get", "(", ...
Get value from session
[ "Get", "value", "from", "session" ]
edac132cc0797190153f2e60bc7e88cb50e80da6
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/trionyx/views/core.py#L98-L101
241,191
krukas/Trionyx
trionyx/trionyx/views/core.py
SessionValueMixin.save_value
def save_value(self, name, value): """Save value to session""" session_name = 'list_{}_{}_{}'.format(self.kwargs.get('app'), self.kwargs.get('model'), name) self.request.session[session_name] = value setattr(self, name, value) return value
python
def save_value(self, name, value): """Save value to session""" session_name = 'list_{}_{}_{}'.format(self.kwargs.get('app'), self.kwargs.get('model'), name) self.request.session[session_name] = value setattr(self, name, value) return value
[ "def", "save_value", "(", "self", ",", "name", ",", "value", ")", ":", "session_name", "=", "'list_{}_{}_{}'", ".", "format", "(", "self", ".", "kwargs", ".", "get", "(", "'app'", ")", ",", "self", ".", "kwargs", ".", "get", "(", "'model'", ")", ",",...
Save value to session
[ "Save", "value", "to", "session" ]
edac132cc0797190153f2e60bc7e88cb50e80da6
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/trionyx/views/core.py#L103-L108
241,192
krukas/Trionyx
trionyx/trionyx/views/core.py
ListView.get_title
def get_title(self): """Get page title""" if self.title: return self.title return self.get_model_class()._meta.verbose_name_plural
python
def get_title(self): """Get page title""" if self.title: return self.title return self.get_model_class()._meta.verbose_name_plural
[ "def", "get_title", "(", "self", ")", ":", "if", "self", ".", "title", ":", "return", "self", ".", "title", "return", "self", ".", "get_model_class", "(", ")", ".", "_meta", ".", "verbose_name_plural" ]
Get page title
[ "Get", "page", "title" ]
edac132cc0797190153f2e60bc7e88cb50e80da6
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/trionyx/views/core.py#L131-L135
241,193
krukas/Trionyx
trionyx/trionyx/views/core.py
ModelListMixin.get_page
def get_page(self, paginator): """Get current page or page in session""" page = int(self.get_and_save_value('page', 1)) if page < 1: return self.save_value('page', 1) if page > paginator.num_pages: return self.save_value('page', paginator.num_pages) retur...
python
def get_page(self, paginator): """Get current page or page in session""" page = int(self.get_and_save_value('page', 1)) if page < 1: return self.save_value('page', 1) if page > paginator.num_pages: return self.save_value('page', paginator.num_pages) retur...
[ "def", "get_page", "(", "self", ",", "paginator", ")", ":", "page", "=", "int", "(", "self", ".", "get_and_save_value", "(", "'page'", ",", "1", ")", ")", "if", "page", "<", "1", ":", "return", "self", ".", "save_value", "(", "'page'", ",", "1", ")...
Get current page or page in session
[ "Get", "current", "page", "or", "page", "in", "session" ]
edac132cc0797190153f2e60bc7e88cb50e80da6
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/trionyx/views/core.py#L168-L176
241,194
krukas/Trionyx
trionyx/trionyx/views/core.py
ModelListMixin.get_search
def get_search(self): """Get current search or search from session, reset page if search is changed""" old_search = self.get_session_value('search', '') search = self.get_and_save_value('search', '') if old_search != search: self.page = 1 self.get_session_value('p...
python
def get_search(self): """Get current search or search from session, reset page if search is changed""" old_search = self.get_session_value('search', '') search = self.get_and_save_value('search', '') if old_search != search: self.page = 1 self.get_session_value('p...
[ "def", "get_search", "(", "self", ")", ":", "old_search", "=", "self", ".", "get_session_value", "(", "'search'", ",", "''", ")", "search", "=", "self", ".", "get_and_save_value", "(", "'search'", ",", "''", ")", "if", "old_search", "!=", "search", ":", ...
Get current search or search from session, reset page if search is changed
[ "Get", "current", "search", "or", "search", "from", "session", "reset", "page", "if", "search", "is", "changed" ]
edac132cc0797190153f2e60bc7e88cb50e80da6
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/trionyx/views/core.py#L186-L193
241,195
krukas/Trionyx
trionyx/trionyx/views/core.py
ModelListMixin.get_all_fields
def get_all_fields(self): """Get all aviable fields""" return { name: { 'name': name, 'label': field['label'], } for name, field in self.get_model_config().get_list_fields().items() }
python
def get_all_fields(self): """Get all aviable fields""" return { name: { 'name': name, 'label': field['label'], } for name, field in self.get_model_config().get_list_fields().items() }
[ "def", "get_all_fields", "(", "self", ")", ":", "return", "{", "name", ":", "{", "'name'", ":", "name", ",", "'label'", ":", "field", "[", "'label'", "]", ",", "}", "for", "name", ",", "field", "in", "self", ".", "get_model_config", "(", ")", ".", ...
Get all aviable fields
[ "Get", "all", "aviable", "fields" ]
edac132cc0797190153f2e60bc7e88cb50e80da6
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/trionyx/views/core.py#L195-L203
241,196
krukas/Trionyx
trionyx/trionyx/views/core.py
ModelListMixin.get_current_fields
def get_current_fields(self): """Get current list to be used""" if hasattr(self, 'current_fields') and self.current_fields: return self.current_fields field_attribute = 'list_{}_{}_fields'.format(self.kwargs.get('app'), self.kwargs.get('model')) current_fields = self.request...
python
def get_current_fields(self): """Get current list to be used""" if hasattr(self, 'current_fields') and self.current_fields: return self.current_fields field_attribute = 'list_{}_{}_fields'.format(self.kwargs.get('app'), self.kwargs.get('model')) current_fields = self.request...
[ "def", "get_current_fields", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'current_fields'", ")", "and", "self", ".", "current_fields", ":", "return", "self", ".", "current_fields", "field_attribute", "=", "'list_{}_{}_fields'", ".", "format", "(",...
Get current list to be used
[ "Get", "current", "list", "to", "be", "used" ]
edac132cc0797190153f2e60bc7e88cb50e80da6
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/trionyx/views/core.py#L205-L226
241,197
krukas/Trionyx
trionyx/trionyx/views/core.py
ModelListMixin.search_queryset
def search_queryset(self): """Get search query set""" queryset = self.get_model_class().objects.get_queryset() if self.get_model_config().list_select_related: queryset = queryset.select_related(*self.get_model_config().list_select_related) return watson.filter(queryset, sel...
python
def search_queryset(self): """Get search query set""" queryset = self.get_model_class().objects.get_queryset() if self.get_model_config().list_select_related: queryset = queryset.select_related(*self.get_model_config().list_select_related) return watson.filter(queryset, sel...
[ "def", "search_queryset", "(", "self", ")", ":", "queryset", "=", "self", ".", "get_model_class", "(", ")", ".", "objects", ".", "get_queryset", "(", ")", "if", "self", ".", "get_model_config", "(", ")", ".", "list_select_related", ":", "queryset", "=", "q...
Get search query set
[ "Get", "search", "query", "set" ]
edac132cc0797190153f2e60bc7e88cb50e80da6
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/trionyx/views/core.py#L238-L245
241,198
krukas/Trionyx
trionyx/trionyx/views/core.py
ListJsendView.handle_request
def handle_request(self, request, *args, **kwargs): """Give back list items + config""" paginator = self.get_paginator() # Call search first, it will reset page if search is changed search = self.get_search() page = self.get_page(paginator) items = self.get_items(paginato...
python
def handle_request(self, request, *args, **kwargs): """Give back list items + config""" paginator = self.get_paginator() # Call search first, it will reset page if search is changed search = self.get_search() page = self.get_page(paginator) items = self.get_items(paginato...
[ "def", "handle_request", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "paginator", "=", "self", ".", "get_paginator", "(", ")", "# Call search first, it will reset page if search is changed", "search", "=", "self", ".", "get_...
Give back list items + config
[ "Give", "back", "list", "items", "+", "config" ]
edac132cc0797190153f2e60bc7e88cb50e80da6
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/trionyx/views/core.py#L259-L276
241,199
krukas/Trionyx
trionyx/trionyx/views/core.py
ListJsendView.get_items
def get_items(self, paginator, current_page): """Get list items for current page""" fields = self.get_model_config().get_list_fields() page = paginator.page(current_page) items = [] for item in page: items.append({ 'id': item.id, 'url...
python
def get_items(self, paginator, current_page): """Get list items for current page""" fields = self.get_model_config().get_list_fields() page = paginator.page(current_page) items = [] for item in page: items.append({ 'id': item.id, 'url...
[ "def", "get_items", "(", "self", ",", "paginator", ",", "current_page", ")", ":", "fields", "=", "self", ".", "get_model_config", "(", ")", ".", "get_list_fields", "(", ")", "page", "=", "paginator", ".", "page", "(", "current_page", ")", "items", "=", "...
Get list items for current page
[ "Get", "list", "items", "for", "current", "page" ]
edac132cc0797190153f2e60bc7e88cb50e80da6
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/trionyx/views/core.py#L278-L294