partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
User.sync
Sync this model with latest data on the saltant server. Note that in addition to returning the updated object, it also updates the existing object. Returns: :class:`saltant.models.user.User`: This user instance after syncing.
saltant/models/user.py
def sync(self): """Sync this model with latest data on the saltant server. Note that in addition to returning the updated object, it also updates the existing object. Returns: :class:`saltant.models.user.User`: This user instance after syncing. """ ...
def sync(self): """Sync this model with latest data on the saltant server. Note that in addition to returning the updated object, it also updates the existing object. Returns: :class:`saltant.models.user.User`: This user instance after syncing. """ ...
[ "Sync", "this", "model", "with", "latest", "data", "on", "the", "saltant", "server", "." ]
saltant-org/saltant-py
python
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/user.py#L35-L47
[ "def", "sync", "(", "self", ")", ":", "self", "=", "self", ".", "manager", ".", "get", "(", "username", "=", "self", ".", "username", ")", "return", "self" ]
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
train
Block.serialised
Tuple containing the contents of the Block.
mrcrowbar/blocks.py
def serialised( self ): """Tuple containing the contents of the Block.""" klass = self.__class__ return ((klass.__module__, klass.__name__), tuple( (name, field.serialise( self._field_data[name], parent=self ) ) for name, field in klass._fields.items()))
def serialised( self ): """Tuple containing the contents of the Block.""" klass = self.__class__ return ((klass.__module__, klass.__name__), tuple( (name, field.serialise( self._field_data[name], parent=self ) ) for name, field in klass._fields.items()))
[ "Tuple", "containing", "the", "contents", "of", "the", "Block", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/blocks.py#L193-L196
[ "def", "serialised", "(", "self", ")", ":", "klass", "=", "self", ".", "__class__", "return", "(", "(", "klass", ".", "__module__", ",", "klass", ".", "__name__", ")", ",", "tuple", "(", "(", "name", ",", "field", ".", "serialise", "(", "self", ".", ...
b1ed882c4555552e7656b2d84aca543184577fa3
train
Block.clone_data
Clone data from another Block. source Block instance to copy from.
mrcrowbar/blocks.py
def clone_data( self, source ): """Clone data from another Block. source Block instance to copy from. """ klass = self.__class__ assert isinstance( source, klass ) for name in klass._fields: self._field_data[name] = getattr( source, name )
def clone_data( self, source ): """Clone data from another Block. source Block instance to copy from. """ klass = self.__class__ assert isinstance( source, klass ) for name in klass._fields: self._field_data[name] = getattr( source, name )
[ "Clone", "data", "from", "another", "Block", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/blocks.py#L198-L208
[ "def", "clone_data", "(", "self", ",", "source", ")", ":", "klass", "=", "self", ".", "__class__", "assert", "isinstance", "(", "source", ",", "klass", ")", "for", "name", "in", "klass", ".", "_fields", ":", "self", ".", "_field_data", "[", "name", "]"...
b1ed882c4555552e7656b2d84aca543184577fa3
train
Block.import_data
Import data from a byte array. raw_buffer Byte array to import from.
mrcrowbar/blocks.py
def import_data( self, raw_buffer ): """Import data from a byte array. raw_buffer Byte array to import from. """ klass = self.__class__ if raw_buffer: assert common.is_bytes( raw_buffer ) # raw_buffer = memoryview( raw_buffer ) self._f...
def import_data( self, raw_buffer ): """Import data from a byte array. raw_buffer Byte array to import from. """ klass = self.__class__ if raw_buffer: assert common.is_bytes( raw_buffer ) # raw_buffer = memoryview( raw_buffer ) self._f...
[ "Import", "data", "from", "a", "byte", "array", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/blocks.py#L210-L255
[ "def", "import_data", "(", "self", ",", "raw_buffer", ")", ":", "klass", "=", "self", ".", "__class__", "if", "raw_buffer", ":", "assert", "common", ".", "is_bytes", "(", "raw_buffer", ")", "# raw_buffer = memoryview( raw_buffer )", "self", ".", "_field...
b1ed882c4555552e7656b2d84aca543184577fa3
train
Block.export_data
Export data to a byte array.
mrcrowbar/blocks.py
def export_data( self ): """Export data to a byte array.""" klass = self.__class__ output = bytearray( b'\x00'*self.get_size() ) # prevalidate all data before export. # this is important to ensure that any dependent fields # are updated beforehand, e.g. a count referenc...
def export_data( self ): """Export data to a byte array.""" klass = self.__class__ output = bytearray( b'\x00'*self.get_size() ) # prevalidate all data before export. # this is important to ensure that any dependent fields # are updated beforehand, e.g. a count referenc...
[ "Export", "data", "to", "a", "byte", "array", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/blocks.py#L258-L282
[ "def", "export_data", "(", "self", ")", ":", "klass", "=", "self", ".", "__class__", "output", "=", "bytearray", "(", "b'\\x00'", "*", "self", ".", "get_size", "(", ")", ")", "# prevalidate all data before export.", "# this is important to ensure that any dependent fi...
b1ed882c4555552e7656b2d84aca543184577fa3
train
Block.update_deps
Update dependencies on all the fields on this Block instance.
mrcrowbar/blocks.py
def update_deps( self ): """Update dependencies on all the fields on this Block instance.""" klass = self.__class__ for name in klass._fields: self.update_deps_on_field( name ) return
def update_deps( self ): """Update dependencies on all the fields on this Block instance.""" klass = self.__class__ for name in klass._fields: self.update_deps_on_field( name ) return
[ "Update", "dependencies", "on", "all", "the", "fields", "on", "this", "Block", "instance", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/blocks.py#L284-L290
[ "def", "update_deps", "(", "self", ")", ":", "klass", "=", "self", ".", "__class__", "for", "name", "in", "klass", ".", "_fields", ":", "self", ".", "update_deps_on_field", "(", "name", ")", "return" ]
b1ed882c4555552e7656b2d84aca543184577fa3
train
Block.validate
Validate all the fields on this Block instance.
mrcrowbar/blocks.py
def validate( self ): """Validate all the fields on this Block instance.""" klass = self.__class__ for name in klass._fields: self.validate_field( name ) return
def validate( self ): """Validate all the fields on this Block instance.""" klass = self.__class__ for name in klass._fields: self.validate_field( name ) return
[ "Validate", "all", "the", "fields", "on", "this", "Block", "instance", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/blocks.py#L292-L298
[ "def", "validate", "(", "self", ")", ":", "klass", "=", "self", ".", "__class__", "for", "name", "in", "klass", ".", "_fields", ":", "self", ".", "validate_field", "(", "name", ")", "return" ]
b1ed882c4555552e7656b2d84aca543184577fa3
train
Block.get_size
Get the projected size (in bytes) of the exported data from this Block instance.
mrcrowbar/blocks.py
def get_size( self ): """Get the projected size (in bytes) of the exported data from this Block instance.""" klass = self.__class__ size = 0 for name in klass._fields: size = max( size, klass._fields[name].get_end_offset( self._field_data[name], parent=self ) ) for ch...
def get_size( self ): """Get the projected size (in bytes) of the exported data from this Block instance.""" klass = self.__class__ size = 0 for name in klass._fields: size = max( size, klass._fields[name].get_end_offset( self._field_data[name], parent=self ) ) for ch...
[ "Get", "the", "projected", "size", "(", "in", "bytes", ")", "of", "the", "exported", "data", "from", "this", "Block", "instance", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/blocks.py#L300-L308
[ "def", "get_size", "(", "self", ")", ":", "klass", "=", "self", ".", "__class__", "size", "=", "0", "for", "name", "in", "klass", ".", "_fields", ":", "size", "=", "max", "(", "size", ",", "klass", ".", "_fields", "[", "name", "]", ".", "get_end_of...
b1ed882c4555552e7656b2d84aca543184577fa3
train
GADDAG.save
Save the GADDAG to file. Args: path: path to save the GADDAG to. compressed: compress the saved GADDAG using gzip. exist_ok: overwrite existing file at `path`.
gaddag/gaddag.py
def save(self, path, compressed=True, exist_ok=False): """ Save the GADDAG to file. Args: path: path to save the GADDAG to. compressed: compress the saved GADDAG using gzip. exist_ok: overwrite existing file at `path`. """ path = os.path.expan...
def save(self, path, compressed=True, exist_ok=False): """ Save the GADDAG to file. Args: path: path to save the GADDAG to. compressed: compress the saved GADDAG using gzip. exist_ok: overwrite existing file at `path`. """ path = os.path.expan...
[ "Save", "the", "GADDAG", "to", "file", "." ]
jorbas/GADDAG
python
https://github.com/jorbas/GADDAG/blob/a0ede3def715c586e1f273d96e9fc0d537cd9561/gaddag/gaddag.py#L70-L95
[ "def", "save", "(", "self", ",", "path", ",", "compressed", "=", "True", ",", "exist_ok", "=", "False", ")", ":", "path", "=", "os", ".", "path", ".", "expandvars", "(", "os", ".", "path", ".", "expanduser", "(", "path", ")", ")", "if", "os", "."...
a0ede3def715c586e1f273d96e9fc0d537cd9561
train
GADDAG.load
Load a GADDAG from file, replacing the words currently in this GADDAG. Args: path: path to saved GADDAG to be loaded.
gaddag/gaddag.py
def load(self, path): """ Load a GADDAG from file, replacing the words currently in this GADDAG. Args: path: path to saved GADDAG to be loaded. """ path = os.path.expandvars(os.path.expanduser(path)) gdg = cgaddag.gdg_load(path.encode("ascii")) if no...
def load(self, path): """ Load a GADDAG from file, replacing the words currently in this GADDAG. Args: path: path to saved GADDAG to be loaded. """ path = os.path.expandvars(os.path.expanduser(path)) gdg = cgaddag.gdg_load(path.encode("ascii")) if no...
[ "Load", "a", "GADDAG", "from", "file", "replacing", "the", "words", "currently", "in", "this", "GADDAG", "." ]
jorbas/GADDAG
python
https://github.com/jorbas/GADDAG/blob/a0ede3def715c586e1f273d96e9fc0d537cd9561/gaddag/gaddag.py#L97-L112
[ "def", "load", "(", "self", ",", "path", ")", ":", "path", "=", "os", ".", "path", ".", "expandvars", "(", "os", ".", "path", ".", "expanduser", "(", "path", ")", ")", "gdg", "=", "cgaddag", ".", "gdg_load", "(", "path", ".", "encode", "(", "\"as...
a0ede3def715c586e1f273d96e9fc0d537cd9561
train
GADDAG.starts_with
Find all words starting with a prefix. Args: prefix: A prefix to be searched for. Returns: A list of all words found.
gaddag/gaddag.py
def starts_with(self, prefix): """ Find all words starting with a prefix. Args: prefix: A prefix to be searched for. Returns: A list of all words found. """ prefix = prefix.lower() found_words = [] res = cgaddag.gdg_starts_with(s...
def starts_with(self, prefix): """ Find all words starting with a prefix. Args: prefix: A prefix to be searched for. Returns: A list of all words found. """ prefix = prefix.lower() found_words = [] res = cgaddag.gdg_starts_with(s...
[ "Find", "all", "words", "starting", "with", "a", "prefix", "." ]
jorbas/GADDAG
python
https://github.com/jorbas/GADDAG/blob/a0ede3def715c586e1f273d96e9fc0d537cd9561/gaddag/gaddag.py#L114-L136
[ "def", "starts_with", "(", "self", ",", "prefix", ")", ":", "prefix", "=", "prefix", ".", "lower", "(", ")", "found_words", "=", "[", "]", "res", "=", "cgaddag", ".", "gdg_starts_with", "(", "self", ".", "gdg", ",", "prefix", ".", "encode", "(", "enc...
a0ede3def715c586e1f273d96e9fc0d537cd9561
train
GADDAG.contains
Find all words containing a substring. Args: sub: A substring to be searched for. Returns: A list of all words found.
gaddag/gaddag.py
def contains(self, sub): """ Find all words containing a substring. Args: sub: A substring to be searched for. Returns: A list of all words found. """ sub = sub.lower() found_words = set() res = cgaddag.gdg_contains(self.gdg, sub...
def contains(self, sub): """ Find all words containing a substring. Args: sub: A substring to be searched for. Returns: A list of all words found. """ sub = sub.lower() found_words = set() res = cgaddag.gdg_contains(self.gdg, sub...
[ "Find", "all", "words", "containing", "a", "substring", "." ]
jorbas/GADDAG
python
https://github.com/jorbas/GADDAG/blob/a0ede3def715c586e1f273d96e9fc0d537cd9561/gaddag/gaddag.py#L138-L160
[ "def", "contains", "(", "self", ",", "sub", ")", ":", "sub", "=", "sub", ".", "lower", "(", ")", "found_words", "=", "set", "(", ")", "res", "=", "cgaddag", ".", "gdg_contains", "(", "self", ".", "gdg", ",", "sub", ".", "encode", "(", "encoding", ...
a0ede3def715c586e1f273d96e9fc0d537cd9561
train
GADDAG.ends_with
Find all words ending with a suffix. Args: suffix: A suffix to be searched for. Returns: A list of all words found.
gaddag/gaddag.py
def ends_with(self, suffix): """ Find all words ending with a suffix. Args: suffix: A suffix to be searched for. Returns: A list of all words found. """ suffix = suffix.lower() found_words = [] res = cgaddag.gdg_ends_with(self.gd...
def ends_with(self, suffix): """ Find all words ending with a suffix. Args: suffix: A suffix to be searched for. Returns: A list of all words found. """ suffix = suffix.lower() found_words = [] res = cgaddag.gdg_ends_with(self.gd...
[ "Find", "all", "words", "ending", "with", "a", "suffix", "." ]
jorbas/GADDAG
python
https://github.com/jorbas/GADDAG/blob/a0ede3def715c586e1f273d96e9fc0d537cd9561/gaddag/gaddag.py#L162-L184
[ "def", "ends_with", "(", "self", ",", "suffix", ")", ":", "suffix", "=", "suffix", ".", "lower", "(", ")", "found_words", "=", "[", "]", "res", "=", "cgaddag", ".", "gdg_ends_with", "(", "self", ".", "gdg", ",", "suffix", ".", "encode", "(", "encodin...
a0ede3def715c586e1f273d96e9fc0d537cd9561
train
GADDAG.add_word
Add a word to the GADDAG. Args: word: A word to be added to the GADDAG.
gaddag/gaddag.py
def add_word(self, word): """ Add a word to the GADDAG. Args: word: A word to be added to the GADDAG. """ word = word.lower() if not (word.isascii() and word.isalpha()): raise ValueError("Invalid character in word '{}'".format(word)) wor...
def add_word(self, word): """ Add a word to the GADDAG. Args: word: A word to be added to the GADDAG. """ word = word.lower() if not (word.isascii() and word.isalpha()): raise ValueError("Invalid character in word '{}'".format(word)) wor...
[ "Add", "a", "word", "to", "the", "GADDAG", "." ]
jorbas/GADDAG
python
https://github.com/jorbas/GADDAG/blob/a0ede3def715c586e1f273d96e9fc0d537cd9561/gaddag/gaddag.py#L186-L203
[ "def", "add_word", "(", "self", ",", "word", ")", ":", "word", "=", "word", ".", "lower", "(", ")", "if", "not", "(", "word", ".", "isascii", "(", ")", "and", "word", ".", "isalpha", "(", ")", ")", ":", "raise", "ValueError", "(", "\"Invalid charac...
a0ede3def715c586e1f273d96e9fc0d537cd9561
train
formatLog
Similar to format, but takes additional reserved params to promote logging best-practices :param level - severity of message - how bad is it? :param source - application context - where did it come from? :param title - brief description - what kind of event happened? :param data - additional information - what...
kayvee/kayvee.py
def formatLog(source="", level="", title="", data={}): """ Similar to format, but takes additional reserved params to promote logging best-practices :param level - severity of message - how bad is it? :param source - application context - where did it come from? :param title - brief description - what kind of ...
def formatLog(source="", level="", title="", data={}): """ Similar to format, but takes additional reserved params to promote logging best-practices :param level - severity of message - how bad is it? :param source - application context - where did it come from? :param title - brief description - what kind of ...
[ "Similar", "to", "format", "but", "takes", "additional", "reserved", "params", "to", "promote", "logging", "best", "-", "practices" ]
Clever/kayvee-python
python
https://github.com/Clever/kayvee-python/blob/9d1cc96d592148bc3bd8f11f9e6ed03255985882/kayvee/kayvee.py#L7-L26
[ "def", "formatLog", "(", "source", "=", "\"\"", ",", "level", "=", "\"\"", ",", "title", "=", "\"\"", ",", "data", "=", "{", "}", ")", ":", "# consistently output empty string for unset params, because null values differ by language", "source", "=", "\"\"", "if", ...
9d1cc96d592148bc3bd8f11f9e6ed03255985882
train
ContainerTaskType.put
Updates this task type on the saltant server. Returns: :class:`saltant.models.container_task_type.ContainerTaskType`: A task type model instance representing the task type just updated.
saltant/models/container_task_type.py
def put(self): """Updates this task type on the saltant server. Returns: :class:`saltant.models.container_task_type.ContainerTaskType`: A task type model instance representing the task type just updated. """ return self.manager.put( ...
def put(self): """Updates this task type on the saltant server. Returns: :class:`saltant.models.container_task_type.ContainerTaskType`: A task type model instance representing the task type just updated. """ return self.manager.put( ...
[ "Updates", "this", "task", "type", "on", "the", "saltant", "server", "." ]
saltant-org/saltant-py
python
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/container_task_type.py#L101-L123
[ "def", "put", "(", "self", ")", ":", "return", "self", ".", "manager", ".", "put", "(", "id", "=", "self", ".", "id", ",", "name", "=", "self", ".", "name", ",", "description", "=", "self", ".", "description", ",", "command_to_run", "=", "self", "....
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
train
ContainerTaskTypeManager.create
Create a container task type. Args: name (str): The name of the task. command_to_run (str): The command to run to execute the task. container_image (str): The container name and tag. For example, ubuntu:14.04 for Docker; and docker://ubuntu:14:04 ...
saltant/models/container_task_type.py
def create( self, name, command_to_run, container_image, container_type, description="", logs_path="", results_path="", environment_variables=None, required_arguments=None, required_arguments_default_values=None, extra_data_...
def create( self, name, command_to_run, container_image, container_type, description="", logs_path="", results_path="", environment_variables=None, required_arguments=None, required_arguments_default_values=None, extra_data_...
[ "Create", "a", "container", "task", "type", "." ]
saltant-org/saltant-py
python
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/container_task_type.py#L142-L207
[ "def", "create", "(", "self", ",", "name", ",", "command_to_run", ",", "container_image", ",", "container_type", ",", "description", "=", "\"\"", ",", "logs_path", "=", "\"\"", ",", "results_path", "=", "\"\"", ",", "environment_variables", "=", "None", ",", ...
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
train
ContainerTaskTypeManager.put
Updates a task type on the saltant server. Args: id (int): The ID of the task type. name (str): The name of the task type. description (str): The description of the task type. command_to_run (str): The command to run to execute the task. environment_v...
saltant/models/container_task_type.py
def put( self, id, name, description, command_to_run, environment_variables, required_arguments, required_arguments_default_values, logs_path, results_path, container_image, container_type, extra_data_to_put=None, ...
def put( self, id, name, description, command_to_run, environment_variables, required_arguments, required_arguments_default_values, logs_path, results_path, container_image, container_type, extra_data_to_put=None, ...
[ "Updates", "a", "task", "type", "on", "the", "saltant", "server", "." ]
saltant-org/saltant-py
python
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/container_task_type.py#L209-L273
[ "def", "put", "(", "self", ",", "id", ",", "name", ",", "description", ",", "command_to_run", ",", "environment_variables", ",", "required_arguments", ",", "required_arguments_default_values", ",", "logs_path", ",", "results_path", ",", "container_image", ",", "cont...
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
train
_strtobool
Convert a string representation of truth to true (1) or false (0). True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values are 'n', 'no', 'f', 'false', 'off', '0' and ''. Raises ValueError if 'val' is anything else.
envitro/core.py
def _strtobool(val): """Convert a string representation of truth to true (1) or false (0). True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values are 'n', 'no', 'f', 'false', 'off', '0' and ''. Raises ValueError if 'val' is anything else. """ val = val.lower() if val in ('y',...
def _strtobool(val): """Convert a string representation of truth to true (1) or false (0). True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values are 'n', 'no', 'f', 'false', 'off', '0' and ''. Raises ValueError if 'val' is anything else. """ val = val.lower() if val in ('y',...
[ "Convert", "a", "string", "representation", "of", "truth", "to", "true", "(", "1", ")", "or", "false", "(", "0", ")", "." ]
MarcMeszaros/envitro
python
https://github.com/MarcMeszaros/envitro/blob/19e925cd152c08d4db8126542afed35188cafff4/envitro/core.py#L18-L31
[ "def", "_strtobool", "(", "val", ")", ":", "val", "=", "val", ".", "lower", "(", ")", "if", "val", "in", "(", "'y'", ",", "'yes'", ",", "'t'", ",", "'true'", ",", "'on'", ",", "'1'", ")", ":", "return", "1", "elif", "val", "in", "(", "'n'", "...
19e925cd152c08d4db8126542afed35188cafff4
train
_str_to_list
Convert a string to a list with sanitization.
envitro/core.py
def _str_to_list(value, separator): """Convert a string to a list with sanitization.""" value_list = [item.strip() for item in value.split(separator)] value_list_sanitized = builtins.list(filter(None, value_list)) if len(value_list_sanitized) > 0: return value_list_sanitized else: ra...
def _str_to_list(value, separator): """Convert a string to a list with sanitization.""" value_list = [item.strip() for item in value.split(separator)] value_list_sanitized = builtins.list(filter(None, value_list)) if len(value_list_sanitized) > 0: return value_list_sanitized else: ra...
[ "Convert", "a", "string", "to", "a", "list", "with", "sanitization", "." ]
MarcMeszaros/envitro
python
https://github.com/MarcMeszaros/envitro/blob/19e925cd152c08d4db8126542afed35188cafff4/envitro/core.py#L34-L41
[ "def", "_str_to_list", "(", "value", ",", "separator", ")", ":", "value_list", "=", "[", "item", ".", "strip", "(", ")", "for", "item", "in", "value", ".", "split", "(", "separator", ")", "]", "value_list_sanitized", "=", "builtins", ".", "list", "(", ...
19e925cd152c08d4db8126542afed35188cafff4
train
write
Write a raw env value. A ``None`` value clears the environment variable. Args: name: The environment variable name value: The value to write
envitro/core.py
def write(name, value): """Write a raw env value. A ``None`` value clears the environment variable. Args: name: The environment variable name value: The value to write """ if value is not None: environ[name] = builtins.str(value) elif environ.get(name): del envi...
def write(name, value): """Write a raw env value. A ``None`` value clears the environment variable. Args: name: The environment variable name value: The value to write """ if value is not None: environ[name] = builtins.str(value) elif environ.get(name): del envi...
[ "Write", "a", "raw", "env", "value", "." ]
MarcMeszaros/envitro
python
https://github.com/MarcMeszaros/envitro/blob/19e925cd152c08d4db8126542afed35188cafff4/envitro/core.py#L53-L65
[ "def", "write", "(", "name", ",", "value", ")", ":", "if", "value", "is", "not", "None", ":", "environ", "[", "name", "]", "=", "builtins", ".", "str", "(", "value", ")", "elif", "environ", ".", "get", "(", "name", ")", ":", "del", "environ", "["...
19e925cd152c08d4db8126542afed35188cafff4
train
read
Read the raw env value. Read the raw environment variable or use the default. If the value is not found and no default is set throw an exception. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the retur...
envitro/core.py
def read(name, default=None, allow_none=False, fallback=None): """Read the raw env value. Read the raw environment variable or use the default. If the value is not found and no default is set throw an exception. Args: name: The environment variable name default: The default value to us...
def read(name, default=None, allow_none=False, fallback=None): """Read the raw env value. Read the raw environment variable or use the default. If the value is not found and no default is set throw an exception. Args: name: The environment variable name default: The default value to us...
[ "Read", "the", "raw", "env", "value", "." ]
MarcMeszaros/envitro
python
https://github.com/MarcMeszaros/envitro/blob/19e925cd152c08d4db8126542afed35188cafff4/envitro/core.py#L73-L101
[ "def", "read", "(", "name", ",", "default", "=", "None", ",", "allow_none", "=", "False", ",", "fallback", "=", "None", ")", ":", "raw_value", "=", "environ", ".", "get", "(", "name", ")", "if", "raw_value", "is", "None", "and", "fallback", "is", "no...
19e925cd152c08d4db8126542afed35188cafff4
train
str
Get a string based environment value or the default. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the return value can be `None` (i.e. optional)
envitro/core.py
def str(name, default=None, allow_none=False, fallback=None): """Get a string based environment value or the default. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the return value can be `None` (i.e. optio...
def str(name, default=None, allow_none=False, fallback=None): """Get a string based environment value or the default. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the return value can be `None` (i.e. optio...
[ "Get", "a", "string", "based", "environment", "value", "or", "the", "default", "." ]
MarcMeszaros/envitro
python
https://github.com/MarcMeszaros/envitro/blob/19e925cd152c08d4db8126542afed35188cafff4/envitro/core.py#L109-L121
[ "def", "str", "(", "name", ",", "default", "=", "None", ",", "allow_none", "=", "False", ",", "fallback", "=", "None", ")", ":", "value", "=", "read", "(", "name", ",", "default", ",", "allow_none", ",", "fallback", "=", "fallback", ")", "if", "value...
19e925cd152c08d4db8126542afed35188cafff4
train
bool
Get a boolean based environment value or the default. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the return value can be `None` (i.e. optional)
envitro/core.py
def bool(name, default=None, allow_none=False, fallback=None): """Get a boolean based environment value or the default. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the return value can be `None` (i.e. opt...
def bool(name, default=None, allow_none=False, fallback=None): """Get a boolean based environment value or the default. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the return value can be `None` (i.e. opt...
[ "Get", "a", "boolean", "based", "environment", "value", "or", "the", "default", "." ]
MarcMeszaros/envitro
python
https://github.com/MarcMeszaros/envitro/blob/19e925cd152c08d4db8126542afed35188cafff4/envitro/core.py#L124-L141
[ "def", "bool", "(", "name", ",", "default", "=", "None", ",", "allow_none", "=", "False", ",", "fallback", "=", "None", ")", ":", "value", "=", "read", "(", "name", ",", "default", ",", "allow_none", ",", "fallback", "=", "fallback", ")", "if", "isin...
19e925cd152c08d4db8126542afed35188cafff4
train
int
Get a string environment value or the default. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the return value can be `None` (i.e. optional)
envitro/core.py
def int(name, default=None, allow_none=False, fallback=None): """Get a string environment value or the default. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the return value can be `None` (i.e. optional) ...
def int(name, default=None, allow_none=False, fallback=None): """Get a string environment value or the default. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the return value can be `None` (i.e. optional) ...
[ "Get", "a", "string", "environment", "value", "or", "the", "default", "." ]
MarcMeszaros/envitro
python
https://github.com/MarcMeszaros/envitro/blob/19e925cd152c08d4db8126542afed35188cafff4/envitro/core.py#L144-L159
[ "def", "int", "(", "name", ",", "default", "=", "None", ",", "allow_none", "=", "False", ",", "fallback", "=", "None", ")", ":", "value", "=", "read", "(", "name", ",", "default", ",", "allow_none", ",", "fallback", "=", "fallback", ")", "if", "isins...
19e925cd152c08d4db8126542afed35188cafff4
train
list
Get a list of strings or the default. The individual list elements are whitespace-stripped. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the return value can be `None` (i.e. optional) separator: T...
envitro/core.py
def list(name, default=None, allow_none=False, fallback=None, separator=','): """Get a list of strings or the default. The individual list elements are whitespace-stripped. Args: name: The environment variable name default: The default value to use if no environment variable is found ...
def list(name, default=None, allow_none=False, fallback=None, separator=','): """Get a list of strings or the default. The individual list elements are whitespace-stripped. Args: name: The environment variable name default: The default value to use if no environment variable is found ...
[ "Get", "a", "list", "of", "strings", "or", "the", "default", "." ]
MarcMeszaros/envitro
python
https://github.com/MarcMeszaros/envitro/blob/19e925cd152c08d4db8126542afed35188cafff4/envitro/core.py#L180-L199
[ "def", "list", "(", "name", ",", "default", "=", "None", ",", "allow_none", "=", "False", ",", "fallback", "=", "None", ",", "separator", "=", "','", ")", ":", "value", "=", "read", "(", "name", ",", "default", ",", "allow_none", ",", "fallback", "="...
19e925cd152c08d4db8126542afed35188cafff4
train
includeme
this function adds some configuration for the application
pyramid_urireferencer/__init__.py
def includeme(config): """this function adds some configuration for the application""" config.add_route('references', '/references') _add_referencer(config.registry) config.add_view_deriver(protected_resources.protected_view) config.add_renderer('json_item', json_renderer) config.scan()
def includeme(config): """this function adds some configuration for the application""" config.add_route('references', '/references') _add_referencer(config.registry) config.add_view_deriver(protected_resources.protected_view) config.add_renderer('json_item', json_renderer) config.scan()
[ "this", "function", "adds", "some", "configuration", "for", "the", "application" ]
OnroerendErfgoed/pyramid_urireferencer
python
https://github.com/OnroerendErfgoed/pyramid_urireferencer/blob/c6ee4ba863e32ced304b9cf00f3f5b450757a29a/pyramid_urireferencer/__init__.py#L17-L23
[ "def", "includeme", "(", "config", ")", ":", "config", ".", "add_route", "(", "'references'", ",", "'/references'", ")", "_add_referencer", "(", "config", ".", "registry", ")", "config", ".", "add_view_deriver", "(", "protected_resources", ".", "protected_view", ...
c6ee4ba863e32ced304b9cf00f3f5b450757a29a
train
_add_referencer
Gets the Referencer from config and adds it to the registry.
pyramid_urireferencer/__init__.py
def _add_referencer(registry): """ Gets the Referencer from config and adds it to the registry. """ referencer = registry.queryUtility(IReferencer) if referencer is not None: return referencer ref = registry.settings['urireferencer.referencer'] url = registry.settings['urireferencer....
def _add_referencer(registry): """ Gets the Referencer from config and adds it to the registry. """ referencer = registry.queryUtility(IReferencer) if referencer is not None: return referencer ref = registry.settings['urireferencer.referencer'] url = registry.settings['urireferencer....
[ "Gets", "the", "Referencer", "from", "config", "and", "adds", "it", "to", "the", "registry", "." ]
OnroerendErfgoed/pyramid_urireferencer
python
https://github.com/OnroerendErfgoed/pyramid_urireferencer/blob/c6ee4ba863e32ced304b9cf00f3f5b450757a29a/pyramid_urireferencer/__init__.py#L26-L37
[ "def", "_add_referencer", "(", "registry", ")", ":", "referencer", "=", "registry", ".", "queryUtility", "(", "IReferencer", ")", "if", "referencer", "is", "not", "None", ":", "return", "referencer", "ref", "=", "registry", ".", "settings", "[", "'urireference...
c6ee4ba863e32ced304b9cf00f3f5b450757a29a
train
get_referencer
Get the referencer class :rtype: pyramid_urireferencer.referencer.AbstractReferencer
pyramid_urireferencer/__init__.py
def get_referencer(registry): """ Get the referencer class :rtype: pyramid_urireferencer.referencer.AbstractReferencer """ # Argument might be a config or request regis = getattr(registry, 'registry', None) if regis is None: regis = registry return regis.queryUtility(IReferencer...
def get_referencer(registry): """ Get the referencer class :rtype: pyramid_urireferencer.referencer.AbstractReferencer """ # Argument might be a config or request regis = getattr(registry, 'registry', None) if regis is None: regis = registry return regis.queryUtility(IReferencer...
[ "Get", "the", "referencer", "class" ]
OnroerendErfgoed/pyramid_urireferencer
python
https://github.com/OnroerendErfgoed/pyramid_urireferencer/blob/c6ee4ba863e32ced304b9cf00f3f5b450757a29a/pyramid_urireferencer/__init__.py#L40-L50
[ "def", "get_referencer", "(", "registry", ")", ":", "# Argument might be a config or request", "regis", "=", "getattr", "(", "registry", ",", "'registry'", ",", "None", ")", "if", "regis", "is", "None", ":", "regis", "=", "registry", "return", "regis", ".", "q...
c6ee4ba863e32ced304b9cf00f3f5b450757a29a
train
_connect_to_ec2
:param region: The region of AWS to connect to. :param EC2Credentials credentials: The credentials to use to authenticate with EC2. :return: a connection object to AWS EC2
bookshelf/api_v3/ec2.py
def _connect_to_ec2(region, credentials): """ :param region: The region of AWS to connect to. :param EC2Credentials credentials: The credentials to use to authenticate with EC2. :return: a connection object to AWS EC2 """ conn = boto.ec2.connect_to_region( region, aws_ac...
def _connect_to_ec2(region, credentials): """ :param region: The region of AWS to connect to. :param EC2Credentials credentials: The credentials to use to authenticate with EC2. :return: a connection object to AWS EC2 """ conn = boto.ec2.connect_to_region( region, aws_ac...
[ ":", "param", "region", ":", "The", "region", "of", "AWS", "to", "connect", "to", ".", ":", "param", "EC2Credentials", "credentials", ":", "The", "credentials", "to", "use", "to", "authenticate", "with", "EC2", "." ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v3/ec2.py#L65-L82
[ "def", "_connect_to_ec2", "(", "region", ",", "credentials", ")", ":", "conn", "=", "boto", ".", "ec2", ".", "connect_to_region", "(", "region", ",", "aws_access_key_id", "=", "credentials", ".", "access_key_id", ",", "aws_secret_access_key", "=", "credentials", ...
a6770678e735de95b194f6e6989223970db5f654
train
PyHeaderSheet.write
:param args: tuple(value, style), tuple(value, style) :param kwargs: header=tuple(value, style), header=tuple(value, style) :param args: value, value :param kwargs: header=value, header=value
pyheaderfile/basefile.py
def write(self, *args, **kwargs): """ :param args: tuple(value, style), tuple(value, style) :param kwargs: header=tuple(value, style), header=tuple(value, style) :param args: value, value :param kwargs: header=value, header=value """ if args: kwargs =...
def write(self, *args, **kwargs): """ :param args: tuple(value, style), tuple(value, style) :param kwargs: header=tuple(value, style), header=tuple(value, style) :param args: value, value :param kwargs: header=value, header=value """ if args: kwargs =...
[ ":", "param", "args", ":", "tuple", "(", "value", "style", ")", "tuple", "(", "value", "style", ")", ":", "param", "kwargs", ":", "header", "=", "tuple", "(", "value", "style", ")", "header", "=", "tuple", "(", "value", "style", ")", ":", "param", ...
kappius/pyheaderfile
python
https://github.com/kappius/pyheaderfile/blob/8d587dadae538adcec527fd8e74ad89ed5e2006a/pyheaderfile/basefile.py#L147-L162
[ "def", "write", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "args", ":", "kwargs", "=", "dict", "(", "zip", "(", "self", ".", "header", ",", "args", ")", ")", "for", "header", "in", "kwargs", ":", "cell", "=", "kwarg...
8d587dadae538adcec527fd8e74ad89ed5e2006a
train
clear_layout
Clear the layout off all its components
pyDLib/GUI/__init__.py
def clear_layout(layout: QLayout) -> None: """Clear the layout off all its components""" if layout is not None: while layout.count(): item = layout.takeAt(0) widget = item.widget() if widget is not None: widget.deleteLater() else: ...
def clear_layout(layout: QLayout) -> None: """Clear the layout off all its components""" if layout is not None: while layout.count(): item = layout.takeAt(0) widget = item.widget() if widget is not None: widget.deleteLater() else: ...
[ "Clear", "the", "layout", "off", "all", "its", "components" ]
benoitkugler/abstractDataLibrary
python
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/__init__.py#L128-L137
[ "def", "clear_layout", "(", "layout", ":", "QLayout", ")", "->", "None", ":", "if", "layout", "is", "not", "None", ":", "while", "layout", ".", "count", "(", ")", ":", "item", "=", "layout", ".", "takeAt", "(", "0", ")", "widget", "=", "item", ".",...
16be28e99837e40287a63803bbfdf67ac1806b7b
train
_load_hangul_syllable_types
Helper function for parsing the contents of "HangulSyllableType.txt" from the Unicode Character Database (UCD) and generating a lookup table for determining whether or not a given Hangul syllable is of type "L", "V", "T", "LV" or "LVT". For more info on the UCD, see the following website: https://www.unicode.o...
unicodeutil/hangulutil.py
def _load_hangul_syllable_types(): """ Helper function for parsing the contents of "HangulSyllableType.txt" from the Unicode Character Database (UCD) and generating a lookup table for determining whether or not a given Hangul syllable is of type "L", "V", "T", "LV" or "LVT". For more info on the UCD, s...
def _load_hangul_syllable_types(): """ Helper function for parsing the contents of "HangulSyllableType.txt" from the Unicode Character Database (UCD) and generating a lookup table for determining whether or not a given Hangul syllable is of type "L", "V", "T", "LV" or "LVT". For more info on the UCD, s...
[ "Helper", "function", "for", "parsing", "the", "contents", "of", "HangulSyllableType", ".", "txt", "from", "the", "Unicode", "Character", "Database", "(", "UCD", ")", "and", "generating", "a", "lookup", "table", "for", "determining", "whether", "or", "not", "a...
leonidessaguisagjr/unicodeutil
python
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/hangulutil.py#L10-L29
[ "def", "_load_hangul_syllable_types", "(", ")", ":", "filename", "=", "\"HangulSyllableType.txt\"", "current_dir", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", "with", "codecs", ".", "open", "(", ...
c25c882cf9cb38c123df49fad365be67e5818928
train
_load_jamo_short_names
Function for parsing the Jamo short names from the Unicode Character Database (UCD) and generating a lookup table For more info on how this is used, see the Unicode Standard, ch. 03, section 3.12, "Conjoining Jamo Behavior" and ch. 04, section 4.8, "Name". https://www.unicode.org/versions/latest/ch03.pdf ...
unicodeutil/hangulutil.py
def _load_jamo_short_names(): """ Function for parsing the Jamo short names from the Unicode Character Database (UCD) and generating a lookup table For more info on how this is used, see the Unicode Standard, ch. 03, section 3.12, "Conjoining Jamo Behavior" and ch. 04, section 4.8, "Name". https://...
def _load_jamo_short_names(): """ Function for parsing the Jamo short names from the Unicode Character Database (UCD) and generating a lookup table For more info on how this is used, see the Unicode Standard, ch. 03, section 3.12, "Conjoining Jamo Behavior" and ch. 04, section 4.8, "Name". https://...
[ "Function", "for", "parsing", "the", "Jamo", "short", "names", "from", "the", "Unicode", "Character", "Database", "(", "UCD", ")", "and", "generating", "a", "lookup", "table", "For", "more", "info", "on", "how", "this", "is", "used", "see", "the", "Unicode...
leonidessaguisagjr/unicodeutil
python
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/hangulutil.py#L32-L51
[ "def", "_load_jamo_short_names", "(", ")", ":", "filename", "=", "\"Jamo.txt\"", "current_dir", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", "with", "codecs", ".", "open", "(", "os", ".", "p...
c25c882cf9cb38c123df49fad365be67e5818928
train
_get_hangul_syllable_type
Function for taking a Unicode scalar value representing a Hangul syllable and determining the correct value for its Hangul_Syllable_Type property. For more information on the Hangul_Syllable_Type property see the Unicode Standard, ch. 03, section 3.12, Conjoining Jamo Behavior. https://www.unicode.org/ver...
unicodeutil/hangulutil.py
def _get_hangul_syllable_type(hangul_syllable): """ Function for taking a Unicode scalar value representing a Hangul syllable and determining the correct value for its Hangul_Syllable_Type property. For more information on the Hangul_Syllable_Type property see the Unicode Standard, ch. 03, section 3.12...
def _get_hangul_syllable_type(hangul_syllable): """ Function for taking a Unicode scalar value representing a Hangul syllable and determining the correct value for its Hangul_Syllable_Type property. For more information on the Hangul_Syllable_Type property see the Unicode Standard, ch. 03, section 3.12...
[ "Function", "for", "taking", "a", "Unicode", "scalar", "value", "representing", "a", "Hangul", "syllable", "and", "determining", "the", "correct", "value", "for", "its", "Hangul_Syllable_Type", "property", ".", "For", "more", "information", "on", "the", "Hangul_Sy...
leonidessaguisagjr/unicodeutil
python
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/hangulutil.py#L78-L93
[ "def", "_get_hangul_syllable_type", "(", "hangul_syllable", ")", ":", "if", "not", "_is_hangul_syllable", "(", "hangul_syllable", ")", ":", "raise", "ValueError", "(", "\"Value 0x%0.4x does not represent a Hangul syllable!\"", "%", "hangul_syllable", ")", "if", "not", "_h...
c25c882cf9cb38c123df49fad365be67e5818928
train
_get_jamo_short_name
Function for taking a Unicode scalar value representing a Jamo and determining the correct value for its Jamo_Short_Name property. For more information on the Jamo_Short_Name property see the Unicode Standard, ch. 03, section 3.12, Conjoining Jamo Behavior. https://www.unicode.org/versions/latest/ch03.pdf...
unicodeutil/hangulutil.py
def _get_jamo_short_name(jamo): """ Function for taking a Unicode scalar value representing a Jamo and determining the correct value for its Jamo_Short_Name property. For more information on the Jamo_Short_Name property see the Unicode Standard, ch. 03, section 3.12, Conjoining Jamo Behavior. http...
def _get_jamo_short_name(jamo): """ Function for taking a Unicode scalar value representing a Jamo and determining the correct value for its Jamo_Short_Name property. For more information on the Jamo_Short_Name property see the Unicode Standard, ch. 03, section 3.12, Conjoining Jamo Behavior. http...
[ "Function", "for", "taking", "a", "Unicode", "scalar", "value", "representing", "a", "Jamo", "and", "determining", "the", "correct", "value", "for", "its", "Jamo_Short_Name", "property", ".", "For", "more", "information", "on", "the", "Jamo_Short_Name", "property"...
leonidessaguisagjr/unicodeutil
python
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/hangulutil.py#L96-L111
[ "def", "_get_jamo_short_name", "(", "jamo", ")", ":", "if", "not", "_is_jamo", "(", "jamo", ")", ":", "raise", "ValueError", "(", "\"Value 0x%0.4x passed in does not represent a Jamo!\"", "%", "jamo", ")", "if", "not", "_jamo_short_names", ":", "_load_jamo_short_names...
c25c882cf9cb38c123df49fad365be67e5818928
train
compose_hangul_syllable
Function for taking a tuple or list of Unicode scalar values representing Jamo and composing it into a Hangul syllable. If the values in the list or tuple passed in are not in the ranges of Jamo, a ValueError will be raised. The algorithm for doing the composition is described in the Unicode Standard, ch. 03,...
unicodeutil/hangulutil.py
def compose_hangul_syllable(jamo): """ Function for taking a tuple or list of Unicode scalar values representing Jamo and composing it into a Hangul syllable. If the values in the list or tuple passed in are not in the ranges of Jamo, a ValueError will be raised. The algorithm for doing the compositio...
def compose_hangul_syllable(jamo): """ Function for taking a tuple or list of Unicode scalar values representing Jamo and composing it into a Hangul syllable. If the values in the list or tuple passed in are not in the ranges of Jamo, a ValueError will be raised. The algorithm for doing the compositio...
[ "Function", "for", "taking", "a", "tuple", "or", "list", "of", "Unicode", "scalar", "values", "representing", "Jamo", "and", "composing", "it", "into", "a", "Hangul", "syllable", ".", "If", "the", "values", "in", "the", "list", "or", "tuple", "passed", "in...
leonidessaguisagjr/unicodeutil
python
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/hangulutil.py#L126-L167
[ "def", "compose_hangul_syllable", "(", "jamo", ")", ":", "fmt_str_invalid_sequence", "=", "\"{0} does not represent a valid sequence of Jamo!\"", "if", "len", "(", "jamo", ")", "==", "3", ":", "l_part", ",", "v_part", ",", "t_part", "=", "jamo", "if", "not", "(", ...
c25c882cf9cb38c123df49fad365be67e5818928
train
decompose_hangul_syllable
Function for taking a Unicode scalar value representing a Hangul syllable and decomposing it into a tuple representing the scalar values of the decomposed (canonical decomposition) Jamo. If the Unicode scalar value passed in is not in the range of Hangul syllable values (as defined in UnicodeData.txt), a Value...
unicodeutil/hangulutil.py
def decompose_hangul_syllable(hangul_syllable, fully_decompose=False): """ Function for taking a Unicode scalar value representing a Hangul syllable and decomposing it into a tuple representing the scalar values of the decomposed (canonical decomposition) Jamo. If the Unicode scalar value passed in is ...
def decompose_hangul_syllable(hangul_syllable, fully_decompose=False): """ Function for taking a Unicode scalar value representing a Hangul syllable and decomposing it into a tuple representing the scalar values of the decomposed (canonical decomposition) Jamo. If the Unicode scalar value passed in is ...
[ "Function", "for", "taking", "a", "Unicode", "scalar", "value", "representing", "a", "Hangul", "syllable", "and", "decomposing", "it", "into", "a", "tuple", "representing", "the", "scalar", "values", "of", "the", "decomposed", "(", "canonical", "decomposition", ...
leonidessaguisagjr/unicodeutil
python
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/hangulutil.py#L170-L212
[ "def", "decompose_hangul_syllable", "(", "hangul_syllable", ",", "fully_decompose", "=", "False", ")", ":", "if", "not", "_is_hangul_syllable", "(", "hangul_syllable", ")", ":", "raise", "ValueError", "(", "\"Value passed in does not represent a Hangul syllable!\"", ")", ...
c25c882cf9cb38c123df49fad365be67e5818928
train
_get_hangul_syllable_name
Function for taking a Unicode scalar value representing a Hangul syllable and converting it to its syllable name as defined by the Unicode naming rule NR1. See the Unicode Standard, ch. 04, section 4.8, Names, for more information. :param hangul_syllable: Unicode scalar value representing the Hangul syllable ...
unicodeutil/hangulutil.py
def _get_hangul_syllable_name(hangul_syllable): """ Function for taking a Unicode scalar value representing a Hangul syllable and converting it to its syllable name as defined by the Unicode naming rule NR1. See the Unicode Standard, ch. 04, section 4.8, Names, for more information. :param hangul_syll...
def _get_hangul_syllable_name(hangul_syllable): """ Function for taking a Unicode scalar value representing a Hangul syllable and converting it to its syllable name as defined by the Unicode naming rule NR1. See the Unicode Standard, ch. 04, section 4.8, Names, for more information. :param hangul_syll...
[ "Function", "for", "taking", "a", "Unicode", "scalar", "value", "representing", "a", "Hangul", "syllable", "and", "converting", "it", "to", "its", "syllable", "name", "as", "defined", "by", "the", "Unicode", "naming", "rule", "NR1", ".", "See", "the", "Unico...
leonidessaguisagjr/unicodeutil
python
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/hangulutil.py#L215-L230
[ "def", "_get_hangul_syllable_name", "(", "hangul_syllable", ")", ":", "if", "not", "_is_hangul_syllable", "(", "hangul_syllable", ")", ":", "raise", "ValueError", "(", "\"Value passed in does not represent a Hangul syllable!\"", ")", "jamo", "=", "decompose_hangul_syllable", ...
c25c882cf9cb38c123df49fad365be67e5818928
train
generate_client_callers
Return a dict mapping method names to anonymous functions that will call the server's endpoint of the corresponding name as described in the api defined by the swagger dict and bravado spec
pymacaron_core/swagger/client.py
def generate_client_callers(spec, timeout, error_callback, local, app): """Return a dict mapping method names to anonymous functions that will call the server's endpoint of the corresponding name as described in the api defined by the swagger dict and bravado spec""" callers_dict = {} def mycallba...
def generate_client_callers(spec, timeout, error_callback, local, app): """Return a dict mapping method names to anonymous functions that will call the server's endpoint of the corresponding name as described in the api defined by the swagger dict and bravado spec""" callers_dict = {} def mycallba...
[ "Return", "a", "dict", "mapping", "method", "names", "to", "anonymous", "functions", "that", "will", "call", "the", "server", "s", "endpoint", "of", "the", "corresponding", "name", "as", "described", "in", "the", "api", "defined", "by", "the", "swagger", "di...
pymacaron/pymacaron-core
python
https://github.com/pymacaron/pymacaron-core/blob/95070a39ed7065a84244ff5601fea4d54cc72b66/pymacaron_core/swagger/client.py#L25-L40
[ "def", "generate_client_callers", "(", "spec", ",", "timeout", ",", "error_callback", ",", "local", ",", "app", ")", ":", "callers_dict", "=", "{", "}", "def", "mycallback", "(", "endpoint", ")", ":", "if", "not", "endpoint", ".", "handler_client", ":", "r...
95070a39ed7065a84244ff5601fea4d54cc72b66
train
ClientCaller._call_retry
Call request and retry up to max_attempts times (or none if self.max_attempts=1)
pymacaron_core/swagger/client.py
def _call_retry(self, force_retry): """Call request and retry up to max_attempts times (or none if self.max_attempts=1)""" last_exception = None for i in range(self.max_attempts): try: log.info("Calling %s %s" % (self.method, self.url)) response = self...
def _call_retry(self, force_retry): """Call request and retry up to max_attempts times (or none if self.max_attempts=1)""" last_exception = None for i in range(self.max_attempts): try: log.info("Calling %s %s" % (self.method, self.url)) response = self...
[ "Call", "request", "and", "retry", "up", "to", "max_attempts", "times", "(", "or", "none", "if", "self", ".", "max_attempts", "=", "1", ")" ]
pymacaron/pymacaron-core
python
https://github.com/pymacaron/pymacaron-core/blob/95070a39ed7065a84244ff5601fea4d54cc72b66/pymacaron_core/swagger/client.py#L270-L333
[ "def", "_call_retry", "(", "self", ",", "force_retry", ")", ":", "last_exception", "=", "None", "for", "i", "in", "range", "(", "self", ".", "max_attempts", ")", ":", "try", ":", "log", ".", "info", "(", "\"Calling %s %s\"", "%", "(", "self", ".", "met...
95070a39ed7065a84244ff5601fea4d54cc72b66
train
syllabify
Syllabify the given word, whether simplex or complex.
finnsyll/prev/v05.py
def syllabify(word): '''Syllabify the given word, whether simplex or complex.''' word = split(word) # detect any non-delimited compounds compound = True if re.search(r'-| |\.', word) else False syllabify = _syllabify_compound if compound else _syllabify syll, rules = syllabify(word) yield syll...
def syllabify(word): '''Syllabify the given word, whether simplex or complex.''' word = split(word) # detect any non-delimited compounds compound = True if re.search(r'-| |\.', word) else False syllabify = _syllabify_compound if compound else _syllabify syll, rules = syllabify(word) yield syll...
[ "Syllabify", "the", "given", "word", "whether", "simplex", "or", "complex", "." ]
tsnaomi/finnsyll
python
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v05.py#L64-L81
[ "def", "syllabify", "(", "word", ")", ":", "word", "=", "split", "(", "word", ")", "# detect any non-delimited compounds", "compound", "=", "True", "if", "re", ".", "search", "(", "r'-| |\\.'", ",", "word", ")", "else", "False", "syllabify", "=", "_syllabify...
6a42740311688c946a636a3e2304866c7aa041b3
train
_syllabify
Syllabify the given word.
finnsyll/prev/v05.py
def _syllabify(word, T4=True): '''Syllabify the given word.''' word = replace_umlauts(word) word, rules = apply_T1(word) if re.search(r'[^ieAyOauo]*([ieAyOauo]{2})[^ieAyOauo]*', word): word, T2 = apply_T2(word) word, T8 = apply_T8(word) word, T9 = apply_T9(word) word, T4...
def _syllabify(word, T4=True): '''Syllabify the given word.''' word = replace_umlauts(word) word, rules = apply_T1(word) if re.search(r'[^ieAyOauo]*([ieAyOauo]{2})[^ieAyOauo]*', word): word, T2 = apply_T2(word) word, T8 = apply_T8(word) word, T9 = apply_T9(word) word, T4...
[ "Syllabify", "the", "given", "word", "." ]
tsnaomi/finnsyll
python
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v05.py#L97-L119
[ "def", "_syllabify", "(", "word", ",", "T4", "=", "True", ")", ":", "word", "=", "replace_umlauts", "(", "word", ")", "word", ",", "rules", "=", "apply_T1", "(", "word", ")", "if", "re", ".", "search", "(", "r'[^ieAyOauo]*([ieAyOauo]{2})[^ieAyOauo]*'", ","...
6a42740311688c946a636a3e2304866c7aa041b3
train
apply_T1
There is a syllable boundary in front of every CV-sequence.
finnsyll/prev/v05.py
def apply_T1(word): '''There is a syllable boundary in front of every CV-sequence.''' # split consonants and vowels: 'balloon' -> ['b', 'a', 'll', 'oo', 'n'] WORD = [w for w in re.split('([ieAyOauo]+)', word) if w] count = 0 for i, v in enumerate(WORD): if i == 0 and is_consonant(v[0]): ...
def apply_T1(word): '''There is a syllable boundary in front of every CV-sequence.''' # split consonants and vowels: 'balloon' -> ['b', 'a', 'll', 'oo', 'n'] WORD = [w for w in re.split('([ieAyOauo]+)', word) if w] count = 0 for i, v in enumerate(WORD): if i == 0 and is_consonant(v[0]): ...
[ "There", "is", "a", "syllable", "boundary", "in", "front", "of", "every", "CV", "-", "sequence", "." ]
tsnaomi/finnsyll
python
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v05.py#L169-L203
[ "def", "apply_T1", "(", "word", ")", ":", "# split consonants and vowels: 'balloon' -> ['b', 'a', 'll', 'oo', 'n']", "WORD", "=", "[", "w", "for", "w", "in", "re", ".", "split", "(", "'([ieAyOauo]+)'", ",", "word", ")", "if", "w", "]", "count", "=", "0", "for"...
6a42740311688c946a636a3e2304866c7aa041b3
train
extended_cigar
Convert mutation annotations to extended cigar format https://github.com/lh3/minimap2#the-cs-optional-tag USAGE: >>> template = 'CGATCGATAAATAGAGTAG---GAATAGCA' >>> query = 'CGATCG---AATAGAGTAGGTCGAATtGCA' >>> extended_cigar(template, query) == ':6-ata:10+gtc:4*at:3' True
cgecore/alignment.py
def extended_cigar(aligned_template, aligned_query): ''' Convert mutation annotations to extended cigar format https://github.com/lh3/minimap2#the-cs-optional-tag USAGE: >>> template = 'CGATCGATAAATAGAGTAG---GAATAGCA' >>> query = 'CGATCG---AATAGAGTAGGTCGAATtGCA' >>> extended_cigar(tem...
def extended_cigar(aligned_template, aligned_query): ''' Convert mutation annotations to extended cigar format https://github.com/lh3/minimap2#the-cs-optional-tag USAGE: >>> template = 'CGATCGATAAATAGAGTAG---GAATAGCA' >>> query = 'CGATCG---AATAGAGTAGGTCGAATtGCA' >>> extended_cigar(tem...
[ "Convert", "mutation", "annotations", "to", "extended", "cigar", "format", "https", ":", "//", "github", ".", "com", "/", "lh3", "/", "minimap2#the", "-", "cs", "-", "optional", "-", "tag", "USAGE", ":", ">>>", "template", "=", "CGATCGATAAATAGAGTAG", "---", ...
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/alignment.py#L14-L83
[ "def", "extended_cigar", "(", "aligned_template", ",", "aligned_query", ")", ":", "# - Go through each position in the alignment", "insertion", "=", "[", "]", "deletion", "=", "[", "]", "matches", "=", "[", "]", "cigar", "=", "[", "]", "for", "r_aa", ",", "q...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
cigar2query
Generate query sequence from the template and extended cigar annotation USAGE: >>> template = 'CGATCGATAAATAGAGTAGGAATAGCA' >>> cigar = ':6-ata:10+gtc:4*at:3' >>> cigar2query(template, cigar) == 'CGATCGAATAGAGTAGGTCGAATtGCA'.upper() True
cgecore/alignment.py
def cigar2query(template, cigar): ''' Generate query sequence from the template and extended cigar annotation USAGE: >>> template = 'CGATCGATAAATAGAGTAGGAATAGCA' >>> cigar = ':6-ata:10+gtc:4*at:3' >>> cigar2query(template, cigar) == 'CGATCGAATAGAGTAGGTCGAATtGCA'.upper() True ''' ...
def cigar2query(template, cigar): ''' Generate query sequence from the template and extended cigar annotation USAGE: >>> template = 'CGATCGATAAATAGAGTAGGAATAGCA' >>> cigar = ':6-ata:10+gtc:4*at:3' >>> cigar2query(template, cigar) == 'CGATCGAATAGAGTAGGTCGAATtGCA'.upper() True ''' ...
[ "Generate", "query", "sequence", "from", "the", "template", "and", "extended", "cigar", "annotation", "USAGE", ":", ">>>", "template", "=", "CGATCGATAAATAGAGTAGGAATAGCA", ">>>", "cigar", "=", ":", "6", "-", "ata", ":", "10", "+", "gtc", ":", "4", "*", "at"...
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/alignment.py#L85-L128
[ "def", "cigar2query", "(", "template", ",", "cigar", ")", ":", "query", "=", "[", "]", "entries", "=", "[", "'+'", ",", "'-'", ",", "'*'", ",", "':'", "]", "number", "=", "list", "(", "map", "(", "str", ",", "range", "(", "10", ")", ")", ")", ...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
Blaster
BLAST wrapper method, that takes a simple input and produces a overview list of the hits to templates, and their alignments Usage >>> import os, subprocess, collections >>> from Bio.Blast import NCBIXML >>> from Bio import SeqIO >>> from string import maketrans >>> inputfile = 't...
cgecore/alignment.py
def Blaster(inputfile, databases, db_path, out_path='.', min_cov=0.6, threshold=0.9, blast='blastn', cut_off=True): ''' BLAST wrapper method, that takes a simple input and produces a overview list of the hits to templates, and their alignments Usage >>> import os, subprocess, collections ...
def Blaster(inputfile, databases, db_path, out_path='.', min_cov=0.6, threshold=0.9, blast='blastn', cut_off=True): ''' BLAST wrapper method, that takes a simple input and produces a overview list of the hits to templates, and their alignments Usage >>> import os, subprocess, collections ...
[ "BLAST", "wrapper", "method", "that", "takes", "a", "simple", "input", "and", "produces", "a", "overview", "list", "of", "the", "hits", "to", "templates", "and", "their", "alignments", "Usage", ">>>", "import", "os", "subprocess", "collections", ">>>", "from",...
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/alignment.py#L130-L325
[ "def", "Blaster", "(", "inputfile", ",", "databases", ",", "db_path", ",", "out_path", "=", "'.'", ",", "min_cov", "=", "0.6", ",", "threshold", "=", "0.9", ",", "blast", "=", "'blastn'", ",", "cut_off", "=", "True", ")", ":", "min_cov", "=", "100", ...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
compare_results
Function for comparing hits and saving only the best hit
cgecore/alignment.py
def compare_results(save, best_hsp, tmp_results, tmp_gene_split): ''' Function for comparing hits and saving only the best hit ''' # Get data for comparison hit_id = best_hsp['hit_id'] new_start_query = best_hsp['query_start'] new_end_query = best_hsp['query_end'] new_start_sbjct = int(best_hsp['sbjct...
def compare_results(save, best_hsp, tmp_results, tmp_gene_split): ''' Function for comparing hits and saving only the best hit ''' # Get data for comparison hit_id = best_hsp['hit_id'] new_start_query = best_hsp['query_start'] new_end_query = best_hsp['query_end'] new_start_sbjct = int(best_hsp['sbjct...
[ "Function", "for", "comparing", "hits", "and", "saving", "only", "the", "best", "hit" ]
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/alignment.py#L332-L446
[ "def", "compare_results", "(", "save", ",", "best_hsp", ",", "tmp_results", ",", "tmp_gene_split", ")", ":", "# Get data for comparison", "hit_id", "=", "best_hsp", "[", "'hit_id'", "]", "new_start_query", "=", "best_hsp", "[", "'query_start'", "]", "new_end_query",...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
calculate_new_length
Function for calcualting new length if the gene is split on several contigs
cgecore/alignment.py
def calculate_new_length(gene_split, gene_results, hit): ''' Function for calcualting new length if the gene is split on several contigs ''' # Looping over splitted hits and calculate new length first = 1 for split in gene_split[hit['sbjct_header']]: new_start = int(gene_results[split]['sbjct_st...
def calculate_new_length(gene_split, gene_results, hit): ''' Function for calcualting new length if the gene is split on several contigs ''' # Looping over splitted hits and calculate new length first = 1 for split in gene_split[hit['sbjct_header']]: new_start = int(gene_results[split]['sbjct_st...
[ "Function", "for", "calcualting", "new", "length", "if", "the", "gene", "is", "split", "on", "several", "contigs" ]
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/alignment.py#L448-L473
[ "def", "calculate_new_length", "(", "gene_split", ",", "gene_results", ",", "hit", ")", ":", "# Looping over splitted hits and calculate new length", "first", "=", "1", "for", "split", "in", "gene_split", "[", "hit", "[", "'sbjct_header'", "]", "]", ":", "new_start"...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
stream_to_packet
Chop a stream of data into MODBUS packets. :param data: stream of data :returns: a tuple of the data that is a packet with the remaining data, or ``None``
modpypes/app.py
def stream_to_packet(data): """ Chop a stream of data into MODBUS packets. :param data: stream of data :returns: a tuple of the data that is a packet with the remaining data, or ``None`` """ if len(data) < 6: return None # unpack the length pktlen = struct.unpack(">H", ...
def stream_to_packet(data): """ Chop a stream of data into MODBUS packets. :param data: stream of data :returns: a tuple of the data that is a packet with the remaining data, or ``None`` """ if len(data) < 6: return None # unpack the length pktlen = struct.unpack(">H", ...
[ "Chop", "a", "stream", "of", "data", "into", "MODBUS", "packets", "." ]
JoelBender/modpypes
python
https://github.com/JoelBender/modpypes/blob/f6e33c48fdc70f873bc2823b1ac4111cafe2a700/modpypes/app.py#L61-L77
[ "def", "stream_to_packet", "(", "data", ")", ":", "if", "len", "(", "data", ")", "<", "6", ":", "return", "None", "# unpack the length", "pktlen", "=", "struct", ".", "unpack", "(", "\">H\"", ",", "data", "[", "4", ":", "6", "]", ")", "[", "0", "]"...
f6e33c48fdc70f873bc2823b1ac4111cafe2a700
train
to_primitive
Convert a complex object into primitives. Handy for JSON serialization. We can optionally handle instances, but since this is a recursive function, we could have cyclical data structures. To handle cyclical data structures we could track the actual objects visited in a set, but not all objects are...
qg/core/jsonutils.py
def to_primitive(value, convert_instances=False, convert_datetime=True, level=0, max_depth=3): """Convert a complex object into primitives. Handy for JSON serialization. We can optionally handle instances, but since this is a recursive function, we could have cyclical data structures. ...
def to_primitive(value, convert_instances=False, convert_datetime=True, level=0, max_depth=3): """Convert a complex object into primitives. Handy for JSON serialization. We can optionally handle instances, but since this is a recursive function, we could have cyclical data structures. ...
[ "Convert", "a", "complex", "object", "into", "primitives", "." ]
QunarOPS/qg.core
python
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/jsonutils.py#L63-L156
[ "def", "to_primitive", "(", "value", ",", "convert_instances", "=", "False", ",", "convert_datetime", "=", "True", ",", "level", "=", "0", ",", "max_depth", "=", "3", ")", ":", "# handle obvious types first - order of basic types determined by running", "# full tests on...
d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3
train
get_vowel
Return the firstmost vowel in 'syll'.
finnsyll/phonology.py
def get_vowel(syll): '''Return the firstmost vowel in 'syll'.''' return re.search(r'([ieaouäöy]{1})', syll, flags=FLAGS).group(1).upper()
def get_vowel(syll): '''Return the firstmost vowel in 'syll'.''' return re.search(r'([ieaouäöy]{1})', syll, flags=FLAGS).group(1).upper()
[ "Return", "the", "firstmost", "vowel", "in", "syll", "." ]
tsnaomi/finnsyll
python
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/phonology.py#L88-L90
[ "def", "get_vowel", "(", "syll", ")", ":", "return", "re", ".", "search", "(", "r'([ieaouäöy]{1})', ", "s", "ll, ", "f", "ags=F", "L", "AGS).", "g", "r", "oup(1", ")", ".", "u", "p", "per()", "", "" ]
6a42740311688c946a636a3e2304866c7aa041b3
train
is_light
Return True if 'syll' is light.
finnsyll/phonology.py
def is_light(syll): '''Return True if 'syll' is light.''' return re.match(r'(^|[^ieaouäöy]+)[ieaouäöy]{1}$', syll, flags=FLAGS)
def is_light(syll): '''Return True if 'syll' is light.''' return re.match(r'(^|[^ieaouäöy]+)[ieaouäöy]{1}$', syll, flags=FLAGS)
[ "Return", "True", "if", "syll", "is", "light", "." ]
tsnaomi/finnsyll
python
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/phonology.py#L98-L100
[ "def", "is_light", "(", "syll", ")", ":", "return", "re", ".", "match", "(", "r'(^|[^ieaouäöy]+)[ieaouäöy]{1}$', sy", "l", ", fl", "a", "s=FLA", "G", "S)", "" ]
6a42740311688c946a636a3e2304866c7aa041b3
train
stress
Assign primary and secondary stress to 'syllabified_simplex_word'.
finnsyll/phonology.py
def stress(syllabified_simplex_word): '''Assign primary and secondary stress to 'syllabified_simplex_word'.''' syllables = syllabified_simplex_word.split('.') stressed = '\'' + syllables[0] # primary stress try: n = 0 medial = syllables[1:-1] for i, syll in enumerate(medial): ...
def stress(syllabified_simplex_word): '''Assign primary and secondary stress to 'syllabified_simplex_word'.''' syllables = syllabified_simplex_word.split('.') stressed = '\'' + syllables[0] # primary stress try: n = 0 medial = syllables[1:-1] for i, syll in enumerate(medial): ...
[ "Assign", "primary", "and", "secondary", "stress", "to", "syllabified_simplex_word", "." ]
tsnaomi/finnsyll
python
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/phonology.py#L108-L141
[ "def", "stress", "(", "syllabified_simplex_word", ")", ":", "syllables", "=", "syllabified_simplex_word", ".", "split", "(", "'.'", ")", "stressed", "=", "'\\''", "+", "syllables", "[", "0", "]", "# primary stress", "try", ":", "n", "=", "0", "medial", "=", ...
6a42740311688c946a636a3e2304866c7aa041b3
train
sonseq
Return True if 'word' does not violate sonority sequencing.
finnsyll/phonology.py
def sonseq(word): '''Return True if 'word' does not violate sonority sequencing.''' parts = re.split(r'([ieaouäöy]+)', word, flags=re.I | re.U) onset, coda = parts[0], parts[-1] # simplex onset Finnish complex onset if len(onset) <= 1 or onset.lower() in ONSETS: # simplex coda ...
def sonseq(word): '''Return True if 'word' does not violate sonority sequencing.''' parts = re.split(r'([ieaouäöy]+)', word, flags=re.I | re.U) onset, coda = parts[0], parts[-1] # simplex onset Finnish complex onset if len(onset) <= 1 or onset.lower() in ONSETS: # simplex coda ...
[ "Return", "True", "if", "word", "does", "not", "violate", "sonority", "sequencing", "." ]
tsnaomi/finnsyll
python
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/phonology.py#L154-L164
[ "def", "sonseq", "(", "word", ")", ":", "parts", "=", "re", ".", "split", "(", "r'([ieaouäöy]+)', ", "w", "rd, ", "f", "ags=r", "e", ".I", " ", "|", "r", ".U", ")", "", "", "onset", ",", "coda", "=", "parts", "[", "0", "]", ",", "parts", "[", ...
6a42740311688c946a636a3e2304866c7aa041b3
train
harmonic
Return True if the word's vowels agree in frontness/backness.
finnsyll/phonology.py
def harmonic(word): '''Return True if the word's vowels agree in frontness/backness.''' depth = {'ä': 0, 'ö': 0, 'y': 0, 'a': 1, 'o': 1, 'u': 1} vowels = filter(lambda ch: is_front(ch) or is_back(ch), word) depths = (depth[x.lower()] for x in vowels) return len(set(depths)) < 2
def harmonic(word): '''Return True if the word's vowels agree in frontness/backness.''' depth = {'ä': 0, 'ö': 0, 'y': 0, 'a': 1, 'o': 1, 'u': 1} vowels = filter(lambda ch: is_front(ch) or is_back(ch), word) depths = (depth[x.lower()] for x in vowels) return len(set(depths)) < 2
[ "Return", "True", "if", "the", "word", "s", "vowels", "agree", "in", "frontness", "/", "backness", "." ]
tsnaomi/finnsyll
python
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/phonology.py#L172-L178
[ "def", "harmonic", "(", "word", ")", ":", "depth", "=", "{", "'ä':", " ", ",", " ", "ö': ", "0", " ", "'", "': ", "0", " ", "'", "': ", "1", " ", "'", "': ", "1", " ", "'", "': ", "1", "", "", "vowels", "=", "filter", "(", "lambda", "ch", ...
6a42740311688c946a636a3e2304866c7aa041b3
train
ExecutableTaskType.put
Updates this task type on the saltant server. Returns: :class:`saltant.models.container_task_type.ExecutableTaskType`: An executable task type model instance representing the task type just updated.
saltant/models/executable_task_type.py
def put(self): """Updates this task type on the saltant server. Returns: :class:`saltant.models.container_task_type.ExecutableTaskType`: An executable task type model instance representing the task type just updated. """ return self.manager.pu...
def put(self): """Updates this task type on the saltant server. Returns: :class:`saltant.models.container_task_type.ExecutableTaskType`: An executable task type model instance representing the task type just updated. """ return self.manager.pu...
[ "Updates", "this", "task", "type", "on", "the", "saltant", "server", "." ]
saltant-org/saltant-py
python
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/executable_task_type.py#L84-L103
[ "def", "put", "(", "self", ")", ":", "return", "self", ".", "manager", ".", "put", "(", "id", "=", "self", ".", "id", ",", "name", "=", "self", ".", "name", ",", "description", "=", "self", ".", "description", ",", "command_to_run", "=", "self", "....
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
train
ExecutableTaskTypeManager.create
Create a container task type. Args: name (str): The name of the task. command_to_run (str): The command to run to execute the task. description (str, optional): The description of the task type. environment_variables (list, optional): The environment ...
saltant/models/executable_task_type.py
def create( self, name, command_to_run, description="", environment_variables=None, required_arguments=None, required_arguments_default_values=None, json_file_option=None, extra_data_to_post=None, ): """Create a container task type. ...
def create( self, name, command_to_run, description="", environment_variables=None, required_arguments=None, required_arguments_default_values=None, json_file_option=None, extra_data_to_post=None, ): """Create a container task type. ...
[ "Create", "a", "container", "task", "type", "." ]
saltant-org/saltant-py
python
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/executable_task_type.py#L122-L172
[ "def", "create", "(", "self", ",", "name", ",", "command_to_run", ",", "description", "=", "\"\"", ",", "environment_variables", "=", "None", ",", "required_arguments", "=", "None", ",", "required_arguments_default_values", "=", "None", ",", "json_file_option", "=...
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
train
ExecutableTaskTypeManager.put
Updates a task type on the saltant server. Args: id (int): The ID of the task type. name (str): The name of the task type. description (str): The description of the task type. command_to_run (str): The command to run to execute the task. environment_v...
saltant/models/executable_task_type.py
def put( self, id, name, description, command_to_run, environment_variables, required_arguments, required_arguments_default_values, json_file_option, extra_data_to_put=None, ): """Updates a task type on the saltant server. ...
def put( self, id, name, description, command_to_run, environment_variables, required_arguments, required_arguments_default_values, json_file_option, extra_data_to_put=None, ): """Updates a task type on the saltant server. ...
[ "Updates", "a", "task", "type", "on", "the", "saltant", "server", "." ]
saltant-org/saltant-py
python
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/executable_task_type.py#L174-L223
[ "def", "put", "(", "self", ",", "id", ",", "name", ",", "description", ",", "command_to_run", ",", "environment_variables", ",", "required_arguments", ",", "required_arguments_default_values", ",", "json_file_option", ",", "extra_data_to_put", "=", "None", ",", ")",...
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
train
Reports.reporter
Creates a report of the genesippr results :param analysistype: The variable to use when accessing attributes in the metadata object
sipprverse_reporter/reports.py
def reporter(self, analysistype='genesippr'): """ Creates a report of the genesippr results :param analysistype: The variable to use when accessing attributes in the metadata object """ logging.info('Creating {} report'.format(analysistype)) # Create a dictionary to link ...
def reporter(self, analysistype='genesippr'): """ Creates a report of the genesippr results :param analysistype: The variable to use when accessing attributes in the metadata object """ logging.info('Creating {} report'.format(analysistype)) # Create a dictionary to link ...
[ "Creates", "a", "report", "of", "the", "genesippr", "results", ":", "param", "analysistype", ":", "The", "variable", "to", "use", "when", "accessing", "attributes", "in", "the", "metadata", "object" ]
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sipprverse_reporter/reports.py#L24-L115
[ "def", "reporter", "(", "self", ",", "analysistype", "=", "'genesippr'", ")", ":", "logging", ".", "info", "(", "'Creating {} report'", ".", "format", "(", "analysistype", ")", ")", "# Create a dictionary to link all the genera with their genes", "genusgenes", "=", "d...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
Reports.genusspecific
Creates simplified genus-specific reports. Instead of the % ID and the fold coverage, a simple +/- scheme is used for presence/absence :param analysistype: The variable to use when accessing attributes in the metadata object
sipprverse_reporter/reports.py
def genusspecific(self, analysistype='genesippr'): """ Creates simplified genus-specific reports. Instead of the % ID and the fold coverage, a simple +/- scheme is used for presence/absence :param analysistype: The variable to use when accessing attributes in the metadata object ...
def genusspecific(self, analysistype='genesippr'): """ Creates simplified genus-specific reports. Instead of the % ID and the fold coverage, a simple +/- scheme is used for presence/absence :param analysistype: The variable to use when accessing attributes in the metadata object ...
[ "Creates", "simplified", "genus", "-", "specific", "reports", ".", "Instead", "of", "the", "%", "ID", "and", "the", "fold", "coverage", "a", "simple", "+", "/", "-", "scheme", "is", "used", "for", "presence", "/", "absence", ":", "param", "analysistype", ...
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sipprverse_reporter/reports.py#L117-L155
[ "def", "genusspecific", "(", "self", ",", "analysistype", "=", "'genesippr'", ")", ":", "# Dictionary to store all the output strings", "results", "=", "dict", "(", ")", "for", "genus", ",", "genelist", "in", "self", ".", "genedict", ".", "items", "(", ")", ":...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
Reports.gdcsreporter
Creates a report of the GDCS results :param analysistype: The variable to use when accessing attributes in the metadata object
sipprverse_reporter/reports.py
def gdcsreporter(self, analysistype='GDCS'): """ Creates a report of the GDCS results :param analysistype: The variable to use when accessing attributes in the metadata object """ logging.info('Creating {} report'.format(analysistype)) # Initialise list to store all the G...
def gdcsreporter(self, analysistype='GDCS'): """ Creates a report of the GDCS results :param analysistype: The variable to use when accessing attributes in the metadata object """ logging.info('Creating {} report'.format(analysistype)) # Initialise list to store all the G...
[ "Creates", "a", "report", "of", "the", "GDCS", "results", ":", "param", "analysistype", ":", "The", "variable", "to", "use", "when", "accessing", "attributes", "in", "the", "metadata", "object" ]
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sipprverse_reporter/reports.py#L157-L260
[ "def", "gdcsreporter", "(", "self", ",", "analysistype", "=", "'GDCS'", ")", ":", "logging", ".", "info", "(", "'Creating {} report'", ".", "format", "(", "analysistype", ")", ")", "# Initialise list to store all the GDCS genes, and genera in the analysis", "gdcs", "=",...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
Reports.gdcs_fai
GDCS analyses need to use the .fai file supplied in the targets folder rather than the one created following reverse baiting :param sample: sample object :param analysistype: current analysis being performed
sipprverse_reporter/reports.py
def gdcs_fai(sample, analysistype='GDCS'): """ GDCS analyses need to use the .fai file supplied in the targets folder rather than the one created following reverse baiting :param sample: sample object :param analysistype: current analysis being performed """ try: ...
def gdcs_fai(sample, analysistype='GDCS'): """ GDCS analyses need to use the .fai file supplied in the targets folder rather than the one created following reverse baiting :param sample: sample object :param analysistype: current analysis being performed """ try: ...
[ "GDCS", "analyses", "need", "to", "use", "the", ".", "fai", "file", "supplied", "in", "the", "targets", "folder", "rather", "than", "the", "one", "created", "following", "reverse", "baiting", ":", "param", "sample", ":", "sample", "object", ":", "param", "...
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sipprverse_reporter/reports.py#L263-L289
[ "def", "gdcs_fai", "(", "sample", ",", "analysistype", "=", "'GDCS'", ")", ":", "try", ":", "# Find the .fai file in the target path", "sample", "[", "analysistype", "]", ".", "faifile", "=", "glob", "(", "os", ".", "path", ".", "join", "(", "sample", "[", ...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
Reports.sixteensreporter
Creates a report of the results :param analysistype: The variable to use when accessing attributes in the metadata object
sipprverse_reporter/reports.py
def sixteensreporter(self, analysistype='sixteens_full'): """ Creates a report of the results :param analysistype: The variable to use when accessing attributes in the metadata object """ # Create the path in which the reports are stored make_path(self.reportpath) ...
def sixteensreporter(self, analysistype='sixteens_full'): """ Creates a report of the results :param analysistype: The variable to use when accessing attributes in the metadata object """ # Create the path in which the reports are stored make_path(self.reportpath) ...
[ "Creates", "a", "report", "of", "the", "results", ":", "param", "analysistype", ":", "The", "variable", "to", "use", "when", "accessing", "attributes", "in", "the", "metadata", "object" ]
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sipprverse_reporter/reports.py#L291-L326
[ "def", "sixteensreporter", "(", "self", ",", "analysistype", "=", "'sixteens_full'", ")", ":", "# Create the path in which the reports are stored", "make_path", "(", "self", ".", "reportpath", ")", "# Initialise the header and data strings", "header", "=", "'Strain,Gene,Perce...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
Reports.confindr_reporter
Creates a final report of all the ConFindr results
sipprverse_reporter/reports.py
def confindr_reporter(self, analysistype='confindr'): """ Creates a final report of all the ConFindr results """ # Initialise the data strings data = 'Strain,Genus,NumContamSNVs,ContamStatus,PercentContam,PercentContamSTD\n' with open(os.path.join(self.reportpath, analysi...
def confindr_reporter(self, analysistype='confindr'): """ Creates a final report of all the ConFindr results """ # Initialise the data strings data = 'Strain,Genus,NumContamSNVs,ContamStatus,PercentContam,PercentContamSTD\n' with open(os.path.join(self.reportpath, analysi...
[ "Creates", "a", "final", "report", "of", "all", "the", "ConFindr", "results" ]
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sipprverse_reporter/reports.py#L328-L346
[ "def", "confindr_reporter", "(", "self", ",", "analysistype", "=", "'confindr'", ")", ":", "# Initialise the data strings", "data", "=", "'Strain,Genus,NumContamSNVs,ContamStatus,PercentContam,PercentContamSTD\\n'", "with", "open", "(", "os", ".", "path", ".", "join", "("...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
Reports.methodreporter
Create final reports collating results from all the individual iterations through the method pipeline
sipprverse_reporter/reports.py
def methodreporter(self): """ Create final reports collating results from all the individual iterations through the method pipeline """ # Ensure that the analyses are set to complete self.analysescomplete = True # Reset the report path to original value self.repor...
def methodreporter(self): """ Create final reports collating results from all the individual iterations through the method pipeline """ # Ensure that the analyses are set to complete self.analysescomplete = True # Reset the report path to original value self.repor...
[ "Create", "final", "reports", "collating", "results", "from", "all", "the", "individual", "iterations", "through", "the", "method", "pipeline" ]
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sipprverse_reporter/reports.py#L348-L371
[ "def", "methodreporter", "(", "self", ")", ":", "# Ensure that the analyses are set to complete", "self", ".", "analysescomplete", "=", "True", "# Reset the report path to original value", "self", ".", "reportpath", "=", "os", ".", "path", ".", "join", "(", "self", "....
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
ReportImage.main
Run the methods required to create the genesippr report summary image
sipprverse_reporter/reports.py
def main(self): """ Run the methods required to create the genesippr report summary image """ self.dataframe_setup() self.figure_populate(self.outputfolder, self.image_report, self.header_list, ...
def main(self): """ Run the methods required to create the genesippr report summary image """ self.dataframe_setup() self.figure_populate(self.outputfolder, self.image_report, self.header_list, ...
[ "Run", "the", "methods", "required", "to", "create", "the", "genesippr", "report", "summary", "image" ]
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sipprverse_reporter/reports.py#L417-L428
[ "def", "main", "(", "self", ")", ":", "self", ".", "dataframe_setup", "(", ")", "self", ".", "figure_populate", "(", "self", ".", "outputfolder", ",", "self", ".", "image_report", ",", "self", ".", "header_list", ",", "self", ".", "samples", ",", "'genes...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
ReportImage.data_sanitise
Format the data to be consistent with heatmaps :param inputstring: string containing data to be formatted :param header: class of the data - certain categories have specific formatting requirements :return: the formatted output string
sipprverse_reporter/reports.py
def data_sanitise(self, inputstring, header=None): """ Format the data to be consistent with heatmaps :param inputstring: string containing data to be formatted :param header: class of the data - certain categories have specific formatting requirements :return: the formatted outp...
def data_sanitise(self, inputstring, header=None): """ Format the data to be consistent with heatmaps :param inputstring: string containing data to be formatted :param header: class of the data - certain categories have specific formatting requirements :return: the formatted outp...
[ "Format", "the", "data", "to", "be", "consistent", "with", "heatmaps", ":", "param", "inputstring", ":", "string", "containing", "data", "to", "be", "formatted", ":", "param", "header", ":", "class", "of", "the", "data", "-", "certain", "categories", "have",...
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sipprverse_reporter/reports.py#L430-L463
[ "def", "data_sanitise", "(", "self", ",", "inputstring", ",", "header", "=", "None", ")", ":", "if", "str", "(", "inputstring", ")", "==", "'nan'", ":", "outputstring", "=", "0", "elif", "'%'", "in", "str", "(", "inputstring", ")", ":", "group", "=", ...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
ReportImage.dataframe_setup
Set-up a report to store the desired header: sanitized string combinations
sipprverse_reporter/reports.py
def dataframe_setup(self): """ Set-up a report to store the desired header: sanitized string combinations """ # Initialise a dictionary to store the sanitized headers and strings genesippr_dict = dict() # Try to open all the reports - use pandas to extract the results fro...
def dataframe_setup(self): """ Set-up a report to store the desired header: sanitized string combinations """ # Initialise a dictionary to store the sanitized headers and strings genesippr_dict = dict() # Try to open all the reports - use pandas to extract the results fro...
[ "Set", "-", "up", "a", "report", "to", "store", "the", "desired", "header", ":", "sanitized", "string", "combinations" ]
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sipprverse_reporter/reports.py#L465-L551
[ "def", "dataframe_setup", "(", "self", ")", ":", "# Initialise a dictionary to store the sanitized headers and strings", "genesippr_dict", "=", "dict", "(", ")", "# Try to open all the reports - use pandas to extract the results from any report that exists", "try", ":", "sippr_matrix",...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
ReportImage.figure_populate
Create the report image from the summary report created in self.dataframesetup :param outputpath: Path in which the outputs are to be created :param csv: Name of the report file from which data are to be extracted :param xlabels: List of all the labels to use on the x-axis :param ylabels...
sipprverse_reporter/reports.py
def figure_populate(outputpath, csv, xlabels, ylabels, analysistype, description, fail=False): """ Create the report image from the summary report created in self.dataframesetup :param outputpath: Path in which the outputs are to be created :param csv: Name of the report file from which ...
def figure_populate(outputpath, csv, xlabels, ylabels, analysistype, description, fail=False): """ Create the report image from the summary report created in self.dataframesetup :param outputpath: Path in which the outputs are to be created :param csv: Name of the report file from which ...
[ "Create", "the", "report", "image", "from", "the", "summary", "report", "created", "in", "self", ".", "dataframesetup", ":", "param", "outputpath", ":", "Path", "in", "which", "the", "outputs", "are", "to", "be", "created", ":", "param", "csv", ":", "Name"...
OLC-Bioinformatics/sipprverse
python
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sipprverse_reporter/reports.py#L554-L600
[ "def", "figure_populate", "(", "outputpath", ",", "csv", ",", "xlabels", ",", "ylabels", ",", "analysistype", ",", "description", ",", "fail", "=", "False", ")", ":", "# Create a data frame from the summary report", "df", "=", "pd", ".", "read_csv", "(", "os", ...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
train
add_usr_local_bin_to_path
adds /usr/local/bin to $PATH
bookshelf/api_v2/os_helpers.py
def add_usr_local_bin_to_path(log=False): """ adds /usr/local/bin to $PATH """ if log: bookshelf2.logging_helpers.log_green('inserts /usr/local/bin into PATH') with settings(hide('warnings', 'running', 'stdout', 'stderr'), capture=True): try: sudo('echo "export...
def add_usr_local_bin_to_path(log=False): """ adds /usr/local/bin to $PATH """ if log: bookshelf2.logging_helpers.log_green('inserts /usr/local/bin into PATH') with settings(hide('warnings', 'running', 'stdout', 'stderr'), capture=True): try: sudo('echo "export...
[ "adds", "/", "usr", "/", "local", "/", "bin", "to", "$PATH" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L12-L24
[ "def", "add_usr_local_bin_to_path", "(", "log", "=", "False", ")", ":", "if", "log", ":", "bookshelf2", ".", "logging_helpers", ".", "log_green", "(", "'inserts /usr/local/bin into PATH'", ")", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ...
a6770678e735de95b194f6e6989223970db5f654
train
dir_attribs
cuisine dir_attribs doesn't do sudo, so we implement our own Updates the mode/owner/group for the given remote directory.
bookshelf/api_v2/os_helpers.py
def dir_attribs(location, mode=None, owner=None, group=None, recursive=False, use_sudo=False): """ cuisine dir_attribs doesn't do sudo, so we implement our own Updates the mode/owner/group for the given remote directory.""" args = '' if recursive: args = args + ' -R ' if...
def dir_attribs(location, mode=None, owner=None, group=None, recursive=False, use_sudo=False): """ cuisine dir_attribs doesn't do sudo, so we implement our own Updates the mode/owner/group for the given remote directory.""" args = '' if recursive: args = args + ' -R ' if...
[ "cuisine", "dir_attribs", "doesn", "t", "do", "sudo", "so", "we", "implement", "our", "own", "Updates", "the", "mode", "/", "owner", "/", "group", "for", "the", "given", "remote", "directory", "." ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L35-L58
[ "def", "dir_attribs", "(", "location", ",", "mode", "=", "None", ",", "owner", "=", "None", ",", "group", "=", "None", ",", "recursive", "=", "False", ",", "use_sudo", "=", "False", ")", ":", "args", "=", "''", "if", "recursive", ":", "args", "=", ...
a6770678e735de95b194f6e6989223970db5f654
train
dir_ensure
cuisine dir_ensure doesn't do sudo, so we implement our own Ensures that there is a remote directory at the given location, optionally updating its mode/owner/group. If we are not updating the owner/group then this can be done as a single ssh call, so use that method, otherwise set owner/group after cre...
bookshelf/api_v2/os_helpers.py
def dir_ensure(location, recursive=False, mode=None, owner=None, group=None, use_sudo=False): """ cuisine dir_ensure doesn't do sudo, so we implement our own Ensures that there is a remote directory at the given location, optionally updating its mode/owner/group. If we are not updating th...
def dir_ensure(location, recursive=False, mode=None, owner=None, group=None, use_sudo=False): """ cuisine dir_ensure doesn't do sudo, so we implement our own Ensures that there is a remote directory at the given location, optionally updating its mode/owner/group. If we are not updating th...
[ "cuisine", "dir_ensure", "doesn", "t", "do", "sudo", "so", "we", "implement", "our", "own", "Ensures", "that", "there", "is", "a", "remote", "directory", "at", "the", "given", "location", "optionally", "updating", "its", "mode", "/", "owner", "/", "group", ...
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L61-L93
[ "def", "dir_ensure", "(", "location", ",", "recursive", "=", "False", ",", "mode", "=", "None", ",", "owner", "=", "None", ",", "group", "=", "None", ",", "use_sudo", "=", "False", ")", ":", "args", "=", "''", "if", "recursive", ":", "args", "=", "...
a6770678e735de95b194f6e6989223970db5f654
train
dir_exists
Tells if there is a remote directory at the given location.
bookshelf/api_v2/os_helpers.py
def dir_exists(location, use_sudo=False): """Tells if there is a remote directory at the given location.""" with settings(hide('running', 'stdout', 'stderr'), warn_only=True): if use_sudo: # convert return code 0 to True return not bool(sudo('test -d %s' % (location)).return_code...
def dir_exists(location, use_sudo=False): """Tells if there is a remote directory at the given location.""" with settings(hide('running', 'stdout', 'stderr'), warn_only=True): if use_sudo: # convert return code 0 to True return not bool(sudo('test -d %s' % (location)).return_code...
[ "Tells", "if", "there", "is", "a", "remote", "directory", "at", "the", "given", "location", "." ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L96-L103
[ "def", "dir_exists", "(", "location", ",", "use_sudo", "=", "False", ")", ":", "with", "settings", "(", "hide", "(", "'running'", ",", "'stdout'", ",", "'stderr'", ")", ",", "warn_only", "=", "True", ")", ":", "if", "use_sudo", ":", "# convert return code ...
a6770678e735de95b194f6e6989223970db5f654
train
disable_env_reset_on_sudo
updates /etc/sudoers so that users from %wheel keep their environment when executing a sudo call
bookshelf/api_v2/os_helpers.py
def disable_env_reset_on_sudo(log=False): """ updates /etc/sudoers so that users from %wheel keep their environment when executing a sudo call """ if log: bookshelf2.logging_helpers.log_green('disabling env reset on sudo') file_append('/etc/sudoers', 'Defaults:%wheel !en...
def disable_env_reset_on_sudo(log=False): """ updates /etc/sudoers so that users from %wheel keep their environment when executing a sudo call """ if log: bookshelf2.logging_helpers.log_green('disabling env reset on sudo') file_append('/etc/sudoers', 'Defaults:%wheel !en...
[ "updates", "/", "etc", "/", "sudoers", "so", "that", "users", "from", "%wheel", "keep", "their", "environment", "when", "executing", "a", "sudo", "call" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L106-L117
[ "def", "disable_env_reset_on_sudo", "(", "log", "=", "False", ")", ":", "if", "log", ":", "bookshelf2", ".", "logging_helpers", ".", "log_green", "(", "'disabling env reset on sudo'", ")", "file_append", "(", "'/etc/sudoers'", ",", "'Defaults:%wheel !env_reset,!secure_p...
a6770678e735de95b194f6e6989223970db5f654
train
disable_requiretty_on_sudoers
allow sudo calls through ssh without a tty
bookshelf/api_v2/os_helpers.py
def disable_requiretty_on_sudoers(log=False): """ allow sudo calls through ssh without a tty """ if log: bookshelf2.logging_helpers.log_green( 'disabling requiretty on sudo calls') comment_line('/etc/sudoers', '^Defaults.*requiretty', use_sudo=True) return True
def disable_requiretty_on_sudoers(log=False): """ allow sudo calls through ssh without a tty """ if log: bookshelf2.logging_helpers.log_green( 'disabling requiretty on sudo calls') comment_line('/etc/sudoers', '^Defaults.*requiretty', use_sudo=True) return True
[ "allow", "sudo", "calls", "through", "ssh", "without", "a", "tty" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L120-L128
[ "def", "disable_requiretty_on_sudoers", "(", "log", "=", "False", ")", ":", "if", "log", ":", "bookshelf2", ".", "logging_helpers", ".", "log_green", "(", "'disabling requiretty on sudo calls'", ")", "comment_line", "(", "'/etc/sudoers'", ",", "'^Defaults.*requiretty'",...
a6770678e735de95b194f6e6989223970db5f654
train
file_attribs
Updates the mode/owner/group for the remote file at the given location.
bookshelf/api_v2/os_helpers.py
def file_attribs(location, mode=None, owner=None, group=None, use_sudo=False, recursive=True): """Updates the mode/owner/group for the remote file at the given location.""" return dir_attribs(location=location, ...
def file_attribs(location, mode=None, owner=None, group=None, use_sudo=False, recursive=True): """Updates the mode/owner/group for the remote file at the given location.""" return dir_attribs(location=location, ...
[ "Updates", "the", "mode", "/", "owner", "/", "group", "for", "the", "remote", "file", "at", "the", "given", "location", "." ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L182-L195
[ "def", "file_attribs", "(", "location", ",", "mode", "=", "None", ",", "owner", "=", "None", ",", "group", "=", "None", ",", "use_sudo", "=", "False", ",", "recursive", "=", "True", ")", ":", "return", "dir_attribs", "(", "location", "=", "location", "...
a6770678e735de95b194f6e6989223970db5f654
train
os_release
returns /etc/os-release in a dictionary
bookshelf/api_v2/os_helpers.py
def os_release(): """ returns /etc/os-release in a dictionary """ with settings(hide('warnings', 'running', 'stderr'), warn_only=True, capture=True): release = {} data = run('cat /etc/os-release') for line in data.split('\n'): if not line: c...
def os_release(): """ returns /etc/os-release in a dictionary """ with settings(hide('warnings', 'running', 'stderr'), warn_only=True, capture=True): release = {} data = run('cat /etc/os-release') for line in data.split('\n'): if not line: c...
[ "returns", "/", "etc", "/", "os", "-", "release", "in", "a", "dictionary" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L198-L212
[ "def", "os_release", "(", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stderr'", ")", ",", "warn_only", "=", "True", ",", "capture", "=", "True", ")", ":", "release", "=", "{", "}", "data", "=", "run", "(", ...
a6770678e735de95b194f6e6989223970db5f654
train
linux_distribution
returns the linux distribution in lower case
bookshelf/api_v2/os_helpers.py
def linux_distribution(): """ returns the linux distribution in lower case """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True, capture=True): data = os_release() return(data['ID'])
def linux_distribution(): """ returns the linux distribution in lower case """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True, capture=True): data = os_release() return(data['ID'])
[ "returns", "the", "linux", "distribution", "in", "lower", "case" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L215-L220
[ "def", "linux_distribution", "(", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stdout'", ",", "'stderr'", ")", ",", "warn_only", "=", "True", ",", "capture", "=", "True", ")", ":", "data", "=", "os_release", "(",...
a6770678e735de95b194f6e6989223970db5f654
train
lsb_release
returns /etc/lsb-release in a dictionary
bookshelf/api_v2/os_helpers.py
def lsb_release(): """ returns /etc/lsb-release in a dictionary """ with settings(hide('warnings', 'running'), capture=True): _lsb_release = {} data = sudo('cat /etc/lsb-release') for line in data.split('\n'): if not line: continue parts = line.sp...
def lsb_release(): """ returns /etc/lsb-release in a dictionary """ with settings(hide('warnings', 'running'), capture=True): _lsb_release = {} data = sudo('cat /etc/lsb-release') for line in data.split('\n'): if not line: continue parts = line.sp...
[ "returns", "/", "etc", "/", "lsb", "-", "release", "in", "a", "dictionary" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L223-L236
[ "def", "lsb_release", "(", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ")", ",", "capture", "=", "True", ")", ":", "_lsb_release", "=", "{", "}", "data", "=", "sudo", "(", "'cat /etc/lsb-release'", ")", "for", "line", ...
a6770678e735de95b194f6e6989223970db5f654
train
restart_service
restarts a service
bookshelf/api_v2/os_helpers.py
def restart_service(service, log=False): """ restarts a service """ with settings(): if log: bookshelf2.logging_helpers.log_yellow( 'stoping service %s' % service) sudo('service %s stop' % service) if log: bookshelf2.logging_helpers.log_yellow( ...
def restart_service(service, log=False): """ restarts a service """ with settings(): if log: bookshelf2.logging_helpers.log_yellow( 'stoping service %s' % service) sudo('service %s stop' % service) if log: bookshelf2.logging_helpers.log_yellow( ...
[ "restarts", "a", "service" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L246-L257
[ "def", "restart_service", "(", "service", ",", "log", "=", "False", ")", ":", "with", "settings", "(", ")", ":", "if", "log", ":", "bookshelf2", ".", "logging_helpers", ".", "log_yellow", "(", "'stoping service %s'", "%", "service", ")", "sudo", "(", "'ser...
a6770678e735de95b194f6e6989223970db5f654
train
systemd
manipulates systemd services
bookshelf/api_v2/os_helpers.py
def systemd(service, start=True, enabled=True, unmask=False, restart=False): """ manipulates systemd services """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True, capture=True): if restart: sudo('systemctl restart %s' % service) else:...
def systemd(service, start=True, enabled=True, unmask=False, restart=False): """ manipulates systemd services """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True, capture=True): if restart: sudo('systemctl restart %s' % service) else:...
[ "manipulates", "systemd", "services" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L260-L280
[ "def", "systemd", "(", "service", ",", "start", "=", "True", ",", "enabled", "=", "True", ",", "unmask", "=", "False", ",", "restart", "=", "False", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stdout'", ",", ...
a6770678e735de95b194f6e6989223970db5f654
train
install_os_updates
installs OS updates
bookshelf/api_v2/os_helpers.py
def install_os_updates(distribution, force=False): """ installs OS updates """ if ('centos' in distribution or 'rhel' in distribution or 'redhat' in distribution): bookshelf2.logging_helpers.log_green('installing OS updates') sudo("yum -y --quiet clean all") sudo(...
def install_os_updates(distribution, force=False): """ installs OS updates """ if ('centos' in distribution or 'rhel' in distribution or 'redhat' in distribution): bookshelf2.logging_helpers.log_green('installing OS updates') sudo("yum -y --quiet clean all") sudo(...
[ "installs", "OS", "updates" ]
pyBookshelf/bookshelf
python
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L319-L341
[ "def", "install_os_updates", "(", "distribution", ",", "force", "=", "False", ")", ":", "if", "(", "'centos'", "in", "distribution", "or", "'rhel'", "in", "distribution", "or", "'redhat'", "in", "distribution", ")", ":", "bookshelf2", ".", "logging_helpers", "...
a6770678e735de95b194f6e6989223970db5f654
train
Stats.ansi_format
Return a human readable ANSI-terminal printout of the stats. width Custom width for the graph (in characters). height Custom height for the graph (in characters).
mrcrowbar/statistics.py
def ansi_format( self, width=64, height=12 ): """Return a human readable ANSI-terminal printout of the stats. width Custom width for the graph (in characters). height Custom height for the graph (in characters). """ from mrcrowbar.ansi import format_bar_...
def ansi_format( self, width=64, height=12 ): """Return a human readable ANSI-terminal printout of the stats. width Custom width for the graph (in characters). height Custom height for the graph (in characters). """ from mrcrowbar.ansi import format_bar_...
[ "Return", "a", "human", "readable", "ANSI", "-", "terminal", "printout", "of", "the", "stats", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/statistics.py#L34-L59
[ "def", "ansi_format", "(", "self", ",", "width", "=", "64", ",", "height", "=", "12", ")", ":", "from", "mrcrowbar", ".", "ansi", "import", "format_bar_graph_iter", "if", "(", "256", "%", "width", ")", "!=", "0", ":", "raise", "ValueError", "(", "'Widt...
b1ed882c4555552e7656b2d84aca543184577fa3
train
TaskWhitelist.put
Updates this task whitelist on the saltant server. Returns: :class:`saltant.models.task_whitelist.TaskWhitelist`: A task whitelist model instance representing the task whitelist just updated.
saltant/models/task_whitelist.py
def put(self): """Updates this task whitelist on the saltant server. Returns: :class:`saltant.models.task_whitelist.TaskWhitelist`: A task whitelist model instance representing the task whitelist just updated. """ return self.manager.put( ...
def put(self): """Updates this task whitelist on the saltant server. Returns: :class:`saltant.models.task_whitelist.TaskWhitelist`: A task whitelist model instance representing the task whitelist just updated. """ return self.manager.put( ...
[ "Updates", "this", "task", "whitelist", "on", "the", "saltant", "server", "." ]
saltant-org/saltant-py
python
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/task_whitelist.py#L96-L114
[ "def", "put", "(", "self", ")", ":", "return", "self", ".", "manager", ".", "put", "(", "id", "=", "self", ".", "id", ",", "name", "=", "self", ".", "name", ",", "description", "=", "self", ".", "description", ",", "whitelisted_container_task_types", "...
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
train
TaskWhitelistManager.create
Create a task whitelist. Args: name (str): The name of the task whitelist. description (str, optional): A description of the task whitelist. whitelisted_container_task_types (list, optional): A list of whitelisted container task type IDs. whitelis...
saltant/models/task_whitelist.py
def create( self, name, description="", whitelisted_container_task_types=None, whitelisted_executable_task_types=None, ): """Create a task whitelist. Args: name (str): The name of the task whitelist. description (str, optional): A desc...
def create( self, name, description="", whitelisted_container_task_types=None, whitelisted_executable_task_types=None, ): """Create a task whitelist. Args: name (str): The name of the task whitelist. description (str, optional): A desc...
[ "Create", "a", "task", "whitelist", "." ]
saltant-org/saltant-py
python
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/task_whitelist.py#L163-L212
[ "def", "create", "(", "self", ",", "name", ",", "description", "=", "\"\"", ",", "whitelisted_container_task_types", "=", "None", ",", "whitelisted_executable_task_types", "=", "None", ",", ")", ":", "# Translate whitelists None to [] if necessary", "if", "whitelisted_c...
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
train
TaskWhitelistManager.patch
Partially updates a task whitelist on the saltant server. Args: id (int): The ID of the task whitelist. name (str, optional): The name of the task whitelist. description (str, optional): A description of the task whitelist. whitelisted_container_task_types (list,...
saltant/models/task_whitelist.py
def patch( self, id, name=None, description=None, whitelisted_container_task_types=None, whitelisted_executable_task_types=None, ): """Partially updates a task whitelist on the saltant server. Args: id (int): The ID of the task whitelist. ...
def patch( self, id, name=None, description=None, whitelisted_container_task_types=None, whitelisted_executable_task_types=None, ): """Partially updates a task whitelist on the saltant server. Args: id (int): The ID of the task whitelist. ...
[ "Partially", "updates", "a", "task", "whitelist", "on", "the", "saltant", "server", "." ]
saltant-org/saltant-py
python
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/task_whitelist.py#L214-L270
[ "def", "patch", "(", "self", ",", "id", ",", "name", "=", "None", ",", "description", "=", "None", ",", "whitelisted_container_task_types", "=", "None", ",", "whitelisted_executable_task_types", "=", "None", ",", ")", ":", "# Update the object", "request_url", "...
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
train
enable_logging
Enable sending logs to stderr. Useful for shell sessions. level Logging threshold, as defined in the logging module of the Python standard library. Defaults to 'WARNING'.
mrcrowbar/utils.py
def enable_logging( level='WARNING' ): """Enable sending logs to stderr. Useful for shell sessions. level Logging threshold, as defined in the logging module of the Python standard library. Defaults to 'WARNING'. """ log = logging.getLogger( 'mrcrowbar' ) log.setLevel( level ) o...
def enable_logging( level='WARNING' ): """Enable sending logs to stderr. Useful for shell sessions. level Logging threshold, as defined in the logging module of the Python standard library. Defaults to 'WARNING'. """ log = logging.getLogger( 'mrcrowbar' ) log.setLevel( level ) o...
[ "Enable", "sending", "logs", "to", "stderr", ".", "Useful", "for", "shell", "sessions", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L15-L28
[ "def", "enable_logging", "(", "level", "=", "'WARNING'", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "'mrcrowbar'", ")", "log", ".", "setLevel", "(", "level", ")", "out", "=", "logging", ".", "StreamHandler", "(", ")", "out", ".", "setLevel",...
b1ed882c4555552e7656b2d84aca543184577fa3
train
find_all_iter
Iterate through every location a substring can be found in a source string. source The source string to search. start Start offset to read from (default: start) end End offset to stop reading at (default: end) overlap Whether to return overlapping matches (default: fa...
mrcrowbar/utils.py
def find_all_iter( source, substring, start=None, end=None, overlap=False ): """Iterate through every location a substring can be found in a source string. source The source string to search. start Start offset to read from (default: start) end End offset to stop reading at (d...
def find_all_iter( source, substring, start=None, end=None, overlap=False ): """Iterate through every location a substring can be found in a source string. source The source string to search. start Start offset to read from (default: start) end End offset to stop reading at (d...
[ "Iterate", "through", "every", "location", "a", "substring", "can", "be", "found", "in", "a", "source", "string", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L51-L80
[ "def", "find_all_iter", "(", "source", ",", "substring", ",", "start", "=", "None", ",", "end", "=", "None", ",", "overlap", "=", "False", ")", ":", "data", "=", "source", "base", "=", "0", "if", "end", "is", "not", "None", ":", "data", "=", "data"...
b1ed882c4555552e7656b2d84aca543184577fa3
train
find_all
Return every location a substring can be found in a source string. source The source string to search. start Start offset to read from (default: start) end End offset to stop reading at (default: end) overlap Whether to return overlapping matches (default: false)
mrcrowbar/utils.py
def find_all( source, substring, start=None, end=None, overlap=False ): """Return every location a substring can be found in a source string. source The source string to search. start Start offset to read from (default: start) end End offset to stop reading at (default: end) ...
def find_all( source, substring, start=None, end=None, overlap=False ): """Return every location a substring can be found in a source string. source The source string to search. start Start offset to read from (default: start) end End offset to stop reading at (default: end) ...
[ "Return", "every", "location", "a", "substring", "can", "be", "found", "in", "a", "source", "string", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L83-L98
[ "def", "find_all", "(", "source", ",", "substring", ",", "start", "=", "None", ",", "end", "=", "None", ",", "overlap", "=", "False", ")", ":", "return", "[", "x", "for", "x", "in", "find_all_iter", "(", "source", ",", "substring", ",", "start", ",",...
b1ed882c4555552e7656b2d84aca543184577fa3
train
basic_diff
Perform a basic diff between two equal-sized binary strings and return a list of (offset, size) tuples denoting the differences. source1 The first byte string source. source2 The second byte string source. start Start offset to read from (default: start) end End o...
mrcrowbar/utils.py
def basic_diff( source1, source2, start=None, end=None ): """Perform a basic diff between two equal-sized binary strings and return a list of (offset, size) tuples denoting the differences. source1 The first byte string source. source2 The second byte string source. start ...
def basic_diff( source1, source2, start=None, end=None ): """Perform a basic diff between two equal-sized binary strings and return a list of (offset, size) tuples denoting the differences. source1 The first byte string source. source2 The second byte string source. start ...
[ "Perform", "a", "basic", "diff", "between", "two", "equal", "-", "sized", "binary", "strings", "and", "return", "a", "list", "of", "(", "offset", "size", ")", "tuples", "denoting", "the", "differences", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L101-L137
[ "def", "basic_diff", "(", "source1", ",", "source2", ",", "start", "=", "None", ",", "end", "=", "None", ")", ":", "start", "=", "start", "if", "start", "is", "not", "None", "else", "0", "end", "=", "end", "if", "end", "is", "not", "None", "else", ...
b1ed882c4555552e7656b2d84aca543184577fa3
train
hexdump_iter
Return the contents of a byte string in tabular hexadecimal/ASCII format. source The byte string to print. start Start offset to read from (default: start) end End offset to stop reading at (default: end) length Length to read in (optional replacement for end) ...
mrcrowbar/utils.py
def hexdump_iter( source, start=None, end=None, length=None, major_len=8, minor_len=4, colour=True, address_base=None ): """Return the contents of a byte string in tabular hexadecimal/ASCII format. source The byte string to print. start Start offset to read from (default: start) e...
def hexdump_iter( source, start=None, end=None, length=None, major_len=8, minor_len=4, colour=True, address_base=None ): """Return the contents of a byte string in tabular hexadecimal/ASCII format. source The byte string to print. start Start offset to read from (default: start) e...
[ "Return", "the", "contents", "of", "a", "byte", "string", "in", "tabular", "hexadecimal", "/", "ASCII", "format", ".", "source", "The", "byte", "string", "to", "print", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L160-L200
[ "def", "hexdump_iter", "(", "source", ",", "start", "=", "None", ",", "end", "=", "None", ",", "length", "=", "None", ",", "major_len", "=", "8", ",", "minor_len", "=", "4", ",", "colour", "=", "True", ",", "address_base", "=", "None", ")", ":", "a...
b1ed882c4555552e7656b2d84aca543184577fa3
train
hexdump
Print the contents of a byte string in tabular hexadecimal/ASCII format. source The byte string to print. start Start offset to read from (default: start) end End offset to stop reading at (default: end) length Length to read in (optional replacement for end) ...
mrcrowbar/utils.py
def hexdump( source, start=None, end=None, length=None, major_len=8, minor_len=4, colour=True, address_base=None ): """Print the contents of a byte string in tabular hexadecimal/ASCII format. source The byte string to print. start Start offset to read from (default: start) end ...
def hexdump( source, start=None, end=None, length=None, major_len=8, minor_len=4, colour=True, address_base=None ): """Print the contents of a byte string in tabular hexadecimal/ASCII format. source The byte string to print. start Start offset to read from (default: start) end ...
[ "Print", "the", "contents", "of", "a", "byte", "string", "in", "tabular", "hexadecimal", "/", "ASCII", "format", ".", "source", "The", "byte", "string", "to", "print", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L203-L233
[ "def", "hexdump", "(", "source", ",", "start", "=", "None", ",", "end", "=", "None", ",", "length", "=", "None", ",", "major_len", "=", "8", ",", "minor_len", "=", "4", ",", "colour", "=", "True", ",", "address_base", "=", "None", ")", ":", "for", ...
b1ed882c4555552e7656b2d84aca543184577fa3
train
hexdump_diff_iter
Returns the differences between two byte strings in tabular hexadecimal/ASCII format. source1 The first byte string source. source2 The second byte string source. start Start offset to read from (default: start) end End offset to stop reading at (default: end) le...
mrcrowbar/utils.py
def hexdump_diff_iter( source1, source2, start=None, end=None, length=None, major_len=8, minor_len=4, colour=True, before=2, after=2, address_base=None ): """Returns the differences between two byte strings in tabular hexadecimal/ASCII format. source1 The first byte string source. source2 ...
def hexdump_diff_iter( source1, source2, start=None, end=None, length=None, major_len=8, minor_len=4, colour=True, before=2, after=2, address_base=None ): """Returns the differences between two byte strings in tabular hexadecimal/ASCII format. source1 The first byte string source. source2 ...
[ "Returns", "the", "differences", "between", "two", "byte", "strings", "in", "tabular", "hexadecimal", "/", "ASCII", "format", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L236-L324
[ "def", "hexdump_diff_iter", "(", "source1", ",", "source2", ",", "start", "=", "None", ",", "end", "=", "None", ",", "length", "=", "None", ",", "major_len", "=", "8", ",", "minor_len", "=", "4", ",", "colour", "=", "True", ",", "before", "=", "2", ...
b1ed882c4555552e7656b2d84aca543184577fa3
train
hexdump_diff
Returns the differences between two byte strings in tabular hexadecimal/ASCII format. source1 The first byte string source. source2 The second byte string source. start Start offset to read from (default: start) end End offset to stop reading at (default: end) le...
mrcrowbar/utils.py
def hexdump_diff( source1, source2, start=None, end=None, length=None, major_len=8, minor_len=4, colour=True, before=2, after=2, address_base=None ): """Returns the differences between two byte strings in tabular hexadecimal/ASCII format. source1 The first byte string source. source2 The s...
def hexdump_diff( source1, source2, start=None, end=None, length=None, major_len=8, minor_len=4, colour=True, before=2, after=2, address_base=None ): """Returns the differences between two byte strings in tabular hexadecimal/ASCII format. source1 The first byte string source. source2 The s...
[ "Returns", "the", "differences", "between", "two", "byte", "strings", "in", "tabular", "hexadecimal", "/", "ASCII", "format", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L327-L366
[ "def", "hexdump_diff", "(", "source1", ",", "source2", ",", "start", "=", "None", ",", "end", "=", "None", ",", "length", "=", "None", ",", "major_len", "=", "8", ",", "minor_len", "=", "4", ",", "colour", "=", "True", ",", "before", "=", "2", ",",...
b1ed882c4555552e7656b2d84aca543184577fa3
train
unpack_bits
Expand a bitfield into a 64-bit int (8 bool bytes).
mrcrowbar/utils.py
def unpack_bits( byte ): """Expand a bitfield into a 64-bit int (8 bool bytes).""" longbits = byte & (0x00000000000000ff) longbits = (longbits | (longbits<<28)) & (0x0000000f0000000f) longbits = (longbits | (longbits<<14)) & (0x0003000300030003) longbits = (longbits | (longbits<<7)) & (0x01010101010...
def unpack_bits( byte ): """Expand a bitfield into a 64-bit int (8 bool bytes).""" longbits = byte & (0x00000000000000ff) longbits = (longbits | (longbits<<28)) & (0x0000000f0000000f) longbits = (longbits | (longbits<<14)) & (0x0003000300030003) longbits = (longbits | (longbits<<7)) & (0x01010101010...
[ "Expand", "a", "bitfield", "into", "a", "64", "-", "bit", "int", "(", "8", "bool", "bytes", ")", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L376-L382
[ "def", "unpack_bits", "(", "byte", ")", ":", "longbits", "=", "byte", "&", "(", "0x00000000000000ff", ")", "longbits", "=", "(", "longbits", "|", "(", "longbits", "<<", "28", ")", ")", "&", "(", "0x0000000f0000000f", ")", "longbits", "=", "(", "longbits"...
b1ed882c4555552e7656b2d84aca543184577fa3
train
pack_bits
Crunch a 64-bit int (8 bool bytes) into a bitfield.
mrcrowbar/utils.py
def pack_bits( longbits ): """Crunch a 64-bit int (8 bool bytes) into a bitfield.""" byte = longbits & (0x0101010101010101) byte = (byte | (byte>>7)) & (0x0003000300030003) byte = (byte | (byte>>14)) & (0x0000000f0000000f) byte = (byte | (byte>>28)) & (0x00000000000000ff) return byte
def pack_bits( longbits ): """Crunch a 64-bit int (8 bool bytes) into a bitfield.""" byte = longbits & (0x0101010101010101) byte = (byte | (byte>>7)) & (0x0003000300030003) byte = (byte | (byte>>14)) & (0x0000000f0000000f) byte = (byte | (byte>>28)) & (0x00000000000000ff) return byte
[ "Crunch", "a", "64", "-", "bit", "int", "(", "8", "bool", "bytes", ")", "into", "a", "bitfield", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L385-L391
[ "def", "pack_bits", "(", "longbits", ")", ":", "byte", "=", "longbits", "&", "(", "0x0101010101010101", ")", "byte", "=", "(", "byte", "|", "(", "byte", ">>", "7", ")", ")", "&", "(", "0x0003000300030003", ")", "byte", "=", "(", "byte", "|", "(", "...
b1ed882c4555552e7656b2d84aca543184577fa3
train
pixdump_iter
Return the contents of a byte string as a 256 colour image. source The byte string to print. start Start offset to read from (default: start) end End offset to stop reading at (default: end) length Length to read in (optional replacement for end) width Wi...
mrcrowbar/utils.py
def pixdump_iter( source, start=None, end=None, length=None, width=64, height=None, palette=None ): """Return the contents of a byte string as a 256 colour image. source The byte string to print. start Start offset to read from (default: start) end End offset to stop reading a...
def pixdump_iter( source, start=None, end=None, length=None, width=64, height=None, palette=None ): """Return the contents of a byte string as a 256 colour image. source The byte string to print. start Start offset to read from (default: start) end End offset to stop reading a...
[ "Return", "the", "contents", "of", "a", "byte", "string", "as", "a", "256", "colour", "image", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L394-L447
[ "def", "pixdump_iter", "(", "source", ",", "start", "=", "None", ",", "end", "=", "None", ",", "length", "=", "None", ",", "width", "=", "64", ",", "height", "=", "None", ",", "palette", "=", "None", ")", ":", "assert", "is_bytes", "(", "source", "...
b1ed882c4555552e7656b2d84aca543184577fa3
train
pixdump
Print the contents of a byte string as a 256 colour image. source The byte string to print. start Start offset to read from (default: start) end End offset to stop reading at (default: end) length Length to read in (optional replacement for end) width Wid...
mrcrowbar/utils.py
def pixdump( source, start=None, end=None, length=None, width=64, height=None, palette=None ): """Print the contents of a byte string as a 256 colour image. source The byte string to print. start Start offset to read from (default: start) end End offset to stop reading at (def...
def pixdump( source, start=None, end=None, length=None, width=64, height=None, palette=None ): """Print the contents of a byte string as a 256 colour image. source The byte string to print. start Start offset to read from (default: start) end End offset to stop reading at (def...
[ "Print", "the", "contents", "of", "a", "byte", "string", "as", "a", "256", "colour", "image", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L450-L476
[ "def", "pixdump", "(", "source", ",", "start", "=", "None", ",", "end", "=", "None", ",", "length", "=", "None", ",", "width", "=", "64", ",", "height", "=", "None", ",", "palette", "=", "None", ")", ":", "for", "line", "in", "pixdump_iter", "(", ...
b1ed882c4555552e7656b2d84aca543184577fa3
train
BitReader.set_offset
Set the current read offset (in bytes) for the instance.
mrcrowbar/utils.py
def set_offset( self, offset ): """Set the current read offset (in bytes) for the instance.""" assert offset in range( len( self.buffer ) ) self.pos = offset self._fill_buffer()
def set_offset( self, offset ): """Set the current read offset (in bytes) for the instance.""" assert offset in range( len( self.buffer ) ) self.pos = offset self._fill_buffer()
[ "Set", "the", "current", "read", "offset", "(", "in", "bytes", ")", "for", "the", "instance", "." ]
moralrecordings/mrcrowbar
python
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L538-L542
[ "def", "set_offset", "(", "self", ",", "offset", ")", ":", "assert", "offset", "in", "range", "(", "len", "(", "self", ".", "buffer", ")", ")", "self", ".", "pos", "=", "offset", "self", ".", "_fill_buffer", "(", ")" ]
b1ed882c4555552e7656b2d84aca543184577fa3