def get_pif(self, dataset_id, uid, dataset_version = None):

failure_message = "<STR_LIT>".format(uid)<EOL>if dataset_version == None:<EOL><INDENT>response = self._get(routes.pif_dataset_uid(dataset_id, uid), failure_message=failure_message)<EOL><DEDENT>else:<EOL><INDENT>response = self._get(routes.pif_dataset_version_uid(dataset_id, uid, dataset_version), failure_message=failure_message)<EOL><DEDENT>return pif.loads(response.content.decode("<STR_LIT:utf-8>"))<EOL>

Retrieves a PIF from a given dataset.

:param dataset_id: The id of the dataset to retrieve PIF from
:type dataset_id: int
:param uid: The uid of the PIF to retrieve
:type uid: str
:param dataset_version: The dataset version to look for the PIF in. If nothing is supplied, the latest dataset version will be searched
:type dataset_version: int
:return: A :class:`Pif` object
:rtype: :class:`Pif`


def create_dataset(self, name=None, description=None, public=False):

data = {<EOL>"<STR_LIT>": _convert_bool_to_public_value(public)<EOL>}<EOL>if name:<EOL><INDENT>data["<STR_LIT:name>"] = name<EOL><DEDENT>if description:<EOL><INDENT>data["<STR_LIT:description>"] = description<EOL><DEDENT>dataset = {"<STR_LIT>": data}<EOL>failure_message = "<STR_LIT>"<EOL>result = self._get_success_json(self._post_json(routes.create_dataset(), dataset, failure_message=failure_message))<EOL>return _dataset_from_response_dict(result)<EOL>

Create a new data set.

:param name: name of the dataset
:type name: str
:param description: description for the dataset
:type description: str
:param public: A boolean indicating whether or not the dataset should be public.
:type public: bool
:return: The newly created dataset.
:rtype: :class:`Dataset`


def update_dataset(self, dataset_id, name=None, description=None, public=None):

data = {<EOL>"<STR_LIT>": _convert_bool_to_public_value(public)<EOL>}<EOL>if name:<EOL><INDENT>data["<STR_LIT:name>"] = name<EOL><DEDENT>if description:<EOL><INDENT>data["<STR_LIT:description>"] = description<EOL><DEDENT>dataset = {"<STR_LIT>": data}<EOL>failure_message = "<STR_LIT>".format(dataset_id)<EOL>response = self._get_success_json(self._post_json(routes.update_dataset(dataset_id), data=dataset, failure_message=failure_message))<EOL>return _dataset_from_response_dict(response)<EOL>

Update a data set.

:param dataset_id: The ID of the dataset to update
:type dataset_id: int
:param name: name of the dataset
:type name: str
:param description: description for the dataset
:type description: str
:param public: A boolean indicating whether or not the dataset should
    be public.
:type public: bool
:return: The updated dataset.
:rtype: :class:`Dataset`


failure_message = "<STR_LIT>".format(dataset_id)<EOL>number = self._get_success_json(self._post_json(routes.create_dataset_version(dataset_id), data={}, failure_message=failure_message))['<STR_LIT>']<EOL>return DatasetVersion(number=number)<EOL>

Create a new data set version.

:param dataset_id: The ID of the dataset for which the version must be bumped.
:type dataset_id: int
:return: The new dataset version.
:rtype: :class:`DatasetVersion`


def __init__(self, id, name=None, description=None,<EOL>created_at=None):

self._name = name<EOL>self._description = description<EOL>self._id = id<EOL>self._created_at = created_at<EOL>

Constructor.

:param id: The ID of the dataset (required for instantiation)
:type id: int
:param name: The name of the dataset
:type name: str
:param description: The description of the dataset
:type description: str
:param created_at: The timestamp for creation of the dataset
:type created_at: str


self._failures = []<EOL>self._successes = []<EOL>


return len(self._failures) == <NUM_LIT:0><EOL>

Indicates whether or not the entire upload was successful.

:return: Whether or not the upload was successful
:rtype: bool


def add_failure(self, filepath, reason):

self._failures.append({<EOL>"<STR_LIT:path>": filepath,<EOL>"<STR_LIT>": reason<EOL>})<EOL>

Registers a file as a failure to upload.

:param filepath: The path to the file which was to be uploaded.
:type filepath: str
:param reason: The reason the file failed to upload
:type reason: str


self._successes.append({<EOL>"<STR_LIT:path>": filepath<EOL>})<EOL>

Registers a file as successfully uploaded.

:param filepath: The path to the successfully uploaded file.
:type filepath: str


self._path = path<EOL>self._url = url<EOL>

Constructor.

:param path: The files path
:type path: str
:param url: If present, a download URL for the file
:type url: str


self._number = number<EOL>

Constructor.

:param number: The number of the dataset version
:type number: ints


def __init__(self, logic=None, weight=None, simple=None, simple_weight=None, id=None, is_featured=None,<EOL>name=None, description=None, owner=None, email=None, updated_at=None, query=None, **kwargs):

self._logic = None<EOL>self.logic = logic<EOL>self._weight = None<EOL>self.weight = weight<EOL>self._simple = None<EOL>self.simple = simple<EOL>self._simple_weight = None<EOL>self.simple_weight = simple_weight<EOL>self._id = None<EOL>self.id = id<EOL>self._is_featured = None<EOL>self.is_featured = is_featured<EOL>self._name = None<EOL>self.name = name<EOL>self._description = None<EOL>self.description = description<EOL>self._owner = None<EOL>self.owner = owner<EOL>self._email = None<EOL>self.email = email<EOL>self._updated_at = None<EOL>self.updated_at = updated_at<EOL>self._query = None<EOL>self.query = query<EOL>

Constructor.

:param logic: The logic to apply to the query ('SHOULD', 'MUST', 'MUST_NOT', or 'OPTIONAL').
:param weight: Weight for the query.
:param simple: String with the simple search to run against all fields.
:param simple_weight: Dictionary of relative paths to their weights for simple queries.
:param id: One or more :class:`Filter` objects with filters against the id field.
:param is_featured:  One or more :class:`BooleanFilter` objects with filters against the isFeatured field.
:param name: One or more :class:`Filter` objects with filters against the name field.
:param description: One or more :class:`Filter` objects with filters against the description field.
:param owner: One or more :class:`Filter` objects with filters against the owner field.
:param email: One or more :class:`Filter` objects with filters against the email field.
:param updated_at: One or more :class:`Filter` objects with filters against the time that the dataset was last updated.
:param query: One or more :class:`DatasetQuery` objects with nested queries.


def __init__(self, query=None, from_index=None, size=None, random_results=None, random_seed=None,<EOL>score_relevance=None, return_max_score=None, timeout=None, count_pifs=None, **kwargs):

super(DatasetReturningQuery, self).__init__(<EOL>query=query, from_index=from_index, size=size, random_results=random_results, random_seed=random_seed,<EOL>score_relevance=score_relevance, return_max_score=return_max_score, timeout=timeout, **kwargs)<EOL>self._count_pifs = None<EOL>self.count_pifs = count_pifs<EOL>

Constructor.

:param query: One or more :class:`DataQuery` objects with the queries to run.
:param from_index: Index of the first hit that should be returned.
:param size: Total number of hits the should be returned.
:param random_results: Whether to return a random set of records.
:param random_seed: The random seed to use.
:param score_relevance: Whether to use relevance scoring.
:param return_max_score: Whether to return the maximum score.
:param timeout: The number of milliseconds to wait for the query to execute.
:param count_pifs: Whether to return counts of PIFs for each dataset.


def __init__(self, took=None, total_num_hits=None, max_score=None, hits=None, **kwargs):

super(DatasetSearchResult, self).__init__(<EOL>took=took, total_num_hits=total_num_hits, max_score=max_score,<EOL>hits=self._get_object(DatasetSearchHit, hits), **kwargs)<EOL>

Constructor.

:param took: Number of milliseconds that the query took to execute.
:param total_num_hits: Total number of hits.
:param max_score: The maximum score.
:param hits: List of :class:`DatasetSearchHit` objects.


def __init__(self, id=None, score=None, is_featured=None, name=None, description=None, owner=None, email=None, <EOL>num_pifs=None, updated_at=None, **kwargs):

self._id = None<EOL>self.id = id<EOL>self._score = None<EOL>self.score = score<EOL>self._is_featured = None<EOL>self.is_featured = is_featured<EOL>self._name = None<EOL>self.name = name<EOL>self._description = None<EOL>self.description = description<EOL>self._owner = None<EOL>self.owner = owner<EOL>self._email = None<EOL>self.email = email<EOL>self._num_pifs = None<EOL>self.num_pifs = num_pifs<EOL>self._updated_at = None<EOL>self.updated_at = updated_at<EOL>

Constructor.

:param id: String with the ID of the record.
:param score: Score with the relevancy of the result.
:param is_featured: Whether the dataset is a featured one.
:param name: Name of the dataset.
:param description: Description of the dataset.
:param owner: Name of the owner of the dataset.
:param email: Email address of the owner of the dataset.
:param num_pifs: Number of PIFs in the dataset.
:param updated_at: String with the last time that the dataset was updated.


def __init__(self, result=None, status=None, **kwargs):

self._result = None<EOL>self.result = result<EOL>self._status = None<EOL>self.status = status<EOL>

Constructor.

:param result: A single :class:`DatasetSearchResult` object with the query results.
:param status: 'SUCCESS', 'ERROR', or 'NOT_EXECUTED'.


def __init__(self, took=None, results=None, **kwargs):

self._took = None<EOL>self.took = took<EOL>self._results = None<EOL>self.results = results<EOL>

Constructor.

:param took: Number of milliseconds that the query took to execute.
:param results: List of :class:`DatasetMultiSearchResultElement` objects.


def __init__(self, logic=None, weight=None, simple=None, simple_weight=None, id=None, name=None, content=None,<EOL>updated_at=None, query=None, **kwargs):

self._logic = None<EOL>self.logic = logic<EOL>self._weight = None<EOL>self.weight = weight<EOL>self._simple = None<EOL>self.simple = simple<EOL>self._simple_weight = None<EOL>self.simple_weight = simple_weight<EOL>self._id = None<EOL>self.id = id<EOL>self._name = None<EOL>self.name = name<EOL>self._content = None<EOL>self.content = content<EOL>self._updated_at = None<EOL>self.updated_at = updated_at<EOL>self._query = None<EOL>self.query = query<EOL>

Constructor.

:param logic: The logic to apply to the query ('SHOULD', 'MUST', 'MUST_NOT', or 'OPTIONAL').
:param weight: Weight for the query.
:param simple: String with the simple search to run against all fields.
:param simple_weight: Dictionary of relative paths to their weights for simple queries.
:param id: One or more :class:`Filter` objects with filters against the id field.
:param name: One or more :class:`Filter` objects with filters against the name field.
:param content: One or more :class:`Filter` objects with filters against the content field.
:param updated_at: One or more :class:`Filter` objects with filters against the time that the dataset was last updated.
:param query: One or more :class:`DatasetQuery` objects with nested queries.


def __init__(self, query=None, from_index=None, size=None, random_results=None, random_seed=None,<EOL>score_relevance=None, return_max_score=None, timeout=None, max_content_highlights=None,<EOL>highlight_pre_tag=None, highlight_post_tag=None, **kwargs):

super(FileReturningQuery, self).__init__(<EOL>query=query, from_index=from_index, size=size, random_results=random_results, random_seed=random_seed,<EOL>score_relevance=score_relevance, return_max_score=return_max_score, timeout=timeout, **kwargs)<EOL>self._max_content_highlights = None<EOL>self.max_content_highlights = max_content_highlights<EOL>self._highlight_pre_tag = None<EOL>self.highlight_pre_tag = highlight_pre_tag<EOL>self._highlight_post_tag = None<EOL>self.highlight_post_tag = highlight_post_tag<EOL>

Constructor.

:param query: One or more :class:`DataQuery` objects with the queries to run.
:param from_index: Index of the first hit that should be returned.
:param size: Total number of hits the should be returned.
:param random_results: Whether to return a random set of records.
:param random_seed: The random seed to use.
:param score_relevance: Whether to use relevance scoring.
:param return_max_score: Whether to return the maximum score.
:param timeout: The number of milliseconds to wait for the query to execute.
:param max_content_highlights: The maximum number of highlighted results to return.
:param highlight_pre_tag: The tag to use at the beginning of a highlight.
:param highlight_post_tag: The tag to use at the end of a highlight.


Constructor.

:param took: Number of milliseconds that the query took to execute.
:param results: List of :class:`FileMultiSearchResultElement` objects.


def __init__(self, dataset_id=None, dataset_version=None, id=None, score=None, name=None, updated_at=None, <EOL>highlights=None, **kwargs):

