partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | Catalog.tagsOf | Return an iterator of unicode strings - the tag names which apply to
the given object. | axiom/tags.py | def tagsOf(self, obj):
"""
Return an iterator of unicode strings - the tag names which apply to
the given object.
"""
return self.store.query(
Tag,
AND(Tag.catalog == self,
Tag.object == obj)).getColumn("name") | def tagsOf(self, obj):
"""
Return an iterator of unicode strings - the tag names which apply to
the given object.
"""
return self.store.query(
Tag,
AND(Tag.catalog == self,
Tag.object == obj)).getColumn("name") | [
"Return",
"an",
"iterator",
"of",
"unicode",
"strings",
"-",
"the",
"tag",
"names",
"which",
"apply",
"to",
"the",
"given",
"object",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/tags.py#L91-L99 | [
"def",
"tagsOf",
"(",
"self",
",",
"obj",
")",
":",
"return",
"self",
".",
"store",
".",
"query",
"(",
"Tag",
",",
"AND",
"(",
"Tag",
".",
"catalog",
"==",
"self",
",",
"Tag",
".",
"object",
"==",
"obj",
")",
")",
".",
"getColumn",
"(",
"\"name\"... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | SQLAttribute.loaded | This method is invoked when the item is loaded from the database, and
when a transaction is reverted which restores this attribute's value.
@param oself: an instance of an item which has this attribute.
@param dbval: the underlying database value which was retrieved. | axiom/attributes.py | def loaded(self, oself, dbval):
"""
This method is invoked when the item is loaded from the database, and
when a transaction is reverted which restores this attribute's value.
@param oself: an instance of an item which has this attribute.
@param dbval: the underlying database v... | def loaded(self, oself, dbval):
"""
This method is invoked when the item is loaded from the database, and
when a transaction is reverted which restores this attribute's value.
@param oself: an instance of an item which has this attribute.
@param dbval: the underlying database v... | [
"This",
"method",
"is",
"invoked",
"when",
"the",
"item",
"is",
"loaded",
"from",
"the",
"database",
"and",
"when",
"a",
"transaction",
"is",
"reverted",
"which",
"restores",
"this",
"attribute",
"s",
"value",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/attributes.py#L459-L469 | [
"def",
"loaded",
"(",
"self",
",",
"oself",
",",
"dbval",
")",
":",
"setattr",
"(",
"oself",
",",
"self",
".",
"dbunderlying",
",",
"dbval",
")",
"delattr",
"(",
"oself",
",",
"self",
".",
"underlying",
")"
] | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | SQLAttribute._convertPyval | Convert a Python value to a value suitable for inserting into the
database.
@param oself: The object on which this descriptor is an attribute.
@param pyval: The value to be converted.
@return: A value legal for this column in the database. | axiom/attributes.py | def _convertPyval(self, oself, pyval):
"""
Convert a Python value to a value suitable for inserting into the
database.
@param oself: The object on which this descriptor is an attribute.
@param pyval: The value to be converted.
@return: A value legal for this column in th... | def _convertPyval(self, oself, pyval):
"""
Convert a Python value to a value suitable for inserting into the
database.
@param oself: The object on which this descriptor is an attribute.
@param pyval: The value to be converted.
@return: A value legal for this column in th... | [
"Convert",
"a",
"Python",
"value",
"to",
"a",
"value",
"suitable",
"for",
"inserting",
"into",
"the",
"database",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/attributes.py#L473-L487 | [
"def",
"_convertPyval",
"(",
"self",
",",
"oself",
",",
"pyval",
")",
":",
"# convert to dbval later, I guess?",
"if",
"pyval",
"is",
"None",
"and",
"not",
"self",
".",
"allowNone",
":",
"raise",
"TypeError",
"(",
"\"attribute [%s.%s = %s()] must not be None\"",
"%"... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | SequenceComparison._queryContainer | Generate and cache the subselect SQL and its arguments. Return the
subselect SQL. | axiom/attributes.py | def _queryContainer(self, store):
"""
Generate and cache the subselect SQL and its arguments. Return the
subselect SQL.
"""
if self._subselectSQL is None:
sql, args = self.container._sqlAndArgs('SELECT',
self.contain... | def _queryContainer(self, store):
"""
Generate and cache the subselect SQL and its arguments. Return the
subselect SQL.
"""
if self._subselectSQL is None:
sql, args = self.container._sqlAndArgs('SELECT',
self.contain... | [
"Generate",
"and",
"cache",
"the",
"subselect",
"SQL",
"and",
"its",
"arguments",
".",
"Return",
"the",
"subselect",
"SQL",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/attributes.py#L729-L738 | [
"def",
"_queryContainer",
"(",
"self",
",",
"store",
")",
":",
"if",
"self",
".",
"_subselectSQL",
"is",
"None",
":",
"sql",
",",
"args",
"=",
"self",
".",
"container",
".",
"_sqlAndArgs",
"(",
"'SELECT'",
",",
"self",
".",
"container",
".",
"_queryTarge... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | SequenceComparison._sequenceContainer | Smash whatever we got into a list and save the result in case we are
executed multiple times. This keeps us from tripping up over
generators and the like. | axiom/attributes.py | def _sequenceContainer(self, store):
"""
Smash whatever we got into a list and save the result in case we are
executed multiple times. This keeps us from tripping up over
generators and the like.
"""
if self._sequence is None:
self._sequence = list(self.conta... | def _sequenceContainer(self, store):
"""
Smash whatever we got into a list and save the result in case we are
executed multiple times. This keeps us from tripping up over
generators and the like.
"""
if self._sequence is None:
self._sequence = list(self.conta... | [
"Smash",
"whatever",
"we",
"got",
"into",
"a",
"list",
"and",
"save",
"the",
"result",
"in",
"case",
"we",
"are",
"executed",
"multiple",
"times",
".",
"This",
"keeps",
"us",
"from",
"tripping",
"up",
"over",
"generators",
"and",
"the",
"like",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/attributes.py#L751-L760 | [
"def",
"_sequenceContainer",
"(",
"self",
",",
"store",
")",
":",
"if",
"self",
".",
"_sequence",
"is",
"None",
":",
"self",
".",
"_sequence",
"=",
"list",
"(",
"self",
".",
"container",
")",
"self",
".",
"_clause",
"=",
"', '",
".",
"join",
"(",
"["... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | SequenceComparison._sequenceArgs | Filter each element of the data using the attribute type being
tested for containment and hand back the resulting list. | axiom/attributes.py | def _sequenceArgs(self, store):
"""
Filter each element of the data using the attribute type being
tested for containment and hand back the resulting list.
"""
self._sequenceContainer(store) # Force _sequence to be valid
return [self.attribute.infilter(pyval, None, store)... | def _sequenceArgs(self, store):
"""
Filter each element of the data using the attribute type being
tested for containment and hand back the resulting list.
"""
self._sequenceContainer(store) # Force _sequence to be valid
return [self.attribute.infilter(pyval, None, store)... | [
"Filter",
"each",
"element",
"of",
"the",
"data",
"using",
"the",
"attribute",
"type",
"being",
"tested",
"for",
"containment",
"and",
"hand",
"back",
"the",
"resulting",
"list",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/attributes.py#L763-L769 | [
"def",
"_sequenceArgs",
"(",
"self",
",",
"store",
")",
":",
"self",
".",
"_sequenceContainer",
"(",
"store",
")",
"# Force _sequence to be valid",
"return",
"[",
"self",
".",
"attribute",
".",
"infilter",
"(",
"pyval",
",",
"None",
",",
"store",
")",
"for",... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | path.prepareInsert | Prepare for insertion into the database by making the dbunderlying
attribute of the item a relative pathname with respect to the store
rather than an absolute pathname. | axiom/attributes.py | def prepareInsert(self, oself, store):
"""
Prepare for insertion into the database by making the dbunderlying
attribute of the item a relative pathname with respect to the store
rather than an absolute pathname.
"""
if self.relative:
fspath = self.__get__(osel... | def prepareInsert(self, oself, store):
"""
Prepare for insertion into the database by making the dbunderlying
attribute of the item a relative pathname with respect to the store
rather than an absolute pathname.
"""
if self.relative:
fspath = self.__get__(osel... | [
"Prepare",
"for",
"insertion",
"into",
"the",
"database",
"by",
"making",
"the",
"dbunderlying",
"attribute",
"of",
"the",
"item",
"a",
"relative",
"pathname",
"with",
"respect",
"to",
"the",
"store",
"rather",
"than",
"an",
"absolute",
"pathname",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/attributes.py#L1021-L1029 | [
"def",
"prepareInsert",
"(",
"self",
",",
"oself",
",",
"store",
")",
":",
"if",
"self",
".",
"relative",
":",
"fspath",
"=",
"self",
".",
"__get__",
"(",
"oself",
")",
"oself",
".",
"__dirty__",
"[",
"self",
".",
"attrname",
"]",
"=",
"self",
",",
... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | SoftDeletable.restore | Undeletes the object. Returns True if undeleted, False if it was already not deleted | djangodeletes/softdeletes/models.py | def restore(self, time=None):
"""
Undeletes the object. Returns True if undeleted, False if it was already not deleted
"""
if self.deleted:
time = time if time else self.deleted_at
if time == self.deleted_at:
self.deleted = False
se... | def restore(self, time=None):
"""
Undeletes the object. Returns True if undeleted, False if it was already not deleted
"""
if self.deleted:
time = time if time else self.deleted_at
if time == self.deleted_at:
self.deleted = False
se... | [
"Undeletes",
"the",
"object",
".",
"Returns",
"True",
"if",
"undeleted",
"False",
"if",
"it",
"was",
"already",
"not",
"deleted"
] | upgrad/django-deletes | python | https://github.com/upgrad/django-deletes/blob/05cebc3323840badc67b926ec1ba2640d6cd12be/djangodeletes/softdeletes/models.py#L97-L109 | [
"def",
"restore",
"(",
"self",
",",
"time",
"=",
"None",
")",
":",
"if",
"self",
".",
"deleted",
":",
"time",
"=",
"time",
"if",
"time",
"else",
"self",
".",
"deleted_at",
"if",
"time",
"==",
"self",
".",
"deleted_at",
":",
"self",
".",
"deleted",
... | 05cebc3323840badc67b926ec1ba2640d6cd12be |
train | SoftDeletable.full_restore | Restores itself, as well as objects that might have been deleted along with it if cascade is the deletion strategy | djangodeletes/softdeletes/models.py | def full_restore(self, using=None):
using = using or router.db_for_write(self.__class__, instance=self)
restore_counter = Counter()
if self.deleted:
time = self.deleted_at
else:
return restore_counter
self.collector = models.deletion.Collector(using=using)... | def full_restore(self, using=None):
using = using or router.db_for_write(self.__class__, instance=self)
restore_counter = Counter()
if self.deleted:
time = self.deleted_at
else:
return restore_counter
self.collector = models.deletion.Collector(using=using)... | [
"Restores",
"itself",
"as",
"well",
"as",
"objects",
"that",
"might",
"have",
"been",
"deleted",
"along",
"with",
"it",
"if",
"cascade",
"is",
"the",
"deletion",
"strategy"
] | upgrad/django-deletes | python | https://github.com/upgrad/django-deletes/blob/05cebc3323840badc67b926ec1ba2640d6cd12be/djangodeletes/softdeletes/models.py#L111-L144 | [
"def",
"full_restore",
"(",
"self",
",",
"using",
"=",
"None",
")",
":",
"using",
"=",
"using",
"or",
"router",
".",
"db_for_write",
"(",
"self",
".",
"__class__",
",",
"instance",
"=",
"self",
")",
"restore_counter",
"=",
"Counter",
"(",
")",
"if",
"s... | 05cebc3323840badc67b926ec1ba2640d6cd12be |
train | connect_to_ec2 | Connect to AWS ec2
:type region: str
:param region: AWS region to connect to
:type access_key: str
:param access_key: AWS access key id
:type secret_key: str
:param secret_key: AWS secret access key
:returns: boto.ec2.connection.EC2Connection -- EC2 connection | automated_ebs_snapshots/connection_manager.py | def connect_to_ec2(region='us-east-1', access_key=None, secret_key=None):
""" Connect to AWS ec2
:type region: str
:param region: AWS region to connect to
:type access_key: str
:param access_key: AWS access key id
:type secret_key: str
:param secret_key: AWS secret access key
:returns: ... | def connect_to_ec2(region='us-east-1', access_key=None, secret_key=None):
""" Connect to AWS ec2
:type region: str
:param region: AWS region to connect to
:type access_key: str
:param access_key: AWS access key id
:type secret_key: str
:param secret_key: AWS secret access key
:returns: ... | [
"Connect",
"to",
"AWS",
"ec2"
] | skymill/automated-ebs-snapshots | python | https://github.com/skymill/automated-ebs-snapshots/blob/9595bc49d458f6ffb93430722757d2284e878fab/automated_ebs_snapshots/connection_manager.py#L11-L47 | [
"def",
"connect_to_ec2",
"(",
"region",
"=",
"'us-east-1'",
",",
"access_key",
"=",
"None",
",",
"secret_key",
"=",
"None",
")",
":",
"if",
"access_key",
":",
"# Connect using supplied credentials",
"logger",
".",
"info",
"(",
"'Connecting to AWS EC2 in {}'",
".",
... | 9595bc49d458f6ffb93430722757d2284e878fab |
train | DictParser.parse | Find stems for a given text. | pymorfologik/parsing.py | def parse(self, output):
"""
Find stems for a given text.
"""
output = self._get_lines_with_stems(output)
words = self._make_unique(output)
return self._parse_for_simple_stems(words) | def parse(self, output):
"""
Find stems for a given text.
"""
output = self._get_lines_with_stems(output)
words = self._make_unique(output)
return self._parse_for_simple_stems(words) | [
"Find",
"stems",
"for",
"a",
"given",
"text",
"."
] | dmirecki/pyMorfologik | python | https://github.com/dmirecki/pyMorfologik/blob/e4d93a82e8b4c7a108f01e0456fbeb8024df0259/pymorfologik/parsing.py#L47-L53 | [
"def",
"parse",
"(",
"self",
",",
"output",
")",
":",
"output",
"=",
"self",
".",
"_get_lines_with_stems",
"(",
"output",
")",
"words",
"=",
"self",
".",
"_make_unique",
"(",
"output",
")",
"return",
"self",
".",
"_parse_for_simple_stems",
"(",
"words",
")... | e4d93a82e8b4c7a108f01e0456fbeb8024df0259 |
train | Locations.validlocations | Read valid locations from HDX
Args:
configuration (Optional[Configuration]): HDX configuration. Defaults to global configuration.
Returns:
List[Dict]: A list of valid locations | src/hdx/hdx_locations.py | def validlocations(configuration=None):
# type: () -> List[Dict]
"""
Read valid locations from HDX
Args:
configuration (Optional[Configuration]): HDX configuration. Defaults to global configuration.
Returns:
List[Dict]: A list of valid locations
... | def validlocations(configuration=None):
# type: () -> List[Dict]
"""
Read valid locations from HDX
Args:
configuration (Optional[Configuration]): HDX configuration. Defaults to global configuration.
Returns:
List[Dict]: A list of valid locations
... | [
"Read",
"valid",
"locations",
"from",
"HDX"
] | OCHA-DAP/hdx-python-api | python | https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/hdx_locations.py#L14-L29 | [
"def",
"validlocations",
"(",
"configuration",
"=",
"None",
")",
":",
"# type: () -> List[Dict]",
"if",
"Locations",
".",
"_validlocations",
"is",
"None",
":",
"if",
"configuration",
"is",
"None",
":",
"configuration",
"=",
"Configuration",
".",
"read",
"(",
")"... | 212440f54f73805826a16db77dbcb6033b18a313 |
train | Locations.get_location_from_HDX_code | Get location from HDX location code
Args:
code (str): code for which to get location name
locations (Optional[List[Dict]]): Valid locations list. Defaults to list downloaded from HDX.
configuration (Optional[Configuration]): HDX configuration. Defaults to global configuratio... | src/hdx/hdx_locations.py | def get_location_from_HDX_code(code, locations=None, configuration=None):
# type: (str, Optional[List[Dict]], Optional[Configuration]) -> Optional[str]
"""Get location from HDX location code
Args:
code (str): code for which to get location name
locations (Optional[List[D... | def get_location_from_HDX_code(code, locations=None, configuration=None):
# type: (str, Optional[List[Dict]], Optional[Configuration]) -> Optional[str]
"""Get location from HDX location code
Args:
code (str): code for which to get location name
locations (Optional[List[D... | [
"Get",
"location",
"from",
"HDX",
"location",
"code"
] | OCHA-DAP/hdx-python-api | python | https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/hdx_locations.py#L46-L63 | [
"def",
"get_location_from_HDX_code",
"(",
"code",
",",
"locations",
"=",
"None",
",",
"configuration",
"=",
"None",
")",
":",
"# type: (str, Optional[List[Dict]], Optional[Configuration]) -> Optional[str]",
"if",
"locations",
"is",
"None",
":",
"locations",
"=",
"Location... | 212440f54f73805826a16db77dbcb6033b18a313 |
train | Locations.get_HDX_code_from_location | Get HDX code for location
Args:
location (str): Location for which to get HDX code
locations (Optional[List[Dict]]): Valid locations list. Defaults to list downloaded from HDX.
configuration (Optional[Configuration]): HDX configuration. Defaults to global configuration.
... | src/hdx/hdx_locations.py | def get_HDX_code_from_location(location, locations=None, configuration=None):
# type: (str, Optional[List[Dict]], Optional[Configuration]) -> Optional[str]
"""Get HDX code for location
Args:
location (str): Location for which to get HDX code
locations (Optional[List[Dict... | def get_HDX_code_from_location(location, locations=None, configuration=None):
# type: (str, Optional[List[Dict]], Optional[Configuration]) -> Optional[str]
"""Get HDX code for location
Args:
location (str): Location for which to get HDX code
locations (Optional[List[Dict... | [
"Get",
"HDX",
"code",
"for",
"location"
] | OCHA-DAP/hdx-python-api | python | https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/hdx_locations.py#L66-L89 | [
"def",
"get_HDX_code_from_location",
"(",
"location",
",",
"locations",
"=",
"None",
",",
"configuration",
"=",
"None",
")",
":",
"# type: (str, Optional[List[Dict]], Optional[Configuration]) -> Optional[str]",
"if",
"locations",
"is",
"None",
":",
"locations",
"=",
"Loca... | 212440f54f73805826a16db77dbcb6033b18a313 |
train | Locations.get_HDX_code_from_location_partial | Get HDX code for location
Args:
location (str): Location for which to get HDX code
locations (Optional[List[Dict]]): Valid locations list. Defaults to list downloaded from HDX.
configuration (Optional[Configuration]): HDX configuration. Defaults to global configuration.
... | src/hdx/hdx_locations.py | def get_HDX_code_from_location_partial(location, locations=None, configuration=None):
# type: (str, Optional[List[Dict]], Optional[Configuration]) -> Tuple[Optional[str], bool]
"""Get HDX code for location
Args:
location (str): Location for which to get HDX code
location... | def get_HDX_code_from_location_partial(location, locations=None, configuration=None):
# type: (str, Optional[List[Dict]], Optional[Configuration]) -> Tuple[Optional[str], bool]
"""Get HDX code for location
Args:
location (str): Location for which to get HDX code
location... | [
"Get",
"HDX",
"code",
"for",
"location"
] | OCHA-DAP/hdx-python-api | python | https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/hdx_locations.py#L92-L117 | [
"def",
"get_HDX_code_from_location_partial",
"(",
"location",
",",
"locations",
"=",
"None",
",",
"configuration",
"=",
"None",
")",
":",
"# type: (str, Optional[List[Dict]], Optional[Configuration]) -> Tuple[Optional[str], bool]",
"hdx_code",
"=",
"Locations",
".",
"get_HDX_co... | 212440f54f73805826a16db77dbcb6033b18a313 |
train | Main | The main program function.
Returns:
bool: True if successful or False if not. | scripts/validate-definitions.py | def Main():
"""The main program function.
Returns:
bool: True if successful or False if not.
"""
argument_parser = argparse.ArgumentParser(
description='Validates dtFabric format definitions.')
argument_parser.add_argument(
'source', nargs='?', action='store', metavar='PATH', default=None,
... | def Main():
"""The main program function.
Returns:
bool: True if successful or False if not.
"""
argument_parser = argparse.ArgumentParser(
description='Validates dtFabric format definitions.')
argument_parser.add_argument(
'source', nargs='?', action='store', metavar='PATH', default=None,
... | [
"The",
"main",
"program",
"function",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/scripts/validate-definitions.py#L77-L130 | [
"def",
"Main",
"(",
")",
":",
"argument_parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Validates dtFabric format definitions.'",
")",
"argument_parser",
".",
"add_argument",
"(",
"'source'",
",",
"nargs",
"=",
"'?'",
",",
"action",
"="... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DefinitionsValidator.CheckDirectory | Validates definition files in a directory.
Args:
path (str): path of the definition file.
extension (Optional[str]): extension of the filenames to read.
Returns:
bool: True if the directory contains valid definitions. | scripts/validate-definitions.py | def CheckDirectory(self, path, extension='yaml'):
"""Validates definition files in a directory.
Args:
path (str): path of the definition file.
extension (Optional[str]): extension of the filenames to read.
Returns:
bool: True if the directory contains valid definitions.
"""
resul... | def CheckDirectory(self, path, extension='yaml'):
"""Validates definition files in a directory.
Args:
path (str): path of the definition file.
extension (Optional[str]): extension of the filenames to read.
Returns:
bool: True if the directory contains valid definitions.
"""
resul... | [
"Validates",
"definition",
"files",
"in",
"a",
"directory",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/scripts/validate-definitions.py#L22-L43 | [
"def",
"CheckDirectory",
"(",
"self",
",",
"path",
",",
"extension",
"=",
"'yaml'",
")",
":",
"result",
"=",
"True",
"if",
"extension",
":",
"glob_spec",
"=",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"'*.{0:s}'",
".",
"format",
"(",
"extension... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DefinitionsValidator.CheckFile | Validates the definition in a file.
Args:
path (str): path of the definition file.
Returns:
bool: True if the file contains valid definitions. | scripts/validate-definitions.py | def CheckFile(self, path):
"""Validates the definition in a file.
Args:
path (str): path of the definition file.
Returns:
bool: True if the file contains valid definitions.
"""
print('Checking: {0:s}'.format(path))
definitions_registry = registry.DataTypeDefinitionsRegistry()
... | def CheckFile(self, path):
"""Validates the definition in a file.
Args:
path (str): path of the definition file.
Returns:
bool: True if the file contains valid definitions.
"""
print('Checking: {0:s}'.format(path))
definitions_registry = registry.DataTypeDefinitionsRegistry()
... | [
"Validates",
"the",
"definition",
"in",
"a",
"file",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/scripts/validate-definitions.py#L45-L74 | [
"def",
"CheckFile",
"(",
"self",
",",
"path",
")",
":",
"print",
"(",
"'Checking: {0:s}'",
".",
"format",
"(",
"path",
")",
")",
"definitions_registry",
"=",
"registry",
".",
"DataTypeDefinitionsRegistry",
"(",
")",
"definitions_reader",
"=",
"reader",
".",
"Y... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | Conversion.styleattribute | returns css.CSSStyleDeclaration of inline styles, for html: @style | inlinestyler/converter.py | def styleattribute(self, element):
"""
returns css.CSSStyleDeclaration of inline styles, for html: @style
"""
css_text = element.get('style')
if css_text:
return cssutils.css.CSSStyleDeclaration(cssText=css_text)
else:
return None | def styleattribute(self, element):
"""
returns css.CSSStyleDeclaration of inline styles, for html: @style
"""
css_text = element.get('style')
if css_text:
return cssutils.css.CSSStyleDeclaration(cssText=css_text)
else:
return None | [
"returns",
"css",
".",
"CSSStyleDeclaration",
"of",
"inline",
"styles",
"for",
"html",
":"
] | dlanger/inlinestyler | python | https://github.com/dlanger/inlinestyler/blob/335c4fbab892f0ed67466a6beaea6a91f395ad12/inlinestyler/converter.py#L66-L74 | [
"def",
"styleattribute",
"(",
"self",
",",
"element",
")",
":",
"css_text",
"=",
"element",
".",
"get",
"(",
"'style'",
")",
"if",
"css_text",
":",
"return",
"cssutils",
".",
"css",
".",
"CSSStyleDeclaration",
"(",
"cssText",
"=",
"css_text",
")",
"else",
... | 335c4fbab892f0ed67466a6beaea6a91f395ad12 |
train | get_configuration | Read configuration file
:type filename: str
:param filename: Path to the configuration file | automated_ebs_snapshots/config_file_parser.py | def get_configuration(filename):
""" Read configuration file
:type filename: str
:param filename: Path to the configuration file
"""
logger.debug('Reading configuration from {}'.format(filename))
conf = SafeConfigParser()
conf.read(filename)
if not conf:
logger.error('Configura... | def get_configuration(filename):
""" Read configuration file
:type filename: str
:param filename: Path to the configuration file
"""
logger.debug('Reading configuration from {}'.format(filename))
conf = SafeConfigParser()
conf.read(filename)
if not conf:
logger.error('Configura... | [
"Read",
"configuration",
"file"
] | skymill/automated-ebs-snapshots | python | https://github.com/skymill/automated-ebs-snapshots/blob/9595bc49d458f6ffb93430722757d2284e878fab/automated_ebs_snapshots/config_file_parser.py#L9-L37 | [
"def",
"get_configuration",
"(",
"filename",
")",
":",
"logger",
".",
"debug",
"(",
"'Reading configuration from {}'",
".",
"format",
"(",
"filename",
")",
")",
"conf",
"=",
"SafeConfigParser",
"(",
")",
"conf",
".",
"read",
"(",
"filename",
")",
"if",
"not"... | 9595bc49d458f6ffb93430722757d2284e878fab |
train | inline_css | Inlines all CSS in an HTML string
Given an HTML document with CSS declared in the HEAD, inlines it into the
applicable elements. Used primarily in the preparation of styled emails.
Arguments:
html_message -- a string of HTML, including CSS | inlinestyler/utils.py | def inline_css(html_message, encoding='unicode'):
"""
Inlines all CSS in an HTML string
Given an HTML document with CSS declared in the HEAD, inlines it into the
applicable elements. Used primarily in the preparation of styled emails.
Arguments:
html_message -- a string of HTML, including ... | def inline_css(html_message, encoding='unicode'):
"""
Inlines all CSS in an HTML string
Given an HTML document with CSS declared in the HEAD, inlines it into the
applicable elements. Used primarily in the preparation of styled emails.
Arguments:
html_message -- a string of HTML, including ... | [
"Inlines",
"all",
"CSS",
"in",
"an",
"HTML",
"string"
] | dlanger/inlinestyler | python | https://github.com/dlanger/inlinestyler/blob/335c4fbab892f0ed67466a6beaea6a91f395ad12/inlinestyler/utils.py#L4-L18 | [
"def",
"inline_css",
"(",
"html_message",
",",
"encoding",
"=",
"'unicode'",
")",
":",
"document",
"=",
"etree",
".",
"HTML",
"(",
"html_message",
")",
"converter",
"=",
"Conversion",
"(",
")",
"converter",
".",
"perform",
"(",
"document",
",",
"html_message... | 335c4fbab892f0ed67466a6beaea6a91f395ad12 |
train | StorageDataTypeMap._CheckByteStreamSize | Checks if the byte stream is large enough for the data type.
Args:
byte_stream (bytes): byte stream.
byte_offset (int): offset into the byte stream where to start.
data_type_size (int): data type size.
Raises:
ByteStreamTooSmallError: if the byte stream is too small.
MappingError... | dtfabric/runtime/data_maps.py | def _CheckByteStreamSize(self, byte_stream, byte_offset, data_type_size):
"""Checks if the byte stream is large enough for the data type.
Args:
byte_stream (bytes): byte stream.
byte_offset (int): offset into the byte stream where to start.
data_type_size (int): data type size.
Raises:
... | def _CheckByteStreamSize(self, byte_stream, byte_offset, data_type_size):
"""Checks if the byte stream is large enough for the data type.
Args:
byte_stream (bytes): byte stream.
byte_offset (int): offset into the byte stream where to start.
data_type_size (int): data type size.
Raises:
... | [
"Checks",
"if",
"the",
"byte",
"stream",
"is",
"large",
"enough",
"for",
"the",
"data",
"type",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L149-L170 | [
"def",
"_CheckByteStreamSize",
"(",
"self",
",",
"byte_stream",
",",
"byte_offset",
",",
"data_type_size",
")",
":",
"try",
":",
"byte_stream_size",
"=",
"len",
"(",
"byte_stream",
")",
"except",
"Exception",
"as",
"exception",
":",
"raise",
"errors",
".",
"Ma... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | StorageDataTypeMap._GetByteStreamOperation | Retrieves the byte stream operation.
Returns:
ByteStreamOperation: byte stream operation or None if unable to determine. | dtfabric/runtime/data_maps.py | def _GetByteStreamOperation(self):
"""Retrieves the byte stream operation.
Returns:
ByteStreamOperation: byte stream operation or None if unable to determine.
"""
byte_order_string = self.GetStructByteOrderString()
format_string = self.GetStructFormatString() # pylint: disable=assignment-fro... | def _GetByteStreamOperation(self):
"""Retrieves the byte stream operation.
Returns:
ByteStreamOperation: byte stream operation or None if unable to determine.
"""
byte_order_string = self.GetStructByteOrderString()
format_string = self.GetStructFormatString() # pylint: disable=assignment-fro... | [
"Retrieves",
"the",
"byte",
"stream",
"operation",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L172-L184 | [
"def",
"_GetByteStreamOperation",
"(",
"self",
")",
":",
"byte_order_string",
"=",
"self",
".",
"GetStructByteOrderString",
"(",
")",
"format_string",
"=",
"self",
".",
"GetStructFormatString",
"(",
")",
"# pylint: disable=assignment-from-none",
"if",
"not",
"format_str... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | StorageDataTypeMap.GetStructByteOrderString | Retrieves the Python struct format string.
Returns:
str: format string as used by Python struct or None if format string
cannot be determined. | dtfabric/runtime/data_maps.py | def GetStructByteOrderString(self):
"""Retrieves the Python struct format string.
Returns:
str: format string as used by Python struct or None if format string
cannot be determined.
"""
if not self._data_type_definition:
return None
return self._BYTE_ORDER_STRINGS.get(
... | def GetStructByteOrderString(self):
"""Retrieves the Python struct format string.
Returns:
str: format string as used by Python struct or None if format string
cannot be determined.
"""
if not self._data_type_definition:
return None
return self._BYTE_ORDER_STRINGS.get(
... | [
"Retrieves",
"the",
"Python",
"struct",
"format",
"string",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L186-L197 | [
"def",
"GetStructByteOrderString",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_data_type_definition",
":",
"return",
"None",
"return",
"self",
".",
"_BYTE_ORDER_STRINGS",
".",
"get",
"(",
"self",
".",
"_data_type_definition",
".",
"byte_order",
",",
"None... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | PrimitiveDataTypeMap.FoldByteStream | Folds the data type into a byte stream.
Args:
mapped_value (object): mapped value.
Returns:
bytes: byte stream.
Raises:
FoldingError: if the data type definition cannot be folded into
the byte stream. | dtfabric/runtime/data_maps.py | def FoldByteStream(self, mapped_value, **unused_kwargs):
"""Folds the data type into a byte stream.
Args:
mapped_value (object): mapped value.
Returns:
bytes: byte stream.
Raises:
FoldingError: if the data type definition cannot be folded into
the byte stream.
"""
... | def FoldByteStream(self, mapped_value, **unused_kwargs):
"""Folds the data type into a byte stream.
Args:
mapped_value (object): mapped value.
Returns:
bytes: byte stream.
Raises:
FoldingError: if the data type definition cannot be folded into
the byte stream.
"""
... | [
"Folds",
"the",
"data",
"type",
"into",
"a",
"byte",
"stream",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L253-L274 | [
"def",
"FoldByteStream",
"(",
"self",
",",
"mapped_value",
",",
"*",
"*",
"unused_kwargs",
")",
":",
"try",
":",
"value",
"=",
"self",
".",
"FoldValue",
"(",
"mapped_value",
")",
"return",
"self",
".",
"_operation",
".",
"WriteTo",
"(",
"tuple",
"(",
"["... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | PrimitiveDataTypeMap.MapByteStream | Maps the data type on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
context (Optional[DataTypeMapContext]): data type map context.
Returns:
object: mapped value.
Raises:
MappingError: if the da... | dtfabric/runtime/data_maps.py | def MapByteStream(
self, byte_stream, byte_offset=0, context=None, **unused_kwargs):
"""Maps the data type on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
context (Optional[DataTypeMapContext]): data type... | def MapByteStream(
self, byte_stream, byte_offset=0, context=None, **unused_kwargs):
"""Maps the data type on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
context (Optional[DataTypeMapContext]): data type... | [
"Maps",
"the",
"data",
"type",
"on",
"a",
"byte",
"stream",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L290-L323 | [
"def",
"MapByteStream",
"(",
"self",
",",
"byte_stream",
",",
"byte_offset",
"=",
"0",
",",
"context",
"=",
"None",
",",
"*",
"*",
"unused_kwargs",
")",
":",
"data_type_size",
"=",
"self",
".",
"_data_type_definition",
".",
"GetByteSize",
"(",
")",
"self",
... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | BooleanMap.FoldValue | Folds the data type into a value.
Args:
value (object): value.
Returns:
object: folded value.
Raises:
ValueError: if the data type definition cannot be folded into the value. | dtfabric/runtime/data_maps.py | def FoldValue(self, value):
"""Folds the data type into a value.
Args:
value (object): value.
Returns:
object: folded value.
Raises:
ValueError: if the data type definition cannot be folded into the value.
"""
if value is False and self._data_type_definition.false_value is n... | def FoldValue(self, value):
"""Folds the data type into a value.
Args:
value (object): value.
Returns:
object: folded value.
Raises:
ValueError: if the data type definition cannot be folded into the value.
"""
if value is False and self._data_type_definition.false_value is n... | [
"Folds",
"the",
"data",
"type",
"into",
"a",
"value",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L378-L396 | [
"def",
"FoldValue",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"is",
"False",
"and",
"self",
".",
"_data_type_definition",
".",
"false_value",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_data_type_definition",
".",
"false_value",
"if",
"value... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | IntegerMap.GetStructFormatString | Retrieves the Python struct format string.
Returns:
str: format string as used by Python struct or None if format string
cannot be determined. | dtfabric/runtime/data_maps.py | def GetStructFormatString(self):
"""Retrieves the Python struct format string.
Returns:
str: format string as used by Python struct or None if format string
cannot be determined.
"""
if self._data_type_definition.format == definitions.FORMAT_UNSIGNED:
return self._FORMAT_STRINGS_U... | def GetStructFormatString(self):
"""Retrieves the Python struct format string.
Returns:
str: format string as used by Python struct or None if format string
cannot be determined.
"""
if self._data_type_definition.format == definitions.FORMAT_UNSIGNED:
return self._FORMAT_STRINGS_U... | [
"Retrieves",
"the",
"Python",
"struct",
"format",
"string",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L515-L527 | [
"def",
"GetStructFormatString",
"(",
"self",
")",
":",
"if",
"self",
".",
"_data_type_definition",
".",
"format",
"==",
"definitions",
".",
"FORMAT_UNSIGNED",
":",
"return",
"self",
".",
"_FORMAT_STRINGS_UNSIGNED",
".",
"get",
"(",
"self",
".",
"_data_type_definit... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | UUIDMap.FoldByteStream | Folds the data type into a byte stream.
Args:
mapped_value (object): mapped value.
Returns:
bytes: byte stream.
Raises:
FoldingError: if the data type definition cannot be folded into
the byte stream. | dtfabric/runtime/data_maps.py | def FoldByteStream(self, mapped_value, **unused_kwargs):
"""Folds the data type into a byte stream.
Args:
mapped_value (object): mapped value.
Returns:
bytes: byte stream.
Raises:
FoldingError: if the data type definition cannot be folded into
the byte stream.
"""
... | def FoldByteStream(self, mapped_value, **unused_kwargs):
"""Folds the data type into a byte stream.
Args:
mapped_value (object): mapped value.
Returns:
bytes: byte stream.
Raises:
FoldingError: if the data type definition cannot be folded into
the byte stream.
"""
... | [
"Folds",
"the",
"data",
"type",
"into",
"a",
"byte",
"stream",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L544-L571 | [
"def",
"FoldByteStream",
"(",
"self",
",",
"mapped_value",
",",
"*",
"*",
"unused_kwargs",
")",
":",
"value",
"=",
"None",
"try",
":",
"if",
"self",
".",
"_byte_order",
"==",
"definitions",
".",
"BYTE_ORDER_BIG_ENDIAN",
":",
"value",
"=",
"mapped_value",
"."... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | UUIDMap.MapByteStream | Maps the data type on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
context (Optional[DataTypeMapContext]): data type map context.
Returns:
uuid.UUID: mapped value.
Raises:
MappingError: if the... | dtfabric/runtime/data_maps.py | def MapByteStream(
self, byte_stream, byte_offset=0, context=None, **unused_kwargs):
"""Maps the data type on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
context (Optional[DataTypeMapContext]): data type... | def MapByteStream(
self, byte_stream, byte_offset=0, context=None, **unused_kwargs):
"""Maps the data type on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
context (Optional[DataTypeMapContext]): data type... | [
"Maps",
"the",
"data",
"type",
"on",
"a",
"byte",
"stream",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L573-L610 | [
"def",
"MapByteStream",
"(",
"self",
",",
"byte_stream",
",",
"byte_offset",
"=",
"0",
",",
"context",
"=",
"None",
",",
"*",
"*",
"unused_kwargs",
")",
":",
"data_type_size",
"=",
"self",
".",
"_data_type_definition",
".",
"GetByteSize",
"(",
")",
"self",
... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | ElementSequenceDataTypeMap._CalculateElementsDataSize | Calculates the elements data size.
Args:
context (Optional[DataTypeMapContext]): data type map context, used to
determine the size hint.
Returns:
int: the elements data size or None if not available. | dtfabric/runtime/data_maps.py | def _CalculateElementsDataSize(self, context):
"""Calculates the elements data size.
Args:
context (Optional[DataTypeMapContext]): data type map context, used to
determine the size hint.
Returns:
int: the elements data size or None if not available.
"""
elements_data_size = N... | def _CalculateElementsDataSize(self, context):
"""Calculates the elements data size.
Args:
context (Optional[DataTypeMapContext]): data type map context, used to
determine the size hint.
Returns:
int: the elements data size or None if not available.
"""
elements_data_size = N... | [
"Calculates",
"the",
"elements",
"data",
"size",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L636-L657 | [
"def",
"_CalculateElementsDataSize",
"(",
"self",
",",
"context",
")",
":",
"elements_data_size",
"=",
"None",
"if",
"self",
".",
"_HasElementsDataSize",
"(",
")",
":",
"elements_data_size",
"=",
"self",
".",
"_EvaluateElementsDataSize",
"(",
"context",
")",
"elif... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | ElementSequenceDataTypeMap._EvaluateElementsDataSize | Evaluates elements data size.
Args:
context (DataTypeMapContext): data type map context.
Returns:
int: elements data size.
Raises:
MappingError: if the elements data size cannot be determined. | dtfabric/runtime/data_maps.py | def _EvaluateElementsDataSize(self, context):
"""Evaluates elements data size.
Args:
context (DataTypeMapContext): data type map context.
Returns:
int: elements data size.
Raises:
MappingError: if the elements data size cannot be determined.
"""
elements_data_size = None
... | def _EvaluateElementsDataSize(self, context):
"""Evaluates elements data size.
Args:
context (DataTypeMapContext): data type map context.
Returns:
int: elements data size.
Raises:
MappingError: if the elements data size cannot be determined.
"""
elements_data_size = None
... | [
"Evaluates",
"elements",
"data",
"size",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L659-L694 | [
"def",
"_EvaluateElementsDataSize",
"(",
"self",
",",
"context",
")",
":",
"elements_data_size",
"=",
"None",
"if",
"self",
".",
"_data_type_definition",
".",
"elements_data_size",
":",
"elements_data_size",
"=",
"self",
".",
"_data_type_definition",
".",
"elements_da... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | ElementSequenceDataTypeMap._EvaluateNumberOfElements | Evaluates number of elements.
Args:
context (DataTypeMapContext): data type map context.
Returns:
int: number of elements.
Raises:
MappingError: if the number of elements cannot be determined. | dtfabric/runtime/data_maps.py | def _EvaluateNumberOfElements(self, context):
"""Evaluates number of elements.
Args:
context (DataTypeMapContext): data type map context.
Returns:
int: number of elements.
Raises:
MappingError: if the number of elements cannot be determined.
"""
number_of_elements = None
... | def _EvaluateNumberOfElements(self, context):
"""Evaluates number of elements.
Args:
context (DataTypeMapContext): data type map context.
Returns:
int: number of elements.
Raises:
MappingError: if the number of elements cannot be determined.
"""
number_of_elements = None
... | [
"Evaluates",
"number",
"of",
"elements",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L696-L731 | [
"def",
"_EvaluateNumberOfElements",
"(",
"self",
",",
"context",
")",
":",
"number_of_elements",
"=",
"None",
"if",
"self",
".",
"_data_type_definition",
".",
"number_of_elements",
":",
"number_of_elements",
"=",
"self",
".",
"_data_type_definition",
".",
"number_of_e... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | ElementSequenceDataTypeMap._GetElementDataTypeDefinition | Retrieves the element data type definition.
Args:
data_type_definition (DataTypeDefinition): data type definition.
Returns:
DataTypeDefinition: element data type definition.
Raises:
FormatError: if the element data type cannot be determined from the data
type definition. | dtfabric/runtime/data_maps.py | def _GetElementDataTypeDefinition(self, data_type_definition):
"""Retrieves the element data type definition.
Args:
data_type_definition (DataTypeDefinition): data type definition.
Returns:
DataTypeDefinition: element data type definition.
Raises:
FormatError: if the element data ty... | def _GetElementDataTypeDefinition(self, data_type_definition):
"""Retrieves the element data type definition.
Args:
data_type_definition (DataTypeDefinition): data type definition.
Returns:
DataTypeDefinition: element data type definition.
Raises:
FormatError: if the element data ty... | [
"Retrieves",
"the",
"element",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L733-L755 | [
"def",
"_GetElementDataTypeDefinition",
"(",
"self",
",",
"data_type_definition",
")",
":",
"if",
"not",
"data_type_definition",
":",
"raise",
"errors",
".",
"FormatError",
"(",
"'Missing data type definition'",
")",
"element_data_type_definition",
"=",
"getattr",
"(",
... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | ElementSequenceDataTypeMap.GetSizeHint | Retrieves a hint about the size.
Args:
context (Optional[DataTypeMapContext]): data type map context, used to
determine the size hint.
Returns:
int: hint of the number of bytes needed from the byte stream or None. | dtfabric/runtime/data_maps.py | def GetSizeHint(self, context=None, **unused_kwargs):
"""Retrieves a hint about the size.
Args:
context (Optional[DataTypeMapContext]): data type map context, used to
determine the size hint.
Returns:
int: hint of the number of bytes needed from the byte stream or None.
"""
c... | def GetSizeHint(self, context=None, **unused_kwargs):
"""Retrieves a hint about the size.
Args:
context (Optional[DataTypeMapContext]): data type map context, used to
determine the size hint.
Returns:
int: hint of the number of bytes needed from the byte stream or None.
"""
c... | [
"Retrieves",
"a",
"hint",
"about",
"the",
"size",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L800-L833 | [
"def",
"GetSizeHint",
"(",
"self",
",",
"context",
"=",
"None",
",",
"*",
"*",
"unused_kwargs",
")",
":",
"context_state",
"=",
"getattr",
"(",
"context",
",",
"'state'",
",",
"{",
"}",
")",
"elements_data_size",
"=",
"self",
".",
"GetByteSize",
"(",
")"... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | SequenceMap._CompositeMapByteStream | Maps a sequence of composite data types on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
context (Optional[DataTypeMapContext]): data type map context.
Returns:
tuple[object, ...]: mapped values.
Rai... | dtfabric/runtime/data_maps.py | def _CompositeMapByteStream(
self, byte_stream, byte_offset=0, context=None, **unused_kwargs):
"""Maps a sequence of composite data types on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
context (Optional[... | def _CompositeMapByteStream(
self, byte_stream, byte_offset=0, context=None, **unused_kwargs):
"""Maps a sequence of composite data types on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
context (Optional[... | [
"Maps",
"a",
"sequence",
"of",
"composite",
"data",
"types",
"on",
"a",
"byte",
"stream",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L909-L1031 | [
"def",
"_CompositeMapByteStream",
"(",
"self",
",",
"byte_stream",
",",
"byte_offset",
"=",
"0",
",",
"context",
"=",
"None",
",",
"*",
"*",
"unused_kwargs",
")",
":",
"elements_data_size",
"=",
"None",
"elements_terminator",
"=",
"None",
"number_of_elements",
"... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | SequenceMap._LinearFoldByteStream | Folds the data type into a byte stream.
Args:
mapped_value (object): mapped value.
Returns:
bytes: byte stream.
Raises:
FoldingError: if the data type definition cannot be folded into
the byte stream. | dtfabric/runtime/data_maps.py | def _LinearFoldByteStream(self, mapped_value, **unused_kwargs):
"""Folds the data type into a byte stream.
Args:
mapped_value (object): mapped value.
Returns:
bytes: byte stream.
Raises:
FoldingError: if the data type definition cannot be folded into
the byte stream.
"... | def _LinearFoldByteStream(self, mapped_value, **unused_kwargs):
"""Folds the data type into a byte stream.
Args:
mapped_value (object): mapped value.
Returns:
bytes: byte stream.
Raises:
FoldingError: if the data type definition cannot be folded into
the byte stream.
"... | [
"Folds",
"the",
"data",
"type",
"into",
"a",
"byte",
"stream",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L1033-L1053 | [
"def",
"_LinearFoldByteStream",
"(",
"self",
",",
"mapped_value",
",",
"*",
"*",
"unused_kwargs",
")",
":",
"try",
":",
"return",
"self",
".",
"_operation",
".",
"WriteTo",
"(",
"mapped_value",
")",
"except",
"Exception",
"as",
"exception",
":",
"error_string"... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | SequenceMap._LinearMapByteStream | Maps a data type sequence on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
context (Optional[DataTypeMapContext]): data type map context.
Returns:
tuple[object, ...]: mapped values.
Raises:
Map... | dtfabric/runtime/data_maps.py | def _LinearMapByteStream(
self, byte_stream, byte_offset=0, context=None, **unused_kwargs):
"""Maps a data type sequence on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
context (Optional[DataTypeMapContex... | def _LinearMapByteStream(
self, byte_stream, byte_offset=0, context=None, **unused_kwargs):
"""Maps a data type sequence on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
context (Optional[DataTypeMapContex... | [
"Maps",
"a",
"data",
"type",
"sequence",
"on",
"a",
"byte",
"stream",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L1055-L1088 | [
"def",
"_LinearMapByteStream",
"(",
"self",
",",
"byte_stream",
",",
"byte_offset",
"=",
"0",
",",
"context",
"=",
"None",
",",
"*",
"*",
"unused_kwargs",
")",
":",
"elements_data_size",
"=",
"self",
".",
"_data_type_definition",
".",
"GetByteSize",
"(",
")",
... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | SequenceMap.GetStructFormatString | Retrieves the Python struct format string.
Returns:
str: format string as used by Python struct or None if format string
cannot be determined. | dtfabric/runtime/data_maps.py | def GetStructFormatString(self):
"""Retrieves the Python struct format string.
Returns:
str: format string as used by Python struct or None if format string
cannot be determined.
"""
if not self._element_data_type_map:
return None
number_of_elements = None
if self._data_t... | def GetStructFormatString(self):
"""Retrieves the Python struct format string.
Returns:
str: format string as used by Python struct or None if format string
cannot be determined.
"""
if not self._element_data_type_map:
return None
number_of_elements = None
if self._data_t... | [
"Retrieves",
"the",
"Python",
"struct",
"format",
"string",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L1105-L1131 | [
"def",
"GetStructFormatString",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_element_data_type_map",
":",
"return",
"None",
"number_of_elements",
"=",
"None",
"if",
"self",
".",
"_data_type_definition",
".",
"elements_data_size",
":",
"element_byte_size",
"=",... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | StreamMap.FoldByteStream | Folds the data type into a byte stream.
Args:
mapped_value (object): mapped value.
context (Optional[DataTypeMapContext]): data type map context.
Returns:
bytes: byte stream.
Raises:
FoldingError: if the data type definition cannot be folded into
the byte stream. | dtfabric/runtime/data_maps.py | def FoldByteStream(self, mapped_value, context=None, **unused_kwargs):
"""Folds the data type into a byte stream.
Args:
mapped_value (object): mapped value.
context (Optional[DataTypeMapContext]): data type map context.
Returns:
bytes: byte stream.
Raises:
FoldingError: if the... | def FoldByteStream(self, mapped_value, context=None, **unused_kwargs):
"""Folds the data type into a byte stream.
Args:
mapped_value (object): mapped value.
context (Optional[DataTypeMapContext]): data type map context.
Returns:
bytes: byte stream.
Raises:
FoldingError: if the... | [
"Folds",
"the",
"data",
"type",
"into",
"a",
"byte",
"stream",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L1175-L1204 | [
"def",
"FoldByteStream",
"(",
"self",
",",
"mapped_value",
",",
"context",
"=",
"None",
",",
"*",
"*",
"unused_kwargs",
")",
":",
"elements_data_size",
"=",
"self",
".",
"_CalculateElementsDataSize",
"(",
"context",
")",
"if",
"elements_data_size",
"is",
"not",
... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | StreamMap.MapByteStream | Maps the data type on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
context (Optional[DataTypeMapContext]): data type map context.
Returns:
tuple[object, ...]: mapped values.
Raises:
MappingErr... | dtfabric/runtime/data_maps.py | def MapByteStream(
self, byte_stream, byte_offset=0, context=None, **unused_kwargs):
"""Maps the data type on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
context (Optional[DataTypeMapContext]): data type... | def MapByteStream(
self, byte_stream, byte_offset=0, context=None, **unused_kwargs):
"""Maps the data type on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
context (Optional[DataTypeMapContext]): data type... | [
"Maps",
"the",
"data",
"type",
"on",
"a",
"byte",
"stream",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L1219-L1289 | [
"def",
"MapByteStream",
"(",
"self",
",",
"byte_stream",
",",
"byte_offset",
"=",
"0",
",",
"context",
"=",
"None",
",",
"*",
"*",
"unused_kwargs",
")",
":",
"context_state",
"=",
"getattr",
"(",
"context",
",",
"'state'",
",",
"{",
"}",
")",
"size_hints... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | PaddingMap.MapByteStream | Maps the data type on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
Returns:
object: mapped value.
Raises:
MappingError: if the data type definition cannot be mapped on
the byte stream. | dtfabric/runtime/data_maps.py | def MapByteStream(self, byte_stream, byte_offset=0, **unused_kwargs):
"""Maps the data type on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
Returns:
object: mapped value.
Raises:
MappingError: i... | def MapByteStream(self, byte_stream, byte_offset=0, **unused_kwargs):
"""Maps the data type on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
Returns:
object: mapped value.
Raises:
MappingError: i... | [
"Maps",
"the",
"data",
"type",
"on",
"a",
"byte",
"stream",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L1355-L1369 | [
"def",
"MapByteStream",
"(",
"self",
",",
"byte_stream",
",",
"byte_offset",
"=",
"0",
",",
"*",
"*",
"unused_kwargs",
")",
":",
"return",
"byte_stream",
"[",
"byte_offset",
":",
"byte_offset",
"+",
"self",
".",
"byte_size",
"]"
] | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | StringMap.FoldByteStream | Folds the data type into a byte stream.
Args:
mapped_value (object): mapped value.
Returns:
bytes: byte stream.
Raises:
FoldingError: if the data type definition cannot be folded into
the byte stream. | dtfabric/runtime/data_maps.py | def FoldByteStream(self, mapped_value, **kwargs):
"""Folds the data type into a byte stream.
Args:
mapped_value (object): mapped value.
Returns:
bytes: byte stream.
Raises:
FoldingError: if the data type definition cannot be folded into
the byte stream.
"""
try:
... | def FoldByteStream(self, mapped_value, **kwargs):
"""Folds the data type into a byte stream.
Args:
mapped_value (object): mapped value.
Returns:
bytes: byte stream.
Raises:
FoldingError: if the data type definition cannot be folded into
the byte stream.
"""
try:
... | [
"Folds",
"the",
"data",
"type",
"into",
"a",
"byte",
"stream",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L1391-L1413 | [
"def",
"FoldByteStream",
"(",
"self",
",",
"mapped_value",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"byte_stream",
"=",
"mapped_value",
".",
"encode",
"(",
"self",
".",
"_data_type_definition",
".",
"encoding",
")",
"except",
"Exception",
"as",
"except... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | StringMap.MapByteStream | Maps the data type on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
Returns:
str: mapped values.
Raises:
MappingError: if the data type definition cannot be mapped on
the byte stream. | dtfabric/runtime/data_maps.py | def MapByteStream(self, byte_stream, byte_offset=0, **kwargs):
"""Maps the data type on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
Returns:
str: mapped values.
Raises:
MappingError: if the dat... | def MapByteStream(self, byte_stream, byte_offset=0, **kwargs):
"""Maps the data type on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
Returns:
str: mapped values.
Raises:
MappingError: if the dat... | [
"Maps",
"the",
"data",
"type",
"on",
"a",
"byte",
"stream",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L1415-L1458 | [
"def",
"MapByteStream",
"(",
"self",
",",
"byte_stream",
",",
"byte_offset",
"=",
"0",
",",
"*",
"*",
"kwargs",
")",
":",
"byte_stream",
"=",
"super",
"(",
"StringMap",
",",
"self",
")",
".",
"MapByteStream",
"(",
"byte_stream",
",",
"byte_offset",
"=",
... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | StructureMap._CheckCompositeMap | Determines if the data type definition needs a composite map.
Args:
data_type_definition (DataTypeDefinition): structure data type definition.
Returns:
bool: True if a composite map is needed, False otherwise.
Raises:
FormatError: if a composite map is needed cannot be determined from t... | dtfabric/runtime/data_maps.py | def _CheckCompositeMap(self, data_type_definition):
"""Determines if the data type definition needs a composite map.
Args:
data_type_definition (DataTypeDefinition): structure data type definition.
Returns:
bool: True if a composite map is needed, False otherwise.
Raises:
FormatErro... | def _CheckCompositeMap(self, data_type_definition):
"""Determines if the data type definition needs a composite map.
Args:
data_type_definition (DataTypeDefinition): structure data type definition.
Returns:
bool: True if a composite map is needed, False otherwise.
Raises:
FormatErro... | [
"Determines",
"if",
"the",
"data",
"type",
"definition",
"needs",
"a",
"composite",
"map",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L1498-L1536 | [
"def",
"_CheckCompositeMap",
"(",
"self",
",",
"data_type_definition",
")",
":",
"if",
"not",
"data_type_definition",
":",
"raise",
"errors",
".",
"FormatError",
"(",
"'Missing data type definition'",
")",
"members",
"=",
"getattr",
"(",
"data_type_definition",
",",
... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | StructureMap._CompositeFoldByteStream | Folds the data type into a byte stream.
Args:
mapped_value (object): mapped value.
context (Optional[DataTypeMapContext]): data type map context.
Returns:
bytes: byte stream.
Raises:
FoldingError: if the data type definition cannot be folded into
the byte stream. | dtfabric/runtime/data_maps.py | def _CompositeFoldByteStream(
self, mapped_value, context=None, **unused_kwargs):
"""Folds the data type into a byte stream.
Args:
mapped_value (object): mapped value.
context (Optional[DataTypeMapContext]): data type map context.
Returns:
bytes: byte stream.
Raises:
Fol... | def _CompositeFoldByteStream(
self, mapped_value, context=None, **unused_kwargs):
"""Folds the data type into a byte stream.
Args:
mapped_value (object): mapped value.
context (Optional[DataTypeMapContext]): data type map context.
Returns:
bytes: byte stream.
Raises:
Fol... | [
"Folds",
"the",
"data",
"type",
"into",
"a",
"byte",
"stream",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L1538-L1582 | [
"def",
"_CompositeFoldByteStream",
"(",
"self",
",",
"mapped_value",
",",
"context",
"=",
"None",
",",
"*",
"*",
"unused_kwargs",
")",
":",
"context_state",
"=",
"getattr",
"(",
"context",
",",
"'state'",
",",
"{",
"}",
")",
"attribute_index",
"=",
"context_... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | StructureMap._CompositeMapByteStream | Maps a sequence of composite data types on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
context (Optional[DataTypeMapContext]): data type map context.
Returns:
object: mapped value.
Raises:
Ma... | dtfabric/runtime/data_maps.py | def _CompositeMapByteStream(
self, byte_stream, byte_offset=0, context=None, **unused_kwargs):
"""Maps a sequence of composite data types on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
context (Optional[... | def _CompositeMapByteStream(
self, byte_stream, byte_offset=0, context=None, **unused_kwargs):
"""Maps a sequence of composite data types on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
context (Optional[... | [
"Maps",
"a",
"sequence",
"of",
"composite",
"data",
"types",
"on",
"a",
"byte",
"stream",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L1584-L1686 | [
"def",
"_CompositeMapByteStream",
"(",
"self",
",",
"byte_stream",
",",
"byte_offset",
"=",
"0",
",",
"context",
"=",
"None",
",",
"*",
"*",
"unused_kwargs",
")",
":",
"context_state",
"=",
"getattr",
"(",
"context",
",",
"'state'",
",",
"{",
"}",
")",
"... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | StructureMap._GetAttributeNames | Determines the attribute (or field) names of the members.
Args:
data_type_definition (DataTypeDefinition): data type definition.
Returns:
list[str]: attribute names.
Raises:
FormatError: if the attribute names cannot be determined from the data
type definition. | dtfabric/runtime/data_maps.py | def _GetAttributeNames(self, data_type_definition):
"""Determines the attribute (or field) names of the members.
Args:
data_type_definition (DataTypeDefinition): data type definition.
Returns:
list[str]: attribute names.
Raises:
FormatError: if the attribute names cannot be determin... | def _GetAttributeNames(self, data_type_definition):
"""Determines the attribute (or field) names of the members.
Args:
data_type_definition (DataTypeDefinition): data type definition.
Returns:
list[str]: attribute names.
Raises:
FormatError: if the attribute names cannot be determin... | [
"Determines",
"the",
"attribute",
"(",
"or",
"field",
")",
"names",
"of",
"the",
"members",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L1688-L1708 | [
"def",
"_GetAttributeNames",
"(",
"self",
",",
"data_type_definition",
")",
":",
"if",
"not",
"data_type_definition",
":",
"raise",
"errors",
".",
"FormatError",
"(",
"'Missing data type definition'",
")",
"attribute_names",
"=",
"[",
"]",
"for",
"member_definition",
... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | StructureMap._GetMemberDataTypeMaps | Retrieves the member data type maps.
Args:
data_type_definition (DataTypeDefinition): data type definition.
data_type_map_cache (dict[str, DataTypeMap]): cached data type maps.
Returns:
list[DataTypeMap]: member data type maps.
Raises:
FormatError: if the data type maps cannot be ... | dtfabric/runtime/data_maps.py | def _GetMemberDataTypeMaps(self, data_type_definition, data_type_map_cache):
"""Retrieves the member data type maps.
Args:
data_type_definition (DataTypeDefinition): data type definition.
data_type_map_cache (dict[str, DataTypeMap]): cached data type maps.
Returns:
list[DataTypeMap]: mem... | def _GetMemberDataTypeMaps(self, data_type_definition, data_type_map_cache):
"""Retrieves the member data type maps.
Args:
data_type_definition (DataTypeDefinition): data type definition.
data_type_map_cache (dict[str, DataTypeMap]): cached data type maps.
Returns:
list[DataTypeMap]: mem... | [
"Retrieves",
"the",
"member",
"data",
"type",
"maps",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L1710-L1771 | [
"def",
"_GetMemberDataTypeMaps",
"(",
"self",
",",
"data_type_definition",
",",
"data_type_map_cache",
")",
":",
"if",
"not",
"data_type_definition",
":",
"raise",
"errors",
".",
"FormatError",
"(",
"'Missing data type definition'",
")",
"members",
"=",
"getattr",
"("... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | StructureMap._LinearFoldByteStream | Folds the data type into a byte stream.
Args:
mapped_value (object): mapped value.
Returns:
bytes: byte stream.
Raises:
FoldingError: if the data type definition cannot be folded into
the byte stream. | dtfabric/runtime/data_maps.py | def _LinearFoldByteStream(self, mapped_value, **unused_kwargs):
"""Folds the data type into a byte stream.
Args:
mapped_value (object): mapped value.
Returns:
bytes: byte stream.
Raises:
FoldingError: if the data type definition cannot be folded into
the byte stream.
"... | def _LinearFoldByteStream(self, mapped_value, **unused_kwargs):
"""Folds the data type into a byte stream.
Args:
mapped_value (object): mapped value.
Returns:
bytes: byte stream.
Raises:
FoldingError: if the data type definition cannot be folded into
the byte stream.
"... | [
"Folds",
"the",
"data",
"type",
"into",
"a",
"byte",
"stream",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L1773-L1798 | [
"def",
"_LinearFoldByteStream",
"(",
"self",
",",
"mapped_value",
",",
"*",
"*",
"unused_kwargs",
")",
":",
"try",
":",
"attribute_values",
"=",
"[",
"getattr",
"(",
"mapped_value",
",",
"attribute_name",
",",
"None",
")",
"for",
"attribute_name",
"in",
"self"... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | StructureMap._LinearMapByteStream | Maps a data type sequence on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
context (Optional[DataTypeMapContext]): data type map context.
Returns:
object: mapped value.
Raises:
MappingError: if... | dtfabric/runtime/data_maps.py | def _LinearMapByteStream(
self, byte_stream, byte_offset=0, context=None, **unused_kwargs):
"""Maps a data type sequence on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
context (Optional[DataTypeMapContex... | def _LinearMapByteStream(
self, byte_stream, byte_offset=0, context=None, **unused_kwargs):
"""Maps a data type sequence on a byte stream.
Args:
byte_stream (bytes): byte stream.
byte_offset (Optional[int]): offset into the byte stream where to start.
context (Optional[DataTypeMapContex... | [
"Maps",
"a",
"data",
"type",
"sequence",
"on",
"a",
"byte",
"stream",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L1800-L1849 | [
"def",
"_LinearMapByteStream",
"(",
"self",
",",
"byte_stream",
",",
"byte_offset",
"=",
"0",
",",
"context",
"=",
"None",
",",
"*",
"*",
"unused_kwargs",
")",
":",
"members_data_size",
"=",
"self",
".",
"_data_type_definition",
".",
"GetByteSize",
"(",
")",
... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | StructureMap.GetSizeHint | Retrieves a hint about the size.
Args:
context (Optional[DataTypeMapContext]): data type map context, used to
determine the size hint.
Returns:
int: hint of the number of bytes needed from the byte stream or None. | dtfabric/runtime/data_maps.py | def GetSizeHint(self, context=None, **unused_kwargs):
"""Retrieves a hint about the size.
Args:
context (Optional[DataTypeMapContext]): data type map context, used to
determine the size hint.
Returns:
int: hint of the number of bytes needed from the byte stream or None.
"""
c... | def GetSizeHint(self, context=None, **unused_kwargs):
"""Retrieves a hint about the size.
Args:
context (Optional[DataTypeMapContext]): data type map context, used to
determine the size hint.
Returns:
int: hint of the number of bytes needed from the byte stream or None.
"""
c... | [
"Retrieves",
"a",
"hint",
"about",
"the",
"size",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L1874-L1900 | [
"def",
"GetSizeHint",
"(",
"self",
",",
"context",
"=",
"None",
",",
"*",
"*",
"unused_kwargs",
")",
":",
"context_state",
"=",
"getattr",
"(",
"context",
",",
"'state'",
",",
"{",
"}",
")",
"subcontext",
"=",
"context_state",
".",
"get",
"(",
"'context'... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | StructureMap.GetStructFormatString | Retrieves the Python struct format string.
Returns:
str: format string as used by Python struct or None if format string
cannot be determined. | dtfabric/runtime/data_maps.py | def GetStructFormatString(self):
"""Retrieves the Python struct format string.
Returns:
str: format string as used by Python struct or None if format string
cannot be determined.
"""
if self._format_string is None and self._data_type_maps:
format_strings = []
for member_data... | def GetStructFormatString(self):
"""Retrieves the Python struct format string.
Returns:
str: format string as used by Python struct or None if format string
cannot be determined.
"""
if self._format_string is None and self._data_type_maps:
format_strings = []
for member_data... | [
"Retrieves",
"the",
"Python",
"struct",
"format",
"string",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L1902-L1923 | [
"def",
"GetStructFormatString",
"(",
"self",
")",
":",
"if",
"self",
".",
"_format_string",
"is",
"None",
"and",
"self",
".",
"_data_type_maps",
":",
"format_strings",
"=",
"[",
"]",
"for",
"member_data_type_map",
"in",
"self",
".",
"_data_type_maps",
":",
"if... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | SemanticDataTypeMap.FoldByteStream | Folds the data type into a byte stream.
Args:
mapped_value (object): mapped value.
Returns:
bytes: byte stream.
Raises:
FoldingError: if the data type definition cannot be folded into
the byte stream. | dtfabric/runtime/data_maps.py | def FoldByteStream(self, mapped_value, **unused_kwargs): # pylint: disable=redundant-returns-doc
"""Folds the data type into a byte stream.
Args:
mapped_value (object): mapped value.
Returns:
bytes: byte stream.
Raises:
FoldingError: if the data type definition cannot be folded int... | def FoldByteStream(self, mapped_value, **unused_kwargs): # pylint: disable=redundant-returns-doc
"""Folds the data type into a byte stream.
Args:
mapped_value (object): mapped value.
Returns:
bytes: byte stream.
Raises:
FoldingError: if the data type definition cannot be folded int... | [
"Folds",
"the",
"data",
"type",
"into",
"a",
"byte",
"stream",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L1944-L1959 | [
"def",
"FoldByteStream",
"(",
"self",
",",
"mapped_value",
",",
"*",
"*",
"unused_kwargs",
")",
":",
"# pylint: disable=redundant-returns-doc",
"raise",
"errors",
".",
"FoldingError",
"(",
"'Unable to fold {0:s} data type into byte stream'",
".",
"format",
"(",
"self",
... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | SemanticDataTypeMap.MapByteStream | Maps the data type on a byte stream.
Args:
byte_stream (bytes): byte stream.
Returns:
object: mapped value.
Raises:
MappingError: if the data type definition cannot be mapped on
the byte stream. | dtfabric/runtime/data_maps.py | def MapByteStream(self, byte_stream, **unused_kwargs): # pylint: disable=redundant-returns-doc
"""Maps the data type on a byte stream.
Args:
byte_stream (bytes): byte stream.
Returns:
object: mapped value.
Raises:
MappingError: if the data type definition cannot be mapped on
... | def MapByteStream(self, byte_stream, **unused_kwargs): # pylint: disable=redundant-returns-doc
"""Maps the data type on a byte stream.
Args:
byte_stream (bytes): byte stream.
Returns:
object: mapped value.
Raises:
MappingError: if the data type definition cannot be mapped on
... | [
"Maps",
"the",
"data",
"type",
"on",
"a",
"byte",
"stream",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L1961-L1976 | [
"def",
"MapByteStream",
"(",
"self",
",",
"byte_stream",
",",
"*",
"*",
"unused_kwargs",
")",
":",
"# pylint: disable=redundant-returns-doc",
"raise",
"errors",
".",
"MappingError",
"(",
"'Unable to map {0:s} data type to byte stream'",
".",
"format",
"(",
"self",
".",
... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | EnumerationMap.GetName | Retrieves the name of an enumeration value by number.
Args:
number (int): number.
Returns:
str: name of the enumeration value or None if no corresponding
enumeration value was found. | dtfabric/runtime/data_maps.py | def GetName(self, number):
"""Retrieves the name of an enumeration value by number.
Args:
number (int): number.
Returns:
str: name of the enumeration value or None if no corresponding
enumeration value was found.
"""
value = self._data_type_definition.values_per_number.get(nu... | def GetName(self, number):
"""Retrieves the name of an enumeration value by number.
Args:
number (int): number.
Returns:
str: name of the enumeration value or None if no corresponding
enumeration value was found.
"""
value = self._data_type_definition.values_per_number.get(nu... | [
"Retrieves",
"the",
"name",
"of",
"an",
"enumeration",
"value",
"by",
"number",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L1986-L2000 | [
"def",
"GetName",
"(",
"self",
",",
"number",
")",
":",
"value",
"=",
"self",
".",
"_data_type_definition",
".",
"values_per_number",
".",
"get",
"(",
"number",
",",
"None",
")",
"if",
"not",
"value",
":",
"return",
"None",
"return",
"value",
".",
"name"... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeMapFactory.CreateDataTypeMap | Creates a specific data type map by name.
Args:
definition_name (str): name of the data type definition.
Returns:
DataTypeMap: data type map or None if the date type definition
is not available. | dtfabric/runtime/data_maps.py | def CreateDataTypeMap(self, definition_name):
"""Creates a specific data type map by name.
Args:
definition_name (str): name of the data type definition.
Returns:
DataTypeMap: data type map or None if the date type definition
is not available.
"""
data_type_definition = self.... | def CreateDataTypeMap(self, definition_name):
"""Creates a specific data type map by name.
Args:
definition_name (str): name of the data type definition.
Returns:
DataTypeMap: data type map or None if the date type definition
is not available.
"""
data_type_definition = self.... | [
"Creates",
"a",
"specific",
"data",
"type",
"map",
"by",
"name",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L2032-L2047 | [
"def",
"CreateDataTypeMap",
"(",
"self",
",",
"definition_name",
")",
":",
"data_type_definition",
"=",
"self",
".",
"_definitions_registry",
".",
"GetDefinitionByName",
"(",
"definition_name",
")",
"if",
"not",
"data_type_definition",
":",
"return",
"None",
"return",... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeMapFactory.CreateDataTypeMapByType | Creates a specific data type map by type indicator.
Args:
data_type_definition (DataTypeDefinition): data type definition.
Returns:
DataTypeMap: data type map or None if the date type definition
is not available. | dtfabric/runtime/data_maps.py | def CreateDataTypeMapByType(cls, data_type_definition):
"""Creates a specific data type map by type indicator.
Args:
data_type_definition (DataTypeDefinition): data type definition.
Returns:
DataTypeMap: data type map or None if the date type definition
is not available.
"""
... | def CreateDataTypeMapByType(cls, data_type_definition):
"""Creates a specific data type map by type indicator.
Args:
data_type_definition (DataTypeDefinition): data type definition.
Returns:
DataTypeMap: data type map or None if the date type definition
is not available.
"""
... | [
"Creates",
"a",
"specific",
"data",
"type",
"map",
"by",
"type",
"indicator",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L2050-L2065 | [
"def",
"CreateDataTypeMapByType",
"(",
"cls",
",",
"data_type_definition",
")",
":",
"data_type_map_class",
"=",
"cls",
".",
"_MAP_PER_DEFINITION",
".",
"get",
"(",
"data_type_definition",
".",
"TYPE_INDICATOR",
",",
"None",
")",
"if",
"not",
"data_type_map_class",
... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | FixedSizeDataTypeDefinition.GetByteSize | Retrieves the byte size of the data type definition.
Returns:
int: data type size in bytes or None if size cannot be determined. | dtfabric/data_types.py | def GetByteSize(self):
"""Retrieves the byte size of the data type definition.
Returns:
int: data type size in bytes or None if size cannot be determined.
"""
if self.size == definitions.SIZE_NATIVE or self.units != 'bytes':
return None
return self.size | def GetByteSize(self):
"""Retrieves the byte size of the data type definition.
Returns:
int: data type size in bytes or None if size cannot be determined.
"""
if self.size == definitions.SIZE_NATIVE or self.units != 'bytes':
return None
return self.size | [
"Retrieves",
"the",
"byte",
"size",
"of",
"the",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/data_types.py#L119-L128 | [
"def",
"GetByteSize",
"(",
"self",
")",
":",
"if",
"self",
".",
"size",
"==",
"definitions",
".",
"SIZE_NATIVE",
"or",
"self",
".",
"units",
"!=",
"'bytes'",
":",
"return",
"None",
"return",
"self",
".",
"size"
] | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | ElementSequenceDataTypeDefinition.GetByteSize | Retrieves the byte size of the data type definition.
Returns:
int: data type size in bytes or None if size cannot be determined. | dtfabric/data_types.py | def GetByteSize(self):
"""Retrieves the byte size of the data type definition.
Returns:
int: data type size in bytes or None if size cannot be determined.
"""
if not self.element_data_type_definition:
return None
if self.elements_data_size:
return self.elements_data_size
if ... | def GetByteSize(self):
"""Retrieves the byte size of the data type definition.
Returns:
int: data type size in bytes or None if size cannot be determined.
"""
if not self.element_data_type_definition:
return None
if self.elements_data_size:
return self.elements_data_size
if ... | [
"Retrieves",
"the",
"byte",
"size",
"of",
"the",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/data_types.py#L306-L325 | [
"def",
"GetByteSize",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"element_data_type_definition",
":",
"return",
"None",
"if",
"self",
".",
"elements_data_size",
":",
"return",
"self",
".",
"elements_data_size",
"if",
"not",
"self",
".",
"number_of_elements... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeDefinitionWithMembers.AddMemberDefinition | Adds a member definition.
Args:
member_definition (DataTypeDefinition): member data type definition. | dtfabric/data_types.py | def AddMemberDefinition(self, member_definition):
"""Adds a member definition.
Args:
member_definition (DataTypeDefinition): member data type definition.
"""
self._byte_size = None
self.members.append(member_definition)
if self.sections:
section_definition = self.sections[-1]
... | def AddMemberDefinition(self, member_definition):
"""Adds a member definition.
Args:
member_definition (DataTypeDefinition): member data type definition.
"""
self._byte_size = None
self.members.append(member_definition)
if self.sections:
section_definition = self.sections[-1]
... | [
"Adds",
"a",
"member",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/data_types.py#L398-L409 | [
"def",
"AddMemberDefinition",
"(",
"self",
",",
"member_definition",
")",
":",
"self",
".",
"_byte_size",
"=",
"None",
"self",
".",
"members",
".",
"append",
"(",
"member_definition",
")",
"if",
"self",
".",
"sections",
":",
"section_definition",
"=",
"self",
... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | MemberDataTypeDefinition.IsComposite | Determines if the data type is composite.
A composite data type consists of other data types.
Returns:
bool: True if the data type is composite, False otherwise. | dtfabric/data_types.py | def IsComposite(self):
"""Determines if the data type is composite.
A composite data type consists of other data types.
Returns:
bool: True if the data type is composite, False otherwise.
"""
return bool(self.condition) or (
self.member_data_type_definition and
self.member_da... | def IsComposite(self):
"""Determines if the data type is composite.
A composite data type consists of other data types.
Returns:
bool: True if the data type is composite, False otherwise.
"""
return bool(self.condition) or (
self.member_data_type_definition and
self.member_da... | [
"Determines",
"if",
"the",
"data",
"type",
"is",
"composite",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/data_types.py#L476-L486 | [
"def",
"IsComposite",
"(",
"self",
")",
":",
"return",
"bool",
"(",
"self",
".",
"condition",
")",
"or",
"(",
"self",
".",
"member_data_type_definition",
"and",
"self",
".",
"member_data_type_definition",
".",
"IsComposite",
"(",
")",
")"
] | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | StructureDefinition.GetByteSize | Retrieves the byte size of the data type definition.
Returns:
int: data type size in bytes or None if size cannot be determined. | dtfabric/data_types.py | def GetByteSize(self):
"""Retrieves the byte size of the data type definition.
Returns:
int: data type size in bytes or None if size cannot be determined.
"""
if self._byte_size is None and self.members:
self._byte_size = 0
for member_definition in self.members:
if isinstance(... | def GetByteSize(self):
"""Retrieves the byte size of the data type definition.
Returns:
int: data type size in bytes or None if size cannot be determined.
"""
if self._byte_size is None and self.members:
self._byte_size = 0
for member_definition in self.members:
if isinstance(... | [
"Retrieves",
"the",
"byte",
"size",
"of",
"the",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/data_types.py#L531-L554 | [
"def",
"GetByteSize",
"(",
"self",
")",
":",
"if",
"self",
".",
"_byte_size",
"is",
"None",
"and",
"self",
".",
"members",
":",
"self",
".",
"_byte_size",
"=",
"0",
"for",
"member_definition",
"in",
"self",
".",
"members",
":",
"if",
"isinstance",
"(",
... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | UnionDefinition.GetByteSize | Retrieves the byte size of the data type definition.
Returns:
int: data type size in bytes or None if size cannot be determined. | dtfabric/data_types.py | def GetByteSize(self):
"""Retrieves the byte size of the data type definition.
Returns:
int: data type size in bytes or None if size cannot be determined.
"""
if self._byte_size is None and self.members:
self._byte_size = 0
for member_definition in self.members:
byte_size = me... | def GetByteSize(self):
"""Retrieves the byte size of the data type definition.
Returns:
int: data type size in bytes or None if size cannot be determined.
"""
if self._byte_size is None and self.members:
self._byte_size = 0
for member_definition in self.members:
byte_size = me... | [
"Retrieves",
"the",
"byte",
"size",
"of",
"the",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/data_types.py#L562-L578 | [
"def",
"GetByteSize",
"(",
"self",
")",
":",
"if",
"self",
".",
"_byte_size",
"is",
"None",
"and",
"self",
".",
"members",
":",
"self",
".",
"_byte_size",
"=",
"0",
"for",
"member_definition",
"in",
"self",
".",
"members",
":",
"byte_size",
"=",
"member_... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | EnumerationDefinition.AddValue | Adds an enumeration value.
Args:
name (str): name.
number (int): number.
aliases (Optional[list[str]]): aliases.
description (Optional[str]): description.
Raises:
KeyError: if the enumeration value already exists. | dtfabric/data_types.py | def AddValue(self, name, number, aliases=None, description=None):
"""Adds an enumeration value.
Args:
name (str): name.
number (int): number.
aliases (Optional[list[str]]): aliases.
description (Optional[str]): description.
Raises:
KeyError: if the enumeration value already e... | def AddValue(self, name, number, aliases=None, description=None):
"""Adds an enumeration value.
Args:
name (str): name.
number (int): number.
aliases (Optional[list[str]]): aliases.
description (Optional[str]): description.
Raises:
KeyError: if the enumeration value already e... | [
"Adds",
"an",
"enumeration",
"value",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/data_types.py#L677-L707 | [
"def",
"AddValue",
"(",
"self",
",",
"name",
",",
"number",
",",
"aliases",
"=",
"None",
",",
"description",
"=",
"None",
")",
":",
"if",
"name",
"in",
"self",
".",
"values_per_name",
":",
"raise",
"KeyError",
"(",
"'Value with name: {0:s} already exists.'",
... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | StructureFamilyDefinition.AddMemberDefinition | Adds a member definition.
Args:
member_definition (DataTypeDefinition): member data type definition. | dtfabric/data_types.py | def AddMemberDefinition(self, member_definition):
"""Adds a member definition.
Args:
member_definition (DataTypeDefinition): member data type definition.
"""
self.members.append(member_definition)
member_definition.family_definition = self | def AddMemberDefinition(self, member_definition):
"""Adds a member definition.
Args:
member_definition (DataTypeDefinition): member data type definition.
"""
self.members.append(member_definition)
member_definition.family_definition = self | [
"Adds",
"a",
"member",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/data_types.py#L771-L778 | [
"def",
"AddMemberDefinition",
"(",
"self",
",",
"member_definition",
")",
":",
"self",
".",
"members",
".",
"append",
"(",
"member_definition",
")",
"member_definition",
".",
"family_definition",
"=",
"self"
] | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | parse_series | Parses things like '1n+2', or 'an+b' generally, returning (a, b) | inlinestyler/cssselect.py | def parse_series(s):
"""
Parses things like '1n+2', or 'an+b' generally, returning (a, b)
"""
if isinstance(s, Element):
s = s._format_element()
if not s or s == '*':
# Happens when there's nothing, which the CSS parser thinks of as *
return (0, 0)
if isinstance(s, int):
... | def parse_series(s):
"""
Parses things like '1n+2', or 'an+b' generally, returning (a, b)
"""
if isinstance(s, Element):
s = s._format_element()
if not s or s == '*':
# Happens when there's nothing, which the CSS parser thinks of as *
return (0, 0)
if isinstance(s, int):
... | [
"Parses",
"things",
"like",
"1n",
"+",
"2",
"or",
"an",
"+",
"b",
"generally",
"returning",
"(",
"a",
"b",
")"
] | dlanger/inlinestyler | python | https://github.com/dlanger/inlinestyler/blob/335c4fbab892f0ed67466a6beaea6a91f395ad12/inlinestyler/cssselect.py#L776-L810 | [
"def",
"parse_series",
"(",
"s",
")",
":",
"if",
"isinstance",
"(",
"s",
",",
"Element",
")",
":",
"s",
"=",
"s",
".",
"_format_element",
"(",
")",
"if",
"not",
"s",
"or",
"s",
"==",
"'*'",
":",
"# Happens when there's nothing, which the CSS parser thinks of... | 335c4fbab892f0ed67466a6beaea6a91f395ad12 |
train | XPathExpr.add_star_prefix | Adds a /* prefix if there is no prefix. This is when you need
to keep context's constrained to a single parent. | inlinestyler/cssselect.py | def add_star_prefix(self):
"""
Adds a /* prefix if there is no prefix. This is when you need
to keep context's constrained to a single parent.
"""
if self.path:
self.path += '*/'
else:
self.path = '*/'
self.star_prefix = True | def add_star_prefix(self):
"""
Adds a /* prefix if there is no prefix. This is when you need
to keep context's constrained to a single parent.
"""
if self.path:
self.path += '*/'
else:
self.path = '*/'
self.star_prefix = True | [
"Adds",
"a",
"/",
"*",
"prefix",
"if",
"there",
"is",
"no",
"prefix",
".",
"This",
"is",
"when",
"you",
"need",
"to",
"keep",
"context",
"s",
"constrained",
"to",
"a",
"single",
"parent",
"."
] | dlanger/inlinestyler | python | https://github.com/dlanger/inlinestyler/blob/335c4fbab892f0ed67466a6beaea6a91f395ad12/inlinestyler/cssselect.py#L580-L589 | [
"def",
"add_star_prefix",
"(",
"self",
")",
":",
"if",
"self",
".",
"path",
":",
"self",
".",
"path",
"+=",
"'*/'",
"else",
":",
"self",
".",
"path",
"=",
"'*/'",
"self",
".",
"star_prefix",
"=",
"True"
] | 335c4fbab892f0ed67466a6beaea6a91f395ad12 |
train | DataTypeDefinitionsReader._ReadBooleanDataTypeDefinition | Reads a boolean data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, object]): definition values.
definition_name (str): name of the definition.
is_member (Optional[bool]): True if the data typ... | dtfabric/reader.py | def _ReadBooleanDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads a boolean data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str,... | def _ReadBooleanDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads a boolean data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str,... | [
"Reads",
"a",
"boolean",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L102-L122 | [
"def",
"_ReadBooleanDataTypeDefinition",
"(",
"self",
",",
"definitions_registry",
",",
"definition_values",
",",
"definition_name",
",",
"is_member",
"=",
"False",
")",
":",
"return",
"self",
".",
"_ReadFixedSizeDataTypeDefinition",
"(",
"definitions_registry",
",",
"d... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeDefinitionsReader._ReadCharacterDataTypeDefinition | Reads a character data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, object]): definition values.
definition_name (str): name of the definition.
is_member (Optional[bool]): True if the data t... | dtfabric/reader.py | def _ReadCharacterDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads a character data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[... | def _ReadCharacterDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads a character data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[... | [
"Reads",
"a",
"character",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L124-L144 | [
"def",
"_ReadCharacterDataTypeDefinition",
"(",
"self",
",",
"definitions_registry",
",",
"definition_values",
",",
"definition_name",
",",
"is_member",
"=",
"False",
")",
":",
"return",
"self",
".",
"_ReadFixedSizeDataTypeDefinition",
"(",
"definitions_registry",
",",
... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeDefinitionsReader._ReadConstantDataTypeDefinition | Reads a constant data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, object]): definition values.
definition_name (str): name of the definition.
is_member (Optional[bool]): True if the data ty... | dtfabric/reader.py | def _ReadConstantDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads a constant data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[st... | def _ReadConstantDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads a constant data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[st... | [
"Reads",
"a",
"constant",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L146-L180 | [
"def",
"_ReadConstantDataTypeDefinition",
"(",
"self",
",",
"definitions_registry",
",",
"definition_values",
",",
"definition_name",
",",
"is_member",
"=",
"False",
")",
":",
"if",
"is_member",
":",
"error_message",
"=",
"'data type not supported as member'",
"raise",
... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeDefinitionsReader._ReadDataTypeDefinition | Reads a data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, object]): definition values.
data_type_definition_class (str): data type definition class.
definition_name (str): name of the defini... | dtfabric/reader.py | def _ReadDataTypeDefinition(
self, definitions_registry, definition_values, data_type_definition_class,
definition_name, supported_definition_values):
"""Reads a data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
def... | def _ReadDataTypeDefinition(
self, definitions_registry, definition_values, data_type_definition_class,
definition_name, supported_definition_values):
"""Reads a data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
def... | [
"Reads",
"a",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L184-L217 | [
"def",
"_ReadDataTypeDefinition",
"(",
"self",
",",
"definitions_registry",
",",
"definition_values",
",",
"data_type_definition_class",
",",
"definition_name",
",",
"supported_definition_values",
")",
":",
"aliases",
"=",
"definition_values",
".",
"get",
"(",
"'aliases'"... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeDefinitionsReader._ReadDataTypeDefinitionWithMembers | Reads a data type definition with members.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, object]): definition values.
data_type_definition_class (str): data type definition class.
definition_name (str): name ... | dtfabric/reader.py | def _ReadDataTypeDefinitionWithMembers(
self, definitions_registry, definition_values,
data_type_definition_class, definition_name, supports_conditions=False):
"""Reads a data type definition with members.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
... | def _ReadDataTypeDefinitionWithMembers(
self, definitions_registry, definition_values,
data_type_definition_class, definition_name, supports_conditions=False):
"""Reads a data type definition with members.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
... | [
"Reads",
"a",
"data",
"type",
"definition",
"with",
"members",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L219-L279 | [
"def",
"_ReadDataTypeDefinitionWithMembers",
"(",
"self",
",",
"definitions_registry",
",",
"definition_values",
",",
"data_type_definition_class",
",",
"definition_name",
",",
"supports_conditions",
"=",
"False",
")",
":",
"members",
"=",
"definition_values",
".",
"get",... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeDefinitionsReader._ReadEnumerationDataTypeDefinition | Reads an enumeration data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, object]): definition values.
definition_name (str): name of the definition.
is_member (Optional[bool]): True if the dat... | dtfabric/reader.py | def _ReadEnumerationDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads an enumeration data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (... | def _ReadEnumerationDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads an enumeration data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (... | [
"Reads",
"an",
"enumeration",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L281-L341 | [
"def",
"_ReadEnumerationDataTypeDefinition",
"(",
"self",
",",
"definitions_registry",
",",
"definition_values",
",",
"definition_name",
",",
"is_member",
"=",
"False",
")",
":",
"if",
"is_member",
":",
"error_message",
"=",
"'data type not supported as member'",
"raise",... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeDefinitionsReader._ReadElementSequenceDataTypeDefinition | Reads an element sequence data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, object]): definition values.
data_type_definition_class (str): data type definition class.
definition_name (str): ... | dtfabric/reader.py | def _ReadElementSequenceDataTypeDefinition(
self, definitions_registry, definition_values,
data_type_definition_class, definition_name, supported_definition_values):
"""Reads an element sequence data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definiti... | def _ReadElementSequenceDataTypeDefinition(
self, definitions_registry, definition_values,
data_type_definition_class, definition_name, supported_definition_values):
"""Reads an element sequence data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definiti... | [
"Reads",
"an",
"element",
"sequence",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L343-L437 | [
"def",
"_ReadElementSequenceDataTypeDefinition",
"(",
"self",
",",
"definitions_registry",
",",
"definition_values",
",",
"data_type_definition_class",
",",
"definition_name",
",",
"supported_definition_values",
")",
":",
"unsupported_definition_values",
"=",
"set",
"(",
"def... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeDefinitionsReader._ReadFixedSizeDataTypeDefinition | Reads a fixed-size data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, object]): definition values.
data_type_definition_class (str): data type definition class.
definition_name (str): name of... | dtfabric/reader.py | def _ReadFixedSizeDataTypeDefinition(
self, definitions_registry, definition_values, data_type_definition_class,
definition_name, supported_attributes,
default_size=definitions.SIZE_NATIVE, default_units='bytes',
is_member=False, supported_size_values=None):
"""Reads a fixed-size data type d... | def _ReadFixedSizeDataTypeDefinition(
self, definitions_registry, definition_values, data_type_definition_class,
definition_name, supported_attributes,
default_size=definitions.SIZE_NATIVE, default_units='bytes',
is_member=False, supported_size_values=None):
"""Reads a fixed-size data type d... | [
"Reads",
"a",
"fixed",
"-",
"size",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L439-L488 | [
"def",
"_ReadFixedSizeDataTypeDefinition",
"(",
"self",
",",
"definitions_registry",
",",
"definition_values",
",",
"data_type_definition_class",
",",
"definition_name",
",",
"supported_attributes",
",",
"default_size",
"=",
"definitions",
".",
"SIZE_NATIVE",
",",
"default_... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeDefinitionsReader._ReadFloatingPointDataTypeDefinition | Reads a floating-point data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, object]): definition values.
definition_name (str): name of the definition.
is_member (Optional[bool]): True if the d... | dtfabric/reader.py | def _ReadFloatingPointDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads a floating-point data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_valu... | def _ReadFloatingPointDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads a floating-point data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_valu... | [
"Reads",
"a",
"floating",
"-",
"point",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L490-L510 | [
"def",
"_ReadFloatingPointDataTypeDefinition",
"(",
"self",
",",
"definitions_registry",
",",
"definition_values",
",",
"definition_name",
",",
"is_member",
"=",
"False",
")",
":",
"return",
"self",
".",
"_ReadFixedSizeDataTypeDefinition",
"(",
"definitions_registry",
","... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeDefinitionsReader._ReadFormatDataTypeDefinition | Reads a format data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, object]): definition values.
definition_name (str): name of the definition.
is_member (Optional[bool]): True if the data type... | dtfabric/reader.py | def _ReadFormatDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads a format data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, o... | def _ReadFormatDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads a format data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, o... | [
"Reads",
"a",
"format",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L512-L565 | [
"def",
"_ReadFormatDataTypeDefinition",
"(",
"self",
",",
"definitions_registry",
",",
"definition_values",
",",
"definition_name",
",",
"is_member",
"=",
"False",
")",
":",
"if",
"is_member",
":",
"error_message",
"=",
"'data type not supported as member'",
"raise",
"e... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeDefinitionsReader._ReadIntegerDataTypeDefinition | Reads an integer data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, object]): definition values.
definition_name (str): name of the definition.
is_member (Optional[bool]): True if the data ty... | dtfabric/reader.py | def _ReadIntegerDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads an integer data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str... | def _ReadIntegerDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads an integer data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str... | [
"Reads",
"an",
"integer",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L567-L603 | [
"def",
"_ReadIntegerDataTypeDefinition",
"(",
"self",
",",
"definitions_registry",
",",
"definition_values",
",",
"definition_name",
",",
"is_member",
"=",
"False",
")",
":",
"definition_object",
"=",
"self",
".",
"_ReadFixedSizeDataTypeDefinition",
"(",
"definitions_regi... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeDefinitionsReader._ReadLayoutDataTypeDefinition | Reads a layout data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, object]): definition values.
data_type_definition_class (str): data type definition class.
definition_name (str): name of the... | dtfabric/reader.py | def _ReadLayoutDataTypeDefinition(
self, definitions_registry, definition_values, data_type_definition_class,
definition_name, supported_definition_values):
"""Reads a layout data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
regist... | def _ReadLayoutDataTypeDefinition(
self, definitions_registry, definition_values, data_type_definition_class,
definition_name, supported_definition_values):
"""Reads a layout data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
regist... | [
"Reads",
"a",
"layout",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L605-L628 | [
"def",
"_ReadLayoutDataTypeDefinition",
"(",
"self",
",",
"definitions_registry",
",",
"definition_values",
",",
"data_type_definition_class",
",",
"definition_name",
",",
"supported_definition_values",
")",
":",
"return",
"self",
".",
"_ReadDataTypeDefinition",
"(",
"defin... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeDefinitionsReader._ReadMemberDataTypeDefinitionMember | Reads a member data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, object]): definition values.
definition_name (str): name of the definition.
supports_conditions (Optional[bool]): True if con... | dtfabric/reader.py | def _ReadMemberDataTypeDefinitionMember(
self, definitions_registry, definition_values, definition_name,
supports_conditions=False):
"""Reads a member data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_val... | def _ReadMemberDataTypeDefinitionMember(
self, definitions_registry, definition_values, definition_name,
supports_conditions=False):
"""Reads a member data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_val... | [
"Reads",
"a",
"member",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L630-L755 | [
"def",
"_ReadMemberDataTypeDefinitionMember",
"(",
"self",
",",
"definitions_registry",
",",
"definition_values",
",",
"definition_name",
",",
"supports_conditions",
"=",
"False",
")",
":",
"if",
"not",
"definition_values",
":",
"error_message",
"=",
"'invalid structure m... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeDefinitionsReader._ReadPaddingDataTypeDefinition | Reads a padding data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, object]): definition values.
definition_name (str): name of the definition.
is_member (Optional[bool]): True if the data typ... | dtfabric/reader.py | def _ReadPaddingDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads a padding data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str,... | def _ReadPaddingDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads a padding data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str,... | [
"Reads",
"a",
"padding",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L757-L804 | [
"def",
"_ReadPaddingDataTypeDefinition",
"(",
"self",
",",
"definitions_registry",
",",
"definition_values",
",",
"definition_name",
",",
"is_member",
"=",
"False",
")",
":",
"if",
"not",
"is_member",
":",
"error_message",
"=",
"'data type only supported as member'",
"r... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeDefinitionsReader._ReadSemanticDataTypeDefinition | Reads a semantic data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, object]): definition values.
data_type_definition_class (str): data type definition class.
definition_name (str): name of t... | dtfabric/reader.py | def _ReadSemanticDataTypeDefinition(
self, definitions_registry, definition_values, data_type_definition_class,
definition_name, supported_definition_values):
"""Reads a semantic data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
re... | def _ReadSemanticDataTypeDefinition(
self, definitions_registry, definition_values, data_type_definition_class,
definition_name, supported_definition_values):
"""Reads a semantic data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
re... | [
"Reads",
"a",
"semantic",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L806-L829 | [
"def",
"_ReadSemanticDataTypeDefinition",
"(",
"self",
",",
"definitions_registry",
",",
"definition_values",
",",
"data_type_definition_class",
",",
"definition_name",
",",
"supported_definition_values",
")",
":",
"return",
"self",
".",
"_ReadDataTypeDefinition",
"(",
"def... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeDefinitionsReader._ReadSequenceDataTypeDefinition | Reads a sequence data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, object]): definition values.
definition_name (str): name of the definition.
is_member (Optional[bool]): True if the data ty... | dtfabric/reader.py | def _ReadSequenceDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads a sequence data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[st... | def _ReadSequenceDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads a sequence data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[st... | [
"Reads",
"a",
"sequence",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L831-L860 | [
"def",
"_ReadSequenceDataTypeDefinition",
"(",
"self",
",",
"definitions_registry",
",",
"definition_values",
",",
"definition_name",
",",
"is_member",
"=",
"False",
")",
":",
"if",
"is_member",
":",
"supported_definition_values",
"=",
"(",
"self",
".",
"_SUPPORTED_DE... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeDefinitionsReader._ReadStorageDataTypeDefinition | Reads a storage data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, object]): definition values.
data_type_definition_class (str): data type definition class.
definition_name (str): name of th... | dtfabric/reader.py | def _ReadStorageDataTypeDefinition(
self, definitions_registry, definition_values, data_type_definition_class,
definition_name, supported_attributes, is_member=False):
"""Reads a storage data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
... | def _ReadStorageDataTypeDefinition(
self, definitions_registry, definition_values, data_type_definition_class,
definition_name, supported_attributes, is_member=False):
"""Reads a storage data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
... | [
"Reads",
"a",
"storage",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L862-L912 | [
"def",
"_ReadStorageDataTypeDefinition",
"(",
"self",
",",
"definitions_registry",
",",
"definition_values",
",",
"data_type_definition_class",
",",
"definition_name",
",",
"supported_attributes",
",",
"is_member",
"=",
"False",
")",
":",
"if",
"is_member",
":",
"suppor... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeDefinitionsReader._ReadStreamDataTypeDefinition | Reads a stream data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, object]): definition values.
definition_name (str): name of the definition.
is_member (Optional[bool]): True if the data type... | dtfabric/reader.py | def _ReadStreamDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads a stream data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, o... | def _ReadStreamDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads a stream data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, o... | [
"Reads",
"a",
"stream",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L914-L943 | [
"def",
"_ReadStreamDataTypeDefinition",
"(",
"self",
",",
"definitions_registry",
",",
"definition_values",
",",
"definition_name",
",",
"is_member",
"=",
"False",
")",
":",
"if",
"is_member",
":",
"supported_definition_values",
"=",
"(",
"self",
".",
"_SUPPORTED_DEFI... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeDefinitionsReader._ReadStringDataTypeDefinition | Reads a string data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, object]): definition values.
definition_name (str): name of the definition.
is_member (Optional[bool]): True if the data type... | dtfabric/reader.py | def _ReadStringDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads a string data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, o... | def _ReadStringDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads a string data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, o... | [
"Reads",
"a",
"string",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L945-L982 | [
"def",
"_ReadStringDataTypeDefinition",
"(",
"self",
",",
"definitions_registry",
",",
"definition_values",
",",
"definition_name",
",",
"is_member",
"=",
"False",
")",
":",
"if",
"is_member",
":",
"supported_definition_values",
"=",
"(",
"self",
".",
"_SUPPORTED_DEFI... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeDefinitionsReader._ReadStructureDataTypeDefinition | Reads a structure data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, object]): definition values.
definition_name (str): name of the definition.
is_member (Optional[bool]): True if the data t... | dtfabric/reader.py | def _ReadStructureDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads a structure data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[... | def _ReadStructureDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads a structure data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[... | [
"Reads",
"a",
"structure",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L984-L1010 | [
"def",
"_ReadStructureDataTypeDefinition",
"(",
"self",
",",
"definitions_registry",
",",
"definition_values",
",",
"definition_name",
",",
"is_member",
"=",
"False",
")",
":",
"if",
"is_member",
":",
"error_message",
"=",
"'data type not supported as member'",
"raise",
... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeDefinitionsReader._ReadStructureFamilyDataTypeDefinition | Reads a structure family data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, object]): definition values.
definition_name (str): name of the definition.
is_member (Optional[bool]): True if the... | dtfabric/reader.py | def _ReadStructureFamilyDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads a structure family data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_... | def _ReadStructureFamilyDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads a structure family data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_... | [
"Reads",
"a",
"structure",
"family",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L1012-L1076 | [
"def",
"_ReadStructureFamilyDataTypeDefinition",
"(",
"self",
",",
"definitions_registry",
",",
"definition_values",
",",
"definition_name",
",",
"is_member",
"=",
"False",
")",
":",
"if",
"is_member",
":",
"error_message",
"=",
"'data type not supported as member'",
"rai... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeDefinitionsReader._ReadUnionDataTypeDefinition | Reads an union data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, object]): definition values.
definition_name (str): name of the definition.
is_member (Optional[bool]): True if the data type... | dtfabric/reader.py | def _ReadUnionDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads an union data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, ob... | def _ReadUnionDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads an union data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, ob... | [
"Reads",
"an",
"union",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L1078-L1100 | [
"def",
"_ReadUnionDataTypeDefinition",
"(",
"self",
",",
"definitions_registry",
",",
"definition_values",
",",
"definition_name",
",",
"is_member",
"=",
"False",
")",
":",
"return",
"self",
".",
"_ReadDataTypeDefinitionWithMembers",
"(",
"definitions_registry",
",",
"d... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeDefinitionsReader._ReadUUIDDataTypeDefinition | Reads an UUID data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, object]): definition values.
definition_name (str): name of the definition.
is_member (Optional[bool]): True if the data type ... | dtfabric/reader.py | def _ReadUUIDDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads an UUID data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, obje... | def _ReadUUIDDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads an UUID data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, obje... | [
"Reads",
"an",
"UUID",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L1102-L1126 | [
"def",
"_ReadUUIDDataTypeDefinition",
"(",
"self",
",",
"definitions_registry",
",",
"definition_values",
",",
"definition_name",
",",
"is_member",
"=",
"False",
")",
":",
"return",
"self",
".",
"_ReadFixedSizeDataTypeDefinition",
"(",
"definitions_registry",
",",
"defi... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeDefinitionsFileReader._ReadDefinition | Reads a data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, object]): definition values.
Returns:
DataTypeDefinition: data type definition or None.
Raises:
DefinitionReaderError: if ... | dtfabric/reader.py | def _ReadDefinition(self, definitions_registry, definition_values):
"""Reads a data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, object]): definition values.
Returns:
DataTypeDefinition: ... | def _ReadDefinition(self, definitions_registry, definition_values):
"""Reads a data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, object]): definition values.
Returns:
DataTypeDefinition: ... | [
"Reads",
"a",
"data",
"type",
"definition",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L1132-L1169 | [
"def",
"_ReadDefinition",
"(",
"self",
",",
"definitions_registry",
",",
"definition_values",
")",
":",
"if",
"not",
"definition_values",
":",
"error_message",
"=",
"'missing definition values'",
"raise",
"errors",
".",
"DefinitionReaderError",
"(",
"None",
",",
"erro... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | DataTypeDefinitionsFileReader.ReadFile | Reads data type definitions from a file into the registry.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
path (str): path of the file to read from. | dtfabric/reader.py | def ReadFile(self, definitions_registry, path):
"""Reads data type definitions from a file into the registry.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
path (str): path of the file to read from.
"""
with open(path, 'r') as file_objec... | def ReadFile(self, definitions_registry, path):
"""Reads data type definitions from a file into the registry.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
path (str): path of the file to read from.
"""
with open(path, 'r') as file_objec... | [
"Reads",
"data",
"type",
"definitions",
"from",
"a",
"file",
"into",
"the",
"registry",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L1171-L1180 | [
"def",
"ReadFile",
"(",
"self",
",",
"definitions_registry",
",",
"path",
")",
":",
"with",
"open",
"(",
"path",
",",
"'r'",
")",
"as",
"file_object",
":",
"self",
".",
"ReadFileObject",
"(",
"definitions_registry",
",",
"file_object",
")"
] | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | YAMLDataTypeDefinitionsFileReader._GetFormatErrorLocation | Retrieves a format error location.
Args:
yaml_definition (dict[str, object]): current YAML definition.
last_definition_object (DataTypeDefinition): previous data type
definition.
Returns:
str: format error location. | dtfabric/reader.py | def _GetFormatErrorLocation(
self, yaml_definition, last_definition_object):
"""Retrieves a format error location.
Args:
yaml_definition (dict[str, object]): current YAML definition.
last_definition_object (DataTypeDefinition): previous data type
definition.
Returns:
str:... | def _GetFormatErrorLocation(
self, yaml_definition, last_definition_object):
"""Retrieves a format error location.
Args:
yaml_definition (dict[str, object]): current YAML definition.
last_definition_object (DataTypeDefinition): previous data type
definition.
Returns:
str:... | [
"Retrieves",
"a",
"format",
"error",
"location",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L1205-L1225 | [
"def",
"_GetFormatErrorLocation",
"(",
"self",
",",
"yaml_definition",
",",
"last_definition_object",
")",
":",
"name",
"=",
"yaml_definition",
".",
"get",
"(",
"'name'",
",",
"None",
")",
"if",
"name",
":",
"error_location",
"=",
"'in: {0:s}'",
".",
"format",
... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | YAMLDataTypeDefinitionsFileReader.ReadFileObject | Reads data type definitions from a file-like object into the registry.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
file_object (file): file-like object to read from.
Raises:
FormatError: if the definitions values are missing or if the f... | dtfabric/reader.py | def ReadFileObject(self, definitions_registry, file_object):
"""Reads data type definitions from a file-like object into the registry.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
file_object (file): file-like object to read from.
Raises:
... | def ReadFileObject(self, definitions_registry, file_object):
"""Reads data type definitions from a file-like object into the registry.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
file_object (file): file-like object to read from.
Raises:
... | [
"Reads",
"data",
"type",
"definitions",
"from",
"a",
"file",
"-",
"like",
"object",
"into",
"the",
"registry",
"."
] | libyal/dtfabric | python | https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/reader.py#L1227-L1267 | [
"def",
"ReadFileObject",
"(",
"self",
",",
"definitions_registry",
",",
"file_object",
")",
":",
"last_definition_object",
"=",
"None",
"error_location",
"=",
"None",
"error_message",
"=",
"None",
"try",
":",
"yaml_generator",
"=",
"yaml",
".",
"safe_load_all",
"(... | 0d2b5719fa257f6e5c661a406737ebcf8c8db266 |
train | MarkdownFileFinder.find_files | Finds files with an (optional) given extension in a given path. | pymarkdownlint/filefinder.py | def find_files(path, filter="*.md"):
""" Finds files with an (optional) given extension in a given path. """
if os.path.isfile(path):
return [path]
if os.path.isdir(path):
matches = []
for root, dirnames, filenames in os.walk(path):
for filena... | def find_files(path, filter="*.md"):
""" Finds files with an (optional) given extension in a given path. """
if os.path.isfile(path):
return [path]
if os.path.isdir(path):
matches = []
for root, dirnames, filenames in os.walk(path):
for filena... | [
"Finds",
"files",
"with",
"an",
"(",
"optional",
")",
"given",
"extension",
"in",
"a",
"given",
"path",
"."
] | jorisroovers/pymarkdownlint | python | https://github.com/jorisroovers/pymarkdownlint/blob/c1044e25e18afd78b3fda8fd9b00a4f67cfbbc65/pymarkdownlint/filefinder.py#L7-L17 | [
"def",
"find_files",
"(",
"path",
",",
"filter",
"=",
"\"*.md\"",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"path",
")",
":",
"return",
"[",
"path",
"]",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
":",
"matches",
"=",
... | c1044e25e18afd78b3fda8fd9b00a4f67cfbbc65 |
train | Organization.read_from_hdx | Reads the organization given by identifier from HDX and returns Organization object
Args:
identifier (str): Identifier of organization
configuration (Optional[Configuration]): HDX configuration. Defaults to global configuration.
Returns:
Optional[Organization]: Orga... | src/hdx/data/organization.py | def read_from_hdx(identifier, configuration=None):
# type: (str, Optional[Configuration]) -> Optional['Organization']
"""Reads the organization given by identifier from HDX and returns Organization object
Args:
identifier (str): Identifier of organization
configuration (... | def read_from_hdx(identifier, configuration=None):
# type: (str, Optional[Configuration]) -> Optional['Organization']
"""Reads the organization given by identifier from HDX and returns Organization object
Args:
identifier (str): Identifier of organization
configuration (... | [
"Reads",
"the",
"organization",
"given",
"by",
"identifier",
"from",
"HDX",
"and",
"returns",
"Organization",
"object"
] | OCHA-DAP/hdx-python-api | python | https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/organization.py#L70-L86 | [
"def",
"read_from_hdx",
"(",
"identifier",
",",
"configuration",
"=",
"None",
")",
":",
"# type: (str, Optional[Configuration]) -> Optional['Organization']",
"organization",
"=",
"Organization",
"(",
"configuration",
"=",
"configuration",
")",
"result",
"=",
"organization",... | 212440f54f73805826a16db77dbcb6033b18a313 |
train | Organization.get_users | Returns the organization's users.
Args:
capacity (Optional[str]): Filter by capacity eg. member, admin. Defaults to None.
Returns:
List[User]: Organization's users. | src/hdx/data/organization.py | def get_users(self, capacity=None):
# type: (Optional[str]) -> List[User]
"""Returns the organization's users.
Args:
capacity (Optional[str]): Filter by capacity eg. member, admin. Defaults to None.
Returns:
List[User]: Organization's users.
"""
u... | def get_users(self, capacity=None):
# type: (Optional[str]) -> List[User]
"""Returns the organization's users.
Args:
capacity (Optional[str]): Filter by capacity eg. member, admin. Defaults to None.
Returns:
List[User]: Organization's users.
"""
u... | [
"Returns",
"the",
"organization",
"s",
"users",
"."
] | OCHA-DAP/hdx-python-api | python | https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/organization.py#L128-L149 | [
"def",
"get_users",
"(",
"self",
",",
"capacity",
"=",
"None",
")",
":",
"# type: (Optional[str]) -> List[User]",
"users",
"=",
"list",
"(",
")",
"usersdicts",
"=",
"self",
".",
"data",
".",
"get",
"(",
"'users'",
")",
"if",
"usersdicts",
"is",
"not",
"Non... | 212440f54f73805826a16db77dbcb6033b18a313 |
train | Organization.add_update_user | Add new or update existing user in organization with new metadata. Capacity eg. member, admin
must be supplied either within the User object or dictionary or using the capacity argument (which takes
precedence).
Args:
user (Union[User,Dict,str]): Either a user id or user metadata ei... | src/hdx/data/organization.py | def add_update_user(self, user, capacity=None):
# type: (Union[hdx.data.user.User,Dict,str],Optional[str]) -> None
"""Add new or update existing user in organization with new metadata. Capacity eg. member, admin
must be supplied either within the User object or dictionary or using the capacity a... | def add_update_user(self, user, capacity=None):
# type: (Union[hdx.data.user.User,Dict,str],Optional[str]) -> None
"""Add new or update existing user in organization with new metadata. Capacity eg. member, admin
must be supplied either within the User object or dictionary or using the capacity a... | [
"Add",
"new",
"or",
"update",
"existing",
"user",
"in",
"organization",
"with",
"new",
"metadata",
".",
"Capacity",
"eg",
".",
"member",
"admin",
"must",
"be",
"supplied",
"either",
"within",
"the",
"User",
"object",
"or",
"dictionary",
"or",
"using",
"the",... | OCHA-DAP/hdx-python-api | python | https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/organization.py#L151-L178 | [
"def",
"add_update_user",
"(",
"self",
",",
"user",
",",
"capacity",
"=",
"None",
")",
":",
"# type: (Union[hdx.data.user.User,Dict,str],Optional[str]) -> None",
"if",
"isinstance",
"(",
"user",
",",
"str",
")",
":",
"user",
"=",
"hdx",
".",
"data",
".",
"user",... | 212440f54f73805826a16db77dbcb6033b18a313 |
train | Organization.add_update_users | Add new or update existing users in organization with new metadata. Capacity eg. member, admin
must be supplied either within the User object or dictionary or using the capacity argument (which takes
precedence).
Args:
users (List[Union[User,Dict,str]]): A list of either user ids or... | src/hdx/data/organization.py | def add_update_users(self, users, capacity=None):
# type: (List[Union[hdx.data.user.User,Dict,str]],Optional[str]) -> None
"""Add new or update existing users in organization with new metadata. Capacity eg. member, admin
must be supplied either within the User object or dictionary or using the c... | def add_update_users(self, users, capacity=None):
# type: (List[Union[hdx.data.user.User,Dict,str]],Optional[str]) -> None
"""Add new or update existing users in organization with new metadata. Capacity eg. member, admin
must be supplied either within the User object or dictionary or using the c... | [
"Add",
"new",
"or",
"update",
"existing",
"users",
"in",
"organization",
"with",
"new",
"metadata",
".",
"Capacity",
"eg",
".",
"member",
"admin",
"must",
"be",
"supplied",
"either",
"within",
"the",
"User",
"object",
"or",
"dictionary",
"or",
"using",
"the"... | OCHA-DAP/hdx-python-api | python | https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/organization.py#L180-L196 | [
"def",
"add_update_users",
"(",
"self",
",",
"users",
",",
"capacity",
"=",
"None",
")",
":",
"# type: (List[Union[hdx.data.user.User,Dict,str]],Optional[str]) -> None",
"if",
"not",
"isinstance",
"(",
"users",
",",
"list",
")",
":",
"raise",
"HDXError",
"(",
"'User... | 212440f54f73805826a16db77dbcb6033b18a313 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.