id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
40,700
Eyepea/systemDream
src/systemdream/journal/helpers.py
send
def send(MESSAGE, SOCKET, MESSAGE_ID=None, CODE_FILE=None, CODE_LINE=None, CODE_FUNC=None, **kwargs): r"""Send a message to the journal. >>> journal.send('Hello world') >>> journal.send('Hello, again, world', FIELD2='Greetings!') >>> journal.send('Binary message', BINARY=b'\xde\xad\xb...
python
def send(MESSAGE, SOCKET, MESSAGE_ID=None, CODE_FILE=None, CODE_LINE=None, CODE_FUNC=None, **kwargs): r"""Send a message to the journal. >>> journal.send('Hello world') >>> journal.send('Hello, again, world', FIELD2='Greetings!') >>> journal.send('Binary message', BINARY=b'\xde\xad\xb...
[ "def", "send", "(", "MESSAGE", ",", "SOCKET", ",", "MESSAGE_ID", "=", "None", ",", "CODE_FILE", "=", "None", ",", "CODE_LINE", "=", "None", ",", "CODE_FUNC", "=", "None", ",", "*", "*", "kwargs", ")", ":", "args", "=", "[", "'MESSAGE='", "+", "MESSAG...
r"""Send a message to the journal. >>> journal.send('Hello world') >>> journal.send('Hello, again, world', FIELD2='Greetings!') >>> journal.send('Binary message', BINARY=b'\xde\xad\xbe\xef') Value of the MESSAGE argument will be used for the MESSAGE= field. MESSAGE must be a string and will be sen...
[ "r", "Send", "a", "message", "to", "the", "journal", "." ]
018fa5e9ff0f4fdc62fa85b235725d0f8b24f1a8
https://github.com/Eyepea/systemDream/blob/018fa5e9ff0f4fdc62fa85b235725d0f8b24f1a8/src/systemdream/journal/helpers.py#L13-L61
40,701
AtomHash/evernode
evernode/models/base_model.py
BaseModel.exists
def exists(self): """ Checks if item already exists in database """ self_object = self.query.filter_by(id=self.id).first() if self_object is None: return False return True
python
def exists(self): """ Checks if item already exists in database """ self_object = self.query.filter_by(id=self.id).first() if self_object is None: return False return True
[ "def", "exists", "(", "self", ")", ":", "self_object", "=", "self", ".", "query", ".", "filter_by", "(", "id", "=", "self", ".", "id", ")", ".", "first", "(", ")", "if", "self_object", "is", "None", ":", "return", "False", "return", "True" ]
Checks if item already exists in database
[ "Checks", "if", "item", "already", "exists", "in", "database" ]
b2fb91555fb937a3f3eba41db56dee26f9b034be
https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/models/base_model.py#L27-L32
40,702
AtomHash/evernode
evernode/models/base_model.py
BaseModel.delete
def delete(self): """ Easy delete for db models """ try: if self.exists() is False: return None self.db.session.delete(self) self.db.session.commit() except (Exception, BaseException) as error: # fail silently r...
python
def delete(self): """ Easy delete for db models """ try: if self.exists() is False: return None self.db.session.delete(self) self.db.session.commit() except (Exception, BaseException) as error: # fail silently r...
[ "def", "delete", "(", "self", ")", ":", "try", ":", "if", "self", ".", "exists", "(", ")", "is", "False", ":", "return", "None", "self", ".", "db", ".", "session", ".", "delete", "(", "self", ")", "self", ".", "db", ".", "session", ".", "commit",...
Easy delete for db models
[ "Easy", "delete", "for", "db", "models" ]
b2fb91555fb937a3f3eba41db56dee26f9b034be
https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/models/base_model.py#L39-L48
40,703
zsiciarz/pygcvs
pygcvs/parser.py
GcvsParser.row_to_dict
def row_to_dict(self, row): """ Converts a raw GCVS record to a dictionary of star data. """ constellation = self.parse_constellation(row[0]) name = self.parse_name(row[1]) ra, dec = self.parse_coordinates(row[2]) variable_type = row[3].strip() max_magnitu...
python
def row_to_dict(self, row): """ Converts a raw GCVS record to a dictionary of star data. """ constellation = self.parse_constellation(row[0]) name = self.parse_name(row[1]) ra, dec = self.parse_coordinates(row[2]) variable_type = row[3].strip() max_magnitu...
[ "def", "row_to_dict", "(", "self", ",", "row", ")", ":", "constellation", "=", "self", ".", "parse_constellation", "(", "row", "[", "0", "]", ")", "name", "=", "self", ".", "parse_name", "(", "row", "[", "1", "]", ")", "ra", ",", "dec", "=", "self"...
Converts a raw GCVS record to a dictionary of star data.
[ "Converts", "a", "raw", "GCVS", "record", "to", "a", "dictionary", "of", "star", "data", "." ]
ed5522ab9cf9237592a6af7a0bc8cad079afeb67
https://github.com/zsiciarz/pygcvs/blob/ed5522ab9cf9237592a6af7a0bc8cad079afeb67/pygcvs/parser.py#L139-L164
40,704
zsiciarz/pygcvs
pygcvs/parser.py
GcvsParser.parse_magnitude
def parse_magnitude(self, magnitude_str): """ Converts magnitude field to a float value, or ``None`` if GCVS does not list the magnitude. Returns a tuple (magnitude, symbol), where symbol can be either an empty string or a single character - one of '<', '>', '('. """ ...
python
def parse_magnitude(self, magnitude_str): """ Converts magnitude field to a float value, or ``None`` if GCVS does not list the magnitude. Returns a tuple (magnitude, symbol), where symbol can be either an empty string or a single character - one of '<', '>', '('. """ ...
[ "def", "parse_magnitude", "(", "self", ",", "magnitude_str", ")", ":", "symbol", "=", "magnitude_str", "[", "0", "]", ".", "strip", "(", ")", "magnitude", "=", "magnitude_str", "[", "1", ":", "6", "]", ".", "strip", "(", ")", "return", "float", "(", ...
Converts magnitude field to a float value, or ``None`` if GCVS does not list the magnitude. Returns a tuple (magnitude, symbol), where symbol can be either an empty string or a single character - one of '<', '>', '('.
[ "Converts", "magnitude", "field", "to", "a", "float", "value", "or", "None", "if", "GCVS", "does", "not", "list", "the", "magnitude", "." ]
ed5522ab9cf9237592a6af7a0bc8cad079afeb67
https://github.com/zsiciarz/pygcvs/blob/ed5522ab9cf9237592a6af7a0bc8cad079afeb67/pygcvs/parser.py#L190-L200
40,705
zsiciarz/pygcvs
pygcvs/parser.py
GcvsParser.parse_period
def parse_period(self, period_str): """ Converts period field to a float value or ``None`` if there is no period in GCVS record. """ period = period_str.translate(TRANSLATION_MAP)[3:14].strip() return float(period) if period else None
python
def parse_period(self, period_str): """ Converts period field to a float value or ``None`` if there is no period in GCVS record. """ period = period_str.translate(TRANSLATION_MAP)[3:14].strip() return float(period) if period else None
[ "def", "parse_period", "(", "self", ",", "period_str", ")", ":", "period", "=", "period_str", ".", "translate", "(", "TRANSLATION_MAP", ")", "[", "3", ":", "14", "]", ".", "strip", "(", ")", "return", "float", "(", "period", ")", "if", "period", "else"...
Converts period field to a float value or ``None`` if there is no period in GCVS record.
[ "Converts", "period", "field", "to", "a", "float", "value", "or", "None", "if", "there", "is", "no", "period", "in", "GCVS", "record", "." ]
ed5522ab9cf9237592a6af7a0bc8cad079afeb67
https://github.com/zsiciarz/pygcvs/blob/ed5522ab9cf9237592a6af7a0bc8cad079afeb67/pygcvs/parser.py#L210-L216
40,706
ponty/confduino
confduino/hwpackinstall.py
find_hwpack_dir
def find_hwpack_dir(root): """search for hwpack dir under root.""" root = path(root) log.debug('files in dir: %s', root) for x in root.walkfiles(): log.debug(' %s', x) hwpack_dir = None for h in (root.walkfiles('boards.txt')): assert not hwpack_dir hwpack_dir = h.parent...
python
def find_hwpack_dir(root): """search for hwpack dir under root.""" root = path(root) log.debug('files in dir: %s', root) for x in root.walkfiles(): log.debug(' %s', x) hwpack_dir = None for h in (root.walkfiles('boards.txt')): assert not hwpack_dir hwpack_dir = h.parent...
[ "def", "find_hwpack_dir", "(", "root", ")", ":", "root", "=", "path", "(", "root", ")", "log", ".", "debug", "(", "'files in dir: %s'", ",", "root", ")", "for", "x", "in", "root", ".", "walkfiles", "(", ")", ":", "log", ".", "debug", "(", "' %s'", ...
search for hwpack dir under root.
[ "search", "for", "hwpack", "dir", "under", "root", "." ]
f4c261e5e84997f145a8bdd001f471db74c9054b
https://github.com/ponty/confduino/blob/f4c261e5e84997f145a8bdd001f471db74c9054b/confduino/hwpackinstall.py#L11-L25
40,707
ponty/confduino
confduino/hwpackinstall.py
install_hwpack
def install_hwpack(url, replace_existing=False): """install hwpackrary from web or local files system. :param url: web address or file path :param replace_existing: bool :rtype: None """ d = tmpdir(tmpdir()) f = download(url) Archive(f).extractall(d) clean_dir(d) src_dhwpack =...
python
def install_hwpack(url, replace_existing=False): """install hwpackrary from web or local files system. :param url: web address or file path :param replace_existing: bool :rtype: None """ d = tmpdir(tmpdir()) f = download(url) Archive(f).extractall(d) clean_dir(d) src_dhwpack =...
[ "def", "install_hwpack", "(", "url", ",", "replace_existing", "=", "False", ")", ":", "d", "=", "tmpdir", "(", "tmpdir", "(", ")", ")", "f", "=", "download", "(", "url", ")", "Archive", "(", "f", ")", ".", "extractall", "(", "d", ")", "clean_dir", ...
install hwpackrary from web or local files system. :param url: web address or file path :param replace_existing: bool :rtype: None
[ "install", "hwpackrary", "from", "web", "or", "local", "files", "system", "." ]
f4c261e5e84997f145a8bdd001f471db74c9054b
https://github.com/ponty/confduino/blob/f4c261e5e84997f145a8bdd001f471db74c9054b/confduino/hwpackinstall.py#L29-L61
40,708
rackerlabs/python-lunrclient
lunrclient/lunr.py
LunrVolume.create
def create(self, volume_id, vtype, size, affinity): """ create a volume """ volume_id = volume_id or str(uuid.uuid4()) params = {'volume_type_name': vtype, 'size': size, 'affinity': affinity} return self.http_put('/volumes/%s' % volume_...
python
def create(self, volume_id, vtype, size, affinity): """ create a volume """ volume_id = volume_id or str(uuid.uuid4()) params = {'volume_type_name': vtype, 'size': size, 'affinity': affinity} return self.http_put('/volumes/%s' % volume_...
[ "def", "create", "(", "self", ",", "volume_id", ",", "vtype", ",", "size", ",", "affinity", ")", ":", "volume_id", "=", "volume_id", "or", "str", "(", "uuid", ".", "uuid4", "(", ")", ")", "params", "=", "{", "'volume_type_name'", ":", "vtype", ",", "...
create a volume
[ "create", "a", "volume" ]
f26a450a422600f492480bfa42cbee50a5c7016f
https://github.com/rackerlabs/python-lunrclient/blob/f26a450a422600f492480bfa42cbee50a5c7016f/lunrclient/lunr.py#L47-L56
40,709
rackerlabs/python-lunrclient
lunrclient/lunr.py
LunrVolume.restore
def restore(self, volume_id, **kwargs): """ restore a volume from a backup """ # These arguments are required self.required('create', kwargs, ['backup', 'size']) # Optional Arguments volume_id = volume_id or str(uuid.uuid4()) kwargs['volume_type_name'] = k...
python
def restore(self, volume_id, **kwargs): """ restore a volume from a backup """ # These arguments are required self.required('create', kwargs, ['backup', 'size']) # Optional Arguments volume_id = volume_id or str(uuid.uuid4()) kwargs['volume_type_name'] = k...
[ "def", "restore", "(", "self", ",", "volume_id", ",", "*", "*", "kwargs", ")", ":", "# These arguments are required", "self", ".", "required", "(", "'create'", ",", "kwargs", ",", "[", "'backup'", ",", "'size'", "]", ")", "# Optional Arguments", "volume_id", ...
restore a volume from a backup
[ "restore", "a", "volume", "from", "a", "backup" ]
f26a450a422600f492480bfa42cbee50a5c7016f
https://github.com/rackerlabs/python-lunrclient/blob/f26a450a422600f492480bfa42cbee50a5c7016f/lunrclient/lunr.py#L58-L70
40,710
rackerlabs/python-lunrclient
lunrclient/lunr.py
LunrBackup.create
def create(self, volume_id, backup_id): """ create a backup """ backup_id = backup_id or str(uuid.uuid4()) return self.http_put('/backups/%s' % backup_id, params={'volume': volume_id})
python
def create(self, volume_id, backup_id): """ create a backup """ backup_id = backup_id or str(uuid.uuid4()) return self.http_put('/backups/%s' % backup_id, params={'volume': volume_id})
[ "def", "create", "(", "self", ",", "volume_id", ",", "backup_id", ")", ":", "backup_id", "=", "backup_id", "or", "str", "(", "uuid", ".", "uuid4", "(", ")", ")", "return", "self", ".", "http_put", "(", "'/backups/%s'", "%", "backup_id", ",", "params", ...
create a backup
[ "create", "a", "backup" ]
f26a450a422600f492480bfa42cbee50a5c7016f
https://github.com/rackerlabs/python-lunrclient/blob/f26a450a422600f492480bfa42cbee50a5c7016f/lunrclient/lunr.py#L102-L108
40,711
rackerlabs/python-lunrclient
lunrclient/lunr.py
LunrExport.delete
def delete(self, volume_id, force=False): """ delete an export """ return self.http_delete('/volumes/%s/export' % volume_id, params={'force': force})
python
def delete(self, volume_id, force=False): """ delete an export """ return self.http_delete('/volumes/%s/export' % volume_id, params={'force': force})
[ "def", "delete", "(", "self", ",", "volume_id", ",", "force", "=", "False", ")", ":", "return", "self", ".", "http_delete", "(", "'/volumes/%s/export'", "%", "volume_id", ",", "params", "=", "{", "'force'", ":", "force", "}", ")" ]
delete an export
[ "delete", "an", "export" ]
f26a450a422600f492480bfa42cbee50a5c7016f
https://github.com/rackerlabs/python-lunrclient/blob/f26a450a422600f492480bfa42cbee50a5c7016f/lunrclient/lunr.py#L215-L220
40,712
rackerlabs/python-lunrclient
lunrclient/lunr.py
LunrExport.update
def update(self, volume_id, **kwargs): """ update an export """ # These arguments are allowed self.allowed('update', kwargs, ['status', 'instance_id', 'mountpoint', 'ip', 'initiator', 'session_ip', 'session_initiato...
python
def update(self, volume_id, **kwargs): """ update an export """ # These arguments are allowed self.allowed('update', kwargs, ['status', 'instance_id', 'mountpoint', 'ip', 'initiator', 'session_ip', 'session_initiato...
[ "def", "update", "(", "self", ",", "volume_id", ",", "*", "*", "kwargs", ")", ":", "# These arguments are allowed", "self", ".", "allowed", "(", "'update'", ",", "kwargs", ",", "[", "'status'", ",", "'instance_id'", ",", "'mountpoint'", ",", "'ip'", ",", "...
update an export
[ "update", "an", "export" ]
f26a450a422600f492480bfa42cbee50a5c7016f
https://github.com/rackerlabs/python-lunrclient/blob/f26a450a422600f492480bfa42cbee50a5c7016f/lunrclient/lunr.py#L222-L233
40,713
hsdp/python-dropsonde
build.py
proto_refactor
def proto_refactor(proto_filename, namespace, namespace_path): """This method refactors a Protobuf file to import from a namespace that will map to the desired python package structure. It also ensures that the syntax is set to "proto2", since protoc complains without it. Args: proto_filename (...
python
def proto_refactor(proto_filename, namespace, namespace_path): """This method refactors a Protobuf file to import from a namespace that will map to the desired python package structure. It also ensures that the syntax is set to "proto2", since protoc complains without it. Args: proto_filename (...
[ "def", "proto_refactor", "(", "proto_filename", ",", "namespace", ",", "namespace_path", ")", ":", "with", "open", "(", "proto_filename", ")", "as", "f", ":", "data", "=", "f", ".", "read", "(", ")", "if", "not", "re", ".", "search", "(", "'syntax = \"pr...
This method refactors a Protobuf file to import from a namespace that will map to the desired python package structure. It also ensures that the syntax is set to "proto2", since protoc complains without it. Args: proto_filename (str): the protobuf filename to be refactored namespace (str): ...
[ "This", "method", "refactors", "a", "Protobuf", "file", "to", "import", "from", "a", "namespace", "that", "will", "map", "to", "the", "desired", "python", "package", "structure", ".", "It", "also", "ensures", "that", "the", "syntax", "is", "set", "to", "pr...
e72680a3139cbb5ee4910ce1bbc2ccbaa227fb07
https://github.com/hsdp/python-dropsonde/blob/e72680a3139cbb5ee4910ce1bbc2ccbaa227fb07/build.py#L12-L30
40,714
hsdp/python-dropsonde
build.py
proto_refactor_files
def proto_refactor_files(dest_dir, namespace, namespace_path): """This method runs the refactoring on all the Protobuf files in the Dropsonde repo. Args: dest_dir (str): directory where the Protobuf files lives. namespace (str): the desired package name (i.e. "dropsonde.py2") namesp...
python
def proto_refactor_files(dest_dir, namespace, namespace_path): """This method runs the refactoring on all the Protobuf files in the Dropsonde repo. Args: dest_dir (str): directory where the Protobuf files lives. namespace (str): the desired package name (i.e. "dropsonde.py2") namesp...
[ "def", "proto_refactor_files", "(", "dest_dir", ",", "namespace", ",", "namespace_path", ")", ":", "for", "dn", ",", "dns", ",", "fns", "in", "os", ".", "walk", "(", "dest_dir", ")", ":", "for", "fn", "in", "fns", ":", "fn", "=", "os", ".", "path", ...
This method runs the refactoring on all the Protobuf files in the Dropsonde repo. Args: dest_dir (str): directory where the Protobuf files lives. namespace (str): the desired package name (i.e. "dropsonde.py2") namespace_path (str): the desired path corresponding to the package ...
[ "This", "method", "runs", "the", "refactoring", "on", "all", "the", "Protobuf", "files", "in", "the", "Dropsonde", "repo", "." ]
e72680a3139cbb5ee4910ce1bbc2ccbaa227fb07
https://github.com/hsdp/python-dropsonde/blob/e72680a3139cbb5ee4910ce1bbc2ccbaa227fb07/build.py#L33-L49
40,715
hsdp/python-dropsonde
build.py
clone_source_dir
def clone_source_dir(source_dir, dest_dir): """Copies the source Protobuf files into a build directory. Args: source_dir (str): source directory of the Protobuf files dest_dir (str): destination directory of the Protobuf files """ if os.path.isdir(dest_dir): print('removing', de...
python
def clone_source_dir(source_dir, dest_dir): """Copies the source Protobuf files into a build directory. Args: source_dir (str): source directory of the Protobuf files dest_dir (str): destination directory of the Protobuf files """ if os.path.isdir(dest_dir): print('removing', de...
[ "def", "clone_source_dir", "(", "source_dir", ",", "dest_dir", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "dest_dir", ")", ":", "print", "(", "'removing'", ",", "dest_dir", ")", "shutil", ".", "rmtree", "(", "dest_dir", ")", "shutil", ".", "...
Copies the source Protobuf files into a build directory. Args: source_dir (str): source directory of the Protobuf files dest_dir (str): destination directory of the Protobuf files
[ "Copies", "the", "source", "Protobuf", "files", "into", "a", "build", "directory", "." ]
e72680a3139cbb5ee4910ce1bbc2ccbaa227fb07
https://github.com/hsdp/python-dropsonde/blob/e72680a3139cbb5ee4910ce1bbc2ccbaa227fb07/build.py#L52-L62
40,716
openspending/ckanext-budgets
ckanext/budgets/plugin.py
BudgetDataPackagePlugin.are_budget_data_package_fields_filled_in
def are_budget_data_package_fields_filled_in(self, resource): """ Check if the budget data package fields are all filled in because if not then this can't be a budget data package """ fields = ['country', 'currency', 'year', 'status'] return all([self.in_resource(f, resou...
python
def are_budget_data_package_fields_filled_in(self, resource): """ Check if the budget data package fields are all filled in because if not then this can't be a budget data package """ fields = ['country', 'currency', 'year', 'status'] return all([self.in_resource(f, resou...
[ "def", "are_budget_data_package_fields_filled_in", "(", "self", ",", "resource", ")", ":", "fields", "=", "[", "'country'", ",", "'currency'", ",", "'year'", ",", "'status'", "]", "return", "all", "(", "[", "self", ".", "in_resource", "(", "f", ",", "resourc...
Check if the budget data package fields are all filled in because if not then this can't be a budget data package
[ "Check", "if", "the", "budget", "data", "package", "fields", "are", "all", "filled", "in", "because", "if", "not", "then", "this", "can", "t", "be", "a", "budget", "data", "package" ]
07dde5a4fdec6b36ceb812b70f0c31cdecb40cfc
https://github.com/openspending/ckanext-budgets/blob/07dde5a4fdec6b36ceb812b70f0c31cdecb40cfc/ckanext/budgets/plugin.py#L228-L234
40,717
openspending/ckanext-budgets
ckanext/budgets/plugin.py
BudgetDataPackagePlugin.generate_budget_data_package
def generate_budget_data_package(self, resource): """ Try to grab a budget data package schema from the resource. The schema only allows fields which are defined in the budget data package specification. If a field is found that is not in the specification this will return a NotA...
python
def generate_budget_data_package(self, resource): """ Try to grab a budget data package schema from the resource. The schema only allows fields which are defined in the budget data package specification. If a field is found that is not in the specification this will return a NotA...
[ "def", "generate_budget_data_package", "(", "self", ",", "resource", ")", ":", "# Return if the budget data package fields have not been filled in", "if", "not", "self", ".", "are_budget_data_package_fields_filled_in", "(", "resource", ")", ":", "return", "try", ":", "resou...
Try to grab a budget data package schema from the resource. The schema only allows fields which are defined in the budget data package specification. If a field is found that is not in the specification this will return a NotABudgetDataPackageException and in that case we can just return...
[ "Try", "to", "grab", "a", "budget", "data", "package", "schema", "from", "the", "resource", ".", "The", "schema", "only", "allows", "fields", "which", "are", "defined", "in", "the", "budget", "data", "package", "specification", ".", "If", "a", "field", "is...
07dde5a4fdec6b36ceb812b70f0c31cdecb40cfc
https://github.com/openspending/ckanext-budgets/blob/07dde5a4fdec6b36ceb812b70f0c31cdecb40cfc/ckanext/budgets/plugin.py#L236-L261
40,718
openspending/ckanext-budgets
ckanext/budgets/plugin.py
BudgetDataPackagePlugin.before_update
def before_update(self, context, current, resource): """ If the resource has changed we try to generate a budget data package, but if it hasn't then we don't do anything """ # Return if the budget data package fields have not been filled in if not self.are_budget_data_pa...
python
def before_update(self, context, current, resource): """ If the resource has changed we try to generate a budget data package, but if it hasn't then we don't do anything """ # Return if the budget data package fields have not been filled in if not self.are_budget_data_pa...
[ "def", "before_update", "(", "self", ",", "context", ",", "current", ",", "resource", ")", ":", "# Return if the budget data package fields have not been filled in", "if", "not", "self", ".", "are_budget_data_package_fields_filled_in", "(", "resource", ")", ":", "return",...
If the resource has changed we try to generate a budget data package, but if it hasn't then we don't do anything
[ "If", "the", "resource", "has", "changed", "we", "try", "to", "generate", "a", "budget", "data", "package", "but", "if", "it", "hasn", "t", "then", "we", "don", "t", "do", "anything" ]
07dde5a4fdec6b36ceb812b70f0c31cdecb40cfc
https://github.com/openspending/ckanext-budgets/blob/07dde5a4fdec6b36ceb812b70f0c31cdecb40cfc/ckanext/budgets/plugin.py#L287-L307
40,719
SeattleTestbed/seash
modules/uploaddir/__init__.py
upload_directory_contents
def upload_directory_contents(input_dict, environment_dict): """This function serves to upload every file in a user-supplied source directory to all of the vessels in the current target group. It essentially calls seash's `upload` function repeatedly, each time with a file name taken from the source directory...
python
def upload_directory_contents(input_dict, environment_dict): """This function serves to upload every file in a user-supplied source directory to all of the vessels in the current target group. It essentially calls seash's `upload` function repeatedly, each time with a file name taken from the source directory...
[ "def", "upload_directory_contents", "(", "input_dict", ",", "environment_dict", ")", ":", "# Check user input and seash state:", "# 1, Make sure there is an active user key.", "if", "environment_dict", "[", "\"currentkeyname\"", "]", "is", "None", ":", "raise", "seash_exception...
This function serves to upload every file in a user-supplied source directory to all of the vessels in the current target group. It essentially calls seash's `upload` function repeatedly, each time with a file name taken from the source directory. A note on the input_dict argument: `input_dict` contains ou...
[ "This", "function", "serves", "to", "upload", "every", "file", "in", "a", "user", "-", "supplied", "source", "directory", "to", "all", "of", "the", "vessels", "in", "the", "current", "target", "group", ".", "It", "essentially", "calls", "seash", "s", "uplo...
40f9d2285662ff8b61e0468b4196acee089b273b
https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/modules/uploaddir/__init__.py#L26-L95
40,720
AtomHash/evernode
evernode/classes/translator.py
Translator.__load_file
def __load_file(self, key_list) -> str: """ Load a translator file """ file = str(key_list[0]) + self.extension key_list.pop(0) file_path = os.path.join(self.path, file) if os.path.exists(file_path): return Json.from_file(file_path) else: r...
python
def __load_file(self, key_list) -> str: """ Load a translator file """ file = str(key_list[0]) + self.extension key_list.pop(0) file_path = os.path.join(self.path, file) if os.path.exists(file_path): return Json.from_file(file_path) else: r...
[ "def", "__load_file", "(", "self", ",", "key_list", ")", "->", "str", ":", "file", "=", "str", "(", "key_list", "[", "0", "]", ")", "+", "self", ".", "extension", "key_list", ".", "pop", "(", "0", ")", "file_path", "=", "os", ".", "path", ".", "j...
Load a translator file
[ "Load", "a", "translator", "file" ]
b2fb91555fb937a3f3eba41db56dee26f9b034be
https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/classes/translator.py#L71-L79
40,721
ponty/confduino
confduino/progremove.py
remove_programmer
def remove_programmer(programmer_id): """remove programmer. :param programmer_id: programmer id (e.g. 'avrisp') :rtype: None """ log.debug('remove %s', programmer_id) lines = programmers_txt().lines() lines = filter( lambda x: not x.strip().startswith(programmer_id + '.'), lines) ...
python
def remove_programmer(programmer_id): """remove programmer. :param programmer_id: programmer id (e.g. 'avrisp') :rtype: None """ log.debug('remove %s', programmer_id) lines = programmers_txt().lines() lines = filter( lambda x: not x.strip().startswith(programmer_id + '.'), lines) ...
[ "def", "remove_programmer", "(", "programmer_id", ")", ":", "log", ".", "debug", "(", "'remove %s'", ",", "programmer_id", ")", "lines", "=", "programmers_txt", "(", ")", ".", "lines", "(", ")", "lines", "=", "filter", "(", "lambda", "x", ":", "not", "x"...
remove programmer. :param programmer_id: programmer id (e.g. 'avrisp') :rtype: None
[ "remove", "programmer", "." ]
f4c261e5e84997f145a8bdd001f471db74c9054b
https://github.com/ponty/confduino/blob/f4c261e5e84997f145a8bdd001f471db74c9054b/confduino/progremove.py#L9-L21
40,722
helixyte/everest
everest/repositories/memory/session.py
MemorySession.load
def load(self, entity_class, entity): """ Load the given repository entity into the session and return a clone. If it was already loaded before, look up the loaded entity and return it. All entities referenced by the loaded entity will also be loaded (and cloned) recursi...
python
def load(self, entity_class, entity): """ Load the given repository entity into the session and return a clone. If it was already loaded before, look up the loaded entity and return it. All entities referenced by the loaded entity will also be loaded (and cloned) recursi...
[ "def", "load", "(", "self", ",", "entity_class", ",", "entity", ")", ":", "if", "self", ".", "__needs_flushing", ":", "self", ".", "flush", "(", ")", "if", "entity", ".", "id", "is", "None", ":", "raise", "ValueError", "(", "'Can not load entity without an...
Load the given repository entity into the session and return a clone. If it was already loaded before, look up the loaded entity and return it. All entities referenced by the loaded entity will also be loaded (and cloned) recursively. :raises ValueError: When an attempt is made...
[ "Load", "the", "given", "repository", "entity", "into", "the", "session", "and", "return", "a", "clone", ".", "If", "it", "was", "already", "loaded", "before", "look", "up", "the", "loaded", "entity", "and", "return", "it", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/repositories/memory/session.py#L127-L152
40,723
corydodt/Codado
doc/sample/ondie.py
AppMourner.onStart
def onStart(self, event): """ Display the environment of a started container """ c = event.container print '+' * 5, 'started:', c kv = lambda s: s.split('=', 1) env = {k: v for (k, v) in (kv(s) for s in c.attrs['Config']['Env'])} print env
python
def onStart(self, event): """ Display the environment of a started container """ c = event.container print '+' * 5, 'started:', c kv = lambda s: s.split('=', 1) env = {k: v for (k, v) in (kv(s) for s in c.attrs['Config']['Env'])} print env
[ "def", "onStart", "(", "self", ",", "event", ")", ":", "c", "=", "event", ".", "container", "print", "'+'", "*", "5", ",", "'started:'", ",", "c", "kv", "=", "lambda", "s", ":", "s", ".", "split", "(", "'='", ",", "1", ")", "env", "=", "{", "...
Display the environment of a started container
[ "Display", "the", "environment", "of", "a", "started", "container" ]
487d51ec6132c05aa88e2f128012c95ccbf6928e
https://github.com/corydodt/Codado/blob/487d51ec6132c05aa88e2f128012c95ccbf6928e/doc/sample/ondie.py#L28-L36
40,724
RI-imaging/qpformat
qpformat/file_formats/__init__.py
SeriesFolder._identifier_data
def _identifier_data(self): """Return a unique identifier for the folder data""" # Use only file names data = [ff.name for ff in self.files] data.sort() # also use the folder name data.append(self.path.name) # add meta data data += self._identifier_meta() ...
python
def _identifier_data(self): """Return a unique identifier for the folder data""" # Use only file names data = [ff.name for ff in self.files] data.sort() # also use the folder name data.append(self.path.name) # add meta data data += self._identifier_meta() ...
[ "def", "_identifier_data", "(", "self", ")", ":", "# Use only file names", "data", "=", "[", "ff", ".", "name", "for", "ff", "in", "self", ".", "files", "]", "data", ".", "sort", "(", ")", "# also use the folder name", "data", ".", "append", "(", "self", ...
Return a unique identifier for the folder data
[ "Return", "a", "unique", "identifier", "for", "the", "folder", "data" ]
364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb
https://github.com/RI-imaging/qpformat/blob/364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb/qpformat/file_formats/__init__.py#L80-L89
40,725
RI-imaging/qpformat
qpformat/file_formats/__init__.py
SeriesFolder._search_files
def _search_files(path): """Search a folder for data files .. versionchanged:: 0.6.0 `path` is not searched recursively anymore """ path = pathlib.Path(path) fifo = [] for fp in path.glob("*"): if fp.is_dir(): continue ...
python
def _search_files(path): """Search a folder for data files .. versionchanged:: 0.6.0 `path` is not searched recursively anymore """ path = pathlib.Path(path) fifo = [] for fp in path.glob("*"): if fp.is_dir(): continue ...
[ "def", "_search_files", "(", "path", ")", ":", "path", "=", "pathlib", ".", "Path", "(", "path", ")", "fifo", "=", "[", "]", "for", "fp", "in", "path", ".", "glob", "(", "\"*\"", ")", ":", "if", "fp", ".", "is_dir", "(", ")", ":", "continue", "...
Search a folder for data files .. versionchanged:: 0.6.0 `path` is not searched recursively anymore
[ "Search", "a", "folder", "for", "data", "files" ]
364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb
https://github.com/RI-imaging/qpformat/blob/364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb/qpformat/file_formats/__init__.py#L93-L131
40,726
RI-imaging/qpformat
qpformat/file_formats/__init__.py
SeriesFolder.get_identifier
def get_identifier(self, idx): """Return an identifier for the data at index `idx` .. versionchanged:: 0.4.2 indexing starts at 1 instead of 0 """ name = self._get_cropped_file_names()[idx] return "{}:{}:{}".format(self.identifier, name, idx + 1)
python
def get_identifier(self, idx): """Return an identifier for the data at index `idx` .. versionchanged:: 0.4.2 indexing starts at 1 instead of 0 """ name = self._get_cropped_file_names()[idx] return "{}:{}:{}".format(self.identifier, name, idx + 1)
[ "def", "get_identifier", "(", "self", ",", "idx", ")", ":", "name", "=", "self", ".", "_get_cropped_file_names", "(", ")", "[", "idx", "]", "return", "\"{}:{}:{}\"", ".", "format", "(", "self", ".", "identifier", ",", "name", ",", "idx", "+", "1", ")" ...
Return an identifier for the data at index `idx` .. versionchanged:: 0.4.2 indexing starts at 1 instead of 0
[ "Return", "an", "identifier", "for", "the", "data", "at", "index", "idx" ]
364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb
https://github.com/RI-imaging/qpformat/blob/364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb/qpformat/file_formats/__init__.py#L148-L155
40,727
RI-imaging/qpformat
qpformat/file_formats/__init__.py
SeriesFolder.verify
def verify(path): """Verify folder file format The folder file format is only valid when there is only one file format present. """ valid = True fifo = SeriesFolder._search_files(path) # dataset size if len(fifo) == 0: valid = False # ...
python
def verify(path): """Verify folder file format The folder file format is only valid when there is only one file format present. """ valid = True fifo = SeriesFolder._search_files(path) # dataset size if len(fifo) == 0: valid = False # ...
[ "def", "verify", "(", "path", ")", ":", "valid", "=", "True", "fifo", "=", "SeriesFolder", ".", "_search_files", "(", "path", ")", "# dataset size", "if", "len", "(", "fifo", ")", "==", "0", ":", "valid", "=", "False", "# number of different file formats", ...
Verify folder file format The folder file format is only valid when there is only one file format present.
[ "Verify", "folder", "file", "format" ]
364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb
https://github.com/RI-imaging/qpformat/blob/364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb/qpformat/file_formats/__init__.py#L176-L191
40,728
RI-imaging/qpformat
examples/convert_txt2npy.py
load_file
def load_file(path): '''Load a txt data file''' path = pathlib.Path(path) data = path.open().readlines() # remove comments and empty lines data = [l for l in data if len(l.strip()) and not l.startswith("#")] # determine data shape n = len(data) m = len(data[0].strip().split()) res = ...
python
def load_file(path): '''Load a txt data file''' path = pathlib.Path(path) data = path.open().readlines() # remove comments and empty lines data = [l for l in data if len(l.strip()) and not l.startswith("#")] # determine data shape n = len(data) m = len(data[0].strip().split()) res = ...
[ "def", "load_file", "(", "path", ")", ":", "path", "=", "pathlib", ".", "Path", "(", "path", ")", "data", "=", "path", ".", "open", "(", ")", ".", "readlines", "(", ")", "# remove comments and empty lines", "data", "=", "[", "l", "for", "l", "in", "d...
Load a txt data file
[ "Load", "a", "txt", "data", "file" ]
364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb
https://github.com/RI-imaging/qpformat/blob/364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb/examples/convert_txt2npy.py#L27-L41
40,729
Eyepea/systemDream
src/systemdream/journal/handler.py
JournalHandler.emit
def emit(self, record): """Write record as journal event. MESSAGE is taken from the message provided by the user, and PRIORITY, LOGGER, THREAD_NAME, CODE_{FILE,LINE,FUNC} fields are appended automatically. In addition, record.MESSAGE_ID will be used if present. "...
python
def emit(self, record): """Write record as journal event. MESSAGE is taken from the message provided by the user, and PRIORITY, LOGGER, THREAD_NAME, CODE_{FILE,LINE,FUNC} fields are appended automatically. In addition, record.MESSAGE_ID will be used if present. "...
[ "def", "emit", "(", "self", ",", "record", ")", ":", "if", "record", ".", "args", "and", "isinstance", "(", "record", ".", "args", ",", "collections", ".", "Mapping", ")", ":", "extra", "=", "dict", "(", "self", ".", "_extra", ",", "*", "*", "recor...
Write record as journal event. MESSAGE is taken from the message provided by the user, and PRIORITY, LOGGER, THREAD_NAME, CODE_{FILE,LINE,FUNC} fields are appended automatically. In addition, record.MESSAGE_ID will be used if present.
[ "Write", "record", "as", "journal", "event", "." ]
018fa5e9ff0f4fdc62fa85b235725d0f8b24f1a8
https://github.com/Eyepea/systemDream/blob/018fa5e9ff0f4fdc62fa85b235725d0f8b24f1a8/src/systemdream/journal/handler.py#L109-L137
40,730
Eyepea/systemDream
src/systemdream/journal/handler.py
JournalHandler.mapPriority
def mapPriority(levelno): """Map logging levels to journald priorities. Since Python log level numbers are "sparse", we have to map numbers in between the standard levels too. """ if levelno <= _logging.DEBUG: return LOG_DEBUG elif levelno <= _logging.INFO: ...
python
def mapPriority(levelno): """Map logging levels to journald priorities. Since Python log level numbers are "sparse", we have to map numbers in between the standard levels too. """ if levelno <= _logging.DEBUG: return LOG_DEBUG elif levelno <= _logging.INFO: ...
[ "def", "mapPriority", "(", "levelno", ")", ":", "if", "levelno", "<=", "_logging", ".", "DEBUG", ":", "return", "LOG_DEBUG", "elif", "levelno", "<=", "_logging", ".", "INFO", ":", "return", "LOG_INFO", "elif", "levelno", "<=", "_logging", ".", "WARNING", "...
Map logging levels to journald priorities. Since Python log level numbers are "sparse", we have to map numbers in between the standard levels too.
[ "Map", "logging", "levels", "to", "journald", "priorities", "." ]
018fa5e9ff0f4fdc62fa85b235725d0f8b24f1a8
https://github.com/Eyepea/systemDream/blob/018fa5e9ff0f4fdc62fa85b235725d0f8b24f1a8/src/systemdream/journal/handler.py#L140-L157
40,731
rackerlabs/python-lunrclient
lunrclient/subcommand.py
SubCommand.get_args
def get_args(self, func): """ Get the arguments of a method and return it as a dictionary with the supplied defaults, method arguments with no default are assigned None """ def reverse(iterable): if iterable: iterable = list(iterable) w...
python
def get_args(self, func): """ Get the arguments of a method and return it as a dictionary with the supplied defaults, method arguments with no default are assigned None """ def reverse(iterable): if iterable: iterable = list(iterable) w...
[ "def", "get_args", "(", "self", ",", "func", ")", ":", "def", "reverse", "(", "iterable", ")", ":", "if", "iterable", ":", "iterable", "=", "list", "(", "iterable", ")", "while", "len", "(", "iterable", ")", ":", "yield", "iterable", ".", "pop", "(",...
Get the arguments of a method and return it as a dictionary with the supplied defaults, method arguments with no default are assigned None
[ "Get", "the", "arguments", "of", "a", "method", "and", "return", "it", "as", "a", "dictionary", "with", "the", "supplied", "defaults", "method", "arguments", "with", "no", "default", "are", "assigned", "None" ]
f26a450a422600f492480bfa42cbee50a5c7016f
https://github.com/rackerlabs/python-lunrclient/blob/f26a450a422600f492480bfa42cbee50a5c7016f/lunrclient/subcommand.py#L253-L274
40,732
RI-imaging/qpformat
qpformat/core.py
guess_format
def guess_format(path): """Determine the file format of a folder or a file""" for fmt in formats: if fmt.verify(path): return fmt.__name__ else: msg = "Undefined file format: '{}'".format(path) raise UnknownFileFormatError(msg)
python
def guess_format(path): """Determine the file format of a folder or a file""" for fmt in formats: if fmt.verify(path): return fmt.__name__ else: msg = "Undefined file format: '{}'".format(path) raise UnknownFileFormatError(msg)
[ "def", "guess_format", "(", "path", ")", ":", "for", "fmt", "in", "formats", ":", "if", "fmt", ".", "verify", "(", "path", ")", ":", "return", "fmt", ".", "__name__", "else", ":", "msg", "=", "\"Undefined file format: '{}'\"", ".", "format", "(", "path",...
Determine the file format of a folder or a file
[ "Determine", "the", "file", "format", "of", "a", "folder", "or", "a", "file" ]
364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb
https://github.com/RI-imaging/qpformat/blob/364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb/qpformat/core.py#L10-L17
40,733
RI-imaging/qpformat
qpformat/core.py
load_data
def load_data(path, fmt=None, bg_data=None, bg_fmt=None, meta_data={}, holo_kw={}, as_type="float32"): """Load experimental data Parameters ---------- path: str Path to experimental data file or folder fmt: str The file format to use (see `file_formats.formats`). ...
python
def load_data(path, fmt=None, bg_data=None, bg_fmt=None, meta_data={}, holo_kw={}, as_type="float32"): """Load experimental data Parameters ---------- path: str Path to experimental data file or folder fmt: str The file format to use (see `file_formats.formats`). ...
[ "def", "load_data", "(", "path", ",", "fmt", "=", "None", ",", "bg_data", "=", "None", ",", "bg_fmt", "=", "None", ",", "meta_data", "=", "{", "}", ",", "holo_kw", "=", "{", "}", ",", "as_type", "=", "\"float32\"", ")", ":", "path", "=", "pathlib",...
Load experimental data Parameters ---------- path: str Path to experimental data file or folder fmt: str The file format to use (see `file_formats.formats`). If set to `None`, the file format is guessed. bg_data: str Path to background data file or `qpimage.QPImage` ...
[ "Load", "experimental", "data" ]
364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb
https://github.com/RI-imaging/qpformat/blob/364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb/qpformat/core.py#L20-L90
40,734
kxz/littlebrother
littlebrother/humanize.py
duration
def duration(seconds): """Return a string of the form "1 hr 2 min 3 sec" representing the given number of seconds.""" if seconds < 1: return 'less than 1 sec' seconds = int(round(seconds)) components = [] for magnitude, label in ((3600, 'hr'), (60, 'min'), (1, 'sec')): if seconds...
python
def duration(seconds): """Return a string of the form "1 hr 2 min 3 sec" representing the given number of seconds.""" if seconds < 1: return 'less than 1 sec' seconds = int(round(seconds)) components = [] for magnitude, label in ((3600, 'hr'), (60, 'min'), (1, 'sec')): if seconds...
[ "def", "duration", "(", "seconds", ")", ":", "if", "seconds", "<", "1", ":", "return", "'less than 1 sec'", "seconds", "=", "int", "(", "round", "(", "seconds", ")", ")", "components", "=", "[", "]", "for", "magnitude", ",", "label", "in", "(", "(", ...
Return a string of the form "1 hr 2 min 3 sec" representing the given number of seconds.
[ "Return", "a", "string", "of", "the", "form", "1", "hr", "2", "min", "3", "sec", "representing", "the", "given", "number", "of", "seconds", "." ]
af9ec9af5c0de9a74796bb7e16a6b836286e8b9f
https://github.com/kxz/littlebrother/blob/af9ec9af5c0de9a74796bb7e16a6b836286e8b9f/littlebrother/humanize.py#L4-L15
40,735
hatemile/hatemile-for-python
hatemile/implementation/display.py
AccessibleDisplayImplementation._get_shortcut_prefix
def _get_shortcut_prefix(self, user_agent, standart_prefix): """ Returns the shortcut prefix of browser. :param user_agent: The user agent of browser. :type user_agent: str :param standart_prefix: The default prefix. :type standart_prefix: str :return: The shortc...
python
def _get_shortcut_prefix(self, user_agent, standart_prefix): """ Returns the shortcut prefix of browser. :param user_agent: The user agent of browser. :type user_agent: str :param standart_prefix: The default prefix. :type standart_prefix: str :return: The shortc...
[ "def", "_get_shortcut_prefix", "(", "self", ",", "user_agent", ",", "standart_prefix", ")", ":", "# pylint: disable=no-self-use", "if", "user_agent", "is", "not", "None", ":", "user_agent", "=", "user_agent", ".", "lower", "(", ")", "opera", "=", "'opera'", "in"...
Returns the shortcut prefix of browser. :param user_agent: The user agent of browser. :type user_agent: str :param standart_prefix: The default prefix. :type standart_prefix: str :return: The shortcut prefix of browser. :rtype: str
[ "Returns", "the", "shortcut", "prefix", "of", "browser", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/display.py#L442-L486
40,736
hatemile/hatemile-for-python
hatemile/implementation/display.py
AccessibleDisplayImplementation._get_role_description
def _get_role_description(self, role): """ Returns the description of role. :param role: The role. :type role: str :return: The description of role. :rtype: str """ parameter = 'role-' + role.lower() if self.configure.has_parameter(parameter): ...
python
def _get_role_description(self, role): """ Returns the description of role. :param role: The role. :type role: str :return: The description of role. :rtype: str """ parameter = 'role-' + role.lower() if self.configure.has_parameter(parameter): ...
[ "def", "_get_role_description", "(", "self", ",", "role", ")", ":", "parameter", "=", "'role-'", "+", "role", ".", "lower", "(", ")", "if", "self", ".", "configure", ".", "has_parameter", "(", "parameter", ")", ":", "return", "self", ".", "configure", "....
Returns the description of role. :param role: The role. :type role: str :return: The description of role. :rtype: str
[ "Returns", "the", "description", "of", "role", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/display.py#L488-L501
40,737
hatemile/hatemile-for-python
hatemile/implementation/display.py
AccessibleDisplayImplementation._get_language_description
def _get_language_description(self, language_code): """ Returns the description of language. :param language_code: The BCP 47 code language. :type language_code: str :return: The description of language. :rtype: str """ language = language_code.lower() ...
python
def _get_language_description(self, language_code): """ Returns the description of language. :param language_code: The BCP 47 code language. :type language_code: str :return: The description of language. :rtype: str """ language = language_code.lower() ...
[ "def", "_get_language_description", "(", "self", ",", "language_code", ")", ":", "language", "=", "language_code", ".", "lower", "(", ")", "parameter", "=", "'language-'", "+", "language", "if", "self", ".", "configure", ".", "has_parameter", "(", "parameter", ...
Returns the description of language. :param language_code: The BCP 47 code language. :type language_code: str :return: The description of language. :rtype: str
[ "Returns", "the", "description", "of", "language", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/display.py#L503-L522
40,738
hatemile/hatemile-for-python
hatemile/implementation/display.py
AccessibleDisplayImplementation._get_description
def _get_description(self, element): """ Returns the description of element. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :return: The description of element. :rtype: str """ description = None if e...
python
def _get_description(self, element): """ Returns the description of element. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :return: The description of element. :rtype: str """ description = None if e...
[ "def", "_get_description", "(", "self", ",", "element", ")", ":", "description", "=", "None", "if", "element", ".", "has_attribute", "(", "'title'", ")", ":", "description", "=", "element", ".", "get_attribute", "(", "'title'", ")", "elif", "element", ".", ...
Returns the description of element. :param element: The element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :return: The description of element. :rtype: str
[ "Returns", "the", "description", "of", "element", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/display.py#L524-L580
40,739
hatemile/hatemile-for-python
hatemile/implementation/display.py
AccessibleDisplayImplementation._generate_list_shortcuts
def _generate_list_shortcuts(self): """ Generate the list of shortcuts of page. """ id_container_shortcuts_before = ( AccessibleDisplayImplementation.ID_CONTAINER_SHORTCUTS_BEFORE ) id_container_shortcuts_after = ( AccessibleDisplayImplementation....
python
def _generate_list_shortcuts(self): """ Generate the list of shortcuts of page. """ id_container_shortcuts_before = ( AccessibleDisplayImplementation.ID_CONTAINER_SHORTCUTS_BEFORE ) id_container_shortcuts_after = ( AccessibleDisplayImplementation....
[ "def", "_generate_list_shortcuts", "(", "self", ")", ":", "id_container_shortcuts_before", "=", "(", "AccessibleDisplayImplementation", ".", "ID_CONTAINER_SHORTCUTS_BEFORE", ")", "id_container_shortcuts_after", "=", "(", "AccessibleDisplayImplementation", ".", "ID_CONTAINER_SHORT...
Generate the list of shortcuts of page.
[ "Generate", "the", "list", "of", "shortcuts", "of", "page", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/display.py#L582-L664
40,740
hatemile/hatemile-for-python
hatemile/implementation/display.py
AccessibleDisplayImplementation._insert
def _insert(self, element, new_element, before): """ Insert a element before or after other element. :param element: The reference element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :param new_element: The element that be inserted. :type new_element...
python
def _insert(self, element, new_element, before): """ Insert a element before or after other element. :param element: The reference element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :param new_element: The element that be inserted. :type new_element...
[ "def", "_insert", "(", "self", ",", "element", ",", "new_element", ",", "before", ")", ":", "tag_name", "=", "element", ".", "get_tag_name", "(", ")", "append_tags", "=", "[", "'BODY'", ",", "'A'", ",", "'FIGCAPTION'", ",", "'LI'", ",", "'DT'", ",", "'...
Insert a element before or after other element. :param element: The reference element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :param new_element: The element that be inserted. :type new_element: hatemile.util.html.htmldomelement.HTMLDOMElement :param bef...
[ "Insert", "a", "element", "before", "or", "after", "other", "element", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/display.py#L666-L718
40,741
hatemile/hatemile-for-python
hatemile/implementation/display.py
AccessibleDisplayImplementation._force_read_simple
def _force_read_simple(self, element, text_before, text_after, data_of): """ Force the screen reader display an information of element. :param element: The reference element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :param text_before: The text content to ...
python
def _force_read_simple(self, element, text_before, text_after, data_of): """ Force the screen reader display an information of element. :param element: The reference element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :param text_before: The text content to ...
[ "def", "_force_read_simple", "(", "self", ",", "element", ",", "text_before", ",", "text_after", ",", "data_of", ")", ":", "self", ".", "id_generator", ".", "generate_id", "(", "element", ")", "identifier", "=", "element", ".", "get_attribute", "(", "'id'", ...
Force the screen reader display an information of element. :param element: The reference element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :param text_before: The text content to show before the element. :type text_before: str :param text_after: The text c...
[ "Force", "the", "screen", "reader", "display", "an", "information", "of", "element", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/display.py#L720-L779
40,742
hatemile/hatemile-for-python
hatemile/implementation/display.py
AccessibleDisplayImplementation._force_read
def _force_read( self, element, value, text_prefix_before, text_suffix_before, text_prefix_after, text_suffix_after, data_of ): """ Force the screen reader display an information of element with prefixes or suffixes. :p...
python
def _force_read( self, element, value, text_prefix_before, text_suffix_before, text_prefix_after, text_suffix_after, data_of ): """ Force the screen reader display an information of element with prefixes or suffixes. :p...
[ "def", "_force_read", "(", "self", ",", "element", ",", "value", ",", "text_prefix_before", ",", "text_suffix_before", ",", "text_prefix_after", ",", "text_suffix_after", ",", "data_of", ")", ":", "if", "(", "text_prefix_before", ")", "or", "(", "text_suffix_befor...
Force the screen reader display an information of element with prefixes or suffixes. :param element: The reference element. :type element: hatemile.util.html.htmldomelement.HTMLDOMElement :param value: The value to be show. :type value: str :param text_prefix_before: The...
[ "Force", "the", "screen", "reader", "display", "an", "information", "of", "element", "with", "prefixes", "or", "suffixes", "." ]
1e914f9aa09f6f8d78282af131311546ecba9fb8
https://github.com/hatemile/hatemile-for-python/blob/1e914f9aa09f6f8d78282af131311546ecba9fb8/hatemile/implementation/display.py#L781-L824
40,743
anlutro/diay.py
diay/__init__.py
provider
def provider(func=None, *, singleton=False, injector=None): """ Decorator to mark a function as a provider. Args: singleton (bool): The returned value should be a singleton or shared instance. If False (the default) the provider function will be invoked again for every time ...
python
def provider(func=None, *, singleton=False, injector=None): """ Decorator to mark a function as a provider. Args: singleton (bool): The returned value should be a singleton or shared instance. If False (the default) the provider function will be invoked again for every time ...
[ "def", "provider", "(", "func", "=", "None", ",", "*", ",", "singleton", "=", "False", ",", "injector", "=", "None", ")", ":", "def", "decorator", "(", "func", ")", ":", "wrapped", "=", "_wrap_provider_func", "(", "func", ",", "{", "'singleton'", ":", ...
Decorator to mark a function as a provider. Args: singleton (bool): The returned value should be a singleton or shared instance. If False (the default) the provider function will be invoked again for every time it's needed for injection. injector (Injector): If provided, the...
[ "Decorator", "to", "mark", "a", "function", "as", "a", "provider", "." ]
78cfd2b53c8dca3dbac468d620eaa0bb7af08275
https://github.com/anlutro/diay.py/blob/78cfd2b53c8dca3dbac468d620eaa0bb7af08275/diay/__init__.py#L21-L45
40,744
anlutro/diay.py
diay/__init__.py
inject
def inject(*args, **kwargs): """ Mark a class or function for injection, meaning that a DI container knows that it should inject dependencies into it. Normally you won't need this as the injector will inject the required arguments anyway, but it can be used to inject properties into a class wit...
python
def inject(*args, **kwargs): """ Mark a class or function for injection, meaning that a DI container knows that it should inject dependencies into it. Normally you won't need this as the injector will inject the required arguments anyway, but it can be used to inject properties into a class wit...
[ "def", "inject", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "wrapper", "(", "obj", ")", ":", "if", "inspect", ".", "isclass", "(", "obj", ")", "or", "callable", "(", "obj", ")", ":", "_inject_object", "(", "obj", ",", "*", "args"...
Mark a class or function for injection, meaning that a DI container knows that it should inject dependencies into it. Normally you won't need this as the injector will inject the required arguments anyway, but it can be used to inject properties into a class without having to specify it in the construc...
[ "Mark", "a", "class", "or", "function", "for", "injection", "meaning", "that", "a", "DI", "container", "knows", "that", "it", "should", "inject", "dependencies", "into", "it", "." ]
78cfd2b53c8dca3dbac468d620eaa0bb7af08275
https://github.com/anlutro/diay.py/blob/78cfd2b53c8dca3dbac468d620eaa0bb7af08275/diay/__init__.py#L55-L75
40,745
anlutro/diay.py
diay/__init__.py
Injector.register_plugin
def register_plugin(self, plugin: Plugin): """ Register a plugin. """ if isinstance(plugin, Plugin): lazy = False elif issubclass(plugin, Plugin): lazy = True else: msg = 'plugin %r must be an object/class of type Plugin' % plugin ...
python
def register_plugin(self, plugin: Plugin): """ Register a plugin. """ if isinstance(plugin, Plugin): lazy = False elif issubclass(plugin, Plugin): lazy = True else: msg = 'plugin %r must be an object/class of type Plugin' % plugin ...
[ "def", "register_plugin", "(", "self", ",", "plugin", ":", "Plugin", ")", ":", "if", "isinstance", "(", "plugin", ",", "Plugin", ")", ":", "lazy", "=", "False", "elif", "issubclass", "(", "plugin", ",", "Plugin", ")", ":", "lazy", "=", "True", "else", ...
Register a plugin.
[ "Register", "a", "plugin", "." ]
78cfd2b53c8dca3dbac468d620eaa0bb7af08275
https://github.com/anlutro/diay.py/blob/78cfd2b53c8dca3dbac468d620eaa0bb7af08275/diay/__init__.py#L93-L112
40,746
anlutro/diay.py
diay/__init__.py
Injector.register_provider
def register_provider(self, func): """ Register a provider function. """ if 'provides' not in getattr(func, '__di__', {}): raise DiayException('function %r is not a provider' % func) self.factories[func.__di__['provides']] = func
python
def register_provider(self, func): """ Register a provider function. """ if 'provides' not in getattr(func, '__di__', {}): raise DiayException('function %r is not a provider' % func) self.factories[func.__di__['provides']] = func
[ "def", "register_provider", "(", "self", ",", "func", ")", ":", "if", "'provides'", "not", "in", "getattr", "(", "func", ",", "'__di__'", ",", "{", "}", ")", ":", "raise", "DiayException", "(", "'function %r is not a provider'", "%", "func", ")", "self", "...
Register a provider function.
[ "Register", "a", "provider", "function", "." ]
78cfd2b53c8dca3dbac468d620eaa0bb7af08275
https://github.com/anlutro/diay.py/blob/78cfd2b53c8dca3dbac468d620eaa0bb7af08275/diay/__init__.py#L114-L121
40,747
anlutro/diay.py
diay/__init__.py
Injector.register_lazy_provider_method
def register_lazy_provider_method(self, cls, method): """ Register a class method lazily as a provider. """ if 'provides' not in getattr(method, '__di__', {}): raise DiayException('method %r is not a provider' % method) @functools.wraps(method) def wrapper(*a...
python
def register_lazy_provider_method(self, cls, method): """ Register a class method lazily as a provider. """ if 'provides' not in getattr(method, '__di__', {}): raise DiayException('method %r is not a provider' % method) @functools.wraps(method) def wrapper(*a...
[ "def", "register_lazy_provider_method", "(", "self", ",", "cls", ",", "method", ")", ":", "if", "'provides'", "not", "in", "getattr", "(", "method", ",", "'__di__'", ",", "{", "}", ")", ":", "raise", "DiayException", "(", "'method %r is not a provider'", "%", ...
Register a class method lazily as a provider.
[ "Register", "a", "class", "method", "lazily", "as", "a", "provider", "." ]
78cfd2b53c8dca3dbac468d620eaa0bb7af08275
https://github.com/anlutro/diay.py/blob/78cfd2b53c8dca3dbac468d620eaa0bb7af08275/diay/__init__.py#L123-L134
40,748
anlutro/diay.py
diay/__init__.py
Injector.set_factory
def set_factory(self, thing: type, value, overwrite=False): """ Set the factory for something. """ if thing in self.factories and not overwrite: raise DiayException('factory for %r already exists' % thing) self.factories[thing] = value
python
def set_factory(self, thing: type, value, overwrite=False): """ Set the factory for something. """ if thing in self.factories and not overwrite: raise DiayException('factory for %r already exists' % thing) self.factories[thing] = value
[ "def", "set_factory", "(", "self", ",", "thing", ":", "type", ",", "value", ",", "overwrite", "=", "False", ")", ":", "if", "thing", "in", "self", ".", "factories", "and", "not", "overwrite", ":", "raise", "DiayException", "(", "'factory for %r already exist...
Set the factory for something.
[ "Set", "the", "factory", "for", "something", "." ]
78cfd2b53c8dca3dbac468d620eaa0bb7af08275
https://github.com/anlutro/diay.py/blob/78cfd2b53c8dca3dbac468d620eaa0bb7af08275/diay/__init__.py#L136-L142
40,749
anlutro/diay.py
diay/__init__.py
Injector.set_instance
def set_instance(self, thing: type, value, overwrite=False): """ Set an instance of a thing. """ if thing in self.instances and not overwrite: raise DiayException('instance for %r already exists' % thing) self.instances[thing] = value
python
def set_instance(self, thing: type, value, overwrite=False): """ Set an instance of a thing. """ if thing in self.instances and not overwrite: raise DiayException('instance for %r already exists' % thing) self.instances[thing] = value
[ "def", "set_instance", "(", "self", ",", "thing", ":", "type", ",", "value", ",", "overwrite", "=", "False", ")", ":", "if", "thing", "in", "self", ".", "instances", "and", "not", "overwrite", ":", "raise", "DiayException", "(", "'instance for %r already exi...
Set an instance of a thing.
[ "Set", "an", "instance", "of", "a", "thing", "." ]
78cfd2b53c8dca3dbac468d620eaa0bb7af08275
https://github.com/anlutro/diay.py/blob/78cfd2b53c8dca3dbac468d620eaa0bb7af08275/diay/__init__.py#L144-L150
40,750
anlutro/diay.py
diay/__init__.py
Injector.get
def get(self, thing: type): """ Get an instance of some type. """ if thing in self.instances: return self.instances[thing] if thing in self.factories: fact = self.factories[thing] ret = self.get(fact) if hasattr(fact, '__di__') and...
python
def get(self, thing: type): """ Get an instance of some type. """ if thing in self.instances: return self.instances[thing] if thing in self.factories: fact = self.factories[thing] ret = self.get(fact) if hasattr(fact, '__di__') and...
[ "def", "get", "(", "self", ",", "thing", ":", "type", ")", ":", "if", "thing", "in", "self", ".", "instances", ":", "return", "self", ".", "instances", "[", "thing", "]", "if", "thing", "in", "self", ".", "factories", ":", "fact", "=", "self", ".",...
Get an instance of some type.
[ "Get", "an", "instance", "of", "some", "type", "." ]
78cfd2b53c8dca3dbac468d620eaa0bb7af08275
https://github.com/anlutro/diay.py/blob/78cfd2b53c8dca3dbac468d620eaa0bb7af08275/diay/__init__.py#L152-L171
40,751
anlutro/diay.py
diay/__init__.py
Injector.call
def call(self, func, *args, **kwargs): """ Call a function, resolving any type-hinted arguments. """ guessed_kwargs = self._guess_kwargs(func) for key, val in guessed_kwargs.items(): kwargs.setdefault(key, val) try: return func(*args, **kwargs) ...
python
def call(self, func, *args, **kwargs): """ Call a function, resolving any type-hinted arguments. """ guessed_kwargs = self._guess_kwargs(func) for key, val in guessed_kwargs.items(): kwargs.setdefault(key, val) try: return func(*args, **kwargs) ...
[ "def", "call", "(", "self", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "guessed_kwargs", "=", "self", ".", "_guess_kwargs", "(", "func", ")", "for", "key", ",", "val", "in", "guessed_kwargs", ".", "items", "(", ")", ":", "kwa...
Call a function, resolving any type-hinted arguments.
[ "Call", "a", "function", "resolving", "any", "type", "-", "hinted", "arguments", "." ]
78cfd2b53c8dca3dbac468d620eaa0bb7af08275
https://github.com/anlutro/diay.py/blob/78cfd2b53c8dca3dbac468d620eaa0bb7af08275/diay/__init__.py#L173-L187
40,752
dariusbakunas/rawdisk
rawdisk/ui/cli/cli_mode.py
CliShell.do_load
def do_load(self, filename): """Load disk image for analysis""" try: self.__session.load(filename) except IOError as e: self.logger.error(e.strerror)
python
def do_load(self, filename): """Load disk image for analysis""" try: self.__session.load(filename) except IOError as e: self.logger.error(e.strerror)
[ "def", "do_load", "(", "self", ",", "filename", ")", ":", "try", ":", "self", ".", "__session", ".", "load", "(", "filename", ")", "except", "IOError", "as", "e", ":", "self", ".", "logger", ".", "error", "(", "e", ".", "strerror", ")" ]
Load disk image for analysis
[ "Load", "disk", "image", "for", "analysis" ]
1dc9d0b377fe5da3c406ccec4abc238c54167403
https://github.com/dariusbakunas/rawdisk/blob/1dc9d0b377fe5da3c406ccec4abc238c54167403/rawdisk/ui/cli/cli_mode.py#L69-L74
40,753
dariusbakunas/rawdisk
rawdisk/ui/cli/cli_mode.py
CliShell.do_session
def do_session(self, args): """Print current session information""" filename = 'Not specified' if self.__session.filename is None \ else self.__session.filename print('{0: <30}: {1}'.format('Filename', filename))
python
def do_session(self, args): """Print current session information""" filename = 'Not specified' if self.__session.filename is None \ else self.__session.filename print('{0: <30}: {1}'.format('Filename', filename))
[ "def", "do_session", "(", "self", ",", "args", ")", ":", "filename", "=", "'Not specified'", "if", "self", ".", "__session", ".", "filename", "is", "None", "else", "self", ".", "__session", ".", "filename", "print", "(", "'{0: <30}: {1}'", ".", "format", "...
Print current session information
[ "Print", "current", "session", "information" ]
1dc9d0b377fe5da3c406ccec4abc238c54167403
https://github.com/dariusbakunas/rawdisk/blob/1dc9d0b377fe5da3c406ccec4abc238c54167403/rawdisk/ui/cli/cli_mode.py#L76-L81
40,754
thomasw/querylist
querylist/list.py
QueryList._convert_iterable
def _convert_iterable(self, iterable): """Converts elements returned by an iterable into instances of self._wrapper """ # Return original if _wrapper isn't callable if not callable(self._wrapper): return iterable return [self._wrapper(x) for x in iterable]
python
def _convert_iterable(self, iterable): """Converts elements returned by an iterable into instances of self._wrapper """ # Return original if _wrapper isn't callable if not callable(self._wrapper): return iterable return [self._wrapper(x) for x in iterable]
[ "def", "_convert_iterable", "(", "self", ",", "iterable", ")", ":", "# Return original if _wrapper isn't callable", "if", "not", "callable", "(", "self", ".", "_wrapper", ")", ":", "return", "iterable", "return", "[", "self", ".", "_wrapper", "(", "x", ")", "f...
Converts elements returned by an iterable into instances of self._wrapper
[ "Converts", "elements", "returned", "by", "an", "iterable", "into", "instances", "of", "self", ".", "_wrapper" ]
4304023ef3330238ef3abccaa530ee97011fba2d
https://github.com/thomasw/querylist/blob/4304023ef3330238ef3abccaa530ee97011fba2d/querylist/list.py#L59-L68
40,755
thomasw/querylist
querylist/list.py
QueryList.get
def get(self, **kwargs): """Returns the first object encountered that matches the specified lookup parameters. >>> site_list.get(id=1) {'url': 'http://site1.tld/', 'published': False, 'id': 1} >>> site_list.get(published=True, id__lt=3) {'url': 'http://site1.tld/', 'publ...
python
def get(self, **kwargs): """Returns the first object encountered that matches the specified lookup parameters. >>> site_list.get(id=1) {'url': 'http://site1.tld/', 'published': False, 'id': 1} >>> site_list.get(published=True, id__lt=3) {'url': 'http://site1.tld/', 'publ...
[ "def", "get", "(", "self", ",", "*", "*", "kwargs", ")", ":", "for", "x", "in", "self", ":", "if", "self", ".", "_check_element", "(", "kwargs", ",", "x", ")", ":", "return", "x", "kv_str", "=", "self", ".", "_stringify_kwargs", "(", "kwargs", ")",...
Returns the first object encountered that matches the specified lookup parameters. >>> site_list.get(id=1) {'url': 'http://site1.tld/', 'published': False, 'id': 1} >>> site_list.get(published=True, id__lt=3) {'url': 'http://site1.tld/', 'published': True, 'id': 2} >>> s...
[ "Returns", "the", "first", "object", "encountered", "that", "matches", "the", "specified", "lookup", "parameters", "." ]
4304023ef3330238ef3abccaa530ee97011fba2d
https://github.com/thomasw/querylist/blob/4304023ef3330238ef3abccaa530ee97011fba2d/querylist/list.py#L81-L113
40,756
dnif/fnExchange
fnexchange/cli.py
runserver
def runserver(ctx, conf, port, foreground): """Run the fnExchange server""" config = read_config(conf) debug = config['conf'].get('debug', False) click.echo('Debug mode {0}.'.format('on' if debug else 'off')) port = port or config['conf']['server']['port'] app_settings = { 'debug': de...
python
def runserver(ctx, conf, port, foreground): """Run the fnExchange server""" config = read_config(conf) debug = config['conf'].get('debug', False) click.echo('Debug mode {0}.'.format('on' if debug else 'off')) port = port or config['conf']['server']['port'] app_settings = { 'debug': de...
[ "def", "runserver", "(", "ctx", ",", "conf", ",", "port", ",", "foreground", ")", ":", "config", "=", "read_config", "(", "conf", ")", "debug", "=", "config", "[", "'conf'", "]", ".", "get", "(", "'debug'", ",", "False", ")", "click", ".", "echo", ...
Run the fnExchange server
[ "Run", "the", "fnExchange", "server" ]
d75431b37da3193447b919b4be2e0104266156f1
https://github.com/dnif/fnExchange/blob/d75431b37da3193447b919b4be2e0104266156f1/fnexchange/cli.py#L99-L120
40,757
helixyte/everest
everest/repositories/utils.py
as_repository
def as_repository(resource): """ Adapts the given registered resource to its configured repository. :return: object implementing :class:`everest.repositories.interfaces.IRepository`. """ reg = get_current_registry() if IInterface in provided_by(resource): resource = reg.getUtility...
python
def as_repository(resource): """ Adapts the given registered resource to its configured repository. :return: object implementing :class:`everest.repositories.interfaces.IRepository`. """ reg = get_current_registry() if IInterface in provided_by(resource): resource = reg.getUtility...
[ "def", "as_repository", "(", "resource", ")", ":", "reg", "=", "get_current_registry", "(", ")", "if", "IInterface", "in", "provided_by", "(", "resource", ")", ":", "resource", "=", "reg", ".", "getUtility", "(", "resource", ",", "name", "=", "'collection-cl...
Adapts the given registered resource to its configured repository. :return: object implementing :class:`everest.repositories.interfaces.IRepository`.
[ "Adapts", "the", "given", "registered", "resource", "to", "its", "configured", "repository", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/repositories/utils.py#L78-L88
40,758
helixyte/everest
everest/repositories/utils.py
commit_veto
def commit_veto(request, response): # unused request arg pylint: disable=W0613 """ Strict commit veto to use with the transaction manager. Unlike the default commit veto supplied with the transaction manager, this will veto all commits for HTTP status codes other than 2xx unless a commit is explici...
python
def commit_veto(request, response): # unused request arg pylint: disable=W0613 """ Strict commit veto to use with the transaction manager. Unlike the default commit veto supplied with the transaction manager, this will veto all commits for HTTP status codes other than 2xx unless a commit is explici...
[ "def", "commit_veto", "(", "request", ",", "response", ")", ":", "# unused request arg pylint: disable=W0613", "tm_header", "=", "response", ".", "headers", ".", "get", "(", "'x-tm'", ")", "if", "not", "tm_header", "is", "None", ":", "result", "=", "tm_header", ...
Strict commit veto to use with the transaction manager. Unlike the default commit veto supplied with the transaction manager, this will veto all commits for HTTP status codes other than 2xx unless a commit is explicitly requested by setting the "x-tm" response header to "commit". As with the default co...
[ "Strict", "commit", "veto", "to", "use", "with", "the", "transaction", "manager", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/repositories/utils.py#L91-L107
40,759
helixyte/everest
everest/repositories/utils.py
GlobalObjectManager.set
def set(cls, key, obj): """ Sets the given object as global object for the given key. """ with cls._lock: if not cls._globs.get(key) is None: raise ValueError('Duplicate key "%s".' % key) cls._globs[key] = obj return cls._globs[key]
python
def set(cls, key, obj): """ Sets the given object as global object for the given key. """ with cls._lock: if not cls._globs.get(key) is None: raise ValueError('Duplicate key "%s".' % key) cls._globs[key] = obj return cls._globs[key]
[ "def", "set", "(", "cls", ",", "key", ",", "obj", ")", ":", "with", "cls", ".", "_lock", ":", "if", "not", "cls", ".", "_globs", ".", "get", "(", "key", ")", "is", "None", ":", "raise", "ValueError", "(", "'Duplicate key \"%s\".'", "%", "key", ")",...
Sets the given object as global object for the given key.
[ "Sets", "the", "given", "object", "as", "global", "object", "for", "the", "given", "key", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/repositories/utils.py#L30-L38
40,760
helixyte/everest
everest/representers/utils.py
as_representer
def as_representer(resource, content_type): """ Adapts the given resource and content type to a representer. :param resource: resource to adapt. :param str content_type: content (MIME) type to obtain a representer for. """ reg = get_current_registry() rpr_reg = reg.queryUtility(IRepresenter...
python
def as_representer(resource, content_type): """ Adapts the given resource and content type to a representer. :param resource: resource to adapt. :param str content_type: content (MIME) type to obtain a representer for. """ reg = get_current_registry() rpr_reg = reg.queryUtility(IRepresenter...
[ "def", "as_representer", "(", "resource", ",", "content_type", ")", ":", "reg", "=", "get_current_registry", "(", ")", "rpr_reg", "=", "reg", ".", "queryUtility", "(", "IRepresenterRegistry", ")", "return", "rpr_reg", ".", "create", "(", "type", "(", "resource...
Adapts the given resource and content type to a representer. :param resource: resource to adapt. :param str content_type: content (MIME) type to obtain a representer for.
[ "Adapts", "the", "given", "resource", "and", "content", "type", "to", "a", "representer", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/representers/utils.py#L29-L38
40,761
helixyte/everest
everest/representers/utils.py
data_element_tree_to_string
def data_element_tree_to_string(data_element): """ Creates a string representation of the given data element tree. """ # FIXME: rewrite this as a visitor to use the data element tree traverser. def __dump(data_el, stream, offset): name = data_el.__class__.__name__ stream.write("%s%s"...
python
def data_element_tree_to_string(data_element): """ Creates a string representation of the given data element tree. """ # FIXME: rewrite this as a visitor to use the data element tree traverser. def __dump(data_el, stream, offset): name = data_el.__class__.__name__ stream.write("%s%s"...
[ "def", "data_element_tree_to_string", "(", "data_element", ")", ":", "# FIXME: rewrite this as a visitor to use the data element tree traverser.", "def", "__dump", "(", "data_el", ",", "stream", ",", "offset", ")", ":", "name", "=", "data_el", ".", "__class__", ".", "__...
Creates a string representation of the given data element tree.
[ "Creates", "a", "string", "representation", "of", "the", "given", "data", "element", "tree", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/representers/utils.py#L53-L98
40,762
pbrisk/timewave
timewave/consumers.py
ConsumerConsumer.initialize_path
def initialize_path(self, path_num=None): """ make the consumer_state ready for the next MC path :param int path_num: """ for c in self.consumers: c.initialize_path(path_num) self.state = [c.state for c in self.consumers]
python
def initialize_path(self, path_num=None): """ make the consumer_state ready for the next MC path :param int path_num: """ for c in self.consumers: c.initialize_path(path_num) self.state = [c.state for c in self.consumers]
[ "def", "initialize_path", "(", "self", ",", "path_num", "=", "None", ")", ":", "for", "c", "in", "self", ".", "consumers", ":", "c", ".", "initialize_path", "(", "path_num", ")", "self", ".", "state", "=", "[", "c", ".", "state", "for", "c", "in", ...
make the consumer_state ready for the next MC path :param int path_num:
[ "make", "the", "consumer_state", "ready", "for", "the", "next", "MC", "path" ]
cf641391d1607a424042724c8b990d43ee270ef6
https://github.com/pbrisk/timewave/blob/cf641391d1607a424042724c8b990d43ee270ef6/timewave/consumers.py#L148-L156
40,763
pbrisk/timewave
timewave/consumers.py
ConsumerConsumer.finalize_path
def finalize_path(self, path_num=None): """finalize path and populate result for ConsumerConsumer""" for c in self.consumers: c.finalize_path(path_num) self.result = [c.result for c in self.consumers]
python
def finalize_path(self, path_num=None): """finalize path and populate result for ConsumerConsumer""" for c in self.consumers: c.finalize_path(path_num) self.result = [c.result for c in self.consumers]
[ "def", "finalize_path", "(", "self", ",", "path_num", "=", "None", ")", ":", "for", "c", "in", "self", ".", "consumers", ":", "c", ".", "finalize_path", "(", "path_num", ")", "self", ".", "result", "=", "[", "c", ".", "result", "for", "c", "in", "s...
finalize path and populate result for ConsumerConsumer
[ "finalize", "path", "and", "populate", "result", "for", "ConsumerConsumer" ]
cf641391d1607a424042724c8b990d43ee270ef6
https://github.com/pbrisk/timewave/blob/cf641391d1607a424042724c8b990d43ee270ef6/timewave/consumers.py#L170-L174
40,764
pbrisk/timewave
timewave/consumers.py
ConsumerConsumer.finalize
def finalize(self): """finalize for ConsumerConsumer""" for c in self.consumers: c.finalize() self.result = [c.result for c in self.consumers]
python
def finalize(self): """finalize for ConsumerConsumer""" for c in self.consumers: c.finalize() self.result = [c.result for c in self.consumers]
[ "def", "finalize", "(", "self", ")", ":", "for", "c", "in", "self", ".", "consumers", ":", "c", ".", "finalize", "(", ")", "self", ".", "result", "=", "[", "c", ".", "result", "for", "c", "in", "self", ".", "consumers", "]" ]
finalize for ConsumerConsumer
[ "finalize", "for", "ConsumerConsumer" ]
cf641391d1607a424042724c8b990d43ee270ef6
https://github.com/pbrisk/timewave/blob/cf641391d1607a424042724c8b990d43ee270ef6/timewave/consumers.py#L176-L180
40,765
pbrisk/timewave
timewave/consumers.py
ConsumerConsumer.get
def get(self, queue_get): """ get to given consumer states. This function is used for merging of results of parallelized MC. The first state is used for merging in place. The states must be disjoint. :param object queue_get: second consumer state """ for (c, cs) ...
python
def get(self, queue_get): """ get to given consumer states. This function is used for merging of results of parallelized MC. The first state is used for merging in place. The states must be disjoint. :param object queue_get: second consumer state """ for (c, cs) ...
[ "def", "get", "(", "self", ",", "queue_get", ")", ":", "for", "(", "c", ",", "cs", ")", "in", "izip", "(", "self", ".", "consumers", ",", "queue_get", ")", ":", "c", ".", "get", "(", "cs", ")", "self", ".", "result", "=", "[", "c", ".", "resu...
get to given consumer states. This function is used for merging of results of parallelized MC. The first state is used for merging in place. The states must be disjoint. :param object queue_get: second consumer state
[ "get", "to", "given", "consumer", "states", ".", "This", "function", "is", "used", "for", "merging", "of", "results", "of", "parallelized", "MC", ".", "The", "first", "state", "is", "used", "for", "merging", "in", "place", ".", "The", "states", "must", "...
cf641391d1607a424042724c8b990d43ee270ef6
https://github.com/pbrisk/timewave/blob/cf641391d1607a424042724c8b990d43ee270ef6/timewave/consumers.py#L182-L192
40,766
pbrisk/timewave
timewave/consumers.py
TransposedConsumer.finalize
def finalize(self): """finalize for PathConsumer""" super(TransposedConsumer, self).finalize() self.result = map(list, zip(*self.result))
python
def finalize(self): """finalize for PathConsumer""" super(TransposedConsumer, self).finalize() self.result = map(list, zip(*self.result))
[ "def", "finalize", "(", "self", ")", ":", "super", "(", "TransposedConsumer", ",", "self", ")", ".", "finalize", "(", ")", "self", ".", "result", "=", "map", "(", "list", ",", "zip", "(", "*", "self", ".", "result", ")", ")" ]
finalize for PathConsumer
[ "finalize", "for", "PathConsumer" ]
cf641391d1607a424042724c8b990d43ee270ef6
https://github.com/pbrisk/timewave/blob/cf641391d1607a424042724c8b990d43ee270ef6/timewave/consumers.py#L206-L209
40,767
dariusbakunas/rawdisk
rawdisk/plugins/filesystems/ntfs/mft_entry.py
MftEntry._get_attribute
def _get_attribute(self, offset): """Determines attribute type at the offset and returns \ initialized attribute object. Returns: MftAttr: One of the attribute objects \ (eg. :class:`~.mft_attribute.MftAttrFilename`). None: If atttribute type does not mach an...
python
def _get_attribute(self, offset): """Determines attribute type at the offset and returns \ initialized attribute object. Returns: MftAttr: One of the attribute objects \ (eg. :class:`~.mft_attribute.MftAttrFilename`). None: If atttribute type does not mach an...
[ "def", "_get_attribute", "(", "self", ",", "offset", ")", ":", "attr_type", "=", "self", ".", "get_uint_le", "(", "offset", ")", "# Attribute length is in header @ offset 0x4", "length", "=", "self", ".", "get_uint_le", "(", "offset", "+", "0x04", ")", "data", ...
Determines attribute type at the offset and returns \ initialized attribute object. Returns: MftAttr: One of the attribute objects \ (eg. :class:`~.mft_attribute.MftAttrFilename`). None: If atttribute type does not mach any one of the supported \ attribut...
[ "Determines", "attribute", "type", "at", "the", "offset", "and", "returns", "\\", "initialized", "attribute", "object", "." ]
1dc9d0b377fe5da3c406ccec4abc238c54167403
https://github.com/dariusbakunas/rawdisk/blob/1dc9d0b377fe5da3c406ccec4abc238c54167403/rawdisk/plugins/filesystems/ntfs/mft_entry.py#L96-L111
40,768
tylucaskelley/licenser
licenser/licenser.py
find_in_matrix_2d
def find_in_matrix_2d(val, matrix): ''' Returns a tuple representing the index of an item in a 2D matrix. Arguments: - val (str) Value to look for - matrix (list) 2D matrix to search for val in Returns: - (tuple) Ordered pair representing location of val ''' dim = len(...
python
def find_in_matrix_2d(val, matrix): ''' Returns a tuple representing the index of an item in a 2D matrix. Arguments: - val (str) Value to look for - matrix (list) 2D matrix to search for val in Returns: - (tuple) Ordered pair representing location of val ''' dim = len(...
[ "def", "find_in_matrix_2d", "(", "val", ",", "matrix", ")", ":", "dim", "=", "len", "(", "matrix", "[", "0", "]", ")", "item_index", "=", "0", "for", "row", "in", "matrix", ":", "for", "i", "in", "row", ":", "if", "i", "==", "val", ":", "break", ...
Returns a tuple representing the index of an item in a 2D matrix. Arguments: - val (str) Value to look for - matrix (list) 2D matrix to search for val in Returns: - (tuple) Ordered pair representing location of val
[ "Returns", "a", "tuple", "representing", "the", "index", "of", "an", "item", "in", "a", "2D", "matrix", "." ]
6b7394fdaab7707c4c33201c4d023097452b46bc
https://github.com/tylucaskelley/licenser/blob/6b7394fdaab7707c4c33201c4d023097452b46bc/licenser/licenser.py#L21-L46
40,769
tylucaskelley/licenser
licenser/licenser.py
compute_distance
def compute_distance(a, b): ''' Computes a modified Levenshtein distance between two strings, comparing the lowercase versions of each string and accounting for QWERTY distance. Arguments: - a (str) String to compare to 'b' - b (str) String to compare to 'a' Returns: - (int...
python
def compute_distance(a, b): ''' Computes a modified Levenshtein distance between two strings, comparing the lowercase versions of each string and accounting for QWERTY distance. Arguments: - a (str) String to compare to 'b' - b (str) String to compare to 'a' Returns: - (int...
[ "def", "compute_distance", "(", "a", ",", "b", ")", ":", "# check simple cases first", "if", "not", "a", ":", "return", "len", "(", "b", ")", "if", "not", "b", ":", "return", "len", "(", "a", ")", "if", "a", "==", "b", "or", "str", ".", "lower", ...
Computes a modified Levenshtein distance between two strings, comparing the lowercase versions of each string and accounting for QWERTY distance. Arguments: - a (str) String to compare to 'b' - b (str) String to compare to 'a' Returns: - (int) Number representing closeness of 'a' a...
[ "Computes", "a", "modified", "Levenshtein", "distance", "between", "two", "strings", "comparing", "the", "lowercase", "versions", "of", "each", "string", "and", "accounting", "for", "QWERTY", "distance", "." ]
6b7394fdaab7707c4c33201c4d023097452b46bc
https://github.com/tylucaskelley/licenser/blob/6b7394fdaab7707c4c33201c4d023097452b46bc/licenser/licenser.py#L95-L139
40,770
tylucaskelley/licenser
licenser/licenser.py
get_defaults
def get_defaults(path): ''' Reads file for configuration defaults. Arguments: - path (str) Absolute filepath (usually ~/.licenser) Returns: - (dict) Defaults for name, email, license, .txt extension ''' defaults = {} if os.path.isfile(path): with open(path) as f: ...
python
def get_defaults(path): ''' Reads file for configuration defaults. Arguments: - path (str) Absolute filepath (usually ~/.licenser) Returns: - (dict) Defaults for name, email, license, .txt extension ''' defaults = {} if os.path.isfile(path): with open(path) as f: ...
[ "def", "get_defaults", "(", "path", ")", ":", "defaults", "=", "{", "}", "if", "os", ".", "path", ".", "isfile", "(", "path", ")", ":", "with", "open", "(", "path", ")", "as", "f", ":", "for", "line", "in", "f", ":", "line", "=", "line", ".", ...
Reads file for configuration defaults. Arguments: - path (str) Absolute filepath (usually ~/.licenser) Returns: - (dict) Defaults for name, email, license, .txt extension
[ "Reads", "file", "for", "configuration", "defaults", "." ]
6b7394fdaab7707c4c33201c4d023097452b46bc
https://github.com/tylucaskelley/licenser/blob/6b7394fdaab7707c4c33201c4d023097452b46bc/licenser/licenser.py#L142-L169
40,771
tylucaskelley/licenser
licenser/licenser.py
get_license
def get_license(name): ''' Returns the closest match to the requested license. Arguments: - name (str) License to use Returns: - (str) License that most closely matches the 'name' parameter ''' filenames = os.listdir(cwd + licenses_loc) licenses = dict(zip(filenames, [-1] ...
python
def get_license(name): ''' Returns the closest match to the requested license. Arguments: - name (str) License to use Returns: - (str) License that most closely matches the 'name' parameter ''' filenames = os.listdir(cwd + licenses_loc) licenses = dict(zip(filenames, [-1] ...
[ "def", "get_license", "(", "name", ")", ":", "filenames", "=", "os", ".", "listdir", "(", "cwd", "+", "licenses_loc", ")", "licenses", "=", "dict", "(", "zip", "(", "filenames", ",", "[", "-", "1", "]", "*", "len", "(", "filenames", ")", ")", ")", ...
Returns the closest match to the requested license. Arguments: - name (str) License to use Returns: - (str) License that most closely matches the 'name' parameter
[ "Returns", "the", "closest", "match", "to", "the", "requested", "license", "." ]
6b7394fdaab7707c4c33201c4d023097452b46bc
https://github.com/tylucaskelley/licenser/blob/6b7394fdaab7707c4c33201c4d023097452b46bc/licenser/licenser.py#L172-L189
40,772
tylucaskelley/licenser
licenser/licenser.py
get_args
def get_args(path): ''' Parse command line args & override defaults. Arguments: - path (str) Absolute filepath Returns: - (tuple) Name, email, license, project, ext, year ''' defaults = get_defaults(path) licenses = ', '.join(os.listdir(cwd + licenses_loc)) p = parser(...
python
def get_args(path): ''' Parse command line args & override defaults. Arguments: - path (str) Absolute filepath Returns: - (tuple) Name, email, license, project, ext, year ''' defaults = get_defaults(path) licenses = ', '.join(os.listdir(cwd + licenses_loc)) p = parser(...
[ "def", "get_args", "(", "path", ")", ":", "defaults", "=", "get_defaults", "(", "path", ")", "licenses", "=", "', '", ".", "join", "(", "os", ".", "listdir", "(", "cwd", "+", "licenses_loc", ")", ")", "p", "=", "parser", "(", "description", "=", "'to...
Parse command line args & override defaults. Arguments: - path (str) Absolute filepath Returns: - (tuple) Name, email, license, project, ext, year
[ "Parse", "command", "line", "args", "&", "override", "defaults", "." ]
6b7394fdaab7707c4c33201c4d023097452b46bc
https://github.com/tylucaskelley/licenser/blob/6b7394fdaab7707c4c33201c4d023097452b46bc/licenser/licenser.py#L192-L227
40,773
tylucaskelley/licenser
licenser/licenser.py
generate_license
def generate_license(args): ''' Creates a LICENSE or LICENSE.txt file in the current directory. Reads from the 'assets' folder and looks for placeholders enclosed in curly braces. Arguments: - (tuple) Name, email, license, project, ext, year ''' with open(cwd + licenses_loc + args[2]) ...
python
def generate_license(args): ''' Creates a LICENSE or LICENSE.txt file in the current directory. Reads from the 'assets' folder and looks for placeholders enclosed in curly braces. Arguments: - (tuple) Name, email, license, project, ext, year ''' with open(cwd + licenses_loc + args[2]) ...
[ "def", "generate_license", "(", "args", ")", ":", "with", "open", "(", "cwd", "+", "licenses_loc", "+", "args", "[", "2", "]", ")", "as", "f", ":", "license", "=", "f", ".", "read", "(", ")", "license", "=", "license", ".", "format", "(", "name", ...
Creates a LICENSE or LICENSE.txt file in the current directory. Reads from the 'assets' folder and looks for placeholders enclosed in curly braces. Arguments: - (tuple) Name, email, license, project, ext, year
[ "Creates", "a", "LICENSE", "or", "LICENSE", ".", "txt", "file", "in", "the", "current", "directory", ".", "Reads", "from", "the", "assets", "folder", "and", "looks", "for", "placeholders", "enclosed", "in", "curly", "braces", "." ]
6b7394fdaab7707c4c33201c4d023097452b46bc
https://github.com/tylucaskelley/licenser/blob/6b7394fdaab7707c4c33201c4d023097452b46bc/licenser/licenser.py#L230-L250
40,774
AtomHash/evernode
evernode/scripts/sendemail.py
SendEmail.parse
def parse(self): """ parses args json """ data = json.loads(sys.argv[1]) self.config_path = self.decode(data['config_path']) self.subject = self.decode(data['subject']) self.text = self.decode(data['text']) self.html = self.decode(data['html']) self.send_as...
python
def parse(self): """ parses args json """ data = json.loads(sys.argv[1]) self.config_path = self.decode(data['config_path']) self.subject = self.decode(data['subject']) self.text = self.decode(data['text']) self.html = self.decode(data['html']) self.send_as...
[ "def", "parse", "(", "self", ")", ":", "data", "=", "json", ".", "loads", "(", "sys", ".", "argv", "[", "1", "]", ")", "self", ".", "config_path", "=", "self", ".", "decode", "(", "data", "[", "'config_path'", "]", ")", "self", ".", "subject", "=...
parses args json
[ "parses", "args", "json" ]
b2fb91555fb937a3f3eba41db56dee26f9b034be
https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/scripts/sendemail.py#L47-L61
40,775
AtomHash/evernode
evernode/scripts/sendemail.py
SendEmail.construct_message
def construct_message(self, email=None): """ construct the email message """ # add subject, from and to self.multipart['Subject'] = self.subject self.multipart['From'] = self.config['EMAIL'] self.multipart['Date'] = formatdate(localtime=True) if email is None and se...
python
def construct_message(self, email=None): """ construct the email message """ # add subject, from and to self.multipart['Subject'] = self.subject self.multipart['From'] = self.config['EMAIL'] self.multipart['Date'] = formatdate(localtime=True) if email is None and se...
[ "def", "construct_message", "(", "self", ",", "email", "=", "None", ")", ":", "# add subject, from and to\r", "self", ".", "multipart", "[", "'Subject'", "]", "=", "self", ".", "subject", "self", ".", "multipart", "[", "'From'", "]", "=", "self", ".", "con...
construct the email message
[ "construct", "the", "email", "message" ]
b2fb91555fb937a3f3eba41db56dee26f9b034be
https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/scripts/sendemail.py#L81-L100
40,776
AtomHash/evernode
evernode/scripts/sendemail.py
SendEmail.send
def send(self, email=None): """ send email message """ if email is None and self.send_as_one: self.smtp.send_message( self.multipart, self.config['EMAIL'], self.addresses) elif email is not None and self.send_as_one is False: self.smtp.send_message( ...
python
def send(self, email=None): """ send email message """ if email is None and self.send_as_one: self.smtp.send_message( self.multipart, self.config['EMAIL'], self.addresses) elif email is not None and self.send_as_one is False: self.smtp.send_message( ...
[ "def", "send", "(", "self", ",", "email", "=", "None", ")", ":", "if", "email", "is", "None", "and", "self", ".", "send_as_one", ":", "self", ".", "smtp", ".", "send_message", "(", "self", ".", "multipart", ",", "self", ".", "config", "[", "'EMAIL'",...
send email message
[ "send", "email", "message" ]
b2fb91555fb937a3f3eba41db56dee26f9b034be
https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/scripts/sendemail.py#L109-L117
40,777
AtomHash/evernode
evernode/scripts/sendemail.py
SendEmail.create_email
def create_email(self): """ main function to construct and send email """ self.connect() if self.send_as_one: self.construct_message() self.send() elif self.send_as_one is False: for email in self.addresses: self.construct_messa...
python
def create_email(self): """ main function to construct and send email """ self.connect() if self.send_as_one: self.construct_message() self.send() elif self.send_as_one is False: for email in self.addresses: self.construct_messa...
[ "def", "create_email", "(", "self", ")", ":", "self", ".", "connect", "(", ")", "if", "self", ".", "send_as_one", ":", "self", ".", "construct_message", "(", ")", "self", ".", "send", "(", ")", "elif", "self", ".", "send_as_one", "is", "False", ":", ...
main function to construct and send email
[ "main", "function", "to", "construct", "and", "send", "email" ]
b2fb91555fb937a3f3eba41db56dee26f9b034be
https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/scripts/sendemail.py#L119-L129
40,778
ylogx/definition
definition/definition.py
get_definition
def get_definition(query): """Returns dictionary of id, first names of people who posted on my wall between start and end time""" try: return get_definition_api(query) except: raise # http://api.wordnik.com:80/v4/word.json/discrimination/definitions?limit=200&includeRelated=true&sou...
python
def get_definition(query): """Returns dictionary of id, first names of people who posted on my wall between start and end time""" try: return get_definition_api(query) except: raise # http://api.wordnik.com:80/v4/word.json/discrimination/definitions?limit=200&includeRelated=true&sou...
[ "def", "get_definition", "(", "query", ")", ":", "try", ":", "return", "get_definition_api", "(", "query", ")", "except", ":", "raise", "# http://api.wordnik.com:80/v4/word.json/discrimination/definitions?limit=200&includeRelated=true&sourceDictionaries=all&useCanonical=false&include...
Returns dictionary of id, first names of people who posted on my wall between start and end time
[ "Returns", "dictionary", "of", "id", "first", "names", "of", "people", "who", "posted", "on", "my", "wall", "between", "start", "and", "end", "time" ]
3699670b33b3a345297b0035fcc1f5aa15959f71
https://github.com/ylogx/definition/blob/3699670b33b3a345297b0035fcc1f5aa15959f71/definition/definition.py#L187-L203
40,779
ponty/confduino
confduino/version.py
intversion
def intversion(text=None): """return version as int. 0022 -> 22 0022ubuntu0.1 -> 22 0023 -> 23 1.0 -> 100 1.0.3 -> 103 1:1.0.5+dfsg2-2 -> 105 """ try: s = text if not s: s = version() s = s.split('ubuntu')[0] s = s.split(':')[-1] ...
python
def intversion(text=None): """return version as int. 0022 -> 22 0022ubuntu0.1 -> 22 0023 -> 23 1.0 -> 100 1.0.3 -> 103 1:1.0.5+dfsg2-2 -> 105 """ try: s = text if not s: s = version() s = s.split('ubuntu')[0] s = s.split(':')[-1] ...
[ "def", "intversion", "(", "text", "=", "None", ")", ":", "try", ":", "s", "=", "text", "if", "not", "s", ":", "s", "=", "version", "(", ")", "s", "=", "s", ".", "split", "(", "'ubuntu'", ")", "[", "0", "]", "s", "=", "s", ".", "split", "(",...
return version as int. 0022 -> 22 0022ubuntu0.1 -> 22 0023 -> 23 1.0 -> 100 1.0.3 -> 103 1:1.0.5+dfsg2-2 -> 105
[ "return", "version", "as", "int", "." ]
f4c261e5e84997f145a8bdd001f471db74c9054b
https://github.com/ponty/confduino/blob/f4c261e5e84997f145a8bdd001f471db74c9054b/confduino/version.py#L24-L56
40,780
AtomHash/evernode
evernode/classes/session.py
Session.set_current_session
def set_current_session(session_id) -> bool: """ Add session_id to flask globals for current request """ try: g.session_id = session_id return True except (Exception, BaseException) as error: # catch all on config update if current_app.confi...
python
def set_current_session(session_id) -> bool: """ Add session_id to flask globals for current request """ try: g.session_id = session_id return True except (Exception, BaseException) as error: # catch all on config update if current_app.confi...
[ "def", "set_current_session", "(", "session_id", ")", "->", "bool", ":", "try", ":", "g", ".", "session_id", "=", "session_id", "return", "True", "except", "(", "Exception", ",", "BaseException", ")", "as", "error", ":", "# catch all on config update\r", "if", ...
Add session_id to flask globals for current request
[ "Add", "session_id", "to", "flask", "globals", "for", "current", "request" ]
b2fb91555fb937a3f3eba41db56dee26f9b034be
https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/classes/session.py#L18-L27
40,781
helixyte/everest
everest/representers/traversal.py
ResourceDataVisitor.visit_member
def visit_member(self, attribute_key, attribute, member_node, member_data, is_link_node, parent_data, index=None): """ Visits a member node in a resource data tree. :param tuple attribute_key: tuple containing the attribute tokens identifying the member node's pos...
python
def visit_member(self, attribute_key, attribute, member_node, member_data, is_link_node, parent_data, index=None): """ Visits a member node in a resource data tree. :param tuple attribute_key: tuple containing the attribute tokens identifying the member node's pos...
[ "def", "visit_member", "(", "self", ",", "attribute_key", ",", "attribute", ",", "member_node", ",", "member_data", ",", "is_link_node", ",", "parent_data", ",", "index", "=", "None", ")", ":", "raise", "NotImplementedError", "(", "'Abstract method.'", ")" ]
Visits a member node in a resource data tree. :param tuple attribute_key: tuple containing the attribute tokens identifying the member node's position in the resource data tree. :param attribute: mapped attribute holding information about the member node's name (in the parent) and t...
[ "Visits", "a", "member", "node", "in", "a", "resource", "data", "tree", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/representers/traversal.py#L53-L76
40,782
helixyte/everest
everest/representers/traversal.py
DataElementDataTraversalProxy.get_relationship
def get_relationship(self, attribute): """ Returns the domain relationship object for the given resource attribute. """ rel = self.__relationships.get(attribute.entity_attr) if rel is None: rel = LazyDomainRelationship(self, attribute, ...
python
def get_relationship(self, attribute): """ Returns the domain relationship object for the given resource attribute. """ rel = self.__relationships.get(attribute.entity_attr) if rel is None: rel = LazyDomainRelationship(self, attribute, ...
[ "def", "get_relationship", "(", "self", ",", "attribute", ")", ":", "rel", "=", "self", ".", "__relationships", ".", "get", "(", "attribute", ".", "entity_attr", ")", "if", "rel", "is", "None", ":", "rel", "=", "LazyDomainRelationship", "(", "self", ",", ...
Returns the domain relationship object for the given resource attribute.
[ "Returns", "the", "domain", "relationship", "object", "for", "the", "given", "resource", "attribute", "." ]
70c9b93c3061db5cb62428349d18b8fb8566411b
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/representers/traversal.py#L438-L449
40,783
MKLab-ITI/reveal-user-annotation
reveal_user_annotation/rabbitmq/rabbitmq_util.py
simple_notification
def simple_notification(connection, queue_name, exchange_name, routing_key, text_body): """ Publishes a simple notification. Inputs: - connection: A rabbitmq connection object. - queue_name: The name of the queue to be checked or created. - exchange_name: The name of the notificatio...
python
def simple_notification(connection, queue_name, exchange_name, routing_key, text_body): """ Publishes a simple notification. Inputs: - connection: A rabbitmq connection object. - queue_name: The name of the queue to be checked or created. - exchange_name: The name of the notificatio...
[ "def", "simple_notification", "(", "connection", ",", "queue_name", ",", "exchange_name", ",", "routing_key", ",", "text_body", ")", ":", "channel", "=", "connection", ".", "channel", "(", ")", "try", ":", "channel", ".", "queue_declare", "(", "queue_name", ",...
Publishes a simple notification. Inputs: - connection: A rabbitmq connection object. - queue_name: The name of the queue to be checked or created. - exchange_name: The name of the notification exchange. - routing_key: The routing key for the exchange-queue binding. -...
[ "Publishes", "a", "simple", "notification", "." ]
ed019c031857b091e5601f53ba3f01a499a0e3ef
https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/rabbitmq/rabbitmq_util.py#L74-L96
40,784
callowayproject/Calloway
calloway/menu.py
DefaultMenu.get_url
def get_url(self, url_or_dict): """ Returns the reversed url given a string or dict and prints errors if MENU_DEBUG is enabled """ if isinstance(url_or_dict, basestring): url_or_dict = {'viewname': url_or_dict} try: return reverse(**url_or_dict) ex...
python
def get_url(self, url_or_dict): """ Returns the reversed url given a string or dict and prints errors if MENU_DEBUG is enabled """ if isinstance(url_or_dict, basestring): url_or_dict = {'viewname': url_or_dict} try: return reverse(**url_or_dict) ex...
[ "def", "get_url", "(", "self", ",", "url_or_dict", ")", ":", "if", "isinstance", "(", "url_or_dict", ",", "basestring", ")", ":", "url_or_dict", "=", "{", "'viewname'", ":", "url_or_dict", "}", "try", ":", "return", "reverse", "(", "*", "*", "url_or_dict",...
Returns the reversed url given a string or dict and prints errors if MENU_DEBUG is enabled
[ "Returns", "the", "reversed", "url", "given", "a", "string", "or", "dict", "and", "prints", "errors", "if", "MENU_DEBUG", "is", "enabled" ]
d22e98d41fbd298ab6393ba7bd84a75528be9f81
https://github.com/callowayproject/Calloway/blob/d22e98d41fbd298ab6393ba7bd84a75528be9f81/calloway/menu.py#L47-L57
40,785
RI-imaging/qpformat
qpformat/file_formats/single_tif_holo.py
SingleTifHolo.get_time
def get_time(self): """Time of the TIFF file Currently, only the file modification time is supported. Note that the modification time of the TIFF file is dependent on the file system and may have temporal resolution as low as 3 seconds. """ if isinstance(self.pat...
python
def get_time(self): """Time of the TIFF file Currently, only the file modification time is supported. Note that the modification time of the TIFF file is dependent on the file system and may have temporal resolution as low as 3 seconds. """ if isinstance(self.pat...
[ "def", "get_time", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "path", ",", "pathlib", ".", "Path", ")", ":", "thetime", "=", "self", ".", "path", ".", "stat", "(", ")", ".", "st_mtime", "else", ":", "thetime", "=", "np", ".", "n...
Time of the TIFF file Currently, only the file modification time is supported. Note that the modification time of the TIFF file is dependent on the file system and may have temporal resolution as low as 3 seconds.
[ "Time", "of", "the", "TIFF", "file" ]
364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb
https://github.com/RI-imaging/qpformat/blob/364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb/qpformat/file_formats/single_tif_holo.py#L26-L38
40,786
RI-imaging/qpformat
qpformat/file_formats/single_tif_holo.py
SingleTifHolo.verify
def verify(path): """Verify that `path` is a valid TIFF file""" valid = False try: tf = SingleTifHolo._get_tif(path) except (ValueError, IsADirectoryError): pass else: if len(tf) == 1: valid = True return valid
python
def verify(path): """Verify that `path` is a valid TIFF file""" valid = False try: tf = SingleTifHolo._get_tif(path) except (ValueError, IsADirectoryError): pass else: if len(tf) == 1: valid = True return valid
[ "def", "verify", "(", "path", ")", ":", "valid", "=", "False", "try", ":", "tf", "=", "SingleTifHolo", ".", "_get_tif", "(", "path", ")", "except", "(", "ValueError", ",", "IsADirectoryError", ")", ":", "pass", "else", ":", "if", "len", "(", "tf", ")...
Verify that `path` is a valid TIFF file
[ "Verify", "that", "path", "is", "a", "valid", "TIFF", "file" ]
364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb
https://github.com/RI-imaging/qpformat/blob/364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb/qpformat/file_formats/single_tif_holo.py#L57-L67
40,787
danbradham/scrim
scrim/__main__.py
add
def add(entry_point, all_entry_points, auto_write, scripts_path): '''Add Scrim scripts for a python project''' click.echo() if not entry_point and not all_entry_points: raise click.UsageError( 'Missing required option: --entry_point or --all_entry_points' ) if not os.path.ex...
python
def add(entry_point, all_entry_points, auto_write, scripts_path): '''Add Scrim scripts for a python project''' click.echo() if not entry_point and not all_entry_points: raise click.UsageError( 'Missing required option: --entry_point or --all_entry_points' ) if not os.path.ex...
[ "def", "add", "(", "entry_point", ",", "all_entry_points", ",", "auto_write", ",", "scripts_path", ")", ":", "click", ".", "echo", "(", ")", "if", "not", "entry_point", "and", "not", "all_entry_points", ":", "raise", "click", ".", "UsageError", "(", "'Missin...
Add Scrim scripts for a python project
[ "Add", "Scrim", "scripts", "for", "a", "python", "project" ]
982a5db1db6e4ef40267f15642af2c7ea0e803ae
https://github.com/danbradham/scrim/blob/982a5db1db6e4ef40267f15642af2c7ea0e803ae/scrim/__main__.py#L20-L89
40,788
andy29485/embypy
embypy/objects/folders.py
Playlist.songs
async def songs(self): '''list of songs in the playlist |force| |coro| Returns ------- list of type :class:`embypy.objects.Audio` ''' items = [] for i in await self.items: if i.type == 'Audio': items.append(i) elif hasattr(i, 'songs'): items.exten...
python
async def songs(self): '''list of songs in the playlist |force| |coro| Returns ------- list of type :class:`embypy.objects.Audio` ''' items = [] for i in await self.items: if i.type == 'Audio': items.append(i) elif hasattr(i, 'songs'): items.exten...
[ "async", "def", "songs", "(", "self", ")", ":", "items", "=", "[", "]", "for", "i", "in", "await", "self", ".", "items", ":", "if", "i", ".", "type", "==", "'Audio'", ":", "items", ".", "append", "(", "i", ")", "elif", "hasattr", "(", "i", ",",...
list of songs in the playlist |force| |coro| Returns ------- list of type :class:`embypy.objects.Audio`
[ "list", "of", "songs", "in", "the", "playlist" ]
cde658d380965caaf4789d4d182d045b0346797b
https://github.com/andy29485/embypy/blob/cde658d380965caaf4789d4d182d045b0346797b/embypy/objects/folders.py#L82-L100
40,789
andy29485/embypy
embypy/objects/folders.py
Playlist.add_items
async def add_items(self, *items): '''append items to the playlist |coro| Parameters ---------- items : array_like list of items to add(or their ids) See Also -------- remove_items : ''' items = [item.id for item in await self.process(items)] if not items: re...
python
async def add_items(self, *items): '''append items to the playlist |coro| Parameters ---------- items : array_like list of items to add(or their ids) See Also -------- remove_items : ''' items = [item.id for item in await self.process(items)] if not items: re...
[ "async", "def", "add_items", "(", "self", ",", "*", "items", ")", ":", "items", "=", "[", "item", ".", "id", "for", "item", "in", "await", "self", ".", "process", "(", "items", ")", "]", "if", "not", "items", ":", "return", "await", "self", ".", ...
append items to the playlist |coro| Parameters ---------- items : array_like list of items to add(or their ids) See Also -------- remove_items :
[ "append", "items", "to", "the", "playlist" ]
cde658d380965caaf4789d4d182d045b0346797b
https://github.com/andy29485/embypy/blob/cde658d380965caaf4789d4d182d045b0346797b/embypy/objects/folders.py#L129-L149
40,790
andy29485/embypy
embypy/objects/folders.py
Playlist.remove_items
async def remove_items(self, *items): '''remove items from the playlist |coro| Parameters ---------- items : array_like list of items to remove(or their ids) See Also -------- add_items : ''' items = [i.id for i in (await self.process(items)) if i in self.items] if...
python
async def remove_items(self, *items): '''remove items from the playlist |coro| Parameters ---------- items : array_like list of items to remove(or their ids) See Also -------- add_items : ''' items = [i.id for i in (await self.process(items)) if i in self.items] if...
[ "async", "def", "remove_items", "(", "self", ",", "*", "items", ")", ":", "items", "=", "[", "i", ".", "id", "for", "i", "in", "(", "await", "self", ".", "process", "(", "items", ")", ")", "if", "i", "in", "self", ".", "items", "]", "if", "not"...
remove items from the playlist |coro| Parameters ---------- items : array_like list of items to remove(or their ids) See Also -------- add_items :
[ "remove", "items", "from", "the", "playlist" ]
cde658d380965caaf4789d4d182d045b0346797b
https://github.com/andy29485/embypy/blob/cde658d380965caaf4789d4d182d045b0346797b/embypy/objects/folders.py#L154-L176
40,791
andy29485/embypy
embypy/objects/folders.py
BoxSet.movies
async def movies(self): '''list of movies in the collection |force| |coro| Returns ------- list of type :class:`embypy.objects.Movie` ''' items = [] for i in await self.items: if i.type == 'Movie': items.append(i) elif hasattr(i, 'movies'): items....
python
async def movies(self): '''list of movies in the collection |force| |coro| Returns ------- list of type :class:`embypy.objects.Movie` ''' items = [] for i in await self.items: if i.type == 'Movie': items.append(i) elif hasattr(i, 'movies'): items....
[ "async", "def", "movies", "(", "self", ")", ":", "items", "=", "[", "]", "for", "i", "in", "await", "self", ".", "items", ":", "if", "i", ".", "type", "==", "'Movie'", ":", "items", ".", "append", "(", "i", ")", "elif", "hasattr", "(", "i", ","...
list of movies in the collection |force| |coro| Returns ------- list of type :class:`embypy.objects.Movie`
[ "list", "of", "movies", "in", "the", "collection" ]
cde658d380965caaf4789d4d182d045b0346797b
https://github.com/andy29485/embypy/blob/cde658d380965caaf4789d4d182d045b0346797b/embypy/objects/folders.py#L196-L214
40,792
andy29485/embypy
embypy/objects/folders.py
BoxSet.series
async def series(self): '''list of series in the collection |force| |coro| Returns ------- list of type :class:`embypy.objects.Series` ''' items = [] for i in await self.items: if i.type == 'Series': items.append(i) elif hasattr(i, 'series'): item...
python
async def series(self): '''list of series in the collection |force| |coro| Returns ------- list of type :class:`embypy.objects.Series` ''' items = [] for i in await self.items: if i.type == 'Series': items.append(i) elif hasattr(i, 'series'): item...
[ "async", "def", "series", "(", "self", ")", ":", "items", "=", "[", "]", "for", "i", "in", "await", "self", ".", "items", ":", "if", "i", ".", "type", "==", "'Series'", ":", "items", ".", "append", "(", "i", ")", "elif", "hasattr", "(", "i", ",...
list of series in the collection |force| |coro| Returns ------- list of type :class:`embypy.objects.Series`
[ "list", "of", "series", "in", "the", "collection" ]
cde658d380965caaf4789d4d182d045b0346797b
https://github.com/andy29485/embypy/blob/cde658d380965caaf4789d4d182d045b0346797b/embypy/objects/folders.py#L243-L261
40,793
tBaxter/activity-monitor
activity_monitor/models.py
Activity.save
def save(self, *args, **kwargs): """ Store a string representation of content_object as target and actor name for fast retrieval and sorting. """ if not self.target: self.target = str(self.content_object) if not self.actor_name: self.actor_name = s...
python
def save(self, *args, **kwargs): """ Store a string representation of content_object as target and actor name for fast retrieval and sorting. """ if not self.target: self.target = str(self.content_object) if not self.actor_name: self.actor_name = s...
[ "def", "save", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "target", ":", "self", ".", "target", "=", "str", "(", "self", ".", "content_object", ")", "if", "not", "self", ".", "actor_name", ":", "se...
Store a string representation of content_object as target and actor name for fast retrieval and sorting.
[ "Store", "a", "string", "representation", "of", "content_object", "as", "target", "and", "actor", "name", "for", "fast", "retrieval", "and", "sorting", "." ]
be6c6edc7c6b4141923b47376502cde0f785eb68
https://github.com/tBaxter/activity-monitor/blob/be6c6edc7c6b4141923b47376502cde0f785eb68/activity_monitor/models.py#L43-L52
40,794
pwaller/__autoversion__
__autoversion__.py
version_from_frame
def version_from_frame(frame): """ Given a ``frame``, obtain the version number of the module running there. """ module = getmodule(frame) if module is None: s = "<unknown from {0}:{1}>" return s.format(frame.f_code.co_filename, frame.f_lineno) module_name = module.__name__ ...
python
def version_from_frame(frame): """ Given a ``frame``, obtain the version number of the module running there. """ module = getmodule(frame) if module is None: s = "<unknown from {0}:{1}>" return s.format(frame.f_code.co_filename, frame.f_lineno) module_name = module.__name__ ...
[ "def", "version_from_frame", "(", "frame", ")", ":", "module", "=", "getmodule", "(", "frame", ")", "if", "module", "is", "None", ":", "s", "=", "\"<unknown from {0}:{1}>\"", "return", "s", ".", "format", "(", "frame", ".", "f_code", ".", "co_filename", ",...
Given a ``frame``, obtain the version number of the module running there.
[ "Given", "a", "frame", "obtain", "the", "version", "number", "of", "the", "module", "running", "there", "." ]
caaaff2c5a758388cdd6117fed0847fb4cd103f5
https://github.com/pwaller/__autoversion__/blob/caaaff2c5a758388cdd6117fed0847fb4cd103f5/__autoversion__.py#L104-L133
40,795
pwaller/__autoversion__
__autoversion__.py
try_fix_num
def try_fix_num(n): """ Return ``n`` as an integer if it is numeric, otherwise return the input """ if not n.isdigit(): return n if n.startswith("0"): n = n.lstrip("0") if not n: n = "0" return int(n)
python
def try_fix_num(n): """ Return ``n`` as an integer if it is numeric, otherwise return the input """ if not n.isdigit(): return n if n.startswith("0"): n = n.lstrip("0") if not n: n = "0" return int(n)
[ "def", "try_fix_num", "(", "n", ")", ":", "if", "not", "n", ".", "isdigit", "(", ")", ":", "return", "n", "if", "n", ".", "startswith", "(", "\"0\"", ")", ":", "n", "=", "n", ".", "lstrip", "(", "\"0\"", ")", "if", "not", "n", ":", "n", "=", ...
Return ``n`` as an integer if it is numeric, otherwise return the input
[ "Return", "n", "as", "an", "integer", "if", "it", "is", "numeric", "otherwise", "return", "the", "input" ]
caaaff2c5a758388cdd6117fed0847fb4cd103f5
https://github.com/pwaller/__autoversion__/blob/caaaff2c5a758388cdd6117fed0847fb4cd103f5/__autoversion__.py#L136-L146
40,796
pwaller/__autoversion__
__autoversion__.py
tupleize_version
def tupleize_version(version): """ Split ``version`` into a lexicographically comparable tuple. "1.0.3" -> ((1, 0, 3),) "1.0.3-dev" -> ((1, 0, 3), ("dev",)) "1.0.3-rc-5" -> ((1, 0, 3), ("rc",), (5,)) """ if version is None: return (("unknown",),) if version.startswith("<unknow...
python
def tupleize_version(version): """ Split ``version`` into a lexicographically comparable tuple. "1.0.3" -> ((1, 0, 3),) "1.0.3-dev" -> ((1, 0, 3), ("dev",)) "1.0.3-rc-5" -> ((1, 0, 3), ("rc",), (5,)) """ if version is None: return (("unknown",),) if version.startswith("<unknow...
[ "def", "tupleize_version", "(", "version", ")", ":", "if", "version", "is", "None", ":", "return", "(", "(", "\"unknown\"", ",", ")", ",", ")", "if", "version", ".", "startswith", "(", "\"<unknown\"", ")", ":", "return", "(", "(", "\"unknown\"", ",", "...
Split ``version`` into a lexicographically comparable tuple. "1.0.3" -> ((1, 0, 3),) "1.0.3-dev" -> ((1, 0, 3), ("dev",)) "1.0.3-rc-5" -> ((1, 0, 3), ("rc",), (5,))
[ "Split", "version", "into", "a", "lexicographically", "comparable", "tuple", "." ]
caaaff2c5a758388cdd6117fed0847fb4cd103f5
https://github.com/pwaller/__autoversion__/blob/caaaff2c5a758388cdd6117fed0847fb4cd103f5/__autoversion__.py#L149-L172
40,797
pwaller/__autoversion__
__autoversion__.py
Git.get_version
def get_version(cls, path, memo={}): """ Return a string describing the version of the repository at ``path`` if possible, otherwise throws ``subprocess.CalledProcessError``. (Note: memoizes the result in the ``memo`` parameter) """ if path not in memo: memo[...
python
def get_version(cls, path, memo={}): """ Return a string describing the version of the repository at ``path`` if possible, otherwise throws ``subprocess.CalledProcessError``. (Note: memoizes the result in the ``memo`` parameter) """ if path not in memo: memo[...
[ "def", "get_version", "(", "cls", ",", "path", ",", "memo", "=", "{", "}", ")", ":", "if", "path", "not", "in", "memo", ":", "memo", "[", "path", "]", "=", "subprocess", ".", "check_output", "(", "\"git describe --tags --dirty 2> /dev/null\"", ",", "shell"...
Return a string describing the version of the repository at ``path`` if possible, otherwise throws ``subprocess.CalledProcessError``. (Note: memoizes the result in the ``memo`` parameter)
[ "Return", "a", "string", "describing", "the", "version", "of", "the", "repository", "at", "path", "if", "possible", "otherwise", "throws", "subprocess", ".", "CalledProcessError", "." ]
caaaff2c5a758388cdd6117fed0847fb4cd103f5
https://github.com/pwaller/__autoversion__/blob/caaaff2c5a758388cdd6117fed0847fb4cd103f5/__autoversion__.py#L41-L59
40,798
pwaller/__autoversion__
__autoversion__.py
Git.is_repo_instance
def is_repo_instance(cls, path): """ Return ``True`` if ``path`` is a source controlled repository. """ try: cls.get_version(path) return True except subprocess.CalledProcessError: # Git returns non-zero status return False ...
python
def is_repo_instance(cls, path): """ Return ``True`` if ``path`` is a source controlled repository. """ try: cls.get_version(path) return True except subprocess.CalledProcessError: # Git returns non-zero status return False ...
[ "def", "is_repo_instance", "(", "cls", ",", "path", ")", ":", "try", ":", "cls", ".", "get_version", "(", "path", ")", "return", "True", "except", "subprocess", ".", "CalledProcessError", ":", "# Git returns non-zero status", "return", "False", "except", "OSErro...
Return ``True`` if ``path`` is a source controlled repository.
[ "Return", "True", "if", "path", "is", "a", "source", "controlled", "repository", "." ]
caaaff2c5a758388cdd6117fed0847fb4cd103f5
https://github.com/pwaller/__autoversion__/blob/caaaff2c5a758388cdd6117fed0847fb4cd103f5/__autoversion__.py#L62-L74
40,799
greenape/mktheapidocs
mktheapidocs/mkapi.py
_sort_modules
def _sort_modules(mods): """ Always sort `index` or `README` as first filename in list. """ def compare(x, y): x = x[1] y = y[1] if x == y: return 0 if y.stem == "__init__.py": return 1 if x.stem == "__init__.py" or x < y: return -1 ...
python
def _sort_modules(mods): """ Always sort `index` or `README` as first filename in list. """ def compare(x, y): x = x[1] y = y[1] if x == y: return 0 if y.stem == "__init__.py": return 1 if x.stem == "__init__.py" or x < y: return -1 ...
[ "def", "_sort_modules", "(", "mods", ")", ":", "def", "compare", "(", "x", ",", "y", ")", ":", "x", "=", "x", "[", "1", "]", "y", "=", "y", "[", "1", "]", "if", "x", "==", "y", ":", "return", "0", "if", "y", ".", "stem", "==", "\"__init__.p...
Always sort `index` or `README` as first filename in list.
[ "Always", "sort", "index", "or", "README", "as", "first", "filename", "in", "list", "." ]
a45e8b43ddd80ed360fe1e98d4f73dc11c4e7bf7
https://github.com/greenape/mktheapidocs/blob/a45e8b43ddd80ed360fe1e98d4f73dc11c4e7bf7/mktheapidocs/mkapi.py#L28-L42