self._dataset_id = None<EOL>self.dataset_id = dataset_id<EOL>self._dataset_version = None<EOL>self.dataset_version = dataset_version<EOL>self._id = None<EOL>self.id = id<EOL>self._score = None<EOL>self.score = score<EOL>self._name = None<EOL>self.name = name<EOL>self._updated_at = None<EOL>self.updated_at = updated_at<EOL>self._highlights = None<EOL>self.highlights = highlights<EOL>

Constructor.

:param dataset_id: String with the ID of the dataset.
:param dataset_version: Long with the version of the dataset.
:param id: String with the ID of the record.
:param score: Score with the relevancy of the result.
:param name: Name of the dataset.
:param updated_at: String with the last time that the dataset was updated.
:param highlights: List of strings with the highlighted results.


Constructor.

:param result: A single :class:`FileSearchResult` object with the query results.
:param status: 'SUCCESS', 'ERROR', or 'NOT_EXECUTED'.


super(FileSearchResult, self).__init__(<EOL>took=took, total_num_hits=total_num_hits, max_score=max_score,<EOL>hits=self._get_object(FileSearchHit, hits), **kwargs)<EOL>

Constructor.

:param took: Number of milliseconds that the query took to execute.
:param total_num_hits: Total number of hits.
:param max_score: The maximum score.
:param hits: List of :class:`FileSearchHit` objects.


if obj is None:<EOL><INDENT>return []<EOL><DEDENT>elif isinstance(obj, list):<EOL><INDENT>return [i.as_dictionary() for i in obj]<EOL><DEDENT>elif isinstance(obj, dict):<EOL><INDENT>return self._keys_to_camel_case(obj)<EOL><DEDENT>else:<EOL><INDENT>return obj.as_dictionary()<EOL><DEDENT>

Convert an object to a form ready to dump to json.

:param obj: Object being serialized. The type of this object must be one of the following: None; a single object derived from the Pio class; or a list of objects, each derived from the Pio class.
:return: List of dictionaries, each representing a physical information object, ready to be serialized.


return dict((to_camel_case(key), value) for (key, value) in obj.items())<EOL>

Make a copy of a dictionary with all keys converted to camel case. This is just calls to_camel_case on each of the keys in the dictionary and returns a new dictionary.

:param obj: Dictionary to convert keys to camel case.
:return: Dictionary with the input values and all keys in camel case


start_index = returning_query.from_index or <NUM_LIT:0><EOL>size = returning_query.size or <NUM_LIT:0><EOL>if start_index < <NUM_LIT:0>:<EOL><INDENT>raise CitrinationClientError(<EOL>"<STR_LIT>")<EOL><DEDENT>if size < <NUM_LIT:0>:<EOL><INDENT>raise CitrinationClientError("<STR_LIT>")<EOL><DEDENT>if start_index + size > MAX_QUERY_DEPTH:<EOL><INDENT>raise CitrinationClientError(<EOL>"<STR_LIT>".format(<EOL>MAX_QUERY_DEPTH))<EOL><DEDENT>

Checks to see that the query will not exceed the max query depth

:param returning_query: The PIF system or Dataset query to execute.
:type returning_query: :class:`PifSystemReturningQuery` or :class: `DatasetReturningQuery`


self._validate_search_query(pif_system_returning_query)<EOL>return self._execute_search_query(<EOL>pif_system_returning_query,<EOL>PifSearchResult<EOL>)<EOL>

Run a PIF query against Citrination.

:param pif_system_returning_query: The PIF system query to execute.
:type pif_system_returning_query: :class:`PifSystemReturningQuery`
:return: :class:`PifSearchResult` object with the results of the query.
:rtype: :class:`PifSearchResult`


self._validate_search_query(dataset_returning_query)<EOL>return self._execute_search_query(<EOL>dataset_returning_query,<EOL>DatasetSearchResult<EOL>)<EOL>

Run a dataset query against Citrination.

:param dataset_returning_query: :class:`DatasetReturningQuery` to execute.
:type dataset_returning_query: :class:`DatasetReturningQuery`
:return: Dataset search result object with the results of the query.
:rtype: :class:`DatasetSearchResult`


def _execute_search_query(self, returning_query, result_class):

if returning_query.from_index:<EOL><INDENT>from_index = returning_query.from_index<EOL><DEDENT>else:<EOL><INDENT>from_index = <NUM_LIT:0><EOL><DEDENT>if returning_query.size != None:<EOL><INDENT>size = min(returning_query.size, client_config.max_query_size)<EOL><DEDENT>else:<EOL><INDENT>size = client_config.max_query_size<EOL><DEDENT>if (size == client_config.max_query_size and<EOL>size != returning_query.size):<EOL><INDENT>self._warn("<STR_LIT>".format(size))<EOL><DEDENT>time = <NUM_LIT:0.0>;<EOL>hits = [];<EOL>while True:<EOL><INDENT>sub_query = deepcopy(returning_query)<EOL>sub_query.from_index = from_index + len(hits)<EOL>partial_results = self._search_internal(sub_query, result_class)<EOL>total = partial_results.total_num_hits<EOL>time += partial_results.took<EOL>if partial_results.hits is not None:<EOL><INDENT>hits.extend(partial_results.hits)<EOL><DEDENT>if len(hits) >= size or len(hits) >= total or sub_query.from_index >= total:<EOL><INDENT>break<EOL><DEDENT><DEDENT>return result_class(hits=hits, total_num_hits=total, took=time)<EOL>

Run a PIF query against Citrination.

:param returning_query: :class:`BaseReturningQuery` to execute.
:param result_class: The class of the result to return.
:return: ``result_class`` object with the results of the query.


failure_message = "<STR_LIT>"<EOL>response_dict = self._get_success_json(<EOL>self._post(routes.pif_multi_search, data=json.dumps(multi_query, cls=QueryEncoder),<EOL>failure_message=failure_message))<EOL>return PifMultiSearchResult(**keys_to_snake_case(response_dict['<STR_LIT>']))<EOL>

Run each in a list of PIF queries against Citrination.

:param multi_query: :class:`MultiQuery` object to execute.
:return: :class:`PifMultiSearchResult` object with the results of the query.


def generate_simple_chemical_query(self, name=None, chemical_formula=None, property_name=None, property_value=None,<EOL>property_min=None, property_max=None, property_units=None, reference_doi=None,<EOL>include_datasets=[], exclude_datasets=[], from_index=None, size=None):

pif_system_query = PifSystemQuery()<EOL>pif_system_query.names = FieldQuery(<EOL>extract_as='<STR_LIT:name>',<EOL>filter=[Filter(equal=i) for i in self._get_list(name)])<EOL>pif_system_query.chemical_formula = ChemicalFieldQuery(<EOL>extract_as='<STR_LIT>',<EOL>filter=[ChemicalFilter(equal=i) for i in self._get_list(chemical_formula)])<EOL>pif_system_query.references = ReferenceQuery(doi=FieldQuery(<EOL>extract_as='<STR_LIT>',<EOL>filter=[Filter(equal=i) for i in self._get_list(reference_doi)]))<EOL>property_name_query = FieldQuery(<EOL>extract_as='<STR_LIT>',<EOL>filter=[Filter(equal=i) for i in self._get_list(property_name)])<EOL>property_units_query = FieldQuery(<EOL>extract_as='<STR_LIT>',<EOL>filter=[Filter(equal=i) for i in self._get_list(property_units)])<EOL>property_value_query = FieldQuery(<EOL>extract_as='<STR_LIT>',<EOL>filter=[])<EOL>for i in self._get_list(property_value):<EOL><INDENT>property_value_query.filter.append(Filter(equal=i))<EOL><DEDENT>if property_min is not None or property_max is not None:<EOL><INDENT>property_value_query.filter.append(Filter(min=property_min, max=property_max))<EOL><DEDENT>pif_system_query.properties = PropertyQuery(<EOL>name=property_name_query,<EOL>value=property_value_query,<EOL>units=property_units_query)<EOL>dataset_query = list()<EOL>if include_datasets:<EOL><INDENT>dataset_query.append(DatasetQuery(logic='<STR_LIT>', id=[Filter(equal=i) for i in include_datasets]))<EOL><DEDENT>if exclude_datasets:<EOL><INDENT>dataset_query.append(DatasetQuery(logic='<STR_LIT>', id=[Filter(equal=i) for i in exclude_datasets]))<EOL><DEDENT>pif_system_returning_query = PifSystemReturningQuery(<EOL>query=DataQuery(<EOL>system=pif_system_query,<EOL>dataset=dataset_query),<EOL>from_index=from_index,<EOL>size=size,<EOL>score_relevance=True)<EOL>return pif_system_returning_query<EOL>

This method generates a :class:`PifSystemReturningQuery` object using the
supplied arguments. All arguments that accept lists have logical OR's on the queries that they generate.
This means that, for example, simple_chemical_search(name=['A', 'B']) will match records that have name
equal to 'A' or 'B'.

Results will be pulled into the extracted field of the :class:`PifSearchHit` objects that are returned. The
name will appear under the key "name", chemical formula under "chemical_formula", property name under
"property_name", value of the property under "property_value", units of the property under "property_units",
and reference DOI under "reference_doi".

This method is only meant for execution of very simple queries. More complex queries must use the search method
that accepts a :class:`PifSystemReturningQuery` object.

:param name: One or more strings with the names of the chemical system to match.
:type name: str or list of str
:param chemical_formula:  One or more strings with the chemical formulas to match.
:type chemical_formula: str or list of str
:param property_name: One or more strings with the names of the property to match.
:type property_name: str or list of str
:param property_value: One or more strings or numbers with the exact values to match.
:type property_value: str or int or float or list of str or int or float
:param property_min: A single string or number with the minimum value to match.
:type property_min: str or int or float
:param property_max: A single string or number with the maximum value to match.
:type property_max: str or int or float
:param property_units: One or more strings with the property units to match.
:type property_units: str or list of str
:param reference_doi: One or more strings with the DOI to match.
:type reference_doin: str or list of str
:param include_datasets: One or more integers with dataset IDs to match.
:type include_datasets: int or list of int
:param exclude_datasets: One or more integers with dataset IDs that must not match.
:type exclude_datasets: int or list of int
:param from_index: Index of the first record to match.
:type from_index: int
:param size: Total number of records to return.
:type size: int
:return: A query to to be submitted with the pif_search method
:rtype: :class:`PifSystemReturningQuery`


if values is None:<EOL><INDENT>return []<EOL><DEDENT>elif isinstance(values, list):<EOL><INDENT>return values<EOL><DEDENT>else:<EOL><INDENT>return [values]<EOL><DEDENT>

Helper method that wraps values in a list. If the input is a list then it is returned. If the input is None then an empty list is returned. For anything else, the input value is wrapped as a single-element list.

:param values: Value to make sure exists in a list.
:return: List with the input values.


def __init__(self, logic=None, weight=None, exists=None, equal=None, filter=None, **kwargs):

self._logic = None<EOL>self.logic = logic<EOL>self._weight = None<EOL>self.weight = weight<EOL>self._exists = None<EOL>self.exists = exists<EOL>self._equal = None<EOL>self.equal = equal<EOL>self._filter = None<EOL>self.filter = filter<EOL>

Constructor.

:param logic: Logic for this filter. Must be equal to one of "MUST", "MUST_NOT", "SHOULD", or "OPTIONAL".
:param weight: Weight for the filter.
:param exists: True/False to simply test whether the field exists and has a non-null value.
:param equal: String with the phrase to match against.
:param filter: List of :class:`BooleanFilter` objects with sub-filters.


def __init__(self, query=None, extraction_sort=None, from_index=None, size=None, random_results=None,<EOL>random_seed=None, score_relevance=None, return_max_score=None, timeout=None, **kwargs):

super(BaseReturningQuery, self).__init__(query=query, extraction_sort=extraction_sort, **kwargs)<EOL>if '<STR_LIT>' in '<STR_LIT>':<EOL><INDENT>self.from_index = kwargs['<STR_LIT>']<EOL><DEDENT>self._from = None<EOL>self.from_index = from_index<EOL>self._size = None<EOL>self.size = size<EOL>self._random_results = None<EOL>self.random_results = random_results<EOL>self._random_seed = None<EOL>self.random_seed = random_seed<EOL>self._score_relevance = None<EOL>self.score_relevance = score_relevance<EOL>self._return_max_score = None<EOL>self.return_max_score = return_max_score<EOL>self._timeout = None<EOL>self.timeout = timeout<EOL>

Base class for all queries against datasets and the items that they contain on Citrination.

:param query: One or more :class:`DataQuery` objects with the queries to run.
:param extraction_sort: A single :class:`ExtractionSort` object for sorting.
:param from_index: Index of the first hit that should be returned.
:param size: Total number of hits the should be returned.
:param random_results: Whether to return a random set of records.
:param random_seed: The random seed to use.
:param score_relevance: Whether to use relevance scoring.
:param return_max_score: Whether to return the maximum score.
:param timeout: The number of milliseconds to wait for the query to execute.


