repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_documentation_string
stringlengths
1
47.2k
func_code_url
stringlengths
85
339
vfilimonov/pydatastream
pydatastream/pydatastream.py
Datastream.fetch
def fetch(self, tickers, fields=None, date=None, date_from=None, date_to=None, freq='D', only_data=True, static=False): """Fetch data from TR DWE. tickers - ticker or list of tickers fields - list of fields. date - date for a single-date query date_...
python
def fetch(self, tickers, fields=None, date=None, date_from=None, date_to=None, freq='D', only_data=True, static=False): """Fetch data from TR DWE. tickers - ticker or list of tickers fields - list of fields. date - date for a single-date query date_...
Fetch data from TR DWE. tickers - ticker or list of tickers fields - list of fields. date - date for a single-date query date_from, date_to - date range (used only if "date" is not specified) freq - frequency of data: daily('D'), weekly('W') or monthly('M')...
https://github.com/vfilimonov/pydatastream/blob/15d2adac1c83501715db1542373fa8428542816e/pydatastream/pydatastream.py#L465-L525
vfilimonov/pydatastream
pydatastream/pydatastream.py
Datastream.get_OHLCV
def get_OHLCV(self, ticker, date=None, date_from=None, date_to=None): """Get Open, High, Low, Close prices and daily Volume for a given ticker. ticker - ticker or symbol date - date for a single-date query date_from, date_to - date range (used only if "date" is not specifie...
python
def get_OHLCV(self, ticker, date=None, date_from=None, date_to=None): """Get Open, High, Low, Close prices and daily Volume for a given ticker. ticker - ticker or symbol date - date for a single-date query date_from, date_to - date range (used only if "date" is not specifie...
Get Open, High, Low, Close prices and daily Volume for a given ticker. ticker - ticker or symbol date - date for a single-date query date_from, date_to - date range (used only if "date" is not specified) Returns pandas.Dataframe with data. If error occurs, then it is pr...
https://github.com/vfilimonov/pydatastream/blob/15d2adac1c83501715db1542373fa8428542816e/pydatastream/pydatastream.py#L528-L540
vfilimonov/pydatastream
pydatastream/pydatastream.py
Datastream.get_constituents
def get_constituents(self, index_ticker, date=None, only_list=False): """ Get a list of all constituents of a given index. index_ticker - Datastream ticker for index date - date for which list should be retrieved (if None then list of present constitue...
python
def get_constituents(self, index_ticker, date=None, only_list=False): """ Get a list of all constituents of a given index. index_ticker - Datastream ticker for index date - date for which list should be retrieved (if None then list of present constitue...
Get a list of all constituents of a given index. index_ticker - Datastream ticker for index date - date for which list should be retrieved (if None then list of present constituents is retrieved) only_list - request only list of symbols. By defa...
https://github.com/vfilimonov/pydatastream/blob/15d2adac1c83501715db1542373fa8428542816e/pydatastream/pydatastream.py#L571-L595
vfilimonov/pydatastream
pydatastream/pydatastream.py
Datastream.get_epit_vintage_matrix
def get_epit_vintage_matrix(self, mnemonic, date_from='1951-01-01', date_to=None): """ Construct the vintage matrix for a given economic series. Requires subscription to Thomson Reuters Economic Point-in-Time (EPiT). Vintage matrix represents a DataFrame where columns correspond to a ...
python
def get_epit_vintage_matrix(self, mnemonic, date_from='1951-01-01', date_to=None): """ Construct the vintage matrix for a given economic series. Requires subscription to Thomson Reuters Economic Point-in-Time (EPiT). Vintage matrix represents a DataFrame where columns correspond to a ...
Construct the vintage matrix for a given economic series. Requires subscription to Thomson Reuters Economic Point-in-Time (EPiT). Vintage matrix represents a DataFrame where columns correspond to a particular period (quarter or month) for the reported statistic and index...
https://github.com/vfilimonov/pydatastream/blob/15d2adac1c83501715db1542373fa8428542816e/pydatastream/pydatastream.py#L598-L646
vfilimonov/pydatastream
pydatastream/pydatastream.py
Datastream.get_epit_revisions
def get_epit_revisions(self, mnemonic, period, relh50=False): """ Return initial estimate and first revisions of a given economic time series and a given period. Requires subscription to Thomson Reuters Economic Point-in-Time (EPiT). "Period" parameter should represent a dat...
python
def get_epit_revisions(self, mnemonic, period, relh50=False): """ Return initial estimate and first revisions of a given economic time series and a given period. Requires subscription to Thomson Reuters Economic Point-in-Time (EPiT). "Period" parameter should represent a dat...
Return initial estimate and first revisions of a given economic time series and a given period. Requires subscription to Thomson Reuters Economic Point-in-Time (EPiT). "Period" parameter should represent a date which falls within a time period of interest, e.g. 2016 Q4 c...
https://github.com/vfilimonov/pydatastream/blob/15d2adac1c83501715db1542373fa8428542816e/pydatastream/pydatastream.py#L649-L672
crs4/hl7apy
hl7apy/__init__.py
check_encoding_chars
def check_encoding_chars(encoding_chars): """ Validate the given encoding chars :type encoding_chars: ``dict`` :param encoding_chars: the encoding chars (see :func:`hl7apy.set_default_encoding_chars`) :raises: :exc:`hl7apy.exceptions.InvalidEncodingChars` if the given encoding chars are not valid ...
python
def check_encoding_chars(encoding_chars): """ Validate the given encoding chars :type encoding_chars: ``dict`` :param encoding_chars: the encoding chars (see :func:`hl7apy.set_default_encoding_chars`) :raises: :exc:`hl7apy.exceptions.InvalidEncodingChars` if the given encoding chars are not valid ...
Validate the given encoding chars :type encoding_chars: ``dict`` :param encoding_chars: the encoding chars (see :func:`hl7apy.set_default_encoding_chars`) :raises: :exc:`hl7apy.exceptions.InvalidEncodingChars` if the given encoding chars are not valid
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/__init__.py#L46-L63
crs4/hl7apy
hl7apy/__init__.py
check_validation_level
def check_validation_level(validation_level): """ Validate the given validation level :type validation_level: ``int`` :param validation_level: validation level (see :class:`hl7apy.consts.VALIDATION_LEVEL`) :raises: :exc:`hl7apy.exceptions.UnknownValidationLevel` if the given validation level is uns...
python
def check_validation_level(validation_level): """ Validate the given validation level :type validation_level: ``int`` :param validation_level: validation level (see :class:`hl7apy.consts.VALIDATION_LEVEL`) :raises: :exc:`hl7apy.exceptions.UnknownValidationLevel` if the given validation level is uns...
Validate the given validation level :type validation_level: ``int`` :param validation_level: validation level (see :class:`hl7apy.consts.VALIDATION_LEVEL`) :raises: :exc:`hl7apy.exceptions.UnknownValidationLevel` if the given validation level is unsupported
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/__init__.py#L66-L75
crs4/hl7apy
hl7apy/__init__.py
load_library
def load_library(version): """ Load the correct module according to the version :type version: ``str`` :param version: the version of the library to be loaded (e.g. '2.6') :rtype: module object """ check_version(version) module_name = SUPPORTED_LIBRARIES[version] lib = sys.modules.g...
python
def load_library(version): """ Load the correct module according to the version :type version: ``str`` :param version: the version of the library to be loaded (e.g. '2.6') :rtype: module object """ check_version(version) module_name = SUPPORTED_LIBRARIES[version] lib = sys.modules.g...
Load the correct module according to the version :type version: ``str`` :param version: the version of the library to be loaded (e.g. '2.6') :rtype: module object
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/__init__.py#L223-L236
crs4/hl7apy
hl7apy/__init__.py
load_reference
def load_reference(name, element_type, version): """ Look for an element of the given type, name and version and return its reference structure :type element_type: ``str`` :param element_type: the element type to look for (e.g. 'Segment') :type name: ``str`` :param name: the element name to loo...
python
def load_reference(name, element_type, version): """ Look for an element of the given type, name and version and return its reference structure :type element_type: ``str`` :param element_type: the element type to look for (e.g. 'Segment') :type name: ``str`` :param name: the element name to loo...
Look for an element of the given type, name and version and return its reference structure :type element_type: ``str`` :param element_type: the element type to look for (e.g. 'Segment') :type name: ``str`` :param name: the element name to look for (e.g. 'MSH') :type version: ``str`` :param vers...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/__init__.py#L239-L281
crs4/hl7apy
hl7apy/__init__.py
find_reference
def find_reference(name, element_types, version): """ Look for an element of the given name and version into the given types and return its reference structure :type name: ``str`` :param name: the element name to look for (e.g. 'MSH') :type types: ``list`` or ``tuple`` :param types: the element...
python
def find_reference(name, element_types, version): """ Look for an element of the given name and version into the given types and return its reference structure :type name: ``str`` :param name: the element name to look for (e.g. 'MSH') :type types: ``list`` or ``tuple`` :param types: the element...
Look for an element of the given name and version into the given types and return its reference structure :type name: ``str`` :param name: the element name to look for (e.g. 'MSH') :type types: ``list`` or ``tuple`` :param types: the element classes where to look for the element (e.g. (Group, Segment))...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/__init__.py#L284-L313
crs4/hl7apy
hl7apy/v2_3_1/__init__.py
find
def find(name, where): """ >>> from hl7apy.core import Segment >>> from hl7apy import find_reference >>> find_reference('UNKNOWN', (Segment, ), '2.3.1') # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... ChildNotFound: No child named UNKNOWN """ for cls in wh...
python
def find(name, where): """ >>> from hl7apy.core import Segment >>> from hl7apy import find_reference >>> find_reference('UNKNOWN', (Segment, ), '2.3.1') # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... ChildNotFound: No child named UNKNOWN """ for cls in wh...
>>> from hl7apy.core import Segment >>> from hl7apy import find_reference >>> find_reference('UNKNOWN', (Segment, ), '2.3.1') # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... ChildNotFound: No child named UNKNOWN
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/v2_3_1/__init__.py#L46-L60
crs4/hl7apy
hl7apy/utils.py
get_date_info
def get_date_info(value): """ Returns the datetime object and the format of the date in input :type value: `str` """ fmt = _get_date_format(value) dt_value = _datetime_obj_factory(value, fmt) return dt_value, fmt
python
def get_date_info(value): """ Returns the datetime object and the format of the date in input :type value: `str` """ fmt = _get_date_format(value) dt_value = _datetime_obj_factory(value, fmt) return dt_value, fmt
Returns the datetime object and the format of the date in input :type value: `str`
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/utils.py#L70-L78
crs4/hl7apy
hl7apy/utils.py
get_timestamp_info
def get_timestamp_info(value): """ Returns the datetime object, the format, the offset and the microsecond of the timestamp in input :type value: `str` """ value, offset = _split_offset(value) fmt, microsec = _get_timestamp_format(value) dt_value = _datetime_obj_factory(value, fmt) retu...
python
def get_timestamp_info(value): """ Returns the datetime object, the format, the offset and the microsecond of the timestamp in input :type value: `str` """ value, offset = _split_offset(value) fmt, microsec = _get_timestamp_format(value) dt_value = _datetime_obj_factory(value, fmt) retu...
Returns the datetime object, the format, the offset and the microsecond of the timestamp in input :type value: `str`
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/utils.py#L81-L90
crs4/hl7apy
hl7apy/utils.py
get_datetime_info
def get_datetime_info(value): """ Returns the datetime object, the format, the offset and the microsecond of the datetime in input :type value: `str` """ date_value, offset = _split_offset(value) date_format = _get_date_format(date_value[:8]) try: timestamp_form, microsec = _get_ti...
python
def get_datetime_info(value): """ Returns the datetime object, the format, the offset and the microsecond of the datetime in input :type value: `str` """ date_value, offset = _split_offset(value) date_format = _get_date_format(date_value[:8]) try: timestamp_form, microsec = _get_ti...
Returns the datetime object, the format, the offset and the microsecond of the datetime in input :type value: `str`
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/utils.py#L93-L112
crs4/hl7apy
hl7apy/core.py
is_base_datatype
def is_base_datatype(datatype, version=None): """ Check if the given datatype is a base datatype of the specified version :type datatype: ``str`` :param datatype: the datatype (e.g. ST) :type version: ``str`` :param version: the HL7 version (e.g. 2.5) :return: ``True`` if it is a base dat...
python
def is_base_datatype(datatype, version=None): """ Check if the given datatype is a base datatype of the specified version :type datatype: ``str`` :param datatype: the datatype (e.g. ST) :type version: ``str`` :param version: the HL7 version (e.g. 2.5) :return: ``True`` if it is a base dat...
Check if the given datatype is a base datatype of the specified version :type datatype: ``str`` :param datatype: the datatype (e.g. ST) :type version: ``str`` :param version: the HL7 version (e.g. 2.5) :return: ``True`` if it is a base datatype, ``False`` otherwise >>> is_base_datatype('ST')...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/core.py#L59-L79
crs4/hl7apy
hl7apy/core.py
ElementList.get_ordered_children
def get_ordered_children(self): """ Return the list of children ordered according to the element structure :return: a list of :class:`Element <hl7apy.core.Element>` """ ordered_keys = self.element.ordered_children if self.element.ordered_children is not None else [] chil...
python
def get_ordered_children(self): """ Return the list of children ordered according to the element structure :return: a list of :class:`Element <hl7apy.core.Element>` """ ordered_keys = self.element.ordered_children if self.element.ordered_children is not None else [] chil...
Return the list of children ordered according to the element structure :return: a list of :class:`Element <hl7apy.core.Element>`
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/core.py#L210-L218
crs4/hl7apy
hl7apy/core.py
ElementList.insert
def insert(self, index, child, by_name_index=-1): """ Add the child at the given index :type index: ``int`` :param index: child position :type child: :class:`Element <hl7apy.core.Element>` :param child: an instance of an :class:`Element <hl7apy.core.Element>` subclass ...
python
def insert(self, index, child, by_name_index=-1): """ Add the child at the given index :type index: ``int`` :param index: child position :type child: :class:`Element <hl7apy.core.Element>` :param child: an instance of an :class:`Element <hl7apy.core.Element>` subclass ...
Add the child at the given index :type index: ``int`` :param index: child position :type child: :class:`Element <hl7apy.core.Element>` :param child: an instance of an :class:`Element <hl7apy.core.Element>` subclass
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/core.py#L228-L246
crs4/hl7apy
hl7apy/core.py
ElementList.append
def append(self, child): """ Append the given child :class:`Element <hl7apy.core.Element>` :param child: an instance of an :class:`Element <hl7apy.core.Element>` subclass """ if self._can_add_child(child): if self.element == child.parent: self...
python
def append(self, child): """ Append the given child :class:`Element <hl7apy.core.Element>` :param child: an instance of an :class:`Element <hl7apy.core.Element>` subclass """ if self._can_add_child(child): if self.element == child.parent: self...
Append the given child :class:`Element <hl7apy.core.Element>` :param child: an instance of an :class:`Element <hl7apy.core.Element>` subclass
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/core.py#L248-L267
crs4/hl7apy
hl7apy/core.py
ElementList.set
def set(self, name, value, index=-1): """ Assign the ``value`` to the child having the given ``name`` at the ``index`` position :type name: ``str`` :param name: the child name (e.g. PID) :type value: an instance of :class:`Element <hl7apy.core.Element>`, a `str` or an instance ...
python
def set(self, name, value, index=-1): """ Assign the ``value`` to the child having the given ``name`` at the ``index`` position :type name: ``str`` :param name: the child name (e.g. PID) :type value: an instance of :class:`Element <hl7apy.core.Element>`, a `str` or an instance ...
Assign the ``value`` to the child having the given ``name`` at the ``index`` position :type name: ``str`` :param name: the child name (e.g. PID) :type value: an instance of :class:`Element <hl7apy.core.Element>`, a `str` or an instance of :class:`ElementProxy <hl7apy.core.ElementPr...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/core.py#L285-L329
crs4/hl7apy
hl7apy/core.py
ElementList.remove
def remove(self, child): """ Remove the given child from both child list and child indexes :type child: :class:`Element <hl7apy.core.Element>` :param child: an instance of :class:`Element <hl7apy.core.Element>` subclass """ try: if self.element == child.trave...
python
def remove(self, child): """ Remove the given child from both child list and child indexes :type child: :class:`Element <hl7apy.core.Element>` :param child: an instance of :class:`Element <hl7apy.core.Element>` subclass """ try: if self.element == child.trave...
Remove the given child from both child list and child indexes :type child: :class:`Element <hl7apy.core.Element>` :param child: an instance of :class:`Element <hl7apy.core.Element>` subclass
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/core.py#L331-L345
crs4/hl7apy
hl7apy/core.py
ElementList.remove_by_name
def remove_by_name(self, name, index=0): """ Remove the child having the given name at the given position :type name: ``str`` :param name: child name (e.g. PID) :type index: ``int`` :param index: child index :return: an instance of :class:`Element <hl7apy.core....
python
def remove_by_name(self, name, index=0): """ Remove the child having the given name at the given position :type name: ``str`` :param name: child name (e.g. PID) :type index: ``int`` :param index: child index :return: an instance of :class:`Element <hl7apy.core....
Remove the child having the given name at the given position :type name: ``str`` :param name: child name (e.g. PID) :type index: ``int`` :param index: child index :return: an instance of :class:`Element <hl7apy.core.Element>` subclass
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/core.py#L347-L361
crs4/hl7apy
hl7apy/core.py
ElementList.child_at_index
def child_at_index(self, name, index): """ Return the child named `name` at the given index :type name: ``str`` :param name: child name (e.g. PID) :type index: ``int`` :param index: child index :return: an instance of :class:`Element <hl7apy.core.Element>` subc...
python
def child_at_index(self, name, index): """ Return the child named `name` at the given index :type name: ``str`` :param name: child name (e.g. PID) :type index: ``int`` :param index: child index :return: an instance of :class:`Element <hl7apy.core.Element>` subc...
Return the child named `name` at the given index :type name: ``str`` :param name: child name (e.g. PID) :type index: ``int`` :param index: child index :return: an instance of :class:`Element <hl7apy.core.Element>` subclass
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/core.py#L363-L389
crs4/hl7apy
hl7apy/core.py
ElementList.create_element
def create_element(self, name, traversal_parent=False, reference=None): """ Create an element having the given name :type name: ``str`` :param name: the name of the element to be created (e.g. PID) :type traversal_parent: ``bool`` :param traversal_parent: if ``True``, t...
python
def create_element(self, name, traversal_parent=False, reference=None): """ Create an element having the given name :type name: ``str`` :param name: the name of the element to be created (e.g. PID) :type traversal_parent: ``bool`` :param traversal_parent: if ``True``, t...
Create an element having the given name :type name: ``str`` :param name: the name of the element to be created (e.g. PID) :type traversal_parent: ``bool`` :param traversal_parent: if ``True``, the parent will be set as temporary for traversal purposes :param reference: the new...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/core.py#L403-L433
crs4/hl7apy
hl7apy/core.py
ElementList._find_name
def _find_name(self, name): """ Find the reference of a child having the given name :type name: ``str`` :param name: the child name (e.g. PID) :return: the element structure (see :func:`load_reference <hl7apy.load_reference>`) or ``None`` if the element has not been...
python
def _find_name(self, name): """ Find the reference of a child having the given name :type name: ``str`` :param name: the child name (e.g. PID) :return: the element structure (see :func:`load_reference <hl7apy.load_reference>`) or ``None`` if the element has not been...
Find the reference of a child having the given name :type name: ``str`` :param name: the child name (e.g. PID) :return: the element structure (see :func:`load_reference <hl7apy.load_reference>`) or ``None`` if the element has not been found
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/core.py#L435-L447
crs4/hl7apy
hl7apy/core.py
ElementList._default_child_lookup
def _default_child_lookup(self, name): """ Return an instance of :class:`ElementProxy <hl7apy.core.ElementProxy>` containing the children found having the given name :type name: ``str`` :param name: the name of the children (e.g. PID) :return: an instance of :class:`Ele...
python
def _default_child_lookup(self, name): """ Return an instance of :class:`ElementProxy <hl7apy.core.ElementProxy>` containing the children found having the given name :type name: ``str`` :param name: the name of the children (e.g. PID) :return: an instance of :class:`Ele...
Return an instance of :class:`ElementProxy <hl7apy.core.ElementProxy>` containing the children found having the given name :type name: ``str`` :param name: the name of the children (e.g. PID) :return: an instance of :class:`ElementProxy <hl7apy.core.ElementProxy>` containing the result...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/core.py#L449-L472
crs4/hl7apy
hl7apy/core.py
ElementFinder.get_structure
def get_structure(element, reference=None): """ Get the element structure :type element: :class:`Element <hl7apy.core.Element>` :param element: element having the given reference structure :param reference: the element structure from :func:`load_reference <hl7apy.load_reference...
python
def get_structure(element, reference=None): """ Get the element structure :type element: :class:`Element <hl7apy.core.Element>` :param element: element having the given reference structure :param reference: the element structure from :func:`load_reference <hl7apy.load_reference...
Get the element structure :type element: :class:`Element <hl7apy.core.Element>` :param element: element having the given reference structure :param reference: the element structure from :func:`load_reference <hl7apy.load_reference>` or from a message profile :return: a dic...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/core.py#L532-L551
crs4/hl7apy
hl7apy/core.py
ElementFinder._parse_structure
def _parse_structure(element, reference): """ Parse the given reference :type element: :class:`Element <hl7apy.core.Element>` :param element: element having the given reference structure :param reference: the element structure from :func:`load_reference <hl7apy.load_reference>`...
python
def _parse_structure(element, reference): """ Parse the given reference :type element: :class:`Element <hl7apy.core.Element>` :param element: element having the given reference structure :param reference: the element structure from :func:`load_reference <hl7apy.load_reference>`...
Parse the given reference :type element: :class:`Element <hl7apy.core.Element>` :param element: element having the given reference structure :param reference: the element structure from :func:`load_reference <hl7apy.load_reference>` or from a message profile :return: a dic...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/core.py#L554-L600
crs4/hl7apy
hl7apy/core.py
Element.to_er7
def to_er7(self, encoding_chars=None, trailing_children=False): """ Returns the HL7 representation of the :class:`Element <hl7apy.core.Element>`. It adds the appropriate separator at the end if needed :type encoding_chars: ``dict`` :param encoding_chars: The encoding chars to us...
python
def to_er7(self, encoding_chars=None, trailing_children=False): """ Returns the HL7 representation of the :class:`Element <hl7apy.core.Element>`. It adds the appropriate separator at the end if needed :type encoding_chars: ``dict`` :param encoding_chars: The encoding chars to us...
Returns the HL7 representation of the :class:`Element <hl7apy.core.Element>`. It adds the appropriate separator at the end if needed :type encoding_chars: ``dict`` :param encoding_chars: The encoding chars to use. If it is ``None`` it uses :attr:`self.encoding_chars`, wh...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/core.py#L706-L735
crs4/hl7apy
hl7apy/core.py
Element.validate
def validate(self, report_file=None): """ Validate the HL7 element using the :attr:`STRICT <hl7apy.consts.VALIDATION_LEVEL.STRICT>` validation level. It calls the :func:`Validator.validate <hl7apy.validation.Validator.validate>` method passing the reference used in the instantiation of t...
python
def validate(self, report_file=None): """ Validate the HL7 element using the :attr:`STRICT <hl7apy.consts.VALIDATION_LEVEL.STRICT>` validation level. It calls the :func:`Validator.validate <hl7apy.validation.Validator.validate>` method passing the reference used in the instantiation of t...
Validate the HL7 element using the :attr:`STRICT <hl7apy.consts.VALIDATION_LEVEL.STRICT>` validation level. It calls the :func:`Validator.validate <hl7apy.validation.Validator.validate>` method passing the reference used in the instantiation of the element. :param: report_file: the report file ...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/core.py#L737-L745
crs4/hl7apy
hl7apy/core.py
Element.encoding_chars
def encoding_chars(self): """ A ``dict`` with the encoding chars of the :class:`Element <hl7apy.core.Element>`. If the :class:`Element <hl7apy.core.Element>` has a parent it is the parent's ``encoding_chars`` otherwise the ones returned by :func:`get_default_encoding_chars <hl7ap...
python
def encoding_chars(self): """ A ``dict`` with the encoding chars of the :class:`Element <hl7apy.core.Element>`. If the :class:`Element <hl7apy.core.Element>` has a parent it is the parent's ``encoding_chars`` otherwise the ones returned by :func:`get_default_encoding_chars <hl7ap...
A ``dict`` with the encoding chars of the :class:`Element <hl7apy.core.Element>`. If the :class:`Element <hl7apy.core.Element>` has a parent it is the parent's ``encoding_chars`` otherwise the ones returned by :func:`get_default_encoding_chars <hl7apy.get_default_encoding_chars>` The str...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/core.py#L788-L809
crs4/hl7apy
hl7apy/core.py
SubComponent.to_er7
def to_er7(self, encoding_chars=None, trailing_children=False): """ Return the ER7-encoded string :type encoding_chars: ``dict`` :param encoding_chars: a dictionary containing the encoding chars or None to use the default (see :func:`get_default_encoding_chars <hl7apy.get_de...
python
def to_er7(self, encoding_chars=None, trailing_children=False): """ Return the ER7-encoded string :type encoding_chars: ``dict`` :param encoding_chars: a dictionary containing the encoding chars or None to use the default (see :func:`get_default_encoding_chars <hl7apy.get_de...
Return the ER7-encoded string :type encoding_chars: ``dict`` :param encoding_chars: a dictionary containing the encoding chars or None to use the default (see :func:`get_default_encoding_chars <hl7apy.get_default_encoding_chars>`) :type trailing_children: ``bool`` :param tr...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/core.py#L1126-L1150
crs4/hl7apy
hl7apy/core.py
Component.add_subcomponent
def add_subcomponent(self, name): """ Create an instance of :class:`SubComponent <hl7apy.core.SubComponent>` having the given name :param name: the name of the subcomponent to be created (e.g. CE_1) :return: an instance of :class:`SubComponent <hl7apy.core.SubComponent>` >>> c ...
python
def add_subcomponent(self, name): """ Create an instance of :class:`SubComponent <hl7apy.core.SubComponent>` having the given name :param name: the name of the subcomponent to be created (e.g. CE_1) :return: an instance of :class:`SubComponent <hl7apy.core.SubComponent>` >>> c ...
Create an instance of :class:`SubComponent <hl7apy.core.SubComponent>` having the given name :param name: the name of the subcomponent to be created (e.g. CE_1) :return: an instance of :class:`SubComponent <hl7apy.core.SubComponent>` >>> c = Component(datatype='CE') >>> ce_1 = c.add_su...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/core.py#L1242-L1259
crs4/hl7apy
hl7apy/core.py
Component.add
def add(self, obj): """ Add an instance of :class:`SubComponent <hl7apy.core.SubComponent>` to the list of children :param obj: an instance of :class:`SubComponent <hl7apy.core.SubComponent>` >>> c = Component('CX_10') >>> s = SubComponent(name='CWE_1', value='EXAMPLE_ID') ...
python
def add(self, obj): """ Add an instance of :class:`SubComponent <hl7apy.core.SubComponent>` to the list of children :param obj: an instance of :class:`SubComponent <hl7apy.core.SubComponent>` >>> c = Component('CX_10') >>> s = SubComponent(name='CWE_1', value='EXAMPLE_ID') ...
Add an instance of :class:`SubComponent <hl7apy.core.SubComponent>` to the list of children :param obj: an instance of :class:`SubComponent <hl7apy.core.SubComponent>` >>> c = Component('CX_10') >>> s = SubComponent(name='CWE_1', value='EXAMPLE_ID') >>> s2 = SubComponent(name='CWE_4', ...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/core.py#L1261-L1291
crs4/hl7apy
hl7apy/core.py
Field.add
def add(self, obj): """ Add an instance of :class:`Component <hl7apy.core.Component>` to the list of children :param obj: an instance of :class:`Component <hl7apy.core.Component>` >>> f = Field('PID_5') >>> f.xpn_1 = 'EVERYMAN' >>> c = Component('XPN_2') >>> c.v...
python
def add(self, obj): """ Add an instance of :class:`Component <hl7apy.core.Component>` to the list of children :param obj: an instance of :class:`Component <hl7apy.core.Component>` >>> f = Field('PID_5') >>> f.xpn_1 = 'EVERYMAN' >>> c = Component('XPN_2') >>> c.v...
Add an instance of :class:`Component <hl7apy.core.Component>` to the list of children :param obj: an instance of :class:`Component <hl7apy.core.Component>` >>> f = Field('PID_5') >>> f.xpn_1 = 'EVERYMAN' >>> c = Component('XPN_2') >>> c.value = 'ADAM' >>> f.add(c) ...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/core.py#L1402-L1421
crs4/hl7apy
hl7apy/core.py
Field.to_er7
def to_er7(self, encoding_chars=None, trailing_children=False): """ Return the ER7-encoded string :type encoding_chars: ``dict`` :param encoding_chars: a dictionary containing the encoding chars or None to use the default (see :func:`get_default_encoding <hl7apy.get_default_...
python
def to_er7(self, encoding_chars=None, trailing_children=False): """ Return the ER7-encoded string :type encoding_chars: ``dict`` :param encoding_chars: a dictionary containing the encoding chars or None to use the default (see :func:`get_default_encoding <hl7apy.get_default_...
Return the ER7-encoded string :type encoding_chars: ``dict`` :param encoding_chars: a dictionary containing the encoding chars or None to use the default (see :func:`get_default_encoding <hl7apy.get_default_encoding_chars>`) :type trailing_children: ``bool`` :param trailing...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/core.py#L1433-L1463
crs4/hl7apy
hl7apy/core.py
Field._get_traversal_children
def _get_traversal_children(self, name): """ Retrieve component and subcomponent indexes from the given traversal path (e.g. PID_1_2 -> component=2, subcomponent=None) """ name = name.upper() parts = name.split('_') try: assert 3 <= len(parts) <= 4 ...
python
def _get_traversal_children(self, name): """ Retrieve component and subcomponent indexes from the given traversal path (e.g. PID_1_2 -> component=2, subcomponent=None) """ name = name.upper() parts = name.split('_') try: assert 3 <= len(parts) <= 4 ...
Retrieve component and subcomponent indexes from the given traversal path (e.g. PID_1_2 -> component=2, subcomponent=None)
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/core.py#L1491-L1508
crs4/hl7apy
hl7apy/core.py
Segment.find_child_reference
def find_child_reference(self, name): """ Override the corresponding :class`Element <hl7apy.core.Element>`'s method. This is done for segments that allow children other than the ones expected in the HL7 structure: the ones with the last known field of type `varies` and the Z-Segments. ...
python
def find_child_reference(self, name): """ Override the corresponding :class`Element <hl7apy.core.Element>`'s method. This is done for segments that allow children other than the ones expected in the HL7 structure: the ones with the last known field of type `varies` and the Z-Segments. ...
Override the corresponding :class`Element <hl7apy.core.Element>`'s method. This is done for segments that allow children other than the ones expected in the HL7 structure: the ones with the last known field of type `varies` and the Z-Segments. The :class:`Field <hl7apy.core.Field>` will be creat...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/core.py#L1636-L1667
crs4/hl7apy
hl7apy/core.py
Segment.to_er7
def to_er7(self, encoding_chars=None, trailing_children=False): """ Return the ER7-encoded string :type encoding_chars: ``dict`` :param encoding_chars: a dictionary containing the encoding chars or None to use the default (see :func:`get_default_encoding_chars <hl7apy.get_de...
python
def to_er7(self, encoding_chars=None, trailing_children=False): """ Return the ER7-encoded string :type encoding_chars: ``dict`` :param encoding_chars: a dictionary containing the encoding chars or None to use the default (see :func:`get_default_encoding_chars <hl7apy.get_de...
Return the ER7-encoded string :type encoding_chars: ``dict`` :param encoding_chars: a dictionary containing the encoding chars or None to use the default (see :func:`get_default_encoding_chars <hl7apy.get_default_encoding_chars>`) :type trailing_children: ``bool`` :param tr...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/core.py#L1685-L1722
crs4/hl7apy
hl7apy/core.py
Message.to_mllp
def to_mllp(self, encoding_chars=None, trailing_children=False): """ Returns the er7 representation of the message wrapped with mllp encoding characters :type encoding_chars: ``dict`` :param encoding_chars: a dictionary containing the encoding chars or None to use the default ...
python
def to_mllp(self, encoding_chars=None, trailing_children=False): """ Returns the er7 representation of the message wrapped with mllp encoding characters :type encoding_chars: ``dict`` :param encoding_chars: a dictionary containing the encoding chars or None to use the default ...
Returns the er7 representation of the message wrapped with mllp encoding characters :type encoding_chars: ``dict`` :param encoding_chars: a dictionary containing the encoding chars or None to use the default (see :func:`get_default_encoding_chars <hl7apy.get_default_encoding_chars>`) ...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/core.py#L1969-L1988
crs4/hl7apy
hl7apy/validation.py
Validator.validate
def validate(element, reference=None, report_file=None): """ Checks if the :class:`Element <hl7apy.core.Element>` is a valid HL7 message according to the reference specified. If the reference is not specified, it will be used the official HL7 structures for the elements. In parti...
python
def validate(element, reference=None, report_file=None): """ Checks if the :class:`Element <hl7apy.core.Element>` is a valid HL7 message according to the reference specified. If the reference is not specified, it will be used the official HL7 structures for the elements. In parti...
Checks if the :class:`Element <hl7apy.core.Element>` is a valid HL7 message according to the reference specified. If the reference is not specified, it will be used the official HL7 structures for the elements. In particular it checks: * the maximum and minimum number of occurrences for...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/validation.py#L40-L210
crs4/hl7apy
hl7apy/parser.py
parse_message
def parse_message(message, validation_level=None, find_groups=True, message_profile=None, report_file=None, force_validation=False): """ Parse the given ER7-encoded message and return an instance of :class:`Message <hl7apy.core.Message>`. :type message: ``str`` :param message: the ER7...
python
def parse_message(message, validation_level=None, find_groups=True, message_profile=None, report_file=None, force_validation=False): """ Parse the given ER7-encoded message and return an instance of :class:`Message <hl7apy.core.Message>`. :type message: ``str`` :param message: the ER7...
Parse the given ER7-encoded message and return an instance of :class:`Message <hl7apy.core.Message>`. :type message: ``str`` :param message: the ER7-encoded message to be parsed :type validation_level: ``int`` :param validation_level: the validation level. Possible values are those defined in ...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/parser.py#L38-L100
crs4/hl7apy
hl7apy/parser.py
parse_segments
def parse_segments(text, version=None, encoding_chars=None, validation_level=None, references=None, find_groups=False): """ Parse the given ER7-encoded segments and return a list of :class:`hl7apy.core.Segment` instances. :type text: ``str`` :param text: the ER7-encoded string containing the segments t...
python
def parse_segments(text, version=None, encoding_chars=None, validation_level=None, references=None, find_groups=False): """ Parse the given ER7-encoded segments and return a list of :class:`hl7apy.core.Segment` instances. :type text: ``str`` :param text: the ER7-encoded string containing the segments t...
Parse the given ER7-encoded segments and return a list of :class:`hl7apy.core.Segment` instances. :type text: ``str`` :param text: the ER7-encoded string containing the segments to be parsed :type version: ``str`` :param version: the HL7 version (e.g. "2.5"), or ``None`` to use the default (se...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/parser.py#L103-L195
crs4/hl7apy
hl7apy/parser.py
parse_segment
def parse_segment(text, version=None, encoding_chars=None, validation_level=None, reference=None): """ Parse the given ER7-encoded segment and return an instance of :class:`Segment <hl7apy.core.Segment>`. :type text: ``str`` :param text: the ER7-encoded string containing the segment to be parsed :...
python
def parse_segment(text, version=None, encoding_chars=None, validation_level=None, reference=None): """ Parse the given ER7-encoded segment and return an instance of :class:`Segment <hl7apy.core.Segment>`. :type text: ``str`` :param text: the ER7-encoded string containing the segment to be parsed :...
Parse the given ER7-encoded segment and return an instance of :class:`Segment <hl7apy.core.Segment>`. :type text: ``str`` :param text: the ER7-encoded string containing the segment to be parsed :type version: ``str`` :param version: the HL7 version (e.g. "2.5"), or ``None`` to use the default ...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/parser.py#L198-L242
crs4/hl7apy
hl7apy/parser.py
parse_fields
def parse_fields(text, name_prefix=None, version=None, encoding_chars=None, validation_level=None, references=None, force_varies=False): """ Parse the given ER7-encoded fields and return a list of :class:`hl7apy.core.Field`. :type text: ``str`` :param text: the ER7-encoded string conta...
python
def parse_fields(text, name_prefix=None, version=None, encoding_chars=None, validation_level=None, references=None, force_varies=False): """ Parse the given ER7-encoded fields and return a list of :class:`hl7apy.core.Field`. :type text: ``str`` :param text: the ER7-encoded string conta...
Parse the given ER7-encoded fields and return a list of :class:`hl7apy.core.Field`. :type text: ``str`` :param text: the ER7-encoded string containing the fields to be parsed :type name_prefix: ``str`` :param name_prefix: the field prefix (e.g. MSH) :type version: ``str`` :param version: the ...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/parser.py#L245-L319
crs4/hl7apy
hl7apy/parser.py
parse_field
def parse_field(text, name=None, version=None, encoding_chars=None, validation_level=None, reference=None, force_varies=False): """ Parse the given ER7-encoded field and return an instance of :class:`Field <hl7apy.core.Field>`. :type text: ``str`` :param text: the ER7-encoded string con...
python
def parse_field(text, name=None, version=None, encoding_chars=None, validation_level=None, reference=None, force_varies=False): """ Parse the given ER7-encoded field and return an instance of :class:`Field <hl7apy.core.Field>`. :type text: ``str`` :param text: the ER7-encoded string con...
Parse the given ER7-encoded field and return an instance of :class:`Field <hl7apy.core.Field>`. :type text: ``str`` :param text: the ER7-encoded string containing the fields to be parsed :type name: ``str`` :param name: the field name (e.g. MSH_7) :type version: ``str`` :param version: the HL...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/parser.py#L322-L394
crs4/hl7apy
hl7apy/parser.py
parse_components
def parse_components(text, field_datatype='ST', version=None, encoding_chars=None, validation_level=None, references=None): """ Parse the given ER7-encoded components and return a list of :class:`Component <hl7apy.core.Component>` instances. :type text: ``str`` :param text: the...
python
def parse_components(text, field_datatype='ST', version=None, encoding_chars=None, validation_level=None, references=None): """ Parse the given ER7-encoded components and return a list of :class:`Component <hl7apy.core.Component>` instances. :type text: ``str`` :param text: the...
Parse the given ER7-encoded components and return a list of :class:`Component <hl7apy.core.Component>` instances. :type text: ``str`` :param text: the ER7-encoded string containing the components to be parsed :type field_datatype: ``str`` :param field_datatype: the datatype of the components (e.g....
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/parser.py#L397-L463
crs4/hl7apy
hl7apy/parser.py
parse_component
def parse_component(text, name=None, datatype='ST', version=None, encoding_chars=None, validation_level=None, reference=None): """ Parse the given ER7-encoded component and return an instance of :class:`Component <hl7apy.core.Component>`. :type text: ``str`` :param text: the ER7...
python
def parse_component(text, name=None, datatype='ST', version=None, encoding_chars=None, validation_level=None, reference=None): """ Parse the given ER7-encoded component and return an instance of :class:`Component <hl7apy.core.Component>`. :type text: ``str`` :param text: the ER7...
Parse the given ER7-encoded component and return an instance of :class:`Component <hl7apy.core.Component>`. :type text: ``str`` :param text: the ER7-encoded string containing the components to be parsed :type name: ``str`` :param name: the component's name (e.g. XPN_2) :type datatype: ``str``...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/parser.py#L466-L527
crs4/hl7apy
hl7apy/parser.py
parse_subcomponents
def parse_subcomponents(text, component_datatype='ST', version=None, encoding_chars=None, validation_level=None): """ Parse the given ER7-encoded subcomponents and return a list of :class:`SubComponent <hl7apy.core.SubComponent>` instances. :type text: ``str`` :param text: t...
python
def parse_subcomponents(text, component_datatype='ST', version=None, encoding_chars=None, validation_level=None): """ Parse the given ER7-encoded subcomponents and return a list of :class:`SubComponent <hl7apy.core.SubComponent>` instances. :type text: ``str`` :param text: t...
Parse the given ER7-encoded subcomponents and return a list of :class:`SubComponent <hl7apy.core.SubComponent>` instances. :type text: ``str`` :param text: the ER7-encoded string containing the components to be parsed :type component_datatype: ``str`` :param component_datatype: the datatype of the...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/parser.py#L530-L588
crs4/hl7apy
hl7apy/parser.py
parse_subcomponent
def parse_subcomponent(text, name=None, datatype='ST', version=None, validation_level=None): """ Parse the given ER7-encoded component and return an instance of :class:`SubComponent <hl7apy.core.SubComponent>`. :type text: ``str`` :param text: the ER7-encoded string containing the subcomponent data...
python
def parse_subcomponent(text, name=None, datatype='ST', version=None, validation_level=None): """ Parse the given ER7-encoded component and return an instance of :class:`SubComponent <hl7apy.core.SubComponent>`. :type text: ``str`` :param text: the ER7-encoded string containing the subcomponent data...
Parse the given ER7-encoded component and return an instance of :class:`SubComponent <hl7apy.core.SubComponent>`. :type text: ``str`` :param text: the ER7-encoded string containing the subcomponent data :type name: ``str`` :param name: the subcomponent's name (e.g. XPN_2) :type datatype: ``st...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/parser.py#L591-L620
crs4/hl7apy
hl7apy/factories.py
datatype_factory
def datatype_factory(datatype, value, version=None, validation_level=None): """ Factory function for both base and complex datatypes. It generates the correct object according to the datatype in input. It should be noted that if you use the factory it is not possible to specify some parameters for t...
python
def datatype_factory(datatype, value, version=None, validation_level=None): """ Factory function for both base and complex datatypes. It generates the correct object according to the datatype in input. It should be noted that if you use the factory it is not possible to specify some parameters for t...
Factory function for both base and complex datatypes. It generates the correct object according to the datatype in input. It should be noted that if you use the factory it is not possible to specify some parameters for the datatype (e.g. the format for datetime base datatypes) If the value is not valid ...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/factories.py#L36-L105
crs4/hl7apy
hl7apy/factories.py
date_factory
def date_factory(value, datatype_cls, validation_level=None): """ Creates a :class:`DT <hl7apy.base_datatypes.DT>` object The value in input must be a string parsable with :meth:`datetime.strptime`. The date format is chosen according to the length of the value as stated in this table: +-------+--...
python
def date_factory(value, datatype_cls, validation_level=None): """ Creates a :class:`DT <hl7apy.base_datatypes.DT>` object The value in input must be a string parsable with :meth:`datetime.strptime`. The date format is chosen according to the length of the value as stated in this table: +-------+--...
Creates a :class:`DT <hl7apy.base_datatypes.DT>` object The value in input must be a string parsable with :meth:`datetime.strptime`. The date format is chosen according to the length of the value as stated in this table: +-------+-----------+ |Length |Format | +=======+===========+ |4 ...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/factories.py#L108-L155
crs4/hl7apy
hl7apy/factories.py
timestamp_factory
def timestamp_factory(value, datatype_cls, validation_level=None): """ Creates a :class:`TM <hl7apy.base_datatypes.TM>` object The value in input must be a string parsable with :meth:`datetime.strptime`. It can also have an offset part specified with the format +/-HHMM. The offset can be added with...
python
def timestamp_factory(value, datatype_cls, validation_level=None): """ Creates a :class:`TM <hl7apy.base_datatypes.TM>` object The value in input must be a string parsable with :meth:`datetime.strptime`. It can also have an offset part specified with the format +/-HHMM. The offset can be added with...
Creates a :class:`TM <hl7apy.base_datatypes.TM>` object The value in input must be a string parsable with :meth:`datetime.strptime`. It can also have an offset part specified with the format +/-HHMM. The offset can be added with all the allowed format The date format is chosen according to the length o...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/factories.py#L158-L211
crs4/hl7apy
hl7apy/factories.py
datetime_factory
def datetime_factory(value, datatype_cls, validation_level=None): """ Creates a :class:`hl7apy.base_datatypes.DTM` object The value in input must be a string parsable with :meth:`datetime.strptime`. It can also have an offset part specified with the format +HHMM -HHMM. The offset can be added with ...
python
def datetime_factory(value, datatype_cls, validation_level=None): """ Creates a :class:`hl7apy.base_datatypes.DTM` object The value in input must be a string parsable with :meth:`datetime.strptime`. It can also have an offset part specified with the format +HHMM -HHMM. The offset can be added with ...
Creates a :class:`hl7apy.base_datatypes.DTM` object The value in input must be a string parsable with :meth:`datetime.strptime`. It can also have an offset part specified with the format +HHMM -HHMM. The offset can be added with all the allowed format. The date format is chosen according to the length ...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/factories.py#L214-L271
crs4/hl7apy
hl7apy/factories.py
numeric_factory
def numeric_factory(value, datatype_cls, validation_level=None): """ Creates a :class:`NM <hl7apy.base_datatypes.NM>` object The value in input can be a string representing a decimal number or a ``float``. (i.e. a string valid for :class:`decimal.Decimal()`). If it's not, a :exc:`ValueError` is rai...
python
def numeric_factory(value, datatype_cls, validation_level=None): """ Creates a :class:`NM <hl7apy.base_datatypes.NM>` object The value in input can be a string representing a decimal number or a ``float``. (i.e. a string valid for :class:`decimal.Decimal()`). If it's not, a :exc:`ValueError` is rai...
Creates a :class:`NM <hl7apy.base_datatypes.NM>` object The value in input can be a string representing a decimal number or a ``float``. (i.e. a string valid for :class:`decimal.Decimal()`). If it's not, a :exc:`ValueError` is raised Also an empty string or ``None`` are allowed :type value: ``str`...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/factories.py#L274-L301
crs4/hl7apy
hl7apy/factories.py
sequence_id_factory
def sequence_id_factory(value, datatype_cls, validation_level=None): """ Creates a :class:`SI <hl7apy.base_datatypes.SI>` object The value in input can be a string representing an integer number or an ``int``. (i.e. a string valid for ``int()`` ). If it's not, a :exc:`ValueError` is raised Als...
python
def sequence_id_factory(value, datatype_cls, validation_level=None): """ Creates a :class:`SI <hl7apy.base_datatypes.SI>` object The value in input can be a string representing an integer number or an ``int``. (i.e. a string valid for ``int()`` ). If it's not, a :exc:`ValueError` is raised Als...
Creates a :class:`SI <hl7apy.base_datatypes.SI>` object The value in input can be a string representing an integer number or an ``int``. (i.e. a string valid for ``int()`` ). If it's not, a :exc:`ValueError` is raised Also an empty string or ``None`` are allowed :type value: ``str`` or ``None`` ...
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/factories.py#L304-L331
playpauseandstop/Flask-And-Redis
flask_redis.py
Redis.get_app
def get_app(self): """Get current app from Flast stack to use. This will allow to ensure which Redis connection to be used when accessing Redis connection public methods via plugin. """ # First see to connection stack ctx = connection_stack.top if ctx is not None...
python
def get_app(self): """Get current app from Flast stack to use. This will allow to ensure which Redis connection to be used when accessing Redis connection public methods via plugin. """ # First see to connection stack ctx = connection_stack.top if ctx is not None...
Get current app from Flast stack to use. This will allow to ensure which Redis connection to be used when accessing Redis connection public methods via plugin.
https://github.com/playpauseandstop/Flask-And-Redis/blob/878bb193ae4a8c3497f6f1ff1511a3b8c96d08b5/flask_redis.py#L79-L98
playpauseandstop/Flask-And-Redis
flask_redis.py
Redis.init_app
def init_app(self, app, config_prefix=None): """ Actual method to read redis settings from app configuration, initialize Redis connection and copy all public connection methods to current instance. :param app: :class:`flask.Flask` application instance. :param config_pref...
python
def init_app(self, app, config_prefix=None): """ Actual method to read redis settings from app configuration, initialize Redis connection and copy all public connection methods to current instance. :param app: :class:`flask.Flask` application instance. :param config_pref...
Actual method to read redis settings from app configuration, initialize Redis connection and copy all public connection methods to current instance. :param app: :class:`flask.Flask` application instance. :param config_prefix: Config prefix to use. By default: ``REDIS``
https://github.com/playpauseandstop/Flask-And-Redis/blob/878bb193ae4a8c3497f6f1ff1511a3b8c96d08b5/flask_redis.py#L100-L170
playpauseandstop/Flask-And-Redis
flask_redis.py
Redis._build_connection_args
def _build_connection_args(self, klass): """Read connection args spec, exclude self from list of possible :param klass: Redis connection class. """ bases = [base for base in klass.__bases__ if base is not object] all_args = [] for cls in [klass] + bases: try:...
python
def _build_connection_args(self, klass): """Read connection args spec, exclude self from list of possible :param klass: Redis connection class. """ bases = [base for base in klass.__bases__ if base is not object] all_args = [] for cls in [klass] + bases: try:...
Read connection args spec, exclude self from list of possible :param klass: Redis connection class.
https://github.com/playpauseandstop/Flask-And-Redis/blob/878bb193ae4a8c3497f6f1ff1511a3b8c96d08b5/flask_redis.py#L172-L189
playpauseandstop/Flask-And-Redis
flask_redis.py
Redis._include_public_methods
def _include_public_methods(self, connection): """Include public methods from Redis connection to current instance. :param connection: Redis connection instance. """ for attr in dir(connection): value = getattr(connection, attr) if attr.startswith('_') or not cal...
python
def _include_public_methods(self, connection): """Include public methods from Redis connection to current instance. :param connection: Redis connection instance. """ for attr in dir(connection): value = getattr(connection, attr) if attr.startswith('_') or not cal...
Include public methods from Redis connection to current instance. :param connection: Redis connection instance.
https://github.com/playpauseandstop/Flask-And-Redis/blob/878bb193ae4a8c3497f6f1ff1511a3b8c96d08b5/flask_redis.py#L191-L200
playpauseandstop/Flask-And-Redis
flask_redis.py
Redis._wrap_public_method
def _wrap_public_method(self, attr): """ Ensure that plugin will call current connection method when accessing as ``plugin.<public_method>(*args, **kwargs)``. """ def wrapper(*args, **kwargs): return getattr(self.connection, attr)(*args, **kwargs) return wrapp...
python
def _wrap_public_method(self, attr): """ Ensure that plugin will call current connection method when accessing as ``plugin.<public_method>(*args, **kwargs)``. """ def wrapper(*args, **kwargs): return getattr(self.connection, attr)(*args, **kwargs) return wrapp...
Ensure that plugin will call current connection method when accessing as ``plugin.<public_method>(*args, **kwargs)``.
https://github.com/playpauseandstop/Flask-And-Redis/blob/878bb193ae4a8c3497f6f1ff1511a3b8c96d08b5/flask_redis.py#L202-L209
JonathonReinhart/scuba
scuba/__main__.py
ScubaDive.prepare
def prepare(self): '''Prepare to run the docker command''' self.__make_scubadir() if self.is_remote_docker: ''' Docker is running remotely (e.g. boot2docker on OSX). We don't need to do any user setup whatsoever. TODO: For now, remote instances w...
python
def prepare(self): '''Prepare to run the docker command''' self.__make_scubadir() if self.is_remote_docker: ''' Docker is running remotely (e.g. boot2docker on OSX). We don't need to do any user setup whatsoever. TODO: For now, remote instances w...
Prepare to run the docker command
https://github.com/JonathonReinhart/scuba/blob/0244c81ec482d3c60202028bc075621447bc3ad1/scuba/__main__.py#L119-L139
JonathonReinhart/scuba
scuba/__main__.py
ScubaDive.add_env
def add_env(self, name, val): '''Add an environment variable to the docker run invocation ''' if name in self.env_vars: raise KeyError(name) self.env_vars[name] = val
python
def add_env(self, name, val): '''Add an environment variable to the docker run invocation ''' if name in self.env_vars: raise KeyError(name) self.env_vars[name] = val
Add an environment variable to the docker run invocation
https://github.com/JonathonReinhart/scuba/blob/0244c81ec482d3c60202028bc075621447bc3ad1/scuba/__main__.py#L176-L181
JonathonReinhart/scuba
scuba/__main__.py
ScubaDive.add_volume
def add_volume(self, hostpath, contpath, options=None): '''Add a volume (bind-mount) to the docker run invocation ''' if options is None: options = [] self.volumes.append((hostpath, contpath, options))
python
def add_volume(self, hostpath, contpath, options=None): '''Add a volume (bind-mount) to the docker run invocation ''' if options is None: options = [] self.volumes.append((hostpath, contpath, options))
Add a volume (bind-mount) to the docker run invocation
https://github.com/JonathonReinhart/scuba/blob/0244c81ec482d3c60202028bc075621447bc3ad1/scuba/__main__.py#L183-L188
JonathonReinhart/scuba
scuba/__main__.py
ScubaDive.__locate_scubainit
def __locate_scubainit(self): '''Determine path to scubainit binary ''' pkg_path = os.path.dirname(__file__) self.scubainit_path = os.path.join(pkg_path, 'scubainit') if not os.path.isfile(self.scubainit_path): raise ScubaError('scubainit not found at "{}"'.format(se...
python
def __locate_scubainit(self): '''Determine path to scubainit binary ''' pkg_path = os.path.dirname(__file__) self.scubainit_path = os.path.join(pkg_path, 'scubainit') if not os.path.isfile(self.scubainit_path): raise ScubaError('scubainit not found at "{}"'.format(se...
Determine path to scubainit binary
https://github.com/JonathonReinhart/scuba/blob/0244c81ec482d3c60202028bc075621447bc3ad1/scuba/__main__.py#L198-L205
JonathonReinhart/scuba
scuba/__main__.py
ScubaDive.__load_config
def __load_config(self): '''Find and load .scuba.yml ''' # top_path is where .scuba.yml is found, and becomes the top of our bind mount. # top_rel is the relative path from top_path to the current working directory, # and is where we'll set the working directory in the container...
python
def __load_config(self): '''Find and load .scuba.yml ''' # top_path is where .scuba.yml is found, and becomes the top of our bind mount. # top_rel is the relative path from top_path to the current working directory, # and is where we'll set the working directory in the container...
Find and load .scuba.yml
https://github.com/JonathonReinhart/scuba/blob/0244c81ec482d3c60202028bc075621447bc3ad1/scuba/__main__.py#L208-L235
JonathonReinhart/scuba
scuba/__main__.py
ScubaDive.__make_scubadir
def __make_scubadir(self): '''Make temp directory where all ancillary files are bind-mounted ''' self.__scubadir_hostpath = tempfile.mkdtemp(prefix='scubadir') self.__scubadir_contpath = '/.scuba' self.add_volume(self.__scubadir_hostpath, self.__scubadir_contpath)
python
def __make_scubadir(self): '''Make temp directory where all ancillary files are bind-mounted ''' self.__scubadir_hostpath = tempfile.mkdtemp(prefix='scubadir') self.__scubadir_contpath = '/.scuba' self.add_volume(self.__scubadir_hostpath, self.__scubadir_contpath)
Make temp directory where all ancillary files are bind-mounted
https://github.com/JonathonReinhart/scuba/blob/0244c81ec482d3c60202028bc075621447bc3ad1/scuba/__main__.py#L237-L242
JonathonReinhart/scuba
scuba/__main__.py
ScubaDive.__setup_native_run
def __setup_native_run(self): # These options are appended to mounted volume arguments # NOTE: This tells Docker to re-label the directory for compatibility # with SELinux. See `man docker-run` for more information. self.vol_opts = ['z'] # Pass variables to scubainit se...
python
def __setup_native_run(self): # These options are appended to mounted volume arguments # NOTE: This tells Docker to re-label the directory for compatibility # with SELinux. See `man docker-run` for more information. self.vol_opts = ['z'] # Pass variables to scubainit se...
Normally, if the user provides no command to "docker run", the image's default CMD is run. Because we set the entrypiont, scuba must emulate the default behavior itself.
https://github.com/JonathonReinhart/scuba/blob/0244c81ec482d3c60202028bc075621447bc3ad1/scuba/__main__.py#L244-L326
JonathonReinhart/scuba
scuba/__main__.py
ScubaDive.open_scubadir_file
def open_scubadir_file(self, name, mode): '''Opens a file in the 'scubadir' This file will automatically be bind-mounted into the container, at a path given by the 'container_path' property on the returned file object. ''' path = os.path.join(self.__scubadir_hostpath, name) ...
python
def open_scubadir_file(self, name, mode): '''Opens a file in the 'scubadir' This file will automatically be bind-mounted into the container, at a path given by the 'container_path' property on the returned file object. ''' path = os.path.join(self.__scubadir_hostpath, name) ...
Opens a file in the 'scubadir' This file will automatically be bind-mounted into the container, at a path given by the 'container_path' property on the returned file object.
https://github.com/JonathonReinhart/scuba/blob/0244c81ec482d3c60202028bc075621447bc3ad1/scuba/__main__.py#L330-L344
JonathonReinhart/scuba
scuba/__main__.py
ScubaDive.copy_scubadir_file
def copy_scubadir_file(self, name, source): '''Copies source into the scubadir Returns the container-path of the copied file ''' dest = os.path.join(self.__scubadir_hostpath, name) assert not os.path.exists(dest) shutil.copy2(source, dest) return os.path.join(se...
python
def copy_scubadir_file(self, name, source): '''Copies source into the scubadir Returns the container-path of the copied file ''' dest = os.path.join(self.__scubadir_hostpath, name) assert not os.path.exists(dest) shutil.copy2(source, dest) return os.path.join(se...
Copies source into the scubadir Returns the container-path of the copied file
https://github.com/JonathonReinhart/scuba/blob/0244c81ec482d3c60202028bc075621447bc3ad1/scuba/__main__.py#L347-L356
JonathonReinhart/scuba
scuba/utils.py
format_cmdline
def format_cmdline(args, maxwidth=80): '''Format args into a shell-quoted command line. The result will be wrapped to maxwidth characters where possible, not breaking a single long argument. ''' # Leave room for the space and backslash at the end of each line maxwidth -= 2 def lines(): ...
python
def format_cmdline(args, maxwidth=80): '''Format args into a shell-quoted command line. The result will be wrapped to maxwidth characters where possible, not breaking a single long argument. ''' # Leave room for the space and backslash at the end of each line maxwidth -= 2 def lines(): ...
Format args into a shell-quoted command line. The result will be wrapped to maxwidth characters where possible, not breaking a single long argument.
https://github.com/JonathonReinhart/scuba/blob/0244c81ec482d3c60202028bc075621447bc3ad1/scuba/utils.py#L13-L41
JonathonReinhart/scuba
scuba/utils.py
parse_env_var
def parse_env_var(s): """Parse an environment variable string Returns a key-value tuple Apply the same logic as `docker run -e`: "If the operator names an environment variable without specifying a value, then the current value of the named variable is propagated into the container's environmen...
python
def parse_env_var(s): """Parse an environment variable string Returns a key-value tuple Apply the same logic as `docker run -e`: "If the operator names an environment variable without specifying a value, then the current value of the named variable is propagated into the container's environmen...
Parse an environment variable string Returns a key-value tuple Apply the same logic as `docker run -e`: "If the operator names an environment variable without specifying a value, then the current value of the named variable is propagated into the container's environment
https://github.com/JonathonReinhart/scuba/blob/0244c81ec482d3c60202028bc075621447bc3ad1/scuba/utils.py#L53-L69
JonathonReinhart/scuba
scuba/dockerutil.py
__wrap_docker_exec
def __wrap_docker_exec(func): '''Wrap a function to raise DockerExecuteError on ENOENT''' def call(*args, **kwargs): try: return func(*args, **kwargs) except OSError as e: if e.errno == errno.ENOENT: raise DockerExecuteError('Failed to execute docker. Is i...
python
def __wrap_docker_exec(func): '''Wrap a function to raise DockerExecuteError on ENOENT''' def call(*args, **kwargs): try: return func(*args, **kwargs) except OSError as e: if e.errno == errno.ENOENT: raise DockerExecuteError('Failed to execute docker. Is i...
Wrap a function to raise DockerExecuteError on ENOENT
https://github.com/JonathonReinhart/scuba/blob/0244c81ec482d3c60202028bc075621447bc3ad1/scuba/dockerutil.py#L19-L28
JonathonReinhart/scuba
scuba/dockerutil.py
docker_inspect
def docker_inspect(image): '''Inspects a docker image Returns: Parsed JSON data ''' args = ['docker', 'inspect', '--type', 'image', image] p = Popen(args, stdout = subprocess.PIPE, stderr = subprocess.PIPE) stdout, stderr = p.communicate() stdout = stdout.decode('utf-8') stderr = stder...
python
def docker_inspect(image): '''Inspects a docker image Returns: Parsed JSON data ''' args = ['docker', 'inspect', '--type', 'image', image] p = Popen(args, stdout = subprocess.PIPE, stderr = subprocess.PIPE) stdout, stderr = p.communicate() stdout = stdout.decode('utf-8') stderr = stder...
Inspects a docker image Returns: Parsed JSON data
https://github.com/JonathonReinhart/scuba/blob/0244c81ec482d3c60202028bc075621447bc3ad1/scuba/dockerutil.py#L34-L51
JonathonReinhart/scuba
scuba/dockerutil.py
docker_pull
def docker_pull(image): '''Pulls an image''' args = ['docker', 'pull', image] # If this fails, the default docker stdout/stderr looks good to the user. ret = call(args) if ret != 0: raise DockerError('Failed to pull image "{}"'.format(image))
python
def docker_pull(image): '''Pulls an image''' args = ['docker', 'pull', image] # If this fails, the default docker stdout/stderr looks good to the user. ret = call(args) if ret != 0: raise DockerError('Failed to pull image "{}"'.format(image))
Pulls an image
https://github.com/JonathonReinhart/scuba/blob/0244c81ec482d3c60202028bc075621447bc3ad1/scuba/dockerutil.py#L53-L60
JonathonReinhart/scuba
scuba/dockerutil.py
get_image_command
def get_image_command(image): '''Gets the default command for an image''' info = docker_inspect_or_pull(image) try: return info['Config']['Cmd'] except KeyError as ke: raise DockerError('Failed to inspect image: JSON result missing key {}'.format(ke))
python
def get_image_command(image): '''Gets the default command for an image''' info = docker_inspect_or_pull(image) try: return info['Config']['Cmd'] except KeyError as ke: raise DockerError('Failed to inspect image: JSON result missing key {}'.format(ke))
Gets the default command for an image
https://github.com/JonathonReinhart/scuba/blob/0244c81ec482d3c60202028bc075621447bc3ad1/scuba/dockerutil.py#L71-L77
JonathonReinhart/scuba
scuba/dockerutil.py
get_image_entrypoint
def get_image_entrypoint(image): '''Gets the image entrypoint''' info = docker_inspect_or_pull(image) try: return info['Config']['Entrypoint'] except KeyError as ke: raise DockerError('Failed to inspect image: JSON result missing key {}'.format(ke))
python
def get_image_entrypoint(image): '''Gets the image entrypoint''' info = docker_inspect_or_pull(image) try: return info['Config']['Entrypoint'] except KeyError as ke: raise DockerError('Failed to inspect image: JSON result missing key {}'.format(ke))
Gets the image entrypoint
https://github.com/JonathonReinhart/scuba/blob/0244c81ec482d3c60202028bc075621447bc3ad1/scuba/dockerutil.py#L79-L85
JonathonReinhart/scuba
scuba/dockerutil.py
make_vol_opt
def make_vol_opt(hostdir, contdir, options=None): '''Generate a docker volume option''' vol = '--volume={}:{}'.format(hostdir, contdir) if options != None: if isinstance(options, str): options = (options,) vol += ':' + ','.join(options) return vol
python
def make_vol_opt(hostdir, contdir, options=None): '''Generate a docker volume option''' vol = '--volume={}:{}'.format(hostdir, contdir) if options != None: if isinstance(options, str): options = (options,) vol += ':' + ','.join(options) return vol
Generate a docker volume option
https://github.com/JonathonReinhart/scuba/blob/0244c81ec482d3c60202028bc075621447bc3ad1/scuba/dockerutil.py#L88-L95
JonathonReinhart/scuba
scuba/config.py
find_config
def find_config(): '''Search up the diretcory hierarchy for .scuba.yml Returns: path, rel on success, or None if not found path The absolute path of the directory where .scuba.yml was found rel The relative path from the directory where .scuba.yml was found to the current...
python
def find_config(): '''Search up the diretcory hierarchy for .scuba.yml Returns: path, rel on success, or None if not found path The absolute path of the directory where .scuba.yml was found rel The relative path from the directory where .scuba.yml was found to the current...
Search up the diretcory hierarchy for .scuba.yml Returns: path, rel on success, or None if not found path The absolute path of the directory where .scuba.yml was found rel The relative path from the directory where .scuba.yml was found to the current directory
https://github.com/JonathonReinhart/scuba/blob/0244c81ec482d3c60202028bc075621447bc3ad1/scuba/config.py#L74-L101
JonathonReinhart/scuba
scuba/config.py
_process_script_node
def _process_script_node(node, name): '''Process a script-type node This handles nodes that follow the *Common script schema*, as outlined in doc/yaml-reference.md. ''' if isinstance(node, basestring): # The script is just the text itself return [node] if isinstance(node, dict...
python
def _process_script_node(node, name): '''Process a script-type node This handles nodes that follow the *Common script schema*, as outlined in doc/yaml-reference.md. ''' if isinstance(node, basestring): # The script is just the text itself return [node] if isinstance(node, dict...
Process a script-type node This handles nodes that follow the *Common script schema*, as outlined in doc/yaml-reference.md.
https://github.com/JonathonReinhart/scuba/blob/0244c81ec482d3c60202028bc075621447bc3ad1/scuba/config.py#L104-L129
JonathonReinhart/scuba
scuba/config.py
Loader.from_yaml
def from_yaml(self, node): ''' Implementes a !from_yaml constructor with the following syntax: !from_yaml filename key Arguments: filename: Filename of external YAML document from which to load, relative to the current YAML file. key...
python
def from_yaml(self, node): ''' Implementes a !from_yaml constructor with the following syntax: !from_yaml filename key Arguments: filename: Filename of external YAML document from which to load, relative to the current YAML file. key...
Implementes a !from_yaml constructor with the following syntax: !from_yaml filename key Arguments: filename: Filename of external YAML document from which to load, relative to the current YAML file. key: Key from external YAML document to ret...
https://github.com/JonathonReinhart/scuba/blob/0244c81ec482d3c60202028bc075621447bc3ad1/scuba/config.py#L25-L69
JonathonReinhart/scuba
scuba/config.py
ScubaConfig.process_command
def process_command(self, command): '''Processes a user command using aliases Arguments: command A user command list (e.g. argv) Returns: A ScubaContext object with the following attributes: script: a list of command line strings image: the docker image ...
python
def process_command(self, command): '''Processes a user command using aliases Arguments: command A user command list (e.g. argv) Returns: A ScubaContext object with the following attributes: script: a list of command line strings image: the docker image ...
Processes a user command using aliases Arguments: command A user command list (e.g. argv) Returns: A ScubaContext object with the following attributes: script: a list of command line strings image: the docker image name to use
https://github.com/JonathonReinhart/scuba/blob/0244c81ec482d3c60202028bc075621447bc3ad1/scuba/config.py#L276-L324
chrislim2888/IP2Location-Python
IP2Location.py
IP2Location.open
def open(self, filename): ''' Opens a database file ''' # Ensure old file is closed before opening a new one self.close() self._f = open(filename, 'rb') self._dbtype = struct.unpack('B', self._f.read(1))[0] self._dbcolumn = struct.unpack('B', self._f.read(1))[0] ...
python
def open(self, filename): ''' Opens a database file ''' # Ensure old file is closed before opening a new one self.close() self._f = open(filename, 'rb') self._dbtype = struct.unpack('B', self._f.read(1))[0] self._dbcolumn = struct.unpack('B', self._f.read(1))[0] ...
Opens a database file
https://github.com/chrislim2888/IP2Location-Python/blob/6b2a7d3a5e61c9f8efda5ae96c7064f9a7714621/IP2Location.py#L105-L121
chrislim2888/IP2Location-Python
IP2Location.py
IP2Location.get_country_short
def get_country_short(self, ip): ''' Get country_short ''' rec = self.get_all(ip) return rec and rec.country_short
python
def get_country_short(self, ip): ''' Get country_short ''' rec = self.get_all(ip) return rec and rec.country_short
Get country_short
https://github.com/chrislim2888/IP2Location-Python/blob/6b2a7d3a5e61c9f8efda5ae96c7064f9a7714621/IP2Location.py#L129-L132
chrislim2888/IP2Location-Python
IP2Location.py
IP2Location.get_country_long
def get_country_long(self, ip): ''' Get country_long ''' rec = self.get_all(ip) return rec and rec.country_long
python
def get_country_long(self, ip): ''' Get country_long ''' rec = self.get_all(ip) return rec and rec.country_long
Get country_long
https://github.com/chrislim2888/IP2Location-Python/blob/6b2a7d3a5e61c9f8efda5ae96c7064f9a7714621/IP2Location.py#L133-L136
chrislim2888/IP2Location-Python
IP2Location.py
IP2Location.get_region
def get_region(self, ip): ''' Get region ''' rec = self.get_all(ip) return rec and rec.region
python
def get_region(self, ip): ''' Get region ''' rec = self.get_all(ip) return rec and rec.region
Get region
https://github.com/chrislim2888/IP2Location-Python/blob/6b2a7d3a5e61c9f8efda5ae96c7064f9a7714621/IP2Location.py#L137-L140
chrislim2888/IP2Location-Python
IP2Location.py
IP2Location.get_city
def get_city(self, ip): ''' Get city ''' rec = self.get_all(ip) return rec and rec.city
python
def get_city(self, ip): ''' Get city ''' rec = self.get_all(ip) return rec and rec.city
Get city
https://github.com/chrislim2888/IP2Location-Python/blob/6b2a7d3a5e61c9f8efda5ae96c7064f9a7714621/IP2Location.py#L141-L144
chrislim2888/IP2Location-Python
IP2Location.py
IP2Location.get_isp
def get_isp(self, ip): ''' Get isp ''' rec = self.get_all(ip) return rec and rec.isp
python
def get_isp(self, ip): ''' Get isp ''' rec = self.get_all(ip) return rec and rec.isp
Get isp
https://github.com/chrislim2888/IP2Location-Python/blob/6b2a7d3a5e61c9f8efda5ae96c7064f9a7714621/IP2Location.py#L145-L148
chrislim2888/IP2Location-Python
IP2Location.py
IP2Location.get_latitude
def get_latitude(self, ip): ''' Get latitude ''' rec = self.get_all(ip) return rec and rec.latitude
python
def get_latitude(self, ip): ''' Get latitude ''' rec = self.get_all(ip) return rec and rec.latitude
Get latitude
https://github.com/chrislim2888/IP2Location-Python/blob/6b2a7d3a5e61c9f8efda5ae96c7064f9a7714621/IP2Location.py#L149-L152
chrislim2888/IP2Location-Python
IP2Location.py
IP2Location.get_longitude
def get_longitude(self, ip): ''' Get longitude ''' rec = self.get_all(ip) return rec and rec.longitude
python
def get_longitude(self, ip): ''' Get longitude ''' rec = self.get_all(ip) return rec and rec.longitude
Get longitude
https://github.com/chrislim2888/IP2Location-Python/blob/6b2a7d3a5e61c9f8efda5ae96c7064f9a7714621/IP2Location.py#L153-L156
chrislim2888/IP2Location-Python
IP2Location.py
IP2Location.get_domain
def get_domain(self, ip): ''' Get domain ''' rec = self.get_all(ip) return rec and rec.domain
python
def get_domain(self, ip): ''' Get domain ''' rec = self.get_all(ip) return rec and rec.domain
Get domain
https://github.com/chrislim2888/IP2Location-Python/blob/6b2a7d3a5e61c9f8efda5ae96c7064f9a7714621/IP2Location.py#L157-L160
chrislim2888/IP2Location-Python
IP2Location.py
IP2Location.get_zipcode
def get_zipcode(self, ip): ''' Get zipcode ''' rec = self.get_all(ip) return rec and rec.zipcode
python
def get_zipcode(self, ip): ''' Get zipcode ''' rec = self.get_all(ip) return rec and rec.zipcode
Get zipcode
https://github.com/chrislim2888/IP2Location-Python/blob/6b2a7d3a5e61c9f8efda5ae96c7064f9a7714621/IP2Location.py#L161-L164
chrislim2888/IP2Location-Python
IP2Location.py
IP2Location.get_timezone
def get_timezone(self, ip): ''' Get timezone ''' rec = self.get_all(ip) return rec and rec.timezone
python
def get_timezone(self, ip): ''' Get timezone ''' rec = self.get_all(ip) return rec and rec.timezone
Get timezone
https://github.com/chrislim2888/IP2Location-Python/blob/6b2a7d3a5e61c9f8efda5ae96c7064f9a7714621/IP2Location.py#L165-L168
chrislim2888/IP2Location-Python
IP2Location.py
IP2Location.get_netspeed
def get_netspeed(self, ip): ''' Get netspeed ''' rec = self.get_all(ip) return rec and rec.netspeed
python
def get_netspeed(self, ip): ''' Get netspeed ''' rec = self.get_all(ip) return rec and rec.netspeed
Get netspeed
https://github.com/chrislim2888/IP2Location-Python/blob/6b2a7d3a5e61c9f8efda5ae96c7064f9a7714621/IP2Location.py#L169-L172
chrislim2888/IP2Location-Python
IP2Location.py
IP2Location.get_idd_code
def get_idd_code(self, ip): ''' Get idd_code ''' rec = self.get_all(ip) return rec and rec.idd_code
python
def get_idd_code(self, ip): ''' Get idd_code ''' rec = self.get_all(ip) return rec and rec.idd_code
Get idd_code
https://github.com/chrislim2888/IP2Location-Python/blob/6b2a7d3a5e61c9f8efda5ae96c7064f9a7714621/IP2Location.py#L173-L176
chrislim2888/IP2Location-Python
IP2Location.py
IP2Location.get_area_code
def get_area_code(self, ip): ''' Get area_code ''' rec = self.get_all(ip) return rec and rec.area_code
python
def get_area_code(self, ip): ''' Get area_code ''' rec = self.get_all(ip) return rec and rec.area_code
Get area_code
https://github.com/chrislim2888/IP2Location-Python/blob/6b2a7d3a5e61c9f8efda5ae96c7064f9a7714621/IP2Location.py#L177-L180
chrislim2888/IP2Location-Python
IP2Location.py
IP2Location.get_weather_code
def get_weather_code(self, ip): ''' Get weather_code ''' rec = self.get_all(ip) return rec and rec.weather_code
python
def get_weather_code(self, ip): ''' Get weather_code ''' rec = self.get_all(ip) return rec and rec.weather_code
Get weather_code
https://github.com/chrislim2888/IP2Location-Python/blob/6b2a7d3a5e61c9f8efda5ae96c7064f9a7714621/IP2Location.py#L181-L184
chrislim2888/IP2Location-Python
IP2Location.py
IP2Location.get_weather_name
def get_weather_name(self, ip): ''' Get weather_name ''' rec = self.get_all(ip) return rec and rec.weather_name
python
def get_weather_name(self, ip): ''' Get weather_name ''' rec = self.get_all(ip) return rec and rec.weather_name
Get weather_name
https://github.com/chrislim2888/IP2Location-Python/blob/6b2a7d3a5e61c9f8efda5ae96c7064f9a7714621/IP2Location.py#L185-L188
chrislim2888/IP2Location-Python
IP2Location.py
IP2Location.get_mcc
def get_mcc(self, ip): ''' Get mcc ''' rec = self.get_all(ip) return rec and rec.mcc
python
def get_mcc(self, ip): ''' Get mcc ''' rec = self.get_all(ip) return rec and rec.mcc
Get mcc
https://github.com/chrislim2888/IP2Location-Python/blob/6b2a7d3a5e61c9f8efda5ae96c7064f9a7714621/IP2Location.py#L189-L192
chrislim2888/IP2Location-Python
IP2Location.py
IP2Location.get_mnc
def get_mnc(self, ip): ''' Get mnc ''' rec = self.get_all(ip) return rec and rec.mnc
python
def get_mnc(self, ip): ''' Get mnc ''' rec = self.get_all(ip) return rec and rec.mnc
Get mnc
https://github.com/chrislim2888/IP2Location-Python/blob/6b2a7d3a5e61c9f8efda5ae96c7064f9a7714621/IP2Location.py#L193-L196
chrislim2888/IP2Location-Python
IP2Location.py
IP2Location.get_mobile_brand
def get_mobile_brand(self, ip): ''' Get mobile_brand ''' rec = self.get_all(ip) return rec and rec.mobile_brand
python
def get_mobile_brand(self, ip): ''' Get mobile_brand ''' rec = self.get_all(ip) return rec and rec.mobile_brand
Get mobile_brand
https://github.com/chrislim2888/IP2Location-Python/blob/6b2a7d3a5e61c9f8efda5ae96c7064f9a7714621/IP2Location.py#L197-L200