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
248,000
ploneintranet/ploneintranet.workspace
src/ploneintranet/workspace/subscribers.py
participation_policy_changed
def participation_policy_changed(ob, event): """ Move all the existing users to a new group """ workspace = IWorkspace(ob) old_group_name = workspace.group_for_policy(event.old_policy) old_group = api.group.get(old_group_name) for member in old_group.getAllGroupMembers(): groups = workspace....
python
def participation_policy_changed(ob, event): """ Move all the existing users to a new group """ workspace = IWorkspace(ob) old_group_name = workspace.group_for_policy(event.old_policy) old_group = api.group.get(old_group_name) for member in old_group.getAllGroupMembers(): groups = workspace....
[ "def", "participation_policy_changed", "(", "ob", ",", "event", ")", ":", "workspace", "=", "IWorkspace", "(", "ob", ")", "old_group_name", "=", "workspace", ".", "group_for_policy", "(", "event", ".", "old_policy", ")", "old_group", "=", "api", ".", "group", ...
Move all the existing users to a new group
[ "Move", "all", "the", "existing", "users", "to", "a", "new", "group" ]
a4fc7a5c61f9c6d4d4ad25478ff5250f342ffbba
https://github.com/ploneintranet/ploneintranet.workspace/blob/a4fc7a5c61f9c6d4d4ad25478ff5250f342ffbba/src/ploneintranet/workspace/subscribers.py#L62-L70
248,001
ploneintranet/ploneintranet.workspace
src/ploneintranet/workspace/subscribers.py
invitation_accepted
def invitation_accepted(event): """ When an invitation is accepted, add the user to the team """ request = getRequest() storage = get_storage() if event.token_id not in storage: return ws_uid, username = storage[event.token_id] storage[event.token_id] acl_users = api.portal....
python
def invitation_accepted(event): """ When an invitation is accepted, add the user to the team """ request = getRequest() storage = get_storage() if event.token_id not in storage: return ws_uid, username = storage[event.token_id] storage[event.token_id] acl_users = api.portal....
[ "def", "invitation_accepted", "(", "event", ")", ":", "request", "=", "getRequest", "(", ")", "storage", "=", "get_storage", "(", ")", "if", "event", ".", "token_id", "not", "in", "storage", ":", "return", "ws_uid", ",", "username", "=", "storage", "[", ...
When an invitation is accepted, add the user to the team
[ "When", "an", "invitation", "is", "accepted", "add", "the", "user", "to", "the", "team" ]
a4fc7a5c61f9c6d4d4ad25478ff5250f342ffbba
https://github.com/ploneintranet/ploneintranet.workspace/blob/a4fc7a5c61f9c6d4d4ad25478ff5250f342ffbba/src/ploneintranet/workspace/subscribers.py#L73-L109
248,002
ploneintranet/ploneintranet.workspace
src/ploneintranet/workspace/subscribers.py
user_deleted_from_site_event
def user_deleted_from_site_event(event): """ Remove deleted user from all the workspaces where he is a member """ userid = event.principal catalog = api.portal.get_tool('portal_catalog') query = {'object_provides': WORKSPACE_INTERFACE} query['workspace_members'] = userid workspaces = [ ...
python
def user_deleted_from_site_event(event): """ Remove deleted user from all the workspaces where he is a member """ userid = event.principal catalog = api.portal.get_tool('portal_catalog') query = {'object_provides': WORKSPACE_INTERFACE} query['workspace_members'] = userid workspaces = [ ...
[ "def", "user_deleted_from_site_event", "(", "event", ")", ":", "userid", "=", "event", ".", "principal", "catalog", "=", "api", ".", "portal", ".", "get_tool", "(", "'portal_catalog'", ")", "query", "=", "{", "'object_provides'", ":", "WORKSPACE_INTERFACE", "}",...
Remove deleted user from all the workspaces where he is a member
[ "Remove", "deleted", "user", "from", "all", "the", "workspaces", "where", "he", "is", "a", "member" ]
a4fc7a5c61f9c6d4d4ad25478ff5250f342ffbba
https://github.com/ploneintranet/ploneintranet.workspace/blob/a4fc7a5c61f9c6d4d4ad25478ff5250f342ffbba/src/ploneintranet/workspace/subscribers.py#L112-L126
248,003
Bystroushaak/zeo_connector_defaults
src/zeo_connector_defaults/environment_generator.py
data_context_name
def data_context_name(fn): """ Return the `fn` in absolute path in `template_data` directory. """ return os.path.join(os.path.dirname(__file__), "template_data", fn)
python
def data_context_name(fn): """ Return the `fn` in absolute path in `template_data` directory. """ return os.path.join(os.path.dirname(__file__), "template_data", fn)
[ "def", "data_context_name", "(", "fn", ")", ":", "return", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "\"template_data\"", ",", "fn", ")" ]
Return the `fn` in absolute path in `template_data` directory.
[ "Return", "the", "fn", "in", "absolute", "path", "in", "template_data", "directory", "." ]
b54ecb99ddb4665db00fba183ef1d7252b0ca62b
https://github.com/Bystroushaak/zeo_connector_defaults/blob/b54ecb99ddb4665db00fba183ef1d7252b0ca62b/src/zeo_connector_defaults/environment_generator.py#L24-L28
248,004
Bystroushaak/zeo_connector_defaults
src/zeo_connector_defaults/environment_generator.py
data_context
def data_context(fn, mode="r"): """ Return content fo the `fn` from the `template_data` directory. """ with open(data_context_name(fn), mode) as f: return f.read()
python
def data_context(fn, mode="r"): """ Return content fo the `fn` from the `template_data` directory. """ with open(data_context_name(fn), mode) as f: return f.read()
[ "def", "data_context", "(", "fn", ",", "mode", "=", "\"r\"", ")", ":", "with", "open", "(", "data_context_name", "(", "fn", ")", ",", "mode", ")", "as", "f", ":", "return", "f", ".", "read", "(", ")" ]
Return content fo the `fn` from the `template_data` directory.
[ "Return", "content", "fo", "the", "fn", "from", "the", "template_data", "directory", "." ]
b54ecb99ddb4665db00fba183ef1d7252b0ca62b
https://github.com/Bystroushaak/zeo_connector_defaults/blob/b54ecb99ddb4665db00fba183ef1d7252b0ca62b/src/zeo_connector_defaults/environment_generator.py#L31-L36
248,005
Bystroushaak/zeo_connector_defaults
src/zeo_connector_defaults/environment_generator.py
tmp_context
def tmp_context(fn, mode="r"): """ Return content fo the `fn` from the temporary directory. """ with open(tmp_context_name(fn), mode) as f: return f.read()
python
def tmp_context(fn, mode="r"): """ Return content fo the `fn` from the temporary directory. """ with open(tmp_context_name(fn), mode) as f: return f.read()
[ "def", "tmp_context", "(", "fn", ",", "mode", "=", "\"r\"", ")", ":", "with", "open", "(", "tmp_context_name", "(", "fn", ")", ",", "mode", ")", "as", "f", ":", "return", "f", ".", "read", "(", ")" ]
Return content fo the `fn` from the temporary directory.
[ "Return", "content", "fo", "the", "fn", "from", "the", "temporary", "directory", "." ]
b54ecb99ddb4665db00fba183ef1d7252b0ca62b
https://github.com/Bystroushaak/zeo_connector_defaults/blob/b54ecb99ddb4665db00fba183ef1d7252b0ca62b/src/zeo_connector_defaults/environment_generator.py#L49-L54
248,006
Bystroushaak/zeo_connector_defaults
src/zeo_connector_defaults/environment_generator.py
cleanup_environment
def cleanup_environment(): """ Shutdown the ZEO server process running in another thread and cleanup the temporary directory. """ SERV.terminate() shutil.rmtree(TMP_PATH) if os.path.exists(TMP_PATH): os.rmdir(TMP_PATH) global TMP_PATH TMP_PATH = None
python
def cleanup_environment(): """ Shutdown the ZEO server process running in another thread and cleanup the temporary directory. """ SERV.terminate() shutil.rmtree(TMP_PATH) if os.path.exists(TMP_PATH): os.rmdir(TMP_PATH) global TMP_PATH TMP_PATH = None
[ "def", "cleanup_environment", "(", ")", ":", "SERV", ".", "terminate", "(", ")", "shutil", ".", "rmtree", "(", "TMP_PATH", ")", "if", "os", ".", "path", ".", "exists", "(", "TMP_PATH", ")", ":", "os", ".", "rmdir", "(", "TMP_PATH", ")", "global", "TM...
Shutdown the ZEO server process running in another thread and cleanup the temporary directory.
[ "Shutdown", "the", "ZEO", "server", "process", "running", "in", "another", "thread", "and", "cleanup", "the", "temporary", "directory", "." ]
b54ecb99ddb4665db00fba183ef1d7252b0ca62b
https://github.com/Bystroushaak/zeo_connector_defaults/blob/b54ecb99ddb4665db00fba183ef1d7252b0ca62b/src/zeo_connector_defaults/environment_generator.py#L97-L108
248,007
dave-shawley/coercion
coercion.py
stringify
def stringify(obj): """ Return the string representation of an object. :param obj: object to get the representation of :returns: unicode string representation of `obj` or `obj` unchanged This function returns a string representation for many of the types from the standard library. It does not...
python
def stringify(obj): """ Return the string representation of an object. :param obj: object to get the representation of :returns: unicode string representation of `obj` or `obj` unchanged This function returns a string representation for many of the types from the standard library. It does not...
[ "def", "stringify", "(", "obj", ")", ":", "out", "=", "obj", "if", "isinstance", "(", "obj", ",", "uuid", ".", "UUID", ")", ":", "out", "=", "str", "(", "obj", ")", "elif", "hasattr", "(", "obj", ",", "'strftime'", ")", ":", "out", "=", "obj", ...
Return the string representation of an object. :param obj: object to get the representation of :returns: unicode string representation of `obj` or `obj` unchanged This function returns a string representation for many of the types from the standard library. It does not convert numeric or Boolean ...
[ "Return", "the", "string", "representation", "of", "an", "object", "." ]
152c91b99310364a7198020090d7d2197ebea94d
https://github.com/dave-shawley/coercion/blob/152c91b99310364a7198020090d7d2197ebea94d/coercion.py#L15-L62
248,008
dave-shawley/coercion
coercion.py
normalize_collection
def normalize_collection(coll): """ Normalize all elements in a collection. :param coll: the collection to normalize. This is required to implement one of the following protocols: :class:`collections.Mapping`, :class:`collections.Sequence`, or :class:`collections.Set`. :return...
python
def normalize_collection(coll): """ Normalize all elements in a collection. :param coll: the collection to normalize. This is required to implement one of the following protocols: :class:`collections.Mapping`, :class:`collections.Sequence`, or :class:`collections.Set`. :return...
[ "def", "normalize_collection", "(", "coll", ")", ":", "#", "# The recursive version of this algorithm is something like:", "#", "# if isinstance(coll, dict):", "# return dict((stringify(k), normalize_collection(v))", "# for k, v in coll.items())", "# if isinst...
Normalize all elements in a collection. :param coll: the collection to normalize. This is required to implement one of the following protocols: :class:`collections.Mapping`, :class:`collections.Sequence`, or :class:`collections.Set`. :returns: a new instance of the input class with th...
[ "Normalize", "all", "elements", "in", "a", "collection", "." ]
152c91b99310364a7198020090d7d2197ebea94d
https://github.com/dave-shawley/coercion/blob/152c91b99310364a7198020090d7d2197ebea94d/coercion.py#L65-L146
248,009
klmitch/vobj
vobj/version.py
SmartVersion.available
def available(self): """ Returns a set of the available versions. :returns: A set of integers giving the available versions. """ # Short-circuit if not self._schema: return set() # Build up the set of available versions avail = set(self._sch...
python
def available(self): """ Returns a set of the available versions. :returns: A set of integers giving the available versions. """ # Short-circuit if not self._schema: return set() # Build up the set of available versions avail = set(self._sch...
[ "def", "available", "(", "self", ")", ":", "# Short-circuit", "if", "not", "self", ".", "_schema", ":", "return", "set", "(", ")", "# Build up the set of available versions", "avail", "=", "set", "(", "self", ".", "_schema", ".", "__vers_downgraders__", ".", "...
Returns a set of the available versions. :returns: A set of integers giving the available versions.
[ "Returns", "a", "set", "of", "the", "available", "versions", "." ]
4952658dc0914fe92afb2ef6e5ccca2829de6cb2
https://github.com/klmitch/vobj/blob/4952658dc0914fe92afb2ef6e5ccca2829de6cb2/vobj/version.py#L101-L116
248,010
rackerlabs/rackspace-python-neutronclient
neutronclient/neutron/v2_0/__init__.py
parse_args_to_dict
def parse_args_to_dict(values_specs): """It is used to analyze the extra command options to command. Besides known options and arguments, our commands also support user to put more options to the end of command line. For example, list_nets -- --tag x y --key1 value1, where '-- --tag x y --key1 value1' ...
python
def parse_args_to_dict(values_specs): """It is used to analyze the extra command options to command. Besides known options and arguments, our commands also support user to put more options to the end of command line. For example, list_nets -- --tag x y --key1 value1, where '-- --tag x y --key1 value1' ...
[ "def", "parse_args_to_dict", "(", "values_specs", ")", ":", "# values_specs for example: '-- --tag x y --key1 type=int value1'", "# -- is a pseudo argument", "values_specs_copy", "=", "values_specs", "[", ":", "]", "if", "values_specs_copy", "and", "values_specs_copy", "[", "0"...
It is used to analyze the extra command options to command. Besides known options and arguments, our commands also support user to put more options to the end of command line. For example, list_nets -- --tag x y --key1 value1, where '-- --tag x y --key1 value1' is extra options to our list_nets. This f...
[ "It", "is", "used", "to", "analyze", "the", "extra", "command", "options", "to", "command", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/neutron/v2_0/__init__.py#L229-L342
248,011
rackerlabs/rackspace-python-neutronclient
neutronclient/neutron/v2_0/__init__.py
_merge_args
def _merge_args(qCmd, parsed_args, _extra_values, value_specs): """Merge arguments from _extra_values into parsed_args. If an argument value are provided in both and it is a list, the values in _extra_values will be merged into parsed_args. @param parsed_args: the parsed args from known options @p...
python
def _merge_args(qCmd, parsed_args, _extra_values, value_specs): """Merge arguments from _extra_values into parsed_args. If an argument value are provided in both and it is a list, the values in _extra_values will be merged into parsed_args. @param parsed_args: the parsed args from known options @p...
[ "def", "_merge_args", "(", "qCmd", ",", "parsed_args", ",", "_extra_values", ",", "value_specs", ")", ":", "temp_values", "=", "_extra_values", ".", "copy", "(", ")", "for", "key", ",", "value", "in", "six", ".", "iteritems", "(", "temp_values", ")", ":", ...
Merge arguments from _extra_values into parsed_args. If an argument value are provided in both and it is a list, the values in _extra_values will be merged into parsed_args. @param parsed_args: the parsed args from known options @param _extra_values: the other parsed arguments in unknown parts @pa...
[ "Merge", "arguments", "from", "_extra_values", "into", "parsed_args", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/neutron/v2_0/__init__.py#L345-L365
248,012
rackerlabs/rackspace-python-neutronclient
neutronclient/neutron/v2_0/__init__.py
update_dict
def update_dict(obj, dict, attributes): """Update dict with fields from obj.attributes. :param obj: the object updated into dict :param dict: the result dictionary :param attributes: a list of attributes belonging to obj """ for attribute in attributes: if hasattr(obj, attribute) and ge...
python
def update_dict(obj, dict, attributes): """Update dict with fields from obj.attributes. :param obj: the object updated into dict :param dict: the result dictionary :param attributes: a list of attributes belonging to obj """ for attribute in attributes: if hasattr(obj, attribute) and ge...
[ "def", "update_dict", "(", "obj", ",", "dict", ",", "attributes", ")", ":", "for", "attribute", "in", "attributes", ":", "if", "hasattr", "(", "obj", ",", "attribute", ")", "and", "getattr", "(", "obj", ",", "attribute", ")", "is", "not", "None", ":", ...
Update dict with fields from obj.attributes. :param obj: the object updated into dict :param dict: the result dictionary :param attributes: a list of attributes belonging to obj
[ "Update", "dict", "with", "fields", "from", "obj", ".", "attributes", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/neutron/v2_0/__init__.py#L368-L377
248,013
rackerlabs/rackspace-python-neutronclient
neutronclient/neutron/v2_0/__init__.py
ListCommand.retrieve_list
def retrieve_list(self, parsed_args): """Retrieve a list of resources from Neutron server.""" neutron_client = self.get_client() _extra_values = parse_args_to_dict(self.values_specs) _merge_args(self, parsed_args, _extra_values, self.values_specs) search_opts ...
python
def retrieve_list(self, parsed_args): """Retrieve a list of resources from Neutron server.""" neutron_client = self.get_client() _extra_values = parse_args_to_dict(self.values_specs) _merge_args(self, parsed_args, _extra_values, self.values_specs) search_opts ...
[ "def", "retrieve_list", "(", "self", ",", "parsed_args", ")", ":", "neutron_client", "=", "self", ".", "get_client", "(", ")", "_extra_values", "=", "parse_args_to_dict", "(", "self", ".", "values_specs", ")", "_merge_args", "(", "self", ",", "parsed_args", ",...
Retrieve a list of resources from Neutron server.
[ "Retrieve", "a", "list", "of", "resources", "from", "Neutron", "server", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/neutron/v2_0/__init__.py#L707-L733
248,014
treycucco/bidon
bidon/db/access/pg_advisory_lock.py
lock_key
def lock_key(group_id, item_id, group_width=8): """Creates a lock ID where the lower bits are the group ID and the upper bits are the item ID. This allows the use of a bigint namespace for items, with a limited space for grouping. :group_id: an integer identifying the group. Must be less than 2 ^ ...
python
def lock_key(group_id, item_id, group_width=8): """Creates a lock ID where the lower bits are the group ID and the upper bits are the item ID. This allows the use of a bigint namespace for items, with a limited space for grouping. :group_id: an integer identifying the group. Must be less than 2 ^ ...
[ "def", "lock_key", "(", "group_id", ",", "item_id", ",", "group_width", "=", "8", ")", ":", "if", "group_id", ">=", "(", "1", "<<", "group_width", ")", ":", "raise", "Exception", "(", "\"Group ID is too big\"", ")", "if", "item_id", ">=", "(", "1", "<<",...
Creates a lock ID where the lower bits are the group ID and the upper bits are the item ID. This allows the use of a bigint namespace for items, with a limited space for grouping. :group_id: an integer identifying the group. Must be less than 2 ^ :group_width: :item_id: item_id an integer. must be...
[ "Creates", "a", "lock", "ID", "where", "the", "lower", "bits", "are", "the", "group", "ID", "and", "the", "upper", "bits", "are", "the", "item", "ID", ".", "This", "allows", "the", "use", "of", "a", "bigint", "namespace", "for", "items", "with", "a", ...
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/pg_advisory_lock.py#L16-L30
248,015
treycucco/bidon
bidon/db/access/pg_advisory_lock.py
release_lock
def release_lock(dax, key, lock_mode=LockMode.wait): """Manually release a pg advisory lock. :dax: a DataAccess instance :key: either a big int or a 2-tuple of integers :lock_mode: a member of the LockMode enum """ lock_fxn = _lock_fxn("unlock", lock_mode, False) return dax.get_scalar( dax.callproc(l...
python
def release_lock(dax, key, lock_mode=LockMode.wait): """Manually release a pg advisory lock. :dax: a DataAccess instance :key: either a big int or a 2-tuple of integers :lock_mode: a member of the LockMode enum """ lock_fxn = _lock_fxn("unlock", lock_mode, False) return dax.get_scalar( dax.callproc(l...
[ "def", "release_lock", "(", "dax", ",", "key", ",", "lock_mode", "=", "LockMode", ".", "wait", ")", ":", "lock_fxn", "=", "_lock_fxn", "(", "\"unlock\"", ",", "lock_mode", ",", "False", ")", "return", "dax", ".", "get_scalar", "(", "dax", ".", "callproc"...
Manually release a pg advisory lock. :dax: a DataAccess instance :key: either a big int or a 2-tuple of integers :lock_mode: a member of the LockMode enum
[ "Manually", "release", "a", "pg", "advisory", "lock", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/pg_advisory_lock.py#L47-L56
248,016
treycucco/bidon
bidon/db/access/pg_advisory_lock.py
advisory_lock
def advisory_lock(dax, key, lock_mode=LockMode.wait, xact=False): """A context manager for obtaining a lock, executing code, and then releasing the lock. A boolean value is passed to the block indicating whether or not the lock was obtained. :dax: a DataAccess instance :key: either a big int or a 2-tuple ...
python
def advisory_lock(dax, key, lock_mode=LockMode.wait, xact=False): """A context manager for obtaining a lock, executing code, and then releasing the lock. A boolean value is passed to the block indicating whether or not the lock was obtained. :dax: a DataAccess instance :key: either a big int or a 2-tuple ...
[ "def", "advisory_lock", "(", "dax", ",", "key", ",", "lock_mode", "=", "LockMode", ".", "wait", ",", "xact", "=", "False", ")", ":", "if", "lock_mode", "==", "LockMode", ".", "wait", ":", "obtain_lock", "(", "dax", ",", "key", ",", "lock_mode", ",", ...
A context manager for obtaining a lock, executing code, and then releasing the lock. A boolean value is passed to the block indicating whether or not the lock was obtained. :dax: a DataAccess instance :key: either a big int or a 2-tuple of integers :lock_mode: a member of the LockMode enum. Determines how...
[ "A", "context", "manager", "for", "obtaining", "a", "lock", "executing", "code", "and", "then", "releasing", "the", "lock", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/pg_advisory_lock.py#L60-L98
248,017
treycucco/bidon
bidon/db/access/pg_advisory_lock.py
_lock_fxn
def _lock_fxn(direction, lock_mode, xact): """Builds a pg advisory lock function name based on various options. :direction: one of "lock" or "unlock" :lock_mode: a member of the LockMode enum :xact: a boolean, if True the lock will be automatically released at the end of the transaction and cannot be ...
python
def _lock_fxn(direction, lock_mode, xact): """Builds a pg advisory lock function name based on various options. :direction: one of "lock" or "unlock" :lock_mode: a member of the LockMode enum :xact: a boolean, if True the lock will be automatically released at the end of the transaction and cannot be ...
[ "def", "_lock_fxn", "(", "direction", ",", "lock_mode", ",", "xact", ")", ":", "if", "direction", "==", "\"unlock\"", "or", "lock_mode", "==", "LockMode", ".", "wait", ":", "try_mode", "=", "\"\"", "else", ":", "try_mode", "=", "\"_try\"", "if", "direction...
Builds a pg advisory lock function name based on various options. :direction: one of "lock" or "unlock" :lock_mode: a member of the LockMode enum :xact: a boolean, if True the lock will be automatically released at the end of the transaction and cannot be manually released.
[ "Builds", "a", "pg", "advisory", "lock", "function", "name", "based", "on", "various", "options", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/pg_advisory_lock.py#L101-L119
248,018
leosartaj/sub
sub/main.py
get_hash
def get_hash(fName, readSize, dire=pDir()): """ creates the required hash """ if not fileExists(fName, dire): return -1 readSize = readSize * 1024 # bytes to be read fName = os.path.join(dire, fName) # name coupled with path with open(fName, 'rb') as f: size = os.path.getsize...
python
def get_hash(fName, readSize, dire=pDir()): """ creates the required hash """ if not fileExists(fName, dire): return -1 readSize = readSize * 1024 # bytes to be read fName = os.path.join(dire, fName) # name coupled with path with open(fName, 'rb') as f: size = os.path.getsize...
[ "def", "get_hash", "(", "fName", ",", "readSize", ",", "dire", "=", "pDir", "(", ")", ")", ":", "if", "not", "fileExists", "(", "fName", ",", "dire", ")", ":", "return", "-", "1", "readSize", "=", "readSize", "*", "1024", "# bytes to be read", "fName",...
creates the required hash
[ "creates", "the", "required", "hash" ]
9a8e55a5326c3b41357eedd235e7c36f253db2e0
https://github.com/leosartaj/sub/blob/9a8e55a5326c3b41357eedd235e7c36f253db2e0/sub/main.py#L37-L52
248,019
leosartaj/sub
sub/main.py
download_file
def download_file(fName, time, dire=pDir()): """ download the required subtitle """ # hash gen_hash = get_hash(fName, 64, dire) if gen_hash == -1: return -1 # making request user_agent = {'User-agent': 'SubDB/1.0 (sub/0.1; http://github.com/leosartaj/sub)'} param = {'action'...
python
def download_file(fName, time, dire=pDir()): """ download the required subtitle """ # hash gen_hash = get_hash(fName, 64, dire) if gen_hash == -1: return -1 # making request user_agent = {'User-agent': 'SubDB/1.0 (sub/0.1; http://github.com/leosartaj/sub)'} param = {'action'...
[ "def", "download_file", "(", "fName", ",", "time", ",", "dire", "=", "pDir", "(", ")", ")", ":", "# hash", "gen_hash", "=", "get_hash", "(", "fName", ",", "64", ",", "dire", ")", "if", "gen_hash", "==", "-", "1", ":", "return", "-", "1", "# making ...
download the required subtitle
[ "download", "the", "required", "subtitle" ]
9a8e55a5326c3b41357eedd235e7c36f253db2e0
https://github.com/leosartaj/sub/blob/9a8e55a5326c3b41357eedd235e7c36f253db2e0/sub/main.py#L54-L80
248,020
leosartaj/sub
sub/main.py
file_downloaded
def file_downloaded(dwn, fName, verbose=False): """ print for downloaded file """ if verbose: if dwn == 200: fName, fExt = os.path.splitext(fName) print 'Downloaded ' + fName + '.srt' return True elif dwn != -1: print 'Tried downloading got...
python
def file_downloaded(dwn, fName, verbose=False): """ print for downloaded file """ if verbose: if dwn == 200: fName, fExt = os.path.splitext(fName) print 'Downloaded ' + fName + '.srt' return True elif dwn != -1: print 'Tried downloading got...
[ "def", "file_downloaded", "(", "dwn", ",", "fName", ",", "verbose", "=", "False", ")", ":", "if", "verbose", ":", "if", "dwn", "==", "200", ":", "fName", ",", "fExt", "=", "os", ".", "path", ".", "splitext", "(", "fName", ")", "print", "'Downloaded '...
print for downloaded file
[ "print", "for", "downloaded", "file" ]
9a8e55a5326c3b41357eedd235e7c36f253db2e0
https://github.com/leosartaj/sub/blob/9a8e55a5326c3b41357eedd235e7c36f253db2e0/sub/main.py#L82-L93
248,021
leosartaj/sub
sub/main.py
download
def download(name, options): """ download a file or all files in a directory """ dire = os.path.dirname(name) # returns the directory name fName = os.path.basename(name) # returns the filename fNameOnly, fExt = os.path.splitext(fName) dwn = 0 if fileExists(fName, dire) and not fileExis...
python
def download(name, options): """ download a file or all files in a directory """ dire = os.path.dirname(name) # returns the directory name fName = os.path.basename(name) # returns the filename fNameOnly, fExt = os.path.splitext(fName) dwn = 0 if fileExists(fName, dire) and not fileExis...
[ "def", "download", "(", "name", ",", "options", ")", ":", "dire", "=", "os", ".", "path", ".", "dirname", "(", "name", ")", "# returns the directory name", "fName", "=", "os", ".", "path", ".", "basename", "(", "name", ")", "# returns the filename", "fName...
download a file or all files in a directory
[ "download", "a", "file", "or", "all", "files", "in", "a", "directory" ]
9a8e55a5326c3b41357eedd235e7c36f253db2e0
https://github.com/leosartaj/sub/blob/9a8e55a5326c3b41357eedd235e7c36f253db2e0/sub/main.py#L95-L115
248,022
ulf1/oxyba
oxyba/clean_dateobject_to_string.py
clean_dateobject_to_string
def clean_dateobject_to_string(x): """Convert a Pandas Timestamp object or datetime object to 'YYYY-MM-DD' string Parameters ---------- x : str, list, tuple, numpy.ndarray, pandas.DataFrame A Pandas Timestamp object or datetime object, or an array of these objects Returns -...
python
def clean_dateobject_to_string(x): """Convert a Pandas Timestamp object or datetime object to 'YYYY-MM-DD' string Parameters ---------- x : str, list, tuple, numpy.ndarray, pandas.DataFrame A Pandas Timestamp object or datetime object, or an array of these objects Returns -...
[ "def", "clean_dateobject_to_string", "(", "x", ")", ":", "import", "numpy", "as", "np", "import", "pandas", "as", "pd", "def", "proc_elem", "(", "e", ")", ":", "try", ":", "return", "e", ".", "strftime", "(", "\"%Y-%m-%d\"", ")", "except", "Exception", "...
Convert a Pandas Timestamp object or datetime object to 'YYYY-MM-DD' string Parameters ---------- x : str, list, tuple, numpy.ndarray, pandas.DataFrame A Pandas Timestamp object or datetime object, or an array of these objects Returns ------- y : str, list, tuple, numpy.nda...
[ "Convert", "a", "Pandas", "Timestamp", "object", "or", "datetime", "object", "to", "YYYY", "-", "MM", "-", "DD", "string" ]
b3043116050de275124365cb11e7df91fb40169d
https://github.com/ulf1/oxyba/blob/b3043116050de275124365cb11e7df91fb40169d/oxyba/clean_dateobject_to_string.py#L2-L66
248,023
sys-git/certifiable
certifiable/operators.py
AND
def AND(*args, **kwargs): """ ALL args must not raise an exception when called incrementally. If an exception is specified, raise it, otherwise raise the callable's exception. :params iterable[Certifier] args: The certifiers to call :param callable kwargs['exc']: Callable that exce...
python
def AND(*args, **kwargs): """ ALL args must not raise an exception when called incrementally. If an exception is specified, raise it, otherwise raise the callable's exception. :params iterable[Certifier] args: The certifiers to call :param callable kwargs['exc']: Callable that exce...
[ "def", "AND", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "for", "arg", "in", "args", ":", "try", ":", "arg", "(", ")", "except", "CertifierError", "as", "e", ":", "exc", "=", "kwargs", ".", "get", "(", "'exc'", ",", "None", ")", "if",...
ALL args must not raise an exception when called incrementally. If an exception is specified, raise it, otherwise raise the callable's exception. :params iterable[Certifier] args: The certifiers to call :param callable kwargs['exc']: Callable that excepts the unexpectedly raised exception ...
[ "ALL", "args", "must", "not", "raise", "an", "exception", "when", "called", "incrementally", ".", "If", "an", "exception", "is", "specified", "raise", "it", "otherwise", "raise", "the", "callable", "s", "exception", "." ]
a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/operators.py#L34-L55
248,024
sys-git/certifiable
certifiable/operators.py
NAND
def NAND(*args, **kwargs): """ ALL args must raise an exception when called overall. Raise the specified exception on failure OR the first exception. :params iterable[Certifier] args: The certifiers to call :param callable kwargs['exc']: Callable that excepts the unexpectedly raised...
python
def NAND(*args, **kwargs): """ ALL args must raise an exception when called overall. Raise the specified exception on failure OR the first exception. :params iterable[Certifier] args: The certifiers to call :param callable kwargs['exc']: Callable that excepts the unexpectedly raised...
[ "def", "NAND", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "errors", "=", "[", "]", "for", "arg", "in", "args", ":", "try", ":", "arg", "(", ")", "except", "CertifierError", "as", "e", ":", "errors", ".", "append", "(", "e", ")", "if",...
ALL args must raise an exception when called overall. Raise the specified exception on failure OR the first exception. :params iterable[Certifier] args: The certifiers to call :param callable kwargs['exc']: Callable that excepts the unexpectedly raised exception as argument and return an ...
[ "ALL", "args", "must", "raise", "an", "exception", "when", "called", "overall", ".", "Raise", "the", "specified", "exception", "on", "failure", "OR", "the", "first", "exception", "." ]
a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/operators.py#L58-L83
248,025
sys-git/certifiable
certifiable/operators.py
XOR
def XOR(a, b, exc=CertifierValueError('Expected at least one certified value')): """ Only one arg must not raise a Certifier exception when called overall. Raise the specified exception on failure. :params Certifier a: The first certifiers to call :params Certifier b: The second cer...
python
def XOR(a, b, exc=CertifierValueError('Expected at least one certified value')): """ Only one arg must not raise a Certifier exception when called overall. Raise the specified exception on failure. :params Certifier a: The first certifiers to call :params Certifier b: The second cer...
[ "def", "XOR", "(", "a", ",", "b", ",", "exc", "=", "CertifierValueError", "(", "'Expected at least one certified value'", ")", ")", ":", "errors", "=", "[", "]", "for", "certifier", "in", "[", "a", ",", "b", "]", ":", "try", ":", "certifier", "(", ")",...
Only one arg must not raise a Certifier exception when called overall. Raise the specified exception on failure. :params Certifier a: The first certifiers to call :params Certifier b: The second certifiers to call :param Exception exc: Callable that is raised if XOR fails.
[ "Only", "one", "arg", "must", "not", "raise", "a", "Certifier", "exception", "when", "called", "overall", ".", "Raise", "the", "specified", "exception", "on", "failure", "." ]
a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/operators.py#L86-L108
248,026
FujiMakoto/IPS-Vagrant
ips_vagrant/cli.py
cli
def cli(ctx, verbose, config): """ IPS Vagrant Management Utility """ assert isinstance(ctx, Context) # Set up the logger verbose = verbose if (verbose <= 3) else 3 log_levels = {1: logging.WARN, 2: logging.INFO, 3: logging.DEBUG} log_level = log_levels[verbose] ctx.log = logging.ge...
python
def cli(ctx, verbose, config): """ IPS Vagrant Management Utility """ assert isinstance(ctx, Context) # Set up the logger verbose = verbose if (verbose <= 3) else 3 log_levels = {1: logging.WARN, 2: logging.INFO, 3: logging.DEBUG} log_level = log_levels[verbose] ctx.log = logging.ge...
[ "def", "cli", "(", "ctx", ",", "verbose", ",", "config", ")", ":", "assert", "isinstance", "(", "ctx", ",", "Context", ")", "# Set up the logger", "verbose", "=", "verbose", "if", "(", "verbose", "<=", "3", ")", "else", "3", "log_levels", "=", "{", "1"...
IPS Vagrant Management Utility
[ "IPS", "Vagrant", "Management", "Utility" ]
7b1d6d095034dd8befb026d9315ecc6494d52269
https://github.com/FujiMakoto/IPS-Vagrant/blob/7b1d6d095034dd8befb026d9315ecc6494d52269/ips_vagrant/cli.py#L119-L155
248,027
FujiMakoto/IPS-Vagrant
ips_vagrant/cli.py
Context.db
def db(self): """ Get a loaded database session """ if self.database is NotImplemented: self.database = Session return self.database
python
def db(self): """ Get a loaded database session """ if self.database is NotImplemented: self.database = Session return self.database
[ "def", "db", "(", "self", ")", ":", "if", "self", ".", "database", "is", "NotImplemented", ":", "self", ".", "database", "=", "Session", "return", "self", ".", "database" ]
Get a loaded database session
[ "Get", "a", "loaded", "database", "session" ]
7b1d6d095034dd8befb026d9315ecc6494d52269
https://github.com/FujiMakoto/IPS-Vagrant/blob/7b1d6d095034dd8befb026d9315ecc6494d52269/ips_vagrant/cli.py#L37-L44
248,028
FujiMakoto/IPS-Vagrant
ips_vagrant/cli.py
Context.get_login
def get_login(self, use_session=True): """ Get an active login session @param use_session: Use a saved session file if available @type use_session: bool """ # Should we try and return an existing login session? if use_session and self._login.check(): ...
python
def get_login(self, use_session=True): """ Get an active login session @param use_session: Use a saved session file if available @type use_session: bool """ # Should we try and return an existing login session? if use_session and self._login.check(): ...
[ "def", "get_login", "(", "self", ",", "use_session", "=", "True", ")", ":", "# Should we try and return an existing login session?", "if", "use_session", "and", "self", ".", "_login", ".", "check", "(", ")", ":", "self", ".", "cookiejar", "=", "self", ".", "_l...
Get an active login session @param use_session: Use a saved session file if available @type use_session: bool
[ "Get", "an", "active", "login", "session" ]
7b1d6d095034dd8befb026d9315ecc6494d52269
https://github.com/FujiMakoto/IPS-Vagrant/blob/7b1d6d095034dd8befb026d9315ecc6494d52269/ips_vagrant/cli.py#L53-L74
248,029
FujiMakoto/IPS-Vagrant
ips_vagrant/cli.py
IpsvCLI.list_commands
def list_commands(self, ctx): """ List CLI commands @type ctx: Context @rtype: list """ commands_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'commands') command_list = [name for __, name, ispkg in pkgutil.iter_modules([commands_path]) if ...
python
def list_commands(self, ctx): """ List CLI commands @type ctx: Context @rtype: list """ commands_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'commands') command_list = [name for __, name, ispkg in pkgutil.iter_modules([commands_path]) if ...
[ "def", "list_commands", "(", "self", ",", "ctx", ")", ":", "commands_path", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "realpath", "(", "__file__", ")", ")", ",", "'commands'", ")", "co...
List CLI commands @type ctx: Context @rtype: list
[ "List", "CLI", "commands" ]
7b1d6d095034dd8befb026d9315ecc6494d52269
https://github.com/FujiMakoto/IPS-Vagrant/blob/7b1d6d095034dd8befb026d9315ecc6494d52269/ips_vagrant/cli.py#L82-L91
248,030
FujiMakoto/IPS-Vagrant
ips_vagrant/cli.py
IpsvCLI.get_command
def get_command(self, ctx, name): """ Get a bound command method @type ctx: Context @param name: Command name @type name: str @rtype: object """ try: mod = importlib.import_module('ips_vagrant.commands.{name}'.format(name=name)) ...
python
def get_command(self, ctx, name): """ Get a bound command method @type ctx: Context @param name: Command name @type name: str @rtype: object """ try: mod = importlib.import_module('ips_vagrant.commands.{name}'.format(name=name)) ...
[ "def", "get_command", "(", "self", ",", "ctx", ",", "name", ")", ":", "try", ":", "mod", "=", "importlib", ".", "import_module", "(", "'ips_vagrant.commands.{name}'", ".", "format", "(", "name", "=", "name", ")", ")", "return", "mod", ".", "cli", "except...
Get a bound command method @type ctx: Context @param name: Command name @type name: str @rtype: object
[ "Get", "a", "bound", "command", "method" ]
7b1d6d095034dd8befb026d9315ecc6494d52269
https://github.com/FujiMakoto/IPS-Vagrant/blob/7b1d6d095034dd8befb026d9315ecc6494d52269/ips_vagrant/cli.py#L93-L105
248,031
polysquare/polysquare-setuptools-lint
polysquare_setuptools_lint/__init__.py
_patched_pep257
def _patched_pep257(): """Monkey-patch pep257 after imports to avoid info logging.""" import pep257 if getattr(pep257, "log", None): def _dummy(*args, **kwargs): del args del kwargs old_log_info = pep257.log.info pep257.log.info = _dummy # suppress(unused-a...
python
def _patched_pep257(): """Monkey-patch pep257 after imports to avoid info logging.""" import pep257 if getattr(pep257, "log", None): def _dummy(*args, **kwargs): del args del kwargs old_log_info = pep257.log.info pep257.log.info = _dummy # suppress(unused-a...
[ "def", "_patched_pep257", "(", ")", ":", "import", "pep257", "if", "getattr", "(", "pep257", ",", "\"log\"", ",", "None", ")", ":", "def", "_dummy", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "del", "args", "del", "kwargs", "old_log_info", ...
Monkey-patch pep257 after imports to avoid info logging.
[ "Monkey", "-", "patch", "pep257", "after", "imports", "to", "avoid", "info", "logging", "." ]
5df5a6401c7ad6a90b42230eeb99c82cc56952b6
https://github.com/polysquare/polysquare-setuptools-lint/blob/5df5a6401c7ad6a90b42230eeb99c82cc56952b6/polysquare_setuptools_lint/__init__.py#L53-L68
248,032
polysquare/polysquare-setuptools-lint
polysquare_setuptools_lint/__init__.py
_stamped_deps
def _stamped_deps(stamp_directory, func, dependencies, *args, **kwargs): """Run func, assumed to have dependencies as its first argument.""" if not isinstance(dependencies, list): jobstamps_dependencies = [dependencies] else: jobstamps_dependencies = dependencies kwargs.update({ ...
python
def _stamped_deps(stamp_directory, func, dependencies, *args, **kwargs): """Run func, assumed to have dependencies as its first argument.""" if not isinstance(dependencies, list): jobstamps_dependencies = [dependencies] else: jobstamps_dependencies = dependencies kwargs.update({ ...
[ "def", "_stamped_deps", "(", "stamp_directory", ",", "func", ",", "dependencies", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "isinstance", "(", "dependencies", ",", "list", ")", ":", "jobstamps_dependencies", "=", "[", "dependencies", ...
Run func, assumed to have dependencies as its first argument.
[ "Run", "func", "assumed", "to", "have", "dependencies", "as", "its", "first", "argument", "." ]
5df5a6401c7ad6a90b42230eeb99c82cc56952b6
https://github.com/polysquare/polysquare-setuptools-lint/blob/5df5a6401c7ad6a90b42230eeb99c82cc56952b6/polysquare_setuptools_lint/__init__.py#L71-L82
248,033
polysquare/polysquare-setuptools-lint
polysquare_setuptools_lint/__init__.py
_debug_linter_status
def _debug_linter_status(linter, filename, show_lint_files): """Indicate that we are running this linter if required.""" if show_lint_files: print("{linter}: {filename}".format(linter=linter, filename=filename))
python
def _debug_linter_status(linter, filename, show_lint_files): """Indicate that we are running this linter if required.""" if show_lint_files: print("{linter}: {filename}".format(linter=linter, filename=filename))
[ "def", "_debug_linter_status", "(", "linter", ",", "filename", ",", "show_lint_files", ")", ":", "if", "show_lint_files", ":", "print", "(", "\"{linter}: {filename}\"", ".", "format", "(", "linter", "=", "linter", ",", "filename", "=", "filename", ")", ")" ]
Indicate that we are running this linter if required.
[ "Indicate", "that", "we", "are", "running", "this", "linter", "if", "required", "." ]
5df5a6401c7ad6a90b42230eeb99c82cc56952b6
https://github.com/polysquare/polysquare-setuptools-lint/blob/5df5a6401c7ad6a90b42230eeb99c82cc56952b6/polysquare_setuptools_lint/__init__.py#L99-L102
248,034
polysquare/polysquare-setuptools-lint
polysquare_setuptools_lint/__init__.py
_run_flake8
def _run_flake8(filename, stamp_file_name, show_lint_files): """Run flake8, cached by stamp_file_name.""" _debug_linter_status("flake8", filename, show_lint_files) return _stamped_deps(stamp_file_name, _run_flake8_internal, filename)
python
def _run_flake8(filename, stamp_file_name, show_lint_files): """Run flake8, cached by stamp_file_name.""" _debug_linter_status("flake8", filename, show_lint_files) return _stamped_deps(stamp_file_name, _run_flake8_internal, filename)
[ "def", "_run_flake8", "(", "filename", ",", "stamp_file_name", ",", "show_lint_files", ")", ":", "_debug_linter_status", "(", "\"flake8\"", ",", "filename", ",", "show_lint_files", ")", "return", "_stamped_deps", "(", "stamp_file_name", ",", "_run_flake8_internal", ",...
Run flake8, cached by stamp_file_name.
[ "Run", "flake8", "cached", "by", "stamp_file_name", "." ]
5df5a6401c7ad6a90b42230eeb99c82cc56952b6
https://github.com/polysquare/polysquare-setuptools-lint/blob/5df5a6401c7ad6a90b42230eeb99c82cc56952b6/polysquare_setuptools_lint/__init__.py#L161-L166
248,035
polysquare/polysquare-setuptools-lint
polysquare_setuptools_lint/__init__.py
_run_prospector_on
def _run_prospector_on(filenames, tools, disabled_linters, show_lint_files, ignore_codes=None): """Run prospector on filename, using the specified tools. This function enables us to run different tools on different ...
python
def _run_prospector_on(filenames, tools, disabled_linters, show_lint_files, ignore_codes=None): """Run prospector on filename, using the specified tools. This function enables us to run different tools on different ...
[ "def", "_run_prospector_on", "(", "filenames", ",", "tools", ",", "disabled_linters", ",", "show_lint_files", ",", "ignore_codes", "=", "None", ")", ":", "from", "prospector", ".", "run", "import", "Prospector", ",", "ProspectorConfig", "assert", "tools", "tools",...
Run prospector on filename, using the specified tools. This function enables us to run different tools on different classes of files, which is necessary in the case of tests.
[ "Run", "prospector", "on", "filename", "using", "the", "specified", "tools", "." ]
5df5a6401c7ad6a90b42230eeb99c82cc56952b6
https://github.com/polysquare/polysquare-setuptools-lint/blob/5df5a6401c7ad6a90b42230eeb99c82cc56952b6/polysquare_setuptools_lint/__init__.py#L191-L235
248,036
polysquare/polysquare-setuptools-lint
polysquare_setuptools_lint/__init__.py
_run_prospector
def _run_prospector(filename, stamp_file_name, disabled_linters, show_lint_files): """Run prospector.""" linter_tools = [ "pep257", "pep8", "pyflakes" ] if can_run_pylint(): linter_tools.append("pylint") # ...
python
def _run_prospector(filename, stamp_file_name, disabled_linters, show_lint_files): """Run prospector.""" linter_tools = [ "pep257", "pep8", "pyflakes" ] if can_run_pylint(): linter_tools.append("pylint") # ...
[ "def", "_run_prospector", "(", "filename", ",", "stamp_file_name", ",", "disabled_linters", ",", "show_lint_files", ")", ":", "linter_tools", "=", "[", "\"pep257\"", ",", "\"pep8\"", ",", "\"pyflakes\"", "]", "if", "can_run_pylint", "(", ")", ":", "linter_tools", ...
Run prospector.
[ "Run", "prospector", "." ]
5df5a6401c7ad6a90b42230eeb99c82cc56952b6
https://github.com/polysquare/polysquare-setuptools-lint/blob/5df5a6401c7ad6a90b42230eeb99c82cc56952b6/polysquare_setuptools_lint/__init__.py#L244-L286
248,037
polysquare/polysquare-setuptools-lint
polysquare_setuptools_lint/__init__.py
_run_pyroma
def _run_pyroma(setup_file, show_lint_files): """Run pyroma.""" from pyroma import projectdata, ratings from prospector.message import Message, Location _debug_linter_status("pyroma", setup_file, show_lint_files) return_dict = dict() data = projectdata.get_data(os.getcwd()) all_tests = ra...
python
def _run_pyroma(setup_file, show_lint_files): """Run pyroma.""" from pyroma import projectdata, ratings from prospector.message import Message, Location _debug_linter_status("pyroma", setup_file, show_lint_files) return_dict = dict() data = projectdata.get_data(os.getcwd()) all_tests = ra...
[ "def", "_run_pyroma", "(", "setup_file", ",", "show_lint_files", ")", ":", "from", "pyroma", "import", "projectdata", ",", "ratings", "from", "prospector", ".", "message", "import", "Message", ",", "Location", "_debug_linter_status", "(", "\"pyroma\"", ",", "setup...
Run pyroma.
[ "Run", "pyroma", "." ]
5df5a6401c7ad6a90b42230eeb99c82cc56952b6
https://github.com/polysquare/polysquare-setuptools-lint/blob/5df5a6401c7ad6a90b42230eeb99c82cc56952b6/polysquare_setuptools_lint/__init__.py#L289-L311
248,038
polysquare/polysquare-setuptools-lint
polysquare_setuptools_lint/__init__.py
_run_polysquare_style_linter
def _run_polysquare_style_linter(matched_filenames, cache_dir, show_lint_files): """Run polysquare-generic-file-linter on matched_filenames.""" from polysquarelinter import linter as lint from prospector.message import Message, Location ...
python
def _run_polysquare_style_linter(matched_filenames, cache_dir, show_lint_files): """Run polysquare-generic-file-linter on matched_filenames.""" from polysquarelinter import linter as lint from prospector.message import Message, Location ...
[ "def", "_run_polysquare_style_linter", "(", "matched_filenames", ",", "cache_dir", ",", "show_lint_files", ")", ":", "from", "polysquarelinter", "import", "linter", "as", "lint", "from", "prospector", ".", "message", "import", "Message", ",", "Location", "return_dict"...
Run polysquare-generic-file-linter on matched_filenames.
[ "Run", "polysquare", "-", "generic", "-", "file", "-", "linter", "on", "matched_filenames", "." ]
5df5a6401c7ad6a90b42230eeb99c82cc56952b6
https://github.com/polysquare/polysquare-setuptools-lint/blob/5df5a6401c7ad6a90b42230eeb99c82cc56952b6/polysquare_setuptools_lint/__init__.py#L322-L355
248,039
polysquare/polysquare-setuptools-lint
polysquare_setuptools_lint/__init__.py
_run_spellcheck_linter
def _run_spellcheck_linter(matched_filenames, cache_dir, show_lint_files): """Run spellcheck-linter on matched_filenames.""" from polysquarelinter import lint_spelling_only as lint from prospector.message import Message, Location for filename in matched_filenames: _debug_linter_status("spellche...
python
def _run_spellcheck_linter(matched_filenames, cache_dir, show_lint_files): """Run spellcheck-linter on matched_filenames.""" from polysquarelinter import lint_spelling_only as lint from prospector.message import Message, Location for filename in matched_filenames: _debug_linter_status("spellche...
[ "def", "_run_spellcheck_linter", "(", "matched_filenames", ",", "cache_dir", ",", "show_lint_files", ")", ":", "from", "polysquarelinter", "import", "lint_spelling_only", "as", "lint", "from", "prospector", ".", "message", "import", "Message", ",", "Location", "for", ...
Run spellcheck-linter on matched_filenames.
[ "Run", "spellcheck", "-", "linter", "on", "matched_filenames", "." ]
5df5a6401c7ad6a90b42230eeb99c82cc56952b6
https://github.com/polysquare/polysquare-setuptools-lint/blob/5df5a6401c7ad6a90b42230eeb99c82cc56952b6/polysquare_setuptools_lint/__init__.py#L358-L389
248,040
polysquare/polysquare-setuptools-lint
polysquare_setuptools_lint/__init__.py
_run_markdownlint
def _run_markdownlint(matched_filenames, show_lint_files): """Run markdownlint on matched_filenames.""" from prospector.message import Message, Location for filename in matched_filenames: _debug_linter_status("mdl", filename, show_lint_files) try: proc = subprocess.Popen(["mdl"] + matc...
python
def _run_markdownlint(matched_filenames, show_lint_files): """Run markdownlint on matched_filenames.""" from prospector.message import Message, Location for filename in matched_filenames: _debug_linter_status("mdl", filename, show_lint_files) try: proc = subprocess.Popen(["mdl"] + matc...
[ "def", "_run_markdownlint", "(", "matched_filenames", ",", "show_lint_files", ")", ":", "from", "prospector", ".", "message", "import", "Message", ",", "Location", "for", "filename", "in", "matched_filenames", ":", "_debug_linter_status", "(", "\"mdl\"", ",", "filen...
Run markdownlint on matched_filenames.
[ "Run", "markdownlint", "on", "matched_filenames", "." ]
5df5a6401c7ad6a90b42230eeb99c82cc56952b6
https://github.com/polysquare/polysquare-setuptools-lint/blob/5df5a6401c7ad6a90b42230eeb99c82cc56952b6/polysquare_setuptools_lint/__init__.py#L392-L418
248,041
polysquare/polysquare-setuptools-lint
polysquare_setuptools_lint/__init__.py
_get_cache_dir
def _get_cache_dir(candidate): """Get the current cache directory.""" if candidate: return candidate import distutils.dist # suppress(import-error) import distutils.command.build # suppress(import-error) build_cmd = distutils.command.build.build(distutils.dist.Distribution()) build_cm...
python
def _get_cache_dir(candidate): """Get the current cache directory.""" if candidate: return candidate import distutils.dist # suppress(import-error) import distutils.command.build # suppress(import-error) build_cmd = distutils.command.build.build(distutils.dist.Distribution()) build_cm...
[ "def", "_get_cache_dir", "(", "candidate", ")", ":", "if", "candidate", ":", "return", "candidate", "import", "distutils", ".", "dist", "# suppress(import-error)", "import", "distutils", ".", "command", ".", "build", "# suppress(import-error)", "build_cmd", "=", "di...
Get the current cache directory.
[ "Get", "the", "current", "cache", "directory", "." ]
5df5a6401c7ad6a90b42230eeb99c82cc56952b6
https://github.com/polysquare/polysquare-setuptools-lint/blob/5df5a6401c7ad6a90b42230eeb99c82cc56952b6/polysquare_setuptools_lint/__init__.py#L426-L444
248,042
polysquare/polysquare-setuptools-lint
polysquare_setuptools_lint/__init__.py
_is_excluded
def _is_excluded(filename, exclusions): """Return true if filename matches any of exclusions.""" for exclusion in exclusions: if fnmatch(filename, exclusion): return True return False
python
def _is_excluded(filename, exclusions): """Return true if filename matches any of exclusions.""" for exclusion in exclusions: if fnmatch(filename, exclusion): return True return False
[ "def", "_is_excluded", "(", "filename", ",", "exclusions", ")", ":", "for", "exclusion", "in", "exclusions", ":", "if", "fnmatch", "(", "filename", ",", "exclusion", ")", ":", "return", "True", "return", "False" ]
Return true if filename matches any of exclusions.
[ "Return", "true", "if", "filename", "matches", "any", "of", "exclusions", "." ]
5df5a6401c7ad6a90b42230eeb99c82cc56952b6
https://github.com/polysquare/polysquare-setuptools-lint/blob/5df5a6401c7ad6a90b42230eeb99c82cc56952b6/polysquare_setuptools_lint/__init__.py#L457-L463
248,043
polysquare/polysquare-setuptools-lint
polysquare_setuptools_lint/__init__.py
PolysquareLintCommand._file_lines
def _file_lines(self, filename): """Get lines for filename, caching opened files.""" try: return self._file_lines_cache[filename] except KeyError: if os.path.isfile(filename): with open(filename) as python_file: self._file_lines_cache[f...
python
def _file_lines(self, filename): """Get lines for filename, caching opened files.""" try: return self._file_lines_cache[filename] except KeyError: if os.path.isfile(filename): with open(filename) as python_file: self._file_lines_cache[f...
[ "def", "_file_lines", "(", "self", ",", "filename", ")", ":", "try", ":", "return", "self", ".", "_file_lines_cache", "[", "filename", "]", "except", "KeyError", ":", "if", "os", ".", "path", ".", "isfile", "(", "filename", ")", ":", "with", "open", "(...
Get lines for filename, caching opened files.
[ "Get", "lines", "for", "filename", "caching", "opened", "files", "." ]
5df5a6401c7ad6a90b42230eeb99c82cc56952b6
https://github.com/polysquare/polysquare-setuptools-lint/blob/5df5a6401c7ad6a90b42230eeb99c82cc56952b6/polysquare_setuptools_lint/__init__.py#L479-L490
248,044
polysquare/polysquare-setuptools-lint
polysquare_setuptools_lint/__init__.py
PolysquareLintCommand._suppressed
def _suppressed(self, filename, line, code): """Return true if linter error code is suppressed inline. The suppression format is suppress(CODE1,CODE2,CODE3) etc. """ if code in self.suppress_codes: return True lines = self._file_lines(filename) # File is ze...
python
def _suppressed(self, filename, line, code): """Return true if linter error code is suppressed inline. The suppression format is suppress(CODE1,CODE2,CODE3) etc. """ if code in self.suppress_codes: return True lines = self._file_lines(filename) # File is ze...
[ "def", "_suppressed", "(", "self", ",", "filename", ",", "line", ",", "code", ")", ":", "if", "code", "in", "self", ".", "suppress_codes", ":", "return", "True", "lines", "=", "self", ".", "_file_lines", "(", "filename", ")", "# File is zero length, cannot b...
Return true if linter error code is suppressed inline. The suppression format is suppress(CODE1,CODE2,CODE3) etc.
[ "Return", "true", "if", "linter", "error", "code", "is", "suppressed", "inline", "." ]
5df5a6401c7ad6a90b42230eeb99c82cc56952b6
https://github.com/polysquare/polysquare-setuptools-lint/blob/5df5a6401c7ad6a90b42230eeb99c82cc56952b6/polysquare_setuptools_lint/__init__.py#L492-L522
248,045
polysquare/polysquare-setuptools-lint
polysquare_setuptools_lint/__init__.py
PolysquareLintCommand._get_md_files
def _get_md_files(self): """Get all markdown files.""" all_f = _all_files_matching_ext(os.getcwd(), "md") exclusions = [ "*.egg/*", "*.eggs/*", "*build/*" ] + self.exclusions return sorted([f for f in all_f if not _is_excluded(f, exclusions)])
python
def _get_md_files(self): """Get all markdown files.""" all_f = _all_files_matching_ext(os.getcwd(), "md") exclusions = [ "*.egg/*", "*.eggs/*", "*build/*" ] + self.exclusions return sorted([f for f in all_f if not _is_excluded(f, exclusions)])
[ "def", "_get_md_files", "(", "self", ")", ":", "all_f", "=", "_all_files_matching_ext", "(", "os", ".", "getcwd", "(", ")", ",", "\"md\"", ")", "exclusions", "=", "[", "\"*.egg/*\"", ",", "\"*.eggs/*\"", ",", "\"*build/*\"", "]", "+", "self", ".", "exclusi...
Get all markdown files.
[ "Get", "all", "markdown", "files", "." ]
5df5a6401c7ad6a90b42230eeb99c82cc56952b6
https://github.com/polysquare/polysquare-setuptools-lint/blob/5df5a6401c7ad6a90b42230eeb99c82cc56952b6/polysquare_setuptools_lint/__init__.py#L524-L532
248,046
polysquare/polysquare-setuptools-lint
polysquare_setuptools_lint/__init__.py
PolysquareLintCommand._get_files_to_lint
def _get_files_to_lint(self, external_directories): """Get files to lint.""" all_f = [] for external_dir in external_directories: all_f.extend(_all_files_matching_ext(external_dir, "py")) packages = self.distribution.packages or list() for package in packages: ...
python
def _get_files_to_lint(self, external_directories): """Get files to lint.""" all_f = [] for external_dir in external_directories: all_f.extend(_all_files_matching_ext(external_dir, "py")) packages = self.distribution.packages or list() for package in packages: ...
[ "def", "_get_files_to_lint", "(", "self", ",", "external_directories", ")", ":", "all_f", "=", "[", "]", "for", "external_dir", "in", "external_directories", ":", "all_f", ".", "extend", "(", "_all_files_matching_ext", "(", "external_dir", ",", "\"py\"", ")", ")...
Get files to lint.
[ "Get", "files", "to", "lint", "." ]
5df5a6401c7ad6a90b42230eeb99c82cc56952b6
https://github.com/polysquare/polysquare-setuptools-lint/blob/5df5a6401c7ad6a90b42230eeb99c82cc56952b6/polysquare_setuptools_lint/__init__.py#L534-L559
248,047
polysquare/polysquare-setuptools-lint
polysquare_setuptools_lint/__init__.py
PolysquareLintCommand.initialize_options
def initialize_options(self): # suppress(unused-function) """Set all options to their initial values.""" self._file_lines_cache = dict() self.suppress_codes = list() self.exclusions = list() self.cache_directory = "" self.stamp_directory = "" self.disable_linters...
python
def initialize_options(self): # suppress(unused-function) """Set all options to their initial values.""" self._file_lines_cache = dict() self.suppress_codes = list() self.exclusions = list() self.cache_directory = "" self.stamp_directory = "" self.disable_linters...
[ "def", "initialize_options", "(", "self", ")", ":", "# suppress(unused-function)", "self", ".", "_file_lines_cache", "=", "dict", "(", ")", "self", ".", "suppress_codes", "=", "list", "(", ")", "self", ".", "exclusions", "=", "list", "(", ")", "self", ".", ...
Set all options to their initial values.
[ "Set", "all", "options", "to", "their", "initial", "values", "." ]
5df5a6401c7ad6a90b42230eeb99c82cc56952b6
https://github.com/polysquare/polysquare-setuptools-lint/blob/5df5a6401c7ad6a90b42230eeb99c82cc56952b6/polysquare_setuptools_lint/__init__.py#L687-L695
248,048
tsileo/globster
globster.py
normalize_pattern
def normalize_pattern(pattern): """Converts backslashes in path patterns to forward slashes. Doesn't normalize regular expressions - they may contain escapes. """ if not (pattern.startswith('RE:') or pattern.startswith('!RE:')): pattern = _slashes.sub('/', pattern) if len(pattern) > 1: ...
python
def normalize_pattern(pattern): """Converts backslashes in path patterns to forward slashes. Doesn't normalize regular expressions - they may contain escapes. """ if not (pattern.startswith('RE:') or pattern.startswith('!RE:')): pattern = _slashes.sub('/', pattern) if len(pattern) > 1: ...
[ "def", "normalize_pattern", "(", "pattern", ")", ":", "if", "not", "(", "pattern", ".", "startswith", "(", "'RE:'", ")", "or", "pattern", ".", "startswith", "(", "'!RE:'", ")", ")", ":", "pattern", "=", "_slashes", ".", "sub", "(", "'/'", ",", "pattern...
Converts backslashes in path patterns to forward slashes. Doesn't normalize regular expressions - they may contain escapes.
[ "Converts", "backslashes", "in", "path", "patterns", "to", "forward", "slashes", "." ]
9628bce60207b150d39b409cddc3fadb34e70841
https://github.com/tsileo/globster/blob/9628bce60207b150d39b409cddc3fadb34e70841/globster.py#L366-L375
248,049
tsileo/globster
globster.py
Replacer.add
def add(self, pat, fun): r"""Add a pattern and replacement. The pattern must not contain capturing groups. The replacement might be either a string template in which \& will be replaced with the match, or a function that will get the matching text as argument. It does not get ma...
python
def add(self, pat, fun): r"""Add a pattern and replacement. The pattern must not contain capturing groups. The replacement might be either a string template in which \& will be replaced with the match, or a function that will get the matching text as argument. It does not get ma...
[ "def", "add", "(", "self", ",", "pat", ",", "fun", ")", ":", "self", ".", "_pat", "=", "None", "self", ".", "_pats", ".", "append", "(", "pat", ")", "self", ".", "_funs", ".", "append", "(", "fun", ")" ]
r"""Add a pattern and replacement. The pattern must not contain capturing groups. The replacement might be either a string template in which \& will be replaced with the match, or a function that will get the matching text as argument. It does not get match object, because capturing is ...
[ "r", "Add", "a", "pattern", "and", "replacement", "." ]
9628bce60207b150d39b409cddc3fadb34e70841
https://github.com/tsileo/globster/blob/9628bce60207b150d39b409cddc3fadb34e70841/globster.py#L60-L71
248,050
tsileo/globster
globster.py
Replacer.add_replacer
def add_replacer(self, replacer): r"""Add all patterns from another replacer. All patterns and replacements from replacer are appended to the ones already defined. """ self._pat = None self._pats.extend(replacer._pats) self._funs.extend(replacer._funs)
python
def add_replacer(self, replacer): r"""Add all patterns from another replacer. All patterns and replacements from replacer are appended to the ones already defined. """ self._pat = None self._pats.extend(replacer._pats) self._funs.extend(replacer._funs)
[ "def", "add_replacer", "(", "self", ",", "replacer", ")", ":", "self", ".", "_pat", "=", "None", "self", ".", "_pats", ".", "extend", "(", "replacer", ".", "_pats", ")", "self", ".", "_funs", ".", "extend", "(", "replacer", ".", "_funs", ")" ]
r"""Add all patterns from another replacer. All patterns and replacements from replacer are appended to the ones already defined.
[ "r", "Add", "all", "patterns", "from", "another", "replacer", "." ]
9628bce60207b150d39b409cddc3fadb34e70841
https://github.com/tsileo/globster/blob/9628bce60207b150d39b409cddc3fadb34e70841/globster.py#L73-L81
248,051
tsileo/globster
globster.py
Globster.is_pattern_valid
def is_pattern_valid(pattern): """Returns True if pattern is valid. :param pattern: Normalized pattern. is_pattern_valid() assumes pattern to be normalized. see: globbing.normalize_pattern """ result = True translator = Globster.pattern_info[Globster.identify(pat...
python
def is_pattern_valid(pattern): """Returns True if pattern is valid. :param pattern: Normalized pattern. is_pattern_valid() assumes pattern to be normalized. see: globbing.normalize_pattern """ result = True translator = Globster.pattern_info[Globster.identify(pat...
[ "def", "is_pattern_valid", "(", "pattern", ")", ":", "result", "=", "True", "translator", "=", "Globster", ".", "pattern_info", "[", "Globster", ".", "identify", "(", "pattern", ")", "]", "[", "\"translator\"", "]", "tpattern", "=", "'(%s)'", "%", "translato...
Returns True if pattern is valid. :param pattern: Normalized pattern. is_pattern_valid() assumes pattern to be normalized. see: globbing.normalize_pattern
[ "Returns", "True", "if", "pattern", "is", "valid", "." ]
9628bce60207b150d39b409cddc3fadb34e70841
https://github.com/tsileo/globster/blob/9628bce60207b150d39b409cddc3fadb34e70841/globster.py#L292-L307
248,052
cbrand/vpnchooser
src/vpnchooser/resources/device.py
DeviceResource.put
def put(self, device_id: int) -> Device: """ Updates the Device Resource with the name. """ device = self._get_or_abort(device_id) self.update(device) session.commit() session.add(device) return device
python
def put(self, device_id: int) -> Device: """ Updates the Device Resource with the name. """ device = self._get_or_abort(device_id) self.update(device) session.commit() session.add(device) return device
[ "def", "put", "(", "self", ",", "device_id", ":", "int", ")", "->", "Device", ":", "device", "=", "self", ".", "_get_or_abort", "(", "device_id", ")", "self", ".", "update", "(", "device", ")", "session", ".", "commit", "(", ")", "session", ".", "add...
Updates the Device Resource with the name.
[ "Updates", "the", "Device", "Resource", "with", "the", "name", "." ]
d153e3d05555c23cf5e8e15e507eecad86465923
https://github.com/cbrand/vpnchooser/blob/d153e3d05555c23cf5e8e15e507eecad86465923/src/vpnchooser/resources/device.py#L114-L123
248,053
idlesign/django-xross
xross/utils.py
xross_listener
def xross_listener(http_method=None, **xross_attrs): """Instructs xross to handle AJAX calls right from the moment it is called. This should be placed in a view decorated with `@xross_view()`. :param str http_method: GET or POST. To be used as a source of data for xross. :param dict xross_attrs: xros...
python
def xross_listener(http_method=None, **xross_attrs): """Instructs xross to handle AJAX calls right from the moment it is called. This should be placed in a view decorated with `@xross_view()`. :param str http_method: GET or POST. To be used as a source of data for xross. :param dict xross_attrs: xros...
[ "def", "xross_listener", "(", "http_method", "=", "None", ",", "*", "*", "xross_attrs", ")", ":", "handler", "=", "currentframe", "(", ")", ".", "f_back", ".", "f_locals", "[", "'request'", "]", ".", "_xross_handler", "handler", ".", "set_attrs", "(", "*",...
Instructs xross to handle AJAX calls right from the moment it is called. This should be placed in a view decorated with `@xross_view()`. :param str http_method: GET or POST. To be used as a source of data for xross. :param dict xross_attrs: xross handler attributes. Those attributes will be avail...
[ "Instructs", "xross", "to", "handle", "AJAX", "calls", "right", "from", "the", "moment", "it", "is", "called", "." ]
414edbab2069c4ba77773d0ef3c8fc830b336efa
https://github.com/idlesign/django-xross/blob/414edbab2069c4ba77773d0ef3c8fc830b336efa/xross/utils.py#L30-L45
248,054
idlesign/django-xross
xross/utils.py
xross_view
def xross_view(*op_functions): """This decorator should be used to decorate application views that require xross functionality. :param list op_functions: operations (functions, methods) responsible for handling xross requests. Function names considered to be operations names. Using them clients will a...
python
def xross_view(*op_functions): """This decorator should be used to decorate application views that require xross functionality. :param list op_functions: operations (functions, methods) responsible for handling xross requests. Function names considered to be operations names. Using them clients will a...
[ "def", "xross_view", "(", "*", "op_functions", ")", ":", "operations_dict", "=", "construct_operations_dict", "(", "*", "op_functions", ")", "def", "get_request", "(", "src", ")", ":", "return", "src", "if", "isinstance", "(", "src", ",", "HttpRequest", ")", ...
This decorator should be used to decorate application views that require xross functionality. :param list op_functions: operations (functions, methods) responsible for handling xross requests. Function names considered to be operations names. Using them clients will address those functions (e.g. x...
[ "This", "decorator", "should", "be", "used", "to", "decorate", "application", "views", "that", "require", "xross", "functionality", "." ]
414edbab2069c4ba77773d0ef3c8fc830b336efa
https://github.com/idlesign/django-xross/blob/414edbab2069c4ba77773d0ef3c8fc830b336efa/xross/utils.py#L48-L123
248,055
ikanor/intercept
intercept/intercept.py
intercept
def intercept(actions: dict={}): """ Decorates a function and handles any exceptions that may rise. Args: actions: A dictionary ``<exception type>: <action>``. Available actions\ are :class:`raises` and :class:`returns`. Returns: Any value declared using a :class:`returns` ...
python
def intercept(actions: dict={}): """ Decorates a function and handles any exceptions that may rise. Args: actions: A dictionary ``<exception type>: <action>``. Available actions\ are :class:`raises` and :class:`returns`. Returns: Any value declared using a :class:`returns` ...
[ "def", "intercept", "(", "actions", ":", "dict", "=", "{", "}", ")", ":", "for", "action", "in", "actions", ".", "values", "(", ")", ":", "if", "type", "(", "action", ")", "is", "not", "returns", "and", "type", "(", "action", ")", "is", "not", "r...
Decorates a function and handles any exceptions that may rise. Args: actions: A dictionary ``<exception type>: <action>``. Available actions\ are :class:`raises` and :class:`returns`. Returns: Any value declared using a :class:`returns` action. Raises: AnyException: if...
[ "Decorates", "a", "function", "and", "handles", "any", "exceptions", "that", "may", "rise", "." ]
7aea4eed4f0942f2f781c560d4fdafd10fbbcc2d
https://github.com/ikanor/intercept/blob/7aea4eed4f0942f2f781c560d4fdafd10fbbcc2d/intercept/intercept.py#L7-L102
248,056
jirutka/sublimedsl
sublimedsl/keymap.py
Keymap.extend
def extend(self, *bindings): """ Append the given bindings to this keymap. Arguments: *bindings (Binding): Bindings to be added. Returns: Keymap: self """ self._bindings.extend(self._preprocess(bindings)) return self
python
def extend(self, *bindings): """ Append the given bindings to this keymap. Arguments: *bindings (Binding): Bindings to be added. Returns: Keymap: self """ self._bindings.extend(self._preprocess(bindings)) return self
[ "def", "extend", "(", "self", ",", "*", "bindings", ")", ":", "self", ".", "_bindings", ".", "extend", "(", "self", ".", "_preprocess", "(", "bindings", ")", ")", "return", "self" ]
Append the given bindings to this keymap. Arguments: *bindings (Binding): Bindings to be added. Returns: Keymap: self
[ "Append", "the", "given", "bindings", "to", "this", "keymap", "." ]
ca9fc79ab06e6efd79a6d5b37cb716688d4affc2
https://github.com/jirutka/sublimedsl/blob/ca9fc79ab06e6efd79a6d5b37cb716688d4affc2/sublimedsl/keymap.py#L108-L117
248,057
jirutka/sublimedsl
sublimedsl/keymap.py
Binding.when
def when(self, key): """ Specify context, i.e. condition that must be met. Arguments: key (str): Name of the context whose value you want to query. Returns: Context: """ ctx = Context(key, self) self.context.append(ctx) return ctx
python
def when(self, key): """ Specify context, i.e. condition that must be met. Arguments: key (str): Name of the context whose value you want to query. Returns: Context: """ ctx = Context(key, self) self.context.append(ctx) return ctx
[ "def", "when", "(", "self", ",", "key", ")", ":", "ctx", "=", "Context", "(", "key", ",", "self", ")", "self", ".", "context", ".", "append", "(", "ctx", ")", "return", "ctx" ]
Specify context, i.e. condition that must be met. Arguments: key (str): Name of the context whose value you want to query. Returns: Context:
[ "Specify", "context", "i", ".", "e", ".", "condition", "that", "must", "be", "met", "." ]
ca9fc79ab06e6efd79a6d5b37cb716688d4affc2
https://github.com/jirutka/sublimedsl/blob/ca9fc79ab06e6efd79a6d5b37cb716688d4affc2/sublimedsl/keymap.py#L184-L194
248,058
wlwang41/cb
cb/commands.py
Command._split_source_page
def _split_source_page(self, path): """Split the source file texts by triple-dashed lines. shit code """ with codecs.open(path, "rb", "utf-8") as fd: textlist = fd.readlines() metadata_notation = "---\n" if textlist[0] != metadata_notation: loggi...
python
def _split_source_page(self, path): """Split the source file texts by triple-dashed lines. shit code """ with codecs.open(path, "rb", "utf-8") as fd: textlist = fd.readlines() metadata_notation = "---\n" if textlist[0] != metadata_notation: loggi...
[ "def", "_split_source_page", "(", "self", ",", "path", ")", ":", "with", "codecs", ".", "open", "(", "path", ",", "\"rb\"", ",", "\"utf-8\"", ")", "as", "fd", ":", "textlist", "=", "fd", ".", "readlines", "(", ")", "metadata_notation", "=", "\"---\\n\"",...
Split the source file texts by triple-dashed lines. shit code
[ "Split", "the", "source", "file", "texts", "by", "triple", "-", "dashed", "lines", "." ]
0a7faa427e3e6593980687dfe1a882ac99d743f6
https://github.com/wlwang41/cb/blob/0a7faa427e3e6593980687dfe1a882ac99d743f6/cb/commands.py#L89-L121
248,059
wlwang41/cb
cb/commands.py
Command._get_feed_data
def _get_feed_data(self, file_paths): """ get data to display in feed file """ rv = {} for i in file_paths: # TODO(crow): only support first category _ = i.split('/') category = _[-2] name = _[-1].split('.')[0] page_config, md =...
python
def _get_feed_data(self, file_paths): """ get data to display in feed file """ rv = {} for i in file_paths: # TODO(crow): only support first category _ = i.split('/') category = _[-2] name = _[-1].split('.')[0] page_config, md =...
[ "def", "_get_feed_data", "(", "self", ",", "file_paths", ")", ":", "rv", "=", "{", "}", "for", "i", "in", "file_paths", ":", "# TODO(crow): only support first category", "_", "=", "i", ".", "split", "(", "'/'", ")", "category", "=", "_", "[", "-", "2", ...
get data to display in feed file
[ "get", "data", "to", "display", "in", "feed", "file" ]
0a7faa427e3e6593980687dfe1a882ac99d743f6
https://github.com/wlwang41/cb/blob/0a7faa427e3e6593980687dfe1a882ac99d743f6/cb/commands.py#L206-L228
248,060
wlwang41/cb
cb/commands.py
Command._generate_feed
def _generate_feed(self, feed_data): """ render feed file with data """ atom_feed = self._render_html('atom.xml', feed_data) feed_path = os.path.join(os.getcwd(), 'public', 'atom.xml') with codecs.open(feed_path, 'wb', 'utf-8') as f: f.write(atom_feed)
python
def _generate_feed(self, feed_data): """ render feed file with data """ atom_feed = self._render_html('atom.xml', feed_data) feed_path = os.path.join(os.getcwd(), 'public', 'atom.xml') with codecs.open(feed_path, 'wb', 'utf-8') as f: f.write(atom_feed)
[ "def", "_generate_feed", "(", "self", ",", "feed_data", ")", ":", "atom_feed", "=", "self", ".", "_render_html", "(", "'atom.xml'", ",", "feed_data", ")", "feed_path", "=", "os", ".", "path", ".", "join", "(", "os", ".", "getcwd", "(", ")", ",", "'publ...
render feed file with data
[ "render", "feed", "file", "with", "data" ]
0a7faa427e3e6593980687dfe1a882ac99d743f6
https://github.com/wlwang41/cb/blob/0a7faa427e3e6593980687dfe1a882ac99d743f6/cb/commands.py#L230-L238
248,061
treycucco/bidon
bidon/util/date.py
_normalize_tz
def _normalize_tz(val): """Normalizes all valid ISO8601 time zone variants to the one python will parse. :val: a timestamp string without a timezone, or with a timezone in one of the ISO8601 accepted formats. """ match = _TZ_RE.match(val) if match: ts, tz = match.groups() if len(tz) == 5: ...
python
def _normalize_tz(val): """Normalizes all valid ISO8601 time zone variants to the one python will parse. :val: a timestamp string without a timezone, or with a timezone in one of the ISO8601 accepted formats. """ match = _TZ_RE.match(val) if match: ts, tz = match.groups() if len(tz) == 5: ...
[ "def", "_normalize_tz", "(", "val", ")", ":", "match", "=", "_TZ_RE", ".", "match", "(", "val", ")", "if", "match", ":", "ts", ",", "tz", "=", "match", ".", "groups", "(", ")", "if", "len", "(", "tz", ")", "==", "5", ":", "# If the length of the tz...
Normalizes all valid ISO8601 time zone variants to the one python will parse. :val: a timestamp string without a timezone, or with a timezone in one of the ISO8601 accepted formats.
[ "Normalizes", "all", "valid", "ISO8601", "time", "zone", "variants", "to", "the", "one", "python", "will", "parse", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/util/date.py#L81-L106
248,062
eallik/spinoff
spinoff/remoting/mock.py
MockNetwork.node
def node(self, nodeid): """Creates a new node with the specified name, with `MockSocket` instances as incoming and outgoing sockets. Returns the implementation object created for the node from the cls, args and address specified, and the sockets. `cls` must be a callable that takes the insock a...
python
def node(self, nodeid): """Creates a new node with the specified name, with `MockSocket` instances as incoming and outgoing sockets. Returns the implementation object created for the node from the cls, args and address specified, and the sockets. `cls` must be a callable that takes the insock a...
[ "def", "node", "(", "self", ",", "nodeid", ")", ":", "_assert_valid_nodeid", "(", "nodeid", ")", "# addr = 'tcp://' + nodeid", "# insock = MockInSocket(addEndpoints=lambda endpoints: self.bind(addr, insock, endpoints))", "# outsock = lambda: MockOutSocket(addr, self)", "return", "Nod...
Creates a new node with the specified name, with `MockSocket` instances as incoming and outgoing sockets. Returns the implementation object created for the node from the cls, args and address specified, and the sockets. `cls` must be a callable that takes the insock and outsock, and the specified args ...
[ "Creates", "a", "new", "node", "with", "the", "specified", "name", "with", "MockSocket", "instances", "as", "incoming", "and", "outgoing", "sockets", "." ]
06b00d6b86c7422c9cb8f9a4b2915906e92b7d52
https://github.com/eallik/spinoff/blob/06b00d6b86c7422c9cb8f9a4b2915906e92b7d52/spinoff/remoting/mock.py#L33-L45
248,063
calvinku96/labreporthelper
labreporthelper/plot.py
PlotSingle2D.do_label
def do_label(self): """ Create label for x and y axis, title and suptitle """ outputdict = self.outputdict xlabel_options = self.kwargs.get("xlabel_options", {}) self.subplot.set_xlabel( self.kwargs.get("xlabel", "").format(**outputdict), **xlabel_...
python
def do_label(self): """ Create label for x and y axis, title and suptitle """ outputdict = self.outputdict xlabel_options = self.kwargs.get("xlabel_options", {}) self.subplot.set_xlabel( self.kwargs.get("xlabel", "").format(**outputdict), **xlabel_...
[ "def", "do_label", "(", "self", ")", ":", "outputdict", "=", "self", ".", "outputdict", "xlabel_options", "=", "self", ".", "kwargs", ".", "get", "(", "\"xlabel_options\"", ",", "{", "}", ")", "self", ".", "subplot", ".", "set_xlabel", "(", "self", ".", ...
Create label for x and y axis, title and suptitle
[ "Create", "label", "for", "x", "and", "y", "axis", "title", "and", "suptitle" ]
4d436241f389c02eb188c313190df62ab28c3763
https://github.com/calvinku96/labreporthelper/blob/4d436241f389c02eb188c313190df62ab28c3763/labreporthelper/plot.py#L148-L186
248,064
questrail/arghelper
arghelper.py
extant_item
def extant_item(arg, arg_type): """Determine if parser argument is an existing file or directory. This technique comes from http://stackoverflow.com/a/11541450/95592 and from http://stackoverflow.com/a/11541495/95592 Args: arg: parser argument containing filename to be checked arg_type...
python
def extant_item(arg, arg_type): """Determine if parser argument is an existing file or directory. This technique comes from http://stackoverflow.com/a/11541450/95592 and from http://stackoverflow.com/a/11541495/95592 Args: arg: parser argument containing filename to be checked arg_type...
[ "def", "extant_item", "(", "arg", ",", "arg_type", ")", ":", "if", "arg_type", "==", "\"file\"", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "arg", ")", ":", "raise", "argparse", ".", "ArgumentError", "(", "None", ",", "\"The file {arg} does...
Determine if parser argument is an existing file or directory. This technique comes from http://stackoverflow.com/a/11541450/95592 and from http://stackoverflow.com/a/11541495/95592 Args: arg: parser argument containing filename to be checked arg_type: string of either "file" or "directory...
[ "Determine", "if", "parser", "argument", "is", "an", "existing", "file", "or", "directory", "." ]
833d7d25a1f3daba70f186057d3d39a040c56200
https://github.com/questrail/arghelper/blob/833d7d25a1f3daba70f186057d3d39a040c56200/arghelper.py#L35-L66
248,065
questrail/arghelper
arghelper.py
parse_config_input_output
def parse_config_input_output(args=sys.argv): """Parse the args using the config_file, input_dir, output_dir pattern Args: args: sys.argv Returns: The populated namespace object from parser.parse_args(). Raises: TBD """ parser = argparse.ArgumentParser( descrip...
python
def parse_config_input_output(args=sys.argv): """Parse the args using the config_file, input_dir, output_dir pattern Args: args: sys.argv Returns: The populated namespace object from parser.parse_args(). Raises: TBD """ parser = argparse.ArgumentParser( descrip...
[ "def", "parse_config_input_output", "(", "args", "=", "sys", ".", "argv", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Process the input files using the given config'", ")", "parser", ".", "add_argument", "(", "'config_file'",...
Parse the args using the config_file, input_dir, output_dir pattern Args: args: sys.argv Returns: The populated namespace object from parser.parse_args(). Raises: TBD
[ "Parse", "the", "args", "using", "the", "config_file", "input_dir", "output_dir", "pattern" ]
833d7d25a1f3daba70f186057d3d39a040c56200
https://github.com/questrail/arghelper/blob/833d7d25a1f3daba70f186057d3d39a040c56200/arghelper.py#L69-L95
248,066
questrail/arghelper
arghelper.py
parse_config
def parse_config(args=sys.argv): """Parse the args using the config_file pattern Args: args: sys.argv Returns: The populated namespace object from parser.parse_args(). Raises: TBD """ parser = argparse.ArgumentParser( description='Read in the config file') ...
python
def parse_config(args=sys.argv): """Parse the args using the config_file pattern Args: args: sys.argv Returns: The populated namespace object from parser.parse_args(). Raises: TBD """ parser = argparse.ArgumentParser( description='Read in the config file') ...
[ "def", "parse_config", "(", "args", "=", "sys", ".", "argv", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Read in the config file'", ")", "parser", ".", "add_argument", "(", "'config_file'", ",", "help", "=", "'Configu...
Parse the args using the config_file pattern Args: args: sys.argv Returns: The populated namespace object from parser.parse_args(). Raises: TBD
[ "Parse", "the", "args", "using", "the", "config_file", "pattern" ]
833d7d25a1f3daba70f186057d3d39a040c56200
https://github.com/questrail/arghelper/blob/833d7d25a1f3daba70f186057d3d39a040c56200/arghelper.py#L98-L116
248,067
davisd50/sparc.cache
sparc/cache/sql/sql.py
SqlObjectCacheArea.cache
def cache(self, CachableItem): """Updates cache area with latest information """ _cachedItem = self.get(CachableItem) if not _cachedItem: _dirtyCachedItem = self.mapper.get(CachableItem) logger.debug("new cachable item added to sql cache area {id: %s, type: %s}", ...
python
def cache(self, CachableItem): """Updates cache area with latest information """ _cachedItem = self.get(CachableItem) if not _cachedItem: _dirtyCachedItem = self.mapper.get(CachableItem) logger.debug("new cachable item added to sql cache area {id: %s, type: %s}", ...
[ "def", "cache", "(", "self", ",", "CachableItem", ")", ":", "_cachedItem", "=", "self", ".", "get", "(", "CachableItem", ")", "if", "not", "_cachedItem", ":", "_dirtyCachedItem", "=", "self", ".", "mapper", ".", "get", "(", "CachableItem", ")", "logger", ...
Updates cache area with latest information
[ "Updates", "cache", "area", "with", "latest", "information" ]
f2378aad48c368a53820e97b093ace790d4d4121
https://github.com/davisd50/sparc.cache/blob/f2378aad48c368a53820e97b093ace790d4d4121/sparc/cache/sql/sql.py#L153-L170
248,068
KnowledgeLinks/rdfframework
rdfframework/datatypes/namespaces.py
format_json
def format_json(item, **kwargs): """ formats a datatype object to a json value """ try: json.dumps(item.value) return item.value except TypeError: if 'time' in item.class_type.lower() \ or 'date' in item.class_type.lower(): return item.value.isoformat() ...
python
def format_json(item, **kwargs): """ formats a datatype object to a json value """ try: json.dumps(item.value) return item.value except TypeError: if 'time' in item.class_type.lower() \ or 'date' in item.class_type.lower(): return item.value.isoformat() ...
[ "def", "format_json", "(", "item", ",", "*", "*", "kwargs", ")", ":", "try", ":", "json", ".", "dumps", "(", "item", ".", "value", ")", "return", "item", ".", "value", "except", "TypeError", ":", "if", "'time'", "in", "item", ".", "class_type", ".", ...
formats a datatype object to a json value
[ "formats", "a", "datatype", "object", "to", "a", "json", "value" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datatypes/namespaces.py#L31-L40
248,069
KnowledgeLinks/rdfframework
rdfframework/datatypes/namespaces.py
format_sparql
def format_sparql(item, dt_format='turtle', **kwargs): """ Formats a datatype value to a SPARQL representation args: item: the datatype object dt_format: the return format ['turtle', 'uri'] """ try: rtn_val = json.dumps(item.value) rtn_val = item.value except: ...
python
def format_sparql(item, dt_format='turtle', **kwargs): """ Formats a datatype value to a SPARQL representation args: item: the datatype object dt_format: the return format ['turtle', 'uri'] """ try: rtn_val = json.dumps(item.value) rtn_val = item.value except: ...
[ "def", "format_sparql", "(", "item", ",", "dt_format", "=", "'turtle'", ",", "*", "*", "kwargs", ")", ":", "try", ":", "rtn_val", "=", "json", ".", "dumps", "(", "item", ".", "value", ")", "rtn_val", "=", "item", ".", "value", "except", ":", "if", ...
Formats a datatype value to a SPARQL representation args: item: the datatype object dt_format: the return format ['turtle', 'uri']
[ "Formats", "a", "datatype", "value", "to", "a", "SPARQL", "representation" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datatypes/namespaces.py#L42-L74
248,070
KnowledgeLinks/rdfframework
rdfframework/datatypes/namespaces.py
BaseRdfDataType._format
def _format(self, method="sparql", dt_format="turtle"): """ Rormats the value in various formats args: method: ['sparql', 'json', 'pyuri'] dt_format: ['turtle','uri'] used in conjuction with the 'sparql' method """ try: ...
python
def _format(self, method="sparql", dt_format="turtle"): """ Rormats the value in various formats args: method: ['sparql', 'json', 'pyuri'] dt_format: ['turtle','uri'] used in conjuction with the 'sparql' method """ try: ...
[ "def", "_format", "(", "self", ",", "method", "=", "\"sparql\"", ",", "dt_format", "=", "\"turtle\"", ")", ":", "try", ":", "return", "__FORMAT_OPTIONS__", "[", "method", "]", "(", "self", ",", "dt_format", "=", "dt_format", ")", "except", "KeyError", ":",...
Rormats the value in various formats args: method: ['sparql', 'json', 'pyuri'] dt_format: ['turtle','uri'] used in conjuction with the 'sparql' method
[ "Rormats", "the", "value", "in", "various", "formats" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datatypes/namespaces.py#L112-L127
248,071
KnowledgeLinks/rdfframework
rdfframework/datatypes/namespaces.py
RdfNsManager.bind
def bind(self, prefix, namespace, *args, **kwargs): """ Extends the function to add an attribute to the class for each added namespace to allow for use of dot notation. All prefixes are converted to lowercase Args: prefix: string of namespace name namespace: rdfl...
python
def bind(self, prefix, namespace, *args, **kwargs): """ Extends the function to add an attribute to the class for each added namespace to allow for use of dot notation. All prefixes are converted to lowercase Args: prefix: string of namespace name namespace: rdfl...
[ "def", "bind", "(", "self", ",", "prefix", ",", "namespace", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# RdfNamespace(prefix, namespace, **kwargs)", "setattr", "(", "self", ",", "prefix", ",", "RdfNamespace", "(", "prefix", ",", "namespace", ",",...
Extends the function to add an attribute to the class for each added namespace to allow for use of dot notation. All prefixes are converted to lowercase Args: prefix: string of namespace name namespace: rdflib.namespace instance kwargs: calc: whether...
[ "Extends", "the", "function", "to", "add", "an", "attribute", "to", "the", "class", "for", "each", "added", "namespace", "to", "allow", "for", "use", "of", "dot", "notation", ".", "All", "prefixes", "are", "converted", "to", "lowercase" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datatypes/namespaces.py#L459-L479
248,072
KnowledgeLinks/rdfframework
rdfframework/datatypes/namespaces.py
RdfNsManager.prefix
def prefix(self, format="sparql"): ''' Generates a string of the rdf namespaces listed used in the framework format: "sparql" or "turtle" ''' lg = logging.getLogger("%s.%s" % (self.ln, inspect.stack()[0][3])) lg.setLevel(self.log_level) _return_str = ""...
python
def prefix(self, format="sparql"): ''' Generates a string of the rdf namespaces listed used in the framework format: "sparql" or "turtle" ''' lg = logging.getLogger("%s.%s" % (self.ln, inspect.stack()[0][3])) lg.setLevel(self.log_level) _return_str = ""...
[ "def", "prefix", "(", "self", ",", "format", "=", "\"sparql\"", ")", ":", "lg", "=", "logging", ".", "getLogger", "(", "\"%s.%s\"", "%", "(", "self", ".", "ln", ",", "inspect", ".", "stack", "(", ")", "[", "0", "]", "[", "3", "]", ")", ")", "lg...
Generates a string of the rdf namespaces listed used in the framework format: "sparql" or "turtle"
[ "Generates", "a", "string", "of", "the", "rdf", "namespaces", "listed", "used", "in", "the", "framework" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datatypes/namespaces.py#L481-L501
248,073
KnowledgeLinks/rdfframework
rdfframework/datatypes/namespaces.py
RdfNsManager.load
def load(self, filepath, file_encoding=None): """ Reads the the beginning of a turtle file and sets the prefix's used in that file and sets the prefix attribute Args: filepath: the path to the turtle file file_encoding: specify a specific encoding if necessary ""...
python
def load(self, filepath, file_encoding=None): """ Reads the the beginning of a turtle file and sets the prefix's used in that file and sets the prefix attribute Args: filepath: the path to the turtle file file_encoding: specify a specific encoding if necessary ""...
[ "def", "load", "(", "self", ",", "filepath", ",", "file_encoding", "=", "None", ")", ":", "with", "open", "(", "filepath", ",", "encoding", "=", "file_encoding", ")", "as", "inf", ":", "for", "line", "in", "inf", ":", "current_line", "=", "str", "(", ...
Reads the the beginning of a turtle file and sets the prefix's used in that file and sets the prefix attribute Args: filepath: the path to the turtle file file_encoding: specify a specific encoding if necessary
[ "Reads", "the", "the", "beginning", "of", "a", "turtle", "file", "and", "sets", "the", "prefix", "s", "used", "in", "that", "file", "and", "sets", "the", "prefix", "attribute" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datatypes/namespaces.py#L503-L518
248,074
KnowledgeLinks/rdfframework
rdfframework/datatypes/namespaces.py
RdfNsManager.dict_load
def dict_load(self, ns_dict): """ Reads a dictionary of namespaces and binds them to the manager Args: ns_dict: dictionary with the key as the prefix and the value as the uri """ for prefix, uri in ns_dict.items(): self.bind(prefix, uri, over...
python
def dict_load(self, ns_dict): """ Reads a dictionary of namespaces and binds them to the manager Args: ns_dict: dictionary with the key as the prefix and the value as the uri """ for prefix, uri in ns_dict.items(): self.bind(prefix, uri, over...
[ "def", "dict_load", "(", "self", ",", "ns_dict", ")", ":", "for", "prefix", ",", "uri", "in", "ns_dict", ".", "items", "(", ")", ":", "self", ".", "bind", "(", "prefix", ",", "uri", ",", "override", "=", "False", ",", "calc", "=", "False", ")", "...
Reads a dictionary of namespaces and binds them to the manager Args: ns_dict: dictionary with the key as the prefix and the value as the uri
[ "Reads", "a", "dictionary", "of", "namespaces", "and", "binds", "them", "to", "the", "manager" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datatypes/namespaces.py#L524-L533
248,075
KnowledgeLinks/rdfframework
rdfframework/datatypes/namespaces.py
RdfNsManager._add_ttl_ns
def _add_ttl_ns(self, line): """ takes one prefix line from the turtle file and binds the namespace to the class Args: line: the turtle prefix line string """ lg = logging.getLogger("%s.%s" % (self.ln, inspect.stack()[0][3])) lg.setLevel(self.log_level) ...
python
def _add_ttl_ns(self, line): """ takes one prefix line from the turtle file and binds the namespace to the class Args: line: the turtle prefix line string """ lg = logging.getLogger("%s.%s" % (self.ln, inspect.stack()[0][3])) lg.setLevel(self.log_level) ...
[ "def", "_add_ttl_ns", "(", "self", ",", "line", ")", ":", "lg", "=", "logging", ".", "getLogger", "(", "\"%s.%s\"", "%", "(", "self", ".", "ln", ",", "inspect", ".", "stack", "(", ")", "[", "0", "]", "[", "3", "]", ")", ")", "lg", ".", "setLeve...
takes one prefix line from the turtle file and binds the namespace to the class Args: line: the turtle prefix line string
[ "takes", "one", "prefix", "line", "from", "the", "turtle", "file", "and", "binds", "the", "namespace", "to", "the", "class" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datatypes/namespaces.py#L535-L559
248,076
KnowledgeLinks/rdfframework
rdfframework/datatypes/namespaces.py
RdfNsManager.del_ns
def del_ns(self, namespace): """ will remove a namespace ref from the manager. either Arg is optional. args: namespace: prefix, string or Namespace() to remove """ # remove the item from the namespace dict namespace = str(namespace) attr_name = None ...
python
def del_ns(self, namespace): """ will remove a namespace ref from the manager. either Arg is optional. args: namespace: prefix, string or Namespace() to remove """ # remove the item from the namespace dict namespace = str(namespace) attr_name = None ...
[ "def", "del_ns", "(", "self", ",", "namespace", ")", ":", "# remove the item from the namespace dict", "namespace", "=", "str", "(", "namespace", ")", "attr_name", "=", "None", "if", "hasattr", "(", "self", ",", "namespace", ")", ":", "delattr", "(", "self", ...
will remove a namespace ref from the manager. either Arg is optional. args: namespace: prefix, string or Namespace() to remove
[ "will", "remove", "a", "namespace", "ref", "from", "the", "manager", ".", "either", "Arg", "is", "optional", "." ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datatypes/namespaces.py#L561-L572
248,077
KnowledgeLinks/rdfframework
rdfframework/datatypes/namespaces.py
RdfNsManager.convert_to_uri
def convert_to_uri(self, value, strip_iri=True): ''' converts a prefixed rdf ns equivalent value to its uri form. If not found returns the value as is args: value: the URI/IRI to convert strip_iri: removes the < and > signs rdflib_uri: ret...
python
def convert_to_uri(self, value, strip_iri=True): ''' converts a prefixed rdf ns equivalent value to its uri form. If not found returns the value as is args: value: the URI/IRI to convert strip_iri: removes the < and > signs rdflib_uri: ret...
[ "def", "convert_to_uri", "(", "self", ",", "value", ",", "strip_iri", "=", "True", ")", ":", "parsed", "=", "self", ".", "parse_uri", "(", "str", "(", "value", ")", ")", "try", ":", "new_uri", "=", "\"%s%s\"", "%", "(", "self", ".", "ns_dict", "[", ...
converts a prefixed rdf ns equivalent value to its uri form. If not found returns the value as is args: value: the URI/IRI to convert strip_iri: removes the < and > signs rdflib_uri: returns an rdflib URIRef
[ "converts", "a", "prefixed", "rdf", "ns", "equivalent", "value", "to", "its", "uri", "form", ".", "If", "not", "found", "returns", "the", "value", "as", "is" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datatypes/namespaces.py#L608-L625
248,078
KnowledgeLinks/rdfframework
rdfframework/datatypes/namespaces.py
RdfNsManager.get_uri_parts
def get_uri_parts(self, value): """takes an value and returns a tuple of the parts args: value: a uri in any form pyuri, ttl or full IRI """ if value.startswith('pyuri_'): value = self.rpyhttp(value) parts = self.parse_uri(value) try: ...
python
def get_uri_parts(self, value): """takes an value and returns a tuple of the parts args: value: a uri in any form pyuri, ttl or full IRI """ if value.startswith('pyuri_'): value = self.rpyhttp(value) parts = self.parse_uri(value) try: ...
[ "def", "get_uri_parts", "(", "self", ",", "value", ")", ":", "if", "value", ".", "startswith", "(", "'pyuri_'", ")", ":", "value", "=", "self", ".", "rpyhttp", "(", "value", ")", "parts", "=", "self", ".", "parse_uri", "(", "value", ")", "try", ":", ...
takes an value and returns a tuple of the parts args: value: a uri in any form pyuri, ttl or full IRI
[ "takes", "an", "value", "and", "returns", "a", "tuple", "of", "the", "parts" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datatypes/namespaces.py#L627-L642
248,079
KnowledgeLinks/rdfframework
rdfframework/datatypes/namespaces.py
RdfNsManager.rpyhttp
def rpyhttp(value): """ converts a no namespace pyuri back to a standard uri """ if value.startswith("http"): return value try: parts = value.split("_") del parts[0] _uri = base64.b64decode(parts.pop(0)).decode() return _uri + "_".join(...
python
def rpyhttp(value): """ converts a no namespace pyuri back to a standard uri """ if value.startswith("http"): return value try: parts = value.split("_") del parts[0] _uri = base64.b64decode(parts.pop(0)).decode() return _uri + "_".join(...
[ "def", "rpyhttp", "(", "value", ")", ":", "if", "value", ".", "startswith", "(", "\"http\"", ")", ":", "return", "value", "try", ":", "parts", "=", "value", ".", "split", "(", "\"_\"", ")", "del", "parts", "[", "0", "]", "_uri", "=", "base64", ".",...
converts a no namespace pyuri back to a standard uri
[ "converts", "a", "no", "namespace", "pyuri", "back", "to", "a", "standard", "uri" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datatypes/namespaces.py#L651-L662
248,080
KnowledgeLinks/rdfframework
rdfframework/datatypes/namespaces.py
RdfNsManager.pyhttp
def pyhttp(self, value): """ converts a no namespaces uri to a python excessable name """ if value.startswith("pyuri_"): return value parts = self.parse_uri(value) return "pyuri_%s_%s" % (base64.b64encode(bytes(parts[0], ...
python
def pyhttp(self, value): """ converts a no namespaces uri to a python excessable name """ if value.startswith("pyuri_"): return value parts = self.parse_uri(value) return "pyuri_%s_%s" % (base64.b64encode(bytes(parts[0], ...
[ "def", "pyhttp", "(", "self", ",", "value", ")", ":", "if", "value", ".", "startswith", "(", "\"pyuri_\"", ")", ":", "return", "value", "parts", "=", "self", ".", "parse_uri", "(", "value", ")", "return", "\"pyuri_%s_%s\"", "%", "(", "base64", ".", "b6...
converts a no namespaces uri to a python excessable name
[ "converts", "a", "no", "namespaces", "uri", "to", "a", "python", "excessable", "name" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datatypes/namespaces.py#L664-L671
248,081
KnowledgeLinks/rdfframework
rdfframework/datatypes/namespaces.py
RdfNsManager.iri
def iri(uri_string): """converts a string to an IRI or returns an IRI if already formated Args: uri_string: uri in string format Returns: formated uri with <> """ uri_string = str(uri_string) if uri_string[:1] == "?": return uri_strin...
python
def iri(uri_string): """converts a string to an IRI or returns an IRI if already formated Args: uri_string: uri in string format Returns: formated uri with <> """ uri_string = str(uri_string) if uri_string[:1] == "?": return uri_strin...
[ "def", "iri", "(", "uri_string", ")", ":", "uri_string", "=", "str", "(", "uri_string", ")", "if", "uri_string", "[", ":", "1", "]", "==", "\"?\"", ":", "return", "uri_string", "if", "uri_string", "[", ":", "1", "]", "==", "\"[\"", ":", "return", "ur...
converts a string to an IRI or returns an IRI if already formated Args: uri_string: uri in string format Returns: formated uri with <>
[ "converts", "a", "string", "to", "an", "IRI", "or", "returns", "an", "IRI", "if", "already", "formated" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datatypes/namespaces.py#L682-L700
248,082
KnowledgeLinks/rdfframework
rdfframework/datatypes/namespaces.py
RdfNsManager.convert_to_ttl
def convert_to_ttl(self, value): ''' converts a value to the prefixed rdf ns equivalent. If not found returns the value as is. args: value: the value to convert ''' parsed = self.parse_uri(value) try: rtn_val = "%s:%s" % (self.uri_dict[parse...
python
def convert_to_ttl(self, value): ''' converts a value to the prefixed rdf ns equivalent. If not found returns the value as is. args: value: the value to convert ''' parsed = self.parse_uri(value) try: rtn_val = "%s:%s" % (self.uri_dict[parse...
[ "def", "convert_to_ttl", "(", "self", ",", "value", ")", ":", "parsed", "=", "self", ".", "parse_uri", "(", "value", ")", "try", ":", "rtn_val", "=", "\"%s:%s\"", "%", "(", "self", ".", "uri_dict", "[", "parsed", "[", "0", "]", "]", ",", "parsed", ...
converts a value to the prefixed rdf ns equivalent. If not found returns the value as is. args: value: the value to convert
[ "converts", "a", "value", "to", "the", "prefixed", "rdf", "ns", "equivalent", ".", "If", "not", "found", "returns", "the", "value", "as", "is", "." ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datatypes/namespaces.py#L702-L717
248,083
KnowledgeLinks/rdfframework
rdfframework/datatypes/namespaces.py
RdfNsManager.convert_to_ns
def convert_to_ns(self, value): ''' converts a value to the prefixed rdf ns equivalent. If not found returns the value as is args: value: the value to convert ''' parsed = self.parse_uri(value) try: rtn_val = "%s_%s" % (self.uri_dict[parsed[0...
python
def convert_to_ns(self, value): ''' converts a value to the prefixed rdf ns equivalent. If not found returns the value as is args: value: the value to convert ''' parsed = self.parse_uri(value) try: rtn_val = "%s_%s" % (self.uri_dict[parsed[0...
[ "def", "convert_to_ns", "(", "self", ",", "value", ")", ":", "parsed", "=", "self", ".", "parse_uri", "(", "value", ")", "try", ":", "rtn_val", "=", "\"%s_%s\"", "%", "(", "self", ".", "uri_dict", "[", "parsed", "[", "0", "]", "]", ",", "parsed", "...
converts a value to the prefixed rdf ns equivalent. If not found returns the value as is args: value: the value to convert
[ "converts", "a", "value", "to", "the", "prefixed", "rdf", "ns", "equivalent", ".", "If", "not", "found", "returns", "the", "value", "as", "is" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datatypes/namespaces.py#L719-L732
248,084
Carreau/warn
warn/warn.py
_get_stack_frame
def _get_stack_frame(stacklevel): """ utility functions to get a stackframe, skipping internal frames. """ stacklevel = stacklevel + 1 if stacklevel <= 1 or _is_internal_frame(sys._getframe(1)): # If frame is too small to care or if the warning originated in # internal code, then do ...
python
def _get_stack_frame(stacklevel): """ utility functions to get a stackframe, skipping internal frames. """ stacklevel = stacklevel + 1 if stacklevel <= 1 or _is_internal_frame(sys._getframe(1)): # If frame is too small to care or if the warning originated in # internal code, then do ...
[ "def", "_get_stack_frame", "(", "stacklevel", ")", ":", "stacklevel", "=", "stacklevel", "+", "1", "if", "stacklevel", "<=", "1", "or", "_is_internal_frame", "(", "sys", ".", "_getframe", "(", "1", ")", ")", ":", "# If frame is too small to care or if the warning ...
utility functions to get a stackframe, skipping internal frames.
[ "utility", "functions", "to", "get", "a", "stackframe", "skipping", "internal", "frames", "." ]
251ed08bc13b536c47392ba577f86e1f96bdad6b
https://github.com/Carreau/warn/blob/251ed08bc13b536c47392ba577f86e1f96bdad6b/warn/warn.py#L118-L134
248,085
Carreau/warn
warn/warn.py
warn
def warn(message, category=None, stacklevel=1, emitstacklevel=1): """Issue a warning, or maybe ignore it or raise an exception. Duplicate of the standard library warn function except it takes the following argument: `emitstacklevel` : default to 1, number of stackframe to consider when matching th...
python
def warn(message, category=None, stacklevel=1, emitstacklevel=1): """Issue a warning, or maybe ignore it or raise an exception. Duplicate of the standard library warn function except it takes the following argument: `emitstacklevel` : default to 1, number of stackframe to consider when matching th...
[ "def", "warn", "(", "message", ",", "category", "=", "None", ",", "stacklevel", "=", "1", ",", "emitstacklevel", "=", "1", ")", ":", "# Check if message is already a Warning object", "####################", "### Get category ###", "####################", "if", "isinstan...
Issue a warning, or maybe ignore it or raise an exception. Duplicate of the standard library warn function except it takes the following argument: `emitstacklevel` : default to 1, number of stackframe to consider when matching the module that emits this warning.
[ "Issue", "a", "warning", "or", "maybe", "ignore", "it", "or", "raise", "an", "exception", "." ]
251ed08bc13b536c47392ba577f86e1f96bdad6b
https://github.com/Carreau/warn/blob/251ed08bc13b536c47392ba577f86e1f96bdad6b/warn/warn.py#L137-L206
248,086
Carreau/warn
warn/warn.py
_set_proxy_filter
def _set_proxy_filter(warningstuple): """set up a proxy that store too long warnings in a separate map""" if len(warningstuple) > 5: key = len(_proxy_map)+1 _proxy_map[key] = warningstuple # always is pass-through further in the code. return ('always', re_matchall, ProxyWarning,...
python
def _set_proxy_filter(warningstuple): """set up a proxy that store too long warnings in a separate map""" if len(warningstuple) > 5: key = len(_proxy_map)+1 _proxy_map[key] = warningstuple # always is pass-through further in the code. return ('always', re_matchall, ProxyWarning,...
[ "def", "_set_proxy_filter", "(", "warningstuple", ")", ":", "if", "len", "(", "warningstuple", ")", ">", "5", ":", "key", "=", "len", "(", "_proxy_map", ")", "+", "1", "_proxy_map", "[", "key", "]", "=", "warningstuple", "# always is pass-through further in th...
set up a proxy that store too long warnings in a separate map
[ "set", "up", "a", "proxy", "that", "store", "too", "long", "warnings", "in", "a", "separate", "map" ]
251ed08bc13b536c47392ba577f86e1f96bdad6b
https://github.com/Carreau/warn/blob/251ed08bc13b536c47392ba577f86e1f96bdad6b/warn/warn.py#L212-L221
248,087
questrail/arghelper
tasks.py
release
def release(ctx, deploy=False, test=False, version=''): """Tag release, run Travis-CI, and deploy to PyPI """ if test: run("python setup.py check") run("python setup.py register sdist upload --dry-run") if deploy: run("python setup.py check") if version: run(...
python
def release(ctx, deploy=False, test=False, version=''): """Tag release, run Travis-CI, and deploy to PyPI """ if test: run("python setup.py check") run("python setup.py register sdist upload --dry-run") if deploy: run("python setup.py check") if version: run(...
[ "def", "release", "(", "ctx", ",", "deploy", "=", "False", ",", "test", "=", "False", ",", "version", "=", "''", ")", ":", "if", "test", ":", "run", "(", "\"python setup.py check\"", ")", "run", "(", "\"python setup.py register sdist upload --dry-run\"", ")", ...
Tag release, run Travis-CI, and deploy to PyPI
[ "Tag", "release", "run", "Travis", "-", "CI", "and", "deploy", "to", "PyPI" ]
833d7d25a1f3daba70f186057d3d39a040c56200
https://github.com/questrail/arghelper/blob/833d7d25a1f3daba70f186057d3d39a040c56200/tasks.py#L23-L48
248,088
OpenGov/python_data_wrap
datawrap/tablewrap.py
squarify_table
def squarify_table(table): ''' Updates a table so that all rows are the same length by filling smaller rows with 'None' objects up to the length of the largest row. ''' max_length = 0 min_length = maxsize for row in table: row_len = len(row) if row_len > max_length: ...
python
def squarify_table(table): ''' Updates a table so that all rows are the same length by filling smaller rows with 'None' objects up to the length of the largest row. ''' max_length = 0 min_length = maxsize for row in table: row_len = len(row) if row_len > max_length: ...
[ "def", "squarify_table", "(", "table", ")", ":", "max_length", "=", "0", "min_length", "=", "maxsize", "for", "row", "in", "table", ":", "row_len", "=", "len", "(", "row", ")", "if", "row_len", ">", "max_length", ":", "max_length", "=", "row_len", "if", ...
Updates a table so that all rows are the same length by filling smaller rows with 'None' objects up to the length of the largest row.
[ "Updates", "a", "table", "so", "that", "all", "rows", "are", "the", "same", "length", "by", "filling", "smaller", "rows", "with", "None", "objects", "up", "to", "the", "length", "of", "the", "largest", "row", "." ]
7de38bb30d7a500adc336a4a7999528d753e5600
https://github.com/OpenGov/python_data_wrap/blob/7de38bb30d7a500adc336a4a7999528d753e5600/datawrap/tablewrap.py#L9-L26
248,089
xtrementl/focus
focus/plugin/modules/apps.py
_get_process_cwd
def _get_process_cwd(pid): """ Returns the working directory for the provided process identifier. `pid` System process identifier. Returns string or ``None``. Note this is used as a workaround, since `psutil` isn't consistent on being able to provide this path in all c...
python
def _get_process_cwd(pid): """ Returns the working directory for the provided process identifier. `pid` System process identifier. Returns string or ``None``. Note this is used as a workaround, since `psutil` isn't consistent on being able to provide this path in all c...
[ "def", "_get_process_cwd", "(", "pid", ")", ":", "cmd", "=", "'lsof -a -p {0} -d cwd -Fn'", ".", "format", "(", "pid", ")", "data", "=", "common", ".", "shell_process", "(", "cmd", ")", "if", "not", "data", "is", "None", ":", "lines", "=", "str", "(", ...
Returns the working directory for the provided process identifier. `pid` System process identifier. Returns string or ``None``. Note this is used as a workaround, since `psutil` isn't consistent on being able to provide this path in all cases, especially MacOS X.
[ "Returns", "the", "working", "directory", "for", "the", "provided", "process", "identifier", "." ]
cbbbc0b49a7409f9e0dc899de5b7e057f50838e4
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/modules/apps.py#L24-L47
248,090
xtrementl/focus
focus/plugin/modules/apps.py
_get_checksum
def _get_checksum(path): """ Generates a md5 checksum of the file at the specified path. `path` Path to file for checksum. Returns string or ``None`` """ # md5 uses a 512-bit digest blocks, let's scale by defined block_size _md5 = hashlib.md5() chunk_size = 128 * _...
python
def _get_checksum(path): """ Generates a md5 checksum of the file at the specified path. `path` Path to file for checksum. Returns string or ``None`` """ # md5 uses a 512-bit digest blocks, let's scale by defined block_size _md5 = hashlib.md5() chunk_size = 128 * _...
[ "def", "_get_checksum", "(", "path", ")", ":", "# md5 uses a 512-bit digest blocks, let's scale by defined block_size", "_md5", "=", "hashlib", ".", "md5", "(", ")", "chunk_size", "=", "128", "*", "_md5", ".", "block_size", "try", ":", "with", "open", "(", "path",...
Generates a md5 checksum of the file at the specified path. `path` Path to file for checksum. Returns string or ``None``
[ "Generates", "a", "md5", "checksum", "of", "the", "file", "at", "the", "specified", "path", "." ]
cbbbc0b49a7409f9e0dc899de5b7e057f50838e4
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/modules/apps.py#L50-L70
248,091
xtrementl/focus
focus/plugin/modules/apps.py
_get_user_processes
def _get_user_processes(): """ Gets process information owned by the current user. Returns generator of tuples: (``psutil.Process`` instance, path). """ uid = os.getuid() for proc in psutil.process_iter(): try: # yield processes that match current user if p...
python
def _get_user_processes(): """ Gets process information owned by the current user. Returns generator of tuples: (``psutil.Process`` instance, path). """ uid = os.getuid() for proc in psutil.process_iter(): try: # yield processes that match current user if p...
[ "def", "_get_user_processes", "(", ")", ":", "uid", "=", "os", ".", "getuid", "(", ")", "for", "proc", "in", "psutil", ".", "process_iter", "(", ")", ":", "try", ":", "# yield processes that match current user", "if", "proc", ".", "uids", ".", "real", "=="...
Gets process information owned by the current user. Returns generator of tuples: (``psutil.Process`` instance, path).
[ "Gets", "process", "information", "owned", "by", "the", "current", "user", "." ]
cbbbc0b49a7409f9e0dc899de5b7e057f50838e4
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/modules/apps.py#L73-L107
248,092
xtrementl/focus
focus/plugin/modules/apps.py
_stop_processes
def _stop_processes(paths): """ Scans process list trying to terminate processes matching paths specified. Uses checksums to identify processes that are duplicates of those specified to terminate. `paths` List of full paths to executables for processes to terminate. """ ...
python
def _stop_processes(paths): """ Scans process list trying to terminate processes matching paths specified. Uses checksums to identify processes that are duplicates of those specified to terminate. `paths` List of full paths to executables for processes to terminate. """ ...
[ "def", "_stop_processes", "(", "paths", ")", ":", "def", "cache_checksum", "(", "path", ")", ":", "\"\"\" Checksum provided path, cache, and return value.\n \"\"\"", "if", "not", "path", ":", "return", "None", "if", "not", "path", "in", "_process_checksums", ...
Scans process list trying to terminate processes matching paths specified. Uses checksums to identify processes that are duplicates of those specified to terminate. `paths` List of full paths to executables for processes to terminate.
[ "Scans", "process", "list", "trying", "to", "terminate", "processes", "matching", "paths", "specified", ".", "Uses", "checksums", "to", "identify", "processes", "that", "are", "duplicates", "of", "those", "specified", "to", "terminate", "." ]
cbbbc0b49a7409f9e0dc899de5b7e057f50838e4
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/modules/apps.py#L110-L145
248,093
xtrementl/focus
focus/plugin/modules/apps.py
AppRun._run_apps
def _run_apps(self, paths): """ Runs apps for the provided paths. """ for path in paths: common.shell_process(path, background=True) time.sleep(0.2)
python
def _run_apps(self, paths): """ Runs apps for the provided paths. """ for path in paths: common.shell_process(path, background=True) time.sleep(0.2)
[ "def", "_run_apps", "(", "self", ",", "paths", ")", ":", "for", "path", "in", "paths", ":", "common", ".", "shell_process", "(", "path", ",", "background", "=", "True", ")", "time", ".", "sleep", "(", "0.2", ")" ]
Runs apps for the provided paths.
[ "Runs", "apps", "for", "the", "provided", "paths", "." ]
cbbbc0b49a7409f9e0dc899de5b7e057f50838e4
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/modules/apps.py#L180-L186
248,094
ulf1/oxyba
oxyba/norm_mle.py
norm_mle
def norm_mle(data, algorithm='Nelder-Mead', debug=False): """Estimate Mean and Std.Dev. of the Normal Distribution Parameters: ----------- data : list, tuple, ndarray vector with samples, observations that are assumed to follow a Normal distribution. algorithm : str Optiona...
python
def norm_mle(data, algorithm='Nelder-Mead', debug=False): """Estimate Mean and Std.Dev. of the Normal Distribution Parameters: ----------- data : list, tuple, ndarray vector with samples, observations that are assumed to follow a Normal distribution. algorithm : str Optiona...
[ "def", "norm_mle", "(", "data", ",", "algorithm", "=", "'Nelder-Mead'", ",", "debug", "=", "False", ")", ":", "import", "scipy", ".", "stats", "as", "sstat", "import", "scipy", ".", "optimize", "as", "sopt", "def", "objective_nll_norm_uni", "(", "theta", "...
Estimate Mean and Std.Dev. of the Normal Distribution Parameters: ----------- data : list, tuple, ndarray vector with samples, observations that are assumed to follow a Normal distribution. algorithm : str Optional. Default 'Nelder-Mead' (Simplex). The algorithm used in...
[ "Estimate", "Mean", "and", "Std", ".", "Dev", ".", "of", "the", "Normal", "Distribution" ]
b3043116050de275124365cb11e7df91fb40169d
https://github.com/ulf1/oxyba/blob/b3043116050de275124365cb11e7df91fb40169d/oxyba/norm_mle.py#L2-L59
248,095
KnowledgeLinks/rdfframework
rdfframework/utilities/frameworkutilities.py
DataStatus.get
def get(self, status_item): """ queries the database and returns that status of the item. args: status_item: the name of the item to check """ lg = logging.getLogger("%s.%s" % (self.ln, inspect.stack()[0][3])) lg.setLevel(self.log_level) sparql = ''' ...
python
def get(self, status_item): """ queries the database and returns that status of the item. args: status_item: the name of the item to check """ lg = logging.getLogger("%s.%s" % (self.ln, inspect.stack()[0][3])) lg.setLevel(self.log_level) sparql = ''' ...
[ "def", "get", "(", "self", ",", "status_item", ")", ":", "lg", "=", "logging", ".", "getLogger", "(", "\"%s.%s\"", "%", "(", "self", ".", "ln", ",", "inspect", ".", "stack", "(", ")", "[", "0", "]", "[", "3", "]", ")", ")", "lg", ".", "setLevel...
queries the database and returns that status of the item. args: status_item: the name of the item to check
[ "queries", "the", "database", "and", "returns", "that", "status", "of", "the", "item", "." ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/utilities/frameworkutilities.py#L71-L90
248,096
malthe/pop
src/pop/utils.py
local_machine_uuid
def local_machine_uuid(): """Return local machine unique identifier. >>> uuid = local_machine_uuid() """ result = subprocess.check_output( 'hal-get-property --udi ' '/org/freedesktop/Hal/devices/computer ' '--key system.hardware.uuid'.split() ).strip() return uuid...
python
def local_machine_uuid(): """Return local machine unique identifier. >>> uuid = local_machine_uuid() """ result = subprocess.check_output( 'hal-get-property --udi ' '/org/freedesktop/Hal/devices/computer ' '--key system.hardware.uuid'.split() ).strip() return uuid...
[ "def", "local_machine_uuid", "(", ")", ":", "result", "=", "subprocess", ".", "check_output", "(", "'hal-get-property --udi '", "'/org/freedesktop/Hal/devices/computer '", "'--key system.hardware.uuid'", ".", "split", "(", ")", ")", ".", "strip", "(", ")", "return", "...
Return local machine unique identifier. >>> uuid = local_machine_uuid()
[ "Return", "local", "machine", "unique", "identifier", "." ]
3b58b91b41d8b9bee546eb40dc280a57500b8bed
https://github.com/malthe/pop/blob/3b58b91b41d8b9bee546eb40dc280a57500b8bed/src/pop/utils.py#L26-L39
248,097
malthe/pop
src/pop/utils.py
YAMLState.read
def read(self, required=False): """Read Zookeeper state. Read in the current Zookeeper state for this node. This operation should be called prior to other interactions with this object. `required`: boolean indicating if the node existence should be required at read time...
python
def read(self, required=False): """Read Zookeeper state. Read in the current Zookeeper state for this node. This operation should be called prior to other interactions with this object. `required`: boolean indicating if the node existence should be required at read time...
[ "def", "read", "(", "self", ",", "required", "=", "False", ")", ":", "self", ".", "_pristine_cache", "=", "{", "}", "self", ".", "_cache", "=", "{", "}", "try", ":", "data", ",", "stat", "=", "yield", "self", ".", "_client", ".", "get", "(", "sel...
Read Zookeeper state. Read in the current Zookeeper state for this node. This operation should be called prior to other interactions with this object. `required`: boolean indicating if the node existence should be required at read time. Normally write will create the node if ...
[ "Read", "Zookeeper", "state", "." ]
3b58b91b41d8b9bee546eb40dc280a57500b8bed
https://github.com/malthe/pop/blob/3b58b91b41d8b9bee546eb40dc280a57500b8bed/src/pop/utils.py#L96-L119
248,098
malthe/pop
src/pop/utils.py
YAMLState.write
def write(self): """Write object state to Zookeeper. This will write the current state of the object to Zookeeper, taking the final merged state as the new one, and resetting any write buffers. """ self._check() cache = self._cache pristine_cache = self._...
python
def write(self): """Write object state to Zookeeper. This will write the current state of the object to Zookeeper, taking the final merged state as the new one, and resetting any write buffers. """ self._check() cache = self._cache pristine_cache = self._...
[ "def", "write", "(", "self", ")", ":", "self", ".", "_check", "(", ")", "cache", "=", "self", ".", "_cache", "pristine_cache", "=", "self", ".", "_pristine_cache", "self", ".", "_pristine_cache", "=", "cache", ".", "copy", "(", ")", "# Used by `apply_chang...
Write object state to Zookeeper. This will write the current state of the object to Zookeeper, taking the final merged state as the new one, and resetting any write buffers.
[ "Write", "object", "state", "to", "Zookeeper", "." ]
3b58b91b41d8b9bee546eb40dc280a57500b8bed
https://github.com/malthe/pop/blob/3b58b91b41d8b9bee546eb40dc280a57500b8bed/src/pop/utils.py#L145-L184
248,099
azogue/dataweb
dataweb/classdataweb.py
DataWeb.printif
def printif(self, obj_print, tipo_print=None): """Color output & logging.""" if self.verbose: print(obj_print) if tipo_print == 'ok': logging.info(obj_print) elif tipo_print == 'error': logging.error(obj_print) elif tipo_print == 'warning': ...
python
def printif(self, obj_print, tipo_print=None): """Color output & logging.""" if self.verbose: print(obj_print) if tipo_print == 'ok': logging.info(obj_print) elif tipo_print == 'error': logging.error(obj_print) elif tipo_print == 'warning': ...
[ "def", "printif", "(", "self", ",", "obj_print", ",", "tipo_print", "=", "None", ")", ":", "if", "self", ".", "verbose", ":", "print", "(", "obj_print", ")", "if", "tipo_print", "==", "'ok'", ":", "logging", ".", "info", "(", "obj_print", ")", "elif", ...
Color output & logging.
[ "Color", "output", "&", "logging", "." ]
085035855df7cef0fe7725bbe9a706832344d946
https://github.com/azogue/dataweb/blob/085035855df7cef0fe7725bbe9a706832344d946/dataweb/classdataweb.py#L148-L157