def __init__(self, logic=None, weight=None, exists=None, equal=None, min=None, max=None, exact=None,<EOL>filter=None, **kwargs):

self._logic = None<EOL>self.logic = logic<EOL>self._weight = None<EOL>self.weight = weight<EOL>self._exists = None<EOL>self.exists = exists<EOL>self._equal = None<EOL>self.equal = equal<EOL>self._min = None<EOL>self.min = min<EOL>self._max = None<EOL>self.max = max<EOL>self._exact = None<EOL>self.exact = exact<EOL>self._filter = None<EOL>self.filter = filter<EOL>

Constructor.

:param logic: Logic for this filter. Must be equal to one of "MUST", "MUST_NOT", "SHOULD", or "OPTIONAL".
:param weight: Weight for the filter.
:param exists: True/False to simply test whether the field exists and has a non-null value.
:param equal: String with the phrase to match against.
:param min: String with the minimum value of a range to match against.
:param max: String with the maximum value of a range to match against.
:param exact: True/False to set whether the "equal" filter should be an exact match.
:param filter: List of :class:`Filter` objects with sub-filters.


def __init__(self, query=None, **kwargs):

self._query = None<EOL>self.query = query<EOL>

Constructor.

:param query: One or more :class:`DataQuery` objects with the queries to run.


def __init__(self, logic=None, weight=None, simple=None, simple_weight=None, dataset=None, system=None, file=None,<EOL>query=None, **kwargs):

self._logic = None<EOL>self.logic = logic<EOL>self._weight = None<EOL>self.weight = weight<EOL>self._simple = None<EOL>self.simple = simple<EOL>self._simple_weight = None<EOL>self.simple_weight = simple_weight<EOL>self._dataset = None<EOL>self.dataset = dataset<EOL>self._system = None<EOL>self.system = system<EOL>self._file = None<EOL>self.file = file<EOL>self._query = None<EOL>self.query = query<EOL>

Constructor.

:param logic: The logic to apply to the query ('SHOULD', 'MUST', 'MUST_NOT', or 'OPTIONAL').
:param weight: Weight for the query.
:param simple: String with the simple search to run against all fields.
:param simple_weight: Dictionary of relative paths to their weights for simple queries.
:param dataset: One or more :class:`DatasetQuery` objects with queries against dataset metadata.
:param system: One or more :class:`PifSystemQuery` objects with queries against PIF systems
:param file: One or more :class:`FileQuery` objects with queries against file content or metadata.
:type file: :class:`FileQuery`
:param query: Nested list of :class:`DataQuery` objects.


def __init__(self, queries=None, **kwargs):

self._queries = None<EOL>self.queries = queries<EOL>

Constructor.

:param queries: One or more queries to run.


self._took = None<EOL>self.took = took<EOL>self._total_num_hits = None<EOL>self.total_num_hits = total_num_hits<EOL>self._max_score = None<EOL>self.max_score = max_score<EOL>self._hits = None<EOL>self.hits = hits<EOL>

Constructor.

:param took: Number of milliseconds that the query took to execute.
:param total_num_hits: Total number of hits.
:param max_score: The maximum score.
:param hits: List of hits.


def __init__(self, sort=None, logic=None, weight=None, simple=None, simple_weight=None, extract_as=None,<EOL>extract_all=None, extract_when_missing=None, length=None, offset=None, filter=None, **kwargs):

super(ChemicalFieldQuery, self).__init__(<EOL>sort=sort, weight=weight, logic=logic, simple=simple, simple_weight=simple_weight, extract_as=extract_as,<EOL>extract_all=extract_all, extract_when_missing=extract_when_missing, length=length, offset=offset, **kwargs)<EOL>self._filter = None<EOL>self.filter = filter<EOL>

Constructor.

:param sort: ASCENDING or DESCENDING to set the sort order on this field.
:param logic: Logic for this query. Must be equal to one of "MUST", "MUST_NOT", "SHOULD", or "OPTIONAL".
:param weight: Weight for the query.
:param simple: String with the simple search to run against all fields.
:param simple_weight: Dictionary of relative paths to their weights for simple queries.
:param extract_as: String with the alias to save this field under.
:param extract_all: Boolean setting whether all values in an array should be extracted.
:param extract_when_missing: Any valid JSON-supported object or PIF object. This value is returned when a value is missing that should be extracted (and the overall query is still satisfied).
:param length: One or more :class:`FieldOperation` objects against the length field.
:param offset: One or more :class:`FieldOperation` objects against the offset field.
:param filter: One or more :class:`ChemicalFilter` objects against this field.


def __init__(self, logic=None, weight=None, simple=None, simple_weight=None, extract_as=None,<EOL>extract_all=None, extract_when_missing=None, tags=None, length=None, offset=None, element=None,<EOL>actual_weight_percent=None, actual_atomic_percent=None, ideal_weight_percent=None,<EOL>ideal_atomic_percent=None, query=None, **kwargs):

super(CompositionQuery, self).__init__(<EOL>logic=logic, weight=weight, simple=simple, simple_weight=simple_weight, extract_as=extract_as,<EOL>extract_all=extract_all, extract_when_missing=extract_when_missing, tags=tags, length=length,<EOL>offset=offset, **kwargs)<EOL>self._element = None<EOL>self.element = element<EOL>self._actual_weight_percent = None<EOL>self.actual_weight_percent = actual_weight_percent<EOL>self._actual_atomic_percent = None<EOL>self.actual_atomic_percent = actual_atomic_percent<EOL>self._ideal_weight_percent = None<EOL>self.ideal_weight_percent = ideal_weight_percent<EOL>self._ideal_atomic_percent = None<EOL>self.ideal_atomic_percent = ideal_atomic_percent<EOL>self._query = None<EOL>self.query = query<EOL>

Constructor.

:param logic: Logic for this filter. Must be equal to one of "MUST", "MUST_NOT", "SHOULD", or "OPTIONAL".
:param weight: Weight of the query.
:param simple: String with the simple query to run against all fields.
:param simple_weight: Dictionary of relative paths to their weights for simple queries.
:param extract_as: String with the alias to save this field under.
:param extract_all: Boolean setting whether all values in an array should be extracted.
:param extract_when_missing: Any valid JSON-supported object or PIF object. This value is returned when a value is missing that should be extracted (and the overall query is still satisfied).
:param tags: One or more :class:`FieldQuery` operations against the tags field.
:param length: One or more :class:`FieldQuery` operations against the length field.
:param offset: One or more :class:`FieldQuery` operations against the offset field.
:param element: One or more :class:`ChemicalFieldQuery` operations against the element field.
:param actual_weight_percent: One or more :class:`FieldQuery` operations against the actual weight percent field.
:param actual_atomic_percent: One or more :class:`FieldQuery` operations against the actual atomic percent field.
:param ideal_weight_percent: One or more :class:`FieldQuery` operations against the ideal weight percent field.
:param ideal_atomic_percent: One or more :class:`FieldQuery` operations against the ideal atomic percent field.
:param query: One or more :class:`CompositionQuery` objects with the nest queries.


def __init__(self, logic=None, weight=None, exists=None, equal=None, element=None, partial=None, exact=None,<EOL>filter=None, **kwargs):

self._logic = None<EOL>self.logic = logic<EOL>self._weight = None<EOL>self.weight = weight<EOL>self._exists = None<EOL>self.exists = exists<EOL>self._equal = None<EOL>self.equal = equal<EOL>self._element = None<EOL>self.element = element<EOL>self._partial = None<EOL>self.partial = partial<EOL>self._exact = None<EOL>self.exact = exact<EOL>self._filter = None<EOL>self.filter = filter<EOL>

Constructor.

:param logic: Logic for this filter. Must be equal to one of "MUST", "MUST_NOT", "SHOULD", or "OPTIONAL".
:param weight: Weight for the query.
:param exists: True/False to simply test whether the field exists and has a non-null value.
:param equal: String with the phrase to match against.
:param element: True to match against the single element field.
:param partial: True to match against the partial formula field.
:param exact: True if matches should be exact.
:param filter: List of :class:`ChemicalFilter` objects with sub-filters.


def __init__(self, key=None, order=None, **kwargs):

self._key = None<EOL>self.key = key<EOL>self._order = None<EOL>self.order = order<EOL>

Constructor.

:param key: String with the key that will be sorted on.
:param order: The order to use. Either ASCENDING or DESCENDING.


def __init__(self, logic=None, weight=None, simple=None, simple_weight=None, extract_as=None, extract_all=None,<EOL>extract_when_missing=None, tags=None, length=None, offset=None, conditions=None, data_type=None,<EOL>name=None, value=None, file=None, units=None, references=None, query=None, **kwargs):

super(PropertyQuery, self).__init__(<EOL>logic=logic, weight=weight, simple=simple, simple_weight=simple_weight, extract_as=extract_as,<EOL>extract_all=extract_all, extract_when_missing=extract_when_missing, tags=tags, length=length,<EOL>offset=offset, name=name, value=value, file=file, units=units, **kwargs)<EOL>self._conditions = None<EOL>self.conditions = conditions<EOL>self._data_type = None<EOL>self.data_type = data_type<EOL>self._references = None<EOL>self.references = references<EOL>self._query = None<EOL>self.query = query<EOL>

Constructor.

:param logic: Logic for this filter. Must be equal to one of "MUST", "MUST_NOT", "SHOULD", or "OPTIONAL".
:param weight: Weight of the query.
:param simple: String with the simple query to run against all fields.
:param simple_weight: Dictionary of relative paths to their weights for simple queries.
:param extract_as: String with the alias to save this field under.
:param extract_all: Boolean setting whether all values in an array should be extracted.
:param extract_when_missing: Any valid JSON-supported object or PIF object. This value is returned when a value is missing that should be extracted (and the overall query is still satisfied).
:param tags: One or more :class:`FieldQuery` operations against the tags field.
:param length: One or more :class:`FieldQuery` operations against the length field.
:param offset: One or more :class:`FieldQuery` operations against the offset field.
:param conditions: One or more :class:`ValueQuery` operations against the conditions.
:param data_type: One or more :class:`FieldQuery` operations against the dataType field.
:param name: One or more :class:`FieldQuery` operations against the name field.
:param value: One or more :class:`FieldQuery` operations against the value.
:param file: One or more :class:`FileReferenceQuery` operations against the file.
:param units: One or more :class:`FieldQuery` operations against the units field.
:param references: One or more :class:`ReferenceQuery` operations against the references field.
:param query: One or more :class:`PropertyQuery` objects with nested queries.


def __init__(self, logic=None, weight=None, simple=None, simple_weight=None, extract_as=None, extract_all=None,<EOL>extract_when_missing=None, tags=None, length=None, offset=None, given=None, family=None,<EOL>title=None, suffix=None, query=None, **kwargs):

super(NameQuery, self).__init__(<EOL>logic=logic, weight=weight, simple=simple, simple_weight=simple_weight, extract_as=extract_as,<EOL>extract_all=extract_all, extract_when_missing=extract_when_missing, tags=tags, length=length,<EOL>offset=offset, **kwargs)<EOL>self._given = None<EOL>self.given = given<EOL>self._family = None<EOL>self.family = family<EOL>self._title = None<EOL>self.title = title<EOL>self._suffix = None<EOL>self.suffix = suffix<EOL>self._query = None<EOL>self.query = query<EOL>

Constructor.

:param logic: Logic for this filter. Must be equal to one of "MUST", "MUST_NOT", "SHOULD", or "OPTIONAL".
:param weight: Weight of the query.
:param simple: String with the simple query to run against all fields.
:param simple_weight: Dictionary of relative paths to their weights for simple queries.
:param extract_as: String with the alias to save this field under.
:param extract_all: Boolean setting whether all values in an array should be extracted.
:param extract_when_missing: Any valid JSON-supported object or PIF object. This value is returned when a value is missing that should be extracted (and the overall query is still satisfied).
:param tags: One or more :class:`FieldQuery` operations against the tags field.
:param length: One or more :class:`FieldQuery` operations against the length field.
:param offset: One or more :class:`FieldQuery` operations against the offset field.
:param given: One or more :class:`FieldQuery` operations against the given name field.
:param family: One or more :class:`FieldQuery` operations against the family name field.
:param title: One or more :class:`FieldQuery` operations against the title field.
:param suffix: One or more :class:`FieldQuery` operations against the suffix field.
:param query: One or more :class:`NameQuery` objects with nested queries.


def __init__(self, logic=None, weight=None, simple=None, simple_weight=None, extract_as=None, extract_all=None,<EOL>extract_when_missing=None, tags=None, length=None, offset=None, name=None, value=None,<EOL>query=None, **kwargs):

