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
250,800
neoinsanity/cognate
cognate/component_core.py
copy_attribute_values
def copy_attribute_values(source, target, property_names): """Function to copy attributes from a source to a target object. This method copies the property values in a given list from a given source object to a target source object. :param source: The source object that is to be inspected for property values....
python
def copy_attribute_values(source, target, property_names): """Function to copy attributes from a source to a target object. This method copies the property values in a given list from a given source object to a target source object. :param source: The source object that is to be inspected for property values....
[ "def", "copy_attribute_values", "(", "source", ",", "target", ",", "property_names", ")", ":", "if", "source", "is", "None", ":", "raise", "ValueError", "(", "'\"source\" must be provided.'", ")", "if", "target", "is", "None", ":", "raise", "ValueError", "(", ...
Function to copy attributes from a source to a target object. This method copies the property values in a given list from a given source object to a target source object. :param source: The source object that is to be inspected for property values. :type source: type :param target: The target object that will be ...
[ "Function", "to", "copy", "attributes", "from", "a", "source", "to", "a", "target", "object", "." ]
ea7ac74d756872a34bd2fb6f8518fd5d7c6ba6f8
https://github.com/neoinsanity/cognate/blob/ea7ac74d756872a34bd2fb6f8518fd5d7c6ba6f8/cognate/component_core.py#L414-L466
250,801
neoinsanity/cognate
cognate/component_core.py
ComponentCore._configure_logging
def _configure_logging(self): """This method configures the self.log entity for log handling. :return: None The method will cognate_configure the logging facilities for the derive service instance. This includes setting up logging to files and console. The configured log will b...
python
def _configure_logging(self): """This method configures the self.log entity for log handling. :return: None The method will cognate_configure the logging facilities for the derive service instance. This includes setting up logging to files and console. The configured log will b...
[ "def", "_configure_logging", "(", "self", ")", ":", "self", ".", "log_level", "=", "ComponentCore", ".", "LOG_LEVEL_MAP", ".", "get", "(", "self", ".", "log_level", ",", "logging", ".", "ERROR", ")", "# assign the windmill instance logger", "self", ".", "log", ...
This method configures the self.log entity for log handling. :return: None The method will cognate_configure the logging facilities for the derive service instance. This includes setting up logging to files and console. The configured log will be available to the service instan...
[ "This", "method", "configures", "the", "self", ".", "log", "entity", "for", "log", "handling", "." ]
ea7ac74d756872a34bd2fb6f8518fd5d7c6ba6f8
https://github.com/neoinsanity/cognate/blob/ea7ac74d756872a34bd2fb6f8518fd5d7c6ba6f8/cognate/component_core.py#L221-L258
250,802
neoinsanity/cognate
cognate/component_core.py
ComponentCore._execute_configuration
def _execute_configuration(self, argv): """This method assigns an argument list to attributes assigned to self. :param argv: A list of arguments. :type argv: list<str> :return: None This is the work horse method that does the work of invoking *configuration_option* and ...
python
def _execute_configuration(self, argv): """This method assigns an argument list to attributes assigned to self. :param argv: A list of arguments. :type argv: list<str> :return: None This is the work horse method that does the work of invoking *configuration_option* and ...
[ "def", "_execute_configuration", "(", "self", ",", "argv", ")", ":", "if", "argv", "is", "None", ":", "argv", "=", "[", "]", "# just create an empty arg list", "# ensure that sys.argv is not modified in case it was passed.", "if", "argv", "is", "sys", ".", "argv", "...
This method assigns an argument list to attributes assigned to self. :param argv: A list of arguments. :type argv: list<str> :return: None This is the work horse method that does the work of invoking *configuration_option* and *cognate_configure* methods on progenitor c...
[ "This", "method", "assigns", "an", "argument", "list", "to", "attributes", "assigned", "to", "self", "." ]
ea7ac74d756872a34bd2fb6f8518fd5d7c6ba6f8
https://github.com/neoinsanity/cognate/blob/ea7ac74d756872a34bd2fb6f8518fd5d7c6ba6f8/cognate/component_core.py#L260-L315
250,803
neoinsanity/cognate
cognate/component_core.py
ComponentCore.invoke_method_on_children
def invoke_method_on_children(self, func_name=None, *args, **kwargs): """This helper method will walk the primary base class hierarchy to invoke a method if it exists for a given child base class. :param func_name: The name of a function to search for invocation. :type func_name: str ...
python
def invoke_method_on_children(self, func_name=None, *args, **kwargs): """This helper method will walk the primary base class hierarchy to invoke a method if it exists for a given child base class. :param func_name: The name of a function to search for invocation. :type func_name: str ...
[ "def", "invoke_method_on_children", "(", "self", ",", "func_name", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "func_name", "is", "None", ":", "raise", "ValueError", "(", "'invoke_method_on_children:func_name parameter required'", ")", ...
This helper method will walk the primary base class hierarchy to invoke a method if it exists for a given child base class. :param func_name: The name of a function to search for invocation. :type func_name: str :param args: An argument list to pass to the target function. :type...
[ "This", "helper", "method", "will", "walk", "the", "primary", "base", "class", "hierarchy", "to", "invoke", "a", "method", "if", "it", "exists", "for", "a", "given", "child", "base", "class", "." ]
ea7ac74d756872a34bd2fb6f8518fd5d7c6ba6f8
https://github.com/neoinsanity/cognate/blob/ea7ac74d756872a34bd2fb6f8518fd5d7c6ba6f8/cognate/component_core.py#L317-L405
250,804
abhinav/reversible
reversible/core.py
execute
def execute(action): """ Execute the given action. An action is any object with a ``forwards()`` and ``backwards()`` method. .. code-block:: python class CreateUser(object): def __init__(self, userinfo): self.userinfo = userinfo self.user_id = Non...
python
def execute(action): """ Execute the given action. An action is any object with a ``forwards()`` and ``backwards()`` method. .. code-block:: python class CreateUser(object): def __init__(self, userinfo): self.userinfo = userinfo self.user_id = Non...
[ "def", "execute", "(", "action", ")", ":", "# TODO this should probably be a class to configure logging, etc. The", "# global execute can refer to the \"default\" instance of the executor.", "try", ":", "return", "action", ".", "forwards", "(", ")", "except", "Exception", ":", ...
Execute the given action. An action is any object with a ``forwards()`` and ``backwards()`` method. .. code-block:: python class CreateUser(object): def __init__(self, userinfo): self.userinfo = userinfo self.user_id = None def forwards(self)...
[ "Execute", "the", "given", "action", "." ]
7e28aaf0390f7d4b889c6ac14d7b340f8f314e89
https://github.com/abhinav/reversible/blob/7e28aaf0390f7d4b889c6ac14d7b340f8f314e89/reversible/core.py#L9-L61
250,805
abhinav/reversible
reversible/core.py
action
def action(forwards=None, context_class=None): """ Decorator to build functions. This decorator can be applied to a function to build actions. The decorated function becomes the ``forwards`` implementation of the action. The first argument of the ``forwards`` implementation is a context object ...
python
def action(forwards=None, context_class=None): """ Decorator to build functions. This decorator can be applied to a function to build actions. The decorated function becomes the ``forwards`` implementation of the action. The first argument of the ``forwards`` implementation is a context object ...
[ "def", "action", "(", "forwards", "=", "None", ",", "context_class", "=", "None", ")", ":", "context_class", "=", "context_class", "or", "dict", "def", "decorator", "(", "_forwards", ")", ":", "return", "ActionBuilder", "(", "_forwards", ",", "context_class", ...
Decorator to build functions. This decorator can be applied to a function to build actions. The decorated function becomes the ``forwards`` implementation of the action. The first argument of the ``forwards`` implementation is a context object that can be used to share state between the forwards and ba...
[ "Decorator", "to", "build", "functions", "." ]
7e28aaf0390f7d4b889c6ac14d7b340f8f314e89
https://github.com/abhinav/reversible/blob/7e28aaf0390f7d4b889c6ac14d7b340f8f314e89/reversible/core.py#L125-L199
250,806
abhinav/reversible
reversible/core.py
ActionBuilder.backwards
def backwards(self, backwards): """Decorator to specify the ``backwards`` action.""" if self._backwards is not None: raise ValueError('Backwards action already specified.') self._backwards = backwards return backwards
python
def backwards(self, backwards): """Decorator to specify the ``backwards`` action.""" if self._backwards is not None: raise ValueError('Backwards action already specified.') self._backwards = backwards return backwards
[ "def", "backwards", "(", "self", ",", "backwards", ")", ":", "if", "self", ".", "_backwards", "is", "not", "None", ":", "raise", "ValueError", "(", "'Backwards action already specified.'", ")", "self", ".", "_backwards", "=", "backwards", "return", "backwards" ]
Decorator to specify the ``backwards`` action.
[ "Decorator", "to", "specify", "the", "backwards", "action", "." ]
7e28aaf0390f7d4b889c6ac14d7b340f8f314e89
https://github.com/abhinav/reversible/blob/7e28aaf0390f7d4b889c6ac14d7b340f8f314e89/reversible/core.py#L110-L117
250,807
eddiejessup/spatious
spatious/geom.py
sphere_volume
def sphere_volume(R, n): """Return the volume of a sphere in an arbitrary number of dimensions. Parameters ---------- R: array-like Radius. n: array-like The number of dimensions of the space in which the sphere lives. Returns ------- V: array-like Volume. "...
python
def sphere_volume(R, n): """Return the volume of a sphere in an arbitrary number of dimensions. Parameters ---------- R: array-like Radius. n: array-like The number of dimensions of the space in which the sphere lives. Returns ------- V: array-like Volume. "...
[ "def", "sphere_volume", "(", "R", ",", "n", ")", ":", "return", "(", "(", "np", ".", "pi", "**", "(", "n", "/", "2.0", ")", ")", "/", "scipy", ".", "special", ".", "gamma", "(", "n", "/", "2.0", "+", "1", ")", ")", "*", "R", "**", "n" ]
Return the volume of a sphere in an arbitrary number of dimensions. Parameters ---------- R: array-like Radius. n: array-like The number of dimensions of the space in which the sphere lives. Returns ------- V: array-like Volume.
[ "Return", "the", "volume", "of", "a", "sphere", "in", "an", "arbitrary", "number", "of", "dimensions", "." ]
b7ae91bec029e85a45a7f303ee184076433723cd
https://github.com/eddiejessup/spatious/blob/b7ae91bec029e85a45a7f303ee184076433723cd/spatious/geom.py#L12-L27
250,808
eddiejessup/spatious
spatious/geom.py
sphere_radius
def sphere_radius(V, n): """Return the radius of a sphere in an arbitrary number of dimensions. Parameters ---------- V: array-like Volume. n: array-like The number of dimensions of the space in which the sphere lives. Returns ------- R: array-like Radius. "...
python
def sphere_radius(V, n): """Return the radius of a sphere in an arbitrary number of dimensions. Parameters ---------- V: array-like Volume. n: array-like The number of dimensions of the space in which the sphere lives. Returns ------- R: array-like Radius. "...
[ "def", "sphere_radius", "(", "V", ",", "n", ")", ":", "return", "(", "(", "(", "scipy", ".", "special", ".", "gamma", "(", "n", "/", "2.0", "+", "1.0", ")", "*", "V", ")", "**", "(", "1.0", "/", "n", ")", ")", "/", "np", ".", "sqrt", "(", ...
Return the radius of a sphere in an arbitrary number of dimensions. Parameters ---------- V: array-like Volume. n: array-like The number of dimensions of the space in which the sphere lives. Returns ------- R: array-like Radius.
[ "Return", "the", "radius", "of", "a", "sphere", "in", "an", "arbitrary", "number", "of", "dimensions", "." ]
b7ae91bec029e85a45a7f303ee184076433723cd
https://github.com/eddiejessup/spatious/blob/b7ae91bec029e85a45a7f303ee184076433723cd/spatious/geom.py#L30-L46
250,809
eddiejessup/spatious
spatious/geom.py
spheres_sep
def spheres_sep(ar, aR, br, bR): """Return the separation distance between two spheres. Parameters ---------- ar, br: array-like, shape (n,) in n dimensions Coordinates of the centres of the spheres `a` and `b`. aR, bR: float Radiuses of the spheres `a` and `b`. Returns ---...
python
def spheres_sep(ar, aR, br, bR): """Return the separation distance between two spheres. Parameters ---------- ar, br: array-like, shape (n,) in n dimensions Coordinates of the centres of the spheres `a` and `b`. aR, bR: float Radiuses of the spheres `a` and `b`. Returns ---...
[ "def", "spheres_sep", "(", "ar", ",", "aR", ",", "br", ",", "bR", ")", ":", "return", "vector", ".", "vector_mag", "(", "ar", "-", "br", ")", "-", "(", "aR", "+", "bR", ")" ]
Return the separation distance between two spheres. Parameters ---------- ar, br: array-like, shape (n,) in n dimensions Coordinates of the centres of the spheres `a` and `b`. aR, bR: float Radiuses of the spheres `a` and `b`. Returns ------- d: float Separation dis...
[ "Return", "the", "separation", "distance", "between", "two", "spheres", "." ]
b7ae91bec029e85a45a7f303ee184076433723cd
https://github.com/eddiejessup/spatious/blob/b7ae91bec029e85a45a7f303ee184076433723cd/spatious/geom.py#L223-L239
250,810
eddiejessup/spatious
spatious/geom.py
spheres_intersect
def spheres_intersect(ar, aR, br, bR): """Return whether or not two spheres intersect each other. Parameters ---------- ar, br: array-like, shape (n,) in n dimensions Coordinates of the centres of the spheres `a` and `b`. aR, bR: float Radiuses of the spheres `a` and `b`. Retur...
python
def spheres_intersect(ar, aR, br, bR): """Return whether or not two spheres intersect each other. Parameters ---------- ar, br: array-like, shape (n,) in n dimensions Coordinates of the centres of the spheres `a` and `b`. aR, bR: float Radiuses of the spheres `a` and `b`. Retur...
[ "def", "spheres_intersect", "(", "ar", ",", "aR", ",", "br", ",", "bR", ")", ":", "return", "vector", ".", "vector_mag_sq", "(", "ar", "-", "br", ")", "<", "(", "aR", "+", "bR", ")", "**", "2" ]
Return whether or not two spheres intersect each other. Parameters ---------- ar, br: array-like, shape (n,) in n dimensions Coordinates of the centres of the spheres `a` and `b`. aR, bR: float Radiuses of the spheres `a` and `b`. Returns ------- intersecting: boolean ...
[ "Return", "whether", "or", "not", "two", "spheres", "intersect", "each", "other", "." ]
b7ae91bec029e85a45a7f303ee184076433723cd
https://github.com/eddiejessup/spatious/blob/b7ae91bec029e85a45a7f303ee184076433723cd/spatious/geom.py#L242-L257
250,811
eddiejessup/spatious
spatious/geom.py
point_seg_sep
def point_seg_sep(ar, br1, br2): """Return the minimum separation vector between a point and a line segment, in 3 dimensions. Parameters ---------- ar: array-like, shape (3,) Coordinates of a point. br1, br2: array-like, shape (3,) Coordinates for the points of a line segment ...
python
def point_seg_sep(ar, br1, br2): """Return the minimum separation vector between a point and a line segment, in 3 dimensions. Parameters ---------- ar: array-like, shape (3,) Coordinates of a point. br1, br2: array-like, shape (3,) Coordinates for the points of a line segment ...
[ "def", "point_seg_sep", "(", "ar", ",", "br1", ",", "br2", ")", ":", "v", "=", "br2", "-", "br1", "w", "=", "ar", "-", "br1", "c1", "=", "np", ".", "dot", "(", "w", ",", "v", ")", "if", "c1", "<=", "0.0", ":", "return", "ar", "-", "br1", ...
Return the minimum separation vector between a point and a line segment, in 3 dimensions. Parameters ---------- ar: array-like, shape (3,) Coordinates of a point. br1, br2: array-like, shape (3,) Coordinates for the points of a line segment Returns ------- sep: float ar...
[ "Return", "the", "minimum", "separation", "vector", "between", "a", "point", "and", "a", "line", "segment", "in", "3", "dimensions", "." ]
b7ae91bec029e85a45a7f303ee184076433723cd
https://github.com/eddiejessup/spatious/blob/b7ae91bec029e85a45a7f303ee184076433723cd/spatious/geom.py#L260-L289
250,812
xtrementl/focus
focus/common.py
readfile
def readfile(filename, binary=False): """ Reads the contents of the specified file. `filename` Filename to read. `binary` Set to ``True`` to indicate a binary file. Returns string or ``None``. """ if not os.path.isfile(filename): return None ...
python
def readfile(filename, binary=False): """ Reads the contents of the specified file. `filename` Filename to read. `binary` Set to ``True`` to indicate a binary file. Returns string or ``None``. """ if not os.path.isfile(filename): return None ...
[ "def", "readfile", "(", "filename", ",", "binary", "=", "False", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "filename", ")", ":", "return", "None", "try", ":", "flags", "=", "'r'", "if", "not", "binary", "else", "'rb'", "with", "...
Reads the contents of the specified file. `filename` Filename to read. `binary` Set to ``True`` to indicate a binary file. Returns string or ``None``.
[ "Reads", "the", "contents", "of", "the", "specified", "file", "." ]
cbbbc0b49a7409f9e0dc899de5b7e057f50838e4
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/common.py#L18-L38
250,813
xtrementl/focus
focus/common.py
writefile
def writefile(filename, data, binary=False): """ Write the provided data to the file. `filename` Filename to write. `data` Data buffer to write. `binary` Set to ``True`` to indicate a binary file. Returns boolean. """ try: fla...
python
def writefile(filename, data, binary=False): """ Write the provided data to the file. `filename` Filename to write. `data` Data buffer to write. `binary` Set to ``True`` to indicate a binary file. Returns boolean. """ try: fla...
[ "def", "writefile", "(", "filename", ",", "data", ",", "binary", "=", "False", ")", ":", "try", ":", "flags", "=", "'w'", "if", "not", "binary", "else", "'wb'", "with", "open", "(", "filename", ",", "flags", ")", "as", "_file", ":", "_file", ".", "...
Write the provided data to the file. `filename` Filename to write. `data` Data buffer to write. `binary` Set to ``True`` to indicate a binary file. Returns boolean.
[ "Write", "the", "provided", "data", "to", "the", "file", "." ]
cbbbc0b49a7409f9e0dc899de5b7e057f50838e4
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/common.py#L41-L61
250,814
xtrementl/focus
focus/common.py
which
def which(name): """ Returns the full path to executable in path matching provided name. `name` String value. Returns string or ``None``. """ # we were given a filename, return it if it's executable if os.path.dirname(name) != '': if not os.path.isdir(name) and...
python
def which(name): """ Returns the full path to executable in path matching provided name. `name` String value. Returns string or ``None``. """ # we were given a filename, return it if it's executable if os.path.dirname(name) != '': if not os.path.isdir(name) and...
[ "def", "which", "(", "name", ")", ":", "# we were given a filename, return it if it's executable", "if", "os", ".", "path", ".", "dirname", "(", "name", ")", "!=", "''", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "name", ")", "and", "os", "....
Returns the full path to executable in path matching provided name. `name` String value. Returns string or ``None``.
[ "Returns", "the", "full", "path", "to", "executable", "in", "path", "matching", "provided", "name", "." ]
cbbbc0b49a7409f9e0dc899de5b7e057f50838e4
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/common.py#L75-L101
250,815
xtrementl/focus
focus/common.py
extract_app_paths
def extract_app_paths(values, app_should_exist=True): """ Extracts application paths from the values provided. `values` List of strings to extract paths from. `app_should_exist` Set to ``True`` to check that application file exists. Returns list of strings. ...
python
def extract_app_paths(values, app_should_exist=True): """ Extracts application paths from the values provided. `values` List of strings to extract paths from. `app_should_exist` Set to ``True`` to check that application file exists. Returns list of strings. ...
[ "def", "extract_app_paths", "(", "values", ",", "app_should_exist", "=", "True", ")", ":", "def", "_osx_app_path", "(", "name", ")", ":", "\"\"\" Attempts to find the full application path for the name specified.\n\n `name`\n Application name.\n\n ...
Extracts application paths from the values provided. `values` List of strings to extract paths from. `app_should_exist` Set to ``True`` to check that application file exists. Returns list of strings. * Raises ``ValueError`` exception if value extraction fails.
[ "Extracts", "application", "paths", "from", "the", "values", "provided", "." ]
cbbbc0b49a7409f9e0dc899de5b7e057f50838e4
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/common.py#L104-L189
250,816
xtrementl/focus
focus/common.py
shell_process
def shell_process(command, input_data=None, background=False, exitcode=False): """ Shells a process with the given shell command. `command` Shell command to spawn. `input_data` String to pipe to process as input. `background` Set to ``True`` to fork proce...
python
def shell_process(command, input_data=None, background=False, exitcode=False): """ Shells a process with the given shell command. `command` Shell command to spawn. `input_data` String to pipe to process as input. `background` Set to ``True`` to fork proce...
[ "def", "shell_process", "(", "command", ",", "input_data", "=", "None", ",", "background", "=", "False", ",", "exitcode", "=", "False", ")", ":", "data", "=", "None", "try", ":", "# kick off the process", "kwargs", "=", "{", "'shell'", ":", "isinstance", "...
Shells a process with the given shell command. `command` Shell command to spawn. `input_data` String to pipe to process as input. `background` Set to ``True`` to fork process into background. NOTE: This exits immediately with no result returned. ...
[ "Shells", "a", "process", "with", "the", "given", "shell", "command", "." ]
cbbbc0b49a7409f9e0dc899de5b7e057f50838e4
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/common.py#L192-L249
250,817
xtrementl/focus
focus/common.py
to_utf8
def to_utf8(buf, errors='replace'): """ Encodes a string into a UTF-8 compatible, ASCII string. `buf` string or unicode to convert. Returns string. * Raises a ``UnicodeEncodeError`` exception if encoding failed and `errors` isn't set to 'replace'. """ if...
python
def to_utf8(buf, errors='replace'): """ Encodes a string into a UTF-8 compatible, ASCII string. `buf` string or unicode to convert. Returns string. * Raises a ``UnicodeEncodeError`` exception if encoding failed and `errors` isn't set to 'replace'. """ if...
[ "def", "to_utf8", "(", "buf", ",", "errors", "=", "'replace'", ")", ":", "if", "isinstance", "(", "buf", ",", "unicode", ")", ":", "return", "buf", ".", "encode", "(", "'utf-8'", ",", "errors", ")", "else", ":", "return", "buf" ]
Encodes a string into a UTF-8 compatible, ASCII string. `buf` string or unicode to convert. Returns string. * Raises a ``UnicodeEncodeError`` exception if encoding failed and `errors` isn't set to 'replace'.
[ "Encodes", "a", "string", "into", "a", "UTF", "-", "8", "compatible", "ASCII", "string", "." ]
cbbbc0b49a7409f9e0dc899de5b7e057f50838e4
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/common.py#L252-L268
250,818
xtrementl/focus
focus/common.py
from_utf8
def from_utf8(buf, errors='replace'): """ Decodes a UTF-8 compatible, ASCII string into a unicode object. `buf` string or unicode string to convert. Returns unicode` string. * Raises a ``UnicodeDecodeError`` exception if encoding failed and `errors` isn't set to 'rep...
python
def from_utf8(buf, errors='replace'): """ Decodes a UTF-8 compatible, ASCII string into a unicode object. `buf` string or unicode string to convert. Returns unicode` string. * Raises a ``UnicodeDecodeError`` exception if encoding failed and `errors` isn't set to 'rep...
[ "def", "from_utf8", "(", "buf", ",", "errors", "=", "'replace'", ")", ":", "if", "isinstance", "(", "buf", ",", "unicode", ")", ":", "return", "buf", "else", ":", "return", "unicode", "(", "buf", ",", "'utf-8'", ",", "errors", ")" ]
Decodes a UTF-8 compatible, ASCII string into a unicode object. `buf` string or unicode string to convert. Returns unicode` string. * Raises a ``UnicodeDecodeError`` exception if encoding failed and `errors` isn't set to 'replace'.
[ "Decodes", "a", "UTF", "-", "8", "compatible", "ASCII", "string", "into", "a", "unicode", "object", "." ]
cbbbc0b49a7409f9e0dc899de5b7e057f50838e4
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/common.py#L271-L287
250,819
dugan/coverage-reporter
coverage_reporter/options.py
Option.get
def get(self, value, cfg=None): """ Returns value for this option from either cfg object or optparse option list, preferring the option list. """ if value is None and cfg: if self.option_type == 'list': value = cfg.get_list(self.name, None) else: ...
python
def get(self, value, cfg=None): """ Returns value for this option from either cfg object or optparse option list, preferring the option list. """ if value is None and cfg: if self.option_type == 'list': value = cfg.get_list(self.name, None) else: ...
[ "def", "get", "(", "self", ",", "value", ",", "cfg", "=", "None", ")", ":", "if", "value", "is", "None", "and", "cfg", ":", "if", "self", ".", "option_type", "==", "'list'", ":", "value", "=", "cfg", ".", "get_list", "(", "self", ".", "name", ","...
Returns value for this option from either cfg object or optparse option list, preferring the option list.
[ "Returns", "value", "for", "this", "option", "from", "either", "cfg", "object", "or", "optparse", "option", "list", "preferring", "the", "option", "list", "." ]
18ecc9189de4f62b15366901b2451b8047f1ccfb
https://github.com/dugan/coverage-reporter/blob/18ecc9189de4f62b15366901b2451b8047f1ccfb/coverage_reporter/options.py#L68-L84
250,820
dhain/potpy
potpy/wsgi.py
PathRouter.add
def add(self, *args): """Add a path template and handler. :param name: Optional. If specified, allows reverse path lookup with :meth:`reverse`. :param template: A string or :class:`~potpy.template.Template` instance used to match paths against. Strings will be wrapped in...
python
def add(self, *args): """Add a path template and handler. :param name: Optional. If specified, allows reverse path lookup with :meth:`reverse`. :param template: A string or :class:`~potpy.template.Template` instance used to match paths against. Strings will be wrapped in...
[ "def", "add", "(", "self", ",", "*", "args", ")", ":", "if", "len", "(", "args", ")", ">", "2", ":", "name", ",", "template", "=", "args", "[", ":", "2", "]", "args", "=", "args", "[", "2", ":", "]", "else", ":", "name", "=", "None", "templ...
Add a path template and handler. :param name: Optional. If specified, allows reverse path lookup with :meth:`reverse`. :param template: A string or :class:`~potpy.template.Template` instance used to match paths against. Strings will be wrapped in a Template instance....
[ "Add", "a", "path", "template", "and", "handler", "." ]
e39a5a84f763fbf144b07a620afb02a5ff3741c9
https://github.com/dhain/potpy/blob/e39a5a84f763fbf144b07a620afb02a5ff3741c9/potpy/wsgi.py#L39-L65
250,821
dhain/potpy
potpy/wsgi.py
PathRouter.reverse
def reverse(self, *args, **kwargs): """Look up a path by name and fill in the provided parameters. Example: >>> handler = lambda: None # just a bogus handler >>> router = PathRouter(('post', '/posts/{slug}', handler)) >>> router.reverse('post', slug='my-post') ...
python
def reverse(self, *args, **kwargs): """Look up a path by name and fill in the provided parameters. Example: >>> handler = lambda: None # just a bogus handler >>> router = PathRouter(('post', '/posts/{slug}', handler)) >>> router.reverse('post', slug='my-post') ...
[ "def", "reverse", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "(", "name", ",", ")", "=", "args", "return", "self", ".", "_templates", "[", "name", "]", ".", "fill", "(", "*", "*", "kwargs", ")" ]
Look up a path by name and fill in the provided parameters. Example: >>> handler = lambda: None # just a bogus handler >>> router = PathRouter(('post', '/posts/{slug}', handler)) >>> router.reverse('post', slug='my-post') '/posts/my-post'
[ "Look", "up", "a", "path", "by", "name", "and", "fill", "in", "the", "provided", "parameters", "." ]
e39a5a84f763fbf144b07a620afb02a5ff3741c9
https://github.com/dhain/potpy/blob/e39a5a84f763fbf144b07a620afb02a5ff3741c9/potpy/wsgi.py#L88-L99
250,822
dhain/potpy
potpy/wsgi.py
MethodRouter.match
def match(self, methods, request_method): """Check for a method match. :param methods: A method or tuple of methods to match against. :param request_method: The method to check for a match. :returns: An empty :class:`dict` in the case of a match, or ``None`` if there is no m...
python
def match(self, methods, request_method): """Check for a method match. :param methods: A method or tuple of methods to match against. :param request_method: The method to check for a match. :returns: An empty :class:`dict` in the case of a match, or ``None`` if there is no m...
[ "def", "match", "(", "self", ",", "methods", ",", "request_method", ")", ":", "if", "isinstance", "(", "methods", ",", "basestring", ")", ":", "return", "{", "}", "if", "request_method", "==", "methods", "else", "None", "return", "{", "}", "if", "request...
Check for a method match. :param methods: A method or tuple of methods to match against. :param request_method: The method to check for a match. :returns: An empty :class:`dict` in the case of a match, or ``None`` if there is no matching handler for the given method. Exampl...
[ "Check", "for", "a", "method", "match", "." ]
e39a5a84f763fbf144b07a620afb02a5ff3741c9
https://github.com/dhain/potpy/blob/e39a5a84f763fbf144b07a620afb02a5ff3741c9/potpy/wsgi.py#L136-L152
250,823
EventTeam/beliefs
src/beliefs/cells/sets.py
SetIntersectionCell.coerce
def coerce(self, value): """ Ensures that a value is a SetCell """ if hasattr(value, 'values') and hasattr(value, 'domain'): return value elif hasattr(value, '__iter__'): # if the values are consistent with the comparison's domains, then # copy...
python
def coerce(self, value): """ Ensures that a value is a SetCell """ if hasattr(value, 'values') and hasattr(value, 'domain'): return value elif hasattr(value, '__iter__'): # if the values are consistent with the comparison's domains, then # copy...
[ "def", "coerce", "(", "self", ",", "value", ")", ":", "if", "hasattr", "(", "value", ",", "'values'", ")", "and", "hasattr", "(", "value", ",", "'domain'", ")", ":", "return", "value", "elif", "hasattr", "(", "value", ",", "'__iter__'", ")", ":", "# ...
Ensures that a value is a SetCell
[ "Ensures", "that", "a", "value", "is", "a", "SetCell" ]
c07d22b61bebeede74a72800030dde770bf64208
https://github.com/EventTeam/beliefs/blob/c07d22b61bebeede74a72800030dde770bf64208/src/beliefs/cells/sets.py#L35-L51
250,824
EventTeam/beliefs
src/beliefs/cells/sets.py
SetIntersectionCell.same_domain
def same_domain(self, other): """ Cheap pointer comparison or symmetric difference operation to ensure domains are the same """ return self.domain == other.domain or \ len(self.domain.symmetric_difference(set(other.domain))) == 0
python
def same_domain(self, other): """ Cheap pointer comparison or symmetric difference operation to ensure domains are the same """ return self.domain == other.domain or \ len(self.domain.symmetric_difference(set(other.domain))) == 0
[ "def", "same_domain", "(", "self", ",", "other", ")", ":", "return", "self", ".", "domain", "==", "other", ".", "domain", "or", "len", "(", "self", ".", "domain", ".", "symmetric_difference", "(", "set", "(", "other", ".", "domain", ")", ")", ")", "=...
Cheap pointer comparison or symmetric difference operation to ensure domains are the same
[ "Cheap", "pointer", "comparison", "or", "symmetric", "difference", "operation", "to", "ensure", "domains", "are", "the", "same" ]
c07d22b61bebeede74a72800030dde770bf64208
https://github.com/EventTeam/beliefs/blob/c07d22b61bebeede74a72800030dde770bf64208/src/beliefs/cells/sets.py#L53-L59
250,825
EventTeam/beliefs
src/beliefs/cells/sets.py
SetIntersectionCell.is_equal
def is_equal(self, other): """ True iff all members are the same """ other = self.coerce(other) return len(self.get_values().symmetric_difference(other.get_values())) == 0
python
def is_equal(self, other): """ True iff all members are the same """ other = self.coerce(other) return len(self.get_values().symmetric_difference(other.get_values())) == 0
[ "def", "is_equal", "(", "self", ",", "other", ")", ":", "other", "=", "self", ".", "coerce", "(", "other", ")", "return", "len", "(", "self", ".", "get_values", "(", ")", ".", "symmetric_difference", "(", "other", ".", "get_values", "(", ")", ")", ")...
True iff all members are the same
[ "True", "iff", "all", "members", "are", "the", "same" ]
c07d22b61bebeede74a72800030dde770bf64208
https://github.com/EventTeam/beliefs/blob/c07d22b61bebeede74a72800030dde770bf64208/src/beliefs/cells/sets.py#L60-L65
250,826
bfontaine/firapria
firapria/pollution.py
get_indices
def get_indices(): """ Return a list of 3 integers representing EU indices for yesterday, today and tomorrow. """ doc = BeautifulSoup(urlopen(BASEURL)) divs = doc.select('.indices_txt') if not divs: return None sibling = divs[1].nextSibling if not sibling: return No...
python
def get_indices(): """ Return a list of 3 integers representing EU indices for yesterday, today and tomorrow. """ doc = BeautifulSoup(urlopen(BASEURL)) divs = doc.select('.indices_txt') if not divs: return None sibling = divs[1].nextSibling if not sibling: return No...
[ "def", "get_indices", "(", ")", ":", "doc", "=", "BeautifulSoup", "(", "urlopen", "(", "BASEURL", ")", ")", "divs", "=", "doc", ".", "select", "(", "'.indices_txt'", ")", "if", "not", "divs", ":", "return", "None", "sibling", "=", "divs", "[", "1", "...
Return a list of 3 integers representing EU indices for yesterday, today and tomorrow.
[ "Return", "a", "list", "of", "3", "integers", "representing", "EU", "indices", "for", "yesterday", "today", "and", "tomorrow", "." ]
a2eeeab6f6d1db50337950cfbd6f835272306ff0
https://github.com/bfontaine/firapria/blob/a2eeeab6f6d1db50337950cfbd6f835272306ff0/firapria/pollution.py#L17-L40
250,827
heikomuller/sco-datastore
scodata/__init__.py
create_dir
def create_dir(directory): """Create given directory, if doesn't exist. Parameters ---------- directory : string Directory path (can be relative or absolute) Returns ------- string Absolute directory path """ if not os.access(directory, os.F_OK): os.makedirs...
python
def create_dir(directory): """Create given directory, if doesn't exist. Parameters ---------- directory : string Directory path (can be relative or absolute) Returns ------- string Absolute directory path """ if not os.access(directory, os.F_OK): os.makedirs...
[ "def", "create_dir", "(", "directory", ")", ":", "if", "not", "os", ".", "access", "(", "directory", ",", "os", ".", "F_OK", ")", ":", "os", ".", "makedirs", "(", "directory", ")", "return", "os", ".", "path", ".", "abspath", "(", "directory", ")" ]
Create given directory, if doesn't exist. Parameters ---------- directory : string Directory path (can be relative or absolute) Returns ------- string Absolute directory path
[ "Create", "given", "directory", "if", "doesn", "t", "exist", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L1212-L1227
250,828
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.experiments_create
def experiments_create(self, subject_id, image_group_id, properties): """Create an experiment object with subject, and image group. Objects are referenced by their unique identifiers. The API ensure that at time of creation all referenced objects exist. Referential consistency, however, ...
python
def experiments_create(self, subject_id, image_group_id, properties): """Create an experiment object with subject, and image group. Objects are referenced by their unique identifiers. The API ensure that at time of creation all referenced objects exist. Referential consistency, however, ...
[ "def", "experiments_create", "(", "self", ",", "subject_id", ",", "image_group_id", ",", "properties", ")", ":", "# Ensure that reference subject exists", "if", "self", ".", "subjects_get", "(", "subject_id", ")", "is", "None", ":", "raise", "ValueError", "(", "'u...
Create an experiment object with subject, and image group. Objects are referenced by their unique identifiers. The API ensure that at time of creation all referenced objects exist. Referential consistency, however, is currently not enforced when objects are deleted. Expects experiment n...
[ "Create", "an", "experiment", "object", "with", "subject", "and", "image", "group", ".", "Objects", "are", "referenced", "by", "their", "unique", "identifiers", ".", "The", "API", "ensure", "that", "at", "time", "of", "creation", "all", "referenced", "objects"...
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L110-L142
250,829
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.experiments_fmri_create
def experiments_fmri_create(self, experiment_id, filename): """Create functional data object from given file and associate the object with the specified experiment. Parameters ---------- experiment_id : string Unique experiment identifier filename : File-type...
python
def experiments_fmri_create(self, experiment_id, filename): """Create functional data object from given file and associate the object with the specified experiment. Parameters ---------- experiment_id : string Unique experiment identifier filename : File-type...
[ "def", "experiments_fmri_create", "(", "self", ",", "experiment_id", ",", "filename", ")", ":", "# Get the experiment to ensure that it exist before we even create the", "# functional data object", "experiment", "=", "self", ".", "experiments_get", "(", "experiment_id", ")", ...
Create functional data object from given file and associate the object with the specified experiment. Parameters ---------- experiment_id : string Unique experiment identifier filename : File-type object Functional data file Returns -----...
[ "Create", "functional", "data", "object", "from", "given", "file", "and", "associate", "the", "object", "with", "the", "specified", "experiment", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L163-L198
250,830
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.experiments_fmri_delete
def experiments_fmri_delete(self, experiment_id): """Delete fMRI data object associated with given experiment. Raises ValueError if an attempt is made to delete a read-only resource. Parameters ---------- experiment_id : string Unique experiment identifier ...
python
def experiments_fmri_delete(self, experiment_id): """Delete fMRI data object associated with given experiment. Raises ValueError if an attempt is made to delete a read-only resource. Parameters ---------- experiment_id : string Unique experiment identifier ...
[ "def", "experiments_fmri_delete", "(", "self", ",", "experiment_id", ")", ":", "# Get experiment fMRI to ensure that it exists", "fmri", "=", "self", ".", "experiments_fmri_get", "(", "experiment_id", ")", "if", "fmri", "is", "None", ":", "return", "None", "# Delete r...
Delete fMRI data object associated with given experiment. Raises ValueError if an attempt is made to delete a read-only resource. Parameters ---------- experiment_id : string Unique experiment identifier Returns ------- FMRIDataHandle Ha...
[ "Delete", "fMRI", "data", "object", "associated", "with", "given", "experiment", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L200-L226
250,831
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.experiments_fmri_download
def experiments_fmri_download(self, experiment_id): """Download the fMRI data file associated with given experiment. Parameters ---------- experiment_id : string Unique experiment identifier Returns ------- FileInfo Information about fMRI...
python
def experiments_fmri_download(self, experiment_id): """Download the fMRI data file associated with given experiment. Parameters ---------- experiment_id : string Unique experiment identifier Returns ------- FileInfo Information about fMRI...
[ "def", "experiments_fmri_download", "(", "self", ",", "experiment_id", ")", ":", "# Get experiment fMRI to ensure that it exists", "fmri", "=", "self", ".", "experiments_fmri_get", "(", "experiment_id", ")", "if", "fmri", "is", "None", ":", "return", "None", "# Return...
Download the fMRI data file associated with given experiment. Parameters ---------- experiment_id : string Unique experiment identifier Returns ------- FileInfo Information about fMRI file on disk or None if experiment is unknown or h...
[ "Download", "the", "fMRI", "data", "file", "associated", "with", "given", "experiment", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L228-L251
250,832
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.experiments_fmri_get
def experiments_fmri_get(self, experiment_id): """Get fMRI data object that is associated with the given experiment. Parameters ---------- experiment_id : string unique experiment identifier Returns ------- FMRIDataHandle Handle for fMRI ...
python
def experiments_fmri_get(self, experiment_id): """Get fMRI data object that is associated with the given experiment. Parameters ---------- experiment_id : string unique experiment identifier Returns ------- FMRIDataHandle Handle for fMRI ...
[ "def", "experiments_fmri_get", "(", "self", ",", "experiment_id", ")", ":", "# Get experiment to ensure that it exists", "experiment", "=", "self", ".", "experiments_get", "(", "experiment_id", ")", "if", "experiment", "is", "None", ":", "return", "None", "# Check if ...
Get fMRI data object that is associated with the given experiment. Parameters ---------- experiment_id : string unique experiment identifier Returns ------- FMRIDataHandle Handle for fMRI data object of None if (a) the experiment is unknown ...
[ "Get", "fMRI", "data", "object", "that", "is", "associated", "with", "the", "given", "experiment", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L253-L277
250,833
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.experiments_fmri_upsert_property
def experiments_fmri_upsert_property(self, experiment_id, properties): """Upsert property of fMRI data object associated with given experiment. Raises ValueError if given property dictionary results in an illegal operation. Parameters ---------- experiment_id : string ...
python
def experiments_fmri_upsert_property(self, experiment_id, properties): """Upsert property of fMRI data object associated with given experiment. Raises ValueError if given property dictionary results in an illegal operation. Parameters ---------- experiment_id : string ...
[ "def", "experiments_fmri_upsert_property", "(", "self", ",", "experiment_id", ",", "properties", ")", ":", "# Get experiment fMRI to ensure that it exists. Needed to get fMRI", "# data object identifier for given experiment identifier", "fmri", "=", "self", ".", "experiments_fmri_get...
Upsert property of fMRI data object associated with given experiment. Raises ValueError if given property dictionary results in an illegal operation. Parameters ---------- experiment_id : string Unique experiment identifier properties : Dictionary() ...
[ "Upsert", "property", "of", "fMRI", "data", "object", "associated", "with", "given", "experiment", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L279-L303
250,834
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.experiments_list
def experiments_list(self, limit=-1, offset=-1): """Retrieve list of all experiments in the data store. Parameters ---------- limit : int Limit number of results in returned object listing offset : int Set offset in list (order as defined by object store)...
python
def experiments_list(self, limit=-1, offset=-1): """Retrieve list of all experiments in the data store. Parameters ---------- limit : int Limit number of results in returned object listing offset : int Set offset in list (order as defined by object store)...
[ "def", "experiments_list", "(", "self", ",", "limit", "=", "-", "1", ",", "offset", "=", "-", "1", ")", ":", "return", "self", ".", "experiments", ".", "list_objects", "(", "limit", "=", "limit", ",", "offset", "=", "offset", ")" ]
Retrieve list of all experiments in the data store. Parameters ---------- limit : int Limit number of results in returned object listing offset : int Set offset in list (order as defined by object store) Returns ------- ObjectListing ...
[ "Retrieve", "list", "of", "all", "experiments", "in", "the", "data", "store", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L320-L335
250,835
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.experiments_predictions_attachments_download
def experiments_predictions_attachments_download(self, experiment_id, run_id, resource_id): """Download a data file that has been attached with a successful model run. Parameters ---------- experiment_id : string Unique experiment identifier model_id : string...
python
def experiments_predictions_attachments_download(self, experiment_id, run_id, resource_id): """Download a data file that has been attached with a successful model run. Parameters ---------- experiment_id : string Unique experiment identifier model_id : string...
[ "def", "experiments_predictions_attachments_download", "(", "self", ",", "experiment_id", ",", "run_id", ",", "resource_id", ")", ":", "# Get experiment to ensure that it exists", "if", "self", ".", "experiments_get", "(", "experiment_id", ")", "is", "None", ":", "retur...
Download a data file that has been attached with a successful model run. Parameters ---------- experiment_id : string Unique experiment identifier model_id : string Unique identifier of model to run resource_id : string Unique attachme...
[ "Download", "a", "data", "file", "that", "has", "been", "attached", "with", "a", "successful", "model", "run", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L398-L427
250,836
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.experiments_predictions_create
def experiments_predictions_create(self, experiment_id, model_id, argument_defs, name, arguments=None, properties=None): """Create new model run for given experiment. Parameters ---------- experiment_id : string Unique experiment identifier model_id : string ...
python
def experiments_predictions_create(self, experiment_id, model_id, argument_defs, name, arguments=None, properties=None): """Create new model run for given experiment. Parameters ---------- experiment_id : string Unique experiment identifier model_id : string ...
[ "def", "experiments_predictions_create", "(", "self", ",", "experiment_id", ",", "model_id", ",", "argument_defs", ",", "name", ",", "arguments", "=", "None", ",", "properties", "=", "None", ")", ":", "# Get experiment to ensure that it exists", "if", "self", ".", ...
Create new model run for given experiment. Parameters ---------- experiment_id : string Unique experiment identifier model_id : string Unique identifier of model to run name : string User-provided name for the model run argument_defs :...
[ "Create", "new", "model", "run", "for", "given", "experiment", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L429-L463
250,837
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.experiments_predictions_delete
def experiments_predictions_delete(self, experiment_id, run_id, erase=False): """Delete given prediction for experiment. Raises ValueError if an attempt is made to delete a read-only resource. Parameters ---------- experiment_id : string Unique experiment identifier...
python
def experiments_predictions_delete(self, experiment_id, run_id, erase=False): """Delete given prediction for experiment. Raises ValueError if an attempt is made to delete a read-only resource. Parameters ---------- experiment_id : string Unique experiment identifier...
[ "def", "experiments_predictions_delete", "(", "self", ",", "experiment_id", ",", "run_id", ",", "erase", "=", "False", ")", ":", "# Get model run to ensure that it exists", "model_run", "=", "self", ".", "experiments_predictions_get", "(", "experiment_id", ",", "run_id"...
Delete given prediction for experiment. Raises ValueError if an attempt is made to delete a read-only resource. Parameters ---------- experiment_id : string Unique experiment identifier run_id : string Unique model run identifier erase : Boolean,...
[ "Delete", "given", "prediction", "for", "experiment", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L465-L492
250,838
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.experiments_predictions_download
def experiments_predictions_download(self, experiment_id, run_id): """Donwload the results of a prediction for a given experiment. Parameters ---------- experiment_id : string Unique experiment identifier run_id : string Unique model run identifier ...
python
def experiments_predictions_download(self, experiment_id, run_id): """Donwload the results of a prediction for a given experiment. Parameters ---------- experiment_id : string Unique experiment identifier run_id : string Unique model run identifier ...
[ "def", "experiments_predictions_download", "(", "self", ",", "experiment_id", ",", "run_id", ")", ":", "# Get model run to ensure that it exists", "model_run", "=", "self", ".", "experiments_predictions_get", "(", "experiment_id", ",", "run_id", ")", "if", "model_run", ...
Donwload the results of a prediction for a given experiment. Parameters ---------- experiment_id : string Unique experiment identifier run_id : string Unique model run identifier Returns ------- FileInfo Information about pred...
[ "Donwload", "the", "results", "of", "a", "prediction", "for", "a", "given", "experiment", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L494-L527
250,839
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.experiments_predictions_get
def experiments_predictions_get(self, experiment_id, run_id): """Get prediction object with given identifier for given experiment. Parameters ---------- experiment_id : string Unique experiment identifier run_id : string Unique model run identifier ...
python
def experiments_predictions_get(self, experiment_id, run_id): """Get prediction object with given identifier for given experiment. Parameters ---------- experiment_id : string Unique experiment identifier run_id : string Unique model run identifier ...
[ "def", "experiments_predictions_get", "(", "self", ",", "experiment_id", ",", "run_id", ")", ":", "# Get experiment to ensure that it exists", "if", "self", ".", "experiments_get", "(", "experiment_id", ")", "is", "None", ":", "return", "None", "# Get predition handle t...
Get prediction object with given identifier for given experiment. Parameters ---------- experiment_id : string Unique experiment identifier run_id : string Unique model run identifier Returns ------- ModelRunHandle Handle for ...
[ "Get", "prediction", "object", "with", "given", "identifier", "for", "given", "experiment", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L529-L556
250,840
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.experiments_predictions_image_set_create
def experiments_predictions_image_set_create(self, experiment_id, run_id, filename): """Create a prediction image set from a given tar archive that was produced as the result of a successful model run. Returns None if the specified model run does not exist or did not finish successfully...
python
def experiments_predictions_image_set_create(self, experiment_id, run_id, filename): """Create a prediction image set from a given tar archive that was produced as the result of a successful model run. Returns None if the specified model run does not exist or did not finish successfully...
[ "def", "experiments_predictions_image_set_create", "(", "self", ",", "experiment_id", ",", "run_id", ",", "filename", ")", ":", "# Ensure that the model run exists and is in state SUCCESS", "model_run", "=", "self", ".", "experiments_predictions_get", "(", "experiment_id", ",...
Create a prediction image set from a given tar archive that was produced as the result of a successful model run. Returns None if the specified model run does not exist or did not finish successfully. Raises a ValueError if the given file is invalid or model run. Parameters ...
[ "Create", "a", "prediction", "image", "set", "from", "a", "given", "tar", "archive", "that", "was", "produced", "as", "the", "result", "of", "a", "successful", "model", "run", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L558-L613
250,841
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.experiments_predictions_list
def experiments_predictions_list(self, experiment_id, limit=-1, offset=-1): """List of all predictions for given experiment. Parameters ---------- experiment_id : string Unique experiment identifier limit : int Limit number of results in returned object l...
python
def experiments_predictions_list(self, experiment_id, limit=-1, offset=-1): """List of all predictions for given experiment. Parameters ---------- experiment_id : string Unique experiment identifier limit : int Limit number of results in returned object l...
[ "def", "experiments_predictions_list", "(", "self", ",", "experiment_id", ",", "limit", "=", "-", "1", ",", "offset", "=", "-", "1", ")", ":", "# Get experiment to ensure that it exists", "if", "self", ".", "experiments_get", "(", "experiment_id", ")", "is", "No...
List of all predictions for given experiment. Parameters ---------- experiment_id : string Unique experiment identifier limit : int Limit number of results in returned object listing offset : int Set offset in list (order as defined by object ...
[ "List", "of", "all", "predictions", "for", "given", "experiment", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L615-L640
250,842
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.experiments_predictions_update_state_active
def experiments_predictions_update_state_active(self, experiment_id, run_id): """Update state of given prediction to active. Parameters ---------- experiment_id : string Unique experiment identifier run_id : string Unique model run identifier Ret...
python
def experiments_predictions_update_state_active(self, experiment_id, run_id): """Update state of given prediction to active. Parameters ---------- experiment_id : string Unique experiment identifier run_id : string Unique model run identifier Ret...
[ "def", "experiments_predictions_update_state_active", "(", "self", ",", "experiment_id", ",", "run_id", ")", ":", "# Get prediction to ensure that it exists", "model_run", "=", "self", ".", "experiments_predictions_get", "(", "experiment_id", ",", "run_id", ")", "if", "mo...
Update state of given prediction to active. Parameters ---------- experiment_id : string Unique experiment identifier run_id : string Unique model run identifier Returns ------- ModelRunHandle Handle for updated model run or N...
[ "Update", "state", "of", "given", "prediction", "to", "active", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L642-L665
250,843
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.experiments_predictions_update_state_error
def experiments_predictions_update_state_error(self, experiment_id, run_id, errors): """Update state of given prediction to failed. Set error messages that where generated by the failed run execution. Parameters ---------- experiment_id : string Unique experiment ide...
python
def experiments_predictions_update_state_error(self, experiment_id, run_id, errors): """Update state of given prediction to failed. Set error messages that where generated by the failed run execution. Parameters ---------- experiment_id : string Unique experiment ide...
[ "def", "experiments_predictions_update_state_error", "(", "self", ",", "experiment_id", ",", "run_id", ",", "errors", ")", ":", "# Get prediction to ensure that it exists", "model_run", "=", "self", ".", "experiments_predictions_get", "(", "experiment_id", ",", "run_id", ...
Update state of given prediction to failed. Set error messages that where generated by the failed run execution. Parameters ---------- experiment_id : string Unique experiment identifier run_id : string Unique model run identifier errors : List(st...
[ "Update", "state", "of", "given", "prediction", "to", "failed", ".", "Set", "error", "messages", "that", "where", "generated", "by", "the", "failed", "run", "execution", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L667-L693
250,844
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.experiments_predictions_update_state_success
def experiments_predictions_update_state_success(self, experiment_id, run_id, result_file): """Update state of given prediction to success. Create a function data resource for the given result file and associate it with the model run. Parameters ---------- experiment_id : string...
python
def experiments_predictions_update_state_success(self, experiment_id, run_id, result_file): """Update state of given prediction to success. Create a function data resource for the given result file and associate it with the model run. Parameters ---------- experiment_id : string...
[ "def", "experiments_predictions_update_state_success", "(", "self", ",", "experiment_id", ",", "run_id", ",", "result_file", ")", ":", "# Get prediction to ensure that it exists", "model_run", "=", "self", ".", "experiments_predictions_get", "(", "experiment_id", ",", "run_...
Update state of given prediction to success. Create a function data resource for the given result file and associate it with the model run. Parameters ---------- experiment_id : string Unique experiment identifier run_id : string Unique model run identifi...
[ "Update", "state", "of", "given", "prediction", "to", "success", ".", "Create", "a", "function", "data", "resource", "for", "the", "given", "result", "file", "and", "associate", "it", "with", "the", "model", "run", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L695-L723
250,845
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.experiments_predictions_upsert_property
def experiments_predictions_upsert_property(self, experiment_id, run_id, properties): """Upsert property of a prodiction for an experiment. Raises ValueError if given property dictionary results in an illegal operation. Parameters ---------- experiment_id : string ...
python
def experiments_predictions_upsert_property(self, experiment_id, run_id, properties): """Upsert property of a prodiction for an experiment. Raises ValueError if given property dictionary results in an illegal operation. Parameters ---------- experiment_id : string ...
[ "def", "experiments_predictions_upsert_property", "(", "self", ",", "experiment_id", ",", "run_id", ",", "properties", ")", ":", "# Get predition to ensure that it exists. Ensures that the combination", "# of experiment and prediction identifier is valid.", "if", "self", ".", "expe...
Upsert property of a prodiction for an experiment. Raises ValueError if given property dictionary results in an illegal operation. Parameters ---------- experiment_id : string Unique experiment identifier run_id : string Unique model run identifi...
[ "Upsert", "property", "of", "a", "prodiction", "for", "an", "experiment", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L725-L750
250,846
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.images_create
def images_create(self, filename): """Create and image file or image group object from the given file. The type of the created database object is determined by the suffix of the given file. An ValueError exception is thrown if the file has an unknown suffix. Raises ValueError if...
python
def images_create(self, filename): """Create and image file or image group object from the given file. The type of the created database object is determined by the suffix of the given file. An ValueError exception is thrown if the file has an unknown suffix. Raises ValueError if...
[ "def", "images_create", "(", "self", ",", "filename", ")", ":", "# Check if file is a single image", "suffix", "=", "get_filename_suffix", "(", "filename", ",", "image", ".", "VALID_IMGFILE_SUFFIXES", ")", "if", "not", "suffix", "is", "None", ":", "# Create image ob...
Create and image file or image group object from the given file. The type of the created database object is determined by the suffix of the given file. An ValueError exception is thrown if the file has an unknown suffix. Raises ValueError if invalid file is given. Parameters ...
[ "Create", "and", "image", "file", "or", "image", "group", "object", "from", "the", "given", "file", ".", "The", "type", "of", "the", "created", "database", "object", "is", "determined", "by", "the", "suffix", "of", "the", "given", "file", ".", "An", "Val...
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L776-L834
250,847
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.image_files_download
def image_files_download(self, image_id): """Get data file for image with given identifier. Parameters ---------- image_id : string Unique image identifier Returns ------- FileInfo Information about image file on disk or None if identifie...
python
def image_files_download(self, image_id): """Get data file for image with given identifier. Parameters ---------- image_id : string Unique image identifier Returns ------- FileInfo Information about image file on disk or None if identifie...
[ "def", "image_files_download", "(", "self", ",", "image_id", ")", ":", "# Retrieve image to ensure that it exist", "img", "=", "self", ".", "image_files_get", "(", "image_id", ")", "if", "img", "is", "None", ":", "# Return None if image is unknown", "return", "None", ...
Get data file for image with given identifier. Parameters ---------- image_id : string Unique image identifier Returns ------- FileInfo Information about image file on disk or None if identifier is unknown
[ "Get", "data", "file", "for", "image", "with", "given", "identifier", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L854-L879
250,848
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.image_files_list
def image_files_list(self, limit=-1, offset=-1): """Retrieve list of all images in the data store. Parameters ---------- limit : int Limit number of results in returned object listing offset : int Set offset in list (order as defined by object store) ...
python
def image_files_list(self, limit=-1, offset=-1): """Retrieve list of all images in the data store. Parameters ---------- limit : int Limit number of results in returned object listing offset : int Set offset in list (order as defined by object store) ...
[ "def", "image_files_list", "(", "self", ",", "limit", "=", "-", "1", ",", "offset", "=", "-", "1", ")", ":", "return", "self", ".", "images", ".", "list_objects", "(", "limit", "=", "limit", ",", "offset", "=", "offset", ")" ]
Retrieve list of all images in the data store. Parameters ---------- limit : int Limit number of results in returned object listing offset : int Set offset in list (order as defined by object store) Returns ------- ObjectListing ...
[ "Retrieve", "list", "of", "all", "images", "in", "the", "data", "store", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L896-L911
250,849
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.image_groups_download
def image_groups_download(self, image_group_id): """Get data file for image group with given identifier. Parameters ---------- image_group_id : string Unique image group identifier Returns ------- FileInfo Information about image group ar...
python
def image_groups_download(self, image_group_id): """Get data file for image group with given identifier. Parameters ---------- image_group_id : string Unique image group identifier Returns ------- FileInfo Information about image group ar...
[ "def", "image_groups_download", "(", "self", ",", "image_group_id", ")", ":", "# Retrieve image group to ensure that it exist", "img_grp", "=", "self", ".", "image_groups_get", "(", "image_group_id", ")", "if", "img_grp", "is", "None", ":", "# Return None if image group i...
Get data file for image group with given identifier. Parameters ---------- image_group_id : string Unique image group identifier Returns ------- FileInfo Information about image group archive file on disk or None if identifier is unkn...
[ "Get", "data", "file", "for", "image", "group", "with", "given", "identifier", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L951-L976
250,850
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.image_group_images_list
def image_group_images_list(self, image_group_id, limit=-1, offset=-1): """List images in the given image group. Parameters ---------- image_group_id : string Unique image group object identifier limit : int Limit number of results in returned object list...
python
def image_group_images_list(self, image_group_id, limit=-1, offset=-1): """List images in the given image group. Parameters ---------- image_group_id : string Unique image group object identifier limit : int Limit number of results in returned object list...
[ "def", "image_group_images_list", "(", "self", ",", "image_group_id", ",", "limit", "=", "-", "1", ",", "offset", "=", "-", "1", ")", ":", "return", "self", ".", "image_groups", ".", "list_images", "(", "image_group_id", ",", "limit", "=", "limit", ",", ...
List images in the given image group. Parameters ---------- image_group_id : string Unique image group object identifier limit : int Limit number of results in returned object listing offset : int Set offset in list (order as defined by object...
[ "List", "images", "in", "the", "given", "image", "group", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L993-L1014
250,851
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.image_groups_list
def image_groups_list(self, limit=-1, offset=-1): """Retrieve list of all image groups in the data store. Parameters ---------- limit : int Limit number of results in returned object listing offset : int Set offset in list (order as defined by object stor...
python
def image_groups_list(self, limit=-1, offset=-1): """Retrieve list of all image groups in the data store. Parameters ---------- limit : int Limit number of results in returned object listing offset : int Set offset in list (order as defined by object stor...
[ "def", "image_groups_list", "(", "self", ",", "limit", "=", "-", "1", ",", "offset", "=", "-", "1", ")", ":", "return", "self", ".", "image_groups", ".", "list_objects", "(", "limit", "=", "limit", ",", "offset", "=", "offset", ")" ]
Retrieve list of all image groups in the data store. Parameters ---------- limit : int Limit number of results in returned object listing offset : int Set offset in list (order as defined by object store) Returns ------- ObjectListing ...
[ "Retrieve", "list", "of", "all", "image", "groups", "in", "the", "data", "store", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L1016-L1031
250,852
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.subjects_create
def subjects_create(self, filename): """Create subject from given data files. Expects the file to be a Freesurfer archive. Raises ValueError if given file is not a valid subject file. Parameters ---------- filename : File-type object Freesurfer archive file ...
python
def subjects_create(self, filename): """Create subject from given data files. Expects the file to be a Freesurfer archive. Raises ValueError if given file is not a valid subject file. Parameters ---------- filename : File-type object Freesurfer archive file ...
[ "def", "subjects_create", "(", "self", ",", "filename", ")", ":", "# Ensure that the file name has a valid archive suffix", "if", "get_filename_suffix", "(", "filename", ",", "ARCHIVE_SUFFIXES", ")", "is", "None", ":", "raise", "ValueError", "(", "'invalid file suffix: '"...
Create subject from given data files. Expects the file to be a Freesurfer archive. Raises ValueError if given file is not a valid subject file. Parameters ---------- filename : File-type object Freesurfer archive file Returns ------- Subject...
[ "Create", "subject", "from", "given", "data", "files", ".", "Expects", "the", "file", "to", "be", "a", "Freesurfer", "archive", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L1086-L1107
250,853
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.subjects_download
def subjects_download(self, subject_id): """Get data file for subject with given identifier. Parameters ---------- subject_id : string Unique subject identifier Returns ------- FileInfo Information about subject's data file on disk or Non...
python
def subjects_download(self, subject_id): """Get data file for subject with given identifier. Parameters ---------- subject_id : string Unique subject identifier Returns ------- FileInfo Information about subject's data file on disk or Non...
[ "def", "subjects_download", "(", "self", ",", "subject_id", ")", ":", "# Retrieve subject to ensure that it exist", "subject", "=", "self", ".", "subjects_get", "(", "subject_id", ")", "if", "subject", "is", "None", ":", "# Return None if subject is unknown", "return", ...
Get data file for subject with given identifier. Parameters ---------- subject_id : string Unique subject identifier Returns ------- FileInfo Information about subject's data file on disk or None if identifier is unknown
[ "Get", "data", "file", "for", "subject", "with", "given", "identifier", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L1127-L1152
250,854
heikomuller/sco-datastore
scodata/__init__.py
SCODataStore.subjects_list
def subjects_list(self, limit=-1, offset=-1): """Retrieve list of all subjects in the data store. Parameters ---------- limit : int Limit number of results in returned object listing offset : int Set offset in list (order as defined by object store) ...
python
def subjects_list(self, limit=-1, offset=-1): """Retrieve list of all subjects in the data store. Parameters ---------- limit : int Limit number of results in returned object listing offset : int Set offset in list (order as defined by object store) ...
[ "def", "subjects_list", "(", "self", ",", "limit", "=", "-", "1", ",", "offset", "=", "-", "1", ")", ":", "return", "self", ".", "subjects", ".", "list_objects", "(", "limit", "=", "limit", ",", "offset", "=", "offset", ")" ]
Retrieve list of all subjects in the data store. Parameters ---------- limit : int Limit number of results in returned object listing offset : int Set offset in list (order as defined by object store) Returns ------- ObjectListing ...
[ "Retrieve", "list", "of", "all", "subjects", "in", "the", "data", "store", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L1169-L1184
250,855
ulf1/oxyba
oxyba/leland94.py
leland94
def leland94(V, s, r, a, t, C=None, d=None, PosEq=False): """Leland94 Capital Structure model, Corporate Bond valuation model Parameters: ----------- V : float Asset Value of the unlevered firm s : float Volatility s of the asset value V of the unlevered firm r : float ...
python
def leland94(V, s, r, a, t, C=None, d=None, PosEq=False): """Leland94 Capital Structure model, Corporate Bond valuation model Parameters: ----------- V : float Asset Value of the unlevered firm s : float Volatility s of the asset value V of the unlevered firm r : float ...
[ "def", "leland94", "(", "V", ",", "s", ",", "r", ",", "a", ",", "t", ",", "C", "=", "None", ",", "d", "=", "None", ",", "PosEq", "=", "False", ")", ":", "# subfunction for", "def", "netcashpayout_by_dividend", "(", "r", ",", "d", ",", "s", ")", ...
Leland94 Capital Structure model, Corporate Bond valuation model Parameters: ----------- V : float Asset Value of the unlevered firm s : float Volatility s of the asset value V of the unlevered firm r : float Risk free rate a : float Bankruptcy cost t : f...
[ "Leland94", "Capital", "Structure", "model", "Corporate", "Bond", "valuation", "model" ]
b3043116050de275124365cb11e7df91fb40169d
https://github.com/ulf1/oxyba/blob/b3043116050de275124365cb11e7df91fb40169d/oxyba/leland94.py#L2-L225
250,856
lizardsystem/tags2sdists
tags2sdists/checkoutdir.py
CheckoutBaseDir.checkout_dirs
def checkout_dirs(self): """Return directories inside the base directory.""" directories = [os.path.join(self.base_directory, d) for d in os.listdir(self.base_directory)] return [d for d in directories if os.path.isdir(d)]
python
def checkout_dirs(self): """Return directories inside the base directory.""" directories = [os.path.join(self.base_directory, d) for d in os.listdir(self.base_directory)] return [d for d in directories if os.path.isdir(d)]
[ "def", "checkout_dirs", "(", "self", ")", ":", "directories", "=", "[", "os", ".", "path", ".", "join", "(", "self", ".", "base_directory", ",", "d", ")", "for", "d", "in", "os", ".", "listdir", "(", "self", ".", "base_directory", ")", "]", "return",...
Return directories inside the base directory.
[ "Return", "directories", "inside", "the", "base", "directory", "." ]
72f3c664940133e3238fca4d87edcc36b9775e48
https://github.com/lizardsystem/tags2sdists/blob/72f3c664940133e3238fca4d87edcc36b9775e48/tags2sdists/checkoutdir.py#L48-L52
250,857
lizardsystem/tags2sdists
tags2sdists/checkoutdir.py
CheckoutDir.missing_tags
def missing_tags(self, existing_sdists=None): """Return difference between existing sdists and available tags.""" if existing_sdists is None: existing_sdists = [] logger.debug("Existing sdists: %s", existing_sdists) if self._missing_tags is None: missing = [] ...
python
def missing_tags(self, existing_sdists=None): """Return difference between existing sdists and available tags.""" if existing_sdists is None: existing_sdists = [] logger.debug("Existing sdists: %s", existing_sdists) if self._missing_tags is None: missing = [] ...
[ "def", "missing_tags", "(", "self", ",", "existing_sdists", "=", "None", ")", ":", "if", "existing_sdists", "is", "None", ":", "existing_sdists", "=", "[", "]", "logger", ".", "debug", "(", "\"Existing sdists: %s\"", ",", "existing_sdists", ")", "if", "self", ...
Return difference between existing sdists and available tags.
[ "Return", "difference", "between", "existing", "sdists", "and", "available", "tags", "." ]
72f3c664940133e3238fca4d87edcc36b9775e48
https://github.com/lizardsystem/tags2sdists/blob/72f3c664940133e3238fca4d87edcc36b9775e48/tags2sdists/checkoutdir.py#L70-L100
250,858
lizardsystem/tags2sdists
tags2sdists/checkoutdir.py
CheckoutDir.create_sdist
def create_sdist(self, tag): """Create an sdist and return the full file path of the .tar.gz.""" logger.info("Making tempdir for %s with tag %s...", self.package, tag) self.wrapper.vcs.checkout_from_tag(tag) # checkout_from_tag() chdirs to a temp directory that we nee...
python
def create_sdist(self, tag): """Create an sdist and return the full file path of the .tar.gz.""" logger.info("Making tempdir for %s with tag %s...", self.package, tag) self.wrapper.vcs.checkout_from_tag(tag) # checkout_from_tag() chdirs to a temp directory that we nee...
[ "def", "create_sdist", "(", "self", ",", "tag", ")", ":", "logger", ".", "info", "(", "\"Making tempdir for %s with tag %s...\"", ",", "self", ".", "package", ",", "tag", ")", "self", ".", "wrapper", ".", "vcs", ".", "checkout_from_tag", "(", "tag", ")", "...
Create an sdist and return the full file path of the .tar.gz.
[ "Create", "an", "sdist", "and", "return", "the", "full", "file", "path", "of", "the", ".", "tar", ".", "gz", "." ]
72f3c664940133e3238fca4d87edcc36b9775e48
https://github.com/lizardsystem/tags2sdists/blob/72f3c664940133e3238fca4d87edcc36b9775e48/tags2sdists/checkoutdir.py#L102-L114
250,859
lizardsystem/tags2sdists
tags2sdists/checkoutdir.py
CheckoutDir.cleanup
def cleanup(self): """Clean up temporary tag checkout dir.""" shutil.rmtree(self.temp_tagdir) # checkout_from_tag might operate on a subdirectory (mostly # 'gitclone'), so cleanup the parent dir as well parentdir = os.path.dirname(self.temp_tagdir) # ensure we don't remov...
python
def cleanup(self): """Clean up temporary tag checkout dir.""" shutil.rmtree(self.temp_tagdir) # checkout_from_tag might operate on a subdirectory (mostly # 'gitclone'), so cleanup the parent dir as well parentdir = os.path.dirname(self.temp_tagdir) # ensure we don't remov...
[ "def", "cleanup", "(", "self", ")", ":", "shutil", ".", "rmtree", "(", "self", ".", "temp_tagdir", ")", "# checkout_from_tag might operate on a subdirectory (mostly", "# 'gitclone'), so cleanup the parent dir as well", "parentdir", "=", "os", ".", "path", ".", "dirname", ...
Clean up temporary tag checkout dir.
[ "Clean", "up", "temporary", "tag", "checkout", "dir", "." ]
72f3c664940133e3238fca4d87edcc36b9775e48
https://github.com/lizardsystem/tags2sdists/blob/72f3c664940133e3238fca4d87edcc36b9775e48/tags2sdists/checkoutdir.py#L116-L125
250,860
shad7/tvdbapi_client
tvdbapi_client/__init__.py
get_client
def get_client(config_file=None, apikey=None, username=None, userpass=None, service_url=None, verify_ssl_certs=None, select_first=None): """Configure the API service and creates a new instance of client. :param str config_file: absolute path to configuration file :param str apikey: apikey fr...
python
def get_client(config_file=None, apikey=None, username=None, userpass=None, service_url=None, verify_ssl_certs=None, select_first=None): """Configure the API service and creates a new instance of client. :param str config_file: absolute path to configuration file :param str apikey: apikey fr...
[ "def", "get_client", "(", "config_file", "=", "None", ",", "apikey", "=", "None", ",", "username", "=", "None", ",", "userpass", "=", "None", ",", "service_url", "=", "None", ",", "verify_ssl_certs", "=", "None", ",", "select_first", "=", "None", ")", ":...
Configure the API service and creates a new instance of client. :param str config_file: absolute path to configuration file :param str apikey: apikey from thetvdb :param str username: username used on thetvdb :param str userpass: password used on thetvdb :param str service_url: the url for thetvdb ...
[ "Configure", "the", "API", "service", "and", "creates", "a", "new", "instance", "of", "client", "." ]
edf1771184122f4db42af7fc087407a3e6a4e377
https://github.com/shad7/tvdbapi_client/blob/edf1771184122f4db42af7fc087407a3e6a4e377/tvdbapi_client/__init__.py#L11-L47
250,861
rorr73/LifeSOSpy
lifesospy/protocol.py
Protocol.close
def close(self) -> None: """Closes connection to the LifeSOS ethernet interface.""" self.cancel_pending_tasks() _LOGGER.debug("Disconnected") if self._transport: self._transport.close() self._is_connected = False
python
def close(self) -> None: """Closes connection to the LifeSOS ethernet interface.""" self.cancel_pending_tasks() _LOGGER.debug("Disconnected") if self._transport: self._transport.close() self._is_connected = False
[ "def", "close", "(", "self", ")", "->", "None", ":", "self", ".", "cancel_pending_tasks", "(", ")", "_LOGGER", ".", "debug", "(", "\"Disconnected\"", ")", "if", "self", ".", "_transport", ":", "self", ".", "_transport", ".", "close", "(", ")", "self", ...
Closes connection to the LifeSOS ethernet interface.
[ "Closes", "connection", "to", "the", "LifeSOS", "ethernet", "interface", "." ]
62360fbab2e90bf04d52b547093bdab2d4e389b4
https://github.com/rorr73/LifeSOSpy/blob/62360fbab2e90bf04d52b547093bdab2d4e389b4/lifesospy/protocol.py#L177-L185
250,862
rorr73/LifeSOSpy
lifesospy/protocol.py
Protocol.async_execute
async def async_execute(self, command: Command, password: str = '', timeout: int = EXECUTE_TIMEOUT_SECS) -> Response: """ Execute a command and return response. command: the command instance to be executed password: if specified, will be used to execute ...
python
async def async_execute(self, command: Command, password: str = '', timeout: int = EXECUTE_TIMEOUT_SECS) -> Response: """ Execute a command and return response. command: the command instance to be executed password: if specified, will be used to execute ...
[ "async", "def", "async_execute", "(", "self", ",", "command", ":", "Command", ",", "password", ":", "str", "=", "''", ",", "timeout", ":", "int", "=", "EXECUTE_TIMEOUT_SECS", ")", "->", "Response", ":", "if", "not", "self", ".", "_is_connected", ":", "ra...
Execute a command and return response. command: the command instance to be executed password: if specified, will be used to execute this command (overriding any global password that may have been assigned to the property) timeout: maximum number of seconds to wait fo...
[ "Execute", "a", "command", "and", "return", "response", "." ]
62360fbab2e90bf04d52b547093bdab2d4e389b4
https://github.com/rorr73/LifeSOSpy/blob/62360fbab2e90bf04d52b547093bdab2d4e389b4/lifesospy/protocol.py#L187-L209
250,863
hitchtest/hitchserve
hitchserve/service_engine.py
ServiceEngine.longest_service_name
def longest_service_name(self): """Length of the longest service name.""" return max([len(service_handle.service.name) for service_handle in self.service_handles] + [0])
python
def longest_service_name(self): """Length of the longest service name.""" return max([len(service_handle.service.name) for service_handle in self.service_handles] + [0])
[ "def", "longest_service_name", "(", "self", ")", ":", "return", "max", "(", "[", "len", "(", "service_handle", ".", "service", ".", "name", ")", "for", "service_handle", "in", "self", ".", "service_handles", "]", "+", "[", "0", "]", ")" ]
Length of the longest service name.
[ "Length", "of", "the", "longest", "service", "name", "." ]
a2def19979264186d283e76f7f0c88f3ed97f2e0
https://github.com/hitchtest/hitchserve/blob/a2def19979264186d283e76f7f0c88f3ed97f2e0/hitchserve/service_engine.py#L42-L44
250,864
knagra/farnsworth
threads/views.py
list_all_threads_view
def list_all_threads_view(request): ''' View of all threads. ''' threads = Thread.objects.all() create_form = ThreadForm( request.POST if "submit_thread_form" in request.POST else None, profile=UserProfile.objects.get(user=request.user), ) if create_form.is_valid(): thr...
python
def list_all_threads_view(request): ''' View of all threads. ''' threads = Thread.objects.all() create_form = ThreadForm( request.POST if "submit_thread_form" in request.POST else None, profile=UserProfile.objects.get(user=request.user), ) if create_form.is_valid(): thr...
[ "def", "list_all_threads_view", "(", "request", ")", ":", "threads", "=", "Thread", ".", "objects", ".", "all", "(", ")", "create_form", "=", "ThreadForm", "(", "request", ".", "POST", "if", "\"submit_thread_form\"", "in", "request", ".", "POST", "else", "No...
View of all threads.
[ "View", "of", "all", "threads", "." ]
1b6589f0d9fea154f0a1e2231ed906764ed26d26
https://github.com/knagra/farnsworth/blob/1b6589f0d9fea154f0a1e2231ed906764ed26d26/threads/views.py#L44-L64
250,865
knagra/farnsworth
threads/views.py
list_user_threads_view
def list_user_threads_view(request, targetUsername): ''' View of threads a user has created. ''' targetUser = get_object_or_404(User, username=targetUsername) targetProfile = get_object_or_404(UserProfile, user=targetUser) threads = Thread.objects.filter(owner=targetProfile) page_name = "{0}'s Threa...
python
def list_user_threads_view(request, targetUsername): ''' View of threads a user has created. ''' targetUser = get_object_or_404(User, username=targetUsername) targetProfile = get_object_or_404(UserProfile, user=targetUser) threads = Thread.objects.filter(owner=targetProfile) page_name = "{0}'s Threa...
[ "def", "list_user_threads_view", "(", "request", ",", "targetUsername", ")", ":", "targetUser", "=", "get_object_or_404", "(", "User", ",", "username", "=", "targetUsername", ")", "targetProfile", "=", "get_object_or_404", "(", "UserProfile", ",", "user", "=", "ta...
View of threads a user has created.
[ "View", "of", "threads", "a", "user", "has", "created", "." ]
1b6589f0d9fea154f0a1e2231ed906764ed26d26
https://github.com/knagra/farnsworth/blob/1b6589f0d9fea154f0a1e2231ed906764ed26d26/threads/views.py#L193-L216
250,866
knagra/farnsworth
threads/views.py
list_user_messages_view
def list_user_messages_view(request, targetUsername): ''' View of threads a user has posted in. ''' targetUser = get_object_or_404(User, username=targetUsername) targetProfile = get_object_or_404(UserProfile, user=targetUser) user_messages = Message.objects.filter(owner=targetProfile) thread_pks = l...
python
def list_user_messages_view(request, targetUsername): ''' View of threads a user has posted in. ''' targetUser = get_object_or_404(User, username=targetUsername) targetProfile = get_object_or_404(UserProfile, user=targetUser) user_messages = Message.objects.filter(owner=targetProfile) thread_pks = l...
[ "def", "list_user_messages_view", "(", "request", ",", "targetUsername", ")", ":", "targetUser", "=", "get_object_or_404", "(", "User", ",", "username", "=", "targetUsername", ")", "targetProfile", "=", "get_object_or_404", "(", "UserProfile", ",", "user", "=", "t...
View of threads a user has posted in.
[ "View", "of", "threads", "a", "user", "has", "posted", "in", "." ]
1b6589f0d9fea154f0a1e2231ed906764ed26d26
https://github.com/knagra/farnsworth/blob/1b6589f0d9fea154f0a1e2231ed906764ed26d26/threads/views.py#L219-L231
250,867
zvadym/django-stored-settings
stored_settings/admin.py
SettingsAdmin.get_form
def get_form(self, request, obj=None, **kwargs): """ Use special form during user creation """ defaults = {} if obj is None: defaults['form'] = self.add_form defaults.update(kwargs) return super(SettingsAdmin, self).get_form(request, obj, **defaults)
python
def get_form(self, request, obj=None, **kwargs): """ Use special form during user creation """ defaults = {} if obj is None: defaults['form'] = self.add_form defaults.update(kwargs) return super(SettingsAdmin, self).get_form(request, obj, **defaults)
[ "def", "get_form", "(", "self", ",", "request", ",", "obj", "=", "None", ",", "*", "*", "kwargs", ")", ":", "defaults", "=", "{", "}", "if", "obj", "is", "None", ":", "defaults", "[", "'form'", "]", "=", "self", ".", "add_form", "defaults", ".", ...
Use special form during user creation
[ "Use", "special", "form", "during", "user", "creation" ]
e68421e5f8c1be95be76a3c21367e1acccd75b71
https://github.com/zvadym/django-stored-settings/blob/e68421e5f8c1be95be76a3c21367e1acccd75b71/stored_settings/admin.py#L39-L47
250,868
tducret/precisionmapper-python
precisionmapper/__init__.py
_css_select
def _css_select(soup, css_selector): """ Returns the content of the element pointed by the CSS selector, or an empty string if not found """ selection = soup.select(css_selector) if len(selection) > 0: if hasattr(selection[0], 'text'): retour = selection[0].te...
python
def _css_select(soup, css_selector): """ Returns the content of the element pointed by the CSS selector, or an empty string if not found """ selection = soup.select(css_selector) if len(selection) > 0: if hasattr(selection[0], 'text'): retour = selection[0].te...
[ "def", "_css_select", "(", "soup", ",", "css_selector", ")", ":", "selection", "=", "soup", ".", "select", "(", "css_selector", ")", "if", "len", "(", "selection", ")", ">", "0", ":", "if", "hasattr", "(", "selection", "[", "0", "]", ",", "'text'", "...
Returns the content of the element pointed by the CSS selector, or an empty string if not found
[ "Returns", "the", "content", "of", "the", "element", "pointed", "by", "the", "CSS", "selector", "or", "an", "empty", "string", "if", "not", "found" ]
462dcc5bccf6edec780b8b7bc42e8c1d717db942
https://github.com/tducret/precisionmapper-python/blob/462dcc5bccf6edec780b8b7bc42e8c1d717db942/precisionmapper/__init__.py#L219-L230
250,869
tducret/precisionmapper-python
precisionmapper/__init__.py
PrecisionMapper.get_authenticity_token
def get_authenticity_token(self, url=_SIGNIN_URL): """ Returns an authenticity_token, mandatory for signing in """ res = self.client._get(url=url, expected_status_code=200) soup = BeautifulSoup(res.text, _DEFAULT_BEAUTIFULSOUP_PARSER) selection = soup.select(_AUTHENTICITY_TOKEN_SELECTOR)...
python
def get_authenticity_token(self, url=_SIGNIN_URL): """ Returns an authenticity_token, mandatory for signing in """ res = self.client._get(url=url, expected_status_code=200) soup = BeautifulSoup(res.text, _DEFAULT_BEAUTIFULSOUP_PARSER) selection = soup.select(_AUTHENTICITY_TOKEN_SELECTOR)...
[ "def", "get_authenticity_token", "(", "self", ",", "url", "=", "_SIGNIN_URL", ")", ":", "res", "=", "self", ".", "client", ".", "_get", "(", "url", "=", "url", ",", "expected_status_code", "=", "200", ")", "soup", "=", "BeautifulSoup", "(", "res", ".", ...
Returns an authenticity_token, mandatory for signing in
[ "Returns", "an", "authenticity_token", "mandatory", "for", "signing", "in" ]
462dcc5bccf6edec780b8b7bc42e8c1d717db942
https://github.com/tducret/precisionmapper-python/blob/462dcc5bccf6edec780b8b7bc42e8c1d717db942/precisionmapper/__init__.py#L131-L142
250,870
tducret/precisionmapper-python
precisionmapper/__init__.py
PrecisionMapper.get_surveys
def get_surveys(self, url=_SURVEYS_URL): """ Function to get the surveys for the account """ res = self.client._get(url=url, expected_status_code=200) soup = BeautifulSoup(res.text, _DEFAULT_BEAUTIFULSOUP_PARSER) surveys_soup = soup.select(_SURVEYS_SELECTOR) survey_list = [] ...
python
def get_surveys(self, url=_SURVEYS_URL): """ Function to get the surveys for the account """ res = self.client._get(url=url, expected_status_code=200) soup = BeautifulSoup(res.text, _DEFAULT_BEAUTIFULSOUP_PARSER) surveys_soup = soup.select(_SURVEYS_SELECTOR) survey_list = [] ...
[ "def", "get_surveys", "(", "self", ",", "url", "=", "_SURVEYS_URL", ")", ":", "res", "=", "self", ".", "client", ".", "_get", "(", "url", "=", "url", ",", "expected_status_code", "=", "200", ")", "soup", "=", "BeautifulSoup", "(", "res", ".", "text", ...
Function to get the surveys for the account
[ "Function", "to", "get", "the", "surveys", "for", "the", "account" ]
462dcc5bccf6edec780b8b7bc42e8c1d717db942
https://github.com/tducret/precisionmapper-python/blob/462dcc5bccf6edec780b8b7bc42e8c1d717db942/precisionmapper/__init__.py#L159-L213
250,871
unistra/britney-utils
britney_utils.py
get_client
def get_client(name, description, base_url=None, middlewares=None, reset=False): """ Build a complete spore client and store it :param name: name of the client :param description: the REST API description as a file or URL :param base_url: the base URL of the REST API :param middlewar...
python
def get_client(name, description, base_url=None, middlewares=None, reset=False): """ Build a complete spore client and store it :param name: name of the client :param description: the REST API description as a file or URL :param base_url: the base URL of the REST API :param middlewar...
[ "def", "get_client", "(", "name", ",", "description", ",", "base_url", "=", "None", ",", "middlewares", "=", "None", ",", "reset", "=", "False", ")", ":", "if", "name", "in", "__clients", "and", "not", "reset", ":", "return", "__clients", "[", "name", ...
Build a complete spore client and store it :param name: name of the client :param description: the REST API description as a file or URL :param base_url: the base URL of the REST API :param middlewares: middlewares to enable :type middlewares: ordered list of 2-elements tuples -> (middleware_class,...
[ "Build", "a", "complete", "spore", "client", "and", "store", "it" ]
d6b948ab220ee9d5809f3bf9ccd69a46e46f7f20
https://github.com/unistra/britney-utils/blob/d6b948ab220ee9d5809f3bf9ccd69a46e46f7f20/britney_utils.py#L13-L62
250,872
b3j0f/utils
b3j0f/utils/iterable.py
isiterable
def isiterable(element, exclude=None): """Check whatever or not if input element is an iterable. :param element: element to check among iterable types. :param type/tuple exclude: not allowed types in the test. :Example: >>> isiterable({}) True >>> isiterable({}, exclude=dict) False ...
python
def isiterable(element, exclude=None): """Check whatever or not if input element is an iterable. :param element: element to check among iterable types. :param type/tuple exclude: not allowed types in the test. :Example: >>> isiterable({}) True >>> isiterable({}, exclude=dict) False ...
[ "def", "isiterable", "(", "element", ",", "exclude", "=", "None", ")", ":", "# check for allowed type", "allowed", "=", "exclude", "is", "None", "or", "not", "isinstance", "(", "element", ",", "exclude", ")", "result", "=", "allowed", "and", "isinstance", "(...
Check whatever or not if input element is an iterable. :param element: element to check among iterable types. :param type/tuple exclude: not allowed types in the test. :Example: >>> isiterable({}) True >>> isiterable({}, exclude=dict) False >>> isiterable({}, exclude=(dict,)) Fals...
[ "Check", "whatever", "or", "not", "if", "input", "element", "is", "an", "iterable", "." ]
793871b98e90fd1c7ce9ef0dce839cc18fcbc6ff
https://github.com/b3j0f/utils/blob/793871b98e90fd1c7ce9ef0dce839cc18fcbc6ff/b3j0f/utils/iterable.py#L39-L59
250,873
b3j0f/utils
b3j0f/utils/iterable.py
ensureiterable
def ensureiterable(value, iterable=list, exclude=None): """Convert a value into an iterable if it is not. :param object value: object to convert :param type iterable: iterable type to apply (default: list) :param type/tuple exclude: types to not convert :Example: >>> ensureiterable([]) []...
python
def ensureiterable(value, iterable=list, exclude=None): """Convert a value into an iterable if it is not. :param object value: object to convert :param type iterable: iterable type to apply (default: list) :param type/tuple exclude: types to not convert :Example: >>> ensureiterable([]) []...
[ "def", "ensureiterable", "(", "value", ",", "iterable", "=", "list", ",", "exclude", "=", "None", ")", ":", "result", "=", "value", "if", "not", "isiterable", "(", "value", ",", "exclude", "=", "exclude", ")", ":", "result", "=", "[", "value", "]", "...
Convert a value into an iterable if it is not. :param object value: object to convert :param type iterable: iterable type to apply (default: list) :param type/tuple exclude: types to not convert :Example: >>> ensureiterable([]) [] >>> ensureiterable([], iterable=tuple) () >>> ensu...
[ "Convert", "a", "value", "into", "an", "iterable", "if", "it", "is", "not", "." ]
793871b98e90fd1c7ce9ef0dce839cc18fcbc6ff
https://github.com/b3j0f/utils/blob/793871b98e90fd1c7ce9ef0dce839cc18fcbc6ff/b3j0f/utils/iterable.py#L62-L90
250,874
b3j0f/utils
b3j0f/utils/iterable.py
first
def first(iterable, default=None): """Try to get input iterable first item or default if iterable is empty. :param Iterable iterable: iterable to iterate on. Must provide the method __iter__. :param default: default value to get if input iterable is empty. :raises TypeError: if iterable is not ...
python
def first(iterable, default=None): """Try to get input iterable first item or default if iterable is empty. :param Iterable iterable: iterable to iterate on. Must provide the method __iter__. :param default: default value to get if input iterable is empty. :raises TypeError: if iterable is not ...
[ "def", "first", "(", "iterable", ",", "default", "=", "None", ")", ":", "result", "=", "default", "# start to get the iterable iterator (raises TypeError if iter)", "iterator", "=", "iter", "(", "iterable", ")", "# get first element", "try", ":", "result", "=", "nex...
Try to get input iterable first item or default if iterable is empty. :param Iterable iterable: iterable to iterate on. Must provide the method __iter__. :param default: default value to get if input iterable is empty. :raises TypeError: if iterable is not an iterable value. :Example: >>>...
[ "Try", "to", "get", "input", "iterable", "first", "item", "or", "default", "if", "iterable", "is", "empty", "." ]
793871b98e90fd1c7ce9ef0dce839cc18fcbc6ff
https://github.com/b3j0f/utils/blob/793871b98e90fd1c7ce9ef0dce839cc18fcbc6ff/b3j0f/utils/iterable.py#L93-L121
250,875
b3j0f/utils
b3j0f/utils/iterable.py
last
def last(iterable, default=None): """Try to get the last iterable item by successive iteration on it. :param Iterable iterable: iterable to iterate on. Must provide the method __iter__. :param default: default value to get if input iterable is empty. :raises TypeError: if iterable is not an ite...
python
def last(iterable, default=None): """Try to get the last iterable item by successive iteration on it. :param Iterable iterable: iterable to iterate on. Must provide the method __iter__. :param default: default value to get if input iterable is empty. :raises TypeError: if iterable is not an ite...
[ "def", "last", "(", "iterable", ",", "default", "=", "None", ")", ":", "result", "=", "default", "iterator", "=", "iter", "(", "iterable", ")", "while", "True", ":", "try", ":", "result", "=", "next", "(", "iterator", ")", "except", "StopIteration", ":...
Try to get the last iterable item by successive iteration on it. :param Iterable iterable: iterable to iterate on. Must provide the method __iter__. :param default: default value to get if input iterable is empty. :raises TypeError: if iterable is not an iterable value. :Example: >>> last...
[ "Try", "to", "get", "the", "last", "iterable", "item", "by", "successive", "iteration", "on", "it", "." ]
793871b98e90fd1c7ce9ef0dce839cc18fcbc6ff
https://github.com/b3j0f/utils/blob/793871b98e90fd1c7ce9ef0dce839cc18fcbc6ff/b3j0f/utils/iterable.py#L123-L151
250,876
b3j0f/utils
b3j0f/utils/iterable.py
itemat
def itemat(iterable, index): """Try to get the item at index position in iterable after iterate on iterable items. :param iterable: object which provides the method __getitem__ or __iter__. :param int index: item position to get. """ result = None handleindex = True if isinstance(ite...
python
def itemat(iterable, index): """Try to get the item at index position in iterable after iterate on iterable items. :param iterable: object which provides the method __getitem__ or __iter__. :param int index: item position to get. """ result = None handleindex = True if isinstance(ite...
[ "def", "itemat", "(", "iterable", ",", "index", ")", ":", "result", "=", "None", "handleindex", "=", "True", "if", "isinstance", "(", "iterable", ",", "dict", ")", ":", "handleindex", "=", "False", "else", ":", "try", ":", "result", "=", "iterable", "[...
Try to get the item at index position in iterable after iterate on iterable items. :param iterable: object which provides the method __getitem__ or __iter__. :param int index: item position to get.
[ "Try", "to", "get", "the", "item", "at", "index", "position", "in", "iterable", "after", "iterate", "on", "iterable", "items", "." ]
793871b98e90fd1c7ce9ef0dce839cc18fcbc6ff
https://github.com/b3j0f/utils/blob/793871b98e90fd1c7ce9ef0dce839cc18fcbc6ff/b3j0f/utils/iterable.py#L153-L197
250,877
b3j0f/utils
b3j0f/utils/iterable.py
sliceit
def sliceit(iterable, lower=0, upper=None): """Apply a slice on input iterable. :param iterable: object which provides the method __getitem__ or __iter__. :param int lower: lower bound from where start to get items. :param int upper: upper bound from where finish to get items. :return: sliced objec...
python
def sliceit(iterable, lower=0, upper=None): """Apply a slice on input iterable. :param iterable: object which provides the method __getitem__ or __iter__. :param int lower: lower bound from where start to get items. :param int upper: upper bound from where finish to get items. :return: sliced objec...
[ "def", "sliceit", "(", "iterable", ",", "lower", "=", "0", ",", "upper", "=", "None", ")", ":", "if", "upper", "is", "None", ":", "upper", "=", "len", "(", "iterable", ")", "try", ":", "result", "=", "iterable", "[", "lower", ":", "upper", "]", "...
Apply a slice on input iterable. :param iterable: object which provides the method __getitem__ or __iter__. :param int lower: lower bound from where start to get items. :param int upper: upper bound from where finish to get items. :return: sliced object of the same type of iterable if not dict, or spec...
[ "Apply", "a", "slice", "on", "input", "iterable", "." ]
793871b98e90fd1c7ce9ef0dce839cc18fcbc6ff
https://github.com/b3j0f/utils/blob/793871b98e90fd1c7ce9ef0dce839cc18fcbc6ff/b3j0f/utils/iterable.py#L199-L247
250,878
b3j0f/utils
b3j0f/utils/iterable.py
hashiter
def hashiter(iterable): """Try to hash input iterable in doing the sum of its content if not hashable. Hash method on not iterable depends on type: hash(iterable.__class__) + ... - dict: sum of (hash(key) + 1) * (hash(value) + 1). - Otherwise: sum of (pos + 1) * (hash(item) + 1).""" ...
python
def hashiter(iterable): """Try to hash input iterable in doing the sum of its content if not hashable. Hash method on not iterable depends on type: hash(iterable.__class__) + ... - dict: sum of (hash(key) + 1) * (hash(value) + 1). - Otherwise: sum of (pos + 1) * (hash(item) + 1).""" ...
[ "def", "hashiter", "(", "iterable", ")", ":", "result", "=", "0", "try", ":", "result", "=", "hash", "(", "iterable", ")", "except", "TypeError", ":", "result", "=", "hash", "(", "iterable", ".", "__class__", ")", "isdict", "=", "isinstance", "(", "ite...
Try to hash input iterable in doing the sum of its content if not hashable. Hash method on not iterable depends on type: hash(iterable.__class__) + ... - dict: sum of (hash(key) + 1) * (hash(value) + 1). - Otherwise: sum of (pos + 1) * (hash(item) + 1).
[ "Try", "to", "hash", "input", "iterable", "in", "doing", "the", "sum", "of", "its", "content", "if", "not", "hashable", "." ]
793871b98e90fd1c7ce9ef0dce839cc18fcbc6ff
https://github.com/b3j0f/utils/blob/793871b98e90fd1c7ce9ef0dce839cc18fcbc6ff/b3j0f/utils/iterable.py#L250-L283
250,879
jjjake/giganews
giganews/utils.py
clean_up
def clean_up(group, identifier, date): """Delete all of a groups local mbox, index, and state files. :type group: str :param group: group name :type identifier: str :param identifier: the identifier for the given group. :rtype: bool :returns: True """ #log.error('exception raised...
python
def clean_up(group, identifier, date): """Delete all of a groups local mbox, index, and state files. :type group: str :param group: group name :type identifier: str :param identifier: the identifier for the given group. :rtype: bool :returns: True """ #log.error('exception raised...
[ "def", "clean_up", "(", "group", ",", "identifier", ",", "date", ")", ":", "#log.error('exception raised, cleaning up files.')", "glob_pat", "=", "'{g}.{d}.mbox*'", ".", "format", "(", "g", "=", "group", ",", "d", "=", "date", ")", "for", "f", "in", "glob", ...
Delete all of a groups local mbox, index, and state files. :type group: str :param group: group name :type identifier: str :param identifier: the identifier for the given group. :rtype: bool :returns: True
[ "Delete", "all", "of", "a", "groups", "local", "mbox", "index", "and", "state", "files", "." ]
8cfb26de6c10c482a8da348d438f0ce19e477573
https://github.com/jjjake/giganews/blob/8cfb26de6c10c482a8da348d438f0ce19e477573/giganews/utils.py#L15-L43
250,880
jjjake/giganews
giganews/utils.py
utf8_encode_str
def utf8_encode_str(string, encoding='UTF-8'): """Attempt to detect the native encoding of `string`, and re-encode to utf-8 :type string: str :param string: The string to be encoded. :rtype: str :returns: A utf-8 encoded string. """ if not string: return '' src_enc = chard...
python
def utf8_encode_str(string, encoding='UTF-8'): """Attempt to detect the native encoding of `string`, and re-encode to utf-8 :type string: str :param string: The string to be encoded. :rtype: str :returns: A utf-8 encoded string. """ if not string: return '' src_enc = chard...
[ "def", "utf8_encode_str", "(", "string", ",", "encoding", "=", "'UTF-8'", ")", ":", "if", "not", "string", ":", "return", "''", "src_enc", "=", "chardet", ".", "detect", "(", "string", ")", "[", "'encoding'", "]", "try", ":", "return", "string", ".", "...
Attempt to detect the native encoding of `string`, and re-encode to utf-8 :type string: str :param string: The string to be encoded. :rtype: str :returns: A utf-8 encoded string.
[ "Attempt", "to", "detect", "the", "native", "encoding", "of", "string", "and", "re", "-", "encode", "to", "utf", "-", "8" ]
8cfb26de6c10c482a8da348d438f0ce19e477573
https://github.com/jjjake/giganews/blob/8cfb26de6c10c482a8da348d438f0ce19e477573/giganews/utils.py#L64-L81
250,881
jjjake/giganews
giganews/utils.py
inline_compress_chunk
def inline_compress_chunk(chunk, level=1): """Compress a string using gzip. :type chunk: str :param chunk: The string to be compressed. :rtype: str :returns: `chunk` compressed. """ b = cStringIO.StringIO() g = gzip.GzipFile(fileobj=b, mode='wb', compresslevel=level) g.write(chunk...
python
def inline_compress_chunk(chunk, level=1): """Compress a string using gzip. :type chunk: str :param chunk: The string to be compressed. :rtype: str :returns: `chunk` compressed. """ b = cStringIO.StringIO() g = gzip.GzipFile(fileobj=b, mode='wb', compresslevel=level) g.write(chunk...
[ "def", "inline_compress_chunk", "(", "chunk", ",", "level", "=", "1", ")", ":", "b", "=", "cStringIO", ".", "StringIO", "(", ")", "g", "=", "gzip", ".", "GzipFile", "(", "fileobj", "=", "b", ",", "mode", "=", "'wb'", ",", "compresslevel", "=", "level...
Compress a string using gzip. :type chunk: str :param chunk: The string to be compressed. :rtype: str :returns: `chunk` compressed.
[ "Compress", "a", "string", "using", "gzip", "." ]
8cfb26de6c10c482a8da348d438f0ce19e477573
https://github.com/jjjake/giganews/blob/8cfb26de6c10c482a8da348d438f0ce19e477573/giganews/utils.py#L86-L102
250,882
adamatan/gitpull
gitpull.py
get_list_of_git_directories
def get_list_of_git_directories(): """Returns a list of paths of git repos under the current directory.""" dirs = [path[0] for path in list(os.walk('.')) if path[0].endswith('.git')] dirs = ['/'.join(path.split('/')[:-1]) for path in dirs] return sorted(dirs)
python
def get_list_of_git_directories(): """Returns a list of paths of git repos under the current directory.""" dirs = [path[0] for path in list(os.walk('.')) if path[0].endswith('.git')] dirs = ['/'.join(path.split('/')[:-1]) for path in dirs] return sorted(dirs)
[ "def", "get_list_of_git_directories", "(", ")", ":", "dirs", "=", "[", "path", "[", "0", "]", "for", "path", "in", "list", "(", "os", ".", "walk", "(", "'.'", ")", ")", "if", "path", "[", "0", "]", ".", "endswith", "(", "'.git'", ")", "]", "dirs"...
Returns a list of paths of git repos under the current directory.
[ "Returns", "a", "list", "of", "paths", "of", "git", "repos", "under", "the", "current", "directory", "." ]
1f4439f903ef05982eea7c3bb67004d4ef3c4098
https://github.com/adamatan/gitpull/blob/1f4439f903ef05982eea7c3bb67004d4ef3c4098/gitpull.py#L41-L45
250,883
adamatan/gitpull
gitpull.py
run_git_concurrently
def run_git_concurrently(base_dir): """Runs the 'git status' and 'git pull' commands in threads and reports the results in a pretty table.""" os.chdir(base_dir) git_dirs = get_list_of_git_directories() print("Processing %d git repos: %s" % (len(git_dirs), ', '.join(git_dirs))) widgets = [Percen...
python
def run_git_concurrently(base_dir): """Runs the 'git status' and 'git pull' commands in threads and reports the results in a pretty table.""" os.chdir(base_dir) git_dirs = get_list_of_git_directories() print("Processing %d git repos: %s" % (len(git_dirs), ', '.join(git_dirs))) widgets = [Percen...
[ "def", "run_git_concurrently", "(", "base_dir", ")", ":", "os", ".", "chdir", "(", "base_dir", ")", "git_dirs", "=", "get_list_of_git_directories", "(", ")", "print", "(", "\"Processing %d git repos: %s\"", "%", "(", "len", "(", "git_dirs", ")", ",", "', '", "...
Runs the 'git status' and 'git pull' commands in threads and reports the results in a pretty table.
[ "Runs", "the", "git", "status", "and", "git", "pull", "commands", "in", "threads", "and", "reports", "the", "results", "in", "a", "pretty", "table", "." ]
1f4439f903ef05982eea7c3bb67004d4ef3c4098
https://github.com/adamatan/gitpull/blob/1f4439f903ef05982eea7c3bb67004d4ef3c4098/gitpull.py#L47-L103
250,884
dossier/dossier.web
dossier/web/routes.py
v1_search
def v1_search(request, response, visid_to_dbid, config, search_engines, filters, cid, engine_name): '''Search feature collections. The route for this endpoint is: ``/dossier/v1/<content_id>/search/<search_engine_name>``. ``content_id`` can be any *profile* content identifier. (This r...
python
def v1_search(request, response, visid_to_dbid, config, search_engines, filters, cid, engine_name): '''Search feature collections. The route for this endpoint is: ``/dossier/v1/<content_id>/search/<search_engine_name>``. ``content_id`` can be any *profile* content identifier. (This r...
[ "def", "v1_search", "(", "request", ",", "response", ",", "visid_to_dbid", ",", "config", ",", "search_engines", ",", "filters", ",", "cid", ",", "engine_name", ")", ":", "db_cid", "=", "visid_to_dbid", "(", "cid", ")", "try", ":", "search_engine", "=", "s...
Search feature collections. The route for this endpoint is: ``/dossier/v1/<content_id>/search/<search_engine_name>``. ``content_id`` can be any *profile* content identifier. (This restriction may be lifted at some point.) Namely, it must start with ``p|``. ``engine_name`` corresponds to the s...
[ "Search", "feature", "collections", "." ]
1cad1cce3c37d3a4e956abc710a2bc1afe16a092
https://github.com/dossier/dossier.web/blob/1cad1cce3c37d3a4e956abc710a2bc1afe16a092/dossier/web/routes.py#L105-L145
250,885
dossier/dossier.web
dossier/web/routes.py
v1_fc_get
def v1_fc_get(visid_to_dbid, store, cid): '''Retrieve a single feature collection. The route for this endpoint is: ``/dossier/v1/feature-collections/<content_id>``. This endpoint returns a JSON serialization of the feature collection identified by ``content_id``. ''' fc = store.get(visid_t...
python
def v1_fc_get(visid_to_dbid, store, cid): '''Retrieve a single feature collection. The route for this endpoint is: ``/dossier/v1/feature-collections/<content_id>``. This endpoint returns a JSON serialization of the feature collection identified by ``content_id``. ''' fc = store.get(visid_t...
[ "def", "v1_fc_get", "(", "visid_to_dbid", ",", "store", ",", "cid", ")", ":", "fc", "=", "store", ".", "get", "(", "visid_to_dbid", "(", "cid", ")", ")", "if", "fc", "is", "None", ":", "bottle", ".", "abort", "(", "404", ",", "'Feature collection \"%s\...
Retrieve a single feature collection. The route for this endpoint is: ``/dossier/v1/feature-collections/<content_id>``. This endpoint returns a JSON serialization of the feature collection identified by ``content_id``.
[ "Retrieve", "a", "single", "feature", "collection", "." ]
1cad1cce3c37d3a4e956abc710a2bc1afe16a092
https://github.com/dossier/dossier.web/blob/1cad1cce3c37d3a4e956abc710a2bc1afe16a092/dossier/web/routes.py#L164-L176
250,886
dossier/dossier.web
dossier/web/routes.py
v1_random_fc_get
def v1_random_fc_get(response, dbid_to_visid, store): '''Retrieves a random feature collection from the database. The route for this endpoint is: ``GET /dossier/v1/random/feature-collection``. Assuming the database has at least one feature collection, this end point returns an array of two element...
python
def v1_random_fc_get(response, dbid_to_visid, store): '''Retrieves a random feature collection from the database. The route for this endpoint is: ``GET /dossier/v1/random/feature-collection``. Assuming the database has at least one feature collection, this end point returns an array of two element...
[ "def", "v1_random_fc_get", "(", "response", ",", "dbid_to_visid", ",", "store", ")", ":", "# Careful, `store.scan()` would be obscenely slow here...", "sample", "=", "streaming_sample", "(", "store", ".", "scan_ids", "(", ")", ",", "1", ",", "1000", ")", "if", "le...
Retrieves a random feature collection from the database. The route for this endpoint is: ``GET /dossier/v1/random/feature-collection``. Assuming the database has at least one feature collection, this end point returns an array of two elements. The first element is the content id and the second ele...
[ "Retrieves", "a", "random", "feature", "collection", "from", "the", "database", "." ]
1cad1cce3c37d3a4e956abc710a2bc1afe16a092
https://github.com/dossier/dossier.web/blob/1cad1cce3c37d3a4e956abc710a2bc1afe16a092/dossier/web/routes.py#L200-L220
250,887
dossier/dossier.web
dossier/web/routes.py
v1_label_put
def v1_label_put(request, response, visid_to_dbid, config, label_hooks, label_store, cid1, cid2, annotator_id): '''Store a single label. The route for this endpoint is: ``PUT /dossier/v1/labels/<content_id1>/<content_id2>/<annotator_id>``. ``content_id`` are the ids of the feature col...
python
def v1_label_put(request, response, visid_to_dbid, config, label_hooks, label_store, cid1, cid2, annotator_id): '''Store a single label. The route for this endpoint is: ``PUT /dossier/v1/labels/<content_id1>/<content_id2>/<annotator_id>``. ``content_id`` are the ids of the feature col...
[ "def", "v1_label_put", "(", "request", ",", "response", ",", "visid_to_dbid", ",", "config", ",", "label_hooks", ",", "label_store", ",", "cid1", ",", "cid2", ",", "annotator_id", ")", ":", "coref_value", "=", "CorefValue", "(", "int", "(", "request", ".", ...
Store a single label. The route for this endpoint is: ``PUT /dossier/v1/labels/<content_id1>/<content_id2>/<annotator_id>``. ``content_id`` are the ids of the feature collections to associate. ``annotator_id`` is a string that identifies the human that created the label. The value of the label sho...
[ "Store", "a", "single", "label", "." ]
1cad1cce3c37d3a4e956abc710a2bc1afe16a092
https://github.com/dossier/dossier.web/blob/1cad1cce3c37d3a4e956abc710a2bc1afe16a092/dossier/web/routes.py#L224-L253
250,888
dossier/dossier.web
dossier/web/routes.py
v1_label_direct
def v1_label_direct(request, response, visid_to_dbid, dbid_to_visid, label_store, cid, subid=None): '''Return directly connected labels. The routes for this endpoint are ``/dossier/v1/label/<cid>/direct`` and ``/dossier/v1/label/<cid>/subtopic/<subid>/direct``. This returns all...
python
def v1_label_direct(request, response, visid_to_dbid, dbid_to_visid, label_store, cid, subid=None): '''Return directly connected labels. The routes for this endpoint are ``/dossier/v1/label/<cid>/direct`` and ``/dossier/v1/label/<cid>/subtopic/<subid>/direct``. This returns all...
[ "def", "v1_label_direct", "(", "request", ",", "response", ",", "visid_to_dbid", ",", "dbid_to_visid", ",", "label_store", ",", "cid", ",", "subid", "=", "None", ")", ":", "lab_to_json", "=", "partial", "(", "label_to_json", ",", "dbid_to_visid", ")", "ident",...
Return directly connected labels. The routes for this endpoint are ``/dossier/v1/label/<cid>/direct`` and ``/dossier/v1/label/<cid>/subtopic/<subid>/direct``. This returns all directly connected labels for ``cid``. Or, if a subtopic id is given, then only directly connected labels for ``(cid, ...
[ "Return", "directly", "connected", "labels", "." ]
1cad1cce3c37d3a4e956abc710a2bc1afe16a092
https://github.com/dossier/dossier.web/blob/1cad1cce3c37d3a4e956abc710a2bc1afe16a092/dossier/web/routes.py#L258-L278
250,889
dossier/dossier.web
dossier/web/routes.py
v1_label_negative_inference
def v1_label_negative_inference(request, response, visid_to_dbid, dbid_to_visid, label_store, cid): '''Return inferred negative labels. The route for this endpoint is: ``/dossier/v1/label/<cid>/negative-inference``. Negative labels are in...
python
def v1_label_negative_inference(request, response, visid_to_dbid, dbid_to_visid, label_store, cid): '''Return inferred negative labels. The route for this endpoint is: ``/dossier/v1/label/<cid>/negative-inference``. Negative labels are in...
[ "def", "v1_label_negative_inference", "(", "request", ",", "response", ",", "visid_to_dbid", ",", "dbid_to_visid", ",", "label_store", ",", "cid", ")", ":", "# No subtopics yet? :-(", "lab_to_json", "=", "partial", "(", "label_to_json", ",", "dbid_to_visid", ")", "l...
Return inferred negative labels. The route for this endpoint is: ``/dossier/v1/label/<cid>/negative-inference``. Negative labels are inferred by first getting all other content ids connected to ``cid`` through a negative label. For each directly adjacent ``cid'``, the connected components of ``cid...
[ "Return", "inferred", "negative", "labels", "." ]
1cad1cce3c37d3a4e956abc710a2bc1afe16a092
https://github.com/dossier/dossier.web/blob/1cad1cce3c37d3a4e956abc710a2bc1afe16a092/dossier/web/routes.py#L336-L358
250,890
dossier/dossier.web
dossier/web/routes.py
v1_folder_list
def v1_folder_list(request, kvlclient): '''Retrieves a list of folders for the current user. The route for this endpoint is: ``GET /dossier/v1/folder``. (Temporarily, the "current user" can be set via the ``annotator_id`` query parameter.) The payload returned is a list of folder identifiers. ...
python
def v1_folder_list(request, kvlclient): '''Retrieves a list of folders for the current user. The route for this endpoint is: ``GET /dossier/v1/folder``. (Temporarily, the "current user" can be set via the ``annotator_id`` query parameter.) The payload returned is a list of folder identifiers. ...
[ "def", "v1_folder_list", "(", "request", ",", "kvlclient", ")", ":", "return", "sorted", "(", "imap", "(", "attrgetter", "(", "'name'", ")", ",", "ifilter", "(", "lambda", "it", ":", "it", ".", "is_folder", "(", ")", ",", "new_folders", "(", "kvlclient",...
Retrieves a list of folders for the current user. The route for this endpoint is: ``GET /dossier/v1/folder``. (Temporarily, the "current user" can be set via the ``annotator_id`` query parameter.) The payload returned is a list of folder identifiers.
[ "Retrieves", "a", "list", "of", "folders", "for", "the", "current", "user", "." ]
1cad1cce3c37d3a4e956abc710a2bc1afe16a092
https://github.com/dossier/dossier.web/blob/1cad1cce3c37d3a4e956abc710a2bc1afe16a092/dossier/web/routes.py#L362-L374
250,891
dossier/dossier.web
dossier/web/routes.py
v1_folder_add
def v1_folder_add(request, response, kvlclient, fid): '''Adds a folder belonging to the current user. The route for this endpoint is: ``PUT /dossier/v1/folder/<fid>``. If the folder was added successfully, ``201`` status is returned. (Temporarily, the "current user" can be set via the ``annotator...
python
def v1_folder_add(request, response, kvlclient, fid): '''Adds a folder belonging to the current user. The route for this endpoint is: ``PUT /dossier/v1/folder/<fid>``. If the folder was added successfully, ``201`` status is returned. (Temporarily, the "current user" can be set via the ``annotator...
[ "def", "v1_folder_add", "(", "request", ",", "response", ",", "kvlclient", ",", "fid", ")", ":", "fid", "=", "urllib", ".", "unquote", "(", "fid", ")", "new_folders", "(", "kvlclient", ",", "request", ")", ".", "put_folder", "(", "fid", ")", "response", ...
Adds a folder belonging to the current user. The route for this endpoint is: ``PUT /dossier/v1/folder/<fid>``. If the folder was added successfully, ``201`` status is returned. (Temporarily, the "current user" can be set via the ``annotator_id`` query parameter.)
[ "Adds", "a", "folder", "belonging", "to", "the", "current", "user", "." ]
1cad1cce3c37d3a4e956abc710a2bc1afe16a092
https://github.com/dossier/dossier.web/blob/1cad1cce3c37d3a4e956abc710a2bc1afe16a092/dossier/web/routes.py#L378-L390
250,892
dossier/dossier.web
dossier/web/routes.py
v1_subfolder_list
def v1_subfolder_list(request, response, kvlclient, fid): '''Retrieves a list of subfolders in a folder for the current user. The route for this endpoint is: ``GET /dossier/v1/folder/<fid>/subfolder``. (Temporarily, the "current user" can be set via the ``annotator_id`` query parameter.) The ...
python
def v1_subfolder_list(request, response, kvlclient, fid): '''Retrieves a list of subfolders in a folder for the current user. The route for this endpoint is: ``GET /dossier/v1/folder/<fid>/subfolder``. (Temporarily, the "current user" can be set via the ``annotator_id`` query parameter.) The ...
[ "def", "v1_subfolder_list", "(", "request", ",", "response", ",", "kvlclient", ",", "fid", ")", ":", "fid", "=", "urllib", ".", "unquote", "(", "fid", ")", "try", ":", "return", "sorted", "(", "imap", "(", "attrgetter", "(", "'name'", ")", ",", "ifilte...
Retrieves a list of subfolders in a folder for the current user. The route for this endpoint is: ``GET /dossier/v1/folder/<fid>/subfolder``. (Temporarily, the "current user" can be set via the ``annotator_id`` query parameter.) The payload returned is a list of subfolder identifiers.
[ "Retrieves", "a", "list", "of", "subfolders", "in", "a", "folder", "for", "the", "current", "user", "." ]
1cad1cce3c37d3a4e956abc710a2bc1afe16a092
https://github.com/dossier/dossier.web/blob/1cad1cce3c37d3a4e956abc710a2bc1afe16a092/dossier/web/routes.py#L394-L412
250,893
dossier/dossier.web
dossier/web/routes.py
v1_subfolder_add
def v1_subfolder_add(request, response, kvlclient, fid, sfid, cid, subid=None): '''Adds a subtopic to a subfolder for the current user. The route for this endpoint is: ``PUT /dossier/v1/folder/<fid>/subfolder/<sfid>/<cid>/<subid>``. ``fid`` is the folder identifier, e.g., ``My_Fol...
python
def v1_subfolder_add(request, response, kvlclient, fid, sfid, cid, subid=None): '''Adds a subtopic to a subfolder for the current user. The route for this endpoint is: ``PUT /dossier/v1/folder/<fid>/subfolder/<sfid>/<cid>/<subid>``. ``fid`` is the folder identifier, e.g., ``My_Fol...
[ "def", "v1_subfolder_add", "(", "request", ",", "response", ",", "kvlclient", ",", "fid", ",", "sfid", ",", "cid", ",", "subid", "=", "None", ")", ":", "if", "subid", "is", "not", "None", ":", "assert", "'@'", "not", "in", "subid", "path", "=", "[", ...
Adds a subtopic to a subfolder for the current user. The route for this endpoint is: ``PUT /dossier/v1/folder/<fid>/subfolder/<sfid>/<cid>/<subid>``. ``fid`` is the folder identifier, e.g., ``My_Folder``. ``sfid`` is the subfolder identifier, e.g., ``My_Subtopic``. ``cid`` and ``subid`` are the ...
[ "Adds", "a", "subtopic", "to", "a", "subfolder", "for", "the", "current", "user", "." ]
1cad1cce3c37d3a4e956abc710a2bc1afe16a092
https://github.com/dossier/dossier.web/blob/1cad1cce3c37d3a4e956abc710a2bc1afe16a092/dossier/web/routes.py#L417-L448
250,894
dossier/dossier.web
dossier/web/routes.py
v1_subtopic_list
def v1_subtopic_list(request, response, kvlclient, fid, sfid): '''Retrieves a list of items in a subfolder. The route for this endpoint is: ``GET /dossier/v1/folder/<fid>/subfolder/<sfid>``. (Temporarily, the "current user" can be set via the ``annotator_id`` query parameter.) The payload ret...
python
def v1_subtopic_list(request, response, kvlclient, fid, sfid): '''Retrieves a list of items in a subfolder. The route for this endpoint is: ``GET /dossier/v1/folder/<fid>/subfolder/<sfid>``. (Temporarily, the "current user" can be set via the ``annotator_id`` query parameter.) The payload ret...
[ "def", "v1_subtopic_list", "(", "request", ",", "response", ",", "kvlclient", ",", "fid", ",", "sfid", ")", ":", "path", "=", "urllib", ".", "unquote", "(", "fid", ")", "+", "'/'", "+", "urllib", ".", "unquote", "(", "sfid", ")", "try", ":", "items",...
Retrieves a list of items in a subfolder. The route for this endpoint is: ``GET /dossier/v1/folder/<fid>/subfolder/<sfid>``. (Temporarily, the "current user" can be set via the ``annotator_id`` query parameter.) The payload returned is a list of two element arrays. The first element in the ar...
[ "Retrieves", "a", "list", "of", "items", "in", "a", "subfolder", "." ]
1cad1cce3c37d3a4e956abc710a2bc1afe16a092
https://github.com/dossier/dossier.web/blob/1cad1cce3c37d3a4e956abc710a2bc1afe16a092/dossier/web/routes.py#L452-L476
250,895
dossier/dossier.web
dossier/web/routes.py
v1_folder_delete
def v1_folder_delete(request, response, kvlclient, fid, sfid=None, cid=None, subid=None): '''Deletes a folder, subfolder or item. The routes for this endpoint are: * ``DELETE /dossier/v1/folder/<fid>`` * ``DELETE /dossier/v1/folder/<fid>/subfolder/<sfid>`` * ``DELETE /dossier/...
python
def v1_folder_delete(request, response, kvlclient, fid, sfid=None, cid=None, subid=None): '''Deletes a folder, subfolder or item. The routes for this endpoint are: * ``DELETE /dossier/v1/folder/<fid>`` * ``DELETE /dossier/v1/folder/<fid>/subfolder/<sfid>`` * ``DELETE /dossier/...
[ "def", "v1_folder_delete", "(", "request", ",", "response", ",", "kvlclient", ",", "fid", ",", "sfid", "=", "None", ",", "cid", "=", "None", ",", "subid", "=", "None", ")", ":", "new_folders", "(", "kvlclient", ",", "request", ")", ".", "delete", "(", ...
Deletes a folder, subfolder or item. The routes for this endpoint are: * ``DELETE /dossier/v1/folder/<fid>`` * ``DELETE /dossier/v1/folder/<fid>/subfolder/<sfid>`` * ``DELETE /dossier/v1/folder/<fid>/subfolder/<sfid>/<cid>`` * ``DELETE /dossier/v1/folder/<fid>/subfolder/<sfid>/<cid>/<subid>``
[ "Deletes", "a", "folder", "subfolder", "or", "item", "." ]
1cad1cce3c37d3a4e956abc710a2bc1afe16a092
https://github.com/dossier/dossier.web/blob/1cad1cce3c37d3a4e956abc710a2bc1afe16a092/dossier/web/routes.py#L483-L495
250,896
dossier/dossier.web
dossier/web/routes.py
v1_folder_rename
def v1_folder_rename(request, response, kvlclient, fid_src, fid_dest, sfid_src=None, sfid_dest=None): '''Rename a folder or a subfolder. The routes for this endpoint are: * ``POST /dossier/v1/<fid_src>/rename/<fid_dest>`` * ``POST /dossier/v1/<fid_src>/subfolder/<sfid_src>/rename/...
python
def v1_folder_rename(request, response, kvlclient, fid_src, fid_dest, sfid_src=None, sfid_dest=None): '''Rename a folder or a subfolder. The routes for this endpoint are: * ``POST /dossier/v1/<fid_src>/rename/<fid_dest>`` * ``POST /dossier/v1/<fid_src>/subfolder/<sfid_src>/rename/...
[ "def", "v1_folder_rename", "(", "request", ",", "response", ",", "kvlclient", ",", "fid_src", ",", "fid_dest", ",", "sfid_src", "=", "None", ",", "sfid_dest", "=", "None", ")", ":", "src", ",", "dest", "=", "make_path", "(", "fid_src", ",", "sfid_src", "...
Rename a folder or a subfolder. The routes for this endpoint are: * ``POST /dossier/v1/<fid_src>/rename/<fid_dest>`` * ``POST /dossier/v1/<fid_src>/subfolder/<sfid_src>/rename/ <fid_dest>/subfolder/<sfid_dest>``
[ "Rename", "a", "folder", "or", "a", "subfolder", "." ]
1cad1cce3c37d3a4e956abc710a2bc1afe16a092
https://github.com/dossier/dossier.web/blob/1cad1cce3c37d3a4e956abc710a2bc1afe16a092/dossier/web/routes.py#L500-L512
250,897
dossier/dossier.web
dossier/web/routes.py
set_query_param
def set_query_param(url, param, value): '''Returns a new URL with the given query parameter set to ``value``. ``value`` may be a list.''' scheme, netloc, path, qs, frag = urlparse.urlsplit(url) params = urlparse.parse_qs(qs) params[param] = value qs = urllib.urlencode(params, doseq=True) re...
python
def set_query_param(url, param, value): '''Returns a new URL with the given query parameter set to ``value``. ``value`` may be a list.''' scheme, netloc, path, qs, frag = urlparse.urlsplit(url) params = urlparse.parse_qs(qs) params[param] = value qs = urllib.urlencode(params, doseq=True) re...
[ "def", "set_query_param", "(", "url", ",", "param", ",", "value", ")", ":", "scheme", ",", "netloc", ",", "path", ",", "qs", ",", "frag", "=", "urlparse", ".", "urlsplit", "(", "url", ")", "params", "=", "urlparse", ".", "parse_qs", "(", "qs", ")", ...
Returns a new URL with the given query parameter set to ``value``. ``value`` may be a list.
[ "Returns", "a", "new", "URL", "with", "the", "given", "query", "parameter", "set", "to", "value", "." ]
1cad1cce3c37d3a4e956abc710a2bc1afe16a092
https://github.com/dossier/dossier.web/blob/1cad1cce3c37d3a4e956abc710a2bc1afe16a092/dossier/web/routes.py#L617-L625
250,898
DoWhileGeek/authentise-services
authentise_services/slice.py
Slice._get_status
def _get_status(self): """utility method to get the status of a slicing job resource, but also used to initialize slice objects by location""" if self._state in ["processed", "error"]: return self._state get_resp = requests.get(self.location, cookies={"session": ...
python
def _get_status(self): """utility method to get the status of a slicing job resource, but also used to initialize slice objects by location""" if self._state in ["processed", "error"]: return self._state get_resp = requests.get(self.location, cookies={"session": ...
[ "def", "_get_status", "(", "self", ")", ":", "if", "self", ".", "_state", "in", "[", "\"processed\"", ",", "\"error\"", "]", ":", "return", "self", ".", "_state", "get_resp", "=", "requests", ".", "get", "(", "self", ".", "location", ",", "cookies", "=...
utility method to get the status of a slicing job resource, but also used to initialize slice objects by location
[ "utility", "method", "to", "get", "the", "status", "of", "a", "slicing", "job", "resource", "but", "also", "used", "to", "initialize", "slice", "objects", "by", "location" ]
ee32bd7f7de15d3fb24c0a6374640d3a1ec8096d
https://github.com/DoWhileGeek/authentise-services/blob/ee32bd7f7de15d3fb24c0a6374640d3a1ec8096d/authentise_services/slice.py#L55-L66
250,899
eeue56/PyChat.js
pychatjs/server/user_server.py
User._to_json
def _to_json(self): """ Gets a dict of this object's properties so that it can be used to send a dump to the client """ return dict(( (k, v) for k, v in self.__dict__.iteritems() if k != 'server'))
python
def _to_json(self): """ Gets a dict of this object's properties so that it can be used to send a dump to the client """ return dict(( (k, v) for k, v in self.__dict__.iteritems() if k != 'server'))
[ "def", "_to_json", "(", "self", ")", ":", "return", "dict", "(", "(", "(", "k", ",", "v", ")", "for", "k", ",", "v", "in", "self", ".", "__dict__", ".", "iteritems", "(", ")", "if", "k", "!=", "'server'", ")", ")" ]
Gets a dict of this object's properties so that it can be used to send a dump to the client
[ "Gets", "a", "dict", "of", "this", "object", "s", "properties", "so", "that", "it", "can", "be", "used", "to", "send", "a", "dump", "to", "the", "client" ]
45056de6f988350c90a6dbe674459a4affde8abc
https://github.com/eeue56/PyChat.js/blob/45056de6f988350c90a6dbe674459a4affde8abc/pychatjs/server/user_server.py#L16-L18