INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
Return an iterator of unicode strings - the tag names which apply to the given object. | 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") |
This method is invoked when the item is loaded from the database and when a transaction is reverted which restores this attribute s value. | 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... |
Convert a Python value to a value suitable for inserting into the database. | 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... |
Generate and cache the subselect SQL and its arguments. Return the subselect SQL. | 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... |
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. | 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... |
Filter each element of the data using the attribute type being tested for containment and hand back the resulting list. | 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)... |
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. | 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... |
Undeletes the object. Returns True if undeleted False if it was already not deleted | 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... |
Restores itself as well as objects that might have been deleted along with it if cascade is the deletion strategy | 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)... |
Connect to AWS ec2 | 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: ... |
Find stems for a given text. | 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) |
Read valid locations from HDX | 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
... |
Get location from HDX location code | 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 HDX code for location | 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 | 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... |
The main program function. | 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,
... |
Validates definition files in a directory. | 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 the definition in a file. | 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()
... |
returns css. CSSStyleDeclaration of inline styles for html: | 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 |
Read configuration file | 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... |
Inlines all CSS in an HTML string | 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 ... |
Checks if the byte stream is large enough for the data type. | 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:
... |
Retrieves the byte stream operation. | 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 Python struct format string. | 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(
... |
Folds the data type into a 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.
"""
... |
Maps the data type on a byte stream. | 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... |
Folds the data type into a value. | 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... |
Retrieves the Python struct format string. | 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... |
Folds the data type into a 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.
"""
... |
Maps the data type on a byte stream. | 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... |
Calculates the elements data size. | 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... |
Evaluates elements data size. | 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 number of elements. | 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
... |
Retrieves the element data type definition. | 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 a hint about the size. | 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... |
Maps a sequence of composite data types on a byte stream. | 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[... |
Folds the data type into a 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.
"... |
Maps a data type sequence on a byte stream. | 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... |
Retrieves the Python struct format string. | 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... |
Folds the data type into a byte stream. | 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... |
Maps the data type on a byte stream. | 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. | 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... |
Folds the data type into a byte stream. | 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:
... |
Maps the data type on a byte stream. | 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... |
Determines if the data type definition needs a composite map. | 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... |
Folds the data type into a byte stream. | 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... |
Maps a sequence of composite data types on a byte stream. | 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[... |
Determines the attribute ( or field ) names of the members. | 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... |
Retrieves the member data type maps. | 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... |
Folds the data type into a 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.
"... |
Maps a data type sequence on a byte stream. | 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... |
Retrieves a hint about the size. | 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 the Python struct format string. | 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... |
Folds the data type into a byte stream. | 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... |
Maps the data type on a byte stream. | 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
... |
Retrieves the name of an enumeration value by number. | 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... |
Creates a specific data type map by name. | 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 type indicator. | 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.
"""
... |
Retrieves the byte size of the data type definition. | 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. | 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 ... |
Adds a member definition. | 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]
... |
Determines if the data type is composite. | 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... |
Retrieves the byte size of the data type definition. | 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. | 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... |
Adds an enumeration value. | 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 a member definition. | 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 |
Parses things like 1n + 2 or an + b generally returning ( a b ) | 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):
... |
Adds a/ * prefix if there is no prefix. This is when you need to keep context s constrained to a single parent. | 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 |
Reads a boolean data type definition. | 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 character data type definition. | 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 constant data type definition. | 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 data type definition. | 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 with members. | 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 an enumeration data type definition. | 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 element sequence data type definition. | 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 a fixed - size data type definition. | 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 floating - point data type definition. | 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 format data type definition. | 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 an integer data type definition. | 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 a layout data type definition. | 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 member data type definition. | 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 padding data type definition. | 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 semantic data type definition. | 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 sequence data type definition. | 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 storage data type definition. | 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 stream data type definition. | 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 string data type definition. | 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 structure data type definition. | 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 family data type 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 an union data type definition. | 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 UUID data type definition. | 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 a data type definition. | 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 data type definitions from a file into the registry. | 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... |
Retrieves a format error location. | 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:... |
Reads data type definitions from a file - like object into the registry. | 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:
... |
Finds files with an ( optional ) given extension in a given path. | 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... |
Reads the organization given by identifier from HDX and returns Organization object | 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 (... |
Returns the organization s users. | 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... |
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 ). | 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 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 ). | 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.