super(ClassificationQuery, self).__init__(<EOL>logic=logic, weight=weight, simple=simple, simple_weight=simple_weight, extract_as=extract_as,<EOL>extract_all=extract_all, extract_when_missing=extract_when_missing, tags=tags, length=length,<EOL>offset=offset, **kwargs)<EOL>self._name = None<EOL>self.name = name<EOL>self._value = None<EOL>self.value = value<EOL>self._query = None<EOL>self.query = query<EOL>

Constructor.

:param logic: Logic for this filter. Must be equal to one of "MUST", "MUST_NOT", "SHOULD", or "OPTIONAL".
:param weight: Weight of the query.
:param simple: String with the simple query against all fields.
:param simple_weight: Dictionary of relative paths to their weights for simple queries.
:param extract_as: String with the alias to save this field under.
:param extract_all: Boolean setting whether all values in an array should be extracted.
:param extract_when_missing: Any valid JSON-supported object or PIF object. This value is returned when a value is missing that should be extracted (and the overall query is still satisfied).
:param tags: One or more :class:`FieldQuery` operations against the tags field.
:param length: One or more :class:`FieldQuery` operations against the length field.
:param offset: One or more :class:`FieldQuery` operations against the offset field.
:param name: One or more :class:`FieldQuery` operations against the name field.
:param value: One or more :class:`FieldQuery` operations against the value field.
:param query: One or more :class:`ClassificationQuery` objects for nested queries.


def __init__(self, logic=None, weight=None, simple=None, simple_weight=None, extract_as=None, extract_all=None,<EOL>extract_when_missing=None, tags=None, length=None, offset=None, relative_path=None,<EOL>mime_type=None, sha256=None, md5=None, query=None, **kwargs):

super(FileReferenceQuery, self).__init__(<EOL>logic=logic, weight=weight, simple=simple, simple_weight=simple_weight, extract_as=extract_as,<EOL>extract_all=extract_all, extract_when_missing=extract_when_missing, tags=tags, length=length,<EOL>offset=offset, **kwargs)<EOL>self._relative_path = None<EOL>self.relative_path = relative_path<EOL>self._mime_type = None<EOL>self.mime_type = mime_type<EOL>self._sha256 = None<EOL>self.sha256 = sha256<EOL>self._md5 = None<EOL>self.md5 = md5<EOL>self._query = None<EOL>self.query = query<EOL>

Constructor.

:param logic: Logic for this filter. Must be equal to one of "MUST", "MUST_NOT", "SHOULD", or "OPTIONAL".
:param weight: Weight of the query.
:param simple: String with the simple query to run against all fields.
:param simple_weight: Dictionary of relative paths to their weights for simple queries.
:param extract_as: String with the alias to save this field under.
:param extract_all: Boolean setting whether all values in an array should be extracted.
:param extract_when_missing: Any valid JSON-supported object or PIF object. This value is returned when a value is missing that should be extracted (and the overall query is still satisfied).
:param tags: One or more :class:`FieldQuery` operations against the tags field.
:param length: One or more :class:`FieldQuery` operations against the length field.
:param offset: One or more :class:`FieldQuery` operations against the offset field.
:param relative_path: One or more :class:`FieldQuery` operations against the relative path field.
:param mime_type: One or more :class:`FieldQuery` operations against the mime type field.
:param sha256: One or more :class:`FieldQuery` operations against the sha256 field.
:param md5: One or more :class:`FieldQuery` operations against the md5 field.
:param query: One or more :class:`FileReferenceQuery` objects as nested queries.


super(IdQuery, self).__init__(<EOL>logic=logic, weight=weight, simple=simple, simple_weight=simple_weight, extract_as=extract_as,<EOL>extract_all=extract_all, extract_when_missing=extract_when_missing, tags=tags, length=length,<EOL>offset=offset, **kwargs)<EOL>self._name = None<EOL>self.name = name<EOL>self._value = None<EOL>self.value = value<EOL>self._query = None<EOL>self.query = query<EOL>

Constructor.

:param logic: Logic for this filter. Must be equal to one of "MUST", "MUST_NOT", "SHOULD", or "OPTIONAL".
:param weight: Weight of the query.
:param simple: String with the query to run over all fields.
:param simple_weight: Dictionary of relative paths to their weights for simple queries.
:param extract_as: String with the alias to save this field under.
:param extract_all: Boolean setting whether all values in an array should be extracted.
:param extract_when_missing: Any valid JSON-supported object or PIF object. This value is returned when a value is missing that should be extracted (and the overall query is still satisfied).
:param tags: One or more :class:`FieldQuery` operations against the tags field.
:param length: One or more :class:`FieldQuery` operations against the length field.
:param offset: One or more :class:`FieldQuery` operations against the offset field.
:param name: One or more :class:`FieldQuery` operations against the name field.
:param value: One or more :class:`FieldQuery` operations against the value field.
:param query: One or more :class:`IdQuery` objects with nested queries.


def __init__(self, sort=None, logic=None, weight=None, simple=None, simple_weight=None, extract_as=None,<EOL>extract_all=None, extract_when_missing=None, length=None, offset=None, **kwargs):

self._sort = None<EOL>self.sort = sort<EOL>self._logic = None<EOL>self.logic = logic<EOL>self._weight = None<EOL>self.weight = weight<EOL>self._simple = None<EOL>self.simple = simple<EOL>self._simple_weight = None<EOL>self.simple_weight = simple_weight<EOL>self._extract_as = None<EOL>self.extract_as = extract_as<EOL>self._extract_all = None<EOL>self.extract_all = extract_all<EOL>self._extract_when_missing = None<EOL>self.extract_when_missing = extract_when_missing<EOL>self._length = None<EOL>self.length = length<EOL>self._offset = None<EOL>self.offset = offset<EOL>

Constructor.

:param sort: ASCENDING or DESCENDING to set the sort order on this field.
:param logic: Logic for this query. Must be equal to one of "MUST", "MUST_NOT", "SHOULD", or "OPTIONAL".
:param weight: Weight for the query.
:param simple: String with the simple search to run against all fields.
:param simple_weight: Dictionary of relative paths to their weights for simple queries.
:param extract_as: String with the alias to save this field under.
:param extract_all: Boolean setting whether all values in an array should be extracted.
:param extract_when_missing: Any valid JSON-supported object or PIF object. This value is returned when a value is missing that should be extracted (and the overall query is still satisfied).
:param length: One or more :class:`FieldQuery` operations against the length field.
:param offset: One or more :class:`FieldQuery` operations against the offset field.


def __init__(self, logic=None, weight=None, simple=None, simple_weight=None, extract_as=None, extract_all=None,<EOL>extract_when_missing=None, tags=None, length=None, offset=None, name=None, value=None,<EOL>file=None, units=None, query=None, **kwargs):

super(ValueQuery, self).__init__(<EOL>logic=logic, weight=weight, simple=simple, simple_weight=simple_weight, extract_as=extract_as,<EOL>extract_all=extract_all, extract_when_missing=extract_when_missing, tags=tags, length=length,<EOL>offset=offset, **kwargs)<EOL>self._name = None<EOL>self.name = name<EOL>self._value = None<EOL>self.value = value<EOL>self._file = None<EOL>self.file = file<EOL>self._units = None<EOL>self.units = units<EOL>self._query = None<EOL>self.query = query<EOL>

Constructor.

:param logic: Logic for this filter. Must be equal to one of "MUST", "MUST_NOT", "SHOULD", or "OPTIONAL".
:param weight: Weight of the query.
:param simple: String with the simple query to run against all fields.
:param simple_weight: Dictionary of relative paths to their weights for simple queries.
:param extract_as: String with the alias to save this field under.
:param extract_all: Boolean setting whether all values in an array should be extracted.
:param extract_when_missing: Any valid JSON-supported object or PIF object. This value is returned when a value is missing that should be extracted (and the overall query is still satisfied).
:param tags: One or more :class:`FieldQuery` operations against the tags field.
:param length: One or more :class:`FieldQuery` operations against the length field.
:param offset: One or more :class:`FieldQuery` operations against the offset field.
:param name: One or more :class:`FieldQuery` operations against the name field.
:param value: One or more :class:`FieldQuery` operations against the value.
:param file: One or more :class:`FileReferenceQuery` operations against the file.
:param units: One or more :class:`FieldQuery` operations against the units field.
:param query: One or more :class:`ValueQuery` objects with nested queries.


def __init__(self, logic=None, weight=None, simple=None, simple_weight=None, extract_as=None, extract_all=None,<EOL>extract_when_missing=None,  tags=None, length=None, offset=None, name=None, details=None,<EOL>query=None, **kwargs):

super(ProcessStepQuery, self).__init__(<EOL>logic=logic, weight=weight, simple=simple, simple_weight=simple_weight, extract_as=extract_as,<EOL>extract_all=extract_all, extract_when_missing=extract_when_missing, tags=tags, length=length,<EOL>offset=offset, **kwargs)<EOL>self._name = None<EOL>self.name = name<EOL>self._details = None<EOL>self.details = details<EOL>self._query = None<EOL>self.query = query<EOL>

Constructor.

:param logic: Logic for this filter. Must be equal to one of "MUST", "MUST_NOT", "SHOULD", or "OPTIONAL".
:param weight: Weight of the query.
:param simple: String with the query to run against all fields.
:param simple_weight: Dictionary of relative paths to their weights for simple queries.
:param extract_as: String with the alias to save this field under.
:param extract_all: Boolean setting whether all values in an array should be extracted.
:param extract_when_missing: Any valid JSON-supported object or PIF object. This value is returned when a value is missing that should be extracted (and the overall query is still satisfied).
:param tags: One or more :class:`FieldQuery` operations against the tags field.
:param length: One or more :class:`FieldQuery` operations against the length field.
:param offset: One or more :class:`FieldQuery` operations against the offset field.
:param name: One or more :class:`FieldQuery` operations against the name field.
:param details: One or more :class:`ValueQuery` operations against the details of the step.
:param query: One or more :class:`ProcessStepQuery` objects with nested queries.


def __init__(self, logic=None, weight=None, simple=None, simple_weight=None, extract_as=None, extract_all=None,<EOL>extract_when_missing=None, tags=None, length=None, offset=None, number=None, title=None,<EOL>caption=None, query=None, **kwargs):

super(DisplayItemQuery, self).__init__(<EOL>logic=logic, weight=weight, simple=simple, simple_weight=simple_weight, extract_as=extract_as,<EOL>extract_all=extract_all, extract_when_missing=extract_when_missing, tags=tags, length=length,<EOL>offset=offset, **kwargs)<EOL>self._title = None<EOL>self.title = title<EOL>self._number = None<EOL>self.number = number<EOL>self._caption = None<EOL>self.caption = caption<EOL>self._query = None<EOL>self.query = query<EOL>

Constructor.

:param logic: Logic for this filter. Must be equal to one of "MUST", "MUST_NOT", "SHOULD", or "OPTIONAL".
:param weight: Weight of the query.
:param simple: String with the simple query to run against all fields.
:param simple_weight: Dictionary of relative paths to their weights for simple queries.
:param extract_as: String with the alias to save this field under.
:param extract_all: Boolean setting whether all values in an array should be extracted.
:param extract_when_missing: Any valid JSON-supported object or PIF object. This value is returned when a value is missing that should be extracted (and the overall query is still satisfied).
:param tags: One or more :class:`FieldQuery` operations against the tags field.
:param length: One or more :class:`FieldQuery` operations against the length field.
:param offset: One or more :class:`FieldQuery` operations against the offset field.
:param number: One or more :class:`FieldQuery` operations against the number field.
:param title: One or more :class:`FieldQuery` operations against the title field.
:param caption: One or more :class:`FieldQuery` operations against the caption field.
:param query: One or more :class:`DisplayItemQuery` objects as nested queries.


def __init__(self, logic=None, weight=None, simple=None, simple_weight=None, extract_as=None, extract_all=None,<EOL>extract_when_missing=None, tags=None, length=None, offset=None, actual_mass_percent=None,<EOL>actual_volume_percent=None, actual_number_percent=None, ideal_mass_percent=None,<EOL>ideal_volume_percent=None, ideal_number_percent=None, query=None, **kwargs):

