repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
mitsei/dlkit
dlkit/json_/assessment_authoring/sessions.py
SequenceRuleAdminSession.update_sequence_rule
def update_sequence_rule(self, sequence_rule_form): """Updates an existing sequence rule. arg: sequence_rule_form (osid.assessment.authoring.SequenceRuleForm): the form containing the elements to be updated raise: IllegalState - ``sequence_rule_form`` already...
python
def update_sequence_rule(self, sequence_rule_form): """Updates an existing sequence rule. arg: sequence_rule_form (osid.assessment.authoring.SequenceRuleForm): the form containing the elements to be updated raise: IllegalState - ``sequence_rule_form`` already...
[ "def", "update_sequence_rule", "(", "self", ",", "sequence_rule_form", ")", ":", "# Implemented from template for", "# osid.resource.ResourceAdminSession.update_resource_template", "collection", "=", "JSONClientValidated", "(", "'assessment_authoring'", ",", "collection", "=", "'...
Updates an existing sequence rule. arg: sequence_rule_form (osid.assessment.authoring.SequenceRuleForm): the form containing the elements to be updated raise: IllegalState - ``sequence_rule_form`` already used in an update transaction raise: ...
[ "Updates", "an", "existing", "sequence", "rule", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment_authoring/sessions.py#L2584-L2625
mitsei/dlkit
dlkit/json_/assessment_authoring/sessions.py
SequenceRuleAdminSession.delete_sequence_rule
def delete_sequence_rule(self, sequence_rule_id): """Deletes a ``SequenceRule``. arg: sequence_rule_id (osid.id.Id): the ``Id`` of the ``SequenceRule`` to remove raise: NotFound - ``sequence_rule_id`` not found raise: NullArgument - ``sequence_rule_id`` is ``null`` ...
python
def delete_sequence_rule(self, sequence_rule_id): """Deletes a ``SequenceRule``. arg: sequence_rule_id (osid.id.Id): the ``Id`` of the ``SequenceRule`` to remove raise: NotFound - ``sequence_rule_id`` not found raise: NullArgument - ``sequence_rule_id`` is ``null`` ...
[ "def", "delete_sequence_rule", "(", "self", ",", "sequence_rule_id", ")", ":", "# Implemented from template for", "# osid.resource.ResourceAdminSession.delete_resource_template", "collection", "=", "JSONClientValidated", "(", "'assessment_authoring'", ",", "collection", "=", "'Se...
Deletes a ``SequenceRule``. arg: sequence_rule_id (osid.id.Id): the ``Id`` of the ``SequenceRule`` to remove raise: NotFound - ``sequence_rule_id`` not found raise: NullArgument - ``sequence_rule_id`` is ``null`` raise: OperationFailed - unable to complete request ...
[ "Deletes", "a", "SequenceRule", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment_authoring/sessions.py#L2648-L2672
mitsei/dlkit
dlkit/json_/assessment_authoring/sessions.py
SequenceRuleAdminSession.alias_sequence_rule
def alias_sequence_rule(self, sequence_rule_id, alias_id): """Adds a ``Id`` to a ``SequenceRule`` for the purpose of creating compatibility. The primary ``Id`` of the ``SequenceRule`` is determined by the provider. The new ``Id`` performs as an alias to the primary ``Id`` . If the alias...
python
def alias_sequence_rule(self, sequence_rule_id, alias_id): """Adds a ``Id`` to a ``SequenceRule`` for the purpose of creating compatibility. The primary ``Id`` of the ``SequenceRule`` is determined by the provider. The new ``Id`` performs as an alias to the primary ``Id`` . If the alias...
[ "def", "alias_sequence_rule", "(", "self", ",", "sequence_rule_id", ",", "alias_id", ")", ":", "# Implemented from template for", "# osid.resource.ResourceAdminSession.alias_resources_template", "self", ".", "_alias_id", "(", "primary_id", "=", "sequence_rule_id", ",", "equiv...
Adds a ``Id`` to a ``SequenceRule`` for the purpose of creating compatibility. The primary ``Id`` of the ``SequenceRule`` is determined by the provider. The new ``Id`` performs as an alias to the primary ``Id`` . If the alias is a pointer to another sequence rule. it is reassigned to th...
[ "Adds", "a", "Id", "to", "a", "SequenceRule", "for", "the", "purpose", "of", "creating", "compatibility", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment_authoring/sessions.py#L2693-L2715
mitsei/dlkit
dlkit/runtime/impls/authentication_process/objects.py
DjangoAuthentication.get_agent_id
def get_agent_id(self): """Gets the ``Id`` of the ``Agent`` identified in this authentication credential. :return: the ``Agent Id`` :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* *implementation notes*: The Agent should be determined at the ...
python
def get_agent_id(self): """Gets the ``Id`` of the ``Agent`` identified in this authentication credential. :return: the ``Agent Id`` :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* *implementation notes*: The Agent should be determined at the ...
[ "def", "get_agent_id", "(", "self", ")", ":", "if", "self", ".", "_django_user", "is", "not", "None", ":", "if", "self", ".", "_use_user_id", ":", "identifier", "=", "self", ".", "_django_user", ".", "id", "else", ":", "identifier", "=", "self", ".", "...
Gets the ``Id`` of the ``Agent`` identified in this authentication credential. :return: the ``Agent Id`` :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* *implementation notes*: The Agent should be determined at the time this credential is crea...
[ "Gets", "the", "Id", "of", "the", "Agent", "identified", "in", "this", "authentication", "credential", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/runtime/impls/authentication_process/objects.py#L28-L51
mitsei/dlkit
dlkit/runtime/impls/authentication_process/objects.py
DjangoAuthentication.get_agent
def get_agent(self): """Gets the ``Agent`` identified in this authentication credential. :return: the ``Agent`` :rtype: ``osid.authentication.Agent`` :raise: ``OperationFailed`` -- unable to complete request *compliance: mandatory -- This method must be implemented.* "...
python
def get_agent(self): """Gets the ``Agent`` identified in this authentication credential. :return: the ``Agent`` :rtype: ``osid.authentication.Agent`` :raise: ``OperationFailed`` -- unable to complete request *compliance: mandatory -- This method must be implemented.* "...
[ "def", "get_agent", "(", "self", ")", ":", "agent_id", "=", "self", ".", "get_agent_id", "(", ")", "return", "Agent", "(", "identifier", "=", "agent_id", ".", "identifier", ",", "namespace", "=", "agent_id", ".", "namespace", ",", "authority", "=", "agent_...
Gets the ``Agent`` identified in this authentication credential. :return: the ``Agent`` :rtype: ``osid.authentication.Agent`` :raise: ``OperationFailed`` -- unable to complete request *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "Agent", "identified", "in", "this", "authentication", "credential", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/runtime/impls/authentication_process/objects.py#L55-L68
pyroscope/auvyon
src/auvyon/imaging/spectrograms.py
spectrogram_image
def spectrogram_image(mediafile, dpi=72, outdir=None, outfile=None): # TODO: Add some of the constants below as parameters """ Create spectrogram image from audio data. Return path to created image file. """ import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt imp...
python
def spectrogram_image(mediafile, dpi=72, outdir=None, outfile=None): # TODO: Add some of the constants below as parameters """ Create spectrogram image from audio data. Return path to created image file. """ import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt imp...
[ "def", "spectrogram_image", "(", "mediafile", ",", "dpi", "=", "72", ",", "outdir", "=", "None", ",", "outfile", "=", "None", ")", ":", "# TODO: Add some of the constants below as parameters", "import", "matplotlib", "matplotlib", ".", "use", "(", "'Agg'", ")", ...
Create spectrogram image from audio data. Return path to created image file.
[ "Create", "spectrogram", "image", "from", "audio", "data", ".", "Return", "path", "to", "created", "image", "file", "." ]
train
https://github.com/pyroscope/auvyon/blob/5115c26f966df03df92a9934580b66c72e23d4e8/src/auvyon/imaging/spectrograms.py#L15-L78
pyroscope/auvyon
src/auvyon/imaging/spectrograms.py
_main
def _main(): """ Command line interface for testing. """ if len(sys.argv) != 2: print("Usage: python -m auvyon.imaging.spectrograms <mediafile>") else: try: print("Created %s" % spectrogram_image(sys.argv[1], dpi=103, outfile="spectrogram.jpg")) except subprocess.Call...
python
def _main(): """ Command line interface for testing. """ if len(sys.argv) != 2: print("Usage: python -m auvyon.imaging.spectrograms <mediafile>") else: try: print("Created %s" % spectrogram_image(sys.argv[1], dpi=103, outfile="spectrogram.jpg")) except subprocess.Call...
[ "def", "_main", "(", ")", ":", "if", "len", "(", "sys", ".", "argv", ")", "!=", "2", ":", "print", "(", "\"Usage: python -m auvyon.imaging.spectrograms <mediafile>\"", ")", "else", ":", "try", ":", "print", "(", "\"Created %s\"", "%", "spectrogram_image", "(",...
Command line interface for testing.
[ "Command", "line", "interface", "for", "testing", "." ]
train
https://github.com/pyroscope/auvyon/blob/5115c26f966df03df92a9934580b66c72e23d4e8/src/auvyon/imaging/spectrograms.py#L81-L90
mitsei/dlkit
dlkit/records/osid/object_records.py
EnclosureRecord.get_genus_type
def get_genus_type(self): """Overrides get_genus_type of extended object""" enclosed_object_id = self.get_enclosed_object_id() package = enclosed_object_id.get_identifier_namespace().split('.')[0] obj = enclosed_object_id.get_identifier_namespace().split('.')[1] return Type( ...
python
def get_genus_type(self): """Overrides get_genus_type of extended object""" enclosed_object_id = self.get_enclosed_object_id() package = enclosed_object_id.get_identifier_namespace().split('.')[0] obj = enclosed_object_id.get_identifier_namespace().split('.')[1] return Type( ...
[ "def", "get_genus_type", "(", "self", ")", ":", "enclosed_object_id", "=", "self", ".", "get_enclosed_object_id", "(", ")", "package", "=", "enclosed_object_id", ".", "get_identifier_namespace", "(", ")", ".", "split", "(", "'.'", ")", "[", "0", "]", "obj", ...
Overrides get_genus_type of extended object
[ "Overrides", "get_genus_type", "of", "extended", "object" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/object_records.py#L50-L62
mitsei/dlkit
dlkit/records/osid/object_records.py
EnclosureRecord.get_enclosed_object
def get_enclosed_object(self): """Return the enclosed object""" if self._enclosed_object is None: enclosed_object_id = self.get_enclosed_object_id() package_name = enclosed_object_id.get_identifier_namespace().split('.')[0] obj_name = enclosed_object_id.get_identifier...
python
def get_enclosed_object(self): """Return the enclosed object""" if self._enclosed_object is None: enclosed_object_id = self.get_enclosed_object_id() package_name = enclosed_object_id.get_identifier_namespace().split('.')[0] obj_name = enclosed_object_id.get_identifier...
[ "def", "get_enclosed_object", "(", "self", ")", ":", "if", "self", ".", "_enclosed_object", "is", "None", ":", "enclosed_object_id", "=", "self", ".", "get_enclosed_object_id", "(", ")", "package_name", "=", "enclosed_object_id", ".", "get_identifier_namespace", "("...
Return the enclosed object
[ "Return", "the", "enclosed", "object" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/object_records.py#L72-L86
mitsei/dlkit
dlkit/records/osid/object_records.py
EnclosureRecord.clone_to
def clone_to(self, target_catalog): """need to clone both the enclosed object + the wrapping asset""" def _clone(obj_id): package_name = obj_id.get_identifier_namespace().split('.')[0] obj_name = obj_id.get_identifier_namespace().split('.')[1].lower() catalogs = { ...
python
def clone_to(self, target_catalog): """need to clone both the enclosed object + the wrapping asset""" def _clone(obj_id): package_name = obj_id.get_identifier_namespace().split('.')[0] obj_name = obj_id.get_identifier_namespace().split('.')[1].lower() catalogs = { ...
[ "def", "clone_to", "(", "self", ",", "target_catalog", ")", ":", "def", "_clone", "(", "obj_id", ")", ":", "package_name", "=", "obj_id", ".", "get_identifier_namespace", "(", ")", ".", "split", "(", "'.'", ")", "[", "0", "]", "obj_name", "=", "obj_id", ...
need to clone both the enclosed object + the wrapping asset
[ "need", "to", "clone", "both", "the", "enclosed", "object", "+", "the", "wrapping", "asset" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/object_records.py#L90-L167
mitsei/dlkit
dlkit/records/osid/object_records.py
EnclosureFormRecord._init_metadata
def _init_metadata(self): """Initialize metadata for this record""" self._enclosed_object_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'enclosed_object'), 'element...
python
def _init_metadata(self): """Initialize metadata for this record""" self._enclosed_object_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'enclosed_object'), 'element...
[ "def", "_init_metadata", "(", "self", ")", ":", "self", ".", "_enclosed_object_metadata", "=", "{", "'element_id'", ":", "Id", "(", "self", ".", "my_osid_object_form", ".", "_authority", ",", "self", ".", "my_osid_object_form", ".", "_namespace", ",", "'enclosed...
Initialize metadata for this record
[ "Initialize", "metadata", "for", "this", "record" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/object_records.py#L192-L207
mitsei/dlkit
dlkit/records/osid/object_records.py
EnclosureFormRecord.get_display_name_metadata
def get_display_name_metadata(self): """Overrides get_display_name_metadata of extended object""" metadata = dict(self.my_osid_object_form._mdata['display_name']) metadata.update({'read_only': True}) return Metadata(**metadata)
python
def get_display_name_metadata(self): """Overrides get_display_name_metadata of extended object""" metadata = dict(self.my_osid_object_form._mdata['display_name']) metadata.update({'read_only': True}) return Metadata(**metadata)
[ "def", "get_display_name_metadata", "(", "self", ")", ":", "metadata", "=", "dict", "(", "self", ".", "my_osid_object_form", ".", "_mdata", "[", "'display_name'", "]", ")", "metadata", ".", "update", "(", "{", "'read_only'", ":", "True", "}", ")", "return", ...
Overrides get_display_name_metadata of extended object
[ "Overrides", "get_display_name_metadata", "of", "extended", "object" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/object_records.py#L232-L236
mitsei/dlkit
dlkit/records/osid/object_records.py
EnclosureFormRecord.get_description_metadata
def get_description_metadata(self): """Overrides get_description_metadata of extended object""" metadata = dict(self.my_osid_object_form._description_metadata) metadata.update({'read_only': True}) return Metadata(**metadata)
python
def get_description_metadata(self): """Overrides get_description_metadata of extended object""" metadata = dict(self.my_osid_object_form._description_metadata) metadata.update({'read_only': True}) return Metadata(**metadata)
[ "def", "get_description_metadata", "(", "self", ")", ":", "metadata", "=", "dict", "(", "self", ".", "my_osid_object_form", ".", "_description_metadata", ")", "metadata", ".", "update", "(", "{", "'read_only'", ":", "True", "}", ")", "return", "Metadata", "(",...
Overrides get_description_metadata of extended object
[ "Overrides", "get_description_metadata", "of", "extended", "object" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/object_records.py#L250-L254
mitsei/dlkit
dlkit/records/osid/object_records.py
EnclosureFormRecord.get_genus_type_metadata
def get_genus_type_metadata(self): """Overrides get_genus_type_metadata of extended object""" metadata = dict(self.my_osid_object_form._genus_type_metadata) metadata.update({'read_only': True}) return Metadata(**metadata)
python
def get_genus_type_metadata(self): """Overrides get_genus_type_metadata of extended object""" metadata = dict(self.my_osid_object_form._genus_type_metadata) metadata.update({'read_only': True}) return Metadata(**metadata)
[ "def", "get_genus_type_metadata", "(", "self", ")", ":", "metadata", "=", "dict", "(", "self", ".", "my_osid_object_form", ".", "_genus_type_metadata", ")", "metadata", ".", "update", "(", "{", "'read_only'", ":", "True", "}", ")", "return", "Metadata", "(", ...
Overrides get_genus_type_metadata of extended object
[ "Overrides", "get_genus_type_metadata", "of", "extended", "object" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/osid/object_records.py#L268-L272
mitsei/dlkit
dlkit/json_/osid/managers.py
OsidProfile._initialize_manager
def _initialize_manager(self, runtime): """Sets the runtime, configuration and json client""" if self._runtime is not None: raise errors.IllegalState('this manager has already been initialized.') self._runtime = runtime self._config = runtime.get_configuration() set_j...
python
def _initialize_manager(self, runtime): """Sets the runtime, configuration and json client""" if self._runtime is not None: raise errors.IllegalState('this manager has already been initialized.') self._runtime = runtime self._config = runtime.get_configuration() set_j...
[ "def", "_initialize_manager", "(", "self", ",", "runtime", ")", ":", "if", "self", ".", "_runtime", "is", "not", "None", ":", "raise", "errors", ".", "IllegalState", "(", "'this manager has already been initialized.'", ")", "self", ".", "_runtime", "=", "runtime...
Sets the runtime, configuration and json client
[ "Sets", "the", "runtime", "configuration", "and", "json", "client" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/managers.py#L42-L48
mitsei/dlkit
dlkit/json_/osid/managers.py
OsidProfile.get_display_name
def get_display_name(self): """Gets a display name for this service implementation. return: (osid.locale.DisplayText) - a display name *compliance: mandatory -- This method must be implemented.* """ return DisplayText( text=profile.DISPLAYNAME, language_...
python
def get_display_name(self): """Gets a display name for this service implementation. return: (osid.locale.DisplayText) - a display name *compliance: mandatory -- This method must be implemented.* """ return DisplayText( text=profile.DISPLAYNAME, language_...
[ "def", "get_display_name", "(", "self", ")", ":", "return", "DisplayText", "(", "text", "=", "profile", ".", "DISPLAYNAME", ",", "language_type", "=", "Type", "(", "*", "*", "profile", ".", "LANGUAGETYPE", ")", ",", "script_type", "=", "Type", "(", "*", ...
Gets a display name for this service implementation. return: (osid.locale.DisplayText) - a display name *compliance: mandatory -- This method must be implemented.*
[ "Gets", "a", "display", "name", "for", "this", "service", "implementation", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/managers.py#L68-L79
mitsei/dlkit
dlkit/json_/osid/managers.py
OsidProfile.get_description
def get_description(self): """Gets a description of this service implementation. return: (osid.locale.DisplayText) - a description *compliance: mandatory -- This method must be implemented.* """ return DisplayText( text=profile.DESCRIPTION, language_type...
python
def get_description(self): """Gets a description of this service implementation. return: (osid.locale.DisplayText) - a description *compliance: mandatory -- This method must be implemented.* """ return DisplayText( text=profile.DESCRIPTION, language_type...
[ "def", "get_description", "(", "self", ")", ":", "return", "DisplayText", "(", "text", "=", "profile", ".", "DESCRIPTION", ",", "language_type", "=", "Type", "(", "*", "*", "profile", ".", "LANGUAGETYPE", ")", ",", "script_type", "=", "Type", "(", "*", "...
Gets a description of this service implementation. return: (osid.locale.DisplayText) - a description *compliance: mandatory -- This method must be implemented.*
[ "Gets", "a", "description", "of", "this", "service", "implementation", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/managers.py#L83-L94
Vagrants/blackbird
blackbird/utils/argumentparse.py
get_args
def get_args(): u""" ./main --config /etc/blackbird/etc/default.cfg --debug ... Return command-line options(arguments). """ description = "The Daemon send various value for zabbix_sender." parser = argparse.ArgumentParser(description) parser.add_argument('--config', '-c', ...
python
def get_args(): u""" ./main --config /etc/blackbird/etc/default.cfg --debug ... Return command-line options(arguments). """ description = "The Daemon send various value for zabbix_sender." parser = argparse.ArgumentParser(description) parser.add_argument('--config', '-c', ...
[ "def", "get_args", "(", ")", ":", "description", "=", "\"The Daemon send various value for zabbix_sender.\"", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", ")", "parser", ".", "add_argument", "(", "'--config'", ",", "'-c'", ",", "default", "=...
u""" ./main --config /etc/blackbird/etc/default.cfg --debug ... Return command-line options(arguments).
[ "u", ".", "/", "main", "--", "config", "/", "etc", "/", "blackbird", "/", "etc", "/", "default", ".", "cfg", "--", "debug", "...", "Return", "command", "-", "line", "options", "(", "arguments", ")", "." ]
train
https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/argumentparse.py#L10-L56
Vagrants/blackbird
blackbird/utils/argumentparse.py
is_pid
def is_pid(value): """ This function checks whether file path that is specified at "pid_file" option eixsts, whether write permission to the file path. Return the following value: case1: exists path and write permission is_pid('/tmp') '/tmp/hogehoge.pid' case2: non-exis...
python
def is_pid(value): """ This function checks whether file path that is specified at "pid_file" option eixsts, whether write permission to the file path. Return the following value: case1: exists path and write permission is_pid('/tmp') '/tmp/hogehoge.pid' case2: non-exis...
[ "def", "is_pid", "(", "value", ")", ":", "value", "=", "os", ".", "path", ".", "expanduser", "(", "value", ")", "value", "=", "os", ".", "path", ".", "expandvars", "(", "value", ")", "value", "=", "os", ".", "path", ".", "abspath", "(", "value", ...
This function checks whether file path that is specified at "pid_file" option eixsts, whether write permission to the file path. Return the following value: case1: exists path and write permission is_pid('/tmp') '/tmp/hogehoge.pid' case2: non-exists path and write permission ...
[ "This", "function", "checks", "whether", "file", "path", "that", "is", "specified", "at", "pid_file", "option", "eixsts", "whether", "write", "permission", "to", "the", "file", "path", "." ]
train
https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/argumentparse.py#L59-L140
planetlabs/es_fluent
es_fluent/fields/__init__.py
Fields.add_field
def add_field(self, field_instance_or_string): """ Appends a field, can be a :class:`~es_fluent.fields.Field` or string. """ if isinstance(field_instance_or_string, basestring): field_instance = Field(field_instance_or_string) elif isinstance(field_instance_or_string,...
python
def add_field(self, field_instance_or_string): """ Appends a field, can be a :class:`~es_fluent.fields.Field` or string. """ if isinstance(field_instance_or_string, basestring): field_instance = Field(field_instance_or_string) elif isinstance(field_instance_or_string,...
[ "def", "add_field", "(", "self", ",", "field_instance_or_string", ")", ":", "if", "isinstance", "(", "field_instance_or_string", ",", "basestring", ")", ":", "field_instance", "=", "Field", "(", "field_instance_or_string", ")", "elif", "isinstance", "(", "field_inst...
Appends a field, can be a :class:`~es_fluent.fields.Field` or string.
[ "Appends", "a", "field", "can", "be", "a", ":", "class", ":", "~es_fluent", ".", "fields", ".", "Field", "or", "string", "." ]
train
https://github.com/planetlabs/es_fluent/blob/74f8db3a1bf9aa1d54512cf2d5e0ec58ee2f4b1c/es_fluent/fields/__init__.py#L14-L27
alevinval/scheduling
scheduling/scheduler.py
Scheduler.run
def run(self): """ Run the schedule """ self.main_task.thread.start() self.main_task.thread.join()
python
def run(self): """ Run the schedule """ self.main_task.thread.start() self.main_task.thread.join()
[ "def", "run", "(", "self", ")", ":", "self", ".", "main_task", ".", "thread", ".", "start", "(", ")", "self", ".", "main_task", ".", "thread", ".", "join", "(", ")" ]
Run the schedule
[ "Run", "the", "schedule" ]
train
https://github.com/alevinval/scheduling/blob/127239712c0b73b929ca19b4b5c2855eebb7fcf0/scheduling/scheduler.py#L41-L46
alevinval/scheduling
scheduling/graph.py
dfs
def dfs(node, expand=expansion_all, callback=None, silent=True): """ Perform a depth-first search on the node graph :param node: GraphNode :param expand: Returns the list of Nodes to explore from a Node :param callback: Callback to run in each node :param silent: Don't throw exception on circular de...
python
def dfs(node, expand=expansion_all, callback=None, silent=True): """ Perform a depth-first search on the node graph :param node: GraphNode :param expand: Returns the list of Nodes to explore from a Node :param callback: Callback to run in each node :param silent: Don't throw exception on circular de...
[ "def", "dfs", "(", "node", ",", "expand", "=", "expansion_all", ",", "callback", "=", "None", ",", "silent", "=", "True", ")", ":", "nodes", "=", "deque", "(", ")", "for", "n", "in", "expand", "(", "node", ")", ":", "nodes", ".", "append", "(", "...
Perform a depth-first search on the node graph :param node: GraphNode :param expand: Returns the list of Nodes to explore from a Node :param callback: Callback to run in each node :param silent: Don't throw exception on circular dependency :return:
[ "Perform", "a", "depth", "-", "first", "search", "on", "the", "node", "graph", ":", "param", "node", ":", "GraphNode", ":", "param", "expand", ":", "Returns", "the", "list", "of", "Nodes", "to", "explore", "from", "a", "Node", ":", "param", "callback", ...
train
https://github.com/alevinval/scheduling/blob/127239712c0b73b929ca19b4b5c2855eebb7fcf0/scheduling/graph.py#L88-L110
alevinval/scheduling
scheduling/graph.py
explore
def explore(node): """ Given a node, explores on relatives, siblings and children :param node: GraphNode from which to explore :return: set of explored GraphNodes """ explored = set() explored.add(node) dfs(node, callback=lambda n: explored.add(n)) return explored
python
def explore(node): """ Given a node, explores on relatives, siblings and children :param node: GraphNode from which to explore :return: set of explored GraphNodes """ explored = set() explored.add(node) dfs(node, callback=lambda n: explored.add(n)) return explored
[ "def", "explore", "(", "node", ")", ":", "explored", "=", "set", "(", ")", "explored", ".", "add", "(", "node", ")", "dfs", "(", "node", ",", "callback", "=", "lambda", "n", ":", "explored", ".", "add", "(", "n", ")", ")", "return", "explored" ]
Given a node, explores on relatives, siblings and children :param node: GraphNode from which to explore :return: set of explored GraphNodes
[ "Given", "a", "node", "explores", "on", "relatives", "siblings", "and", "children", ":", "param", "node", ":", "GraphNode", "from", "which", "to", "explore", ":", "return", ":", "set", "of", "explored", "GraphNodes" ]
train
https://github.com/alevinval/scheduling/blob/127239712c0b73b929ca19b4b5c2855eebb7fcf0/scheduling/graph.py#L113-L121
alevinval/scheduling
scheduling/graph.py
DependencyGraphNode.depends
def depends(self, *nodes): """ Adds nodes as relatives to this one, and updates the relatives with self as children. :param nodes: GraphNode(s) """ for node in nodes: self.add_relative(node) node.add_children(self)
python
def depends(self, *nodes): """ Adds nodes as relatives to this one, and updates the relatives with self as children. :param nodes: GraphNode(s) """ for node in nodes: self.add_relative(node) node.add_children(self)
[ "def", "depends", "(", "self", ",", "*", "nodes", ")", ":", "for", "node", "in", "nodes", ":", "self", ".", "add_relative", "(", "node", ")", "node", ".", "add_children", "(", "self", ")" ]
Adds nodes as relatives to this one, and updates the relatives with self as children. :param nodes: GraphNode(s)
[ "Adds", "nodes", "as", "relatives", "to", "this", "one", "and", "updates", "the", "relatives", "with", "self", "as", "children", ".", ":", "param", "nodes", ":", "GraphNode", "(", "s", ")" ]
train
https://github.com/alevinval/scheduling/blob/127239712c0b73b929ca19b4b5c2855eebb7fcf0/scheduling/graph.py#L60-L67
alevinval/scheduling
scheduling/graph.py
DependencyGraphNode.add
def add(self, *nodes): """ Adds nodes as siblings :param nodes: GraphNode(s) """ for node in nodes: node.set_parent(self) self.add_sibling(node)
python
def add(self, *nodes): """ Adds nodes as siblings :param nodes: GraphNode(s) """ for node in nodes: node.set_parent(self) self.add_sibling(node)
[ "def", "add", "(", "self", ",", "*", "nodes", ")", ":", "for", "node", "in", "nodes", ":", "node", ".", "set_parent", "(", "self", ")", "self", ".", "add_sibling", "(", "node", ")" ]
Adds nodes as siblings :param nodes: GraphNode(s)
[ "Adds", "nodes", "as", "siblings", ":", "param", "nodes", ":", "GraphNode", "(", "s", ")" ]
train
https://github.com/alevinval/scheduling/blob/127239712c0b73b929ca19b4b5c2855eebb7fcf0/scheduling/graph.py#L76-L82
mitsei/dlkit
dlkit/json_/hierarchy/searches.py
HierarchySearchResults.get_hierarchies
def get_hierarchies(self): """Gets the hierarchy list resulting from the search. return: (osid.hierarchy.HierarchyList) - the hierarchy list raise: IllegalState - the hierarchy list was already retrieved *compliance: mandatory -- This method must be implemented.* """ i...
python
def get_hierarchies(self): """Gets the hierarchy list resulting from the search. return: (osid.hierarchy.HierarchyList) - the hierarchy list raise: IllegalState - the hierarchy list was already retrieved *compliance: mandatory -- This method must be implemented.* """ i...
[ "def", "get_hierarchies", "(", "self", ")", ":", "if", "self", ".", "retrieved", ":", "raise", "errors", ".", "IllegalState", "(", "'List has already been retrieved.'", ")", "self", ".", "retrieved", "=", "True", "return", "objects", ".", "HierarchyList", "(", ...
Gets the hierarchy list resulting from the search. return: (osid.hierarchy.HierarchyList) - the hierarchy list raise: IllegalState - the hierarchy list was already retrieved *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "hierarchy", "list", "resulting", "from", "the", "search", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/hierarchy/searches.py#L96-L107
jason-weirather/py-seq-tools
seqtools/sequence/twobit.py
Sequence2Bit._set_seq
def _set_seq(self,sequence,start=0): """Set the sequence from a start position for the length of the sequence""" if start+len(sequence) > self._slen: sys.stderr.write("Error not long enough to add\n") sys.exit() z = 0 for i in xrange(start, start+len(sequence)): self._set_nt(sequence[...
python
def _set_seq(self,sequence,start=0): """Set the sequence from a start position for the length of the sequence""" if start+len(sequence) > self._slen: sys.stderr.write("Error not long enough to add\n") sys.exit() z = 0 for i in xrange(start, start+len(sequence)): self._set_nt(sequence[...
[ "def", "_set_seq", "(", "self", ",", "sequence", ",", "start", "=", "0", ")", ":", "if", "start", "+", "len", "(", "sequence", ")", ">", "self", ".", "_slen", ":", "sys", ".", "stderr", ".", "write", "(", "\"Error not long enough to add\\n\"", ")", "sy...
Set the sequence from a start position for the length of the sequence
[ "Set", "the", "sequence", "from", "a", "start", "position", "for", "the", "length", "of", "the", "sequence" ]
train
https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/sequence/twobit.py#L24-L32
mitsei/dlkit
dlkit/json_/authentication/sessions.py
AgentLookupSession.get_agent
def get_agent(self, agent_id): """Gets the ``Agent`` specified by its ``Id``. In plenary mode, the exact ``Id`` is found or a ``NotFound`` results. Otherwise, the returned ``Agent`` may have a different ``Id`` than requested, such as the case where a duplicate ``Id`` was assigne...
python
def get_agent(self, agent_id): """Gets the ``Agent`` specified by its ``Id``. In plenary mode, the exact ``Id`` is found or a ``NotFound`` results. Otherwise, the returned ``Agent`` may have a different ``Id`` than requested, such as the case where a duplicate ``Id`` was assigne...
[ "def", "get_agent", "(", "self", ",", "agent_id", ")", ":", "# Implemented from template for", "# osid.resource.ResourceLookupSession.get_resource", "# NOTE: This implementation currently ignores plenary view", "collection", "=", "JSONClientValidated", "(", "'authentication'", ",", ...
Gets the ``Agent`` specified by its ``Id``. In plenary mode, the exact ``Id`` is found or a ``NotFound`` results. Otherwise, the returned ``Agent`` may have a different ``Id`` than requested, such as the case where a duplicate ``Id`` was assigned to an ``Agent`` and retained for compati...
[ "Gets", "the", "Agent", "specified", "by", "its", "Id", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/authentication/sessions.py#L183-L209
mitsei/dlkit
dlkit/json_/authentication/sessions.py
AgentLookupSession.get_agents_by_ids
def get_agents_by_ids(self, agent_ids): """Gets an ``AgentList`` corresponding to the given ``IdList``. In plenary mode, the returned list contains all of the agents specified in the ``Id`` list, in the order of the list, including duplicates, or an error results if an ``Id`` in the ...
python
def get_agents_by_ids(self, agent_ids): """Gets an ``AgentList`` corresponding to the given ``IdList``. In plenary mode, the returned list contains all of the agents specified in the ``Id`` list, in the order of the list, including duplicates, or an error results if an ``Id`` in the ...
[ "def", "get_agents_by_ids", "(", "self", ",", "agent_ids", ")", ":", "# Implemented from template for", "# osid.resource.ResourceLookupSession.get_resources_by_ids", "# NOTE: This implementation currently ignores plenary view", "collection", "=", "JSONClientValidated", "(", "'authentic...
Gets an ``AgentList`` corresponding to the given ``IdList``. In plenary mode, the returned list contains all of the agents specified in the ``Id`` list, in the order of the list, including duplicates, or an error results if an ``Id`` in the supplied list is not found or inaccessible. Ot...
[ "Gets", "an", "AgentList", "corresponding", "to", "the", "given", "IdList", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/authentication/sessions.py#L212-L252
mitsei/dlkit
dlkit/json_/authentication/sessions.py
AgentLookupSession.get_agents_by_genus_type
def get_agents_by_genus_type(self, agent_genus_type): """Gets an ``AgentList`` corresponding to the given agent genus ``Type`` which does not include agents of genus types derived from the specified ``Type``. In plenary mode, the returned list contains all known agents or an error results. Othe...
python
def get_agents_by_genus_type(self, agent_genus_type): """Gets an ``AgentList`` corresponding to the given agent genus ``Type`` which does not include agents of genus types derived from the specified ``Type``. In plenary mode, the returned list contains all known agents or an error results. Othe...
[ "def", "get_agents_by_genus_type", "(", "self", ",", "agent_genus_type", ")", ":", "# Implemented from template for", "# osid.resource.ResourceLookupSession.get_resources_by_genus_type", "# NOTE: This implementation currently ignores plenary view", "collection", "=", "JSONClientValidated",...
Gets an ``AgentList`` corresponding to the given agent genus ``Type`` which does not include agents of genus types derived from the specified ``Type``. In plenary mode, the returned list contains all known agents or an error results. Otherwise, the returned list may contain only those agents th...
[ "Gets", "an", "AgentList", "corresponding", "to", "the", "given", "agent", "genus", "Type", "which", "does", "not", "include", "agents", "of", "genus", "types", "derived", "from", "the", "specified", "Type", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/authentication/sessions.py#L255-L280
mitsei/dlkit
dlkit/json_/authentication/sessions.py
AgentLookupSession.get_agents
def get_agents(self): """Gets all ``Agents``. In plenary mode, the returned list contains all known agents or an error results. Otherwise, the returned list may contain only those agents that are accessible through this session. return: (osid.authentication.AgentList) - a list ...
python
def get_agents(self): """Gets all ``Agents``. In plenary mode, the returned list contains all known agents or an error results. Otherwise, the returned list may contain only those agents that are accessible through this session. return: (osid.authentication.AgentList) - a list ...
[ "def", "get_agents", "(", "self", ")", ":", "# Implemented from template for", "# osid.resource.ResourceLookupSession.get_resources", "# NOTE: This implementation currently ignores plenary view", "collection", "=", "JSONClientValidated", "(", "'authentication'", ",", "collection", "=...
Gets all ``Agents``. In plenary mode, the returned list contains all known agents or an error results. Otherwise, the returned list may contain only those agents that are accessible through this session. return: (osid.authentication.AgentList) - a list of ``Agents`` raise: Ope...
[ "Gets", "all", "Agents", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/authentication/sessions.py#L326-L346
bachiraoun/pysimplelog
SimpleLog.py
Logger.__stream_format_allowed
def __stream_format_allowed(self, stream): """ Check whether a stream allows formatting such as coloring. Inspired from Python cookbook, #475186 """ # curses isn't available on all platforms try: import curses as CURSES except: return False...
python
def __stream_format_allowed(self, stream): """ Check whether a stream allows formatting such as coloring. Inspired from Python cookbook, #475186 """ # curses isn't available on all platforms try: import curses as CURSES except: return False...
[ "def", "__stream_format_allowed", "(", "self", ",", "stream", ")", ":", "# curses isn't available on all platforms", "try", ":", "import", "curses", "as", "CURSES", "except", ":", "return", "False", "try", ":", "CURSES", ".", "setupterm", "(", ")", "return", "CU...
Check whether a stream allows formatting such as coloring. Inspired from Python cookbook, #475186
[ "Check", "whether", "a", "stream", "allows", "formatting", "such", "as", "coloring", ".", "Inspired", "from", "Python", "cookbook", "#475186" ]
train
https://github.com/bachiraoun/pysimplelog/blob/2681ed5b1b8d7e66c3fff3ec3cca2b14ac571238/SimpleLog.py#L342-L356
bachiraoun/pysimplelog
SimpleLog.py
Logger.lastLogged
def lastLogged(self): """Get a dictionary of last logged messages. Keys are log types and values are the the last messages.""" d = copy.deepcopy(self.__lastLogged) d.pop(-1, None) return d
python
def lastLogged(self): """Get a dictionary of last logged messages. Keys are log types and values are the the last messages.""" d = copy.deepcopy(self.__lastLogged) d.pop(-1, None) return d
[ "def", "lastLogged", "(", "self", ")", ":", "d", "=", "copy", ".", "deepcopy", "(", "self", ".", "__lastLogged", ")", "d", ".", "pop", "(", "-", "1", ",", "None", ")", "return", "d" ]
Get a dictionary of last logged messages. Keys are log types and values are the the last messages.
[ "Get", "a", "dictionary", "of", "last", "logged", "messages", ".", "Keys", "are", "log", "types", "and", "values", "are", "the", "the", "last", "messages", "." ]
train
https://github.com/bachiraoun/pysimplelog/blob/2681ed5b1b8d7e66c3fff3ec3cca2b14ac571238/SimpleLog.py#L397-L402
bachiraoun/pysimplelog
SimpleLog.py
Logger.set_stdout
def set_stdout(self, stream=None): """ Set the logger standard output stream. :Parameters: #. stdout (None, stream): The standard output stream. If None, system standard output will be set automatically. Otherwise any stream with read and write methods can...
python
def set_stdout(self, stream=None): """ Set the logger standard output stream. :Parameters: #. stdout (None, stream): The standard output stream. If None, system standard output will be set automatically. Otherwise any stream with read and write methods can...
[ "def", "set_stdout", "(", "self", ",", "stream", "=", "None", ")", ":", "if", "stream", "is", "None", ":", "self", ".", "__stdout", "=", "sys", ".", "stdout", "else", ":", "assert", "hasattr", "(", "stream", ",", "'read'", ")", "and", "hasattr", "(",...
Set the logger standard output stream. :Parameters: #. stdout (None, stream): The standard output stream. If None, system standard output will be set automatically. Otherwise any stream with read and write methods can be passed
[ "Set", "the", "logger", "standard", "output", "stream", "." ]
train
https://github.com/bachiraoun/pysimplelog/blob/2681ed5b1b8d7e66c3fff3ec3cca2b14ac571238/SimpleLog.py#L573-L588
bachiraoun/pysimplelog
SimpleLog.py
Logger.set_log_type_flags
def set_log_type_flags(self, logType, stdoutFlag, fileFlag): """ Set a defined log type flags. :Parameters: #. logType (string): A defined logging type. #. stdoutFlag (boolean): Whether to log to the standard output stream. #. fileFlag (boolean): Whether to log ...
python
def set_log_type_flags(self, logType, stdoutFlag, fileFlag): """ Set a defined log type flags. :Parameters: #. logType (string): A defined logging type. #. stdoutFlag (boolean): Whether to log to the standard output stream. #. fileFlag (boolean): Whether to log ...
[ "def", "set_log_type_flags", "(", "self", ",", "logType", ",", "stdoutFlag", ",", "fileFlag", ")", ":", "assert", "logType", "in", "self", ".", "__logTypeStdoutFlags", ".", "keys", "(", ")", ",", "\"logType '%s' not defined\"", "%", "logType", "assert", "isinsta...
Set a defined log type flags. :Parameters: #. logType (string): A defined logging type. #. stdoutFlag (boolean): Whether to log to the standard output stream. #. fileFlag (boolean): Whether to log to to file.
[ "Set", "a", "defined", "log", "type", "flags", "." ]
train
https://github.com/bachiraoun/pysimplelog/blob/2681ed5b1b8d7e66c3fff3ec3cca2b14ac571238/SimpleLog.py#L610-L623
bachiraoun/pysimplelog
SimpleLog.py
Logger.set_log_file
def set_log_file(self, logfile): """ Set the log file full path including directory path basename and extension. :Parameters: #. logFile (string): the full log file path including basename and extension. If this is given, all of logFileBasename and logFileExtension ...
python
def set_log_file(self, logfile): """ Set the log file full path including directory path basename and extension. :Parameters: #. logFile (string): the full log file path including basename and extension. If this is given, all of logFileBasename and logFileExtension ...
[ "def", "set_log_file", "(", "self", ",", "logfile", ")", ":", "assert", "isinstance", "(", "logfile", ",", "basestring", ")", ",", "\"logfile must be a string\"", "basename", ",", "extension", "=", "os", ".", "path", ".", "splitext", "(", "logfile", ")", "se...
Set the log file full path including directory path basename and extension. :Parameters: #. logFile (string): the full log file path including basename and extension. If this is given, all of logFileBasename and logFileExtension will be discarded. logfile is equivalent to...
[ "Set", "the", "log", "file", "full", "path", "including", "directory", "path", "basename", "and", "extension", "." ]
train
https://github.com/bachiraoun/pysimplelog/blob/2681ed5b1b8d7e66c3fff3ec3cca2b14ac571238/SimpleLog.py#L625-L637
bachiraoun/pysimplelog
SimpleLog.py
Logger.set_log_file_extension
def set_log_file_extension(self, logFileExtension): """ Set the log file extension. :Parameters: #. logFileExtension (string): Logging file extension. A logging file full name is set as logFileBasename.logFileExtension """ assert isinstance(logFileExtens...
python
def set_log_file_extension(self, logFileExtension): """ Set the log file extension. :Parameters: #. logFileExtension (string): Logging file extension. A logging file full name is set as logFileBasename.logFileExtension """ assert isinstance(logFileExtens...
[ "def", "set_log_file_extension", "(", "self", ",", "logFileExtension", ")", ":", "assert", "isinstance", "(", "logFileExtension", ",", "basestring", ")", ",", "\"logFileExtension must be a basestring\"", "assert", "len", "(", "logFileExtension", ")", ",", "\"logFileExte...
Set the log file extension. :Parameters: #. logFileExtension (string): Logging file extension. A logging file full name is set as logFileBasename.logFileExtension
[ "Set", "the", "log", "file", "extension", "." ]
train
https://github.com/bachiraoun/pysimplelog/blob/2681ed5b1b8d7e66c3fff3ec3cca2b14ac571238/SimpleLog.py#L639-L657
bachiraoun/pysimplelog
SimpleLog.py
Logger.__set_log_file_name
def __set_log_file_name(self): """Automatically set logFileName attribute""" # ensure directory exists dir, _ = os.path.split(self.__logFileBasename) if len(dir) and not os.path.exists(dir): os.makedirs(dir) # create logFileName self.__logFileName = self.__log...
python
def __set_log_file_name(self): """Automatically set logFileName attribute""" # ensure directory exists dir, _ = os.path.split(self.__logFileBasename) if len(dir) and not os.path.exists(dir): os.makedirs(dir) # create logFileName self.__logFileName = self.__log...
[ "def", "__set_log_file_name", "(", "self", ")", ":", "# ensure directory exists", "dir", ",", "_", "=", "os", ".", "path", ".", "split", "(", "self", ".", "__logFileBasename", ")", "if", "len", "(", "dir", ")", "and", "not", "os", ".", "path", ".", "ex...
Automatically set logFileName attribute
[ "Automatically", "set", "logFileName", "attribute" ]
train
https://github.com/bachiraoun/pysimplelog/blob/2681ed5b1b8d7e66c3fff3ec3cca2b14ac571238/SimpleLog.py#L675-L690
bachiraoun/pysimplelog
SimpleLog.py
Logger.set_log_file_maximum_size
def set_log_file_maximum_size(self, logFileMaxSize): """ Set the log file maximum size in megabytes :Parameters: #. logFileMaxSize (number): The maximum size in Megabytes of a logging file. Once exceeded, another logging file as logFileBasename_N.logFileExtension ...
python
def set_log_file_maximum_size(self, logFileMaxSize): """ Set the log file maximum size in megabytes :Parameters: #. logFileMaxSize (number): The maximum size in Megabytes of a logging file. Once exceeded, another logging file as logFileBasename_N.logFileExtension ...
[ "def", "set_log_file_maximum_size", "(", "self", ",", "logFileMaxSize", ")", ":", "assert", "_is_number", "(", "logFileMaxSize", ")", ",", "\"logFileMaxSize must be a number\"", "logFileMaxSize", "=", "float", "(", "logFileMaxSize", ")", "assert", "logFileMaxSize", ">="...
Set the log file maximum size in megabytes :Parameters: #. logFileMaxSize (number): The maximum size in Megabytes of a logging file. Once exceeded, another logging file as logFileBasename_N.logFileExtension will be created. Where N is an automatically incremented number.
[ "Set", "the", "log", "file", "maximum", "size", "in", "megabytes" ]
train
https://github.com/bachiraoun/pysimplelog/blob/2681ed5b1b8d7e66c3fff3ec3cca2b14ac571238/SimpleLog.py#L692-L704
bachiraoun/pysimplelog
SimpleLog.py
Logger.set_minimum_level
def set_minimum_level(self, level=0, stdoutFlag=True, fileFlag=True): """ Set the minimum logging level. All levels below the minimum will be ignored at logging. :Parameters: #. level (None, number, str): The minimum level of logging. If None, minimum level checking is ...
python
def set_minimum_level(self, level=0, stdoutFlag=True, fileFlag=True): """ Set the minimum logging level. All levels below the minimum will be ignored at logging. :Parameters: #. level (None, number, str): The minimum level of logging. If None, minimum level checking is ...
[ "def", "set_minimum_level", "(", "self", ",", "level", "=", "0", ",", "stdoutFlag", "=", "True", ",", "fileFlag", "=", "True", ")", ":", "# check flags", "assert", "isinstance", "(", "stdoutFlag", ",", "bool", ")", ",", "\"stdoutFlag must be boolean\"", "asser...
Set the minimum logging level. All levels below the minimum will be ignored at logging. :Parameters: #. level (None, number, str): The minimum level of logging. If None, minimum level checking is left out. If str, it must be a defined logtype and therefore the minimum lev...
[ "Set", "the", "minimum", "logging", "level", ".", "All", "levels", "below", "the", "minimum", "will", "be", "ignored", "at", "logging", "." ]
train
https://github.com/bachiraoun/pysimplelog/blob/2681ed5b1b8d7e66c3fff3ec3cca2b14ac571238/SimpleLog.py#L706-L742
bachiraoun/pysimplelog
SimpleLog.py
Logger.force_log_type_stdout_flag
def force_log_type_stdout_flag(self, logType, flag): """ Force a logtype standard output logging flag despite minimum and maximum logging level boundaries. :Parameters: #. logType (string): A defined logging type. #. flag (None boolean): The standard output logging flag. ...
python
def force_log_type_stdout_flag(self, logType, flag): """ Force a logtype standard output logging flag despite minimum and maximum logging level boundaries. :Parameters: #. logType (string): A defined logging type. #. flag (None boolean): The standard output logging flag. ...
[ "def", "force_log_type_stdout_flag", "(", "self", ",", "logType", ",", "flag", ")", ":", "assert", "logType", "in", "self", ".", "__logTypeStdoutFlags", ".", "keys", "(", ")", ",", "\"logType '%s' not defined\"", "%", "logType", "if", "flag", "is", "None", ":"...
Force a logtype standard output logging flag despite minimum and maximum logging level boundaries. :Parameters: #. logType (string): A defined logging type. #. flag (None boolean): The standard output logging flag. If None, logtype existing forced flag is released.
[ "Force", "a", "logtype", "standard", "output", "logging", "flag", "despite", "minimum", "and", "maximum", "logging", "level", "boundaries", "." ]
train
https://github.com/bachiraoun/pysimplelog/blob/2681ed5b1b8d7e66c3fff3ec3cca2b14ac571238/SimpleLog.py#L822-L838
bachiraoun/pysimplelog
SimpleLog.py
Logger.force_log_type_file_flag
def force_log_type_file_flag(self, logType, flag): """ Force a logtype file logging flag despite minimum and maximum logging level boundaries. :Parameters: #. logType (string): A defined logging type. #. flag (None, boolean): The file logging flag. If None, l...
python
def force_log_type_file_flag(self, logType, flag): """ Force a logtype file logging flag despite minimum and maximum logging level boundaries. :Parameters: #. logType (string): A defined logging type. #. flag (None, boolean): The file logging flag. If None, l...
[ "def", "force_log_type_file_flag", "(", "self", ",", "logType", ",", "flag", ")", ":", "assert", "logType", "in", "self", ".", "__logTypeStdoutFlags", ".", "keys", "(", ")", ",", "\"logType '%s' not defined\"", "%", "logType", "if", "flag", "is", "None", ":", ...
Force a logtype file logging flag despite minimum and maximum logging level boundaries. :Parameters: #. logType (string): A defined logging type. #. flag (None, boolean): The file logging flag. If None, logtype existing forced flag is released.
[ "Force", "a", "logtype", "file", "logging", "flag", "despite", "minimum", "and", "maximum", "logging", "level", "boundaries", "." ]
train
https://github.com/bachiraoun/pysimplelog/blob/2681ed5b1b8d7e66c3fff3ec3cca2b14ac571238/SimpleLog.py#L840-L856
bachiraoun/pysimplelog
SimpleLog.py
Logger.force_log_type_flags
def force_log_type_flags(self, logType, stdoutFlag, fileFlag): """ Force a logtype logging flags. :Parameters: #. logType (string): A defined logging type. #. stdoutFlag (None, boolean): The standard output logging flag. If None, logtype stdoutFlag forcing is...
python
def force_log_type_flags(self, logType, stdoutFlag, fileFlag): """ Force a logtype logging flags. :Parameters: #. logType (string): A defined logging type. #. stdoutFlag (None, boolean): The standard output logging flag. If None, logtype stdoutFlag forcing is...
[ "def", "force_log_type_flags", "(", "self", ",", "logType", ",", "stdoutFlag", ",", "fileFlag", ")", ":", "self", ".", "force_log_type_stdout_flag", "(", "logType", ",", "stdoutFlag", ")", "self", ".", "force_log_type_file_flag", "(", "logType", ",", "fileFlag", ...
Force a logtype logging flags. :Parameters: #. logType (string): A defined logging type. #. stdoutFlag (None, boolean): The standard output logging flag. If None, logtype stdoutFlag forcing is released. #. fileFlag (None, boolean): The file logging flag. ...
[ "Force", "a", "logtype", "logging", "flags", "." ]
train
https://github.com/bachiraoun/pysimplelog/blob/2681ed5b1b8d7e66c3fff3ec3cca2b14ac571238/SimpleLog.py#L858-L870
bachiraoun/pysimplelog
SimpleLog.py
Logger.set_log_type_name
def set_log_type_name(self, logType, name): """ Set a logtype name. :Parameters: #. logType (string): A defined logging type. #. name (string): The logtype new name. """ assert logType in self.__logTypeStdoutFlags.keys(), "logType '%s' not defined" %logType...
python
def set_log_type_name(self, logType, name): """ Set a logtype name. :Parameters: #. logType (string): A defined logging type. #. name (string): The logtype new name. """ assert logType in self.__logTypeStdoutFlags.keys(), "logType '%s' not defined" %logType...
[ "def", "set_log_type_name", "(", "self", ",", "logType", ",", "name", ")", ":", "assert", "logType", "in", "self", ".", "__logTypeStdoutFlags", ".", "keys", "(", ")", ",", "\"logType '%s' not defined\"", "%", "logType", "assert", "isinstance", "(", "name", ","...
Set a logtype name. :Parameters: #. logType (string): A defined logging type. #. name (string): The logtype new name.
[ "Set", "a", "logtype", "name", "." ]
train
https://github.com/bachiraoun/pysimplelog/blob/2681ed5b1b8d7e66c3fff3ec3cca2b14ac571238/SimpleLog.py#L872-L883
bachiraoun/pysimplelog
SimpleLog.py
Logger.set_log_type_level
def set_log_type_level(self, logType, level): """ Set a logtype logging level. :Parameters: #. logType (string): A defined logging type. #. level (number): The level of logging. """ assert _is_number(level), "level must be a number" level = float(le...
python
def set_log_type_level(self, logType, level): """ Set a logtype logging level. :Parameters: #. logType (string): A defined logging type. #. level (number): The level of logging. """ assert _is_number(level), "level must be a number" level = float(le...
[ "def", "set_log_type_level", "(", "self", ",", "logType", ",", "level", ")", ":", "assert", "_is_number", "(", "level", ")", ",", "\"level must be a number\"", "level", "=", "float", "(", "level", ")", "name", "=", "str", "(", "name", ")", "self", ".", "...
Set a logtype logging level. :Parameters: #. logType (string): A defined logging type. #. level (number): The level of logging.
[ "Set", "a", "logtype", "logging", "level", "." ]
train
https://github.com/bachiraoun/pysimplelog/blob/2681ed5b1b8d7e66c3fff3ec3cca2b14ac571238/SimpleLog.py#L885-L896
bachiraoun/pysimplelog
SimpleLog.py
Logger.remove_log_type
def remove_log_type(self, logType, _assert=False): """ Remove a logtype. :Parameters: #. logType (string): The logtype. #. _assert (boolean): Raise an assertion error if logType is not defined. """ # check logType if _assert: assert logT...
python
def remove_log_type(self, logType, _assert=False): """ Remove a logtype. :Parameters: #. logType (string): The logtype. #. _assert (boolean): Raise an assertion error if logType is not defined. """ # check logType if _assert: assert logT...
[ "def", "remove_log_type", "(", "self", ",", "logType", ",", "_assert", "=", "False", ")", ":", "# check logType", "if", "_assert", ":", "assert", "logType", "in", "self", ".", "__logTypeStdoutFlags", ".", "keys", "(", ")", ",", "\"logType '%s' is not defined\"",...
Remove a logtype. :Parameters: #. logType (string): The logtype. #. _assert (boolean): Raise an assertion error if logType is not defined.
[ "Remove", "a", "logtype", "." ]
train
https://github.com/bachiraoun/pysimplelog/blob/2681ed5b1b8d7e66c3fff3ec3cca2b14ac571238/SimpleLog.py#L898-L919
bachiraoun/pysimplelog
SimpleLog.py
Logger.add_log_type
def add_log_type(self, logType, name=None, level=0, stdoutFlag=None, fileFlag=None, color=None, highlight=None, attributes=None): """ Add a new logtype. :Parameters: #. logType (string): The logtype. #. name (None, string): The logtype name. If None, name will be set to lo...
python
def add_log_type(self, logType, name=None, level=0, stdoutFlag=None, fileFlag=None, color=None, highlight=None, attributes=None): """ Add a new logtype. :Parameters: #. logType (string): The logtype. #. name (None, string): The logtype name. If None, name will be set to lo...
[ "def", "add_log_type", "(", "self", ",", "logType", ",", "name", "=", "None", ",", "level", "=", "0", ",", "stdoutFlag", "=", "None", ",", "fileFlag", "=", "None", ",", "color", "=", "None", ",", "highlight", "=", "None", ",", "attributes", "=", "Non...
Add a new logtype. :Parameters: #. logType (string): The logtype. #. name (None, string): The logtype name. If None, name will be set to logtype. #. level (number): The level of logging. #. stdoutFlag (None, boolean): Force standard output logging flag. ...
[ "Add", "a", "new", "logtype", "." ]
train
https://github.com/bachiraoun/pysimplelog/blob/2681ed5b1b8d7e66c3fff3ec3cca2b14ac571238/SimpleLog.py#L921-L950
bachiraoun/pysimplelog
SimpleLog.py
Logger.update_log_type
def update_log_type(self, logType, name=None, level=None, stdoutFlag=None, fileFlag=None, color=None, highlight=None, attributes=None): """ update a logtype. :Parameters: #. logType (string): The logtype. #. name (None, string): The logtype name. If None, name will be set ...
python
def update_log_type(self, logType, name=None, level=None, stdoutFlag=None, fileFlag=None, color=None, highlight=None, attributes=None): """ update a logtype. :Parameters: #. logType (string): The logtype. #. name (None, string): The logtype name. If None, name will be set ...
[ "def", "update_log_type", "(", "self", ",", "logType", ",", "name", "=", "None", ",", "level", "=", "None", ",", "stdoutFlag", "=", "None", ",", "fileFlag", "=", "None", ",", "color", "=", "None", ",", "highlight", "=", "None", ",", "attributes", "=", ...
update a logtype. :Parameters: #. logType (string): The logtype. #. name (None, string): The logtype name. If None, name will be set to logtype. #. level (number): The level of logging. #. stdoutFlag (None, boolean): Force standard output logging flag. ...
[ "update", "a", "logtype", "." ]
train
https://github.com/bachiraoun/pysimplelog/blob/2681ed5b1b8d7e66c3fff3ec3cca2b14ac571238/SimpleLog.py#L1020-L1055
bachiraoun/pysimplelog
SimpleLog.py
Logger.log
def log(self, logType, message, data=None, tback=None): """ log a message of a certain logtype. :Parameters: #. logType (string): A defined logging type. #. message (string): Any message to log. #. data (None, object): Any type of data to print and/or write to ...
python
def log(self, logType, message, data=None, tback=None): """ log a message of a certain logtype. :Parameters: #. logType (string): A defined logging type. #. message (string): Any message to log. #. data (None, object): Any type of data to print and/or write to ...
[ "def", "log", "(", "self", ",", "logType", ",", "message", ",", "data", "=", "None", ",", "tback", "=", "None", ")", ":", "# log to stdout", "log", "=", "self", ".", "_format_message", "(", "logType", "=", "logType", ",", "message", "=", "message", ","...
log a message of a certain logtype. :Parameters: #. logType (string): A defined logging type. #. message (string): Any message to log. #. data (None, object): Any type of data to print and/or write to log file after log message #. tback (None, str, lis...
[ "log", "a", "message", "of", "a", "certain", "logtype", "." ]
train
https://github.com/bachiraoun/pysimplelog/blob/2681ed5b1b8d7e66c3fff3ec3cca2b14ac571238/SimpleLog.py#L1099-L1139
bachiraoun/pysimplelog
SimpleLog.py
Logger.force_log
def force_log(self, logType, message, data=None, tback=None, stdout=True, file=True): """ Force logging a message of a certain logtype whether logtype level is allowed or not. :Parameters: #. logType (string): A defined logging type. #. message (string): Any message to log...
python
def force_log(self, logType, message, data=None, tback=None, stdout=True, file=True): """ Force logging a message of a certain logtype whether logtype level is allowed or not. :Parameters: #. logType (string): A defined logging type. #. message (string): Any message to log...
[ "def", "force_log", "(", "self", ",", "logType", ",", "message", ",", "data", "=", "None", ",", "tback", "=", "None", ",", "stdout", "=", "True", ",", "file", "=", "True", ")", ":", "# log to stdout", "log", "=", "self", ".", "_format_message", "(", ...
Force logging a message of a certain logtype whether logtype level is allowed or not. :Parameters: #. logType (string): A defined logging type. #. message (string): Any message to log. #. tback (None, str, list): Stack traceback to print and/or write to log file. ...
[ "Force", "logging", "a", "message", "of", "a", "certain", "logtype", "whether", "logtype", "level", "is", "allowed", "or", "not", "." ]
train
https://github.com/bachiraoun/pysimplelog/blob/2681ed5b1b8d7e66c3fff3ec3cca2b14ac571238/SimpleLog.py#L1141-L1179
bachiraoun/pysimplelog
SimpleLog.py
Logger.flush
def flush(self): """Flush all streams.""" if self.__logFileStream is not None: try: self.__logFileStream.flush() except: pass try: os.fsync(self.__logFileStream.fileno()) except: pass ...
python
def flush(self): """Flush all streams.""" if self.__logFileStream is not None: try: self.__logFileStream.flush() except: pass try: os.fsync(self.__logFileStream.fileno()) except: pass ...
[ "def", "flush", "(", "self", ")", ":", "if", "self", ".", "__logFileStream", "is", "not", "None", ":", "try", ":", "self", ".", "__logFileStream", ".", "flush", "(", ")", "except", ":", "pass", "try", ":", "os", ".", "fsync", "(", "self", ".", "__l...
Flush all streams.
[ "Flush", "all", "streams", "." ]
train
https://github.com/bachiraoun/pysimplelog/blob/2681ed5b1b8d7e66c3fff3ec3cca2b14ac571238/SimpleLog.py#L1181-L1200
bachiraoun/pysimplelog
SimpleLog.py
Logger.info
def info(self, message, *args, **kwargs): """alias to message at information level""" self.log("info", message, *args, **kwargs)
python
def info(self, message, *args, **kwargs): """alias to message at information level""" self.log("info", message, *args, **kwargs)
[ "def", "info", "(", "self", ",", "message", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "log", "(", "\"info\"", ",", "message", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
alias to message at information level
[ "alias", "to", "message", "at", "information", "level" ]
train
https://github.com/bachiraoun/pysimplelog/blob/2681ed5b1b8d7e66c3fff3ec3cca2b14ac571238/SimpleLog.py#L1202-L1204
bachiraoun/pysimplelog
SimpleLog.py
Logger.information
def information(self, message, *args, **kwargs): """alias to message at information level""" self.log("info", message, *args, **kwargs)
python
def information(self, message, *args, **kwargs): """alias to message at information level""" self.log("info", message, *args, **kwargs)
[ "def", "information", "(", "self", ",", "message", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "log", "(", "\"info\"", ",", "message", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
alias to message at information level
[ "alias", "to", "message", "at", "information", "level" ]
train
https://github.com/bachiraoun/pysimplelog/blob/2681ed5b1b8d7e66c3fff3ec3cca2b14ac571238/SimpleLog.py#L1206-L1208
bachiraoun/pysimplelog
SimpleLog.py
Logger.warn
def warn(self, message, *args, **kwargs): """alias to message at warning level""" self.log("warn", message, *args, **kwargs)
python
def warn(self, message, *args, **kwargs): """alias to message at warning level""" self.log("warn", message, *args, **kwargs)
[ "def", "warn", "(", "self", ",", "message", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "log", "(", "\"warn\"", ",", "message", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
alias to message at warning level
[ "alias", "to", "message", "at", "warning", "level" ]
train
https://github.com/bachiraoun/pysimplelog/blob/2681ed5b1b8d7e66c3fff3ec3cca2b14ac571238/SimpleLog.py#L1210-L1212
bachiraoun/pysimplelog
SimpleLog.py
Logger.warning
def warning(self, message, *args, **kwargs): """alias to message at warning level""" self.log("warn", message, *args, **kwargs)
python
def warning(self, message, *args, **kwargs): """alias to message at warning level""" self.log("warn", message, *args, **kwargs)
[ "def", "warning", "(", "self", ",", "message", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "log", "(", "\"warn\"", ",", "message", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
alias to message at warning level
[ "alias", "to", "message", "at", "warning", "level" ]
train
https://github.com/bachiraoun/pysimplelog/blob/2681ed5b1b8d7e66c3fff3ec3cca2b14ac571238/SimpleLog.py#L1214-L1216
ytjia/utils-py
utils_py/time_util.py
ts_to_dt_str
def ts_to_dt_str(ts, dt_format='%Y-%m-%d %H:%M:%S'): """ 时间戳转换为日期字符串 Args: ts: 待转换的时间戳 dt_format: 目标日期字符串格式 Returns: 日期字符串 """ return datetime.datetime.fromtimestamp(int(ts)).strftime(dt_format)
python
def ts_to_dt_str(ts, dt_format='%Y-%m-%d %H:%M:%S'): """ 时间戳转换为日期字符串 Args: ts: 待转换的时间戳 dt_format: 目标日期字符串格式 Returns: 日期字符串 """ return datetime.datetime.fromtimestamp(int(ts)).strftime(dt_format)
[ "def", "ts_to_dt_str", "(", "ts", ",", "dt_format", "=", "'%Y-%m-%d %H:%M:%S'", ")", ":", "return", "datetime", ".", "datetime", ".", "fromtimestamp", "(", "int", "(", "ts", ")", ")", ".", "strftime", "(", "dt_format", ")" ]
时间戳转换为日期字符串 Args: ts: 待转换的时间戳 dt_format: 目标日期字符串格式 Returns: 日期字符串
[ "时间戳转换为日期字符串", "Args", ":", "ts", ":", "待转换的时间戳", "dt_format", ":", "目标日期字符串格式" ]
train
https://github.com/ytjia/utils-py/blob/68039b367e2e38fdecf234ecc625406b9e203ec0/utils_py/time_util.py#L10-L20
ytjia/utils-py
utils_py/time_util.py
str_to_datetime
def str_to_datetime(dt_str, fmt='%Y-%m-%d %H:%M:%S'): """ 字符串转换为datetime类型数据 :param dt_str: :param fmt: :return: """ d_time = datetime.datetime.strptime(dt_str, fmt) return d_time
python
def str_to_datetime(dt_str, fmt='%Y-%m-%d %H:%M:%S'): """ 字符串转换为datetime类型数据 :param dt_str: :param fmt: :return: """ d_time = datetime.datetime.strptime(dt_str, fmt) return d_time
[ "def", "str_to_datetime", "(", "dt_str", ",", "fmt", "=", "'%Y-%m-%d %H:%M:%S'", ")", ":", "d_time", "=", "datetime", ".", "datetime", ".", "strptime", "(", "dt_str", ",", "fmt", ")", "return", "d_time" ]
字符串转换为datetime类型数据 :param dt_str: :param fmt: :return:
[ "字符串转换为datetime类型数据", ":", "param", "dt_str", ":", ":", "param", "fmt", ":", ":", "return", ":" ]
train
https://github.com/ytjia/utils-py/blob/68039b367e2e38fdecf234ecc625406b9e203ec0/utils_py/time_util.py#L23-L31
ytjia/utils-py
utils_py/time_util.py
dt_delta
def dt_delta(dt, delta): """ 获取dt相隔delta的日期 :param dt: :param delta: :return: """ delta_time = datetime.timedelta(days=delta) target_date = dt + delta_time return target_date
python
def dt_delta(dt, delta): """ 获取dt相隔delta的日期 :param dt: :param delta: :return: """ delta_time = datetime.timedelta(days=delta) target_date = dt + delta_time return target_date
[ "def", "dt_delta", "(", "dt", ",", "delta", ")", ":", "delta_time", "=", "datetime", ".", "timedelta", "(", "days", "=", "delta", ")", "target_date", "=", "dt", "+", "delta_time", "return", "target_date" ]
获取dt相隔delta的日期 :param dt: :param delta: :return:
[ "获取dt相隔delta的日期", ":", "param", "dt", ":", ":", "param", "delta", ":", ":", "return", ":" ]
train
https://github.com/ytjia/utils-py/blob/68039b367e2e38fdecf234ecc625406b9e203ec0/utils_py/time_util.py#L63-L72
ytjia/utils-py
utils_py/time_util.py
time_str_to_minutes
def time_str_to_minutes(time_str): """ 通过时间字符串计算得到这是一天中第多少分钟 :param time_str: eg: '11:10:00' :return: int """ time_arr = time_str.split(":") hours = int(time_arr[0]) minutes = int(time_arr[1]) return hours * 60 + minutes
python
def time_str_to_minutes(time_str): """ 通过时间字符串计算得到这是一天中第多少分钟 :param time_str: eg: '11:10:00' :return: int """ time_arr = time_str.split(":") hours = int(time_arr[0]) minutes = int(time_arr[1]) return hours * 60 + minutes
[ "def", "time_str_to_minutes", "(", "time_str", ")", ":", "time_arr", "=", "time_str", ".", "split", "(", "\":\"", ")", "hours", "=", "int", "(", "time_arr", "[", "0", "]", ")", "minutes", "=", "int", "(", "time_arr", "[", "1", "]", ")", "return", "ho...
通过时间字符串计算得到这是一天中第多少分钟 :param time_str: eg: '11:10:00' :return: int
[ "通过时间字符串计算得到这是一天中第多少分钟", ":", "param", "time_str", ":", "eg", ":", "11", ":", "10", ":", "00", ":", "return", ":", "int" ]
train
https://github.com/ytjia/utils-py/blob/68039b367e2e38fdecf234ecc625406b9e203ec0/utils_py/time_util.py#L75-L84
ytjia/utils-py
utils_py/math_util.py
almost_eq
def almost_eq(a, b, threshold=0.000001): """ 比较两个小数是否几乎相等 当两数差的绝对值小于threshold时认为其相等 :param a: :param b: :param threshold: :return: True or False """ if abs(a - b) < threshold: return True else: return False
python
def almost_eq(a, b, threshold=0.000001): """ 比较两个小数是否几乎相等 当两数差的绝对值小于threshold时认为其相等 :param a: :param b: :param threshold: :return: True or False """ if abs(a - b) < threshold: return True else: return False
[ "def", "almost_eq", "(", "a", ",", "b", ",", "threshold", "=", "0.000001", ")", ":", "if", "abs", "(", "a", "-", "b", ")", "<", "threshold", ":", "return", "True", "else", ":", "return", "False" ]
比较两个小数是否几乎相等 当两数差的绝对值小于threshold时认为其相等 :param a: :param b: :param threshold: :return: True or False
[ "比较两个小数是否几乎相等", "当两数差的绝对值小于threshold时认为其相等", ":", "param", "a", ":", ":", "param", "b", ":", ":", "param", "threshold", ":", ":", "return", ":", "True", "or", "False" ]
train
https://github.com/ytjia/utils-py/blob/68039b367e2e38fdecf234ecc625406b9e203ec0/utils_py/math_util.py#L7-L19
jason-weirather/py-seq-tools
seqtools/structure/transcriptome/__init__.py
Transcriptome.sort_transcripts
def sort_transcripts(self): """Sort the transcripts stored here""" txs = sorted(self.transcripts,key=lambda x: (x.range.chr, x.range.start, x.range.end)) self._transcripts = txs
python
def sort_transcripts(self): """Sort the transcripts stored here""" txs = sorted(self.transcripts,key=lambda x: (x.range.chr, x.range.start, x.range.end)) self._transcripts = txs
[ "def", "sort_transcripts", "(", "self", ")", ":", "txs", "=", "sorted", "(", "self", ".", "transcripts", ",", "key", "=", "lambda", "x", ":", "(", "x", ".", "range", ".", "chr", ",", "x", ".", "range", ".", "start", ",", "x", ".", "range", ".", ...
Sort the transcripts stored here
[ "Sort", "the", "transcripts", "stored", "here" ]
train
https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/structure/transcriptome/__init__.py#L32-L35
mitsei/dlkit
dlkit/services/locale.py
LocaleManager._set_no_catalog_view
def _set_no_catalog_view(self, session): """Sets the underlying no_catalog view to match current view""" if self._no_catalog_view == COMPARATIVE: try: session.use_comparative_no_catalog_view() except AttributeError: pass else: t...
python
def _set_no_catalog_view(self, session): """Sets the underlying no_catalog view to match current view""" if self._no_catalog_view == COMPARATIVE: try: session.use_comparative_no_catalog_view() except AttributeError: pass else: t...
[ "def", "_set_no_catalog_view", "(", "self", ",", "session", ")", ":", "if", "self", ".", "_no_catalog_view", "==", "COMPARATIVE", ":", "try", ":", "session", ".", "use_comparative_no_catalog_view", "(", ")", "except", "AttributeError", ":", "pass", "else", ":", ...
Sets the underlying no_catalog view to match current view
[ "Sets", "the", "underlying", "no_catalog", "view", "to", "match", "current", "view" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/locale.py#L209-L220
cloudnull/cloudlib
cloudlib/mail.py
Mailer.send
def send(self, send_to, from_who, subject, message, reply_to=None): """Send Email. To use this module pass in a message, send_to, from_who, and subject. :param send_to: ``str`` :param from_who: ``str`` :param subject: ``str`` :param message: ``str`` :param reply...
python
def send(self, send_to, from_who, subject, message, reply_to=None): """Send Email. To use this module pass in a message, send_to, from_who, and subject. :param send_to: ``str`` :param from_who: ``str`` :param subject: ``str`` :param message: ``str`` :param reply...
[ "def", "send", "(", "self", ",", "send_to", ",", "from_who", ",", "subject", ",", "message", ",", "reply_to", "=", "None", ")", ":", "# Set the reply to address if it's None", "if", "reply_to", "is", "None", ":", "reply_to", "=", "from_who", "try", ":", "em_...
Send Email. To use this module pass in a message, send_to, from_who, and subject. :param send_to: ``str`` :param from_who: ``str`` :param subject: ``str`` :param message: ``str`` :param reply_to: ``str``
[ "Send", "Email", "." ]
train
https://github.com/cloudnull/cloudlib/blob/5038111ce02521caa2558117e3bae9e1e806d315/cloudlib/mail.py#L92-L133
ilgarm/pyzimbra
pyzimbra/z/client.py
ZimbraClient.authenticate
def authenticate(self, account_name, password): """ Authenticates zimbra account. @param account_name: account email address @param password: account password @raise AuthException: if authentication fails @raise SoapException: if soap communication fails """ ...
python
def authenticate(self, account_name, password): """ Authenticates zimbra account. @param account_name: account email address @param password: account password @raise AuthException: if authentication fails @raise SoapException: if soap communication fails """ ...
[ "def", "authenticate", "(", "self", ",", "account_name", ",", "password", ")", ":", "self", ".", "auth_token", "=", "self", ".", "authenticator", ".", "authenticate", "(", "self", ".", "transport", ",", "account_name", ",", "password", ")" ]
Authenticates zimbra account. @param account_name: account email address @param password: account password @raise AuthException: if authentication fails @raise SoapException: if soap communication fails
[ "Authenticates", "zimbra", "account", "." ]
train
https://github.com/ilgarm/pyzimbra/blob/c397bc7497554d260ec6fd1a80405aed872a70cc/pyzimbra/z/client.py#L40-L50
ilgarm/pyzimbra
pyzimbra/z/client.py
ZimbraClient.change_password
def change_password(self, current_password, new_password): """ Changes account password. @param current_password: current password @param new_password: new password """ attrs = {sconstant.A_BY: sconstant.V_NAME} account = SOAPpy.Types.stringType(data=self.auth_tok...
python
def change_password(self, current_password, new_password): """ Changes account password. @param current_password: current password @param new_password: new password """ attrs = {sconstant.A_BY: sconstant.V_NAME} account = SOAPpy.Types.stringType(data=self.auth_tok...
[ "def", "change_password", "(", "self", ",", "current_password", ",", "new_password", ")", ":", "attrs", "=", "{", "sconstant", ".", "A_BY", ":", "sconstant", ".", "V_NAME", "}", "account", "=", "SOAPpy", ".", "Types", ".", "stringType", "(", "data", "=", ...
Changes account password. @param current_password: current password @param new_password: new password
[ "Changes", "account", "password", "." ]
train
https://github.com/ilgarm/pyzimbra/blob/c397bc7497554d260ec6fd1a80405aed872a70cc/pyzimbra/z/client.py#L53-L69
ilgarm/pyzimbra
pyzimbra/z/client.py
ZimbraClient.get_account_info
def get_account_info(self): """ Gets account info. @return: AccountInfo """ attrs = {sconstant.A_BY: sconstant.V_NAME} account = SOAPpy.Types.stringType(data=self.auth_token.account_name, attrs=attrs) params = {sconstant....
python
def get_account_info(self): """ Gets account info. @return: AccountInfo """ attrs = {sconstant.A_BY: sconstant.V_NAME} account = SOAPpy.Types.stringType(data=self.auth_token.account_name, attrs=attrs) params = {sconstant....
[ "def", "get_account_info", "(", "self", ")", ":", "attrs", "=", "{", "sconstant", ".", "A_BY", ":", "sconstant", ".", "V_NAME", "}", "account", "=", "SOAPpy", ".", "Types", ".", "stringType", "(", "data", "=", "self", ".", "auth_token", ".", "account_nam...
Gets account info. @return: AccountInfo
[ "Gets", "account", "info", "." ]
train
https://github.com/ilgarm/pyzimbra/blob/c397bc7497554d260ec6fd1a80405aed872a70cc/pyzimbra/z/client.py#L72-L90
ilgarm/pyzimbra
pyzimbra/z/client.py
ZimbraClient.get_info
def get_info(self, params={}): """ Gets mailbox info. @param params: params to retrieve @return: AccountInfo """ res = self.invoke(zconstant.NS_ZIMBRA_ACC_URL, sconstant.GetInfoRequest, params) return res
python
def get_info(self, params={}): """ Gets mailbox info. @param params: params to retrieve @return: AccountInfo """ res = self.invoke(zconstant.NS_ZIMBRA_ACC_URL, sconstant.GetInfoRequest, params) return res
[ "def", "get_info", "(", "self", ",", "params", "=", "{", "}", ")", ":", "res", "=", "self", ".", "invoke", "(", "zconstant", ".", "NS_ZIMBRA_ACC_URL", ",", "sconstant", ".", "GetInfoRequest", ",", "params", ")", "return", "res" ]
Gets mailbox info. @param params: params to retrieve @return: AccountInfo
[ "Gets", "mailbox", "info", "." ]
train
https://github.com/ilgarm/pyzimbra/blob/c397bc7497554d260ec6fd1a80405aed872a70cc/pyzimbra/z/client.py#L93-L103
mitsei/dlkit
dlkit/json_/relationship/default_mdata.py
get_relationship_mdata
def get_relationship_mdata(): """Return default mdata map for Relationship""" return { 'source': { 'element_label': { 'text': 'source', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), 'for...
python
def get_relationship_mdata(): """Return default mdata map for Relationship""" return { 'source': { 'element_label': { 'text': 'source', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), 'for...
[ "def", "get_relationship_mdata", "(", ")", ":", "return", "{", "'source'", ":", "{", "'element_label'", ":", "{", "'text'", ":", "'source'", ",", "'languageTypeId'", ":", "str", "(", "DEFAULT_LANGUAGE_TYPE", ")", ",", "'scriptTypeId'", ":", "str", "(", "DEFAUL...
Return default mdata map for Relationship
[ "Return", "default", "mdata", "map", "for", "Relationship" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/default_mdata.py#L11-L56
mitsei/dlkit
dlkit/json_/osid/queries.py
OsidQuery._match_minimum_date_time
def _match_minimum_date_time(self, match_key, date_time_value, match=True): """Matches a minimum date time value""" if match: gtelt = '$gte' else: gtelt = '$lt' if match_key in self._query_terms: self._query_terms[match_key][gtelt] = date_time_value ...
python
def _match_minimum_date_time(self, match_key, date_time_value, match=True): """Matches a minimum date time value""" if match: gtelt = '$gte' else: gtelt = '$lt' if match_key in self._query_terms: self._query_terms[match_key][gtelt] = date_time_value ...
[ "def", "_match_minimum_date_time", "(", "self", ",", "match_key", ",", "date_time_value", ",", "match", "=", "True", ")", ":", "if", "match", ":", "gtelt", "=", "'$gte'", "else", ":", "gtelt", "=", "'$lt'", "if", "match_key", "in", "self", ".", "_query_ter...
Matches a minimum date time value
[ "Matches", "a", "minimum", "date", "time", "value" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/queries.py#L146-L155
mitsei/dlkit
dlkit/json_/osid/queries.py
OsidQuery._clear_minimum_terms
def _clear_minimum_terms(self, match_key): """clears minimum match_key term values""" try: # clear match = True case del self._query_terms[match_key]['$gte'] except KeyError: pass try: # clear match = False case del self._query_terms[match_key]['$lt'...
python
def _clear_minimum_terms(self, match_key): """clears minimum match_key term values""" try: # clear match = True case del self._query_terms[match_key]['$gte'] except KeyError: pass try: # clear match = False case del self._query_terms[match_key]['$lt'...
[ "def", "_clear_minimum_terms", "(", "self", ",", "match_key", ")", ":", "try", ":", "# clear match = True case", "del", "self", ".", "_query_terms", "[", "match_key", "]", "[", "'$gte'", "]", "except", "KeyError", ":", "pass", "try", ":", "# clear match = False ...
clears minimum match_key term values
[ "clears", "minimum", "match_key", "term", "values" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/queries.py#L176-L190
mitsei/dlkit
dlkit/json_/osid/queries.py
OsidQuery._clear_maximum_terms
def _clear_maximum_terms(self, match_key): """clears maximum match_key term values""" try: # clear match = True case del self._query_terms[match_key]['$lte'] except KeyError: pass try: # clear match = False case del self._query_terms[match_key]['$gt'...
python
def _clear_maximum_terms(self, match_key): """clears maximum match_key term values""" try: # clear match = True case del self._query_terms[match_key]['$lte'] except KeyError: pass try: # clear match = False case del self._query_terms[match_key]['$gt'...
[ "def", "_clear_maximum_terms", "(", "self", ",", "match_key", ")", ":", "try", ":", "# clear match = True case", "del", "self", ".", "_query_terms", "[", "match_key", "]", "[", "'$lte'", "]", "except", "KeyError", ":", "pass", "try", ":", "# clear match = False ...
clears maximum match_key term values
[ "clears", "maximum", "match_key", "term", "values" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/queries.py#L192-L206
mitsei/dlkit
dlkit/json_/osid/queries.py
OsidQuery.match_keyword
def match_keyword(self, keyword, string_match_type=DEFAULT_STRING_MATCH_TYPE, match=True): """Adds a keyword to match. Multiple keywords can be added to perform a boolean ``OR`` among them. A keyword may be applied to any of the elements defined in this object such as the display name, ...
python
def match_keyword(self, keyword, string_match_type=DEFAULT_STRING_MATCH_TYPE, match=True): """Adds a keyword to match. Multiple keywords can be added to perform a boolean ``OR`` among them. A keyword may be applied to any of the elements defined in this object such as the display name, ...
[ "def", "match_keyword", "(", "self", ",", "keyword", ",", "string_match_type", "=", "DEFAULT_STRING_MATCH_TYPE", ",", "match", "=", "True", ")", ":", "# Note: this currently ignores match argument", "match_value", "=", "self", ".", "_get_string_match_value", "(", "keywo...
Adds a keyword to match. Multiple keywords can be added to perform a boolean ``OR`` among them. A keyword may be applied to any of the elements defined in this object such as the display name, description or any method defined in an interface implemented by this object. arg: ...
[ "Adds", "a", "keyword", "to", "match", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/queries.py#L239-L267
mitsei/dlkit
dlkit/json_/osid/queries.py
OsidQuery.match_any
def match_any(self, match): """Matches any object. arg: match (boolean): ``true`` to match any object ``,`` ``false`` to match no objects *compliance: mandatory -- This method must be implemented.* """ match_key = '_id' param = '$exists' if ma...
python
def match_any(self, match): """Matches any object. arg: match (boolean): ``true`` to match any object ``,`` ``false`` to match no objects *compliance: mandatory -- This method must be implemented.* """ match_key = '_id' param = '$exists' if ma...
[ "def", "match_any", "(", "self", ",", "match", ")", ":", "match_key", "=", "'_id'", "param", "=", "'$exists'", "if", "match", ":", "flag", "=", "'true'", "else", ":", "flag", "=", "'false'", "if", "match_key", "in", "self", ".", "_query_terms", ":", "s...
Matches any object. arg: match (boolean): ``true`` to match any object ``,`` ``false`` to match no objects *compliance: mandatory -- This method must be implemented.*
[ "Matches", "any", "object", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/queries.py#L280-L297
mitsei/dlkit
dlkit/json_/osid/queries.py
OsidTemporalQuery.match_start_date
def match_start_date(self, start, end, match): """Matches temporals whose start date falls in between the given dates inclusive. arg: start (osid.calendaring.DateTime): start of date range arg: end (osid.calendaring.DateTime): end of date range arg: match (boolean): ``true`` if...
python
def match_start_date(self, start, end, match): """Matches temporals whose start date falls in between the given dates inclusive. arg: start (osid.calendaring.DateTime): start of date range arg: end (osid.calendaring.DateTime): end of date range arg: match (boolean): ``true`` if...
[ "def", "match_start_date", "(", "self", ",", "start", ",", "end", ",", "match", ")", ":", "if", "match", ":", "if", "end", "<", "start", ":", "raise", "errors", ".", "InvalidArgument", "(", "'end date must be >= start date when match = True'", ")", "self", "."...
Matches temporals whose start date falls in between the given dates inclusive. arg: start (osid.calendaring.DateTime): start of date range arg: end (osid.calendaring.DateTime): end of date range arg: match (boolean): ``true`` if a positive match, ``false`` for a negativ...
[ "Matches", "temporals", "whose", "start", "date", "falls", "in", "between", "the", "given", "dates", "inclusive", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/queries.py#L462-L482
mitsei/dlkit
dlkit/json_/osid/queries.py
OsidTemporalQuery.match_end_date
def match_end_date(self, start, end, match): """Matches temporals whose effective end date falls in between the given dates inclusive. arg: start (osid.calendaring.DateTime): start of date range arg: end (osid.calendaring.DateTime): end of date range arg: match (boolean): ``tru...
python
def match_end_date(self, start, end, match): """Matches temporals whose effective end date falls in between the given dates inclusive. arg: start (osid.calendaring.DateTime): start of date range arg: end (osid.calendaring.DateTime): end of date range arg: match (boolean): ``tru...
[ "def", "match_end_date", "(", "self", ",", "start", ",", "end", ",", "match", ")", ":", "if", "match", ":", "if", "end", "<", "start", ":", "raise", "errors", ".", "InvalidArgument", "(", "'end date must be >= start date when match = True'", ")", "self", ".", ...
Matches temporals whose effective end date falls in between the given dates inclusive. arg: start (osid.calendaring.DateTime): start of date range arg: end (osid.calendaring.DateTime): end of date range arg: match (boolean): ``true`` if a positive match, ``false`` for n...
[ "Matches", "temporals", "whose", "effective", "end", "date", "falls", "in", "between", "the", "given", "dates", "inclusive", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/queries.py#L506-L526
mitsei/dlkit
dlkit/json_/osid/queries.py
OsidTemporalQuery.match_date
def match_date(self, from_, to, match): """Matches temporals where the given date range falls entirely between the start and end dates inclusive. arg: from (osid.calendaring.DateTime): start date arg: to (osid.calendaring.DateTime): end date arg: match (boolean): ``true`` if a ...
python
def match_date(self, from_, to, match): """Matches temporals where the given date range falls entirely between the start and end dates inclusive. arg: from (osid.calendaring.DateTime): start date arg: to (osid.calendaring.DateTime): end date arg: match (boolean): ``true`` if a ...
[ "def", "match_date", "(", "self", ",", "from_", ",", "to", ",", "match", ")", ":", "if", "match", ":", "if", "to", "<", "from_", ":", "raise", "errors", ".", "InvalidArgument", "(", "'end date must be >= start date when match = True'", ")", "self", ".", "_qu...
Matches temporals where the given date range falls entirely between the start and end dates inclusive. arg: from (osid.calendaring.DateTime): start date arg: to (osid.calendaring.DateTime): end date arg: match (boolean): ``true`` if a positive match, ``false`` for a neg...
[ "Matches", "temporals", "where", "the", "given", "date", "range", "falls", "entirely", "between", "the", "start", "and", "end", "dates", "inclusive", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/queries.py#L550-L572
mitsei/dlkit
dlkit/json_/osid/queries.py
OsidObjectQuery.match_display_name
def match_display_name(self, display_name, string_match_type=DEFAULT_STRING_MATCH_TYPE, match=True): """Adds a display name to match. Multiple display name matches can be added to perform a boolean ``OR`` among them. arg: display_name (string): display name to match arg: ...
python
def match_display_name(self, display_name, string_match_type=DEFAULT_STRING_MATCH_TYPE, match=True): """Adds a display name to match. Multiple display name matches can be added to perform a boolean ``OR`` among them. arg: display_name (string): display name to match arg: ...
[ "def", "match_display_name", "(", "self", ",", "display_name", ",", "string_match_type", "=", "DEFAULT_STRING_MATCH_TYPE", ",", "match", "=", "True", ")", ":", "self", ".", "_match_display_text", "(", "'displayName'", ",", "display_name", ",", "string_match_type", "...
Adds a display name to match. Multiple display name matches can be added to perform a boolean ``OR`` among them. arg: display_name (string): display name to match arg: string_match_type (osid.type.Type): the string match type arg: match (boolean): ``tru...
[ "Adds", "a", "display", "name", "to", "match", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/queries.py#L971-L992
mitsei/dlkit
dlkit/json_/osid/queries.py
OsidObjectQuery.match_description
def match_description(self, description, string_match_type=DEFAULT_STRING_MATCH_TYPE, match=True): """Adds a description name to match. Multiple description matches can be added to perform a boolean ``OR`` among them. arg: description (string): description to match arg: s...
python
def match_description(self, description, string_match_type=DEFAULT_STRING_MATCH_TYPE, match=True): """Adds a description name to match. Multiple description matches can be added to perform a boolean ``OR`` among them. arg: description (string): description to match arg: s...
[ "def", "match_description", "(", "self", ",", "description", ",", "string_match_type", "=", "DEFAULT_STRING_MATCH_TYPE", ",", "match", "=", "True", ")", ":", "self", ".", "_match_display_text", "(", "'description'", ",", "description", ",", "string_match_type", ",",...
Adds a description name to match. Multiple description matches can be added to perform a boolean ``OR`` among them. arg: description (string): description to match arg: string_match_type (osid.type.Type): the string match type arg: match (boolean): ``tr...
[ "Adds", "a", "description", "name", "to", "match", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/queries.py#L1016-L1037
Vagrants/blackbird
blackbird/utils/logger.py
get_handler_fp
def get_handler_fp(logger): """ Get handler_fp. This method is integrated to LoggerFactory Object in the future. :param logging.Logger logger: Python logging.Logger. logger instance. :rtype: logging.Logger.handlers.BaseRotatingHandler :return: Handler or Handler's stream. We call it `handler_fp`...
python
def get_handler_fp(logger): """ Get handler_fp. This method is integrated to LoggerFactory Object in the future. :param logging.Logger logger: Python logging.Logger. logger instance. :rtype: logging.Logger.handlers.BaseRotatingHandler :return: Handler or Handler's stream. We call it `handler_fp`...
[ "def", "get_handler_fp", "(", "logger", ")", ":", "if", "not", "hasattr", "(", "logger", ",", "'handlers'", ")", ":", "raise", "blackbird", ".", "utils", ".", "error", ".", "BlackbirdError", "(", "'Given logger is not logging.Logger instance!'", ")", "if", "len"...
Get handler_fp. This method is integrated to LoggerFactory Object in the future. :param logging.Logger logger: Python logging.Logger. logger instance. :rtype: logging.Logger.handlers.BaseRotatingHandler :return: Handler or Handler's stream. We call it `handler_fp`.
[ "Get", "handler_fp", ".", "This", "method", "is", "integrated", "to", "LoggerFactory", "Object", "in", "the", "future", ".", ":", "param", "logging", ".", "Logger", "logger", ":", "Python", "logging", ".", "Logger", ".", "logger", "instance", ".", ":", "rt...
train
https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/logger.py#L69-L91
python-odin/odinweb
odinweb/resources.py
Error.from_status
def from_status(cls, http_status, code_index=0, message=None, developer_message=None, meta=None): # type: (HTTPStatus, int, AnyStr, AnyStr, dict) -> Error """ Automatically build an HTTP response from the HTTP Status code. :param http_status: :param code_index: ...
python
def from_status(cls, http_status, code_index=0, message=None, developer_message=None, meta=None): # type: (HTTPStatus, int, AnyStr, AnyStr, dict) -> Error """ Automatically build an HTTP response from the HTTP Status code. :param http_status: :param code_index: ...
[ "def", "from_status", "(", "cls", ",", "http_status", ",", "code_index", "=", "0", ",", "message", "=", "None", ",", "developer_message", "=", "None", ",", "meta", "=", "None", ")", ":", "# type: (HTTPStatus, int, AnyStr, AnyStr, dict) -> Error", "return", "cls", ...
Automatically build an HTTP response from the HTTP Status code. :param http_status: :param code_index: :param message: :param developer_message: :param meta:
[ "Automatically", "build", "an", "HTTP", "response", "from", "the", "HTTP", "Status", "code", ".", ":", "param", "http_status", ":", ":", "param", "code_index", ":", ":", "param", "message", ":", ":", "param", "developer_message", ":", ":", "param", "meta", ...
train
https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/resources.py#L64-L80
kata198/NamedAtomicLock
NamedAtomicLock/__init__.py
NamedAtomicLock.acquire
def acquire(self, timeout=None): ''' acquire - Acquire given lock. Can be blocking or nonblocking by providing a timeout. Returns "True" if you got the lock, otherwise "False" @param timeout <None/float> - Max number of seconds to wait, or None to block until we can acquir...
python
def acquire(self, timeout=None): ''' acquire - Acquire given lock. Can be blocking or nonblocking by providing a timeout. Returns "True" if you got the lock, otherwise "False" @param timeout <None/float> - Max number of seconds to wait, or None to block until we can acquir...
[ "def", "acquire", "(", "self", ",", "timeout", "=", "None", ")", ":", "if", "self", ".", "held", "is", "True", ":", "# NOTE: Without some type of in-directory marker (like a uuid) we cannot", "# refresh an expired lock accurately", "if", "os", ".", "path", ".", ...
acquire - Acquire given lock. Can be blocking or nonblocking by providing a timeout. Returns "True" if you got the lock, otherwise "False" @param timeout <None/float> - Max number of seconds to wait, or None to block until we can acquire it. @return <bool> - True if you got the ...
[ "acquire", "-", "Acquire", "given", "lock", ".", "Can", "be", "blocking", "or", "nonblocking", "by", "providing", "a", "timeout", ".", "Returns", "True", "if", "you", "got", "the", "lock", "otherwise", "False" ]
train
https://github.com/kata198/NamedAtomicLock/blob/82d480b81daf4deea926964f18bb2e47d4f30f6c/NamedAtomicLock/__init__.py#L74-L126
kata198/NamedAtomicLock
NamedAtomicLock/__init__.py
NamedAtomicLock.release
def release(self, forceRelease=False): ''' release - Release the lock. @param forceRelease <bool> default False - If True, will release the lock even if we don't hold it. @return - True if lock is released, otherwise False ''' if not self.held: i...
python
def release(self, forceRelease=False): ''' release - Release the lock. @param forceRelease <bool> default False - If True, will release the lock even if we don't hold it. @return - True if lock is released, otherwise False ''' if not self.held: i...
[ "def", "release", "(", "self", ",", "forceRelease", "=", "False", ")", ":", "if", "not", "self", ".", "held", ":", "if", "forceRelease", "is", "False", ":", "return", "False", "# We were not holding the lock", "else", ":", "self", ".", "held", "=", "True",...
release - Release the lock. @param forceRelease <bool> default False - If True, will release the lock even if we don't hold it. @return - True if lock is released, otherwise False
[ "release", "-", "Release", "the", "lock", "." ]
train
https://github.com/kata198/NamedAtomicLock/blob/82d480b81daf4deea926964f18bb2e47d4f30f6c/NamedAtomicLock/__init__.py#L128-L162
kata198/NamedAtomicLock
NamedAtomicLock/__init__.py
NamedAtomicLock.__checkExpiration
def __checkExpiration(self, mtime=None): ''' __checkExpiration - Check if we have expired @param mtime <int> - Optional mtime if known, otherwise will be gathered @return <bool> - True if we did expire, otherwise False ''' if not self.maxLockAge:...
python
def __checkExpiration(self, mtime=None): ''' __checkExpiration - Check if we have expired @param mtime <int> - Optional mtime if known, otherwise will be gathered @return <bool> - True if we did expire, otherwise False ''' if not self.maxLockAge:...
[ "def", "__checkExpiration", "(", "self", ",", "mtime", "=", "None", ")", ":", "if", "not", "self", ".", "maxLockAge", ":", "return", "False", "if", "mtime", "is", "None", ":", "try", ":", "mtime", "=", "os", ".", "stat", "(", "self", ".", "lockPath",...
__checkExpiration - Check if we have expired @param mtime <int> - Optional mtime if known, otherwise will be gathered @return <bool> - True if we did expire, otherwise False
[ "__checkExpiration", "-", "Check", "if", "we", "have", "expired", "@param", "mtime", "<int", ">", "-", "Optional", "mtime", "if", "known", "otherwise", "will", "be", "gathered" ]
train
https://github.com/kata198/NamedAtomicLock/blob/82d480b81daf4deea926964f18bb2e47d4f30f6c/NamedAtomicLock/__init__.py#L165-L185
kata198/NamedAtomicLock
NamedAtomicLock/__init__.py
NamedAtomicLock.isHeld
def isHeld(self): ''' isHeld - True if anyone holds the lock, otherwise False. @return bool - If lock is held by anyone ''' if not os.path.exists(self.lockPath): return False try: mtime = os.stat(self.lockPath).st_mtime ex...
python
def isHeld(self): ''' isHeld - True if anyone holds the lock, otherwise False. @return bool - If lock is held by anyone ''' if not os.path.exists(self.lockPath): return False try: mtime = os.stat(self.lockPath).st_mtime ex...
[ "def", "isHeld", "(", "self", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "self", ".", "lockPath", ")", ":", "return", "False", "try", ":", "mtime", "=", "os", ".", "stat", "(", "self", ".", "lockPath", ")", ".", "st_mtime", "ex...
isHeld - True if anyone holds the lock, otherwise False. @return bool - If lock is held by anyone
[ "isHeld", "-", "True", "if", "anyone", "holds", "the", "lock", "otherwise", "False", "." ]
train
https://github.com/kata198/NamedAtomicLock/blob/82d480b81daf4deea926964f18bb2e47d4f30f6c/NamedAtomicLock/__init__.py#L188-L205
kata198/NamedAtomicLock
NamedAtomicLock/__init__.py
NamedAtomicLock.hasLock
def hasLock(self): ''' hasLock - Property, returns True if we have the lock, or False if we do not. @return <bool> - True/False if we have the lock or not. ''' # If we don't hold it currently, return False if self.held is False: return False ...
python
def hasLock(self): ''' hasLock - Property, returns True if we have the lock, or False if we do not. @return <bool> - True/False if we have the lock or not. ''' # If we don't hold it currently, return False if self.held is False: return False ...
[ "def", "hasLock", "(", "self", ")", ":", "# If we don't hold it currently, return False", "if", "self", ".", "held", "is", "False", ":", "return", "False", "# Otherwise if we think we hold it, but it is not held, we have lost it.", "if", "not", "self", ".", "isHeld", ":",...
hasLock - Property, returns True if we have the lock, or False if we do not. @return <bool> - True/False if we have the lock or not.
[ "hasLock", "-", "Property", "returns", "True", "if", "we", "have", "the", "lock", "or", "False", "if", "we", "do", "not", "." ]
train
https://github.com/kata198/NamedAtomicLock/blob/82d480b81daf4deea926964f18bb2e47d4f30f6c/NamedAtomicLock/__init__.py#L208-L231
bodylabs/harrison
harrison/util/inspectlib.py
stack_frame_info
def stack_frame_info(stacklevel): ''' Return a named tuple with information about the given stack frame: - filename - line_number - module_name - function_name stacklevel: How far up the stack to look. 1 means the immediate caller, 2 its caller, and so on. ''' ...
python
def stack_frame_info(stacklevel): ''' Return a named tuple with information about the given stack frame: - filename - line_number - module_name - function_name stacklevel: How far up the stack to look. 1 means the immediate caller, 2 its caller, and so on. ''' ...
[ "def", "stack_frame_info", "(", "stacklevel", ")", ":", "import", "inspect", "if", "stacklevel", "<", "1", ":", "raise", "ValueError", "(", "'A stacklevel less than 1 is pointless'", ")", "frame", ",", "filename", ",", "line_number", ",", "function_name", ",", "_"...
Return a named tuple with information about the given stack frame: - filename - line_number - module_name - function_name stacklevel: How far up the stack to look. 1 means the immediate caller, 2 its caller, and so on.
[ "Return", "a", "named", "tuple", "with", "information", "about", "the", "given", "stack", "frame", ":", "-", "filename", "-", "line_number", "-", "module_name", "-", "function_name" ]
train
https://github.com/bodylabs/harrison/blob/8a05b5c997909a75480b3fccacb2bfff888abfc7/harrison/util/inspectlib.py#L20-L48
bodylabs/harrison
harrison/util/inspectlib.py
Where.pretty
def pretty(self): ''' Return a string like '/foo/bar.py:230 in foo.bar.my_func'. ''' return '{}:{} in {}.{}'.format( self.filename, self.line_number, self.module_name, self.function_name)
python
def pretty(self): ''' Return a string like '/foo/bar.py:230 in foo.bar.my_func'. ''' return '{}:{} in {}.{}'.format( self.filename, self.line_number, self.module_name, self.function_name)
[ "def", "pretty", "(", "self", ")", ":", "return", "'{}:{} in {}.{}'", ".", "format", "(", "self", ".", "filename", ",", "self", ".", "line_number", ",", "self", ".", "module_name", ",", "self", ".", "function_name", ")" ]
Return a string like '/foo/bar.py:230 in foo.bar.my_func'.
[ "Return", "a", "string", "like", "/", "foo", "/", "bar", ".", "py", ":", "230", "in", "foo", ".", "bar", ".", "my_func", "." ]
train
https://github.com/bodylabs/harrison/blob/8a05b5c997909a75480b3fccacb2bfff888abfc7/harrison/util/inspectlib.py#L10-L18
juju/juju-bundlelib
jujubundlelib/validation.py
validate
def validate(bundle): """Validate a bundle object and all of its components. The bundle must be passed as a YAML decoded object. Return a list of bundle errors, or an empty list if the bundle is valid. """ errors = [] add_error = errors.append # Check that the bundle sections are well for...
python
def validate(bundle): """Validate a bundle object and all of its components. The bundle must be passed as a YAML decoded object. Return a list of bundle errors, or an empty list if the bundle is valid. """ errors = [] add_error = errors.append # Check that the bundle sections are well for...
[ "def", "validate", "(", "bundle", ")", ":", "errors", "=", "[", "]", "add_error", "=", "errors", ".", "append", "# Check that the bundle sections are well formed.", "series", ",", "services", ",", "machines", ",", "relations", "=", "_validate_sections", "(", "bund...
Validate a bundle object and all of its components. The bundle must be passed as a YAML decoded object. Return a list of bundle errors, or an empty list if the bundle is valid.
[ "Validate", "a", "bundle", "object", "and", "all", "of", "its", "components", "." ]
train
https://github.com/juju/juju-bundlelib/blob/c2efa614f53675ed9526027776448bfbb0454ca6/jujubundlelib/validation.py#L37-L62
juju/juju-bundlelib
jujubundlelib/validation.py
_validate_sections
def _validate_sections(bundle, add_error): """Check that the base bundle sections are valid. The bundle argument is a YAML decoded bundle content. A bundle is composed of series, services, machines and relations. Only the services section is mandatory. Use the given add_error callable to register...
python
def _validate_sections(bundle, add_error): """Check that the base bundle sections are valid. The bundle argument is a YAML decoded bundle content. A bundle is composed of series, services, machines and relations. Only the services section is mandatory. Use the given add_error callable to register...
[ "def", "_validate_sections", "(", "bundle", ",", "add_error", ")", ":", "# Check that the bundle itself is well formed.", "if", "not", "isdict", "(", "bundle", ")", ":", "add_error", "(", "'bundle does not appear to be a bundle'", ")", "return", "None", ",", "None", "...
Check that the base bundle sections are valid. The bundle argument is a YAML decoded bundle content. A bundle is composed of series, services, machines and relations. Only the services section is mandatory. Use the given add_error callable to register validation error. Return the four sections
[ "Check", "that", "the", "base", "bundle", "sections", "are", "valid", "." ]
train
https://github.com/juju/juju-bundlelib/blob/c2efa614f53675ed9526027776448bfbb0454ca6/jujubundlelib/validation.py#L65-L100
juju/juju-bundlelib
jujubundlelib/validation.py
_validate_series
def _validate_series(series, label, add_error): """Check that the given series is valid. Use the given label (e.g. "machine X" or just "bundle") to describe possible errors. Use the given add_error callable to register validation error. """ if series is None: return if not isstring(...
python
def _validate_series(series, label, add_error): """Check that the given series is valid. Use the given label (e.g. "machine X" or just "bundle") to describe possible errors. Use the given add_error callable to register validation error. """ if series is None: return if not isstring(...
[ "def", "_validate_series", "(", "series", ",", "label", ",", "add_error", ")", ":", "if", "series", "is", "None", ":", "return", "if", "not", "isstring", "(", "series", ")", ":", "add_error", "(", "'{} series must be a string, found {}'", ".", "format", "(", ...
Check that the given series is valid. Use the given label (e.g. "machine X" or just "bundle") to describe possible errors. Use the given add_error callable to register validation error.
[ "Check", "that", "the", "given", "series", "is", "valid", "." ]
train
https://github.com/juju/juju-bundlelib/blob/c2efa614f53675ed9526027776448bfbb0454ca6/jujubundlelib/validation.py#L103-L119
juju/juju-bundlelib
jujubundlelib/validation.py
_validate_services
def _validate_services(services, machines, add_error): """Validate each service within the bundle. Receive the services and machines sections of the bundle. Use the given add_error callable to register validation error. """ machine_ids = set() for service_name, service in services.items(): ...
python
def _validate_services(services, machines, add_error): """Validate each service within the bundle. Receive the services and machines sections of the bundle. Use the given add_error callable to register validation error. """ machine_ids = set() for service_name, service in services.items(): ...
[ "def", "_validate_services", "(", "services", ",", "machines", ",", "add_error", ")", ":", "machine_ids", "=", "set", "(", ")", "for", "service_name", ",", "service", "in", "services", ".", "items", "(", ")", ":", "if", "not", "isstring", "(", "service_nam...
Validate each service within the bundle. Receive the services and machines sections of the bundle. Use the given add_error callable to register validation error.
[ "Validate", "each", "service", "within", "the", "bundle", "." ]
train
https://github.com/juju/juju-bundlelib/blob/c2efa614f53675ed9526027776448bfbb0454ca6/jujubundlelib/validation.py#L122-L165
juju/juju-bundlelib
jujubundlelib/validation.py
_validate_charm
def _validate_charm(url, service_name, add_error): """Validate the given charm URL. Use the given service name to describe possible errors. Use the given add_error callable to register validation error. If the URL is valid, return the corresponding charm reference object. Return None otherwise. ...
python
def _validate_charm(url, service_name, add_error): """Validate the given charm URL. Use the given service name to describe possible errors. Use the given add_error callable to register validation error. If the URL is valid, return the corresponding charm reference object. Return None otherwise. ...
[ "def", "_validate_charm", "(", "url", ",", "service_name", ",", "add_error", ")", ":", "if", "url", "is", "None", ":", "add_error", "(", "'no charm specified for service {}'", ".", "format", "(", "service_name", ")", ")", "return", "None", "if", "not", "isstri...
Validate the given charm URL. Use the given service name to describe possible errors. Use the given add_error callable to register validation error. If the URL is valid, return the corresponding charm reference object. Return None otherwise.
[ "Validate", "the", "given", "charm", "URL", "." ]
train
https://github.com/juju/juju-bundlelib/blob/c2efa614f53675ed9526027776448bfbb0454ca6/jujubundlelib/validation.py#L168-L206
juju/juju-bundlelib
jujubundlelib/validation.py
_validate_num_units
def _validate_num_units(num_units, service_name, add_error): """Check that the given num_units is valid. Use the given service name to describe possible errors. Use the given add_error callable to register validation error. If no errors are encountered, return the number of units as an integer. Re...
python
def _validate_num_units(num_units, service_name, add_error): """Check that the given num_units is valid. Use the given service name to describe possible errors. Use the given add_error callable to register validation error. If no errors are encountered, return the number of units as an integer. Re...
[ "def", "_validate_num_units", "(", "num_units", ",", "service_name", ",", "add_error", ")", ":", "if", "num_units", "is", "None", ":", "# This should be a subordinate charm.", "return", "0", "try", ":", "num_units", "=", "int", "(", "num_units", ")", "except", "...
Check that the given num_units is valid. Use the given service name to describe possible errors. Use the given add_error callable to register validation error. If no errors are encountered, return the number of units as an integer. Return None otherwise.
[ "Check", "that", "the", "given", "num_units", "is", "valid", "." ]
train
https://github.com/juju/juju-bundlelib/blob/c2efa614f53675ed9526027776448bfbb0454ca6/jujubundlelib/validation.py#L209-L232
juju/juju-bundlelib
jujubundlelib/validation.py
_validate_constraints
def _validate_constraints(constraints, label, add_error): """Validate the given service or machine constraints. Use the given label (e.g. "machine X" or "service Y") to describe possible errors. Use the given add_error callable to register validation error. """ if constraints is None: r...
python
def _validate_constraints(constraints, label, add_error): """Validate the given service or machine constraints. Use the given label (e.g. "machine X" or "service Y") to describe possible errors. Use the given add_error callable to register validation error. """ if constraints is None: r...
[ "def", "_validate_constraints", "(", "constraints", ",", "label", ",", "add_error", ")", ":", "if", "constraints", "is", "None", ":", "return", "msg", "=", "'{} has invalid constraints {}'", ".", "format", "(", "label", ",", "constraints", ")", "if", "not", "i...
Validate the given service or machine constraints. Use the given label (e.g. "machine X" or "service Y") to describe possible errors. Use the given add_error callable to register validation error.
[ "Validate", "the", "given", "service", "or", "machine", "constraints", "." ]
train
https://github.com/juju/juju-bundlelib/blob/c2efa614f53675ed9526027776448bfbb0454ca6/jujubundlelib/validation.py#L235-L256
juju/juju-bundlelib
jujubundlelib/validation.py
_validate_storage
def _validate_storage(storage, service_name, add_error): """Lazily validate the storage constraints, ensuring that they are a dict. Use the given add_error callable to register validation error. """ if storage is None: return if not isdict(storage): msg = 'service {} has invalid sto...
python
def _validate_storage(storage, service_name, add_error): """Lazily validate the storage constraints, ensuring that they are a dict. Use the given add_error callable to register validation error. """ if storage is None: return if not isdict(storage): msg = 'service {} has invalid sto...
[ "def", "_validate_storage", "(", "storage", ",", "service_name", ",", "add_error", ")", ":", "if", "storage", "is", "None", ":", "return", "if", "not", "isdict", "(", "storage", ")", ":", "msg", "=", "'service {} has invalid storage constraints {}'", ".", "forma...
Lazily validate the storage constraints, ensuring that they are a dict. Use the given add_error callable to register validation error.
[ "Lazily", "validate", "the", "storage", "constraints", "ensuring", "that", "they", "are", "a", "dict", "." ]
train
https://github.com/juju/juju-bundlelib/blob/c2efa614f53675ed9526027776448bfbb0454ca6/jujubundlelib/validation.py#L259-L269
juju/juju-bundlelib
jujubundlelib/validation.py
_validate_options
def _validate_options(options, service_name, add_error): """Lazily validate the options, ensuring that they are a dict. Use the given add_error callable to register validation error. """ if options is None: return if not isdict(options): add_error('service {} has malformed options'....
python
def _validate_options(options, service_name, add_error): """Lazily validate the options, ensuring that they are a dict. Use the given add_error callable to register validation error. """ if options is None: return if not isdict(options): add_error('service {} has malformed options'....
[ "def", "_validate_options", "(", "options", ",", "service_name", ",", "add_error", ")", ":", "if", "options", "is", "None", ":", "return", "if", "not", "isdict", "(", "options", ")", ":", "add_error", "(", "'service {} has malformed options'", ".", "format", "...
Lazily validate the options, ensuring that they are a dict. Use the given add_error callable to register validation error.
[ "Lazily", "validate", "the", "options", "ensuring", "that", "they", "are", "a", "dict", "." ]
train
https://github.com/juju/juju-bundlelib/blob/c2efa614f53675ed9526027776448bfbb0454ca6/jujubundlelib/validation.py#L272-L280
juju/juju-bundlelib
jujubundlelib/validation.py
_validate_annotations
def _validate_annotations(annotations, label, add_error): """Check that the given service or machine annotations are valid. Use the given label (e.g. "machine X" or "service Y") to describe possible errors. Use the given add_error callable to register validation error. """ if annotations is Non...
python
def _validate_annotations(annotations, label, add_error): """Check that the given service or machine annotations are valid. Use the given label (e.g. "machine X" or "service Y") to describe possible errors. Use the given add_error callable to register validation error. """ if annotations is Non...
[ "def", "_validate_annotations", "(", "annotations", ",", "label", ",", "add_error", ")", ":", "if", "annotations", "is", "None", ":", "return", "if", "not", "isdict", "(", "annotations", ")", ":", "add_error", "(", "'{} has invalid annotations {}'", ".", "format...
Check that the given service or machine annotations are valid. Use the given label (e.g. "machine X" or "service Y") to describe possible errors. Use the given add_error callable to register validation error.
[ "Check", "that", "the", "given", "service", "or", "machine", "annotations", "are", "valid", "." ]
train
https://github.com/juju/juju-bundlelib/blob/c2efa614f53675ed9526027776448bfbb0454ca6/jujubundlelib/validation.py#L283-L298
juju/juju-bundlelib
jujubundlelib/validation.py
_validate_placement
def _validate_placement(placement, services, machines, charm, add_error): """Validate a placement directive against other services. Receive the placement (possibly as a string), the services and machines bundle sections, the corresponding charm (or None if invalid) and the add_error callable used to re...
python
def _validate_placement(placement, services, machines, charm, add_error): """Validate a placement directive against other services. Receive the placement (possibly as a string), the services and machines bundle sections, the corresponding charm (or None if invalid) and the add_error callable used to re...
[ "def", "_validate_placement", "(", "placement", ",", "services", ",", "machines", ",", "charm", ",", "add_error", ")", ":", "if", "not", "isstring", "(", "placement", ")", ":", "add_error", "(", "'invalid placement {}: placement must be a string'", "''", ".", "for...
Validate a placement directive against other services. Receive the placement (possibly as a string), the services and machines bundle sections, the corresponding charm (or None if invalid) and the add_error callable used to register validation errors. If applicable, also validate the placement of othe...
[ "Validate", "a", "placement", "directive", "against", "other", "services", "." ]
train
https://github.com/juju/juju-bundlelib/blob/c2efa614f53675ed9526027776448bfbb0454ca6/jujubundlelib/validation.py#L301-L382
juju/juju-bundlelib
jujubundlelib/validation.py
_validate_machines
def _validate_machines(machines, add_error): """Validate the given machines section. Validation includes machines constraints, series and annotations. Use the given add_error callable to register validation error. """ if not machines: return for machine_id, machine in machines.items(): ...
python
def _validate_machines(machines, add_error): """Validate the given machines section. Validation includes machines constraints, series and annotations. Use the given add_error callable to register validation error. """ if not machines: return for machine_id, machine in machines.items(): ...
[ "def", "_validate_machines", "(", "machines", ",", "add_error", ")", ":", "if", "not", "machines", ":", "return", "for", "machine_id", ",", "machine", "in", "machines", ".", "items", "(", ")", ":", "if", "machine_id", "<", "0", ":", "add_error", "(", "'m...
Validate the given machines section. Validation includes machines constraints, series and annotations. Use the given add_error callable to register validation error.
[ "Validate", "the", "given", "machines", "section", "." ]
train
https://github.com/juju/juju-bundlelib/blob/c2efa614f53675ed9526027776448bfbb0454ca6/jujubundlelib/validation.py#L385-L408
juju/juju-bundlelib
jujubundlelib/validation.py
_validate_relations
def _validate_relations(relations, services, add_error): """Validate relations, ensuring that the endpoints exist. Receive the relations and services bundle sections. Use the given add_error callable to register validation error. """ if not relations: return for relation in relations: ...
python
def _validate_relations(relations, services, add_error): """Validate relations, ensuring that the endpoints exist. Receive the relations and services bundle sections. Use the given add_error callable to register validation error. """ if not relations: return for relation in relations: ...
[ "def", "_validate_relations", "(", "relations", ",", "services", ",", "add_error", ")", ":", "if", "not", "relations", ":", "return", "for", "relation", "in", "relations", ":", "if", "not", "islist", "(", "relation", ")", ":", "add_error", "(", "'relation {}...
Validate relations, ensuring that the endpoints exist. Receive the relations and services bundle sections. Use the given add_error callable to register validation error.
[ "Validate", "relations", "ensuring", "that", "the", "endpoints", "exist", "." ]
train
https://github.com/juju/juju-bundlelib/blob/c2efa614f53675ed9526027776448bfbb0454ca6/jujubundlelib/validation.py#L411-L437