repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
IBM/pyxcli
pyxcli/helpers/exceptool.py
chained
def chained(wrapping_exc): # pylint: disable=W0212 """ Embeds the current exception information into the given one (which will replace the current one). For example:: try: ... except OSError as ex: raise chained(MyError("database not found!")) """ t, ...
python
def chained(wrapping_exc): # pylint: disable=W0212 """ Embeds the current exception information into the given one (which will replace the current one). For example:: try: ... except OSError as ex: raise chained(MyError("database not found!")) """ t, ...
[ "def", "chained", "(", "wrapping_exc", ")", ":", "# pylint: disable=W0212", "t", ",", "v", ",", "tb", "=", "sys", ".", "exc_info", "(", ")", "if", "not", "t", ":", "return", "wrapping_exc", "wrapping_exc", ".", "_inner_exc", "=", "v", "lines", "=", "trac...
Embeds the current exception information into the given one (which will replace the current one). For example:: try: ... except OSError as ex: raise chained(MyError("database not found!"))
[ "Embeds", "the", "current", "exception", "information", "into", "the", "given", "one", "(", "which", "will", "replace", "the", "current", "one", ")", ".", "For", "example", "::" ]
train
https://github.com/IBM/pyxcli/blob/7d8ece1dcc16f50246740a447aa81b94a0dbced4/pyxcli/helpers/exceptool.py#L21-L39
khazhyk/osuapi
osuapi/osu.py
OsuApi.get_user
def get_user(self, username, *, mode=OsuMode.osu, event_days=31): """Get a user profile. Parameters ---------- username : str or int A `str` representing the user's username, or an `int` representing the user's id. mode : :class:`osuapi.enums.OsuMode` The...
python
def get_user(self, username, *, mode=OsuMode.osu, event_days=31): """Get a user profile. Parameters ---------- username : str or int A `str` representing the user's username, or an `int` representing the user's id. mode : :class:`osuapi.enums.OsuMode` The...
[ "def", "get_user", "(", "self", ",", "username", ",", "*", ",", "mode", "=", "OsuMode", ".", "osu", ",", "event_days", "=", "31", ")", ":", "return", "self", ".", "_make_req", "(", "endpoints", ".", "USER", ",", "dict", "(", "k", "=", "self", ".", ...
Get a user profile. Parameters ---------- username : str or int A `str` representing the user's username, or an `int` representing the user's id. mode : :class:`osuapi.enums.OsuMode` The osu! game mode for which to look up. Defaults to osu!standard. event...
[ "Get", "a", "user", "profile", "." ]
train
https://github.com/khazhyk/osuapi/blob/e46a76dc7c1f43e7ce63ab83ab7162ab5c3930ec/osuapi/osu.py#L33-L51
khazhyk/osuapi
osuapi/osu.py
OsuApi.get_user_best
def get_user_best(self, username, *, mode=OsuMode.osu, limit=50): """Get a user's best scores. Parameters ---------- username : str or int A `str` representing the user's username, or an `int` representing the user's id. mode : :class:`osuapi.enums.OsuMode` ...
python
def get_user_best(self, username, *, mode=OsuMode.osu, limit=50): """Get a user's best scores. Parameters ---------- username : str or int A `str` representing the user's username, or an `int` representing the user's id. mode : :class:`osuapi.enums.OsuMode` ...
[ "def", "get_user_best", "(", "self", ",", "username", ",", "*", ",", "mode", "=", "OsuMode", ".", "osu", ",", "limit", "=", "50", ")", ":", "return", "self", ".", "_make_req", "(", "endpoints", ".", "USER_BEST", ",", "dict", "(", "k", "=", "self", ...
Get a user's best scores. Parameters ---------- username : str or int A `str` representing the user's username, or an `int` representing the user's id. mode : :class:`osuapi.enums.OsuMode` The osu! game mode for which to look up. Defaults to osu!standard. ...
[ "Get", "a", "user", "s", "best", "scores", "." ]
train
https://github.com/khazhyk/osuapi/blob/e46a76dc7c1f43e7ce63ab83ab7162ab5c3930ec/osuapi/osu.py#L53-L71
khazhyk/osuapi
osuapi/osu.py
OsuApi.get_user_recent
def get_user_recent(self, username, *, mode=OsuMode.osu, limit=10): """Get a user's most recent scores, within the last 24 hours. Parameters ---------- username : str or int A `str` representing the user's username, or an `int` representing the user's id. mode : :cla...
python
def get_user_recent(self, username, *, mode=OsuMode.osu, limit=10): """Get a user's most recent scores, within the last 24 hours. Parameters ---------- username : str or int A `str` representing the user's username, or an `int` representing the user's id. mode : :cla...
[ "def", "get_user_recent", "(", "self", ",", "username", ",", "*", ",", "mode", "=", "OsuMode", ".", "osu", ",", "limit", "=", "10", ")", ":", "return", "self", ".", "_make_req", "(", "endpoints", ".", "USER_RECENT", ",", "dict", "(", "k", "=", "self"...
Get a user's most recent scores, within the last 24 hours. Parameters ---------- username : str or int A `str` representing the user's username, or an `int` representing the user's id. mode : :class:`osuapi.enums.OsuMode` The osu! game mode for which to look up. ...
[ "Get", "a", "user", "s", "most", "recent", "scores", "within", "the", "last", "24", "hours", "." ]
train
https://github.com/khazhyk/osuapi/blob/e46a76dc7c1f43e7ce63ab83ab7162ab5c3930ec/osuapi/osu.py#L73-L91
khazhyk/osuapi
osuapi/osu.py
OsuApi.get_scores
def get_scores(self, beatmap_id, *, username=None, mode=OsuMode.osu, mods=None, limit=50): """Get the top scores for a given beatmap. Parameters ---------- beatmap_id Individual Beatmap ID to lookup. username : str or int A `str` representing the user's u...
python
def get_scores(self, beatmap_id, *, username=None, mode=OsuMode.osu, mods=None, limit=50): """Get the top scores for a given beatmap. Parameters ---------- beatmap_id Individual Beatmap ID to lookup. username : str or int A `str` representing the user's u...
[ "def", "get_scores", "(", "self", ",", "beatmap_id", ",", "*", ",", "username", "=", "None", ",", "mode", "=", "OsuMode", ".", "osu", ",", "mods", "=", "None", ",", "limit", "=", "50", ")", ":", "return", "self", ".", "_make_req", "(", "endpoints", ...
Get the top scores for a given beatmap. Parameters ---------- beatmap_id Individual Beatmap ID to lookup. username : str or int A `str` representing the user's username, or an `int` representing the user's id. If specified, restricts returned scores to the specif...
[ "Get", "the", "top", "scores", "for", "a", "given", "beatmap", "." ]
train
https://github.com/khazhyk/osuapi/blob/e46a76dc7c1f43e7ce63ab83ab7162ab5c3930ec/osuapi/osu.py#L93-L116
khazhyk/osuapi
osuapi/osu.py
OsuApi.get_beatmaps
def get_beatmaps(self, *, since=None, beatmapset_id=None, beatmap_id=None, username=None, mode=None, include_converted=False, beatmap_hash=None, limit=500): """Get beatmaps. Parameters ---------- since : datetime If specified, restrict results to beatmap...
python
def get_beatmaps(self, *, since=None, beatmapset_id=None, beatmap_id=None, username=None, mode=None, include_converted=False, beatmap_hash=None, limit=500): """Get beatmaps. Parameters ---------- since : datetime If specified, restrict results to beatmap...
[ "def", "get_beatmaps", "(", "self", ",", "*", ",", "since", "=", "None", ",", "beatmapset_id", "=", "None", ",", "beatmap_id", "=", "None", ",", "username", "=", "None", ",", "mode", "=", "None", ",", "include_converted", "=", "False", ",", "beatmap_hash...
Get beatmaps. Parameters ---------- since : datetime If specified, restrict results to beatmaps *ranked* after this date. beatmapset_id If specified, restrict results to a specific beatmap set. beatmap_id If specified, restrict results to a sp...
[ "Get", "beatmaps", "." ]
train
https://github.com/khazhyk/osuapi/blob/e46a76dc7c1f43e7ce63ab83ab7162ab5c3930ec/osuapi/osu.py#L118-L153
khazhyk/osuapi
osuapi/osu.py
OsuApi.get_match
def get_match(self, match_id): """Get a multiplayer match. Parameters ---------- match_id The ID of the match to retrieve. This is the ID that you see in a online multiplayer match summary. This does not correspond the in-game game ID.""" return self._mak...
python
def get_match(self, match_id): """Get a multiplayer match. Parameters ---------- match_id The ID of the match to retrieve. This is the ID that you see in a online multiplayer match summary. This does not correspond the in-game game ID.""" return self._mak...
[ "def", "get_match", "(", "self", ",", "match_id", ")", ":", "return", "self", ".", "_make_req", "(", "endpoints", ".", "MATCH", ",", "dict", "(", "k", "=", "self", ".", "key", ",", "mp", "=", "match_id", ")", ",", "Match", ")" ]
Get a multiplayer match. Parameters ---------- match_id The ID of the match to retrieve. This is the ID that you see in a online multiplayer match summary. This does not correspond the in-game game ID.
[ "Get", "a", "multiplayer", "match", "." ]
train
https://github.com/khazhyk/osuapi/blob/e46a76dc7c1f43e7ce63ab83ab7162ab5c3930ec/osuapi/osu.py#L155-L165
aioworkers/aioworkers
aioworkers/storage/http.py
RoStorage.copy
async def copy(self, key_source, storage_dest, key_dest): """ Return True if data are copied * optimized for http->fs copy * not supported return_status """ from aioworkers.storage.filesystem import FileSystemStorage if not isinstance(storage_dest, FileSystemStorage): ...
python
async def copy(self, key_source, storage_dest, key_dest): """ Return True if data are copied * optimized for http->fs copy * not supported return_status """ from aioworkers.storage.filesystem import FileSystemStorage if not isinstance(storage_dest, FileSystemStorage): ...
[ "async", "def", "copy", "(", "self", ",", "key_source", ",", "storage_dest", ",", "key_dest", ")", ":", "from", "aioworkers", ".", "storage", ".", "filesystem", "import", "FileSystemStorage", "if", "not", "isinstance", "(", "storage_dest", ",", "FileSystemStorag...
Return True if data are copied * optimized for http->fs copy * not supported return_status
[ "Return", "True", "if", "data", "are", "copied", "*", "optimized", "for", "http", "-", ">", "fs", "copy", "*", "not", "supported", "return_status" ]
train
https://github.com/aioworkers/aioworkers/blob/94caa5584a75bae1cee6c8c7a24667bff9cefa90/aioworkers/storage/http.py#L104-L129
aioworkers/aioworkers
aioworkers/utils.py
import_name
def import_name(stref: str): """ >>> import_name('datetime.datetime.utcnow') is not None True >>> import_name('aioworkers.utils.import_name') is not None True """ h = stref p = [] m = None try: r = importlib.util.find_spec(stref) except (AttributeError, ImportError): ...
python
def import_name(stref: str): """ >>> import_name('datetime.datetime.utcnow') is not None True >>> import_name('aioworkers.utils.import_name') is not None True """ h = stref p = [] m = None try: r = importlib.util.find_spec(stref) except (AttributeError, ImportError): ...
[ "def", "import_name", "(", "stref", ":", "str", ")", ":", "h", "=", "stref", "p", "=", "[", "]", "m", "=", "None", "try", ":", "r", "=", "importlib", ".", "util", ".", "find_spec", "(", "stref", ")", "except", "(", "AttributeError", ",", "ImportErr...
>>> import_name('datetime.datetime.utcnow') is not None True >>> import_name('aioworkers.utils.import_name') is not None True
[ ">>>", "import_name", "(", "datetime", ".", "datetime", ".", "utcnow", ")", "is", "not", "None", "True", ">>>", "import_name", "(", "aioworkers", ".", "utils", ".", "import_name", ")", "is", "not", "None", "True" ]
train
https://github.com/aioworkers/aioworkers/blob/94caa5584a75bae1cee6c8c7a24667bff9cefa90/aioworkers/utils.py#L16-L52
IBM/pyxcli
pyxcli/client.py
BaseXCLIClient.options
def options(self, **options): """A context-manager for setting connection options; the original values of the options will be restored when the context-manager exits. For example:: with c.options(gui_mode = False): c.cmd.vol_list() """ self._contexts...
python
def options(self, **options): """A context-manager for setting connection options; the original values of the options will be restored when the context-manager exits. For example:: with c.options(gui_mode = False): c.cmd.vol_list() """ self._contexts...
[ "def", "options", "(", "self", ",", "*", "*", "options", ")", ":", "self", ".", "_contexts", ".", "append", "(", "self", ".", "_contexts", "[", "-", "1", "]", ".", "copy", "(", ")", ")", "self", ".", "set_options", "(", "*", "*", "options", ")", ...
A context-manager for setting connection options; the original values of the options will be restored when the context-manager exits. For example:: with c.options(gui_mode = False): c.cmd.vol_list()
[ "A", "context", "-", "manager", "for", "setting", "connection", "options", ";", "the", "original", "values", "of", "the", "options", "will", "be", "restored", "when", "the", "context", "-", "manager", "exits", ".", "For", "example", "::" ]
train
https://github.com/IBM/pyxcli/blob/7d8ece1dcc16f50246740a447aa81b94a0dbced4/pyxcli/client.py#L108-L121
IBM/pyxcli
pyxcli/client.py
BaseXCLIClient.set_options
def set_options(self, **options): """Sets the value of the given options (as keyword arguments). Note that underscored in the option's name will be replaced with hyphens (i.e., ``c.set_options(gui_mode = True)`` will set the option ``gui-mode``) """ opt2 = self._contexts[...
python
def set_options(self, **options): """Sets the value of the given options (as keyword arguments). Note that underscored in the option's name will be replaced with hyphens (i.e., ``c.set_options(gui_mode = True)`` will set the option ``gui-mode``) """ opt2 = self._contexts[...
[ "def", "set_options", "(", "self", ",", "*", "*", "options", ")", ":", "opt2", "=", "self", ".", "_contexts", "[", "-", "1", "]", "for", "k", ",", "v", "in", "options", ".", "items", "(", ")", ":", "k2", "=", "k", ".", "replace", "(", "\"_\"", ...
Sets the value of the given options (as keyword arguments). Note that underscored in the option's name will be replaced with hyphens (i.e., ``c.set_options(gui_mode = True)`` will set the option ``gui-mode``)
[ "Sets", "the", "value", "of", "the", "given", "options", "(", "as", "keyword", "arguments", ")", ".", "Note", "that", "underscored", "in", "the", "option", "s", "name", "will", "be", "replaced", "with", "hyphens", "(", "i", ".", "e", ".", "c", ".", "...
train
https://github.com/IBM/pyxcli/blob/7d8ece1dcc16f50246740a447aa81b94a0dbced4/pyxcli/client.py#L129-L141
IBM/pyxcli
pyxcli/client.py
XCLIClient.connect_ssl
def connect_ssl(cls, user, password, endpoints, ca_certs=None, validate=None): """ Creates an SSL transport to the first endpoint (aserver) to which we successfully connect """ if isinstance(endpoints, basestring): endpoints = [endpoints] t...
python
def connect_ssl(cls, user, password, endpoints, ca_certs=None, validate=None): """ Creates an SSL transport to the first endpoint (aserver) to which we successfully connect """ if isinstance(endpoints, basestring): endpoints = [endpoints] t...
[ "def", "connect_ssl", "(", "cls", ",", "user", ",", "password", ",", "endpoints", ",", "ca_certs", "=", "None", ",", "validate", "=", "None", ")", ":", "if", "isinstance", "(", "endpoints", ",", "basestring", ")", ":", "endpoints", "=", "[", "endpoints",...
Creates an SSL transport to the first endpoint (aserver) to which we successfully connect
[ "Creates", "an", "SSL", "transport", "to", "the", "first", "endpoint", "(", "aserver", ")", "to", "which", "we", "successfully", "connect" ]
train
https://github.com/IBM/pyxcli/blob/7d8ece1dcc16f50246740a447aa81b94a0dbced4/pyxcli/client.py#L200-L211
IBM/pyxcli
pyxcli/client.py
XCLIClient.connect_multiendpoint_ssl
def connect_multiendpoint_ssl(cls, user, password, endpoints, auto_discover=True, ca_certs=None, validate=None): """ Creates a MultiEndpointTransport, so that if the current endpoint (aserver) fails, it would automatically move ...
python
def connect_multiendpoint_ssl(cls, user, password, endpoints, auto_discover=True, ca_certs=None, validate=None): """ Creates a MultiEndpointTransport, so that if the current endpoint (aserver) fails, it would automatically move ...
[ "def", "connect_multiendpoint_ssl", "(", "cls", ",", "user", ",", "password", ",", "endpoints", ",", "auto_discover", "=", "True", ",", "ca_certs", "=", "None", ",", "validate", "=", "None", ")", ":", "if", "isinstance", "(", "endpoints", ",", "basestring", ...
Creates a MultiEndpointTransport, so that if the current endpoint (aserver) fails, it would automatically move to the next available endpoint. If ``auto_discover`` is ``True``, we will execute ipinterface_list on the system to discover all management IP interfaces and add them t...
[ "Creates", "a", "MultiEndpointTransport", "so", "that", "if", "the", "current", "endpoint", "(", "aserver", ")", "fails", "it", "would", "automatically", "move", "to", "the", "next", "available", "endpoint", "." ]
train
https://github.com/IBM/pyxcli/blob/7d8ece1dcc16f50246740a447aa81b94a0dbced4/pyxcli/client.py#L214-L238
IBM/pyxcli
pyxcli/client.py
XCLIClient.execute_remote
def execute_remote(self, remote_target, cmd, **kwargs): """ Executes the given command (with the given arguments) on the given remote target of the connected machine """ data = self._build_command(cmd, kwargs, self._contexts[-1], remote_target) ...
python
def execute_remote(self, remote_target, cmd, **kwargs): """ Executes the given command (with the given arguments) on the given remote target of the connected machine """ data = self._build_command(cmd, kwargs, self._contexts[-1], remote_target) ...
[ "def", "execute_remote", "(", "self", ",", "remote_target", ",", "cmd", ",", "*", "*", "kwargs", ")", ":", "data", "=", "self", ".", "_build_command", "(", "cmd", ",", "kwargs", ",", "self", ".", "_contexts", "[", "-", "1", "]", ",", "remote_target", ...
Executes the given command (with the given arguments) on the given remote target of the connected machine
[ "Executes", "the", "given", "command", "(", "with", "the", "given", "arguments", ")", "on", "the", "given", "remote", "target", "of", "the", "connected", "machine" ]
train
https://github.com/IBM/pyxcli/blob/7d8ece1dcc16f50246740a447aa81b94a0dbced4/pyxcli/client.py#L304-L320
IBM/pyxcli
pyxcli/client.py
XCLIClient.get_user_client
def get_user_client(self, user, password, populate=True): """ Returns a new client for the given user. This is a lightweight client that only uses different credentials and shares the transport with the underlying client """ return XCLIClientForUser(weakproxy(self), user,...
python
def get_user_client(self, user, password, populate=True): """ Returns a new client for the given user. This is a lightweight client that only uses different credentials and shares the transport with the underlying client """ return XCLIClientForUser(weakproxy(self), user,...
[ "def", "get_user_client", "(", "self", ",", "user", ",", "password", ",", "populate", "=", "True", ")", ":", "return", "XCLIClientForUser", "(", "weakproxy", "(", "self", ")", ",", "user", ",", "password", ",", "populate", "=", "populate", ")" ]
Returns a new client for the given user. This is a lightweight client that only uses different credentials and shares the transport with the underlying client
[ "Returns", "a", "new", "client", "for", "the", "given", "user", ".", "This", "is", "a", "lightweight", "client", "that", "only", "uses", "different", "credentials", "and", "shares", "the", "transport", "with", "the", "underlying", "client" ]
train
https://github.com/IBM/pyxcli/blob/7d8ece1dcc16f50246740a447aa81b94a0dbced4/pyxcli/client.py#L322-L329
IBM/pyxcli
pyxcli/client.py
XCLIClient.get_remote_client
def get_remote_client(self, target_name, user=None, password=None): """ Returns a new client for the remote target. This is a lightweight client that only uses different credentials and shares the transport with the underlying client """ if user: base = self.g...
python
def get_remote_client(self, target_name, user=None, password=None): """ Returns a new client for the remote target. This is a lightweight client that only uses different credentials and shares the transport with the underlying client """ if user: base = self.g...
[ "def", "get_remote_client", "(", "self", ",", "target_name", ",", "user", "=", "None", ",", "password", "=", "None", ")", ":", "if", "user", ":", "base", "=", "self", ".", "get_user_client", "(", "user", ",", "password", ",", "populate", "=", "False", ...
Returns a new client for the remote target. This is a lightweight client that only uses different credentials and shares the transport with the underlying client
[ "Returns", "a", "new", "client", "for", "the", "remote", "target", ".", "This", "is", "a", "lightweight", "client", "that", "only", "uses", "different", "credentials", "and", "shares", "the", "transport", "with", "the", "underlying", "client" ]
train
https://github.com/IBM/pyxcli/blob/7d8ece1dcc16f50246740a447aa81b94a0dbced4/pyxcli/client.py#L331-L341
IBM/pyxcli
pyxcli/client.py
XCLIClient.as_user
def as_user(self, user, password): """ A context-manager for ``get_user_client``. Allows the execution of commands as a different user with ease. Example: >>> c.cmd.vol_list() >>> with c.as_user("user", "password"): ... c.cmd.vol_list() """ ...
python
def as_user(self, user, password): """ A context-manager for ``get_user_client``. Allows the execution of commands as a different user with ease. Example: >>> c.cmd.vol_list() >>> with c.as_user("user", "password"): ... c.cmd.vol_list() """ ...
[ "def", "as_user", "(", "self", ",", "user", ",", "password", ")", ":", "with", "self", ".", "options", "(", "user", "=", "user", ",", "password", "=", "password", ")", ":", "yield", "self" ]
A context-manager for ``get_user_client``. Allows the execution of commands as a different user with ease. Example: >>> c.cmd.vol_list() >>> with c.as_user("user", "password"): ... c.cmd.vol_list()
[ "A", "context", "-", "manager", "for", "get_user_client", ".", "Allows", "the", "execution", "of", "commands", "as", "a", "different", "user", "with", "ease", "." ]
train
https://github.com/IBM/pyxcli/blob/7d8ece1dcc16f50246740a447aa81b94a0dbced4/pyxcli/client.py#L344-L358
khazhyk/osuapi
osuapi/model.py
Score.accuracy
def accuracy(self, mode: OsuMode): """Calculated accuracy. See Also -------- <https://osu.ppy.sh/help/wiki/Accuracy> """ if mode is OsuMode.osu: return ( (6 * self.count300 + 2 * self.count100 + self.count50) / (6 * (self.count...
python
def accuracy(self, mode: OsuMode): """Calculated accuracy. See Also -------- <https://osu.ppy.sh/help/wiki/Accuracy> """ if mode is OsuMode.osu: return ( (6 * self.count300 + 2 * self.count100 + self.count50) / (6 * (self.count...
[ "def", "accuracy", "(", "self", ",", "mode", ":", "OsuMode", ")", ":", "if", "mode", "is", "OsuMode", ".", "osu", ":", "return", "(", "(", "6", "*", "self", ".", "count300", "+", "2", "*", "self", ".", "count100", "+", "self", ".", "count50", ")"...
Calculated accuracy. See Also -------- <https://osu.ppy.sh/help/wiki/Accuracy>
[ "Calculated", "accuracy", "." ]
train
https://github.com/khazhyk/osuapi/blob/e46a76dc7c1f43e7ce63ab83ab7162ab5c3930ec/osuapi/model.py#L62-L84
IBM/pyxcli
pyxcli/mirroring/cg_recovery_manager.py
CGRecoveryManager.create_mirror
def create_mirror(self, resource_name, target_name, mirror_type, slave_resource_name, rpo=None, remote_rpo=None, schedule=None, remote_schedule=None, activate_mirror='no'): '''creates a mirror and returns a mirror object. target n...
python
def create_mirror(self, resource_name, target_name, mirror_type, slave_resource_name, rpo=None, remote_rpo=None, schedule=None, remote_schedule=None, activate_mirror='no'): '''creates a mirror and returns a mirror object. target n...
[ "def", "create_mirror", "(", "self", ",", "resource_name", ",", "target_name", ",", "mirror_type", ",", "slave_resource_name", ",", "rpo", "=", "None", ",", "remote_rpo", "=", "None", ",", "schedule", "=", "None", ",", "remote_schedule", "=", "None", ",", "a...
creates a mirror and returns a mirror object. target name must be a valid target from target_list, mirror type must be 'sync' or 'async', slave_resource_name would be the slave_cg name
[ "creates", "a", "mirror", "and", "returns", "a", "mirror", "object", ".", "target", "name", "must", "be", "a", "valid", "target", "from", "target_list", "mirror", "type", "must", "be", "sync", "or", "async", "slave_resource_name", "would", "be", "the", "slav...
train
https://github.com/IBM/pyxcli/blob/7d8ece1dcc16f50246740a447aa81b94a0dbced4/pyxcli/mirroring/cg_recovery_manager.py#L105-L118
IBM/pyxcli
pyxcli/mirroring/cg_recovery_manager.py
CGRecoveryManager.get_cg_volumes
def get_cg_volumes(self, group_id): """ return all non snapshots volumes in cg """ for volume in self.xcli_client.cmd.vol_list(cg=group_id): if volume.snapshot_of == '': yield volume.name
python
def get_cg_volumes(self, group_id): """ return all non snapshots volumes in cg """ for volume in self.xcli_client.cmd.vol_list(cg=group_id): if volume.snapshot_of == '': yield volume.name
[ "def", "get_cg_volumes", "(", "self", ",", "group_id", ")", ":", "for", "volume", "in", "self", ".", "xcli_client", ".", "cmd", ".", "vol_list", "(", "cg", "=", "group_id", ")", ":", "if", "volume", ".", "snapshot_of", "==", "''", ":", "yield", "volume...
return all non snapshots volumes in cg
[ "return", "all", "non", "snapshots", "volumes", "in", "cg" ]
train
https://github.com/IBM/pyxcli/blob/7d8ece1dcc16f50246740a447aa81b94a0dbced4/pyxcli/mirroring/cg_recovery_manager.py#L206-L210
IBM/pyxcli
pyxcli/transports.py
SocketTransport._certificate_required
def _certificate_required(cls, hostname, port=XCLI_DEFAULT_PORT, ca_certs=None, validate=None): ''' returns true if connection should verify certificate ''' if not ca_certs: return False xlog.debug("CONNECT SSL %s:%s, cert_file=%s", ...
python
def _certificate_required(cls, hostname, port=XCLI_DEFAULT_PORT, ca_certs=None, validate=None): ''' returns true if connection should verify certificate ''' if not ca_certs: return False xlog.debug("CONNECT SSL %s:%s, cert_file=%s", ...
[ "def", "_certificate_required", "(", "cls", ",", "hostname", ",", "port", "=", "XCLI_DEFAULT_PORT", ",", "ca_certs", "=", "None", ",", "validate", "=", "None", ")", ":", "if", "not", "ca_certs", ":", "return", "False", "xlog", ".", "debug", "(", "\"CONNECT...
returns true if connection should verify certificate
[ "returns", "true", "if", "connection", "should", "verify", "certificate" ]
train
https://github.com/IBM/pyxcli/blob/7d8ece1dcc16f50246740a447aa81b94a0dbced4/pyxcli/transports.py#L161-L180
aioworkers/aioworkers
aioworkers/core/formatter.py
JsonFormatter.add_converter
def add_converter(cls, klass, conv, score=0): """ Add converter :param klass: class or str :param conv: callable :param score: :return: """ if isinstance(klass, str): klass = import_name(klass) item = klass, conv, score cls.converters.a...
python
def add_converter(cls, klass, conv, score=0): """ Add converter :param klass: class or str :param conv: callable :param score: :return: """ if isinstance(klass, str): klass = import_name(klass) item = klass, conv, score cls.converters.a...
[ "def", "add_converter", "(", "cls", ",", "klass", ",", "conv", ",", "score", "=", "0", ")", ":", "if", "isinstance", "(", "klass", ",", "str", ")", ":", "klass", "=", "import_name", "(", "klass", ")", "item", "=", "klass", ",", "conv", ",", "score"...
Add converter :param klass: class or str :param conv: callable :param score: :return:
[ "Add", "converter", ":", "param", "klass", ":", "class", "or", "str", ":", "param", "conv", ":", "callable", ":", "param", "score", ":", ":", "return", ":" ]
train
https://github.com/aioworkers/aioworkers/blob/94caa5584a75bae1cee6c8c7a24667bff9cefa90/aioworkers/core/formatter.py#L183-L195
IBM/pyxcli
pyxcli/response.py
_populate_bunch_with_element
def _populate_bunch_with_element(element): """ Helper function to recursively populates a Bunch from an XML tree. Returns leaf XML elements as a simple value, branch elements are returned as Bunches containing their subelements as value or recursively generated Bunch members. """ if 'value' ...
python
def _populate_bunch_with_element(element): """ Helper function to recursively populates a Bunch from an XML tree. Returns leaf XML elements as a simple value, branch elements are returned as Bunches containing their subelements as value or recursively generated Bunch members. """ if 'value' ...
[ "def", "_populate_bunch_with_element", "(", "element", ")", ":", "if", "'value'", "in", "element", ".", "attrib", ":", "return", "element", ".", "get", "(", "'value'", ")", "current_bunch", "=", "Bunch", "(", ")", "if", "element", ".", "get", "(", "'id'", ...
Helper function to recursively populates a Bunch from an XML tree. Returns leaf XML elements as a simple value, branch elements are returned as Bunches containing their subelements as value or recursively generated Bunch members.
[ "Helper", "function", "to", "recursively", "populates", "a", "Bunch", "from", "an", "XML", "tree", ".", "Returns", "leaf", "XML", "elements", "as", "a", "simple", "value", "branch", "elements", "are", "returned", "as", "Bunches", "containing", "their", "subele...
train
https://github.com/IBM/pyxcli/blob/7d8ece1dcc16f50246740a447aa81b94a0dbced4/pyxcli/response.py#L122-L138
IBM/pyxcli
pyxcli/response.py
XCLIResponse.all
def all(self, element_type=None, response_path=None): """ Generates Bunches, each representing a single subelement of the response. If an element_type is requested, only elements whose tag matches the element_type are returned. If the response has no subelements (for example, in ...
python
def all(self, element_type=None, response_path=None): """ Generates Bunches, each representing a single subelement of the response. If an element_type is requested, only elements whose tag matches the element_type are returned. If the response has no subelements (for example, in ...
[ "def", "all", "(", "self", ",", "element_type", "=", "None", ",", "response_path", "=", "None", ")", ":", "path", "=", "self", ".", "RETURN_PATH", "if", "response_path", "is", "not", "None", ":", "path", "+=", "\"/\"", "+", "response_path", "response_eleme...
Generates Bunches, each representing a single subelement of the response. If an element_type is requested, only elements whose tag matches the element_type are returned. If the response has no subelements (for example, in a <return>-less command), yields None.
[ "Generates", "Bunches", "each", "representing", "a", "single", "subelement", "of", "the", "response", ".", "If", "an", "element_type", "is", "requested", "only", "elements", "whose", "tag", "matches", "the", "element_type", "are", "returned", ".", "If", "the", ...
train
https://github.com/IBM/pyxcli/blob/7d8ece1dcc16f50246740a447aa81b94a0dbced4/pyxcli/response.py#L57-L72
IBM/pyxcli
pyxcli/response.py
XCLIResponse.as_single_element
def as_single_element(self): """ Processes the response as a single-element response, like config_get or system_counters_get. If there is more then one element in the response or no elements this raises a ResponseError """ if self.as_return_etree is None: ...
python
def as_single_element(self): """ Processes the response as a single-element response, like config_get or system_counters_get. If there is more then one element in the response or no elements this raises a ResponseError """ if self.as_return_etree is None: ...
[ "def", "as_single_element", "(", "self", ")", ":", "if", "self", ".", "as_return_etree", "is", "None", ":", "return", "None", "if", "len", "(", "self", ".", "as_return_etree", ".", "getchildren", "(", ")", ")", "==", "1", ":", "return", "_populate_bunch_wi...
Processes the response as a single-element response, like config_get or system_counters_get. If there is more then one element in the response or no elements this raises a ResponseError
[ "Processes", "the", "response", "as", "a", "single", "-", "element", "response", "like", "config_get", "or", "system_counters_get", ".", "If", "there", "is", "more", "then", "one", "element", "in", "the", "response", "or", "no", "elements", "this", "raises", ...
train
https://github.com/IBM/pyxcli/blob/7d8ece1dcc16f50246740a447aa81b94a0dbced4/pyxcli/response.py#L75-L87
khazhyk/osuapi
osuapi/flags.py
Flags.enabled_flags
def enabled_flags(self): """Return the objects for each individual set flag.""" if not self.value: yield self.__flags_members__[0] return val = self.value while val: lowest_bit = val & -val val ^= lowest_bit yield self.__flags_...
python
def enabled_flags(self): """Return the objects for each individual set flag.""" if not self.value: yield self.__flags_members__[0] return val = self.value while val: lowest_bit = val & -val val ^= lowest_bit yield self.__flags_...
[ "def", "enabled_flags", "(", "self", ")", ":", "if", "not", "self", ".", "value", ":", "yield", "self", ".", "__flags_members__", "[", "0", "]", "return", "val", "=", "self", ".", "value", "while", "val", ":", "lowest_bit", "=", "val", "&", "-", "val...
Return the objects for each individual set flag.
[ "Return", "the", "objects", "for", "each", "individual", "set", "flag", "." ]
train
https://github.com/khazhyk/osuapi/blob/e46a76dc7c1f43e7ce63ab83ab7162ab5c3930ec/osuapi/flags.py#L78-L88
khazhyk/osuapi
osuapi/flags.py
Flags.contains_any
def contains_any(self, other): """Check if any flags are set. (OsuMod.Hidden | OsuMod.HardRock) in flags # Check if either hidden or hardrock are enabled. OsuMod.keyMod in flags # Check if any keymod is enabled. """ return self.value == other.value or self.value & other.value
python
def contains_any(self, other): """Check if any flags are set. (OsuMod.Hidden | OsuMod.HardRock) in flags # Check if either hidden or hardrock are enabled. OsuMod.keyMod in flags # Check if any keymod is enabled. """ return self.value == other.value or self.value & other.value
[ "def", "contains_any", "(", "self", ",", "other", ")", ":", "return", "self", ".", "value", "==", "other", ".", "value", "or", "self", ".", "value", "&", "other", ".", "value" ]
Check if any flags are set. (OsuMod.Hidden | OsuMod.HardRock) in flags # Check if either hidden or hardrock are enabled. OsuMod.keyMod in flags # Check if any keymod is enabled.
[ "Check", "if", "any", "flags", "are", "set", "." ]
train
https://github.com/khazhyk/osuapi/blob/e46a76dc7c1f43e7ce63ab83ab7162ab5c3930ec/osuapi/flags.py#L90-L96
ianlini/bistiming
bistiming/multistopwatch.py
MultiStopwatch.get_percentage
def get_percentage(self): """Get the cumulative time percentage of each stopwatch (including the current split). Returns ------- cumulative_elapsed_time_percentage : List[float] """ cumulative_elapsed_time = self.get_cumulative_elapsed_time() sum_elapsed_time = s...
python
def get_percentage(self): """Get the cumulative time percentage of each stopwatch (including the current split). Returns ------- cumulative_elapsed_time_percentage : List[float] """ cumulative_elapsed_time = self.get_cumulative_elapsed_time() sum_elapsed_time = s...
[ "def", "get_percentage", "(", "self", ")", ":", "cumulative_elapsed_time", "=", "self", ".", "get_cumulative_elapsed_time", "(", ")", "sum_elapsed_time", "=", "sum", "(", "cumulative_elapsed_time", ",", "datetime", ".", "timedelta", "(", ")", ")", "if", "not", "...
Get the cumulative time percentage of each stopwatch (including the current split). Returns ------- cumulative_elapsed_time_percentage : List[float]
[ "Get", "the", "cumulative", "time", "percentage", "of", "each", "stopwatch", "(", "including", "the", "current", "split", ")", "." ]
train
https://github.com/ianlini/bistiming/blob/46a78ec647723c3516fc4fc73f2619ab41f647f2/bistiming/multistopwatch.py#L42-L53
ianlini/bistiming
bistiming/multistopwatch.py
MultiStopwatch.get_mean_per_split
def get_mean_per_split(self): """Get the mean elapsed time per split of each stopwatch (excluding the current split). Returns ------- mean_elapsed_time_per_split : List[datetime.timedelta] """ return [div_timedelta(sum(stopwatch.split_elapsed_time, datetime.timedelta()),...
python
def get_mean_per_split(self): """Get the mean elapsed time per split of each stopwatch (excluding the current split). Returns ------- mean_elapsed_time_per_split : List[datetime.timedelta] """ return [div_timedelta(sum(stopwatch.split_elapsed_time, datetime.timedelta()),...
[ "def", "get_mean_per_split", "(", "self", ")", ":", "return", "[", "div_timedelta", "(", "sum", "(", "stopwatch", ".", "split_elapsed_time", ",", "datetime", ".", "timedelta", "(", ")", ")", ",", "len", "(", "stopwatch", ".", "split_elapsed_time", ")", ")", ...
Get the mean elapsed time per split of each stopwatch (excluding the current split). Returns ------- mean_elapsed_time_per_split : List[datetime.timedelta]
[ "Get", "the", "mean", "elapsed", "time", "per", "split", "of", "each", "stopwatch", "(", "excluding", "the", "current", "split", ")", "." ]
train
https://github.com/ianlini/bistiming/blob/46a78ec647723c3516fc4fc73f2619ab41f647f2/bistiming/multistopwatch.py#L64-L74
ianlini/bistiming
bistiming/multistopwatch.py
MultiStopwatch.get_statistics
def get_statistics(self): """Get all statistics as a dictionary. Returns ------- statistics : Dict[str, List] """ return { 'cumulative_elapsed_time': self.get_cumulative_elapsed_time(), 'percentage': self.get_percentage(), 'n_splits': ...
python
def get_statistics(self): """Get all statistics as a dictionary. Returns ------- statistics : Dict[str, List] """ return { 'cumulative_elapsed_time': self.get_cumulative_elapsed_time(), 'percentage': self.get_percentage(), 'n_splits': ...
[ "def", "get_statistics", "(", "self", ")", ":", "return", "{", "'cumulative_elapsed_time'", ":", "self", ".", "get_cumulative_elapsed_time", "(", ")", ",", "'percentage'", ":", "self", ".", "get_percentage", "(", ")", ",", "'n_splits'", ":", "self", ".", "get_...
Get all statistics as a dictionary. Returns ------- statistics : Dict[str, List]
[ "Get", "all", "statistics", "as", "a", "dictionary", "." ]
train
https://github.com/ianlini/bistiming/blob/46a78ec647723c3516fc4fc73f2619ab41f647f2/bistiming/multistopwatch.py#L76-L88
KyleJamesWalker/yamlsettings
yamlsettings/extensions/base.py
YamlSettingsExtension.conform_query
def conform_query(cls, query): """Converts the query string from a target uri, uses cls.default_query to populate default arguments. :param query: Unparsed query string :type query: urllib.parse.unsplit(uri).query :returns: Dictionary of parsed values, everything in cls.default_...
python
def conform_query(cls, query): """Converts the query string from a target uri, uses cls.default_query to populate default arguments. :param query: Unparsed query string :type query: urllib.parse.unsplit(uri).query :returns: Dictionary of parsed values, everything in cls.default_...
[ "def", "conform_query", "(", "cls", ",", "query", ")", ":", "query", "=", "parse_qs", "(", "query", ",", "keep_blank_values", "=", "True", ")", "# Load yaml of passed values", "for", "key", ",", "vals", "in", "query", ".", "items", "(", ")", ":", "# Multip...
Converts the query string from a target uri, uses cls.default_query to populate default arguments. :param query: Unparsed query string :type query: urllib.parse.unsplit(uri).query :returns: Dictionary of parsed values, everything in cls.default_query will be set if not passe...
[ "Converts", "the", "query", "string", "from", "a", "target", "uri", "uses", "cls", ".", "default_query", "to", "populate", "default", "arguments", "." ]
train
https://github.com/KyleJamesWalker/yamlsettings/blob/ddd7df2ca995ddf191b24c4d35e9dd28186e4535/yamlsettings/extensions/base.py#L15-L38
KyleJamesWalker/yamlsettings
yamlsettings/extensions/base.py
YamlSettingsExtension.load_target
def load_target(cls, scheme, path, fragment, username, password, hostname, port, query, load_method, **kwargs): """Override this method to use values from the parsed uri to initialize the expected target. """ raise NotImplementedError("load_target...
python
def load_target(cls, scheme, path, fragment, username, password, hostname, port, query, load_method, **kwargs): """Override this method to use values from the parsed uri to initialize the expected target. """ raise NotImplementedError("load_target...
[ "def", "load_target", "(", "cls", ",", "scheme", ",", "path", ",", "fragment", ",", "username", ",", "password", ",", "hostname", ",", "port", ",", "query", ",", "load_method", ",", "*", "*", "kwargs", ")", ":", "raise", "NotImplementedError", "(", "\"lo...
Override this method to use values from the parsed uri to initialize the expected target.
[ "Override", "this", "method", "to", "use", "values", "from", "the", "parsed", "uri", "to", "initialize", "the", "expected", "target", "." ]
train
https://github.com/KyleJamesWalker/yamlsettings/blob/ddd7df2ca995ddf191b24c4d35e9dd28186e4535/yamlsettings/extensions/base.py#L41-L48
lqez/hog
hog/hog.py
hog
def hog(concurrency, requests, limit, timeout, params, paramfile, headers, headerfile, method, url): '''Sending multiple `HTTP` requests `ON` `GREEN` thread''' params = parse_from_list_and_file(params, paramfile) headers = parse_from_list_and_file(headers, headerfile) # Running information ...
python
def hog(concurrency, requests, limit, timeout, params, paramfile, headers, headerfile, method, url): '''Sending multiple `HTTP` requests `ON` `GREEN` thread''' params = parse_from_list_and_file(params, paramfile) headers = parse_from_list_and_file(headers, headerfile) # Running information ...
[ "def", "hog", "(", "concurrency", ",", "requests", ",", "limit", ",", "timeout", ",", "params", ",", "paramfile", ",", "headers", ",", "headerfile", ",", "method", ",", "url", ")", ":", "params", "=", "parse_from_list_and_file", "(", "params", ",", "paramf...
Sending multiple `HTTP` requests `ON` `GREEN` thread
[ "Sending", "multiple", "HTTP", "requests", "ON", "GREEN", "thread" ]
train
https://github.com/lqez/hog/blob/c88038a56a829015ab3d10119d6533d9b8d4784e/hog/hog.py#L200-L220
JarryShaw/DictDumper
src/plist.py
PLIST._append_value
def _append_value(self, value, _file, _name): """Call this function to write contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file * _name - str, name of current content dict """ _tabs = '\t' * self._tctr ...
python
def _append_value(self, value, _file, _name): """Call this function to write contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file * _name - str, name of current content dict """ _tabs = '\t' * self._tctr ...
[ "def", "_append_value", "(", "self", ",", "value", ",", "_file", ",", "_name", ")", ":", "_tabs", "=", "'\\t'", "*", "self", ".", "_tctr", "_keys", "=", "'{tabs}<key>{name}</key>\\n'", ".", "format", "(", "tabs", "=", "_tabs", ",", "name", "=", "_name", ...
Call this function to write contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file * _name - str, name of current content dict
[ "Call", "this", "function", "to", "write", "contents", "." ]
train
https://github.com/JarryShaw/DictDumper/blob/430efcfdff18bb2421c3f27059ff94c93e621483/src/plist.py#L151-L165
JarryShaw/DictDumper
src/plist.py
PLIST._append_array
def _append_array(self, value, _file): """Call this function to write array contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ _tabs = '\t' * self._tctr _labs = '{tabs}<array>\n'.format(tabs=_tabs) ...
python
def _append_array(self, value, _file): """Call this function to write array contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ _tabs = '\t' * self._tctr _labs = '{tabs}<array>\n'.format(tabs=_tabs) ...
[ "def", "_append_array", "(", "self", ",", "value", ",", "_file", ")", ":", "_tabs", "=", "'\\t'", "*", "self", ".", "_tctr", "_labs", "=", "'{tabs}<array>\\n'", ".", "format", "(", "tabs", "=", "_tabs", ")", "_file", ".", "write", "(", "_labs", ")", ...
Call this function to write array contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file
[ "Call", "this", "function", "to", "write", "array", "contents", "." ]
train
https://github.com/JarryShaw/DictDumper/blob/430efcfdff18bb2421c3f27059ff94c93e621483/src/plist.py#L167-L190
JarryShaw/DictDumper
src/plist.py
PLIST._append_dict
def _append_dict(self, value, _file): """Call this function to write dict contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ _tabs = '\t' * self._tctr _labs = '{tabs}<dict>\n'.format(tabs=_tabs) _f...
python
def _append_dict(self, value, _file): """Call this function to write dict contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ _tabs = '\t' * self._tctr _labs = '{tabs}<dict>\n'.format(tabs=_tabs) _f...
[ "def", "_append_dict", "(", "self", ",", "value", ",", "_file", ")", ":", "_tabs", "=", "'\\t'", "*", "self", ".", "_tctr", "_labs", "=", "'{tabs}<dict>\\n'", ".", "format", "(", "tabs", "=", "_tabs", ")", "_file", ".", "write", "(", "_labs", ")", "s...
Call this function to write dict contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file
[ "Call", "this", "function", "to", "write", "dict", "contents", "." ]
train
https://github.com/JarryShaw/DictDumper/blob/430efcfdff18bb2421c3f27059ff94c93e621483/src/plist.py#L192-L220
JarryShaw/DictDumper
src/plist.py
PLIST._append_data
def _append_data(self, value, _file): """Call this function to write data contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ # binascii.b2a_base64(value) -> plistlib.Data # binascii.a2b_base64(Data) -> val...
python
def _append_data(self, value, _file): """Call this function to write data contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ # binascii.b2a_base64(value) -> plistlib.Data # binascii.a2b_base64(Data) -> val...
[ "def", "_append_data", "(", "self", ",", "value", ",", "_file", ")", ":", "# binascii.b2a_base64(value) -> plistlib.Data", "# binascii.a2b_base64(Data) -> value(bytes)", "_tabs", "=", "'\\t'", "*", "self", ".", "_tctr", "_text", "=", "base64", ".", "b64encode", "(", ...
Call this function to write data contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file
[ "Call", "this", "function", "to", "write", "data", "contents", "." ]
train
https://github.com/JarryShaw/DictDumper/blob/430efcfdff18bb2421c3f27059ff94c93e621483/src/plist.py#L235-L262
JarryShaw/DictDumper
src/plist.py
PLIST._append_date
def _append_date(self, value, _file): """Call this function to write date contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ _tabs = '\t' * self._tctr _text = value.strftime('%Y-%m-%dT%H:%M:%S.%fZ') ...
python
def _append_date(self, value, _file): """Call this function to write date contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ _tabs = '\t' * self._tctr _text = value.strftime('%Y-%m-%dT%H:%M:%S.%fZ') ...
[ "def", "_append_date", "(", "self", ",", "value", ",", "_file", ")", ":", "_tabs", "=", "'\\t'", "*", "self", ".", "_tctr", "_text", "=", "value", ".", "strftime", "(", "'%Y-%m-%dT%H:%M:%S.%fZ'", ")", "_labs", "=", "'{tabs}<date>{text}</date>\\n'", ".", "for...
Call this function to write date contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file
[ "Call", "this", "function", "to", "write", "date", "contents", "." ]
train
https://github.com/JarryShaw/DictDumper/blob/430efcfdff18bb2421c3f27059ff94c93e621483/src/plist.py#L264-L275
JarryShaw/DictDumper
src/plist.py
PLIST._append_integer
def _append_integer(self, value, _file): """Call this function to write integer contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ _tabs = '\t' * self._tctr _text = value _labs = '{tabs}<integer>{t...
python
def _append_integer(self, value, _file): """Call this function to write integer contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ _tabs = '\t' * self._tctr _text = value _labs = '{tabs}<integer>{t...
[ "def", "_append_integer", "(", "self", ",", "value", ",", "_file", ")", ":", "_tabs", "=", "'\\t'", "*", "self", ".", "_tctr", "_text", "=", "value", "_labs", "=", "'{tabs}<integer>{text}</integer>\\n'", ".", "format", "(", "tabs", "=", "_tabs", ",", "text...
Call this function to write integer contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file
[ "Call", "this", "function", "to", "write", "integer", "contents", "." ]
train
https://github.com/JarryShaw/DictDumper/blob/430efcfdff18bb2421c3f27059ff94c93e621483/src/plist.py#L277-L288
undertherain/pycontextfree
site/plugins/copy_pics/copy_pics.py
CopyPics.register_output_name
def register_output_name(self, input_folder, rel_name, rel_output_name): """Register proper and improper file mappings.""" self.improper_input_file_mapping[rel_name].add(rel_output_name) self.proper_input_file_mapping[os.path.join(input_folder, rel_name)] = rel_output_name self.proper_in...
python
def register_output_name(self, input_folder, rel_name, rel_output_name): """Register proper and improper file mappings.""" self.improper_input_file_mapping[rel_name].add(rel_output_name) self.proper_input_file_mapping[os.path.join(input_folder, rel_name)] = rel_output_name self.proper_in...
[ "def", "register_output_name", "(", "self", ",", "input_folder", ",", "rel_name", ",", "rel_output_name", ")", ":", "self", ".", "improper_input_file_mapping", "[", "rel_name", "]", ".", "add", "(", "rel_output_name", ")", "self", ".", "proper_input_file_mapping", ...
Register proper and improper file mappings.
[ "Register", "proper", "and", "improper", "file", "mappings", "." ]
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/site/plugins/copy_pics/copy_pics.py#L25-L29
KyleJamesWalker/yamlsettings
yamlsettings/extensions/registry.py
ExtensionRegistry._discover
def _discover(self): """Find and install all extensions""" for ep in pkg_resources.iter_entry_points('yamlsettings10'): ext = ep.load() if callable(ext): ext = ext() self.add(ext)
python
def _discover(self): """Find and install all extensions""" for ep in pkg_resources.iter_entry_points('yamlsettings10'): ext = ep.load() if callable(ext): ext = ext() self.add(ext)
[ "def", "_discover", "(", "self", ")", ":", "for", "ep", "in", "pkg_resources", ".", "iter_entry_points", "(", "'yamlsettings10'", ")", ":", "ext", "=", "ep", ".", "load", "(", ")", "if", "callable", "(", "ext", ")", ":", "ext", "=", "ext", "(", ")", ...
Find and install all extensions
[ "Find", "and", "install", "all", "extensions" ]
train
https://github.com/KyleJamesWalker/yamlsettings/blob/ddd7df2ca995ddf191b24c4d35e9dd28186e4535/yamlsettings/extensions/registry.py#L39-L45
KyleJamesWalker/yamlsettings
yamlsettings/extensions/registry.py
ExtensionRegistry.get_extension
def get_extension(self, protocol): """Retrieve extension for the given protocol :param protocol: name of the protocol :type protocol: string :raises NoProtocolError: no extension registered for protocol """ if protocol not in self.registry: raise NoProtocolE...
python
def get_extension(self, protocol): """Retrieve extension for the given protocol :param protocol: name of the protocol :type protocol: string :raises NoProtocolError: no extension registered for protocol """ if protocol not in self.registry: raise NoProtocolE...
[ "def", "get_extension", "(", "self", ",", "protocol", ")", ":", "if", "protocol", "not", "in", "self", ".", "registry", ":", "raise", "NoProtocolError", "(", "\"No protocol for %s\"", "%", "protocol", ")", "index", "=", "self", ".", "registry", "[", "protoco...
Retrieve extension for the given protocol :param protocol: name of the protocol :type protocol: string :raises NoProtocolError: no extension registered for protocol
[ "Retrieve", "extension", "for", "the", "given", "protocol" ]
train
https://github.com/KyleJamesWalker/yamlsettings/blob/ddd7df2ca995ddf191b24c4d35e9dd28186e4535/yamlsettings/extensions/registry.py#L47-L58
KyleJamesWalker/yamlsettings
yamlsettings/extensions/registry.py
ExtensionRegistry.add
def add(self, extension): """Adds an extension to the registry :param extension: Extension object :type extension: yamlsettings.extensions.base.YamlSettingsExtension """ index = len(self.extensions) self.extensions[index] = extension for protocol in extension.pr...
python
def add(self, extension): """Adds an extension to the registry :param extension: Extension object :type extension: yamlsettings.extensions.base.YamlSettingsExtension """ index = len(self.extensions) self.extensions[index] = extension for protocol in extension.pr...
[ "def", "add", "(", "self", ",", "extension", ")", ":", "index", "=", "len", "(", "self", ".", "extensions", ")", "self", ".", "extensions", "[", "index", "]", "=", "extension", "for", "protocol", "in", "extension", ".", "protocols", ":", "self", ".", ...
Adds an extension to the registry :param extension: Extension object :type extension: yamlsettings.extensions.base.YamlSettingsExtension
[ "Adds", "an", "extension", "to", "the", "registry" ]
train
https://github.com/KyleJamesWalker/yamlsettings/blob/ddd7df2ca995ddf191b24c4d35e9dd28186e4535/yamlsettings/extensions/registry.py#L60-L70
KyleJamesWalker/yamlsettings
yamlsettings/extensions/registry.py
ExtensionRegistry._load_first
def _load_first(self, target_uris, load_method, **kwargs): """Load first yamldict target found in uri list. :param target_uris: Uris to try and open :param load_method: load callback :type target_uri: list or string :type load_method: callback :returns: yamldict ...
python
def _load_first(self, target_uris, load_method, **kwargs): """Load first yamldict target found in uri list. :param target_uris: Uris to try and open :param load_method: load callback :type target_uri: list or string :type load_method: callback :returns: yamldict ...
[ "def", "_load_first", "(", "self", ",", "target_uris", ",", "load_method", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "target_uris", ",", "string_types", ")", ":", "target_uris", "=", "[", "target_uris", "]", "# TODO: Move the list logic into th...
Load first yamldict target found in uri list. :param target_uris: Uris to try and open :param load_method: load callback :type target_uri: list or string :type load_method: callback :returns: yamldict
[ "Load", "first", "yamldict", "target", "found", "in", "uri", "list", "." ]
train
https://github.com/KyleJamesWalker/yamlsettings/blob/ddd7df2ca995ddf191b24c4d35e9dd28186e4535/yamlsettings/extensions/registry.py#L72-L112
KyleJamesWalker/yamlsettings
yamlsettings/extensions/registry.py
ExtensionRegistry.load
def load(self, target_uris, fields=None, **kwargs): """Load first yamldict target found in uri. :param target_uris: Uris to try and open :param fields: Fields to filter. Default: None :type target_uri: list or string :type fields: list :returns: yamldict """ ...
python
def load(self, target_uris, fields=None, **kwargs): """Load first yamldict target found in uri. :param target_uris: Uris to try and open :param fields: Fields to filter. Default: None :type target_uri: list or string :type fields: list :returns: yamldict """ ...
[ "def", "load", "(", "self", ",", "target_uris", ",", "fields", "=", "None", ",", "*", "*", "kwargs", ")", ":", "yaml_dict", "=", "self", ".", "_load_first", "(", "target_uris", ",", "yamlsettings", ".", "yamldict", ".", "load", ",", "*", "*", "kwargs",...
Load first yamldict target found in uri. :param target_uris: Uris to try and open :param fields: Fields to filter. Default: None :type target_uri: list or string :type fields: list :returns: yamldict
[ "Load", "first", "yamldict", "target", "found", "in", "uri", "." ]
train
https://github.com/KyleJamesWalker/yamlsettings/blob/ddd7df2ca995ddf191b24c4d35e9dd28186e4535/yamlsettings/extensions/registry.py#L114-L133
KyleJamesWalker/yamlsettings
yamlsettings/extensions/registry.py
ExtensionRegistry.load_all
def load_all(self, target_uris, **kwargs): ''' Load *all* YAML settings from a list of file paths given. - File paths in the list gets the priority by their orders of the list. ''' yaml_series = self._load_first( target_uris, yamlsettings.yamldict.loa...
python
def load_all(self, target_uris, **kwargs): ''' Load *all* YAML settings from a list of file paths given. - File paths in the list gets the priority by their orders of the list. ''' yaml_series = self._load_first( target_uris, yamlsettings.yamldict.loa...
[ "def", "load_all", "(", "self", ",", "target_uris", ",", "*", "*", "kwargs", ")", ":", "yaml_series", "=", "self", ".", "_load_first", "(", "target_uris", ",", "yamlsettings", ".", "yamldict", ".", "load_all", ",", "*", "*", "kwargs", ")", "yaml_dicts", ...
Load *all* YAML settings from a list of file paths given. - File paths in the list gets the priority by their orders of the list.
[ "Load", "*", "all", "*", "YAML", "settings", "from", "a", "list", "of", "file", "paths", "given", "." ]
train
https://github.com/KyleJamesWalker/yamlsettings/blob/ddd7df2ca995ddf191b24c4d35e9dd28186e4535/yamlsettings/extensions/registry.py#L135-L149
KyleJamesWalker/yamlsettings
yamlsettings/yamldict.py
load_all
def load_all(stream): """ Parse all YAML documents in a stream and produce corresponding YAMLDict objects. """ loader = YAMLDictLoader(stream) try: while loader.check_data(): yield loader.get_data() finally: loader.dispose()
python
def load_all(stream): """ Parse all YAML documents in a stream and produce corresponding YAMLDict objects. """ loader = YAMLDictLoader(stream) try: while loader.check_data(): yield loader.get_data() finally: loader.dispose()
[ "def", "load_all", "(", "stream", ")", ":", "loader", "=", "YAMLDictLoader", "(", "stream", ")", "try", ":", "while", "loader", ".", "check_data", "(", ")", ":", "yield", "loader", ".", "get_data", "(", ")", "finally", ":", "loader", ".", "dispose", "(...
Parse all YAML documents in a stream and produce corresponding YAMLDict objects.
[ "Parse", "all", "YAML", "documents", "in", "a", "stream", "and", "produce", "corresponding", "YAMLDict", "objects", "." ]
train
https://github.com/KyleJamesWalker/yamlsettings/blob/ddd7df2ca995ddf191b24c4d35e9dd28186e4535/yamlsettings/yamldict.py#L192-L202
KyleJamesWalker/yamlsettings
yamlsettings/yamldict.py
dump
def dump(data, stream=None, **kwargs): """ Serialize YAMLDict into a YAML stream. If stream is None, return the produced string instead. """ return yaml.dump_all( [data], stream=stream, Dumper=YAMLDictDumper, **kwargs )
python
def dump(data, stream=None, **kwargs): """ Serialize YAMLDict into a YAML stream. If stream is None, return the produced string instead. """ return yaml.dump_all( [data], stream=stream, Dumper=YAMLDictDumper, **kwargs )
[ "def", "dump", "(", "data", ",", "stream", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "yaml", ".", "dump_all", "(", "[", "data", "]", ",", "stream", "=", "stream", ",", "Dumper", "=", "YAMLDictDumper", ",", "*", "*", "kwargs", ")" ]
Serialize YAMLDict into a YAML stream. If stream is None, return the produced string instead.
[ "Serialize", "YAMLDict", "into", "a", "YAML", "stream", ".", "If", "stream", "is", "None", "return", "the", "produced", "string", "instead", "." ]
train
https://github.com/KyleJamesWalker/yamlsettings/blob/ddd7df2ca995ddf191b24c4d35e9dd28186e4535/yamlsettings/yamldict.py#L263-L273
KyleJamesWalker/yamlsettings
yamlsettings/yamldict.py
dump_all
def dump_all(data_list, stream=None, **kwargs): """ Serialize YAMLDict into a YAML stream. If stream is None, return the produced string instead. """ return yaml.dump_all( data_list, stream=stream, Dumper=YAMLDictDumper, **kwargs )
python
def dump_all(data_list, stream=None, **kwargs): """ Serialize YAMLDict into a YAML stream. If stream is None, return the produced string instead. """ return yaml.dump_all( data_list, stream=stream, Dumper=YAMLDictDumper, **kwargs )
[ "def", "dump_all", "(", "data_list", ",", "stream", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "yaml", ".", "dump_all", "(", "data_list", ",", "stream", "=", "stream", ",", "Dumper", "=", "YAMLDictDumper", ",", "*", "*", "kwargs", ")" ]
Serialize YAMLDict into a YAML stream. If stream is None, return the produced string instead.
[ "Serialize", "YAMLDict", "into", "a", "YAML", "stream", ".", "If", "stream", "is", "None", "return", "the", "produced", "string", "instead", "." ]
train
https://github.com/KyleJamesWalker/yamlsettings/blob/ddd7df2ca995ddf191b24c4d35e9dd28186e4535/yamlsettings/yamldict.py#L276-L286
KyleJamesWalker/yamlsettings
yamlsettings/yamldict.py
YAMLDict.traverse
def traverse(self, callback): ''' Traverse through all keys and values (in-order) and replace keys and values with the return values from the callback function. ''' def _traverse_node(path, node, callback): ret_val = callback(path, node) if ret_val...
python
def traverse(self, callback): ''' Traverse through all keys and values (in-order) and replace keys and values with the return values from the callback function. ''' def _traverse_node(path, node, callback): ret_val = callback(path, node) if ret_val...
[ "def", "traverse", "(", "self", ",", "callback", ")", ":", "def", "_traverse_node", "(", "path", ",", "node", ",", "callback", ")", ":", "ret_val", "=", "callback", "(", "path", ",", "node", ")", "if", "ret_val", "is", "not", "None", ":", "# replace no...
Traverse through all keys and values (in-order) and replace keys and values with the return values from the callback function.
[ "Traverse", "through", "all", "keys", "and", "values", "(", "in", "-", "order", ")", "and", "replace", "keys", "and", "values", "with", "the", "return", "values", "from", "the", "callback", "function", "." ]
train
https://github.com/KyleJamesWalker/yamlsettings/blob/ddd7df2ca995ddf191b24c4d35e9dd28186e4535/yamlsettings/yamldict.py#L46-L69
KyleJamesWalker/yamlsettings
yamlsettings/yamldict.py
YAMLDict.update
def update(self, yaml_dict): ''' Update the content (i.e. keys and values) with yaml_dict. ''' def _update_node(base_node, update_node): if isinstance(update_node, YAMLDict) or \ isinstance(update_node, dict): if not (isinstance(base_node, YAMLDict...
python
def update(self, yaml_dict): ''' Update the content (i.e. keys and values) with yaml_dict. ''' def _update_node(base_node, update_node): if isinstance(update_node, YAMLDict) or \ isinstance(update_node, dict): if not (isinstance(base_node, YAMLDict...
[ "def", "update", "(", "self", ",", "yaml_dict", ")", ":", "def", "_update_node", "(", "base_node", ",", "update_node", ")", ":", "if", "isinstance", "(", "update_node", ",", "YAMLDict", ")", "or", "isinstance", "(", "update_node", ",", "dict", ")", ":", ...
Update the content (i.e. keys and values) with yaml_dict.
[ "Update", "the", "content", "(", "i", ".", "e", ".", "keys", "and", "values", ")", "with", "yaml_dict", "." ]
train
https://github.com/KyleJamesWalker/yamlsettings/blob/ddd7df2ca995ddf191b24c4d35e9dd28186e4535/yamlsettings/yamldict.py#L71-L101
KyleJamesWalker/yamlsettings
yamlsettings/yamldict.py
YAMLDict.rebase
def rebase(self, yaml_dict): ''' Use yaml_dict as self's new base and update with existing reverse of update. ''' base = yaml_dict.clone() base.update(self) self.clear() self.update(base)
python
def rebase(self, yaml_dict): ''' Use yaml_dict as self's new base and update with existing reverse of update. ''' base = yaml_dict.clone() base.update(self) self.clear() self.update(base)
[ "def", "rebase", "(", "self", ",", "yaml_dict", ")", ":", "base", "=", "yaml_dict", ".", "clone", "(", ")", "base", ".", "update", "(", "self", ")", "self", ".", "clear", "(", ")", "self", ".", "update", "(", "base", ")" ]
Use yaml_dict as self's new base and update with existing reverse of update.
[ "Use", "yaml_dict", "as", "self", "s", "new", "base", "and", "update", "with", "existing", "reverse", "of", "update", "." ]
train
https://github.com/KyleJamesWalker/yamlsettings/blob/ddd7df2ca995ddf191b24c4d35e9dd28186e4535/yamlsettings/yamldict.py#L110-L117
KyleJamesWalker/yamlsettings
yamlsettings/yamldict.py
YAMLDict.limit
def limit(self, keys): ''' Remove all keys other than the keys specified. ''' if not isinstance(keys, list) and not isinstance(keys, tuple): keys = [keys] remove_keys = [k for k in self.keys() if k not in keys] for k in remove_keys: self.pop(k)
python
def limit(self, keys): ''' Remove all keys other than the keys specified. ''' if not isinstance(keys, list) and not isinstance(keys, tuple): keys = [keys] remove_keys = [k for k in self.keys() if k not in keys] for k in remove_keys: self.pop(k)
[ "def", "limit", "(", "self", ",", "keys", ")", ":", "if", "not", "isinstance", "(", "keys", ",", "list", ")", "and", "not", "isinstance", "(", "keys", ",", "tuple", ")", ":", "keys", "=", "[", "keys", "]", "remove_keys", "=", "[", "k", "for", "k"...
Remove all keys other than the keys specified.
[ "Remove", "all", "keys", "other", "than", "the", "keys", "specified", "." ]
train
https://github.com/KyleJamesWalker/yamlsettings/blob/ddd7df2ca995ddf191b24c4d35e9dd28186e4535/yamlsettings/yamldict.py#L119-L126
KyleJamesWalker/yamlsettings
yamlsettings/helpers.py
save
def save(yaml_dict, filepath): ''' Save YAML settings to the specified file path. ''' yamldict.dump(yaml_dict, open(filepath, 'w'), default_flow_style=False)
python
def save(yaml_dict, filepath): ''' Save YAML settings to the specified file path. ''' yamldict.dump(yaml_dict, open(filepath, 'w'), default_flow_style=False)
[ "def", "save", "(", "yaml_dict", ",", "filepath", ")", ":", "yamldict", ".", "dump", "(", "yaml_dict", ",", "open", "(", "filepath", ",", "'w'", ")", ",", "default_flow_style", "=", "False", ")" ]
Save YAML settings to the specified file path.
[ "Save", "YAML", "settings", "to", "the", "specified", "file", "path", "." ]
train
https://github.com/KyleJamesWalker/yamlsettings/blob/ddd7df2ca995ddf191b24c4d35e9dd28186e4535/yamlsettings/helpers.py#L13-L17
KyleJamesWalker/yamlsettings
yamlsettings/helpers.py
save_all
def save_all(yaml_dicts, filepath): ''' Save *all* YAML settings to the specified file path. ''' yamldict.dump_all(yaml_dicts, open(filepath, 'w'), default_flow_style=False)
python
def save_all(yaml_dicts, filepath): ''' Save *all* YAML settings to the specified file path. ''' yamldict.dump_all(yaml_dicts, open(filepath, 'w'), default_flow_style=False)
[ "def", "save_all", "(", "yaml_dicts", ",", "filepath", ")", ":", "yamldict", ".", "dump_all", "(", "yaml_dicts", ",", "open", "(", "filepath", ",", "'w'", ")", ",", "default_flow_style", "=", "False", ")" ]
Save *all* YAML settings to the specified file path.
[ "Save", "*", "all", "*", "YAML", "settings", "to", "the", "specified", "file", "path", "." ]
train
https://github.com/KyleJamesWalker/yamlsettings/blob/ddd7df2ca995ddf191b24c4d35e9dd28186e4535/yamlsettings/helpers.py#L20-L25
KyleJamesWalker/yamlsettings
yamlsettings/helpers.py
update_from_file
def update_from_file(yaml_dict, filepaths): ''' Override YAML settings with loaded values from filepaths. - File paths in the list gets the priority by their orders of the list. ''' # load YAML settings with only fields in yaml_dict yaml_dict.update(registry.load(filepaths, list(yaml_dict))...
python
def update_from_file(yaml_dict, filepaths): ''' Override YAML settings with loaded values from filepaths. - File paths in the list gets the priority by their orders of the list. ''' # load YAML settings with only fields in yaml_dict yaml_dict.update(registry.load(filepaths, list(yaml_dict))...
[ "def", "update_from_file", "(", "yaml_dict", ",", "filepaths", ")", ":", "# load YAML settings with only fields in yaml_dict", "yaml_dict", ".", "update", "(", "registry", ".", "load", "(", "filepaths", ",", "list", "(", "yaml_dict", ")", ")", ")" ]
Override YAML settings with loaded values from filepaths. - File paths in the list gets the priority by their orders of the list.
[ "Override", "YAML", "settings", "with", "loaded", "values", "from", "filepaths", "." ]
train
https://github.com/KyleJamesWalker/yamlsettings/blob/ddd7df2ca995ddf191b24c4d35e9dd28186e4535/yamlsettings/helpers.py#L28-L35
KyleJamesWalker/yamlsettings
yamlsettings/helpers.py
update_from_env
def update_from_env(yaml_dict, prefix=None): ''' Override YAML settings with values from the environment variables. - The letter '_' is delimit the hierarchy of the YAML settings such that the value of 'config.databases.local' will be overridden by CONFIG_DATABASES_LOCAL. ''' ...
python
def update_from_env(yaml_dict, prefix=None): ''' Override YAML settings with values from the environment variables. - The letter '_' is delimit the hierarchy of the YAML settings such that the value of 'config.databases.local' will be overridden by CONFIG_DATABASES_LOCAL. ''' ...
[ "def", "update_from_env", "(", "yaml_dict", ",", "prefix", "=", "None", ")", ":", "prefix", "=", "prefix", "or", "\"\"", "def", "_set_env_var", "(", "path", ",", "node", ")", ":", "env_path", "=", "\"{0}{1}{2}\"", ".", "format", "(", "prefix", ".", "uppe...
Override YAML settings with values from the environment variables. - The letter '_' is delimit the hierarchy of the YAML settings such that the value of 'config.databases.local' will be overridden by CONFIG_DATABASES_LOCAL.
[ "Override", "YAML", "settings", "with", "values", "from", "the", "environment", "variables", "." ]
train
https://github.com/KyleJamesWalker/yamlsettings/blob/ddd7df2ca995ddf191b24c4d35e9dd28186e4535/yamlsettings/helpers.py#L38-L63
undertherain/pycontextfree
contextfree/shapes.py
circle
def circle(rad=0.5): """Draw a circle""" _ctx = _state["ctx"] _ctx.arc(0, 0, rad, 0, 2 * math.pi) _ctx.set_line_width(0) _ctx.stroke_preserve() # _ctx.set_source_rgb(0.3, 0.4, 0.6) _ctx.fill()
python
def circle(rad=0.5): """Draw a circle""" _ctx = _state["ctx"] _ctx.arc(0, 0, rad, 0, 2 * math.pi) _ctx.set_line_width(0) _ctx.stroke_preserve() # _ctx.set_source_rgb(0.3, 0.4, 0.6) _ctx.fill()
[ "def", "circle", "(", "rad", "=", "0.5", ")", ":", "_ctx", "=", "_state", "[", "\"ctx\"", "]", "_ctx", ".", "arc", "(", "0", ",", "0", ",", "rad", ",", "0", ",", "2", "*", "math", ".", "pi", ")", "_ctx", ".", "set_line_width", "(", "0", ")", ...
Draw a circle
[ "Draw", "a", "circle" ]
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/contextfree/shapes.py#L7-L14
undertherain/pycontextfree
contextfree/shapes.py
line
def line(x, y, width=0.1): """Draw a line""" ctx = _state["ctx"] ctx.move_to(0, 0) ctx.line_to(x, y) ctx.close_path() # _ctx.set_source_rgb (0.3, 0.2, 0.5) ctx.set_line_width(width) ctx.stroke()
python
def line(x, y, width=0.1): """Draw a line""" ctx = _state["ctx"] ctx.move_to(0, 0) ctx.line_to(x, y) ctx.close_path() # _ctx.set_source_rgb (0.3, 0.2, 0.5) ctx.set_line_width(width) ctx.stroke()
[ "def", "line", "(", "x", ",", "y", ",", "width", "=", "0.1", ")", ":", "ctx", "=", "_state", "[", "\"ctx\"", "]", "ctx", ".", "move_to", "(", "0", ",", "0", ")", "ctx", ".", "line_to", "(", "x", ",", "y", ")", "ctx", ".", "close_path", "(", ...
Draw a line
[ "Draw", "a", "line" ]
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/contextfree/shapes.py#L17-L25
undertherain/pycontextfree
contextfree/shapes.py
triangle
def triangle(rad=0.5): """Draw a triangle""" # half_height = math.sqrt(3) * side / 6 # half_height = side / 2 ctx = _state["ctx"] side = 3 * rad / math.sqrt(3) ctx.move_to(0, -rad / 2) ctx.line_to(-side / 2, -rad / 2) ctx.line_to(0, rad) ctx.line_to(side / 2, -rad / 2) ctx.close_...
python
def triangle(rad=0.5): """Draw a triangle""" # half_height = math.sqrt(3) * side / 6 # half_height = side / 2 ctx = _state["ctx"] side = 3 * rad / math.sqrt(3) ctx.move_to(0, -rad / 2) ctx.line_to(-side / 2, -rad / 2) ctx.line_to(0, rad) ctx.line_to(side / 2, -rad / 2) ctx.close_...
[ "def", "triangle", "(", "rad", "=", "0.5", ")", ":", "# half_height = math.sqrt(3) * side / 6", "# half_height = side / 2", "ctx", "=", "_state", "[", "\"ctx\"", "]", "side", "=", "3", "*", "rad", "/", "math", ".", "sqrt", "(", "3", ")", "ctx", ".", "move_...
Draw a triangle
[ "Draw", "a", "triangle" ]
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/contextfree/shapes.py#L28-L39
undertherain/pycontextfree
contextfree/shapes.py
box
def box(side=1): """Draw a box""" half_side = side / 2 _state["ctx"].rectangle(-half_side, -half_side, side, side) _state["ctx"].fill()
python
def box(side=1): """Draw a box""" half_side = side / 2 _state["ctx"].rectangle(-half_side, -half_side, side, side) _state["ctx"].fill()
[ "def", "box", "(", "side", "=", "1", ")", ":", "half_side", "=", "side", "/", "2", "_state", "[", "\"ctx\"", "]", ".", "rectangle", "(", "-", "half_side", ",", "-", "half_side", ",", "side", ",", "side", ")", "_state", "[", "\"ctx\"", "]", ".", "...
Draw a box
[ "Draw", "a", "box" ]
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/contextfree/shapes.py#L42-L46
JarryShaw/DictDumper
src/dumper.py
Dumper._dump_header
def _dump_header(self): """Initially dump file heads and tails.""" with open(self._file, 'w') as _file: _file.write(self._hsrt) self._sptr = _file.tell() _file.write(self._hend)
python
def _dump_header(self): """Initially dump file heads and tails.""" with open(self._file, 'w') as _file: _file.write(self._hsrt) self._sptr = _file.tell() _file.write(self._hend)
[ "def", "_dump_header", "(", "self", ")", ":", "with", "open", "(", "self", ".", "_file", ",", "'w'", ")", "as", "_file", ":", "_file", ".", "write", "(", "self", ".", "_hsrt", ")", "self", ".", "_sptr", "=", "_file", ".", "tell", "(", ")", "_file...
Initially dump file heads and tails.
[ "Initially", "dump", "file", "heads", "and", "tails", "." ]
train
https://github.com/JarryShaw/DictDumper/blob/430efcfdff18bb2421c3f27059ff94c93e621483/src/dumper.py#L116-L121
undertherain/pycontextfree
setup_boilerplate.py
find_version
def find_version( package_name: str, version_module_name: str = '_version', version_variable_name: str = 'VERSION') -> str: """Simulate behaviour of "from package_name._version import VERSION", and return VERSION.""" version_module = importlib.import_module( '{}.{}'.format(package_name.r...
python
def find_version( package_name: str, version_module_name: str = '_version', version_variable_name: str = 'VERSION') -> str: """Simulate behaviour of "from package_name._version import VERSION", and return VERSION.""" version_module = importlib.import_module( '{}.{}'.format(package_name.r...
[ "def", "find_version", "(", "package_name", ":", "str", ",", "version_module_name", ":", "str", "=", "'_version'", ",", "version_variable_name", ":", "str", "=", "'VERSION'", ")", "->", "str", ":", "version_module", "=", "importlib", ".", "import_module", "(", ...
Simulate behaviour of "from package_name._version import VERSION", and return VERSION.
[ "Simulate", "behaviour", "of", "from", "package_name", ".", "_version", "import", "VERSION", "and", "return", "VERSION", "." ]
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/setup_boilerplate.py#L50-L56
undertherain/pycontextfree
setup_boilerplate.py
find_packages
def find_packages(root_directory: str = '.') -> t.List[str]: """Find packages to pack.""" exclude = ['test*', 'test.*'] if ('bdist_wheel' in sys.argv or 'bdist' in sys.argv) else [] packages_list = setuptools.find_packages(root_directory, exclude=exclude) return packages_list
python
def find_packages(root_directory: str = '.') -> t.List[str]: """Find packages to pack.""" exclude = ['test*', 'test.*'] if ('bdist_wheel' in sys.argv or 'bdist' in sys.argv) else [] packages_list = setuptools.find_packages(root_directory, exclude=exclude) return packages_list
[ "def", "find_packages", "(", "root_directory", ":", "str", "=", "'.'", ")", "->", "t", ".", "List", "[", "str", "]", ":", "exclude", "=", "[", "'test*'", ",", "'test.*'", "]", "if", "(", "'bdist_wheel'", "in", "sys", ".", "argv", "or", "'bdist'", "in...
Find packages to pack.
[ "Find", "packages", "to", "pack", "." ]
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/setup_boilerplate.py#L59-L63
undertherain/pycontextfree
setup_boilerplate.py
parse_requirements
def parse_requirements( requirements_path: str = 'requirements.txt') -> t.List[str]: """Read contents of requirements.txt file and return data from its relevant lines. Only non-empty and non-comment lines are relevant. """ requirements = [] with HERE.joinpath(requirements_path).open() as re...
python
def parse_requirements( requirements_path: str = 'requirements.txt') -> t.List[str]: """Read contents of requirements.txt file and return data from its relevant lines. Only non-empty and non-comment lines are relevant. """ requirements = [] with HERE.joinpath(requirements_path).open() as re...
[ "def", "parse_requirements", "(", "requirements_path", ":", "str", "=", "'requirements.txt'", ")", "->", "t", ".", "List", "[", "str", "]", ":", "requirements", "=", "[", "]", "with", "HERE", ".", "joinpath", "(", "requirements_path", ")", ".", "open", "("...
Read contents of requirements.txt file and return data from its relevant lines. Only non-empty and non-comment lines are relevant.
[ "Read", "contents", "of", "requirements", ".", "txt", "file", "and", "return", "data", "from", "its", "relevant", "lines", "." ]
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/setup_boilerplate.py#L66-L78
undertherain/pycontextfree
setup_boilerplate.py
partition_version_classifiers
def partition_version_classifiers( classifiers: t.Sequence[str], version_prefix: str = 'Programming Language :: Python :: ', only_suffix: str = ' :: Only') -> t.Tuple[t.List[str], t.List[str]]: """Find version number classifiers in given list and partition them into 2 groups.""" versions_min, ve...
python
def partition_version_classifiers( classifiers: t.Sequence[str], version_prefix: str = 'Programming Language :: Python :: ', only_suffix: str = ' :: Only') -> t.Tuple[t.List[str], t.List[str]]: """Find version number classifiers in given list and partition them into 2 groups.""" versions_min, ve...
[ "def", "partition_version_classifiers", "(", "classifiers", ":", "t", ".", "Sequence", "[", "str", "]", ",", "version_prefix", ":", "str", "=", "'Programming Language :: Python :: '", ",", "only_suffix", ":", "str", "=", "' :: Only'", ")", "->", "t", ".", "Tuple...
Find version number classifiers in given list and partition them into 2 groups.
[ "Find", "version", "number", "classifiers", "in", "given", "list", "and", "partition", "them", "into", "2", "groups", "." ]
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/setup_boilerplate.py#L81-L96
undertherain/pycontextfree
setup_boilerplate.py
find_required_python_version
def find_required_python_version( classifiers: t.Sequence[str], version_prefix: str = 'Programming Language :: Python :: ', only_suffix: str = ' :: Only') -> t.Optional[str]: """Determine the minimum required Python version.""" versions_min, versions_only = partition_version_classifiers( ...
python
def find_required_python_version( classifiers: t.Sequence[str], version_prefix: str = 'Programming Language :: Python :: ', only_suffix: str = ' :: Only') -> t.Optional[str]: """Determine the minimum required Python version.""" versions_min, versions_only = partition_version_classifiers( ...
[ "def", "find_required_python_version", "(", "classifiers", ":", "t", ".", "Sequence", "[", "str", "]", ",", "version_prefix", ":", "str", "=", "'Programming Language :: Python :: '", ",", "only_suffix", ":", "str", "=", "' :: Only'", ")", "->", "t", ".", "Option...
Determine the minimum required Python version.
[ "Determine", "the", "minimum", "required", "Python", "version", "." ]
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/setup_boilerplate.py#L99-L126
undertherain/pycontextfree
setup_boilerplate.py
parse_rst
def parse_rst(text: str) -> docutils.nodes.document: """Parse text assuming it's an RST markup.""" parser = docutils.parsers.rst.Parser() components = (docutils.parsers.rst.Parser,) settings = docutils.frontend.OptionParser(components=components).get_default_values() document = docutils.utils.new_do...
python
def parse_rst(text: str) -> docutils.nodes.document: """Parse text assuming it's an RST markup.""" parser = docutils.parsers.rst.Parser() components = (docutils.parsers.rst.Parser,) settings = docutils.frontend.OptionParser(components=components).get_default_values() document = docutils.utils.new_do...
[ "def", "parse_rst", "(", "text", ":", "str", ")", "->", "docutils", ".", "nodes", ".", "document", ":", "parser", "=", "docutils", ".", "parsers", ".", "rst", ".", "Parser", "(", ")", "components", "=", "(", "docutils", ".", "parsers", ".", "rst", "....
Parse text assuming it's an RST markup.
[ "Parse", "text", "assuming", "it", "s", "an", "RST", "markup", "." ]
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/setup_boilerplate.py#L129-L136
undertherain/pycontextfree
setup_boilerplate.py
resolve_relative_rst_links
def resolve_relative_rst_links(text: str, base_link: str): """Resolve all relative links in a given RST document. All links of form `link`_ become `link <base_link/link>`_. """ document = parse_rst(text) visitor = SimpleRefCounter(document) document.walk(visitor) for target in visitor.refer...
python
def resolve_relative_rst_links(text: str, base_link: str): """Resolve all relative links in a given RST document. All links of form `link`_ become `link <base_link/link>`_. """ document = parse_rst(text) visitor = SimpleRefCounter(document) document.walk(visitor) for target in visitor.refer...
[ "def", "resolve_relative_rst_links", "(", "text", ":", "str", ",", "base_link", ":", "str", ")", ":", "document", "=", "parse_rst", "(", "text", ")", "visitor", "=", "SimpleRefCounter", "(", "document", ")", "document", ".", "walk", "(", "visitor", ")", "f...
Resolve all relative links in a given RST document. All links of form `link`_ become `link <base_link/link>`_.
[ "Resolve", "all", "relative", "links", "in", "a", "given", "RST", "document", "." ]
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/setup_boilerplate.py#L175-L191
undertherain/pycontextfree
setup_boilerplate.py
SimpleRefCounter.visit_reference
def visit_reference(self, node: docutils.nodes.reference) -> None: """Called for "reference" nodes.""" # if len(node.children) != 1 or not isinstance(node.children[0], docutils.nodes.Text) \ # or not all(_ in node.attributes for _ in ('name', 'refuri')): # return path...
python
def visit_reference(self, node: docutils.nodes.reference) -> None: """Called for "reference" nodes.""" # if len(node.children) != 1 or not isinstance(node.children[0], docutils.nodes.Text) \ # or not all(_ in node.attributes for _ in ('name', 'refuri')): # return path...
[ "def", "visit_reference", "(", "self", ",", "node", ":", "docutils", ".", "nodes", ".", "reference", ")", "->", "None", ":", "# if len(node.children) != 1 or not isinstance(node.children[0], docutils.nodes.Text) \\", "# or not all(_ in node.attributes for _ in ('name', 'ref...
Called for "reference" nodes.
[ "Called", "for", "reference", "nodes", "." ]
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/setup_boilerplate.py#L147-L168
undertherain/pycontextfree
setup_boilerplate.py
Package.try_fields
def try_fields(cls, *names) -> t.Optional[t.Any]: """Return first existing of given class field names.""" for name in names: if hasattr(cls, name): return getattr(cls, name) raise AttributeError((cls, names))
python
def try_fields(cls, *names) -> t.Optional[t.Any]: """Return first existing of given class field names.""" for name in names: if hasattr(cls, name): return getattr(cls, name) raise AttributeError((cls, names))
[ "def", "try_fields", "(", "cls", ",", "*", "names", ")", "->", "t", ".", "Optional", "[", "t", ".", "Any", "]", ":", "for", "name", "in", "names", ":", "if", "hasattr", "(", "cls", ",", "name", ")", ":", "return", "getattr", "(", "cls", ",", "n...
Return first existing of given class field names.
[ "Return", "first", "existing", "of", "given", "class", "field", "names", "." ]
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/setup_boilerplate.py#L249-L254
undertherain/pycontextfree
setup_boilerplate.py
Package.parse_readme
def parse_readme(cls, readme_path: str = 'README.rst', encoding: str = 'utf-8') -> str: """Parse readme and resolve relative links in it if it is feasible. Links are resolved if readme is in rst format and the package is hosted on GitHub. """ with HERE.joinpath(readme_path).open(encodin...
python
def parse_readme(cls, readme_path: str = 'README.rst', encoding: str = 'utf-8') -> str: """Parse readme and resolve relative links in it if it is feasible. Links are resolved if readme is in rst format and the package is hosted on GitHub. """ with HERE.joinpath(readme_path).open(encodin...
[ "def", "parse_readme", "(", "cls", ",", "readme_path", ":", "str", "=", "'README.rst'", ",", "encoding", ":", "str", "=", "'utf-8'", ")", "->", "str", ":", "with", "HERE", ".", "joinpath", "(", "readme_path", ")", ".", "open", "(", "encoding", "=", "en...
Parse readme and resolve relative links in it if it is feasible. Links are resolved if readme is in rst format and the package is hosted on GitHub.
[ "Parse", "readme", "and", "resolve", "relative", "links", "in", "it", "if", "it", "is", "feasible", "." ]
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/setup_boilerplate.py#L257-L269
undertherain/pycontextfree
setup_boilerplate.py
Package.prepare
def prepare(cls) -> None: """Fill in possibly missing package metadata.""" if cls.version is None: cls.version = find_version(cls.name) if cls.long_description is None: cls.long_description = cls.parse_readme() if cls.packages is None: cls.packages = f...
python
def prepare(cls) -> None: """Fill in possibly missing package metadata.""" if cls.version is None: cls.version = find_version(cls.name) if cls.long_description is None: cls.long_description = cls.parse_readme() if cls.packages is None: cls.packages = f...
[ "def", "prepare", "(", "cls", ")", "->", "None", ":", "if", "cls", ".", "version", "is", "None", ":", "cls", ".", "version", "=", "find_version", "(", "cls", ".", "name", ")", "if", "cls", ".", "long_description", "is", "None", ":", "cls", ".", "lo...
Fill in possibly missing package metadata.
[ "Fill", "in", "possibly", "missing", "package", "metadata", "." ]
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/setup_boilerplate.py#L272-L283
undertherain/pycontextfree
setup_boilerplate.py
Package.setup
def setup(cls) -> None: """Run setuptools.setup() with correct arguments.""" cls.prepare() setuptools.setup( name=cls.name, version=cls.version, description=cls.description, long_description=cls.long_description, url=cls.url, download_url=cls.download_url, aut...
python
def setup(cls) -> None: """Run setuptools.setup() with correct arguments.""" cls.prepare() setuptools.setup( name=cls.name, version=cls.version, description=cls.description, long_description=cls.long_description, url=cls.url, download_url=cls.download_url, aut...
[ "def", "setup", "(", "cls", ")", "->", "None", ":", "cls", ".", "prepare", "(", ")", "setuptools", ".", "setup", "(", "name", "=", "cls", ".", "name", ",", "version", "=", "cls", ".", "version", ",", "description", "=", "cls", ".", "description", "...
Run setuptools.setup() with correct arguments.
[ "Run", "setuptools", ".", "setup", "()", "with", "correct", "arguments", "." ]
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/setup_boilerplate.py#L286-L301
undertherain/pycontextfree
contextfree/core.py
surface_to_image
def surface_to_image(surface): """Renders current buffer surface to IPython image""" from IPython.display import Image buf = BytesIO() surface.write_to_png(buf) data = buf.getvalue() buf.close() return Image(data=data)
python
def surface_to_image(surface): """Renders current buffer surface to IPython image""" from IPython.display import Image buf = BytesIO() surface.write_to_png(buf) data = buf.getvalue() buf.close() return Image(data=data)
[ "def", "surface_to_image", "(", "surface", ")", ":", "from", "IPython", ".", "display", "import", "Image", "buf", "=", "BytesIO", "(", ")", "surface", ".", "write_to_png", "(", "buf", ")", "data", "=", "buf", ".", "getvalue", "(", ")", "buf", ".", "clo...
Renders current buffer surface to IPython image
[ "Renders", "current", "buffer", "surface", "to", "IPython", "image" ]
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/contextfree/core.py#L34-L41
undertherain/pycontextfree
contextfree/core.py
get_npimage
def get_npimage(transparent=False, y_origin="top"): """ Returns a WxHx[3-4] numpy array representing the RGB picture. If `transparent` is True the image is WxHx4 and represents a RGBA picture, i.e. array[i,j] is the [r,g,b,a] value of the pixel at position [i,j]. If `transparent` is false, a RGB array ...
python
def get_npimage(transparent=False, y_origin="top"): """ Returns a WxHx[3-4] numpy array representing the RGB picture. If `transparent` is True the image is WxHx4 and represents a RGBA picture, i.e. array[i,j] is the [r,g,b,a] value of the pixel at position [i,j]. If `transparent` is false, a RGB array ...
[ "def", "get_npimage", "(", "transparent", "=", "False", ",", "y_origin", "=", "\"top\"", ")", ":", "image_surface", "=", "render_record_surface", "(", ")", "img", "=", "0", "+", "np", ".", "frombuffer", "(", "image_surface", ".", "get_data", "(", ")", ",",...
Returns a WxHx[3-4] numpy array representing the RGB picture. If `transparent` is True the image is WxHx4 and represents a RGBA picture, i.e. array[i,j] is the [r,g,b,a] value of the pixel at position [i,j]. If `transparent` is false, a RGB array is returned. Parameter y_origin ("top" or "bottom") dec...
[ "Returns", "a", "WxHx", "[", "3", "-", "4", "]", "numpy", "array", "representing", "the", "RGB", "picture", "." ]
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/contextfree/core.py#L50-L66
undertherain/pycontextfree
contextfree/core.py
check_limits
def check_limits(user_rule): """Stop recursion if resolution is too low on number of components is too high """ def wrapper(*args, **kwargs): """The body of the decorator """ global _state _state["cnt_elements"] += 1 _state["depth"] += 1 matrix = _state["ctx"].get_matrix...
python
def check_limits(user_rule): """Stop recursion if resolution is too low on number of components is too high """ def wrapper(*args, **kwargs): """The body of the decorator """ global _state _state["cnt_elements"] += 1 _state["depth"] += 1 matrix = _state["ctx"].get_matrix...
[ "def", "check_limits", "(", "user_rule", ")", ":", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "\"\"\"The body of the decorator \"\"\"", "global", "_state", "_state", "[", "\"cnt_elements\"", "]", "+=", "1", "_state", "[", "\"depth\"...
Stop recursion if resolution is too low on number of components is too high
[ "Stop", "recursion", "if", "resolution", "is", "too", "low", "on", "number", "of", "components", "is", "too", "high" ]
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/contextfree/core.py#L100-L124
undertherain/pycontextfree
contextfree/core.py
init
def init(canvas_size=(512, 512), max_depth=12, face_color=None, background_color=None): """Initializes global state""" global _background_color _background_color = background_color global _ctx global cnt_elements global MAX_DEPTH global WIDTH global HEIGHT _init_state() sys.setr...
python
def init(canvas_size=(512, 512), max_depth=12, face_color=None, background_color=None): """Initializes global state""" global _background_color _background_color = background_color global _ctx global cnt_elements global MAX_DEPTH global WIDTH global HEIGHT _init_state() sys.setr...
[ "def", "init", "(", "canvas_size", "=", "(", "512", ",", "512", ")", ",", "max_depth", "=", "12", ",", "face_color", "=", "None", ",", "background_color", "=", "None", ")", ":", "global", "_background_color", "_background_color", "=", "background_color", "gl...
Initializes global state
[ "Initializes", "global", "state" ]
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/contextfree/core.py#L164-L184
undertherain/pycontextfree
contextfree/core.py
htmlcolor_to_rgb
def htmlcolor_to_rgb(str_color): """function to convert HTML-styly color string to RGB values Args: s: Color in HTML format Returns: list of three RGB color components """ if not (str_color.startswith('#') and len(str_color) == 7): raise ValueError("Bad html color format. E...
python
def htmlcolor_to_rgb(str_color): """function to convert HTML-styly color string to RGB values Args: s: Color in HTML format Returns: list of three RGB color components """ if not (str_color.startswith('#') and len(str_color) == 7): raise ValueError("Bad html color format. E...
[ "def", "htmlcolor_to_rgb", "(", "str_color", ")", ":", "if", "not", "(", "str_color", ".", "startswith", "(", "'#'", ")", "and", "len", "(", "str_color", ")", "==", "7", ")", ":", "raise", "ValueError", "(", "\"Bad html color format. Expected: '#RRGGBB' \"", "...
function to convert HTML-styly color string to RGB values Args: s: Color in HTML format Returns: list of three RGB color components
[ "function", "to", "convert", "HTML", "-", "styly", "color", "string", "to", "RGB", "values" ]
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/contextfree/core.py#L262-L274
undertherain/pycontextfree
site/plugins/pdoc/pdoc.py
CompilePdoc.compile_string
def compile_string(self, data, source_path=None, is_two_file=True, post=None, lang=None): """Compile docstrings into HTML strings, with shortcode support.""" if not is_two_file: _, data = self.split_metadata(data, None, lang) new_data, shortcodes = sc.extract_shortcodes(data) ...
python
def compile_string(self, data, source_path=None, is_two_file=True, post=None, lang=None): """Compile docstrings into HTML strings, with shortcode support.""" if not is_two_file: _, data = self.split_metadata(data, None, lang) new_data, shortcodes = sc.extract_shortcodes(data) ...
[ "def", "compile_string", "(", "self", ",", "data", ",", "source_path", "=", "None", ",", "is_two_file", "=", "True", ",", "post", "=", "None", ",", "lang", "=", "None", ")", ":", "if", "not", "is_two_file", ":", "_", ",", "data", "=", "self", ".", ...
Compile docstrings into HTML strings, with shortcode support.
[ "Compile", "docstrings", "into", "HTML", "strings", "with", "shortcode", "support", "." ]
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/site/plugins/pdoc/pdoc.py#L58-L74
undertherain/pycontextfree
site/plugins/pdoc/pdoc.py
CompilePdoc.compile
def compile(self, source, dest, is_two_file=True, post=None, lang=None): """Compile the docstring into HTML and save as dest.""" makedirs(os.path.dirname(dest)) with io.open(dest, "w+", encoding="utf8") as out_file: with io.open(source, "r", encoding="utf8") as in_file: ...
python
def compile(self, source, dest, is_two_file=True, post=None, lang=None): """Compile the docstring into HTML and save as dest.""" makedirs(os.path.dirname(dest)) with io.open(dest, "w+", encoding="utf8") as out_file: with io.open(source, "r", encoding="utf8") as in_file: ...
[ "def", "compile", "(", "self", ",", "source", ",", "dest", ",", "is_two_file", "=", "True", ",", "post", "=", "None", ",", "lang", "=", "None", ")", ":", "makedirs", "(", "os", ".", "path", ".", "dirname", "(", "dest", ")", ")", "with", "io", "."...
Compile the docstring into HTML and save as dest.
[ "Compile", "the", "docstring", "into", "HTML", "and", "save", "as", "dest", "." ]
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/site/plugins/pdoc/pdoc.py#L76-L91
undertherain/pycontextfree
site/plugins/pdoc/pdoc.py
CompilePdoc.create_post
def create_post(self, path, **kw): """Create a new post.""" content = kw.pop('content', None) onefile = kw.pop('onefile', False) # is_page is not used by create_post as of now. kw.pop('is_page', False) metadata = {} metadata.update(self.default_metadata) m...
python
def create_post(self, path, **kw): """Create a new post.""" content = kw.pop('content', None) onefile = kw.pop('onefile', False) # is_page is not used by create_post as of now. kw.pop('is_page', False) metadata = {} metadata.update(self.default_metadata) m...
[ "def", "create_post", "(", "self", ",", "path", ",", "*", "*", "kw", ")", ":", "content", "=", "kw", ".", "pop", "(", "'content'", ",", "None", ")", "onefile", "=", "kw", ".", "pop", "(", "'onefile'", ",", "False", ")", "# is_page is not used by create...
Create a new post.
[ "Create", "a", "new", "post", "." ]
train
https://github.com/undertherain/pycontextfree/blob/91505e978f6034863747c98d919ac11b029b1ac3/site/plugins/pdoc/pdoc.py#L93-L108
JarryShaw/DictDumper
src/tree.py
Tree._append_value
def _append_value(self, value, _file, _name): """Call this function to write contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file * _name - str, name of current content dict """ if self._flag: _k...
python
def _append_value(self, value, _file, _name): """Call this function to write contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file * _name - str, name of current content dict """ if self._flag: _k...
[ "def", "_append_value", "(", "self", ",", "value", ",", "_file", ",", "_name", ")", ":", "if", "self", ".", "_flag", ":", "_keys", "=", "_name", "+", "'\\n'", "else", ":", "_keys", "=", "'\\n'", "+", "_name", "+", "'\\n'", "_file", ".", "seek", "("...
Call this function to write contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file * _name - str, name of current content dict
[ "Call", "this", "function", "to", "write", "contents", "." ]
train
https://github.com/JarryShaw/DictDumper/blob/430efcfdff18bb2421c3f27059ff94c93e621483/src/tree.py#L169-L186
JarryShaw/DictDumper
src/tree.py
Tree._append_array
def _append_array(self, value, _file): """Call this function to write array contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ if not value: self._append_none(None, _file) return _...
python
def _append_array(self, value, _file): """Call this function to write array contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ if not value: self._append_none(None, _file) return _...
[ "def", "_append_array", "(", "self", ",", "value", ",", "_file", ")", ":", "if", "not", "value", ":", "self", ".", "_append_none", "(", "None", ",", "_file", ")", "return", "_bptr", "=", "''", "_tabs", "=", "''", "_tlen", "=", "len", "(", "value", ...
Call this function to write array contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file
[ "Call", "this", "function", "to", "write", "array", "contents", "." ]
train
https://github.com/JarryShaw/DictDumper/blob/430efcfdff18bb2421c3f27059ff94c93e621483/src/tree.py#L188-L219
JarryShaw/DictDumper
src/tree.py
Tree._append_branch
def _append_branch(self, value, _file): """Call this function to write branch contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ if not value: return # return self._append_none(None, _file)...
python
def _append_branch(self, value, _file): """Call this function to write branch contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ if not value: return # return self._append_none(None, _file)...
[ "def", "_append_branch", "(", "self", ",", "value", ",", "_file", ")", ":", "if", "not", "value", ":", "return", "# return self._append_none(None, _file)", "self", ".", "_tctr", "+=", "1", "_vlen", "=", "len", "(", "value", ")", "for", "(", "_vctr", ",", ...
Call this function to write branch contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file
[ "Call", "this", "function", "to", "write", "branch", "contents", "." ]
train
https://github.com/JarryShaw/DictDumper/blob/430efcfdff18bb2421c3f27059ff94c93e621483/src/tree.py#L221-L264
JarryShaw/DictDumper
src/tree.py
Tree._append_bytes
def _append_bytes(self, value, _file): """Call this function to write bytes contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ # binascii.b2a_base64(value) -> plistlib.Data # binascii.a2b_base64(Data) -> v...
python
def _append_bytes(self, value, _file): """Call this function to write bytes contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ # binascii.b2a_base64(value) -> plistlib.Data # binascii.a2b_base64(Data) -> v...
[ "def", "_append_bytes", "(", "self", ",", "value", ",", "_file", ")", ":", "# binascii.b2a_base64(value) -> plistlib.Data", "# binascii.a2b_base64(Data) -> value(bytes)", "if", "not", "value", ":", "self", ".", "_append_none", "(", "None", ",", "_file", ")", "return",...
Call this function to write bytes contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file
[ "Call", "this", "function", "to", "write", "bytes", "contents", "." ]
train
https://github.com/JarryShaw/DictDumper/blob/430efcfdff18bb2421c3f27059ff94c93e621483/src/tree.py#L282-L311
JarryShaw/DictDumper
src/tree.py
Tree._append_number
def _append_number(self, value, _file): # pylint: disable=no-self-use """Call this function to write number contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ _text = value _labs = ' {text}'.format(text=_...
python
def _append_number(self, value, _file): # pylint: disable=no-self-use """Call this function to write number contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ _text = value _labs = ' {text}'.format(text=_...
[ "def", "_append_number", "(", "self", ",", "value", ",", "_file", ")", ":", "# pylint: disable=no-self-use", "_text", "=", "value", "_labs", "=", "' {text}'", ".", "format", "(", "text", "=", "_text", ")", "_file", ".", "write", "(", "_labs", ")" ]
Call this function to write number contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file
[ "Call", "this", "function", "to", "write", "number", "contents", "." ]
train
https://github.com/JarryShaw/DictDumper/blob/430efcfdff18bb2421c3f27059ff94c93e621483/src/tree.py#L325-L335
JarryShaw/DictDumper
src/json.py
JSON._append_value
def _append_value(self, value, _file, _name): """Call this function to write contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file * _name - str, name of current content dict """ _tabs = '\t' * self._tctr ...
python
def _append_value(self, value, _file, _name): """Call this function to write contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file * _name - str, name of current content dict """ _tabs = '\t' * self._tctr ...
[ "def", "_append_value", "(", "self", ",", "value", ",", "_file", ",", "_name", ")", ":", "_tabs", "=", "'\\t'", "*", "self", ".", "_tctr", "_cmma", "=", "',\\n'", "if", "self", ".", "_vctr", "[", "self", ".", "_tctr", "]", "else", "''", "_keys", "=...
Call this function to write contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file * _name - str, name of current content dict
[ "Call", "this", "function", "to", "write", "contents", "." ]
train
https://github.com/JarryShaw/DictDumper/blob/430efcfdff18bb2421c3f27059ff94c93e621483/src/json.py#L143-L160
JarryShaw/DictDumper
src/json.py
JSON._append_array
def _append_array(self, value, _file): """Call this function to write array contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ _labs = ' [' _file.write(_labs) self._tctr += 1 for _item in...
python
def _append_array(self, value, _file): """Call this function to write array contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ _labs = ' [' _file.write(_labs) self._tctr += 1 for _item in...
[ "def", "_append_array", "(", "self", ",", "value", ",", "_file", ")", ":", "_labs", "=", "' ['", "_file", ".", "write", "(", "_labs", ")", "self", ".", "_tctr", "+=", "1", "for", "_item", "in", "value", ":", "_cmma", "=", "','", "if", "self", ".", ...
Call this function to write array contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file
[ "Call", "this", "function", "to", "write", "array", "contents", "." ]
train
https://github.com/JarryShaw/DictDumper/blob/430efcfdff18bb2421c3f27059ff94c93e621483/src/json.py#L166-L193
JarryShaw/DictDumper
src/json.py
JSON._append_object
def _append_object(self, value, _file): """Call this function to write object contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ _labs = ' {' _file.write(_labs) self._tctr += 1 for (_item,...
python
def _append_object(self, value, _file): """Call this function to write object contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ _labs = ' {' _file.write(_labs) self._tctr += 1 for (_item,...
[ "def", "_append_object", "(", "self", ",", "value", ",", "_file", ")", ":", "_labs", "=", "' {'", "_file", ".", "write", "(", "_labs", ")", "self", ".", "_tctr", "+=", "1", "for", "(", "_item", ",", "_text", ")", "in", "value", ".", "items", "(", ...
Call this function to write object contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file
[ "Call", "this", "function", "to", "write", "object", "contents", "." ]
train
https://github.com/JarryShaw/DictDumper/blob/430efcfdff18bb2421c3f27059ff94c93e621483/src/json.py#L195-L223
JarryShaw/DictDumper
src/json.py
JSON._append_string
def _append_string(self, value, _file): # pylint: disable=no-self-use """Call this function to write string contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ _text = str(value).replace('"', '\\"') _labs ...
python
def _append_string(self, value, _file): # pylint: disable=no-self-use """Call this function to write string contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ _text = str(value).replace('"', '\\"') _labs ...
[ "def", "_append_string", "(", "self", ",", "value", ",", "_file", ")", ":", "# pylint: disable=no-self-use", "_text", "=", "str", "(", "value", ")", ".", "replace", "(", "'\"'", ",", "'\\\\\"'", ")", "_labs", "=", "' \"{text}\"'", ".", "format", "(", "text...
Call this function to write string contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file
[ "Call", "this", "function", "to", "write", "string", "contents", "." ]
train
https://github.com/JarryShaw/DictDumper/blob/430efcfdff18bb2421c3f27059ff94c93e621483/src/json.py#L225-L235
JarryShaw/DictDumper
src/json.py
JSON._append_bytes
def _append_bytes(self, value, _file): # pylint: disable=no-self-use """Call this function to write bytes contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ # binascii.b2a_base64(value) -> plistlib.Data #...
python
def _append_bytes(self, value, _file): # pylint: disable=no-self-use """Call this function to write bytes contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ # binascii.b2a_base64(value) -> plistlib.Data #...
[ "def", "_append_bytes", "(", "self", ",", "value", ",", "_file", ")", ":", "# pylint: disable=no-self-use", "# binascii.b2a_base64(value) -> plistlib.Data", "# binascii.a2b_base64(Data) -> value(bytes)", "_text", "=", "' '", ".", "join", "(", "textwrap", ".", "wrap", "(",...
Call this function to write bytes contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file
[ "Call", "this", "function", "to", "write", "bytes", "contents", "." ]
train
https://github.com/JarryShaw/DictDumper/blob/430efcfdff18bb2421c3f27059ff94c93e621483/src/json.py#L237-L253
JarryShaw/DictDumper
src/json.py
JSON._append_date
def _append_date(self, value, _file): # pylint: disable=no-self-use """Call this function to write date contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ _text = value.strftime('%Y-%m-%dT%H:%M:%S.%fZ') _...
python
def _append_date(self, value, _file): # pylint: disable=no-self-use """Call this function to write date contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file """ _text = value.strftime('%Y-%m-%dT%H:%M:%S.%fZ') _...
[ "def", "_append_date", "(", "self", ",", "value", ",", "_file", ")", ":", "# pylint: disable=no-self-use", "_text", "=", "value", ".", "strftime", "(", "'%Y-%m-%dT%H:%M:%S.%fZ'", ")", "_labs", "=", "' \"{text}\"'", ".", "format", "(", "text", "=", "_text", ")"...
Call this function to write date contents. Keyword arguments: * value - dict, content to be dumped * _file - FileIO, output file
[ "Call", "this", "function", "to", "write", "date", "contents", "." ]
train
https://github.com/JarryShaw/DictDumper/blob/430efcfdff18bb2421c3f27059ff94c93e621483/src/json.py#L255-L265
ianlini/bistiming
bistiming/stopwatch.py
Stopwatch.start
def start(self, verbose=None, end_in_new_line=None): """Start the stopwatch if it is paused. If the stopwatch is already started, then nothing will happen. Parameters ---------- verbose : Optional[bool] Wether to log. If `None`, use `verbose_start` set during initia...
python
def start(self, verbose=None, end_in_new_line=None): """Start the stopwatch if it is paused. If the stopwatch is already started, then nothing will happen. Parameters ---------- verbose : Optional[bool] Wether to log. If `None`, use `verbose_start` set during initia...
[ "def", "start", "(", "self", ",", "verbose", "=", "None", ",", "end_in_new_line", "=", "None", ")", ":", "if", "self", ".", "_start_time", "is", "not", "None", "and", "self", ".", "_end_time", "is", "None", ":", "# the stopwatch is already running", "return"...
Start the stopwatch if it is paused. If the stopwatch is already started, then nothing will happen. Parameters ---------- verbose : Optional[bool] Wether to log. If `None`, use `verbose_start` set during initialization. end_in_new_line : Optional[bool]] ...
[ "Start", "the", "stopwatch", "if", "it", "is", "paused", "." ]
train
https://github.com/ianlini/bistiming/blob/46a78ec647723c3516fc4fc73f2619ab41f647f2/bistiming/stopwatch.py#L64-L91
ianlini/bistiming
bistiming/stopwatch.py
Stopwatch.pause
def pause(self): """Pause the stopwatch. If the stopwatch is already paused, nothing will happen. """ if self._end_time is not None: # the stopwatch is already paused return self._end_time = datetime.datetime.now() self._elapsed_time += self._end_...
python
def pause(self): """Pause the stopwatch. If the stopwatch is already paused, nothing will happen. """ if self._end_time is not None: # the stopwatch is already paused return self._end_time = datetime.datetime.now() self._elapsed_time += self._end_...
[ "def", "pause", "(", "self", ")", ":", "if", "self", ".", "_end_time", "is", "not", "None", ":", "# the stopwatch is already paused", "return", "self", ".", "_end_time", "=", "datetime", ".", "datetime", ".", "now", "(", ")", "self", ".", "_elapsed_time", ...
Pause the stopwatch. If the stopwatch is already paused, nothing will happen.
[ "Pause", "the", "stopwatch", "." ]
train
https://github.com/ianlini/bistiming/blob/46a78ec647723c3516fc4fc73f2619ab41f647f2/bistiming/stopwatch.py#L93-L102
ianlini/bistiming
bistiming/stopwatch.py
Stopwatch.get_elapsed_time
def get_elapsed_time(self): """Get the elapsed time of the current split. """ if self._start_time is None or self._end_time is not None: # the stopwatch is paused return self._elapsed_time return self._elapsed_time + (datetime.datetime.now() - self._start_time)
python
def get_elapsed_time(self): """Get the elapsed time of the current split. """ if self._start_time is None or self._end_time is not None: # the stopwatch is paused return self._elapsed_time return self._elapsed_time + (datetime.datetime.now() - self._start_time)
[ "def", "get_elapsed_time", "(", "self", ")", ":", "if", "self", ".", "_start_time", "is", "None", "or", "self", ".", "_end_time", "is", "not", "None", ":", "# the stopwatch is paused", "return", "self", ".", "_elapsed_time", "return", "self", ".", "_elapsed_ti...
Get the elapsed time of the current split.
[ "Get", "the", "elapsed", "time", "of", "the", "current", "split", "." ]
train
https://github.com/ianlini/bistiming/blob/46a78ec647723c3516fc4fc73f2619ab41f647f2/bistiming/stopwatch.py#L104-L110
ianlini/bistiming
bistiming/stopwatch.py
Stopwatch.split
def split(self, verbose=None, end_in_new_line=None): """Save the elapsed time of the current split and restart the stopwatch. The current elapsed time will be appended to :attr:`split_elapsed_time`. If the stopwatch is paused, then it will remain paused. Otherwise, it will continue runn...
python
def split(self, verbose=None, end_in_new_line=None): """Save the elapsed time of the current split and restart the stopwatch. The current elapsed time will be appended to :attr:`split_elapsed_time`. If the stopwatch is paused, then it will remain paused. Otherwise, it will continue runn...
[ "def", "split", "(", "self", ",", "verbose", "=", "None", ",", "end_in_new_line", "=", "None", ")", ":", "elapsed_time", "=", "self", ".", "get_elapsed_time", "(", ")", "self", ".", "split_elapsed_time", ".", "append", "(", "elapsed_time", ")", "self", "."...
Save the elapsed time of the current split and restart the stopwatch. The current elapsed time will be appended to :attr:`split_elapsed_time`. If the stopwatch is paused, then it will remain paused. Otherwise, it will continue running. Parameters ---------- verbose : Op...
[ "Save", "the", "elapsed", "time", "of", "the", "current", "split", "and", "restart", "the", "stopwatch", "." ]
train
https://github.com/ianlini/bistiming/blob/46a78ec647723c3516fc4fc73f2619ab41f647f2/bistiming/stopwatch.py#L127-L155
ianlini/bistiming
bistiming/stopwatch.py
Stopwatch.reset
def reset(self): """Reset the stopwatch. """ self._start_time = None self._end_time = None self._elapsed_time = datetime.timedelta() self._cumulative_elapsed_time = datetime.timedelta() self.split_elapsed_time = []
python
def reset(self): """Reset the stopwatch. """ self._start_time = None self._end_time = None self._elapsed_time = datetime.timedelta() self._cumulative_elapsed_time = datetime.timedelta() self.split_elapsed_time = []
[ "def", "reset", "(", "self", ")", ":", "self", ".", "_start_time", "=", "None", "self", ".", "_end_time", "=", "None", "self", ".", "_elapsed_time", "=", "datetime", ".", "timedelta", "(", ")", "self", ".", "_cumulative_elapsed_time", "=", "datetime", ".",...
Reset the stopwatch.
[ "Reset", "the", "stopwatch", "." ]
train
https://github.com/ianlini/bistiming/blob/46a78ec647723c3516fc4fc73f2619ab41f647f2/bistiming/stopwatch.py#L157-L164
OLC-Bioinformatics/ConFindr
confindr_src/wrappers/bbtools.py
bbduk_trim
def bbduk_trim(forward_in, forward_out, reverse_in='NA', reverse_out='NA', returncmd=False, **kwargs): """ Wrapper for using bbduk to quality trim reads. Contains arguments used in OLC Assembly Pipeline, but these can be overwritten by using keyword parameters. :param forward_in: Forward reads you want ...
python
def bbduk_trim(forward_in, forward_out, reverse_in='NA', reverse_out='NA', returncmd=False, **kwargs): """ Wrapper for using bbduk to quality trim reads. Contains arguments used in OLC Assembly Pipeline, but these can be overwritten by using keyword parameters. :param forward_in: Forward reads you want ...
[ "def", "bbduk_trim", "(", "forward_in", ",", "forward_out", ",", "reverse_in", "=", "'NA'", ",", "reverse_out", "=", "'NA'", ",", "returncmd", "=", "False", ",", "*", "*", "kwargs", ")", ":", "options", "=", "kwargs_to_string", "(", "kwargs", ")", "cmd", ...
Wrapper for using bbduk to quality trim reads. Contains arguments used in OLC Assembly Pipeline, but these can be overwritten by using keyword parameters. :param forward_in: Forward reads you want to quality trim. :param returncmd: If set to true, function will return the cmd string passed to subprocess as ...
[ "Wrapper", "for", "using", "bbduk", "to", "quality", "trim", "reads", ".", "Contains", "arguments", "used", "in", "OLC", "Assembly", "Pipeline", "but", "these", "can", "be", "overwritten", "by", "using", "keyword", "parameters", ".", ":", "param", "forward_in"...
train
https://github.com/OLC-Bioinformatics/ConFindr/blob/4c292617c3f270ebd5ff138cbc5a107f6d01200d/confindr_src/wrappers/bbtools.py#L59-L112
OLC-Bioinformatics/ConFindr
confindr_src/wrappers/bbtools.py
genome_size
def genome_size(peaks_file, haploid=True): """ Finds the genome size of an organsim, based on the peaks file created by kmercountexact.sh :param peaks_file: Path to peaks file created by kmercountexact. :param haploid: Set to True if organism of interest is haploid, False if not. Default True. :retu...
python
def genome_size(peaks_file, haploid=True): """ Finds the genome size of an organsim, based on the peaks file created by kmercountexact.sh :param peaks_file: Path to peaks file created by kmercountexact. :param haploid: Set to True if organism of interest is haploid, False if not. Default True. :retu...
[ "def", "genome_size", "(", "peaks_file", ",", "haploid", "=", "True", ")", ":", "size", "=", "0", "with", "open", "(", "peaks_file", ")", "as", "peaks", ":", "lines", "=", "peaks", ".", "readlines", "(", ")", "for", "line", "in", "lines", ":", "if", ...
Finds the genome size of an organsim, based on the peaks file created by kmercountexact.sh :param peaks_file: Path to peaks file created by kmercountexact. :param haploid: Set to True if organism of interest is haploid, False if not. Default True. :return: size of genome, as an int. If size could not be fou...
[ "Finds", "the", "genome", "size", "of", "an", "organsim", "based", "on", "the", "peaks", "file", "created", "by", "kmercountexact", ".", "sh", ":", "param", "peaks_file", ":", "Path", "to", "peaks", "file", "created", "by", "kmercountexact", ".", ":", "par...
train
https://github.com/OLC-Bioinformatics/ConFindr/blob/4c292617c3f270ebd5ff138cbc5a107f6d01200d/confindr_src/wrappers/bbtools.py#L372-L389