super(QuantityQuery, self).__init__(<EOL>logic=logic, weight=weight, simple=simple, simple_weight=simple_weight, extract_as=extract_as,<EOL>extract_all=extract_all, extract_when_missing=extract_when_missing, tags=tags, length=length,<EOL>offset=offset, **kwargs)<EOL>self._actual_mass_percent = None<EOL>self.actual_mass_percent = actual_mass_percent<EOL>self._actual_volume_percent = None<EOL>self.actual_volume_percent = actual_volume_percent<EOL>self._actual_number_percent = None<EOL>self.actual_number_percent = actual_number_percent<EOL>self._ideal_mass_percent = None<EOL>self.ideal_mass_percent = ideal_mass_percent<EOL>self._ideal_volume_percent = None<EOL>self.ideal_volume_percent = ideal_volume_percent<EOL>self._ideal_number_percent = None<EOL>self.ideal_number_percent = ideal_number_percent<EOL>self._query = None<EOL>self.query = query<EOL>

Constructor.

:param logic: Logic for this filter. Must be equal to one of "MUST", "MUST_NOT", "SHOULD", or "OPTIONAL".
:param weight: Weight of the query.
:param simple: String with the simple query to run against all fields.
:param simple_weight: Dictionary of relative paths to their weights for simple queries.
:param extract_as: String with the alias to save this field under.
:param extract_all: Boolean setting whether all values in an array should be extracted.
:param extract_when_missing: Any valid JSON-supported object or PIF object. This value is returned when a value is missing that should be extracted (and the overall query is still satisfied).
:param tags: One or more :class:`FieldQuery` operations against the tags field.
:param length: One or more :class:`FieldQuery` operations against the length field.
:param offset: One or more :class:`FieldQuery` operations against the offset field.
:param actual_mass_percent: One or more :class:`FieldQuery` operations against the actual mass percent field.
:param actual_volume_percent: One or more :class:`FieldQuery` operations against the actual volume percent field.
:param actual_number_percent: One or more :class:`FieldQuery` operations against the actual number percent field.
:param ideal_mass_percent: One or more :class:`FieldQuery` operations against the ideal mass percent field.
:param ideal_volume_percent: One or more :class:`FieldQuery` operations against the ideal volume percent field.
:param ideal_number_percent: One or more :class:`FieldQuery` operations against the ideal number percent field.
:param query: One or more :class:`QuantityQuery` objects with nested queries.


def __init__(self, logic=None, weight=None, simple=None, simple_weight=None, extract_as=None, extract_all=None,<EOL>extract_when_missing=None, tags=None, length=None, offset=None, producer=None, url=None,<EOL>query=None, **kwargs):

super(SourceQuery, self).__init__(<EOL>logic=logic, weight=weight, simple=simple, simple_weight=simple_weight, extract_as=extract_as,<EOL>extract_all=extract_all, extract_when_missing=extract_when_missing, tags=tags, length=length,<EOL>offset=offset, **kwargs)<EOL>self._producer = None<EOL>self.producer = producer<EOL>self._url = None<EOL>self.url = url<EOL>self._query = None<EOL>self.query = query<EOL>

Constructor.

:param logic: Logic for this filter. Must be equal to one of "MUST", "MUST_NOT", "SHOULD", or "OPTIONAL".
:param weight: Weight of the query.
:param simple: String with the simple query to run against all fields.
:param simple_weight: Dictionary of relative paths to their weights for simple queries.
:param extract_as: String with the alias to save this field under.
:param extract_all: Boolean setting whether all values in an array should be extracted.
:param extract_when_missing: Any valid JSON-supported object or PIF object. This value is returned when a value is missing that should be extracted (and the overall query is still satisfied).
:param tags: One or more :class:`FieldQuery` operations against the tags field.
:param length: One or more :class:`FieldQuery` operations against the length field.
:param offset: One or more :class:`FieldQuery` operations against the offset field.
:param producer: One or more :class:`FieldQuery` operations against the producer field.
:param url: One or more :class:`FieldQuery` operations against the url field.
:param query: One or more :class:`SourceQuery` objects with nested queries.


def __init__(self, logic=None, weight=None, simple=None, simple_weight=None, extract_as=None, extract_all=None,<EOL>extract_when_missing=None, tags=None, length=None, offset=None, doi=None, isbn=None, issn=None,<EOL>url=None, title=None, publisher=None, journal=None, volume=None, issue=None, year=None,<EOL>figure=None, table=None, pages=None, authors=None, editors=None, affiliations=None,<EOL>acknowledgements=None, references=None, query=None, **kwargs):

super(ReferenceQuery, self).__init__(<EOL>logic=logic, weight=weight, simple=simple, simple_weight=simple_weight, extract_as=extract_as,<EOL>extract_all=extract_all, extract_when_missing=extract_when_missing, tags=tags, length=length,<EOL>offset=offset, **kwargs)<EOL>self._doi = None<EOL>self.doi = doi<EOL>self._isbn = None<EOL>self.isbn = isbn<EOL>self._issn = None<EOL>self.issn = issn<EOL>self._url = None<EOL>self.url = url<EOL>self._title = None<EOL>self.title = title<EOL>self._publisher = None<EOL>self.publisher = publisher<EOL>self._journal = None<EOL>self.journal = journal<EOL>self._volume = None<EOL>self.volume = volume<EOL>self._issue = None<EOL>self.issue = issue<EOL>self._year = None<EOL>self.year = year<EOL>self._figure = None<EOL>self.figure = figure<EOL>self._table = None<EOL>self.table = table<EOL>self._pages = None<EOL>self.pages = pages<EOL>self._authors = None<EOL>self.authors = authors<EOL>self._editors = None<EOL>self.editors = editors<EOL>self._affiliations = None<EOL>self.affiliations = affiliations<EOL>self._acknowledgements = None<EOL>self.acknowledgements = acknowledgements<EOL>self._references = None<EOL>self.references = references<EOL>self._query = None<EOL>self.query = query<EOL>

Constructor.

:param logic: Logic for this filter. Must be equal to one of "MUST", "MUST_NOT", "SHOULD", or "OPTIONAL".
:param weight: Weight of the query.
:param simple: String with the simple query to run against all fields.
:param simple_weight: Dictionary of relative paths to their weights for simple queries.
:param extract_as: String with the alias to save this field under.
:param extract_all: Boolean setting whether all values in an array should be extracted.
:param extract_when_missing: Any valid JSON-supported object or PIF object. This value is returned when a value is missing that should be extracted (and the overall query is still satisfied).
:param tags: One or more :class:`FieldQuery` operations against the tags field.
:param length: One or more :class:`FieldQuery` operations against the length field.
:param offset: One or more :class:`FieldQuery` operations against the offset field.
:param doi: One or more :class:`FieldQuery` operations against the doi field.
:param isbn: One or more :class:`FieldQuery` operations against the isbn field.
:param issn: One or more :class:`FieldQuery` operations against the issn field.
:param url: One or more :class:`FieldQuery` operations against the url field.
:param title: One or more :class:`FieldQuery` operations against the title field.
:param publisher: One or more :class:`FieldQuery` operations against the publisher field.
:param journal: One or more :class:`FieldQuery` operations against the journal field.
:param volume: One or more :class:`FieldQuery` operations against the volume field.
:param issue: One or more :class:`FieldQuery` operations against the issue field.
:param year: One or more :class:`FieldQuery` operations against the year field.
:param figure: One or more :class:`DisplayItemQuery` operations against the figure field.
:param table: One or more :class:`DisplayItemQuery` operations against the table field.
:param pages: One or more :class:`PagesQuery` operations against the pages field.
:param authors: One or more :class:`NameQuery` operations against the authors field.
:param editors: One or more :class:`NameQuery` operations against the editors field.
:param affiliations: One or more :class:`FieldQuery` operations against the affiliations field.
:param acknowledgements: One or more :class:`FieldQuery` operations against the acknowledgements field.
:param references: One or more :class:`ReferenceQuery` operations against the references field.
:param query: One or more :class:`ReferenceQuery` objects with nested queries.


def __init__(self, sort=None, weight=None, logic=None, simple=None, simple_weight=None, extract_as=None,<EOL>extract_all=None, extract_when_missing=None, length=None, offset=None, filter=None, **kwargs):

super(FieldQuery, self).__init__(<EOL>sort=sort, weight=weight, logic=logic, simple=simple, simple_weight=simple_weight, extract_as=extract_as,<EOL>extract_all=extract_all, extract_when_missing=extract_when_missing, length=length, offset=offset, **kwargs)<EOL>self._filter = None<EOL>self.filter = filter<EOL>

Constructor.

:param sort: ASCENDING or DESCENDING to set the sort order on this field.
:param weight: Weight of the query.
:param logic: Logic for this query. Must be equal to one of "MUST", "MUST_NOT", "SHOULD", or "OPTIONAL".
:param simple: String with the simple search to run against all fields.
:param simple_weight: Dictionary of relative paths to their weights for simple queries.
:param extract_as: String with the alias to save this field under.
:param extract_all: Boolean setting whether all values in an array should be extracted.
:param extract_when_missing: Any valid JSON-supported object or PIF object. This value is returned when a value is missing that should be extracted (and the overall query is still satisfied).
:param length: One or more :class:`FieldQuery` objects against the length field.
:param offset: One or more :class:`FieldQuery` objects against the offset field.
:param filter: One or more :class:`Filter` objects against this field.


def __init__(self, logic=None, weight=None, simple=None, simple_weight=None, extract_as=None, extract_all=None,<EOL>extract_when_missing=None, tags=None, length=None, offset=None, **kwargs):

self._logic = None<EOL>self.logic = logic<EOL>self._weight = None<EOL>self.weight = weight<EOL>self._simple = None<EOL>self.simple = simple<EOL>self._simple_weight = None<EOL>self.simple_weight = simple_weight<EOL>self._extract_as = None<EOL>self.extract_as = extract_as<EOL>self._extract_all = None<EOL>self.extract_all = extract_all<EOL>self._extract_when_missing = None<EOL>self.extract_when_missing = extract_when_missing<EOL>self._tags = None<EOL>self.tags = tags<EOL>self._length = None<EOL>self.length = length<EOL>self._offset = None<EOL>self.offset = offset<EOL>

Constructor.

:param logic: Logic for this filter. Must be equal to one of "MUST", "MUST_NOT", "SHOULD", or "OPTIONAL".
:param weight: Weight for the query.
:param simple: String with the simple search to run against all fields.
:param simple_weight: Dictionary of relative paths to their weights for simple queries.
:param extract_as: String with the alias to save this field under.
:param extract_all: Boolean setting whether all values in an array should be extracted.
:param extract_when_missing: Any valid JSON-supported object or PIF object. This value is returned when a value is missing that should be extracted (and the overall query is still satisfied).
:param tags: One or more :class:`FieldQuery` operations against the tags field.
:param length: One or more :class:`FieldQuery` operations against the length field.
:param offset: One or more :class:`FieldQuery` operations against the offset field.


def __init__(self, logic=None, weight=None, simple=None, simple_weight=None, extract_as=None, extract_all=None,<EOL>extract_when_missing=None, tags=None, length=None, offset=None, start=None, end=None,<EOL>query=None, **kwargs):

super(PagesQuery, self).__init__(<EOL>logic=logic, weight=weight, simple=simple, simple_weight=simple_weight, extract_as=extract_as,<EOL>extract_all=extract_all, extract_when_missing=extract_when_missing, tags=tags, length=length,<EOL>offset=offset, **kwargs)<EOL>self._start = None<EOL>self.start = start<EOL>self._end = None<EOL>self.end = end<EOL>self._query = None<EOL>self.query = query<EOL>

Constructor.

:param logic: Logic for this filter. Must be equal to one of "MUST", "MUST_NOT", "SHOULD", or "OPTIONAL".
:param weight: Weight of the query.
:param simple: String with the simple query to run against all fields.
:param simple_weight: Dictionary of relative paths to their weights for simple queries.
:param extract_as: String with the alias to save this field under.
:param extract_all: Boolean setting whether all values in an array should be extracted.
:param extract_when_missing: Any valid JSON-supported object or PIF object. This value is returned when a value is missing that should be extracted (and the overall query is still satisfied).
:param tags: One or more :class:`FieldQuery` operations against the tags field.
:param length: One or more :class:`FieldQuery` operations against the length field.
:param offset: One or more :class:`FieldQuery` operations against the offset field.
:param start: One or more :class:`FieldQuery` operations against the starting page field.
:param end: One or more :class:`FieldQuery` operations against the ending page field.
:param query: One or more :class:`PagesQuery` objects with nested queries.


def __init__(self, logic=None, weight=None, simple=None, simple_weight=None, extract_as=None, extract_all=None,<EOL>extract_when_missing=None, tags=None, length=None, offset=None, uid=None, updated_at=None,<EOL>names=None, ids=None, classifications=None, source=None, quantity=None, chemical_formula=None,<EOL>composition=None, properties=None, preparation=None, references=None, sub_systems=None,<EOL>query=None, **kwargs):

super(PifSystemQuery, self).__init__(<EOL>logic=logic, weight=weight, simple=simple, simple_weight=simple_weight, extract_as=extract_as,<EOL>extract_all=extract_all, extract_when_missing=extract_when_missing, tags=tags, length=length,<EOL>offset=offset, **kwargs)<EOL>self._uid = None<EOL>self.uid = uid<EOL>self._updated_at = None<EOL>self.updated_at = updated_at<EOL>self._names = None<EOL>self.names = names<EOL>self._ids = None<EOL>self.ids = ids<EOL>self._classifications = None<EOL>self.classifications = classifications<EOL>self._source = None<EOL>self.source = source<EOL>self._quantity = None<EOL>self.quantity = quantity<EOL>self._chemical_formula = None<EOL>self.chemical_formula = chemical_formula<EOL>self._composition = None<EOL>self.composition = composition<EOL>self._properties = None<EOL>self.properties = properties<EOL>self._preparation = None<EOL>self.preparation = preparation<EOL>self._references = None<EOL>self.references = references<EOL>self._sub_systems = None<EOL>self.sub_systems = sub_systems<EOL>self._query = None<EOL>self.query = query<EOL>

Constructor.

:param logic: Logic for this filter. Must be equal to one of "MUST", "MUST_NOT", "SHOULD", or "OPTIONAL".
:param weight: Weight of the query.
:param simple: String with the simple search to run against all fields.
:param simple_weight: Dictionary of relative paths to their weights for simple queries.
:param extract_as: String with the alias to save this field under.
:param extract_all: Boolean setting whether all values in an array should be extracted.
:param extract_when_missing: Any valid JSON-supported object or PIF object. This value is returned when a value is missing that should be extracted (and the overall query is still satisfied).
:param tags: One or more :class:`FieldQuery` operations against the tags field.
:param length: One or more :class:`FieldQuery` operations against the length field.
:param offset: One or more :class:`FieldQuery` operations against the offset field.
:param uid: One or more :class:`Filter` objects with the filters against the uid field.
:param updated_at: One or more :class:`Filter` objects with filters against the time that the PIF record was last updated.
:param names: One or more :class:`FieldQuery` objects with queries against the names field.
:param ids: One or more :class:`IdQuery` objects with queries against the ids field.
:param classifications: One or more :class:`ClassificationQuery` objects with queries against the classifications field.
:param source: One or more :class:`SourceQuery` objects with queries against the source field.
:param quantity: One or more :class:`QuantityQuery` objects with queries against the quantity field.
:param chemical_formula: One or more :class:`ChemicalFieldQuery` objects with queries against the chemicalFormula field.
:param composition: One or more :class:`CompositionQuery` objects with queries against the composition field.
:param properties: One or more :class:`PropertyQuery` objects with queries against the properties field.
:param preparation: One or more :class:`ProcessStepQuery` objects with queries against the preparation field.
:param references: One or more :class:`ReferenceQuery` objects with queries against the references field.
:param sub_systems: One or more :class:`PifSystemQuery` objects with queries against the subSystems field.
:param query: One or more :class:`PifSystemQuery` objects with nested queries.


def __init__(self, query=None, extraction_sort=None, from_index=None, size=None, random_results=None,<EOL>random_seed=None, score_relevance=None, return_max_score=None, timeout=None, return_system=None,<EOL>add_latex=None, return_extracted_path=None, unwrap_single_value_extractions=None, **kwargs):

super(PifSystemReturningQuery, self).__init__(<EOL>query=query, from_index=from_index, size=size, random_results=random_results, random_seed=random_seed,<EOL>score_relevance=score_relevance, return_max_score=return_max_score, timeout=timeout, **kwargs)<EOL>self._return_system = None<EOL>self.return_system = return_system<EOL>self._add_latex = None<EOL>self.add_latex = add_latex<EOL>self._return_extracted_path = None<EOL>self.return_extracted_path = return_extracted_path<EOL>self._unwrap_single_value_extractions = None<EOL>self.unwrap_single_value_extractions = unwrap_single_value_extractions<EOL>self._extraction_sort = None<EOL>self.extraction_sort = extraction_sort<EOL>

Constructor.

:param query: One or more :class:`DataQuery` objects with the queries to run.
:param extraction_sort: A single :class:`ExtractionSort` object for sorting.
:param from_index: Index of the first hit that should be returned.
:param size: Total number of hits the should be returned.
:param random_results: Whether to return a random set of records.
:param random_seed: The random seed to use.
:param score_relevance: Whether to use relevance scoring.
:param return_max_score: Whether to return the maximum score.
:param timeout: The number of milliseconds to wait for the query to execute.
:param return_system: Whether to return the matched PIF systems.
:param add_latex: Whether to add latex formatting where possible in results.
:param return_extracted_path: Whether to return the path in PIFs for extracted values.
:param unwrap_single_value_extractions: Whether to unwrap extracted values when they are lists with one value.


def __init__(self, result=None, status=None, **kwargs):

self._result = None<EOL>self.result = result<EOL>self._status = None<EOL>self.status = status<EOL>

Constructor.

:param result: A single :class:`PifSearchResult` object with the query results.
:param status: 'SUCCESS', 'ERROR', or 'NOT_EXECUTED'.


def __init__(self, id=None, dataset=None, dataset_version=None, score=None, updated_at=None, system=None, <EOL>extracted=None, extracted_path=None, **kwargs):

self._id = None<EOL>self.id = id<EOL>self._dataset = None<EOL>self.dataset = dataset<EOL>self._dataset_version = None<EOL>self.dataset_version = dataset_version<EOL>self._score = None<EOL>self.score = score<EOL>self._updated_at = None<EOL>self.updated_at = updated_at<EOL>self._system = None<EOL>self.system = system<EOL>self._extracted = None<EOL>self.extracted = extracted<EOL>self._extracted_path = None<EOL>self.extracted_path = extracted_path<EOL>

Constructor.

:param id: String with the ID of the record.
:param dataset: Integer with the dataset of the record.
:param dataset_version: Integer with the dataset version of the record.
:param score: Score with the relevancy of the result.
:param updated_at: String with the last time that the record was updated.
:param system: Pif System object that matched.
:param extracted: Dictionary with a map of extracted property names to values.
:param extracted_path: Dictionary with a map of extracted property names to paths in a PIF.


def __init__(self, took=None, results=None, **kwargs):

self._took = None<EOL>self.took = took<EOL>self._results = None<EOL>self.results = results<EOL>

Constructor.

:param took: Number of milliseconds that the query took to execute.
:param results: List of :class:`PifMultiSearchResultElement` objects.


def __init__(self, took=None, total_num_hits=None, max_score=None, hits=None, **kwargs):

super(PifSearchResult, self).__init__(<EOL>took=took, total_num_hits=total_num_hits, max_score=max_score,<EOL>hits=self._get_object(PifSearchHit, hits), **kwargs)<EOL>

Constructor.

:param took: Number of milliseconds that the query took to execute.
:param total_num_hits: Total number of hits.
:param max_score: The maximum score.
:param hits: List of :class:`PifSearchHit` objects.


with open(path, "<STR_LIT:r>") as f:<EOL><INDENT>parsed_dict = json.load(f)<EOL><DEDENT>return parsed_dict<EOL>

Given a filepath, loads the file as a dictionary from JSON

:param path: The path to a JSON file


def create(self, configuration, name, description):

data = {<EOL>"<STR_LIT>":<EOL>configuration,<EOL>"<STR_LIT:name>":<EOL>name,<EOL>"<STR_LIT:description>":<EOL>description<EOL>}<EOL>failure_message = "<STR_LIT>"<EOL>result = self._get_success_json(self._post_json(<EOL>'<STR_LIT>', data, failure_message=failure_message))<EOL>data_view_id = result['<STR_LIT:data>']['<STR_LIT:id>']<EOL>return data_view_id<EOL>

Creates a data view from the search template and ml template given

:param configuration: Information to construct the data view from (eg descriptors, datasets etc)
:param name: Name of the data view
:param description: Description for the data view
:return: The data view id


def update(self, id, configuration, name, description):

data = {<EOL>"<STR_LIT>":<EOL>configuration,<EOL>"<STR_LIT:name>":<EOL>name,<EOL>"<STR_LIT:description>":<EOL>description<EOL>}<EOL>failure_message = "<STR_LIT>"<EOL>self._patch_json(<EOL>'<STR_LIT>' + id, data, failure_message=failure_message)<EOL>

Updates an existing data view from the search template and ml template given

:param id: Identifier for the data view.  This returned from the create method.
:param configuration: Information to construct the data view from (eg descriptors, datasets etc)
:param name: Name of the data view
:param description: Description for the data view


failure_message = "<STR_LIT>"<EOL>self._delete('<STR_LIT>' + id, None, failure_message=failure_message)<EOL>

Deletes a data view.

:param id: Identifier of the data view


failure_message = "<STR_LIT>"<EOL>return self._get_success_json(self._get(<EOL>'<STR_LIT>' + data_view_id, None, failure_message=failure_message))['<STR_LIT:data>']['<STR_LIT>']<EOL>

Gets basic information about a view

:param data_view_id: Identifier of the data view
:return: Metadata about the view as JSON


Retrieves the status for all of the services associated with a data view:
    - predict
    - experimental_design
    - data_reports
    - model_reports

:param data_view_id: The ID number of the data view to which the
    run belongs, as a string
:type data_view_id: str
:return: A :class:`DataViewStatus`
:rtype: DataViewStatus


available_columns = self.search_template_client.get_available_columns(dataset_ids)<EOL>search_template = self.search_template_client.create(dataset_ids, available_columns)<EOL>return self.create_ml_configuration(search_template, available_columns, dataset_ids)<EOL>

Creates an ml configuration from dataset_ids and extract_as_keys

:param dataset_ids: Array of dataset identifiers to make search template from
:return: An identifier used to request the status of the builder job (get_ml_configuration_status)


def create_ml_configuration(self, search_template, extract_as_keys, dataset_ids):

data = {<EOL>"<STR_LIT>":<EOL>search_template,<EOL>"<STR_LIT>":<EOL>extract_as_keys<EOL>}<EOL>failure_message = "<STR_LIT>"<EOL>config_job_id = self._get_success_json(self._post_json(<EOL>'<STR_LIT>', data, failure_message=failure_message))['<STR_LIT:data>'][<EOL>'<STR_LIT:result>']['<STR_LIT>']<EOL>while True:<EOL><INDENT>config_status = self.__get_ml_configuration_status(config_job_id)<EOL>print('<STR_LIT>', config_status)<EOL>if config_status['<STR_LIT:status>'] == '<STR_LIT>':<EOL><INDENT>ml_config = self.__convert_response_to_configuration(config_status['<STR_LIT:result>'], dataset_ids)<EOL>return ml_config<EOL><DEDENT>time.sleep(<NUM_LIT:5>)<EOL><DEDENT>

This method will spawn a server job to create a default ML configuration based on a search template and
the extract as keys.
This function will submit the request to build, and wait for the configuration to finish before returning.

:param search_template: A search template defining the query (properties, datasets etc)
:param extract_as_keys: Array of extract-as keys defining the descriptors
:param dataset_ids: Array of dataset identifiers to make search template from
:return: An identifier used to request the status of the builder job (get_ml_configuration_status)


def __convert_response_to_configuration(self, result_blob, dataset_ids):

builder = DataViewBuilder()<EOL>builder.dataset_ids(dataset_ids)<EOL>for i, (k, v) in enumerate(result_blob['<STR_LIT>'].items()):<EOL><INDENT>try:<EOL><INDENT>descriptor = self.__snake_case(v[<NUM_LIT:0>])<EOL>print(json.dumps(descriptor))<EOL>descriptor['<STR_LIT>'] = k<EOL>builder.add_raw_descriptor(descriptor)<EOL><DEDENT>except IndexError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>for i, (k, v) in enumerate(result_blob['<STR_LIT>'].items()):<EOL><INDENT>builder.set_role(k, v.lower())<EOL><DEDENT>return builder.build()<EOL>

Utility function to turn the result object from the configuration builder endpoint into something that
can be used directly as a configuration.

:param result_blob: Nested dicts representing the possible descriptors
:param dataset_ids: Array of dataset identifiers to make search template from
:return: An object suitable to be used as a parameter to data view create


newdict = {}<EOL>for i, (k, v) in enumerate(descriptor.items()):<EOL><INDENT>newkey = "<STR_LIT>"<EOL>for j, c in enumerate(k):<EOL><INDENT>if c.isupper():<EOL><INDENT>if len(newkey) != <NUM_LIT:0>:<EOL><INDENT>newkey += '<STR_LIT:_>'<EOL><DEDENT>newkey += c.lower()<EOL><DEDENT>else:<EOL><INDENT>newkey += c<EOL><DEDENT><DEDENT>newdict[newkey] = v<EOL><DEDENT>return newdict<EOL>

Utility method to convert camelcase to snake
:param descriptor: The dictionary to convert


failure_message = "<STR_LIT>"<EOL>response = self._get_success_json(self._get(<EOL>'<STR_LIT>' + job_id + '<STR_LIT>', None, failure_message=failure_message))[<EOL>'<STR_LIT:data>']<EOL>return response<EOL>

After invoking the create_ml_configuration async method, you can use this method to
check on the status of the builder job.

:param job_id: The identifier returned from create_ml_configuration
:return: Job status


data = {<EOL>"<STR_LIT>":<EOL>ml_template<EOL>}<EOL>failure_message = "<STR_LIT>"<EOL>res = self._get_success_json(self._post_json(<EOL>'<STR_LIT>', data, failure_message=failure_message))['<STR_LIT:data>']<EOL>if res['<STR_LIT>']:<EOL><INDENT>return '<STR_LIT:OK>'<EOL><DEDENT>return res['<STR_LIT>']<EOL>

Runs the template against the validation endpoint, returns a message indicating status of the templte

:param ml_template: Template to validate
:return: OK or error message if validation failed


self.configuration['<STR_LIT>'] = dataset_ids<EOL>

Sets the dataset ids to use for the view

:param dataset_ids: Array of strings, one for each dataset id


self.configuration['<STR_LIT>'] = model_type<EOL>

Sets the model type for the view

:param model_type: A string of either linear, or default


def add_descriptor(self, descriptor, role='<STR_LIT:ignore>', group_by_key=False):

descriptor.validate()<EOL>if descriptor.key in self.configuration["<STR_LIT>"]:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>self.configuration['<STR_LIT>'].append(descriptor.as_dict())<EOL>self.configuration["<STR_LIT>"][descriptor.key] = role<EOL>if group_by_key:<EOL><INDENT>self.configuration["<STR_LIT>"].append(descriptor.key)<EOL><DEDENT>

Add a descriptor column.

:param descriptor: A Descriptor instance (e.g., RealDescriptor, InorganicDescriptor, etc.)
:param role: Specify a role (input, output, latentVariable, or ignore)
:param group_by_key: Whether or not to group by this key during cross validation


self.configuration['<STR_LIT>'].append(descriptor)<EOL>

Add a raw descriptor dictionary object.
:param descriptor: A descriptor as a dictionary


if not isinstance(dataset_ids, list):<EOL><INDENT>dataset_ids = [dataset_ids]<EOL><DEDENT>data = {<EOL>"<STR_LIT>":<EOL>dataset_ids<EOL>}<EOL>failure_message = "<STR_LIT>".format(dataset_ids)<EOL>return self._get_success_json(self._post_json(<EOL>'<STR_LIT>', data, failure_message=failure_message))['<STR_LIT:data>']<EOL>

Retrieves the set of columns from the combination of dataset ids given

:param dataset_ids: The id of the dataset to retrieve columns from
:type dataset_ids: list of int
:return: A list of column names from the dataset ids given.
:rtype: list of str


data = {<EOL>"<STR_LIT>":<EOL>dataset_ids<EOL>}<EOL>failure_message = "<STR_LIT>".format(dataset_ids)<EOL>return self._get_success_json(self._post_json(<EOL>'<STR_LIT>', data, failure_message=failure_message))['<STR_LIT:data>']<EOL>

Generates a default search templates from the available columns in the dataset ids given.

:param dataset_ids: The id of the dataset to retrieve files from
:type dataset_ids: list of int
:return: A search template based on the columns in the datasets given


def __prune_search_template(self, extract_as_keys, search_template):

data = {<EOL>"<STR_LIT>":<EOL>extract_as_keys,<EOL>"<STR_LIT>":<EOL>search_template<EOL>}<EOL>failure_message = "<STR_LIT>"<EOL>return self._get_success_json(self._post_json(<EOL>'<STR_LIT>', data, failure_message=failure_message))['<STR_LIT:data>']<EOL>

Returns a new search template, but the new template has only the extract_as_keys given.

:param extract_as_keys: List of extract as keys to keep
:param search_template: The search template to prune
:return: New search template with pruned columns


return _NOTATION_KEYS.get(notation, None)<EOL>

Given a numeric value or string value, returns one in IP_DOT, IP_HEX,
    IP_BIN, etc., or None if unable to convert to the internally
    used numeric convention.


return NOTATION_MAP[_get_notation(notation) or IP_UNKNOWN][<NUM_LIT:0>]<EOL>

Return a string representing the given notation.


octets = str(ip).split('<STR_LIT:.>')<EOL>if len(octets) != <NUM_LIT:4>:<EOL><INDENT>return False<EOL><DEDENT>for i in octets:<EOL><INDENT>try:<EOL><INDENT>val = int(i)<EOL><DEDENT>except ValueError:<EOL><INDENT>return False<EOL><DEDENT>if val > <NUM_LIT:255> or val < <NUM_LIT:0>:<EOL><INDENT>return False<EOL><DEDENT><DEDENT>return True<EOL>

Return true if the IP address is in dotted decimal notation.


try:<EOL><INDENT>dec = int(str(ip), <NUM_LIT:16>)<EOL><DEDENT>except (TypeError, ValueError):<EOL><INDENT>return False<EOL><DEDENT>if dec > <NUM_LIT> or dec < <NUM_LIT:0>:<EOL><INDENT>return False<EOL><DEDENT>return True<EOL>

Return true if the IP address is in hexadecimal notation.


try:<EOL><INDENT>ip = str(ip)<EOL>if len(ip) != <NUM_LIT:32>:<EOL><INDENT>return False<EOL><DEDENT>dec = int(ip, <NUM_LIT:2>)<EOL><DEDENT>except (TypeError, ValueError):<EOL><INDENT>return False<EOL><DEDENT>if dec > <NUM_LIT> or dec < <NUM_LIT:0>:<EOL><INDENT>return False<EOL><DEDENT>return True<EOL>

Return true if the IP address is in binary notation.


try:<EOL><INDENT>dec = int(str(ip), <NUM_LIT:8>)<EOL><DEDENT>except (TypeError, ValueError):<EOL><INDENT>return False<EOL><DEDENT>if dec > <NUM_LIT> or dec < <NUM_LIT:0>:<EOL><INDENT>return False<EOL><DEDENT>return True<EOL>

Return true if the IP address is in octal notation.


try:<EOL><INDENT>dec = int(str(ip))<EOL><DEDENT>except ValueError:<EOL><INDENT>return False<EOL><DEDENT>if dec > <NUM_LIT> or dec < <NUM_LIT:0>:<EOL><INDENT>return False<EOL><DEDENT>return True<EOL>

Return true if the IP address is in decimal notation.


<EOL>_NM_CHECK_FUNCT = {<EOL>NM_DOT: _dot_to_dec,<EOL>NM_HEX: _hex_to_dec,<EOL>NM_BIN: _bin_to_dec,<EOL>NM_OCT: _oct_to_dec,<EOL>NM_DEC: _dec_to_dec_long}<EOL>try:<EOL><INDENT>dec = _NM_CHECK_FUNCT[notation](nm, check=True)<EOL><DEDENT>except ValueError:<EOL><INDENT>return False<EOL><DEDENT>if dec in _NETMASKS_VALUES:<EOL><INDENT>return True<EOL><DEDENT>return False<EOL>

Function internally used to check if the given netmask
    is of the specified notation.


return _check_nm(nm, NM_DOT)<EOL>

Return true if the netmask is in dotted decimal notatation.


return _check_nm(nm, NM_HEX)<EOL>

Return true if the netmask is in hexadecimal notatation.


return _check_nm(nm, NM_BIN)<EOL>

Return true if the netmask is in binary notatation.


return _check_nm(nm, NM_OCT)<EOL>

Return true if the netmask is in octal notatation.


return _check_nm(nm, NM_DEC)<EOL>

Return true if the netmask is in decimal notatation.


try:<EOL><INDENT>bits = int(str(nm))<EOL><DEDENT>except ValueError:<EOL><INDENT>return False<EOL><DEDENT>if bits > <NUM_LIT:32> or bits < <NUM_LIT:0>:<EOL><INDENT>return False<EOL><DEDENT>return True<EOL>

Return true if the netmask is in bits notatation.


try:<EOL><INDENT>dec = <NUM_LIT> - _dot_to_dec(nm, check=True)<EOL><DEDENT>except ValueError:<EOL><INDENT>return False<EOL><DEDENT>if dec in _NETMASKS_VALUES:<EOL><INDENT>return True<EOL><DEDENT>return False<EOL>

Return true if the netmask is in wildcard bits notatation.


if check and not is_dot(ip):<EOL><INDENT>raise ValueError('<STR_LIT>' % ip)<EOL><DEDENT>octets = str(ip).split('<STR_LIT:.>')<EOL>dec = <NUM_LIT:0><EOL>dec |= int(octets[<NUM_LIT:0>]) << <NUM_LIT><EOL>dec |= int(octets[<NUM_LIT:1>]) << <NUM_LIT:16><EOL>dec |= int(octets[<NUM_LIT:2>]) << <NUM_LIT:8><EOL>dec |= int(octets[<NUM_LIT:3>])<EOL>return dec<EOL>

Dotted decimal notation to decimal conversion.


first = int((ip >> <NUM_LIT>) & <NUM_LIT:255>)<EOL>second = int((ip >> <NUM_LIT:16>) & <NUM_LIT:255>)<EOL>third = int((ip >> <NUM_LIT:8>) & <NUM_LIT:255>)<EOL>fourth = int(ip & <NUM_LIT:255>)<EOL>return '<STR_LIT>' % (first, second, third, fourth)<EOL>

Decimal to dotted decimal notation conversion.


if check and not is_hex(ip):<EOL><INDENT>raise ValueError('<STR_LIT>' % ip)<EOL><DEDENT>if isinstance(ip, int):<EOL><INDENT>ip = hex(ip)<EOL><DEDENT>return int(str(ip), <NUM_LIT:16>)<EOL>


return hex(ip)<EOL>


if check and not is_oct(ip):<EOL><INDENT>raise ValueError('<STR_LIT>' % ip)<EOL><DEDENT>if isinstance(ip, int):<EOL><INDENT>ip = oct(ip)<EOL><DEDENT>return int(str(ip), <NUM_LIT:8>)<EOL>


return oct(ip)<EOL>


if check and not is_bin(ip):<EOL><INDENT>raise ValueError('<STR_LIT>' % ip)<EOL><DEDENT>if isinstance(ip, int):<EOL><INDENT>ip = str(ip)<EOL><DEDENT>return int(str(ip), <NUM_LIT:2>)<EOL>


the_table = <NUM_LIT>*[None]<EOL>bits_per_byte = list(range(<NUM_LIT:7>, -<NUM_LIT:1>, -<NUM_LIT:1>))<EOL>for n in range(<NUM_LIT>):<EOL><INDENT>l = n<EOL>bits = <NUM_LIT:8>*[None]<EOL>for i in bits_per_byte:<EOL><INDENT>bits[i] = '<STR_LIT>'[n & <NUM_LIT:1>]<EOL>n >>= <NUM_LIT:1><EOL><DEDENT>the_table[l] = '<STR_LIT>'.join(bits)<EOL><DEDENT>return the_table<EOL>

Generate a table to convert a whole byte to binary.
    This code was taken from the Python Cookbook, 2nd edition - O'Reilly.


bits = []<EOL>while ip:<EOL><INDENT>bits.append(_BYTES_TO_BITS[ip & <NUM_LIT:255>])<EOL>ip >>= <NUM_LIT:8><EOL><DEDENT>bits.reverse()<EOL>return '<STR_LIT>'.join(bits) or <NUM_LIT:32>*'<STR_LIT:0>'<EOL>


if check and not is_dec(ip):<EOL><INDENT>raise ValueError('<STR_LIT>' % ip)<EOL><DEDENT>return int(str(ip))<EOL>


return str(ip)<EOL>


if check and not is_bits_nm(nm):<EOL><INDENT>raise ValueError('<STR_LIT>' % nm)<EOL><DEDENT>bits = int(str(nm))<EOL>return VALID_NETMASKS[bits]<EOL>


return str(_NETMASKS_INV[nm])<EOL>


if check and not is_wildcard_nm(nm):<EOL><INDENT>raise ValueError('<STR_LIT>' % nm)<EOL><DEDENT>return <NUM_LIT> - _dot_to_dec(nm, check=False)<EOL>


return _dec_to_dot(<NUM_LIT> - nm)<EOL>


notation_orig = notation<EOL>notation = _get_notation(notation)<EOL>if notation not in _CHECK_FUNCT_KEYS:<EOL><INDENT>raise ValueError('<STR_LIT>' % notation_orig)<EOL><DEDENT>return _CHECK_FUNCT[notation][_isnm](ip)<EOL>

Internally used to check if an IP/netmask is in the given notation.


return _is_notation(ip, notation, _isnm=False)<EOL>

Return true if the given address is in the given notation.


return _is_notation(nm, notation, _isnm=True)<EOL>

Return true if the given netmask is in the given notation.


ip = str(ip)<EOL>if len(ip) > <NUM_LIT:1>:<EOL><INDENT>if ip[<NUM_LIT:0>:<NUM_LIT:2>] == '<STR_LIT>':<EOL><INDENT>if _CHECK_FUNCT[IP_HEX][_isnm](ip):<EOL><INDENT>return IP_HEX<EOL><DEDENT><DEDENT>elif ip[<NUM_LIT:0>] == '<STR_LIT:0>':<EOL><INDENT>if _CHECK_FUNCT[IP_OCT][_isnm](ip):<EOL><INDENT>return IP_OCT<EOL><DEDENT><DEDENT><DEDENT>if _CHECK_FUNCT[IP_DOT][_isnm](ip):<EOL><INDENT>return IP_DOT<EOL><DEDENT>elif _isnm and _CHECK_FUNCT[NM_BITS][_isnm](ip):<EOL><INDENT>return NM_BITS<EOL><DEDENT>elif _CHECK_FUNCT[IP_DEC][_isnm](ip):<EOL><INDENT>return IP_DEC<EOL><DEDENT>elif _isnm and _CHECK_FUNCT[NM_WILDCARD][_isnm](ip):<EOL><INDENT>return NM_WILDCARD<EOL><DEDENT>elif _CHECK_FUNCT[IP_BIN][_isnm](ip):<EOL><INDENT>return IP_BIN<EOL><DEDENT>return IP_UNKNOWN<EOL>

Function internally used to detect the notation of the
    given IP or netmask.


return _detect(ip, _isnm=False)<EOL>

Detect the notation of an IP address.

    @param ip: the IP address.
    @type ip: integers, strings or object with an appropriate __str()__ method.
    @return: one of the IP_* constants; IP_UNKNOWN if undetected.


return _detect(nm, _isnm=True)<EOL>

Detect the notation of a netmask.
    @param nm: the netmask.
    @type nm: integers, strings or object with an appropriate __str()__ method.
    @return: one of the NM_* constants; NM_UNKNOWN if undetected.


return NOTATION_MAP[detect(ip)][<NUM_LIT:0>]<EOL>

Return the notation of an IP address (string).


return NOTATION_MAP[detect_nm(nm)][<NUM_LIT:0>]<EOL>

Return the notation of a netmask (string).


def _convert(ip, notation, inotation, _check, _isnm):

inotation_orig = inotation<EOL>notation_orig = notation<EOL>inotation = _get_notation(inotation)<EOL>notation = _get_notation(notation)<EOL>if inotation is None:<EOL><INDENT>raise ValueError('<STR_LIT>' % inotation_orig)<EOL><DEDENT>if notation is None:<EOL><INDENT>raise ValueError('<STR_LIT>' % notation_orig)<EOL><DEDENT>docheck = _check or False<EOL>if inotation == IP_UNKNOWN:<EOL><INDENT>inotation = _detect(ip, _isnm)<EOL>if inotation == IP_UNKNOWN:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if _check is None:<EOL><INDENT>docheck = True<EOL><DEDENT><DEDENT>if _isnm:<EOL><INDENT>docheck = False<EOL><DEDENT>dec = <NUM_LIT:0><EOL>if inotation == IP_DOT:<EOL><INDENT>dec = _dot_to_dec(ip, docheck)<EOL><DEDENT>elif inotation == IP_HEX:<EOL><INDENT>dec = _hex_to_dec(ip, docheck)<EOL><DEDENT>elif inotation == IP_BIN:<EOL><INDENT>dec = _bin_to_dec(ip, docheck)<EOL><DEDENT>elif inotation == IP_OCT:<EOL><INDENT>dec = _oct_to_dec(ip, docheck)<EOL><DEDENT>elif inotation == IP_DEC:<EOL><INDENT>dec = _dec_to_dec_long(ip, docheck)<EOL><DEDENT>elif _isnm and inotation == NM_BITS:<EOL><INDENT>dec = _bits_to_dec(ip, docheck)<EOL><DEDENT>elif _isnm and inotation == NM_WILDCARD:<EOL><INDENT>dec = _wildcard_to_dec(ip, docheck)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>' % inotation_orig)<EOL><DEDENT>if _isnm and dec not in _NETMASKS_VALUES:<EOL><INDENT>raise ValueError('<STR_LIT>' % ip)<EOL><DEDENT>if notation == IP_DOT:<EOL><INDENT>return _dec_to_dot(dec)<EOL><DEDENT>elif notation == IP_HEX:<EOL><INDENT>return _dec_to_hex(dec)<EOL><DEDENT>elif notation == IP_BIN:<EOL><INDENT>return _dec_to_bin(dec)<EOL><DEDENT>elif notation == IP_OCT:<EOL><INDENT>return _dec_to_oct(dec)<EOL><DEDENT>elif notation == IP_DEC:<EOL><INDENT>return _dec_to_dec_str(dec)<EOL><DEDENT>elif _isnm and notation == NM_BITS:<EOL><INDENT>return _dec_to_bits(dec)<EOL><DEDENT>elif _isnm and notation == NM_WILDCARD:<EOL><INDENT>return _dec_to_wildcard(dec)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>' % notation_orig)<EOL><DEDENT>

Internally used to convert IPs and netmasks to other notations.


def convert(ip, notation=IP_DOT, inotation=IP_UNKNOWN, check=True):

return _convert(ip, notation, inotation, _check=check, _isnm=False)<EOL>

Convert among IP address notations.

    Given an IP address, this function returns the address
    in another notation.

    @param ip: the IP address.
    @type ip: integers, strings or object with an appropriate __str()__ method.

    @param notation: the notation of the output (default: IP_DOT).
    @type notation: one of the IP_* constants, or the equivalent strings.

    @param inotation: force the input to be considered in the given notation
                    (default the notation of the input is autodetected).
    @type inotation: one of the IP_* constants, or the equivalent strings.

    @param check: force the notation check on the input.
    @type check: True force the check, False force not to check and None
                do the check only if the inotation is unknown.

    @return: a string representing the IP in the selected notation.

    @raise ValueError: raised when the input is in unknown notation.


def convert_nm(nm, notation=IP_DOT, inotation=IP_UNKNOWN, check=True):

return _convert(nm, notation, inotation, _check=check, _isnm=True)<EOL>


def __init__(self, ip, notation=IP_UNKNOWN):

self.set(ip, notation)<EOL>


self._ip_dec = int(_convert(ip, notation=IP_DEC, inotation=notation,<EOL>_check=True, _isnm=self._isnm))<EOL>self._ip = _convert(self._ip_dec, notation=IP_DOT, inotation=IP_DEC,<EOL>_check=False, _isnm=self._isnm)<EOL>


return self.get_dot()<EOL>


return self._ip<EOL>

Return the dotted decimal notation of the address/netmask.


return _convert(self._ip_dec, notation=IP_HEX,<EOL>inotation=IP_DEC, _check=False, _isnm=self._isnm)<EOL>

Return the hexadecimal notation of the address/netmask.


return _convert(self._ip_dec, notation=IP_BIN,<EOL>inotation=IP_DEC, _check=False, _isnm=self._isnm)<EOL>

Return the binary notation of the address/netmask.


return str(self._ip_dec)<EOL>

Return the decimal notation of the address/netmask.


return _convert(self._ip_dec, notation=IP_OCT,<EOL>inotation=IP_DEC, _check=False, _isnm=self._isnm)<EOL>

Return the octal notation of the address/netmask.


return self.get()<EOL>


if isinstance(other, self.__class__):<EOL><INDENT>return other._ip_dec<EOL><DEDENT>elif isinstance(other, int):<EOL><INDENT>return other<EOL><DEDENT>return self.__class__(other)._ip_dec<EOL>

Prepare the item to be compared with this address/netmask.


return self._ip_dec<EOL>

Return the decimal representation of the address/netmask.


return '<STR_LIT>' % self.get()<EOL>

The representation string for this address.


if isinstance(other, self.__class__):<EOL><INDENT>sum_ = self._ip_dec + other._ip_dec<EOL><DEDENT>elif isinstance(other, int):<EOL><INDENT>sum_ = self._ip_dec + other<EOL><DEDENT>else:<EOL><INDENT>other = self.__class__(other)<EOL>sum_ = self._ip_dec + other._ip_dec<EOL><DEDENT>return sum_<EOL>


return IPv4Address(self._add(other), notation=IP_DEC)<EOL>


self.set(self._add(other), notation=IP_DEC)<EOL>return self<EOL>


if isinstance(other, self.__class__):<EOL><INDENT>sub = self._ip_dec - other._ip_dec<EOL><DEDENT>if isinstance(other, int):<EOL><INDENT>sub = self._ip_dec - other<EOL><DEDENT>else:<EOL><INDENT>other = self.__class__(other)<EOL>sub = self._ip_dec - other._ip_dec<EOL><DEDENT>return sub<EOL>


return IPv4Address(self._sub(other), notation=IP_DEC)<EOL>


self.set(self._sub(other), notation=IP_DEC)<EOL>return self<EOL>


return _convert(self._ip, notation=NM_BITS,<EOL>inotation=IP_DOT, _check=False, _isnm=self._isnm)<EOL>

Return the bits notation of the netmask.


return _convert(self._ip, notation=NM_WILDCARD,<EOL>inotation=IP_DOT, _check=False, _isnm=self._isnm)<EOL>

Return the wildcard bits notation of the netmask.


return '<STR_LIT>' % self.get()<EOL>

The representation string for this netmask.


if isinstance(ip, str) and netmask is None:<EOL><INDENT>ipnm = ip.split('<STR_LIT:/>')<EOL>if len(ipnm) != <NUM_LIT:2>:<EOL><INDENT>raise ValueError('<STR_LIT>' % ip)<EOL><DEDENT>ip = ipnm[<NUM_LIT:0>]<EOL>netmask = ipnm[<NUM_LIT:1>]<EOL><DEDENT>if isinstance(ip, IPv4Address):<EOL><INDENT>self._ip = ip<EOL><DEDENT>else:<EOL><INDENT>self._ip = IPv4Address(ip)<EOL><DEDENT>if isinstance(netmask, IPv4NetMask):<EOL><INDENT>self._nm = netmask<EOL><DEDENT>else:<EOL><INDENT>self._nm = IPv4NetMask(netmask)<EOL><DEDENT>ipl = int(self._ip)<EOL>nml = int(self._nm)<EOL>base_add = ipl & nml<EOL>self._ip_num = <NUM_LIT> - <NUM_LIT:1> - nml<EOL>if self._ip_num in (-<NUM_LIT:1>, <NUM_LIT:0>):<EOL><INDENT>if self._ip_num == -<NUM_LIT:1>:<EOL><INDENT>self._ip_num = <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>self._ip_num = <NUM_LIT:2><EOL><DEDENT>self._net_ip = None<EOL>self._bc_ip = None<EOL>self._first_ip_dec = base_add<EOL>self._first_ip = IPv4Address(self._first_ip_dec, notation=IP_DEC)<EOL>if self._ip_num == <NUM_LIT:1>:<EOL><INDENT>last_ip_dec = self._first_ip_dec<EOL><DEDENT>else:<EOL><INDENT>last_ip_dec = self._first_ip_dec + <NUM_LIT:1><EOL><DEDENT>self._last_ip = IPv4Address(last_ip_dec, notation=IP_DEC)<EOL>return<EOL><DEDENT>self._net_ip = IPv4Address(base_add, notation=IP_DEC)<EOL>self._bc_ip = IPv4Address(base_add + self._ip_num + <NUM_LIT:1>, notation=IP_DEC)<EOL>self._first_ip_dec = base_add + <NUM_LIT:1><EOL>self._first_ip = IPv4Address(self._first_ip_dec, notation=IP_DEC)<EOL>self._last_ip = IPv4Address(base_add + self._ip_num, notation=IP_DEC)<EOL>


return '<STR_LIT>' % (str(self._ip), str(self._nm))<EOL>


self.set(ip=ip, netmask=self._nm)<EOL>


return self._ip<EOL>


self.set(ip=self._ip, netmask=netmask)<EOL>


return self._nm<EOL>


return self._first_ip<EOL>


return self._last_ip<EOL>


return self._net_ip<EOL>


return self._bc_ip<EOL>


return self._ip_num<EOL>

Return the number of usable IP addresses.


return list(self.__iter__())<EOL>

Return a list of IPv4Address objects, one for every usable IP.

        WARNING: it's slow and can take a huge amount of memory for
        subnets with a large number of addresses.
        Use __iter__ instead ('for ip in ...').