partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | Parties._from_dict | Initialize a Parties object from a json dictionary. | ibm_watson/compare_comply_v1.py | def _from_dict(cls, _dict):
"""Initialize a Parties object from a json dictionary."""
args = {}
if 'party' in _dict:
args['party'] = _dict.get('party')
if 'importance' in _dict:
args['importance'] = _dict.get('importance')
if 'role' in _dict:
a... | def _from_dict(cls, _dict):
"""Initialize a Parties object from a json dictionary."""
args = {}
if 'party' in _dict:
args['party'] = _dict.get('party')
if 'importance' in _dict:
args['importance'] = _dict.get('importance')
if 'role' in _dict:
a... | [
"Initialize",
"a",
"Parties",
"object",
"from",
"a",
"json",
"dictionary",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/compare_comply_v1.py#L3922-L3939 | [
"def",
"_from_dict",
"(",
"cls",
",",
"_dict",
")",
":",
"args",
"=",
"{",
"}",
"if",
"'party'",
"in",
"_dict",
":",
"args",
"[",
"'party'",
"]",
"=",
"_dict",
".",
"get",
"(",
"'party'",
")",
"if",
"'importance'",
"in",
"_dict",
":",
"args",
"[",
... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | Parties._to_dict | Return a json dictionary representing this model. | ibm_watson/compare_comply_v1.py | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'party') and self.party is not None:
_dict['party'] = self.party
if hasattr(self, 'importance') and self.importance is not None:
_dict['importance'] = self.impo... | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'party') and self.party is not None:
_dict['party'] = self.party
if hasattr(self, 'importance') and self.importance is not None:
_dict['importance'] = self.impo... | [
"Return",
"a",
"json",
"dictionary",
"representing",
"this",
"model",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/compare_comply_v1.py#L3941-L3954 | [
"def",
"_to_dict",
"(",
"self",
")",
":",
"_dict",
"=",
"{",
"}",
"if",
"hasattr",
"(",
"self",
",",
"'party'",
")",
"and",
"self",
".",
"party",
"is",
"not",
"None",
":",
"_dict",
"[",
"'party'",
"]",
"=",
"self",
".",
"party",
"if",
"hasattr",
... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | SectionTitles._to_dict | Return a json dictionary representing this model. | ibm_watson/compare_comply_v1.py | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'text') and self.text is not None:
_dict['text'] = self.text
if hasattr(self, 'location') and self.location is not None:
_dict['location'] = self.location._to_d... | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'text') and self.text is not None:
_dict['text'] = self.text
if hasattr(self, 'location') and self.location is not None:
_dict['location'] = self.location._to_d... | [
"Return",
"a",
"json",
"dictionary",
"representing",
"this",
"model",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/compare_comply_v1.py#L4345-L4359 | [
"def",
"_to_dict",
"(",
"self",
")",
":",
"_dict",
"=",
"{",
"}",
"if",
"hasattr",
"(",
"self",
",",
"'text'",
")",
"and",
"self",
".",
"text",
"is",
"not",
"None",
":",
"_dict",
"[",
"'text'",
"]",
"=",
"self",
".",
"text",
"if",
"hasattr",
"(",... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | ShortDoc._to_dict | Return a json dictionary representing this model. | ibm_watson/compare_comply_v1.py | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'title') and self.title is not None:
_dict['title'] = self.title
if hasattr(self, 'hash') and self.hash is not None:
_dict['hash'] = self.hash
return _d... | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'title') and self.title is not None:
_dict['title'] = self.title
if hasattr(self, 'hash') and self.hash is not None:
_dict['hash'] = self.hash
return _d... | [
"Return",
"a",
"json",
"dictionary",
"representing",
"this",
"model",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/compare_comply_v1.py#L4404-L4411 | [
"def",
"_to_dict",
"(",
"self",
")",
":",
"_dict",
"=",
"{",
"}",
"if",
"hasattr",
"(",
"self",
",",
"'title'",
")",
"and",
"self",
".",
"title",
"is",
"not",
"None",
":",
"_dict",
"[",
"'title'",
"]",
"=",
"self",
".",
"title",
"if",
"hasattr",
... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | TableHeaders._to_dict | Return a json dictionary representing this model. | ibm_watson/compare_comply_v1.py | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'cell_id') and self.cell_id is not None:
_dict['cell_id'] = self.cell_id
if hasattr(self, 'location') and self.location is not None:
_dict['location'] = self.lo... | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'cell_id') and self.cell_id is not None:
_dict['cell_id'] = self.cell_id
if hasattr(self, 'location') and self.location is not None:
_dict['location'] = self.lo... | [
"Return",
"a",
"json",
"dictionary",
"representing",
"this",
"model",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/compare_comply_v1.py#L4502-L4523 | [
"def",
"_to_dict",
"(",
"self",
")",
":",
"_dict",
"=",
"{",
"}",
"if",
"hasattr",
"(",
"self",
",",
"'cell_id'",
")",
"and",
"self",
".",
"cell_id",
"is",
"not",
"None",
":",
"_dict",
"[",
"'cell_id'",
"]",
"=",
"self",
".",
"cell_id",
"if",
"hasa... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | TableReturn._from_dict | Initialize a TableReturn object from a json dictionary. | ibm_watson/compare_comply_v1.py | def _from_dict(cls, _dict):
"""Initialize a TableReturn object from a json dictionary."""
args = {}
if 'document' in _dict:
args['document'] = DocInfo._from_dict(_dict.get('document'))
if 'model_id' in _dict:
args['model_id'] = _dict.get('model_id')
if 'mo... | def _from_dict(cls, _dict):
"""Initialize a TableReturn object from a json dictionary."""
args = {}
if 'document' in _dict:
args['document'] = DocInfo._from_dict(_dict.get('document'))
if 'model_id' in _dict:
args['model_id'] = _dict.get('model_id')
if 'mo... | [
"Initialize",
"a",
"TableReturn",
"object",
"from",
"a",
"json",
"dictionary",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/compare_comply_v1.py#L4573-L4586 | [
"def",
"_from_dict",
"(",
"cls",
",",
"_dict",
")",
":",
"args",
"=",
"{",
"}",
"if",
"'document'",
"in",
"_dict",
":",
"args",
"[",
"'document'",
"]",
"=",
"DocInfo",
".",
"_from_dict",
"(",
"_dict",
".",
"get",
"(",
"'document'",
")",
")",
"if",
... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | TableReturn._to_dict | Return a json dictionary representing this model. | ibm_watson/compare_comply_v1.py | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'document') and self.document is not None:
_dict['document'] = self.document._to_dict()
if hasattr(self, 'model_id') and self.model_id is not None:
_dict['model... | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'document') and self.document is not None:
_dict['document'] = self.document._to_dict()
if hasattr(self, 'model_id') and self.model_id is not None:
_dict['model... | [
"Return",
"a",
"json",
"dictionary",
"representing",
"this",
"model",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/compare_comply_v1.py#L4588-L4599 | [
"def",
"_to_dict",
"(",
"self",
")",
":",
"_dict",
"=",
"{",
"}",
"if",
"hasattr",
"(",
"self",
",",
"'document'",
")",
"and",
"self",
".",
"document",
"is",
"not",
"None",
":",
"_dict",
"[",
"'document'",
"]",
"=",
"self",
".",
"document",
".",
"_... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | Tables._from_dict | Initialize a Tables object from a json dictionary. | ibm_watson/compare_comply_v1.py | def _from_dict(cls, _dict):
"""Initialize a Tables object from a json dictionary."""
args = {}
if 'location' in _dict:
args['location'] = Location._from_dict(_dict.get('location'))
if 'text' in _dict:
args['text'] = _dict.get('text')
if 'section_title' in ... | def _from_dict(cls, _dict):
"""Initialize a Tables object from a json dictionary."""
args = {}
if 'location' in _dict:
args['location'] = Location._from_dict(_dict.get('location'))
if 'text' in _dict:
args['text'] = _dict.get('text')
if 'section_title' in ... | [
"Initialize",
"a",
"Tables",
"object",
"from",
"a",
"json",
"dictionary",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/compare_comply_v1.py#L4681-L4713 | [
"def",
"_from_dict",
"(",
"cls",
",",
"_dict",
")",
":",
"args",
"=",
"{",
"}",
"if",
"'location'",
"in",
"_dict",
":",
"args",
"[",
"'location'",
"]",
"=",
"Location",
".",
"_from_dict",
"(",
"_dict",
".",
"get",
"(",
"'location'",
")",
")",
"if",
... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | Tables._to_dict | Return a json dictionary representing this model. | ibm_watson/compare_comply_v1.py | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'location') and self.location is not None:
_dict['location'] = self.location._to_dict()
if hasattr(self, 'text') and self.text is not None:
_dict['text'] = self... | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'location') and self.location is not None:
_dict['location'] = self.location._to_dict()
if hasattr(self, 'text') and self.text is not None:
_dict['text'] = self... | [
"Return",
"a",
"json",
"dictionary",
"representing",
"this",
"model",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/compare_comply_v1.py#L4715-L4739 | [
"def",
"_to_dict",
"(",
"self",
")",
":",
"_dict",
"=",
"{",
"}",
"if",
"hasattr",
"(",
"self",
",",
"'location'",
")",
"and",
"self",
".",
"location",
"is",
"not",
"None",
":",
"_dict",
"[",
"'location'",
"]",
"=",
"self",
".",
"location",
".",
"_... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | TypeLabelComparison._to_dict | Return a json dictionary representing this model. | ibm_watson/compare_comply_v1.py | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'label') and self.label is not None:
_dict['label'] = self.label._to_dict()
return _dict | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'label') and self.label is not None:
_dict['label'] = self.label._to_dict()
return _dict | [
"Return",
"a",
"json",
"dictionary",
"representing",
"this",
"model",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/compare_comply_v1.py#L4905-L4910 | [
"def",
"_to_dict",
"(",
"self",
")",
":",
"_dict",
"=",
"{",
"}",
"if",
"hasattr",
"(",
"self",
",",
"'label'",
")",
"and",
"self",
".",
"label",
"is",
"not",
"None",
":",
"_dict",
"[",
"'label'",
"]",
"=",
"self",
".",
"label",
".",
"_to_dict",
... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | UnalignedElement._from_dict | Initialize a UnalignedElement object from a json dictionary. | ibm_watson/compare_comply_v1.py | def _from_dict(cls, _dict):
"""Initialize a UnalignedElement object from a json dictionary."""
args = {}
if 'document_label' in _dict:
args['document_label'] = _dict.get('document_label')
if 'location' in _dict:
args['location'] = Location._from_dict(_dict.get('lo... | def _from_dict(cls, _dict):
"""Initialize a UnalignedElement object from a json dictionary."""
args = {}
if 'document_label' in _dict:
args['document_label'] = _dict.get('document_label')
if 'location' in _dict:
args['location'] = Location._from_dict(_dict.get('lo... | [
"Initialize",
"a",
"UnalignedElement",
"object",
"from",
"a",
"json",
"dictionary",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/compare_comply_v1.py#L4975-L4997 | [
"def",
"_from_dict",
"(",
"cls",
",",
"_dict",
")",
":",
"args",
"=",
"{",
"}",
"if",
"'document_label'",
"in",
"_dict",
":",
"args",
"[",
"'document_label'",
"]",
"=",
"_dict",
".",
"get",
"(",
"'document_label'",
")",
"if",
"'location'",
"in",
"_dict",... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | UnalignedElement._to_dict | Return a json dictionary representing this model. | ibm_watson/compare_comply_v1.py | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'document_label') and self.document_label is not None:
_dict['document_label'] = self.document_label
if hasattr(self, 'location') and self.location is not None:
... | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'document_label') and self.document_label is not None:
_dict['document_label'] = self.document_label
if hasattr(self, 'location') and self.location is not None:
... | [
"Return",
"a",
"json",
"dictionary",
"representing",
"this",
"model",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/compare_comply_v1.py#L4999-L5014 | [
"def",
"_to_dict",
"(",
"self",
")",
":",
"_dict",
"=",
"{",
"}",
"if",
"hasattr",
"(",
"self",
",",
"'document_label'",
")",
"and",
"self",
".",
"document_label",
"is",
"not",
"None",
":",
"_dict",
"[",
"'document_label'",
"]",
"=",
"self",
".",
"docu... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | SpeechToTextV1Adapter.recognize_using_websocket | Sends audio for speech recognition using web sockets.
:param AudioSource audio: The audio to transcribe in the format specified by the
`Content-Type` header.
:param str content_type: The type of the input: audio/basic, audio/flac,
audio/l16, audio/mp3, audio/mpeg, audio/mulaw, audio/ogg... | ibm_watson/speech_to_text_v1_adapter.py | def recognize_using_websocket(self,
audio,
content_type,
recognize_callback,
model=None,
language_customization_id=None,
... | def recognize_using_websocket(self,
audio,
content_type,
recognize_callback,
model=None,
language_customization_id=None,
... | [
"Sends",
"audio",
"for",
"speech",
"recognition",
"using",
"web",
"sockets",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/speech_to_text_v1_adapter.py#L28-L241 | [
"def",
"recognize_using_websocket",
"(",
"self",
",",
"audio",
",",
"content_type",
",",
"recognize_callback",
",",
"model",
"=",
"None",
",",
"language_customization_id",
"=",
"None",
",",
"acoustic_customization_id",
"=",
"None",
",",
"customization_weight",
"=",
... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | SynthesizeListener.send_text | Sends the text message
Note: The service handles one request per connection | ibm_watson/websocket/synthesize_listener.py | def send_text(self):
"""
Sends the text message
Note: The service handles one request per connection
"""
def run(*args):
"""Background process to send the text"""
self.ws_client.send(json.dumps(self.options).encode('utf8'))
time.sleep(TEN_MILL... | def send_text(self):
"""
Sends the text message
Note: The service handles one request per connection
"""
def run(*args):
"""Background process to send the text"""
self.ws_client.send(json.dumps(self.options).encode('utf8'))
time.sleep(TEN_MILL... | [
"Sends",
"the",
"text",
"message",
"Note",
":",
"The",
"service",
"handles",
"one",
"request",
"per",
"connection"
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/websocket/synthesize_listener.py#L61-L72 | [
"def",
"send_text",
"(",
"self",
")",
":",
"def",
"run",
"(",
"*",
"args",
")",
":",
"\"\"\"Background process to send the text\"\"\"",
"self",
".",
"ws_client",
".",
"send",
"(",
"json",
".",
"dumps",
"(",
"self",
".",
"options",
")",
".",
"encode",
"(",
... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | SynthesizeListener.on_data | Callback executed when message is received from the server.
:param ws: Websocket client
:param message: utf-8 string which we get from the server.
:param message_type: Message type which is either ABNF.OPCODE_TEXT or ABNF.OPCODE_BINARY
:param fin: continue flag. If 0, the data continues... | ibm_watson/websocket/synthesize_listener.py | def on_data(self, ws, message, message_type, fin):
"""
Callback executed when message is received from the server.
:param ws: Websocket client
:param message: utf-8 string which we get from the server.
:param message_type: Message type which is either ABNF.OPCODE_TEXT or ABNF.OP... | def on_data(self, ws, message, message_type, fin):
"""
Callback executed when message is received from the server.
:param ws: Websocket client
:param message: utf-8 string which we get from the server.
:param message_type: Message type which is either ABNF.OPCODE_TEXT or ABNF.OP... | [
"Callback",
"executed",
"when",
"message",
"is",
"received",
"from",
"the",
"server",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/websocket/synthesize_listener.py#L84-L109 | [
"def",
"on_data",
"(",
"self",
",",
"ws",
",",
"message",
",",
"message_type",
",",
"fin",
")",
":",
"try",
":",
"if",
"message_type",
"==",
"websocket",
".",
"ABNF",
".",
"OPCODE_TEXT",
":",
"json_object",
"=",
"json",
".",
"loads",
"(",
"message",
")... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | RecognizeListener.send | Send message to server.
data: message to send. If you set opcode to OPCODE_TEXT,
data must be utf-8 string or unicode.
opcode: operation code of data. default is OPCODE_TEXT. | ibm_watson/websocket/recognize_listener.py | def send(self, data, opcode=websocket.ABNF.OPCODE_TEXT):
"""
Send message to server.
data: message to send. If you set opcode to OPCODE_TEXT,
data must be utf-8 string or unicode.
opcode: operation code of data. default is OPCODE_TEXT.
"""
self.ws_client.se... | def send(self, data, opcode=websocket.ABNF.OPCODE_TEXT):
"""
Send message to server.
data: message to send. If you set opcode to OPCODE_TEXT,
data must be utf-8 string or unicode.
opcode: operation code of data. default is OPCODE_TEXT.
"""
self.ws_client.se... | [
"Send",
"message",
"to",
"server",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/websocket/recognize_listener.py#L89-L97 | [
"def",
"send",
"(",
"self",
",",
"data",
",",
"opcode",
"=",
"websocket",
".",
"ABNF",
".",
"OPCODE_TEXT",
")",
":",
"self",
".",
"ws_client",
".",
"send",
"(",
"data",
",",
"opcode",
")"
] | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | RecognizeListener.send_audio | Stream audio to server
:param ws: Websocket client | ibm_watson/websocket/recognize_listener.py | def send_audio(self, ws):
"""
Stream audio to server
:param ws: Websocket client
"""
def run(*args):
"""Background process to stream the data"""
if not self.audio_source.is_buffer:
while True:
chunk = self.audio_source.... | def send_audio(self, ws):
"""
Stream audio to server
:param ws: Websocket client
"""
def run(*args):
"""Background process to stream the data"""
if not self.audio_source.is_buffer:
while True:
chunk = self.audio_source.... | [
"Stream",
"audio",
"to",
"server"
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/websocket/recognize_listener.py#L99-L137 | [
"def",
"send_audio",
"(",
"self",
",",
"ws",
")",
":",
"def",
"run",
"(",
"*",
"args",
")",
":",
"\"\"\"Background process to stream the data\"\"\"",
"if",
"not",
"self",
".",
"audio_source",
".",
"is_buffer",
":",
"while",
"True",
":",
"chunk",
"=",
"self",... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | RecognizeListener.on_open | Callback executed when a connection is opened to the server.
Handles streaming of audio to the server.
:param ws: Websocket client | ibm_watson/websocket/recognize_listener.py | def on_open(self, ws):
"""
Callback executed when a connection is opened to the server.
Handles streaming of audio to the server.
:param ws: Websocket client
"""
self.callback.on_connected()
# Send initialization message
init_data = self.build_start_mess... | def on_open(self, ws):
"""
Callback executed when a connection is opened to the server.
Handles streaming of audio to the server.
:param ws: Websocket client
"""
self.callback.on_connected()
# Send initialization message
init_data = self.build_start_mess... | [
"Callback",
"executed",
"when",
"a",
"connection",
"is",
"opened",
"to",
"the",
"server",
".",
"Handles",
"streaming",
"of",
"audio",
"to",
"the",
"server",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/websocket/recognize_listener.py#L139-L150 | [
"def",
"on_open",
"(",
"self",
",",
"ws",
")",
":",
"self",
".",
"callback",
".",
"on_connected",
"(",
")",
"# Send initialization message",
"init_data",
"=",
"self",
".",
"build_start_message",
"(",
"self",
".",
"options",
")",
"self",
".",
"ws_client",
"."... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | RecognizeListener.on_data | Callback executed when message is received from the server.
:param ws: Websocket client
:param message: utf-8 string which we get from the server.
:param message_type: Message type which is either ABNF.OPCODE_TEXT or ABNF.OPCODE_BINARY
:param fin: continue flag. If 0, the data continues... | ibm_watson/websocket/recognize_listener.py | def on_data(self, ws, message, message_type, fin):
"""
Callback executed when message is received from the server.
:param ws: Websocket client
:param message: utf-8 string which we get from the server.
:param message_type: Message type which is either ABNF.OPCODE_TEXT or ABNF.OP... | def on_data(self, ws, message, message_type, fin):
"""
Callback executed when message is received from the server.
:param ws: Websocket client
:param message: utf-8 string which we get from the server.
:param message_type: Message type which is either ABNF.OPCODE_TEXT or ABNF.OP... | [
"Callback",
"executed",
"when",
"message",
"is",
"received",
"from",
"the",
"server",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/websocket/recognize_listener.py#L152-L202 | [
"def",
"on_data",
"(",
"self",
",",
"ws",
",",
"message",
",",
"message_type",
",",
"fin",
")",
":",
"try",
":",
"json_object",
"=",
"json",
".",
"loads",
"(",
"message",
")",
"except",
"Exception",
":",
"self",
".",
"on_error",
"(",
"ws",
",",
"'Una... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | PersonalityInsightsV3.profile | Get profile.
Generates a personality profile for the author of the input text. The service
accepts a maximum of 20 MB of input content, but it requires much less text to
produce an accurate profile. The service can analyze text in Arabic, English,
Japanese, Korean, or Spanish. It can re... | ibm_watson/personality_insights_v3.py | def profile(self,
content,
accept,
content_language=None,
accept_language=None,
raw_scores=None,
csv_headers=None,
consumption_preferences=None,
content_type=None,
**kwargs):
... | def profile(self,
content,
accept,
content_language=None,
accept_language=None,
raw_scores=None,
csv_headers=None,
consumption_preferences=None,
content_type=None,
**kwargs):
... | [
"Get",
"profile",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/personality_insights_v3.py#L122-L243 | [
"def",
"profile",
"(",
"self",
",",
"content",
",",
"accept",
",",
"content_language",
"=",
"None",
",",
"accept_language",
"=",
"None",
",",
"raw_scores",
"=",
"None",
",",
"csv_headers",
"=",
"None",
",",
"consumption_preferences",
"=",
"None",
",",
"conte... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | Behavior._to_dict | Return a json dictionary representing this model. | ibm_watson/personality_insights_v3.py | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'trait_id') and self.trait_id is not None:
_dict['trait_id'] = self.trait_id
if hasattr(self, 'name') and self.name is not None:
_dict['name'] = self.name
... | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'trait_id') and self.trait_id is not None:
_dict['trait_id'] = self.trait_id
if hasattr(self, 'name') and self.name is not None:
_dict['name'] = self.name
... | [
"Return",
"a",
"json",
"dictionary",
"representing",
"this",
"model",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/personality_insights_v3.py#L308-L319 | [
"def",
"_to_dict",
"(",
"self",
")",
":",
"_dict",
"=",
"{",
"}",
"if",
"hasattr",
"(",
"self",
",",
"'trait_id'",
")",
"and",
"self",
".",
"trait_id",
"is",
"not",
"None",
":",
"_dict",
"[",
"'trait_id'",
"]",
"=",
"self",
".",
"trait_id",
"if",
"... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | ConsumptionPreferences._to_dict | Return a json dictionary representing this model. | ibm_watson/personality_insights_v3.py | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'consumption_preference_id'
) and self.consumption_preference_id is not None:
_dict['consumption_preference_id'] = self.consumption_preference_id
if hasat... | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'consumption_preference_id'
) and self.consumption_preference_id is not None:
_dict['consumption_preference_id'] = self.consumption_preference_id
if hasat... | [
"Return",
"a",
"json",
"dictionary",
"representing",
"this",
"model",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/personality_insights_v3.py#L398-L408 | [
"def",
"_to_dict",
"(",
"self",
")",
":",
"_dict",
"=",
"{",
"}",
"if",
"hasattr",
"(",
"self",
",",
"'consumption_preference_id'",
")",
"and",
"self",
".",
"consumption_preference_id",
"is",
"not",
"None",
":",
"_dict",
"[",
"'consumption_preference_id'",
"]"... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | ConsumptionPreferencesCategory._from_dict | Initialize a ConsumptionPreferencesCategory object from a json dictionary. | ibm_watson/personality_insights_v3.py | def _from_dict(cls, _dict):
"""Initialize a ConsumptionPreferencesCategory object from a json dictionary."""
args = {}
if 'consumption_preference_category_id' in _dict:
args['consumption_preference_category_id'] = _dict.get(
'consumption_preference_category_id')
... | def _from_dict(cls, _dict):
"""Initialize a ConsumptionPreferencesCategory object from a json dictionary."""
args = {}
if 'consumption_preference_category_id' in _dict:
args['consumption_preference_category_id'] = _dict.get(
'consumption_preference_category_id')
... | [
"Initialize",
"a",
"ConsumptionPreferencesCategory",
"object",
"from",
"a",
"json",
"dictionary",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/personality_insights_v3.py#L454-L479 | [
"def",
"_from_dict",
"(",
"cls",
",",
"_dict",
")",
":",
"args",
"=",
"{",
"}",
"if",
"'consumption_preference_category_id'",
"in",
"_dict",
":",
"args",
"[",
"'consumption_preference_category_id'",
"]",
"=",
"_dict",
".",
"get",
"(",
"'consumption_preference_cate... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | ConsumptionPreferencesCategory._to_dict | Return a json dictionary representing this model. | ibm_watson/personality_insights_v3.py | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'consumption_preference_category_id'
) and self.consumption_preference_category_id is not None:
_dict[
'consumption_preference_category_id'] = sel... | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'consumption_preference_category_id'
) and self.consumption_preference_category_id is not None:
_dict[
'consumption_preference_category_id'] = sel... | [
"Return",
"a",
"json",
"dictionary",
"representing",
"this",
"model",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/personality_insights_v3.py#L481-L495 | [
"def",
"_to_dict",
"(",
"self",
")",
":",
"_dict",
"=",
"{",
"}",
"if",
"hasattr",
"(",
"self",
",",
"'consumption_preference_category_id'",
")",
"and",
"self",
".",
"consumption_preference_category_id",
"is",
"not",
"None",
":",
"_dict",
"[",
"'consumption_pref... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | Content._from_dict | Initialize a Content object from a json dictionary. | ibm_watson/personality_insights_v3.py | def _from_dict(cls, _dict):
"""Initialize a Content object from a json dictionary."""
args = {}
if 'contentItems' in _dict:
args['content_items'] = [
ContentItem._from_dict(x) for x in (_dict.get('contentItems'))
]
else:
raise ValueErro... | def _from_dict(cls, _dict):
"""Initialize a Content object from a json dictionary."""
args = {}
if 'contentItems' in _dict:
args['content_items'] = [
ContentItem._from_dict(x) for x in (_dict.get('contentItems'))
]
else:
raise ValueErro... | [
"Initialize",
"a",
"Content",
"object",
"from",
"a",
"json",
"dictionary",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/personality_insights_v3.py#L530-L541 | [
"def",
"_from_dict",
"(",
"cls",
",",
"_dict",
")",
":",
"args",
"=",
"{",
"}",
"if",
"'contentItems'",
"in",
"_dict",
":",
"args",
"[",
"'content_items'",
"]",
"=",
"[",
"ContentItem",
".",
"_from_dict",
"(",
"x",
")",
"for",
"x",
"in",
"(",
"_dict"... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | Content._to_dict | Return a json dictionary representing this model. | ibm_watson/personality_insights_v3.py | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'content_items') and self.content_items is not None:
_dict['contentItems'] = [x._to_dict() for x in self.content_items]
return _dict | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'content_items') and self.content_items is not None:
_dict['contentItems'] = [x._to_dict() for x in self.content_items]
return _dict | [
"Return",
"a",
"json",
"dictionary",
"representing",
"this",
"model",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/personality_insights_v3.py#L543-L548 | [
"def",
"_to_dict",
"(",
"self",
")",
":",
"_dict",
"=",
"{",
"}",
"if",
"hasattr",
"(",
"self",
",",
"'content_items'",
")",
"and",
"self",
".",
"content_items",
"is",
"not",
"None",
":",
"_dict",
"[",
"'contentItems'",
"]",
"=",
"[",
"x",
".",
"_to_... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | ContentItem._to_dict | Return a json dictionary representing this model. | ibm_watson/personality_insights_v3.py | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'content') and self.content is not None:
_dict['content'] = self.content
if hasattr(self, 'id') and self.id is not None:
_dict['id'] = self.id
if hasatt... | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'content') and self.content is not None:
_dict['content'] = self.content
if hasattr(self, 'id') and self.id is not None:
_dict['id'] = self.id
if hasatt... | [
"Return",
"a",
"json",
"dictionary",
"representing",
"this",
"model",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/personality_insights_v3.py#L678-L699 | [
"def",
"_to_dict",
"(",
"self",
")",
":",
"_dict",
"=",
"{",
"}",
"if",
"hasattr",
"(",
"self",
",",
"'content'",
")",
"and",
"self",
".",
"content",
"is",
"not",
"None",
":",
"_dict",
"[",
"'content'",
"]",
"=",
"self",
".",
"content",
"if",
"hasa... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | Profile._from_dict | Initialize a Profile object from a json dictionary. | ibm_watson/personality_insights_v3.py | def _from_dict(cls, _dict):
"""Initialize a Profile object from a json dictionary."""
args = {}
if 'processed_language' in _dict:
args['processed_language'] = _dict.get('processed_language')
else:
raise ValueError(
'Required property \'processed_la... | def _from_dict(cls, _dict):
"""Initialize a Profile object from a json dictionary."""
args = {}
if 'processed_language' in _dict:
args['processed_language'] = _dict.get('processed_language')
else:
raise ValueError(
'Required property \'processed_la... | [
"Initialize",
"a",
"Profile",
"object",
"from",
"a",
"json",
"dictionary",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/personality_insights_v3.py#L795-L846 | [
"def",
"_from_dict",
"(",
"cls",
",",
"_dict",
")",
":",
"args",
"=",
"{",
"}",
"if",
"'processed_language'",
"in",
"_dict",
":",
"args",
"[",
"'processed_language'",
"]",
"=",
"_dict",
".",
"get",
"(",
"'processed_language'",
")",
"else",
":",
"raise",
... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | Profile._to_dict | Return a json dictionary representing this model. | ibm_watson/personality_insights_v3.py | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(
self,
'processed_language') and self.processed_language is not None:
_dict['processed_language'] = self.processed_language
if hasattr(self, 'word... | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(
self,
'processed_language') and self.processed_language is not None:
_dict['processed_language'] = self.processed_language
if hasattr(self, 'word... | [
"Return",
"a",
"json",
"dictionary",
"representing",
"this",
"model",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/personality_insights_v3.py#L848-L876 | [
"def",
"_to_dict",
"(",
"self",
")",
":",
"_dict",
"=",
"{",
"}",
"if",
"hasattr",
"(",
"self",
",",
"'processed_language'",
")",
"and",
"self",
".",
"processed_language",
"is",
"not",
"None",
":",
"_dict",
"[",
"'processed_language'",
"]",
"=",
"self",
... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | Trait._from_dict | Initialize a Trait object from a json dictionary. | ibm_watson/personality_insights_v3.py | def _from_dict(cls, _dict):
"""Initialize a Trait object from a json dictionary."""
args = {}
if 'trait_id' in _dict:
args['trait_id'] = _dict.get('trait_id')
else:
raise ValueError(
'Required property \'trait_id\' not present in Trait JSON')
... | def _from_dict(cls, _dict):
"""Initialize a Trait object from a json dictionary."""
args = {}
if 'trait_id' in _dict:
args['trait_id'] = _dict.get('trait_id')
else:
raise ValueError(
'Required property \'trait_id\' not present in Trait JSON')
... | [
"Initialize",
"a",
"Trait",
"object",
"from",
"a",
"json",
"dictionary",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/personality_insights_v3.py#L980-L1011 | [
"def",
"_from_dict",
"(",
"cls",
",",
"_dict",
")",
":",
"args",
"=",
"{",
"}",
"if",
"'trait_id'",
"in",
"_dict",
":",
"args",
"[",
"'trait_id'",
"]",
"=",
"_dict",
".",
"get",
"(",
"'trait_id'",
")",
"else",
":",
"raise",
"ValueError",
"(",
"'Requi... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | Trait._to_dict | Return a json dictionary representing this model. | ibm_watson/personality_insights_v3.py | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'trait_id') and self.trait_id is not None:
_dict['trait_id'] = self.trait_id
if hasattr(self, 'name') and self.name is not None:
_dict['name'] = self.name
... | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'trait_id') and self.trait_id is not None:
_dict['trait_id'] = self.trait_id
if hasattr(self, 'name') and self.name is not None:
_dict['name'] = self.name
... | [
"Return",
"a",
"json",
"dictionary",
"representing",
"this",
"model",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/personality_insights_v3.py#L1013-L1030 | [
"def",
"_to_dict",
"(",
"self",
")",
":",
"_dict",
"=",
"{",
"}",
"if",
"hasattr",
"(",
"self",
",",
"'trait_id'",
")",
"and",
"self",
".",
"trait_id",
"is",
"not",
"None",
":",
"_dict",
"[",
"'trait_id'",
"]",
"=",
"self",
".",
"trait_id",
"if",
"... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | Warning._to_dict | Return a json dictionary representing this model. | ibm_watson/personality_insights_v3.py | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'warning_id') and self.warning_id is not None:
_dict['warning_id'] = self.warning_id
if hasattr(self, 'message') and self.message is not None:
_dict['message'] ... | def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'warning_id') and self.warning_id is not None:
_dict['warning_id'] = self.warning_id
if hasattr(self, 'message') and self.message is not None:
_dict['message'] ... | [
"Return",
"a",
"json",
"dictionary",
"representing",
"this",
"model",
"."
] | watson-developer-cloud/python-sdk | python | https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/personality_insights_v3.py#L1105-L1112 | [
"def",
"_to_dict",
"(",
"self",
")",
":",
"_dict",
"=",
"{",
"}",
"if",
"hasattr",
"(",
"self",
",",
"'warning_id'",
")",
"and",
"self",
".",
"warning_id",
"is",
"not",
"None",
":",
"_dict",
"[",
"'warning_id'",
"]",
"=",
"self",
".",
"warning_id",
"... | 4c2c9df4466fcde88975da9ecd834e6ba95eb353 |
train | TickStore.delete | Delete all chunks for a symbol.
Which are, for the moment, fully contained in the passed in
date_range.
Parameters
----------
symbol : `str`
symbol name for the item
date_range : `date.DateRange`
DateRange to delete ticks in | arctic/tickstore/tickstore.py | def delete(self, symbol, date_range=None):
"""
Delete all chunks for a symbol.
Which are, for the moment, fully contained in the passed in
date_range.
Parameters
----------
symbol : `str`
symbol name for the item
date_range : `date.DateRange`... | def delete(self, symbol, date_range=None):
"""
Delete all chunks for a symbol.
Which are, for the moment, fully contained in the passed in
date_range.
Parameters
----------
symbol : `str`
symbol name for the item
date_range : `date.DateRange`... | [
"Delete",
"all",
"chunks",
"for",
"a",
"symbol",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/tickstore/tickstore.py#L149-L172 | [
"def",
"delete",
"(",
"self",
",",
"symbol",
",",
"date_range",
"=",
"None",
")",
":",
"query",
"=",
"{",
"SYMBOL",
":",
"symbol",
"}",
"date_range",
"=",
"to_pandas_closed_closed",
"(",
"date_range",
")",
"if",
"date_range",
"is",
"not",
"None",
":",
"a... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | TickStore._read_preference | Return the mongo read preference given an 'allow_secondary' argument | arctic/tickstore/tickstore.py | def _read_preference(self, allow_secondary):
""" Return the mongo read preference given an 'allow_secondary' argument
"""
allow_secondary = self._allow_secondary if allow_secondary is None else allow_secondary
return ReadPreference.NEAREST if allow_secondary else ReadPreference.PRIMARY | def _read_preference(self, allow_secondary):
""" Return the mongo read preference given an 'allow_secondary' argument
"""
allow_secondary = self._allow_secondary if allow_secondary is None else allow_secondary
return ReadPreference.NEAREST if allow_secondary else ReadPreference.PRIMARY | [
"Return",
"the",
"mongo",
"read",
"preference",
"given",
"an",
"allow_secondary",
"argument"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/tickstore/tickstore.py#L258-L262 | [
"def",
"_read_preference",
"(",
"self",
",",
"allow_secondary",
")",
":",
"allow_secondary",
"=",
"self",
".",
"_allow_secondary",
"if",
"allow_secondary",
"is",
"None",
"else",
"allow_secondary",
"return",
"ReadPreference",
".",
"NEAREST",
"if",
"allow_secondary",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | TickStore.read | Read data for the named symbol. Returns a VersionedItem object with
a data and metdata element (as passed into write).
Parameters
----------
symbol : `str`
symbol name for the item
date_range : `date.DateRange`
Returns ticks in the specified DateRange
... | arctic/tickstore/tickstore.py | def read(self, symbol, date_range=None, columns=None, include_images=False, allow_secondary=None,
_target_tick_count=0):
"""
Read data for the named symbol. Returns a VersionedItem object with
a data and metdata element (as passed into write).
Parameters
----------... | def read(self, symbol, date_range=None, columns=None, include_images=False, allow_secondary=None,
_target_tick_count=0):
"""
Read data for the named symbol. Returns a VersionedItem object with
a data and metdata element (as passed into write).
Parameters
----------... | [
"Read",
"data",
"for",
"the",
"named",
"symbol",
".",
"Returns",
"a",
"VersionedItem",
"object",
"with",
"a",
"data",
"and",
"metdata",
"element",
"(",
"as",
"passed",
"into",
"write",
")",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/tickstore/tickstore.py#L264-L370 | [
"def",
"read",
"(",
"self",
",",
"symbol",
",",
"date_range",
"=",
"None",
",",
"columns",
"=",
"None",
",",
"include_images",
"=",
"False",
",",
"allow_secondary",
"=",
"None",
",",
"_target_tick_count",
"=",
"0",
")",
":",
"perf_start",
"=",
"dt",
".",... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | TickStore.write | Writes a list of market data events.
Parameters
----------
symbol : `str`
symbol name for the item
data : list of dicts or a pandas.DataFrame
List of ticks to store to the tick-store.
if a list of dicts, each dict must contain a 'index' datetime
... | arctic/tickstore/tickstore.py | def write(self, symbol, data, initial_image=None, metadata=None):
"""
Writes a list of market data events.
Parameters
----------
symbol : `str`
symbol name for the item
data : list of dicts or a pandas.DataFrame
List of ticks to store to the tick-... | def write(self, symbol, data, initial_image=None, metadata=None):
"""
Writes a list of market data events.
Parameters
----------
symbol : `str`
symbol name for the item
data : list of dicts or a pandas.DataFrame
List of ticks to store to the tick-... | [
"Writes",
"a",
"list",
"of",
"market",
"data",
"events",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/tickstore/tickstore.py#L562-L603 | [
"def",
"write",
"(",
"self",
",",
"symbol",
",",
"data",
",",
"initial_image",
"=",
"None",
",",
"metadata",
"=",
"None",
")",
":",
"pandas",
"=",
"False",
"# Check for overlapping data",
"if",
"isinstance",
"(",
"data",
",",
"list",
")",
":",
"start",
"... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | TickStore._str_dtype | Represent dtypes without byte order, as earlier Java tickstore code doesn't support explicit byte order. | arctic/tickstore/tickstore.py | def _str_dtype(dtype):
"""
Represent dtypes without byte order, as earlier Java tickstore code doesn't support explicit byte order.
"""
assert dtype.byteorder != '>'
if dtype.kind == 'i':
assert dtype.itemsize == 8
return 'int64'
elif dtype.kind ==... | def _str_dtype(dtype):
"""
Represent dtypes without byte order, as earlier Java tickstore code doesn't support explicit byte order.
"""
assert dtype.byteorder != '>'
if dtype.kind == 'i':
assert dtype.itemsize == 8
return 'int64'
elif dtype.kind ==... | [
"Represent",
"dtypes",
"without",
"byte",
"order",
"as",
"earlier",
"Java",
"tickstore",
"code",
"doesn",
"t",
"support",
"explicit",
"byte",
"order",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/tickstore/tickstore.py#L636-L650 | [
"def",
"_str_dtype",
"(",
"dtype",
")",
":",
"assert",
"dtype",
".",
"byteorder",
"!=",
"'>'",
"if",
"dtype",
".",
"kind",
"==",
"'i'",
":",
"assert",
"dtype",
".",
"itemsize",
"==",
"8",
"return",
"'int64'",
"elif",
"dtype",
".",
"kind",
"==",
"'f'",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | TickStore.max_date | Return the maximum datetime stored for a particular symbol
Parameters
----------
symbol : `str`
symbol name for the item | arctic/tickstore/tickstore.py | def max_date(self, symbol):
"""
Return the maximum datetime stored for a particular symbol
Parameters
----------
symbol : `str`
symbol name for the item
"""
res = self._collection.find_one({SYMBOL: symbol}, projection={ID: 0, END: 1},
... | def max_date(self, symbol):
"""
Return the maximum datetime stored for a particular symbol
Parameters
----------
symbol : `str`
symbol name for the item
"""
res = self._collection.find_one({SYMBOL: symbol}, projection={ID: 0, END: 1},
... | [
"Return",
"the",
"maximum",
"datetime",
"stored",
"for",
"a",
"particular",
"symbol"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/tickstore/tickstore.py#L774-L787 | [
"def",
"max_date",
"(",
"self",
",",
"symbol",
")",
":",
"res",
"=",
"self",
".",
"_collection",
".",
"find_one",
"(",
"{",
"SYMBOL",
":",
"symbol",
"}",
",",
"projection",
"=",
"{",
"ID",
":",
"0",
",",
"END",
":",
"1",
"}",
",",
"sort",
"=",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | TickStore.min_date | Return the minimum datetime stored for a particular symbol
Parameters
----------
symbol : `str`
symbol name for the item | arctic/tickstore/tickstore.py | def min_date(self, symbol):
"""
Return the minimum datetime stored for a particular symbol
Parameters
----------
symbol : `str`
symbol name for the item
"""
res = self._collection.find_one({SYMBOL: symbol}, projection={ID: 0, START: 1},
... | def min_date(self, symbol):
"""
Return the minimum datetime stored for a particular symbol
Parameters
----------
symbol : `str`
symbol name for the item
"""
res = self._collection.find_one({SYMBOL: symbol}, projection={ID: 0, START: 1},
... | [
"Return",
"the",
"minimum",
"datetime",
"stored",
"for",
"a",
"particular",
"symbol"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/tickstore/tickstore.py#L789-L802 | [
"def",
"min_date",
"(",
"self",
",",
"symbol",
")",
":",
"res",
"=",
"self",
".",
"_collection",
".",
"find_one",
"(",
"{",
"SYMBOL",
":",
"symbol",
"}",
",",
"projection",
"=",
"{",
"ID",
":",
"0",
",",
"START",
":",
"1",
"}",
",",
"sort",
"=",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | PassthroughChunker.to_chunks | pass thru chunker of the dataframe/series
returns
-------
('NA', 'NA', 'NA', dataframe/series) | arctic/chunkstore/passthrough_chunker.py | def to_chunks(self, df, **kwargs):
"""
pass thru chunker of the dataframe/series
returns
-------
('NA', 'NA', 'NA', dataframe/series)
"""
if len(df) > 0:
yield b'NA', b'NA', b'NA', df | def to_chunks(self, df, **kwargs):
"""
pass thru chunker of the dataframe/series
returns
-------
('NA', 'NA', 'NA', dataframe/series)
"""
if len(df) > 0:
yield b'NA', b'NA', b'NA', df | [
"pass",
"thru",
"chunker",
"of",
"the",
"dataframe",
"/",
"series"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/chunkstore/passthrough_chunker.py#L9-L18 | [
"def",
"to_chunks",
"(",
"self",
",",
"df",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"len",
"(",
"df",
")",
">",
"0",
":",
"yield",
"b'NA'",
",",
"b'NA'",
",",
"b'NA'",
",",
"df"
] | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | authenticate | Return True / False on authentication success.
PyMongo 2.6 changed the auth API to raise on Auth failure. | arctic/auth.py | def authenticate(db, user, password):
"""
Return True / False on authentication success.
PyMongo 2.6 changed the auth API to raise on Auth failure.
"""
try:
logger.debug("Authenticating {} with {}".format(db, user))
return db.authenticate(user, password)
except OperationFailure ... | def authenticate(db, user, password):
"""
Return True / False on authentication success.
PyMongo 2.6 changed the auth API to raise on Auth failure.
"""
try:
logger.debug("Authenticating {} with {}".format(db, user))
return db.authenticate(user, password)
except OperationFailure ... | [
"Return",
"True",
"/",
"False",
"on",
"authentication",
"success",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/auth.py#L9-L20 | [
"def",
"authenticate",
"(",
"db",
",",
"user",
",",
"password",
")",
":",
"try",
":",
"logger",
".",
"debug",
"(",
"\"Authenticating {} with {}\"",
".",
"format",
"(",
"db",
",",
"user",
")",
")",
"return",
"db",
".",
"authenticate",
"(",
"user",
",",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | get_auth | Authentication hook to allow plugging in custom authentication credential providers | arctic/auth.py | def get_auth(host, app_name, database_name):
"""
Authentication hook to allow plugging in custom authentication credential providers
"""
from .hooks import _get_auth_hook
return _get_auth_hook(host, app_name, database_name) | def get_auth(host, app_name, database_name):
"""
Authentication hook to allow plugging in custom authentication credential providers
"""
from .hooks import _get_auth_hook
return _get_auth_hook(host, app_name, database_name) | [
"Authentication",
"hook",
"to",
"allow",
"plugging",
"in",
"custom",
"authentication",
"credential",
"providers"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/auth.py#L26-L31 | [
"def",
"get_auth",
"(",
"host",
",",
"app_name",
",",
"database_name",
")",
":",
"from",
".",
"hooks",
"import",
"_get_auth_hook",
"return",
"_get_auth_hook",
"(",
"host",
",",
"app_name",
",",
"database_name",
")"
] | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | get_arctic_lib | Returns a mongo library for the given connection string
Parameters
---------
connection_string: `str`
Format must be one of the following:
library@trading for known mongo servers
library@hostname:port
Returns:
--------
Arctic library | arctic/hosts.py | def get_arctic_lib(connection_string, **kwargs):
"""
Returns a mongo library for the given connection string
Parameters
---------
connection_string: `str`
Format must be one of the following:
library@trading for known mongo servers
library@hostname:port
Returns:... | def get_arctic_lib(connection_string, **kwargs):
"""
Returns a mongo library for the given connection string
Parameters
---------
connection_string: `str`
Format must be one of the following:
library@trading for known mongo servers
library@hostname:port
Returns:... | [
"Returns",
"a",
"mongo",
"library",
"for",
"the",
"given",
"connection",
"string"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/hosts.py#L21-L40 | [
"def",
"get_arctic_lib",
"(",
"connection_string",
",",
"*",
"*",
"kwargs",
")",
":",
"m",
"=",
"CONNECTION_STR",
".",
"match",
"(",
"connection_string",
")",
"if",
"not",
"m",
":",
"raise",
"ValueError",
"(",
"\"connection string incorrectly formed: %s\"",
"%",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | do_db_auth | Attempts to authenticate against the mongo instance.
Tries:
- Auth'ing against admin as 'admin' ; credentials: <host>/arctic/admin/admin
- Auth'ing against db_name (which may be None if auth'ing against admin above)
returns True if authentication succeeded. | arctic/scripts/utils.py | def do_db_auth(host, connection, db_name):
"""
Attempts to authenticate against the mongo instance.
Tries:
- Auth'ing against admin as 'admin' ; credentials: <host>/arctic/admin/admin
- Auth'ing against db_name (which may be None if auth'ing against admin above)
returns True if authenticat... | def do_db_auth(host, connection, db_name):
"""
Attempts to authenticate against the mongo instance.
Tries:
- Auth'ing against admin as 'admin' ; credentials: <host>/arctic/admin/admin
- Auth'ing against db_name (which may be None if auth'ing against admin above)
returns True if authenticat... | [
"Attempts",
"to",
"authenticate",
"against",
"the",
"mongo",
"instance",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/scripts/utils.py#L10-L39 | [
"def",
"do_db_auth",
"(",
"host",
",",
"connection",
",",
"db_name",
")",
":",
"admin_creds",
"=",
"get_auth",
"(",
"host",
",",
"'admin'",
",",
"'admin'",
")",
"user_creds",
"=",
"get_auth",
"(",
"host",
",",
"'arctic'",
",",
"db_name",
")",
"# Attempt to... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | log_exception | External exception logging hook. | arctic/hooks.py | def log_exception(fn_name, exception, retry_count, **kwargs):
"""
External exception logging hook.
"""
_log_exception_hook(fn_name, exception, retry_count, **kwargs) | def log_exception(fn_name, exception, retry_count, **kwargs):
"""
External exception logging hook.
"""
_log_exception_hook(fn_name, exception, retry_count, **kwargs) | [
"External",
"exception",
"logging",
"hook",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/hooks.py#L23-L27 | [
"def",
"log_exception",
"(",
"fn_name",
",",
"exception",
",",
"retry_count",
",",
"*",
"*",
"kwargs",
")",
":",
"_log_exception_hook",
"(",
"fn_name",
",",
"exception",
",",
"retry_count",
",",
"*",
"*",
"kwargs",
")"
] | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | fancy_group_by | Dataframe group-by operation that supports aggregating by different methods on the index.
Parameters
----------
df: ``DataFrame``
Pandas dataframe with a MultiIndex
grouping_level: ``int`` or ``str`` or ``list`` of ``str``
Index level to group by. Defaults to 0.
aggregate_level: ``i... | arctic/multi_index.py | def fancy_group_by(df, grouping_level=0, aggregate_level=1, method='last', max_=None, min_=None, within=None):
""" Dataframe group-by operation that supports aggregating by different methods on the index.
Parameters
----------
df: ``DataFrame``
Pandas dataframe with a MultiIndex
grouping_le... | def fancy_group_by(df, grouping_level=0, aggregate_level=1, method='last', max_=None, min_=None, within=None):
""" Dataframe group-by operation that supports aggregating by different methods on the index.
Parameters
----------
df: ``DataFrame``
Pandas dataframe with a MultiIndex
grouping_le... | [
"Dataframe",
"group",
"-",
"by",
"operation",
"that",
"supports",
"aggregating",
"by",
"different",
"methods",
"on",
"the",
"index",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/multi_index.py#L19-L73 | [
"def",
"fancy_group_by",
"(",
"df",
",",
"grouping_level",
"=",
"0",
",",
"aggregate_level",
"=",
"1",
",",
"method",
"=",
"'last'",
",",
"max_",
"=",
"None",
",",
"min_",
"=",
"None",
",",
"within",
"=",
"None",
")",
":",
"if",
"method",
"not",
"in"... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | groupby_asof | Common use case for selecting the latest rows from a bitemporal dataframe as-of a certain date.
Parameters
----------
df: ``pd.DataFrame``
Dataframe with a MultiIndex index
as_of: ``datetime``
Return a timeseries with values observed <= this as-of date. By default, the latest observed
... | arctic/multi_index.py | def groupby_asof(df, as_of=None, dt_col='sample_dt', asof_col='observed_dt'):
''' Common use case for selecting the latest rows from a bitemporal dataframe as-of a certain date.
Parameters
----------
df: ``pd.DataFrame``
Dataframe with a MultiIndex index
as_of: ``datetime``
Return a... | def groupby_asof(df, as_of=None, dt_col='sample_dt', asof_col='observed_dt'):
''' Common use case for selecting the latest rows from a bitemporal dataframe as-of a certain date.
Parameters
----------
df: ``pd.DataFrame``
Dataframe with a MultiIndex index
as_of: ``datetime``
Return a... | [
"Common",
"use",
"case",
"for",
"selecting",
"the",
"latest",
"rows",
"from",
"a",
"bitemporal",
"dataframe",
"as",
"-",
"of",
"a",
"certain",
"date",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/multi_index.py#L78-L100 | [
"def",
"groupby_asof",
"(",
"df",
",",
"as_of",
"=",
"None",
",",
"dt_col",
"=",
"'sample_dt'",
",",
"asof_col",
"=",
"'observed_dt'",
")",
":",
"if",
"as_of",
":",
"if",
"as_of",
".",
"tzinfo",
"is",
"None",
"and",
"df",
".",
"index",
".",
"get_level_... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | multi_index_insert_row | Return a new dataframe with a row inserted for a multi-index dataframe.
This will sort the rows according to the ordered multi-index levels. | arctic/multi_index.py | def multi_index_insert_row(df, index_row, values_row):
""" Return a new dataframe with a row inserted for a multi-index dataframe.
This will sort the rows according to the ordered multi-index levels.
"""
row_index = pd.MultiIndex(levels=[[i] for i in index_row],
labels=... | def multi_index_insert_row(df, index_row, values_row):
""" Return a new dataframe with a row inserted for a multi-index dataframe.
This will sort the rows according to the ordered multi-index levels.
"""
row_index = pd.MultiIndex(levels=[[i] for i in index_row],
labels=... | [
"Return",
"a",
"new",
"dataframe",
"with",
"a",
"row",
"inserted",
"for",
"a",
"multi",
"-",
"index",
"dataframe",
".",
"This",
"will",
"sort",
"the",
"rows",
"according",
"to",
"the",
"ordered",
"multi",
"-",
"index",
"levels",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/multi_index.py#L106-L118 | [
"def",
"multi_index_insert_row",
"(",
"df",
",",
"index_row",
",",
"values_row",
")",
":",
"row_index",
"=",
"pd",
".",
"MultiIndex",
"(",
"levels",
"=",
"[",
"[",
"i",
"]",
"for",
"i",
"in",
"index_row",
"]",
",",
"labels",
"=",
"[",
"[",
"0",
"]",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | insert_at | Insert some values into a bi-temporal dataframe.
This is like what would happen when we get a price correction. | arctic/multi_index.py | def insert_at(df, sample_date, values):
""" Insert some values into a bi-temporal dataframe.
This is like what would happen when we get a price correction.
"""
observed_dt = dt(datetime.now())
return multi_index_insert_row(df, [sample_date, observed_dt], values) | def insert_at(df, sample_date, values):
""" Insert some values into a bi-temporal dataframe.
This is like what would happen when we get a price correction.
"""
observed_dt = dt(datetime.now())
return multi_index_insert_row(df, [sample_date, observed_dt], values) | [
"Insert",
"some",
"values",
"into",
"a",
"bi",
"-",
"temporal",
"dataframe",
".",
"This",
"is",
"like",
"what",
"would",
"happen",
"when",
"we",
"get",
"a",
"price",
"correction",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/multi_index.py#L121-L126 | [
"def",
"insert_at",
"(",
"df",
",",
"sample_date",
",",
"values",
")",
":",
"observed_dt",
"=",
"dt",
"(",
"datetime",
".",
"now",
"(",
")",
")",
"return",
"multi_index_insert_row",
"(",
"df",
",",
"[",
"sample_date",
",",
"observed_dt",
"]",
",",
"value... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | register_library_type | Register a Arctic Library Type handler | arctic/arctic.py | def register_library_type(name, type_):
"""
Register a Arctic Library Type handler
"""
if name in LIBRARY_TYPES:
raise ArcticException("Library %s already registered as %s" % (name, LIBRARY_TYPES[name]))
LIBRARY_TYPES[name] = type_ | def register_library_type(name, type_):
"""
Register a Arctic Library Type handler
"""
if name in LIBRARY_TYPES:
raise ArcticException("Library %s already registered as %s" % (name, LIBRARY_TYPES[name]))
LIBRARY_TYPES[name] = type_ | [
"Register",
"a",
"Arctic",
"Library",
"Type",
"handler"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/arctic.py#L42-L48 | [
"def",
"register_library_type",
"(",
"name",
",",
"type_",
")",
":",
"if",
"name",
"in",
"LIBRARY_TYPES",
":",
"raise",
"ArcticException",
"(",
"\"Library %s already registered as %s\"",
"%",
"(",
"name",
",",
"LIBRARY_TYPES",
"[",
"name",
"]",
")",
")",
"LIBRAR... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | Arctic._list_libraries_cached | Returns
-------
List of Arctic library names from a cached collection (global per mongo cluster) in mongo.
Long term list_libraries should have a use_cached argument. | arctic/arctic.py | def _list_libraries_cached(self, newer_than_secs=-1):
"""
Returns
-------
List of Arctic library names from a cached collection (global per mongo cluster) in mongo.
Long term list_libraries should have a use_cached argument.
"""
_ = self._conn # Ensures the conne... | def _list_libraries_cached(self, newer_than_secs=-1):
"""
Returns
-------
List of Arctic library names from a cached collection (global per mongo cluster) in mongo.
Long term list_libraries should have a use_cached argument.
"""
_ = self._conn # Ensures the conne... | [
"Returns",
"-------",
"List",
"of",
"Arctic",
"library",
"names",
"from",
"a",
"cached",
"collection",
"(",
"global",
"per",
"mongo",
"cluster",
")",
"in",
"mongo",
".",
"Long",
"term",
"list_libraries",
"should",
"have",
"a",
"use_cached",
"argument",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/arctic.py#L216-L229 | [
"def",
"_list_libraries_cached",
"(",
"self",
",",
"newer_than_secs",
"=",
"-",
"1",
")",
":",
"_",
"=",
"self",
".",
"_conn",
"# Ensures the connection exists and cache is initialized with it.",
"cache_data",
"=",
"self",
".",
"_cache",
".",
"get",
"(",
"'list_libr... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | Arctic.library_exists | Check whether a given library exists.
Parameters
----------
library : `str`
The name of the library. e.g. 'library' or 'user.library'
Returns
-------
`bool`
True if the library with the given name already exists, False otherwise | arctic/arctic.py | def library_exists(self, library):
"""
Check whether a given library exists.
Parameters
----------
library : `str`
The name of the library. e.g. 'library' or 'user.library'
Returns
-------
`bool`
True if the library with the given... | def library_exists(self, library):
"""
Check whether a given library exists.
Parameters
----------
library : `str`
The name of the library. e.g. 'library' or 'user.library'
Returns
-------
`bool`
True if the library with the given... | [
"Check",
"whether",
"a",
"given",
"library",
"exists",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/arctic.py#L235-L260 | [
"def",
"library_exists",
"(",
"self",
",",
"library",
")",
":",
"exists",
"=",
"False",
"try",
":",
"# This forces auth errors, and to fall back to the slower \"list_collections\"",
"ArcticLibraryBinding",
"(",
"self",
",",
"library",
")",
".",
"get_library_type",
"(",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | Arctic.initialize_library | Create an Arctic Library or a particular type.
Parameters
----------
library : `str`
The name of the library. e.g. 'library' or 'user.library'
lib_type : `str`
The type of the library. e.g. arctic.VERSION_STORE or arctic.TICK_STORE
Or any type regis... | arctic/arctic.py | def initialize_library(self, library, lib_type=VERSION_STORE, **kwargs):
"""
Create an Arctic Library or a particular type.
Parameters
----------
library : `str`
The name of the library. e.g. 'library' or 'user.library'
lib_type : `str`
The type ... | def initialize_library(self, library, lib_type=VERSION_STORE, **kwargs):
"""
Create an Arctic Library or a particular type.
Parameters
----------
library : `str`
The name of the library. e.g. 'library' or 'user.library'
lib_type : `str`
The type ... | [
"Create",
"an",
"Arctic",
"Library",
"or",
"a",
"particular",
"type",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/arctic.py#L270-L300 | [
"def",
"initialize_library",
"(",
"self",
",",
"library",
",",
"lib_type",
"=",
"VERSION_STORE",
",",
"*",
"*",
"kwargs",
")",
":",
"lib",
"=",
"ArcticLibraryBinding",
"(",
"self",
",",
"library",
")",
"# check that we don't create too many namespaces",
"# can be di... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | Arctic.delete_library | Delete an Arctic Library, and all associated collections in the MongoDB.
Parameters
----------
library : `str`
The name of the library. e.g. 'library' or 'user.library' | arctic/arctic.py | def delete_library(self, library):
"""
Delete an Arctic Library, and all associated collections in the MongoDB.
Parameters
----------
library : `str`
The name of the library. e.g. 'library' or 'user.library'
"""
lib = ArcticLibraryBinding(self, librar... | def delete_library(self, library):
"""
Delete an Arctic Library, and all associated collections in the MongoDB.
Parameters
----------
library : `str`
The name of the library. e.g. 'library' or 'user.library'
"""
lib = ArcticLibraryBinding(self, librar... | [
"Delete",
"an",
"Arctic",
"Library",
"and",
"all",
"associated",
"collections",
"in",
"the",
"MongoDB",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/arctic.py#L303-L326 | [
"def",
"delete_library",
"(",
"self",
",",
"library",
")",
":",
"lib",
"=",
"ArcticLibraryBinding",
"(",
"self",
",",
"library",
")",
"colname",
"=",
"lib",
".",
"get_top_level_collection",
"(",
")",
".",
"name",
"if",
"not",
"[",
"c",
"for",
"c",
"in",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | Arctic.get_library | Return the library instance. Can generally use slicing to return the library:
arctic_store[library]
Parameters
----------
library : `str`
The name of the library. e.g. 'library' or 'user.library' | arctic/arctic.py | def get_library(self, library):
"""
Return the library instance. Can generally use slicing to return the library:
arctic_store[library]
Parameters
----------
library : `str`
The name of the library. e.g. 'library' or 'user.library'
"""
if... | def get_library(self, library):
"""
Return the library instance. Can generally use slicing to return the library:
arctic_store[library]
Parameters
----------
library : `str`
The name of the library. e.g. 'library' or 'user.library'
"""
if... | [
"Return",
"the",
"library",
"instance",
".",
"Can",
"generally",
"use",
"slicing",
"to",
"return",
"the",
"library",
":",
"arctic_store",
"[",
"library",
"]"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/arctic.py#L328-L361 | [
"def",
"get_library",
"(",
"self",
",",
"library",
")",
":",
"if",
"library",
"in",
"self",
".",
"_library_cache",
":",
"return",
"self",
".",
"_library_cache",
"[",
"library",
"]",
"try",
":",
"error",
"=",
"None",
"lib",
"=",
"ArcticLibraryBinding",
"(",... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | Arctic.rename_library | Renames a library
Parameters
----------
from_lib: str
The name of the library to be renamed
to_lib: str
The new name of the library | arctic/arctic.py | def rename_library(self, from_lib, to_lib):
"""
Renames a library
Parameters
----------
from_lib: str
The name of the library to be renamed
to_lib: str
The new name of the library
"""
to_colname = to_lib
if '.' in from_lib ... | def rename_library(self, from_lib, to_lib):
"""
Renames a library
Parameters
----------
from_lib: str
The name of the library to be renamed
to_lib: str
The new name of the library
"""
to_colname = to_lib
if '.' in from_lib ... | [
"Renames",
"a",
"library"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/arctic.py#L410-L441 | [
"def",
"rename_library",
"(",
"self",
",",
"from_lib",
",",
"to_lib",
")",
":",
"to_colname",
"=",
"to_lib",
"if",
"'.'",
"in",
"from_lib",
"and",
"'.'",
"in",
"to_lib",
":",
"if",
"from_lib",
".",
"split",
"(",
"'.'",
")",
"[",
"0",
"]",
"!=",
"to_l... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | ArcticLibraryBinding._parse_db_lib | Returns the canonical (database_name, library) for the passed in
string 'library'. | arctic/arctic.py | def _parse_db_lib(cls, library):
"""
Returns the canonical (database_name, library) for the passed in
string 'library'.
"""
database_name = library.split('.', 2)
if len(database_name) == 2:
library = database_name[1]
if database_name[0].startswith(... | def _parse_db_lib(cls, library):
"""
Returns the canonical (database_name, library) for the passed in
string 'library'.
"""
database_name = library.split('.', 2)
if len(database_name) == 2:
library = database_name[1]
if database_name[0].startswith(... | [
"Returns",
"the",
"canonical",
"(",
"database_name",
"library",
")",
"for",
"the",
"passed",
"in",
"string",
"library",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/arctic.py#L473-L487 | [
"def",
"_parse_db_lib",
"(",
"cls",
",",
"library",
")",
":",
"database_name",
"=",
"library",
".",
"split",
"(",
"'.'",
",",
"2",
")",
"if",
"len",
"(",
"database_name",
")",
"==",
"2",
":",
"library",
"=",
"database_name",
"[",
"1",
"]",
"if",
"dat... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | ArcticLibraryBinding.set_quota | Set a quota (in bytes) on this user library. The quota is 'best effort',
and should be set conservatively.
A quota of 0 is 'unlimited' | arctic/arctic.py | def set_quota(self, quota_bytes):
"""
Set a quota (in bytes) on this user library. The quota is 'best effort',
and should be set conservatively.
A quota of 0 is 'unlimited'
"""
self.set_library_metadata(ArcticLibraryBinding.QUOTA, quota_bytes)
self.quota = quota... | def set_quota(self, quota_bytes):
"""
Set a quota (in bytes) on this user library. The quota is 'best effort',
and should be set conservatively.
A quota of 0 is 'unlimited'
"""
self.set_library_metadata(ArcticLibraryBinding.QUOTA, quota_bytes)
self.quota = quota... | [
"Set",
"a",
"quota",
"(",
"in",
"bytes",
")",
"on",
"this",
"user",
"library",
".",
"The",
"quota",
"is",
"best",
"effort",
"and",
"should",
"be",
"set",
"conservatively",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/arctic.py#L551-L560 | [
"def",
"set_quota",
"(",
"self",
",",
"quota_bytes",
")",
":",
"self",
".",
"set_library_metadata",
"(",
"ArcticLibraryBinding",
".",
"QUOTA",
",",
"quota_bytes",
")",
"self",
".",
"quota",
"=",
"quota_bytes",
"self",
".",
"quota_countdown",
"=",
"0"
] | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | ArcticLibraryBinding.check_quota | Check whether the user is within quota. Should be called before
every write. Will raise() if the library has exceeded its allotted
quota. | arctic/arctic.py | def check_quota(self):
"""
Check whether the user is within quota. Should be called before
every write. Will raise() if the library has exceeded its allotted
quota.
"""
# Don't check on every write, that would be slow
if self.quota_countdown > 0:
sel... | def check_quota(self):
"""
Check whether the user is within quota. Should be called before
every write. Will raise() if the library has exceeded its allotted
quota.
"""
# Don't check on every write, that would be slow
if self.quota_countdown > 0:
sel... | [
"Check",
"whether",
"the",
"user",
"is",
"within",
"quota",
".",
"Should",
"be",
"called",
"before",
"every",
"write",
".",
"Will",
"raise",
"()",
"if",
"the",
"library",
"has",
"exceeded",
"its",
"allotted",
"quota",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/arctic.py#L568-L621 | [
"def",
"check_quota",
"(",
"self",
")",
":",
"# Don't check on every write, that would be slow",
"if",
"self",
".",
"quota_countdown",
">",
"0",
":",
"self",
".",
"quota_countdown",
"-=",
"1",
"return",
"# Re-cache the quota after the countdown",
"self",
".",
"quota",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | ChunkStore._checksum | Checksum the passed in dictionary | arctic/chunkstore/chunkstore.py | def _checksum(self, fields, data):
"""
Checksum the passed in dictionary
"""
sha = hashlib.sha1()
for field in fields:
sha.update(field)
sha.update(data)
return Binary(sha.digest()) | def _checksum(self, fields, data):
"""
Checksum the passed in dictionary
"""
sha = hashlib.sha1()
for field in fields:
sha.update(field)
sha.update(data)
return Binary(sha.digest()) | [
"Checksum",
"the",
"passed",
"in",
"dictionary"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/chunkstore/chunkstore.py#L109-L117 | [
"def",
"_checksum",
"(",
"self",
",",
"fields",
",",
"data",
")",
":",
"sha",
"=",
"hashlib",
".",
"sha1",
"(",
")",
"for",
"field",
"in",
"fields",
":",
"sha",
".",
"update",
"(",
"field",
")",
"sha",
".",
"update",
"(",
"data",
")",
"return",
"... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | ChunkStore.delete | Delete all chunks for a symbol, or optionally, chunks within a range
Parameters
----------
symbol : str
symbol name for the item
chunk_range: range object
a date range to delete
audit: dict
dict to store in the audit log | arctic/chunkstore/chunkstore.py | def delete(self, symbol, chunk_range=None, audit=None):
"""
Delete all chunks for a symbol, or optionally, chunks within a range
Parameters
----------
symbol : str
symbol name for the item
chunk_range: range object
a date range to delete
a... | def delete(self, symbol, chunk_range=None, audit=None):
"""
Delete all chunks for a symbol, or optionally, chunks within a range
Parameters
----------
symbol : str
symbol name for the item
chunk_range: range object
a date range to delete
a... | [
"Delete",
"all",
"chunks",
"for",
"a",
"symbol",
"or",
"optionally",
"chunks",
"within",
"a",
"range"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/chunkstore/chunkstore.py#L119-L168 | [
"def",
"delete",
"(",
"self",
",",
"symbol",
",",
"chunk_range",
"=",
"None",
",",
"audit",
"=",
"None",
")",
":",
"if",
"chunk_range",
"is",
"not",
"None",
":",
"sym",
"=",
"self",
".",
"_get_symbol_info",
"(",
"symbol",
")",
"# read out chunks that fall ... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | ChunkStore.list_symbols | Returns all symbols in the library
Parameters
----------
partial: None or str
if not none, use this string to do a partial match on symbol names
Returns
-------
list of str | arctic/chunkstore/chunkstore.py | def list_symbols(self, partial_match=None):
"""
Returns all symbols in the library
Parameters
----------
partial: None or str
if not none, use this string to do a partial match on symbol names
Returns
-------
list of str
"""
s... | def list_symbols(self, partial_match=None):
"""
Returns all symbols in the library
Parameters
----------
partial: None or str
if not none, use this string to do a partial match on symbol names
Returns
-------
list of str
"""
s... | [
"Returns",
"all",
"symbols",
"in",
"the",
"library"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/chunkstore/chunkstore.py#L170-L186 | [
"def",
"list_symbols",
"(",
"self",
",",
"partial_match",
"=",
"None",
")",
":",
"symbols",
"=",
"self",
".",
"_symbols",
".",
"distinct",
"(",
"SYMBOL",
")",
"if",
"partial_match",
"is",
"None",
":",
"return",
"symbols",
"return",
"[",
"x",
"for",
"x",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | ChunkStore.rename | Rename a symbol
Parameters
----------
from_symbol: str
the existing symbol that will be renamed
to_symbol: str
the new symbol name
audit: dict
audit information | arctic/chunkstore/chunkstore.py | def rename(self, from_symbol, to_symbol, audit=None):
"""
Rename a symbol
Parameters
----------
from_symbol: str
the existing symbol that will be renamed
to_symbol: str
the new symbol name
audit: dict
audit information
... | def rename(self, from_symbol, to_symbol, audit=None):
"""
Rename a symbol
Parameters
----------
from_symbol: str
the existing symbol that will be renamed
to_symbol: str
the new symbol name
audit: dict
audit information
... | [
"Rename",
"a",
"symbol"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/chunkstore/chunkstore.py#L193-L226 | [
"def",
"rename",
"(",
"self",
",",
"from_symbol",
",",
"to_symbol",
",",
"audit",
"=",
"None",
")",
":",
"sym",
"=",
"self",
".",
"_get_symbol_info",
"(",
"from_symbol",
")",
"if",
"not",
"sym",
":",
"raise",
"NoDataFoundException",
"(",
"'No data found for ... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | ChunkStore.read | Reads data for a given symbol from the database.
Parameters
----------
symbol: str, or list of str
the symbol(s) to retrieve
chunk_range: object
corresponding range object for the specified chunker (for
DateChunker it is a DateRange object or a Dateti... | arctic/chunkstore/chunkstore.py | def read(self, symbol, chunk_range=None, filter_data=True, **kwargs):
"""
Reads data for a given symbol from the database.
Parameters
----------
symbol: str, or list of str
the symbol(s) to retrieve
chunk_range: object
corresponding range object f... | def read(self, symbol, chunk_range=None, filter_data=True, **kwargs):
"""
Reads data for a given symbol from the database.
Parameters
----------
symbol: str, or list of str
the symbol(s) to retrieve
chunk_range: object
corresponding range object f... | [
"Reads",
"data",
"for",
"a",
"given",
"symbol",
"from",
"the",
"database",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/chunkstore/chunkstore.py#L228-L287 | [
"def",
"read",
"(",
"self",
",",
"symbol",
",",
"chunk_range",
"=",
"None",
",",
"filter_data",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"symbol",
",",
"list",
")",
":",
"symbol",
"=",
"[",
"symbol",
"]",
"sym... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | ChunkStore.read_audit_log | Reads the audit log
Parameters
----------
symbol: str
optionally only retrieve specific symbol's audit information
Returns
-------
list of dicts | arctic/chunkstore/chunkstore.py | def read_audit_log(self, symbol=None):
"""
Reads the audit log
Parameters
----------
symbol: str
optionally only retrieve specific symbol's audit information
Returns
-------
list of dicts
"""
if symbol:
return [x f... | def read_audit_log(self, symbol=None):
"""
Reads the audit log
Parameters
----------
symbol: str
optionally only retrieve specific symbol's audit information
Returns
-------
list of dicts
"""
if symbol:
return [x f... | [
"Reads",
"the",
"audit",
"log"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/chunkstore/chunkstore.py#L289-L304 | [
"def",
"read_audit_log",
"(",
"self",
",",
"symbol",
"=",
"None",
")",
":",
"if",
"symbol",
":",
"return",
"[",
"x",
"for",
"x",
"in",
"self",
".",
"_audit",
".",
"find",
"(",
"{",
"'symbol'",
":",
"symbol",
"}",
",",
"{",
"'_id'",
":",
"False",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | ChunkStore.write | Writes data from item to symbol in the database
Parameters
----------
symbol: str
the symbol that will be used to reference the written data
item: Dataframe or Series
the data to write the database
metadata: ?
optional per symbol metadata
... | arctic/chunkstore/chunkstore.py | def write(self, symbol, item, metadata=None, chunker=DateChunker(), audit=None, **kwargs):
"""
Writes data from item to symbol in the database
Parameters
----------
symbol: str
the symbol that will be used to reference the written data
item: Dataframe or Seri... | def write(self, symbol, item, metadata=None, chunker=DateChunker(), audit=None, **kwargs):
"""
Writes data from item to symbol in the database
Parameters
----------
symbol: str
the symbol that will be used to reference the written data
item: Dataframe or Seri... | [
"Writes",
"data",
"from",
"item",
"to",
"symbol",
"in",
"the",
"database"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/chunkstore/chunkstore.py#L306-L404 | [
"def",
"write",
"(",
"self",
",",
"symbol",
",",
"item",
",",
"metadata",
"=",
"None",
",",
"chunker",
"=",
"DateChunker",
"(",
")",
",",
"audit",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"item",
",",
"(",
"... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | ChunkStore.__update | helper method used by update and append since they very closely
resemble eachother. Really differ only by the combine method.
append will combine existing date with new data (within a chunk),
whereas update will replace existing data with new data (within a
chunk). | arctic/chunkstore/chunkstore.py | def __update(self, sym, item, metadata=None, combine_method=None, chunk_range=None, audit=None):
'''
helper method used by update and append since they very closely
resemble eachother. Really differ only by the combine method.
append will combine existing date with new data (within a chu... | def __update(self, sym, item, metadata=None, combine_method=None, chunk_range=None, audit=None):
'''
helper method used by update and append since they very closely
resemble eachother. Really differ only by the combine method.
append will combine existing date with new data (within a chu... | [
"helper",
"method",
"used",
"by",
"update",
"and",
"append",
"since",
"they",
"very",
"closely",
"resemble",
"eachother",
".",
"Really",
"differ",
"only",
"by",
"the",
"combine",
"method",
".",
"append",
"will",
"combine",
"existing",
"date",
"with",
"new",
... | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/chunkstore/chunkstore.py#L406-L491 | [
"def",
"__update",
"(",
"self",
",",
"sym",
",",
"item",
",",
"metadata",
"=",
"None",
",",
"combine_method",
"=",
"None",
",",
"chunk_range",
"=",
"None",
",",
"audit",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"item",
",",
"(",
"DataFr... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | ChunkStore.append | Appends data from item to symbol's data in the database.
Is not idempotent
Parameters
----------
symbol: str
the symbol for the given item in the DB
item: DataFrame or Series
the data to append
upsert:
write data if symbol does not ex... | arctic/chunkstore/chunkstore.py | def append(self, symbol, item, upsert=False, metadata=None, audit=None, **kwargs):
"""
Appends data from item to symbol's data in the database.
Is not idempotent
Parameters
----------
symbol: str
the symbol for the given item in the DB
item: DataFram... | def append(self, symbol, item, upsert=False, metadata=None, audit=None, **kwargs):
"""
Appends data from item to symbol's data in the database.
Is not idempotent
Parameters
----------
symbol: str
the symbol for the given item in the DB
item: DataFram... | [
"Appends",
"data",
"from",
"item",
"to",
"symbol",
"s",
"data",
"in",
"the",
"database",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/chunkstore/chunkstore.py#L493-L523 | [
"def",
"append",
"(",
"self",
",",
"symbol",
",",
"item",
",",
"upsert",
"=",
"False",
",",
"metadata",
"=",
"None",
",",
"audit",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"sym",
"=",
"self",
".",
"_get_symbol_info",
"(",
"symbol",
")",
"if"... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | ChunkStore.update | Overwrites data in DB with data in item for the given symbol.
Is idempotent
Parameters
----------
symbol: str
the symbol for the given item in the DB
item: DataFrame or Series
the data to update
metadata: ?
optional per symbol metadat... | arctic/chunkstore/chunkstore.py | def update(self, symbol, item, metadata=None, chunk_range=None, upsert=False, audit=None, **kwargs):
"""
Overwrites data in DB with data in item for the given symbol.
Is idempotent
Parameters
----------
symbol: str
the symbol for the given item in the DB
... | def update(self, symbol, item, metadata=None, chunk_range=None, upsert=False, audit=None, **kwargs):
"""
Overwrites data in DB with data in item for the given symbol.
Is idempotent
Parameters
----------
symbol: str
the symbol for the given item in the DB
... | [
"Overwrites",
"data",
"in",
"DB",
"with",
"data",
"in",
"item",
"for",
"the",
"given",
"symbol",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/chunkstore/chunkstore.py#L525-L567 | [
"def",
"update",
"(",
"self",
",",
"symbol",
",",
"item",
",",
"metadata",
"=",
"None",
",",
"chunk_range",
"=",
"None",
",",
"upsert",
"=",
"False",
",",
"audit",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"sym",
"=",
"self",
".",
"_get_symbo... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | ChunkStore.get_info | Returns information about the symbol, in a dictionary
Parameters
----------
symbol: str
the symbol for the given item in the DB
Returns
-------
dictionary | arctic/chunkstore/chunkstore.py | def get_info(self, symbol):
"""
Returns information about the symbol, in a dictionary
Parameters
----------
symbol: str
the symbol for the given item in the DB
Returns
-------
dictionary
"""
sym = self._get_symbol_info(symbol)... | def get_info(self, symbol):
"""
Returns information about the symbol, in a dictionary
Parameters
----------
symbol: str
the symbol for the given item in the DB
Returns
-------
dictionary
"""
sym = self._get_symbol_info(symbol)... | [
"Returns",
"information",
"about",
"the",
"symbol",
"in",
"a",
"dictionary"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/chunkstore/chunkstore.py#L569-L593 | [
"def",
"get_info",
"(",
"self",
",",
"symbol",
")",
":",
"sym",
"=",
"self",
".",
"_get_symbol_info",
"(",
"symbol",
")",
"if",
"not",
"sym",
":",
"raise",
"NoDataFoundException",
"(",
"\"Symbol does not exist.\"",
")",
"ret",
"=",
"{",
"}",
"ret",
"[",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | ChunkStore.read_metadata | Reads user defined metadata out for the given symbol
Parameters
----------
symbol: str
symbol for the given item in the DB
Returns
-------
? | arctic/chunkstore/chunkstore.py | def read_metadata(self, symbol):
'''
Reads user defined metadata out for the given symbol
Parameters
----------
symbol: str
symbol for the given item in the DB
Returns
-------
?
'''
sym = self._get_symbol_info(symbol)
... | def read_metadata(self, symbol):
'''
Reads user defined metadata out for the given symbol
Parameters
----------
symbol: str
symbol for the given item in the DB
Returns
-------
?
'''
sym = self._get_symbol_info(symbol)
... | [
"Reads",
"user",
"defined",
"metadata",
"out",
"for",
"the",
"given",
"symbol"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/chunkstore/chunkstore.py#L595-L612 | [
"def",
"read_metadata",
"(",
"self",
",",
"symbol",
")",
":",
"sym",
"=",
"self",
".",
"_get_symbol_info",
"(",
"symbol",
")",
"if",
"not",
"sym",
":",
"raise",
"NoDataFoundException",
"(",
"\"Symbol does not exist.\"",
")",
"x",
"=",
"self",
".",
"_symbols"... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | ChunkStore.write_metadata | writes user defined metadata for the given symbol
Parameters
----------
symbol: str
symbol for the given item in the DB
metadata: ?
metadata to write | arctic/chunkstore/chunkstore.py | def write_metadata(self, symbol, metadata):
'''
writes user defined metadata for the given symbol
Parameters
----------
symbol: str
symbol for the given item in the DB
metadata: ?
metadata to write
'''
sym = self._get_symbol_info(s... | def write_metadata(self, symbol, metadata):
'''
writes user defined metadata for the given symbol
Parameters
----------
symbol: str
symbol for the given item in the DB
metadata: ?
metadata to write
'''
sym = self._get_symbol_info(s... | [
"writes",
"user",
"defined",
"metadata",
"for",
"the",
"given",
"symbol"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/chunkstore/chunkstore.py#L614-L630 | [
"def",
"write_metadata",
"(",
"self",
",",
"symbol",
",",
"metadata",
")",
":",
"sym",
"=",
"self",
".",
"_get_symbol_info",
"(",
"symbol",
")",
"if",
"not",
"sym",
":",
"raise",
"NoDataFoundException",
"(",
"\"Symbol does not exist.\"",
")",
"sym",
"[",
"US... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | ChunkStore.get_chunk_ranges | Returns a generator of (Start, End) tuples for each chunk in the symbol
Parameters
----------
symbol: str
the symbol for the given item in the DB
chunk_range: None, or a range object
allows you to subset the chunks by range
reverse: boolean
re... | arctic/chunkstore/chunkstore.py | def get_chunk_ranges(self, symbol, chunk_range=None, reverse=False):
"""
Returns a generator of (Start, End) tuples for each chunk in the symbol
Parameters
----------
symbol: str
the symbol for the given item in the DB
chunk_range: None, or a range object
... | def get_chunk_ranges(self, symbol, chunk_range=None, reverse=False):
"""
Returns a generator of (Start, End) tuples for each chunk in the symbol
Parameters
----------
symbol: str
the symbol for the given item in the DB
chunk_range: None, or a range object
... | [
"Returns",
"a",
"generator",
"of",
"(",
"Start",
"End",
")",
"tuples",
"for",
"each",
"chunk",
"in",
"the",
"symbol"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/chunkstore/chunkstore.py#L632-L662 | [
"def",
"get_chunk_ranges",
"(",
"self",
",",
"symbol",
",",
"chunk_range",
"=",
"None",
",",
"reverse",
"=",
"False",
")",
":",
"sym",
"=",
"self",
".",
"_get_symbol_info",
"(",
"symbol",
")",
"if",
"not",
"sym",
":",
"raise",
"NoDataFoundException",
"(",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | ChunkStore.iterator | Returns a generator that accesses each chunk in ascending order
Parameters
----------
symbol: str
the symbol for the given item in the DB
chunk_range: None, or a range object
allows you to subset the chunks by range
Returns
-------
genera... | arctic/chunkstore/chunkstore.py | def iterator(self, symbol, chunk_range=None):
"""
Returns a generator that accesses each chunk in ascending order
Parameters
----------
symbol: str
the symbol for the given item in the DB
chunk_range: None, or a range object
allows you to subset t... | def iterator(self, symbol, chunk_range=None):
"""
Returns a generator that accesses each chunk in ascending order
Parameters
----------
symbol: str
the symbol for the given item in the DB
chunk_range: None, or a range object
allows you to subset t... | [
"Returns",
"a",
"generator",
"that",
"accesses",
"each",
"chunk",
"in",
"ascending",
"order"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/chunkstore/chunkstore.py#L664-L686 | [
"def",
"iterator",
"(",
"self",
",",
"symbol",
",",
"chunk_range",
"=",
"None",
")",
":",
"sym",
"=",
"self",
".",
"_get_symbol_info",
"(",
"symbol",
")",
"if",
"not",
"sym",
":",
"raise",
"NoDataFoundException",
"(",
"\"Symbol does not exist.\"",
")",
"c",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | ChunkStore.reverse_iterator | Returns a generator that accesses each chunk in descending order
Parameters
----------
symbol: str
the symbol for the given item in the DB
chunk_range: None, or a range object
allows you to subset the chunks by range
Returns
-------
gener... | arctic/chunkstore/chunkstore.py | def reverse_iterator(self, symbol, chunk_range=None):
"""
Returns a generator that accesses each chunk in descending order
Parameters
----------
symbol: str
the symbol for the given item in the DB
chunk_range: None, or a range object
allows you to... | def reverse_iterator(self, symbol, chunk_range=None):
"""
Returns a generator that accesses each chunk in descending order
Parameters
----------
symbol: str
the symbol for the given item in the DB
chunk_range: None, or a range object
allows you to... | [
"Returns",
"a",
"generator",
"that",
"accesses",
"each",
"chunk",
"in",
"descending",
"order"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/chunkstore/chunkstore.py#L688-L710 | [
"def",
"reverse_iterator",
"(",
"self",
",",
"symbol",
",",
"chunk_range",
"=",
"None",
")",
":",
"sym",
"=",
"self",
".",
"_get_symbol_info",
"(",
"symbol",
")",
"if",
"not",
"sym",
":",
"raise",
"NoDataFoundException",
"(",
"\"Symbol does not exist.\"",
")",... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | mongo_retry | Catch-all decorator that handles AutoReconnect and OperationFailure
errors from PyMongo | arctic/decorators.py | def mongo_retry(f):
"""
Catch-all decorator that handles AutoReconnect and OperationFailure
errors from PyMongo
"""
log_all_exceptions = 'arctic' in f.__module__ if f.__module__ else False
@wraps(f)
def f_retry(*args, **kwargs):
global _retry_count, _in_retry
top_level = not... | def mongo_retry(f):
"""
Catch-all decorator that handles AutoReconnect and OperationFailure
errors from PyMongo
"""
log_all_exceptions = 'arctic' in f.__module__ if f.__module__ else False
@wraps(f)
def f_retry(*args, **kwargs):
global _retry_count, _in_retry
top_level = not... | [
"Catch",
"-",
"all",
"decorator",
"that",
"handles",
"AutoReconnect",
"and",
"OperationFailure",
"errors",
"from",
"PyMongo"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/decorators.py#L34-L65 | [
"def",
"mongo_retry",
"(",
"f",
")",
":",
"log_all_exceptions",
"=",
"'arctic'",
"in",
"f",
".",
"__module__",
"if",
"f",
".",
"__module__",
"else",
"False",
"@",
"wraps",
"(",
"f",
")",
"def",
"f_retry",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | _start_end | Return tuple: [start, end] of np.datetime64 dates that are inclusive of the passed
in datetimes. | arctic/store/_pandas_ndarray_store.py | def _start_end(date_range, dts):
"""
Return tuple: [start, end] of np.datetime64 dates that are inclusive of the passed
in datetimes.
"""
# FIXME: timezones
assert len(dts)
_assert_no_timezone(date_range)
date_range = to_pandas_closed_closed(date_range, add_tz=False)
start = np.datet... | def _start_end(date_range, dts):
"""
Return tuple: [start, end] of np.datetime64 dates that are inclusive of the passed
in datetimes.
"""
# FIXME: timezones
assert len(dts)
_assert_no_timezone(date_range)
date_range = to_pandas_closed_closed(date_range, add_tz=False)
start = np.datet... | [
"Return",
"tuple",
":",
"[",
"start",
"end",
"]",
"of",
"np",
".",
"datetime64",
"dates",
"that",
"are",
"inclusive",
"of",
"the",
"passed",
"in",
"datetimes",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/_pandas_ndarray_store.py#L123-L134 | [
"def",
"_start_end",
"(",
"date_range",
",",
"dts",
")",
":",
"# FIXME: timezones",
"assert",
"len",
"(",
"dts",
")",
"_assert_no_timezone",
"(",
"date_range",
")",
"date_range",
"=",
"to_pandas_closed_closed",
"(",
"date_range",
",",
"add_tz",
"=",
"False",
")"... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | PandasStore._segment_index | Generate index of datetime64 -> item offset.
Parameters:
-----------
new_data: new data being written (or appended)
existing_index: index field from the versions document of the previous version
start: first (0-based) offset of the new data
segments: list of offsets. Eac... | arctic/store/_pandas_ndarray_store.py | def _segment_index(self, recarr, existing_index, start, new_segments):
"""
Generate index of datetime64 -> item offset.
Parameters:
-----------
new_data: new data being written (or appended)
existing_index: index field from the versions document of the previous version
... | def _segment_index(self, recarr, existing_index, start, new_segments):
"""
Generate index of datetime64 -> item offset.
Parameters:
-----------
new_data: new data being written (or appended)
existing_index: index field from the versions document of the previous version
... | [
"Generate",
"index",
"of",
"datetime64",
"-",
">",
"item",
"offset",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/_pandas_ndarray_store.py#L24-L60 | [
"def",
"_segment_index",
"(",
"self",
",",
"recarr",
",",
"existing_index",
",",
"start",
",",
"new_segments",
")",
":",
"# find the index of the first datetime64 column",
"idx_col",
"=",
"self",
".",
"_datetime64_index",
"(",
"recarr",
")",
"# if one exists let's creat... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | PandasStore._datetime64_index | Given a np.recarray find the first datetime64 column | arctic/store/_pandas_ndarray_store.py | def _datetime64_index(self, recarr):
""" Given a np.recarray find the first datetime64 column """
# TODO: Handle multi-indexes
names = recarr.dtype.names
for name in names:
if recarr[name].dtype == DTN64_DTYPE:
return name
return None | def _datetime64_index(self, recarr):
""" Given a np.recarray find the first datetime64 column """
# TODO: Handle multi-indexes
names = recarr.dtype.names
for name in names:
if recarr[name].dtype == DTN64_DTYPE:
return name
return None | [
"Given",
"a",
"np",
".",
"recarray",
"find",
"the",
"first",
"datetime64",
"column"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/_pandas_ndarray_store.py#L62-L69 | [
"def",
"_datetime64_index",
"(",
"self",
",",
"recarr",
")",
":",
"# TODO: Handle multi-indexes",
"names",
"=",
"recarr",
".",
"dtype",
".",
"names",
"for",
"name",
"in",
"names",
":",
"if",
"recarr",
"[",
"name",
"]",
".",
"dtype",
"==",
"DTN64_DTYPE",
":... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | PandasStore._index_range | Given a version, read the segment_index and return the chunks associated
with the date_range. As the segment index is (id -> last datetime)
we need to take care in choosing the correct chunks. | arctic/store/_pandas_ndarray_store.py | def _index_range(self, version, symbol, date_range=None, **kwargs):
""" Given a version, read the segment_index and return the chunks associated
with the date_range. As the segment index is (id -> last datetime)
we need to take care in choosing the correct chunks. """
if date_range and '... | def _index_range(self, version, symbol, date_range=None, **kwargs):
""" Given a version, read the segment_index and return the chunks associated
with the date_range. As the segment index is (id -> last datetime)
we need to take care in choosing the correct chunks. """
if date_range and '... | [
"Given",
"a",
"version",
"read",
"the",
"segment_index",
"and",
"return",
"the",
"chunks",
"associated",
"with",
"the",
"date_range",
".",
"As",
"the",
"segment",
"index",
"is",
"(",
"id",
"-",
">",
"last",
"datetime",
")",
"we",
"need",
"to",
"take",
"c... | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/_pandas_ndarray_store.py#L74-L90 | [
"def",
"_index_range",
"(",
"self",
",",
"version",
",",
"symbol",
",",
"date_range",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"date_range",
"and",
"'segment_index'",
"in",
"version",
":",
"# index is read-only but it's never written to",
"index",
"... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | PandasStore._daterange | Given a recarr, slice out the given artic.date.DateRange if a
datetime64 index exists | arctic/store/_pandas_ndarray_store.py | def _daterange(self, recarr, date_range):
""" Given a recarr, slice out the given artic.date.DateRange if a
datetime64 index exists """
idx = self._datetime64_index(recarr)
if idx and len(recarr):
dts = recarr[idx]
mask = Series(np.zeros(len(dts)), index=dts)
... | def _daterange(self, recarr, date_range):
""" Given a recarr, slice out the given artic.date.DateRange if a
datetime64 index exists """
idx = self._datetime64_index(recarr)
if idx and len(recarr):
dts = recarr[idx]
mask = Series(np.zeros(len(dts)), index=dts)
... | [
"Given",
"a",
"recarr",
"slice",
"out",
"the",
"given",
"artic",
".",
"date",
".",
"DateRange",
"if",
"a",
"datetime64",
"index",
"exists"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/_pandas_ndarray_store.py#L92-L102 | [
"def",
"_daterange",
"(",
"self",
",",
"recarr",
",",
"date_range",
")",
":",
"idx",
"=",
"self",
".",
"_datetime64_index",
"(",
"recarr",
")",
"if",
"idx",
"and",
"len",
"(",
"recarr",
")",
":",
"dts",
"=",
"recarr",
"[",
"idx",
"]",
"mask",
"=",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | PandasStore.get_info | parses out the relevant information in version
and returns it to the user in a dictionary | arctic/store/_pandas_ndarray_store.py | def get_info(self, version):
"""
parses out the relevant information in version
and returns it to the user in a dictionary
"""
ret = super(PandasStore, self).get_info(version)
ret['col_names'] = version['dtype_metadata']
ret['handler'] = self.__class__.__name__
... | def get_info(self, version):
"""
parses out the relevant information in version
and returns it to the user in a dictionary
"""
ret = super(PandasStore, self).get_info(version)
ret['col_names'] = version['dtype_metadata']
ret['handler'] = self.__class__.__name__
... | [
"parses",
"out",
"the",
"relevant",
"information",
"in",
"version",
"and",
"returns",
"it",
"to",
"the",
"user",
"in",
"a",
"dictionary"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/_pandas_ndarray_store.py#L111-L120 | [
"def",
"get_info",
"(",
"self",
",",
"version",
")",
":",
"ret",
"=",
"super",
"(",
"PandasStore",
",",
"self",
")",
".",
"get_info",
"(",
"version",
")",
"ret",
"[",
"'col_names'",
"]",
"=",
"version",
"[",
"'dtype_metadata'",
"]",
"ret",
"[",
"'handl... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | _resize_with_dtype | This function will transform arr into an array with the same type as dtype. It will do this by
filling new columns with zeros (or NaNs, if it is a float column). Also, columns that are not
in the new dtype will be dropped. | arctic/store/_ndarray_store.py | def _resize_with_dtype(arr, dtype):
"""
This function will transform arr into an array with the same type as dtype. It will do this by
filling new columns with zeros (or NaNs, if it is a float column). Also, columns that are not
in the new dtype will be dropped.
"""
structured_arrays = dtype.nam... | def _resize_with_dtype(arr, dtype):
"""
This function will transform arr into an array with the same type as dtype. It will do this by
filling new columns with zeros (or NaNs, if it is a float column). Also, columns that are not
in the new dtype will be dropped.
"""
structured_arrays = dtype.nam... | [
"This",
"function",
"will",
"transform",
"arr",
"into",
"an",
"array",
"with",
"the",
"same",
"type",
"as",
"dtype",
".",
"It",
"will",
"do",
"this",
"by",
"filling",
"new",
"columns",
"with",
"zeros",
"(",
"or",
"NaNs",
"if",
"it",
"is",
"a",
"float",... | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/_ndarray_store.py#L75-L113 | [
"def",
"_resize_with_dtype",
"(",
"arr",
",",
"dtype",
")",
":",
"structured_arrays",
"=",
"dtype",
".",
"names",
"is",
"not",
"None",
"and",
"arr",
".",
"dtype",
".",
"names",
"is",
"not",
"None",
"old_columns",
"=",
"arr",
".",
"dtype",
".",
"names",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | _update_fw_pointers | This function will decide whether to update the version document with forward pointers to segments.
It detects cases where no prior writes/appends have been performed with FW pointers, and extracts the segment IDs.
It also sets the metadata which indicate the mode of operation at the time of the version creatio... | arctic/store/_ndarray_store.py | def _update_fw_pointers(collection, symbol, version, previous_version, is_append, shas_to_add=None):
"""
This function will decide whether to update the version document with forward pointers to segments.
It detects cases where no prior writes/appends have been performed with FW pointers, and extracts the s... | def _update_fw_pointers(collection, symbol, version, previous_version, is_append, shas_to_add=None):
"""
This function will decide whether to update the version document with forward pointers to segments.
It detects cases where no prior writes/appends have been performed with FW pointers, and extracts the s... | [
"This",
"function",
"will",
"decide",
"whether",
"to",
"update",
"the",
"version",
"document",
"with",
"forward",
"pointers",
"to",
"segments",
".",
"It",
"detects",
"cases",
"where",
"no",
"prior",
"writes",
"/",
"appends",
"have",
"been",
"performed",
"with"... | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/_ndarray_store.py#L121-L156 | [
"def",
"_update_fw_pointers",
"(",
"collection",
",",
"symbol",
",",
"version",
",",
"previous_version",
",",
"is_append",
",",
"shas_to_add",
"=",
"None",
")",
":",
"version",
"[",
"FW_POINTERS_CONFIG_KEY",
"]",
"=",
"ARCTIC_FORWARD_POINTERS_CFG",
".",
"name",
"#... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | _spec_fw_pointers_aware | This method updates the find query filter spec used to read the segment for a version.
It chooses whether to query via forward pointers or not based on the version details and current mode of operation. | arctic/store/_ndarray_store.py | def _spec_fw_pointers_aware(symbol, version, from_index=None, to_index=None):
"""
This method updates the find query filter spec used to read the segment for a version.
It chooses whether to query via forward pointers or not based on the version details and current mode of operation.
"""
spec = {'sy... | def _spec_fw_pointers_aware(symbol, version, from_index=None, to_index=None):
"""
This method updates the find query filter spec used to read the segment for a version.
It chooses whether to query via forward pointers or not based on the version details and current mode of operation.
"""
spec = {'sy... | [
"This",
"method",
"updates",
"the",
"find",
"query",
"filter",
"spec",
"used",
"to",
"read",
"the",
"segment",
"for",
"a",
"version",
".",
"It",
"chooses",
"whether",
"to",
"query",
"via",
"forward",
"pointers",
"or",
"not",
"based",
"on",
"the",
"version"... | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/_ndarray_store.py#L159-L195 | [
"def",
"_spec_fw_pointers_aware",
"(",
"symbol",
",",
"version",
",",
"from_index",
"=",
"None",
",",
"to_index",
"=",
"None",
")",
":",
"spec",
"=",
"{",
"'symbol'",
":",
"symbol",
",",
"'segment'",
":",
"{",
"'$lt'",
":",
"version",
"[",
"'up_to'",
"]"... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | _fw_pointers_convert_append_to_write | This method decides whether to convert an append to a full write in order to avoid data integrity errors | arctic/store/_ndarray_store.py | def _fw_pointers_convert_append_to_write(previous_version):
"""
This method decides whether to convert an append to a full write in order to avoid data integrity errors
"""
# Switching from ENABLED --> DISABLED/HYBRID when appending can cause integrity errors for subsequent reads:
# - Assume the ... | def _fw_pointers_convert_append_to_write(previous_version):
"""
This method decides whether to convert an append to a full write in order to avoid data integrity errors
"""
# Switching from ENABLED --> DISABLED/HYBRID when appending can cause integrity errors for subsequent reads:
# - Assume the ... | [
"This",
"method",
"decides",
"whether",
"to",
"convert",
"an",
"append",
"to",
"a",
"full",
"write",
"in",
"order",
"to",
"avoid",
"data",
"integrity",
"errors"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/_ndarray_store.py#L198-L208 | [
"def",
"_fw_pointers_convert_append_to_write",
"(",
"previous_version",
")",
":",
"# Switching from ENABLED --> DISABLED/HYBRID when appending can cause integrity errors for subsequent reads:",
"# - Assume the last write was done with ENABLED (segments don't have parent references updated).",
"# ... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | NdarrayStore._index_range | Tuple describing range to read from the ndarray - closed:open | arctic/store/_ndarray_store.py | def _index_range(self, version, symbol, from_version=None, **kwargs):
"""
Tuple describing range to read from the ndarray - closed:open
"""
from_index = None
if from_version:
from_index = from_version['up_to']
return from_index, None | def _index_range(self, version, symbol, from_version=None, **kwargs):
"""
Tuple describing range to read from the ndarray - closed:open
"""
from_index = None
if from_version:
from_index = from_version['up_to']
return from_index, None | [
"Tuple",
"describing",
"range",
"to",
"read",
"from",
"the",
"ndarray",
"-",
"closed",
":",
"open"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/_ndarray_store.py#L321-L328 | [
"def",
"_index_range",
"(",
"self",
",",
"version",
",",
"symbol",
",",
"from_version",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"from_index",
"=",
"None",
"if",
"from_version",
":",
"from_index",
"=",
"from_version",
"[",
"'up_to'",
"]",
"return",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | NdarrayStore._do_read | index_range is a 2-tuple of integers - a [from, to) range of segments to be read.
Either from or to can be None, indicating no bound. | arctic/store/_ndarray_store.py | def _do_read(self, collection, version, symbol, index_range=None):
"""
index_range is a 2-tuple of integers - a [from, to) range of segments to be read.
Either from or to can be None, indicating no bound.
"""
from_index = index_range[0] if index_range else None
to_ind... | def _do_read(self, collection, version, symbol, index_range=None):
"""
index_range is a 2-tuple of integers - a [from, to) range of segments to be read.
Either from or to can be None, indicating no bound.
"""
from_index = index_range[0] if index_range else None
to_ind... | [
"index_range",
"is",
"a",
"2",
"-",
"tuple",
"of",
"integers",
"-",
"a",
"[",
"from",
"to",
")",
"range",
"of",
"segments",
"to",
"be",
"read",
".",
"Either",
"from",
"or",
"to",
"can",
"be",
"None",
"indicating",
"no",
"bound",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/_ndarray_store.py#L353-L378 | [
"def",
"_do_read",
"(",
"self",
",",
"collection",
",",
"version",
",",
"symbol",
",",
"index_range",
"=",
"None",
")",
":",
"from_index",
"=",
"index_range",
"[",
"0",
"]",
"if",
"index_range",
"else",
"None",
"to_index",
"=",
"version",
"[",
"'up_to'",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | TopLevelTickStore.add | Adds the library with the given date range to the underlying collection of libraries used by this store.
The underlying libraries should not overlap as the date ranges are assumed to be CLOSED_CLOSED by this function
and the rest of the class.
Arguments:
date_range: A date range provid... | arctic/tickstore/toplevel.py | def add(self, date_range, library_name):
"""
Adds the library with the given date range to the underlying collection of libraries used by this store.
The underlying libraries should not overlap as the date ranges are assumed to be CLOSED_CLOSED by this function
and the rest of the class.... | def add(self, date_range, library_name):
"""
Adds the library with the given date range to the underlying collection of libraries used by this store.
The underlying libraries should not overlap as the date ranges are assumed to be CLOSED_CLOSED by this function
and the rest of the class.... | [
"Adds",
"the",
"library",
"with",
"the",
"given",
"date",
"range",
"to",
"the",
"underlying",
"collection",
"of",
"libraries",
"used",
"by",
"this",
"store",
".",
"The",
"underlying",
"libraries",
"should",
"not",
"overlap",
"as",
"the",
"date",
"ranges",
"a... | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/tickstore/toplevel.py#L71-L103 | [
"def",
"add",
"(",
"self",
",",
"date_range",
",",
"library_name",
")",
":",
"# check that the library is valid",
"try",
":",
"self",
".",
"_arctic_lib",
".",
"arctic",
"[",
"library_name",
"]",
"except",
"Exception",
"as",
"e",
":",
"logger",
".",
"error",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | TopLevelTickStore.write | Split the tick data to the underlying collections and write the data to each low
level library.
Args:
symbol (str): the symbol for the timeseries data
data (list of dicts or pandas dataframe): Tick data to write
if a list of dicts is given the list must be in tim... | arctic/tickstore/toplevel.py | def write(self, symbol, data):
"""
Split the tick data to the underlying collections and write the data to each low
level library.
Args:
symbol (str): the symbol for the timeseries data
data (list of dicts or pandas dataframe): Tick data to write
... | def write(self, symbol, data):
"""
Split the tick data to the underlying collections and write the data to each low
level library.
Args:
symbol (str): the symbol for the timeseries data
data (list of dicts or pandas dataframe): Tick data to write
... | [
"Split",
"the",
"tick",
"data",
"to",
"the",
"underlying",
"collections",
"and",
"write",
"the",
"data",
"to",
"each",
"low",
"level",
"library",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/tickstore/toplevel.py#L119-L138 | [
"def",
"write",
"(",
"self",
",",
"symbol",
",",
"data",
")",
":",
"# get the full set of date ranges that we have",
"cursor",
"=",
"self",
".",
"_collection",
".",
"find",
"(",
")",
"for",
"res",
"in",
"cursor",
":",
"library",
"=",
"self",
".",
"_arctic_li... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | TopLevelTickStore._get_library_metadata | Retrieve the libraries for the given date range, the assumption is that the date ranges do not overlap and
they are CLOSED_CLOSED.
At the moment the date range is mandatory | arctic/tickstore/toplevel.py | def _get_library_metadata(self, date_range):
"""
Retrieve the libraries for the given date range, the assumption is that the date ranges do not overlap and
they are CLOSED_CLOSED.
At the moment the date range is mandatory
"""
if date_range is None:
raise Exce... | def _get_library_metadata(self, date_range):
"""
Retrieve the libraries for the given date range, the assumption is that the date ranges do not overlap and
they are CLOSED_CLOSED.
At the moment the date range is mandatory
"""
if date_range is None:
raise Exce... | [
"Retrieve",
"the",
"libraries",
"for",
"the",
"given",
"date",
"range",
"the",
"assumption",
"is",
"that",
"the",
"date",
"ranges",
"do",
"not",
"overlap",
"and",
"they",
"are",
"CLOSED_CLOSED",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/tickstore/toplevel.py#L188-L221 | [
"def",
"_get_library_metadata",
"(",
"self",
",",
"date_range",
")",
":",
"if",
"date_range",
"is",
"None",
":",
"raise",
"Exception",
"(",
"\"A date range must be provided\"",
")",
"if",
"not",
"(",
"date_range",
".",
"start",
"and",
"date_range",
".",
"end",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | ArcticTransaction.write | Records a write request to be actioned on context exit. Takes exactly the same parameters as the regular
library write call. | arctic/store/audit.py | def write(self, symbol, data, prune_previous_version=True, metadata=None, **kwargs):
"""
Records a write request to be actioned on context exit. Takes exactly the same parameters as the regular
library write call.
"""
if data is not None:
# We only write data if exist... | def write(self, symbol, data, prune_previous_version=True, metadata=None, **kwargs):
"""
Records a write request to be actioned on context exit. Takes exactly the same parameters as the regular
library write call.
"""
if data is not None:
# We only write data if exist... | [
"Records",
"a",
"write",
"request",
"to",
"be",
"actioned",
"on",
"context",
"exit",
".",
"Takes",
"exactly",
"the",
"same",
"parameters",
"as",
"the",
"regular",
"library",
"write",
"call",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/audit.py#L118-L128 | [
"def",
"write",
"(",
"self",
",",
"symbol",
",",
"data",
",",
"prune_previous_version",
"=",
"True",
",",
"metadata",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"data",
"is",
"not",
"None",
":",
"# We only write data if existing data is None or the ... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | PandasSerializer._to_records | Similar to DataFrame.to_records()
Differences:
Attempt type conversion for pandas columns stored as objects (e.g. strings),
as we can only store primitives in the ndarray.
Use dtype metadata to store column and index names.
string_max_len: integer - enforces a string... | arctic/serialization/numpy_records.py | def _to_records(self, df, string_max_len=None, forced_dtype=None):
"""
Similar to DataFrame.to_records()
Differences:
Attempt type conversion for pandas columns stored as objects (e.g. strings),
as we can only store primitives in the ndarray.
Use dtype metadat... | def _to_records(self, df, string_max_len=None, forced_dtype=None):
"""
Similar to DataFrame.to_records()
Differences:
Attempt type conversion for pandas columns stored as objects (e.g. strings),
as we can only store primitives in the ndarray.
Use dtype metadat... | [
"Similar",
"to",
"DataFrame",
".",
"to_records",
"()",
"Differences",
":",
"Attempt",
"type",
"conversion",
"for",
"pandas",
"columns",
"stored",
"as",
"objects",
"(",
"e",
".",
"g",
".",
"strings",
")",
"as",
"we",
"can",
"only",
"store",
"primitives",
"i... | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/serialization/numpy_records.py#L116-L157 | [
"def",
"_to_records",
"(",
"self",
",",
"df",
",",
"string_max_len",
"=",
"None",
",",
"forced_dtype",
"=",
"None",
")",
":",
"index_names",
",",
"ix_vals",
",",
"metadata",
"=",
"self",
".",
"_index_to_records",
"(",
"df",
")",
"columns",
",",
"column_val... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | PandasSerializer.fast_check_serializable | Convert efficiently the frame's object-columns/object-index/multi-index/multi-column to
records, by creating a recarray only for the object fields instead for the whole dataframe.
If we have no object dtypes, we can safely convert only the first row to recarray to test if serializable.
Previousl... | arctic/serialization/numpy_records.py | def fast_check_serializable(self, df):
"""
Convert efficiently the frame's object-columns/object-index/multi-index/multi-column to
records, by creating a recarray only for the object fields instead for the whole dataframe.
If we have no object dtypes, we can safely convert only the first... | def fast_check_serializable(self, df):
"""
Convert efficiently the frame's object-columns/object-index/multi-index/multi-column to
records, by creating a recarray only for the object fields instead for the whole dataframe.
If we have no object dtypes, we can safely convert only the first... | [
"Convert",
"efficiently",
"the",
"frame",
"s",
"object",
"-",
"columns",
"/",
"object",
"-",
"index",
"/",
"multi",
"-",
"index",
"/",
"multi",
"-",
"column",
"to",
"records",
"by",
"creating",
"a",
"recarray",
"only",
"for",
"the",
"object",
"fields",
"... | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/serialization/numpy_records.py#L159-L187 | [
"def",
"fast_check_serializable",
"(",
"self",
",",
"df",
")",
":",
"i_dtype",
",",
"f_dtypes",
"=",
"df",
".",
"index",
".",
"dtype",
",",
"df",
".",
"dtypes",
"index_has_object",
"=",
"df",
".",
"index",
".",
"dtype",
"is",
"NP_OBJECT_DTYPE",
"fields_wit... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | read_apply | Apply `func` to each chunk in lib.symbol
Parameters
----------
lib: arctic library
symbol: str
the symbol for the given item in the DB
chunk_range: None, or a range object
allows you to subset the chunks by range
Returns
-------
generator | arctic/chunkstore/utils.py | def read_apply(lib, symbol, func, chunk_range=None):
"""
Apply `func` to each chunk in lib.symbol
Parameters
----------
lib: arctic library
symbol: str
the symbol for the given item in the DB
chunk_range: None, or a range object
allows you to subset the chunks by range
... | def read_apply(lib, symbol, func, chunk_range=None):
"""
Apply `func` to each chunk in lib.symbol
Parameters
----------
lib: arctic library
symbol: str
the symbol for the given item in the DB
chunk_range: None, or a range object
allows you to subset the chunks by range
... | [
"Apply",
"func",
"to",
"each",
"chunk",
"in",
"lib",
".",
"symbol"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/chunkstore/utils.py#L6-L23 | [
"def",
"read_apply",
"(",
"lib",
",",
"symbol",
",",
"func",
",",
"chunk_range",
"=",
"None",
")",
":",
"for",
"chunk",
"in",
"lib",
".",
"iterator",
"(",
"symbol",
",",
"chunk_range",
"=",
"chunk_range",
")",
":",
"yield",
"func",
"(",
"chunk",
")"
] | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | MetadataStore.list_symbols | Return the symbols in this library.
Parameters
----------
as_of : `datetime.datetime`
filter symbols valid at given time
regex : `str`
filter symbols by the passed in regular expression
kwargs :
kwarg keys are used as fields to query fo... | arctic/store/metadata_store.py | def list_symbols(self, regex=None, as_of=None, **kwargs):
"""
Return the symbols in this library.
Parameters
----------
as_of : `datetime.datetime`
filter symbols valid at given time
regex : `str`
filter symbols by the passed in regular expr... | def list_symbols(self, regex=None, as_of=None, **kwargs):
"""
Return the symbols in this library.
Parameters
----------
as_of : `datetime.datetime`
filter symbols valid at given time
regex : `str`
filter symbols by the passed in regular expr... | [
"Return",
"the",
"symbols",
"in",
"this",
"library",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/metadata_store.py#L62-L118 | [
"def",
"list_symbols",
"(",
"self",
",",
"regex",
"=",
"None",
",",
"as_of",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# Skip aggregation pipeline",
"if",
"not",
"(",
"regex",
"or",
"as_of",
"or",
"kwargs",
")",
":",
"return",
"self",
".",
"dist... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | MetadataStore.read_history | Return all metadata saved for `symbol`
Parameters
----------
symbol : `str`
symbol name for the item
Returns
-------
pandas.DateFrame containing timestamps and metadata entries | arctic/store/metadata_store.py | def read_history(self, symbol):
"""
Return all metadata saved for `symbol`
Parameters
----------
symbol : `str`
symbol name for the item
Returns
-------
pandas.DateFrame containing timestamps and metadata entries
"""
find = se... | def read_history(self, symbol):
"""
Return all metadata saved for `symbol`
Parameters
----------
symbol : `str`
symbol name for the item
Returns
-------
pandas.DateFrame containing timestamps and metadata entries
"""
find = se... | [
"Return",
"all",
"metadata",
"saved",
"for",
"symbol"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/metadata_store.py#L125-L144 | [
"def",
"read_history",
"(",
"self",
",",
"symbol",
")",
":",
"find",
"=",
"self",
".",
"find",
"(",
"{",
"'symbol'",
":",
"symbol",
"}",
",",
"sort",
"=",
"[",
"(",
"'start_time'",
",",
"pymongo",
".",
"ASCENDING",
")",
"]",
")",
"times",
"=",
"[",... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | MetadataStore.read | Return current metadata saved for `symbol`
Parameters
----------
symbol : `str`
symbol name for the item
as_of : `datetime.datetime`
return entry valid at given time
Returns
-------
metadata | arctic/store/metadata_store.py | def read(self, symbol, as_of=None):
"""
Return current metadata saved for `symbol`
Parameters
----------
symbol : `str`
symbol name for the item
as_of : `datetime.datetime`
return entry valid at given time
Returns
-------
... | def read(self, symbol, as_of=None):
"""
Return current metadata saved for `symbol`
Parameters
----------
symbol : `str`
symbol name for the item
as_of : `datetime.datetime`
return entry valid at given time
Returns
-------
... | [
"Return",
"current",
"metadata",
"saved",
"for",
"symbol"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/metadata_store.py#L147-L167 | [
"def",
"read",
"(",
"self",
",",
"symbol",
",",
"as_of",
"=",
"None",
")",
":",
"if",
"as_of",
"is",
"not",
"None",
":",
"res",
"=",
"self",
".",
"find_one",
"(",
"{",
"'symbol'",
":",
"symbol",
",",
"'start_time'",
":",
"{",
"'$lte'",
":",
"as_of"... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | MetadataStore.write_history | Manually overwrite entire metadata history for symbols in `collection`
Parameters
----------
collection : `list of pandas.DataFrame`
with symbol names as headers and timestamps as indices
(the same format as output of read_history)
Example:
[p... | arctic/store/metadata_store.py | def write_history(self, collection):
"""
Manually overwrite entire metadata history for symbols in `collection`
Parameters
----------
collection : `list of pandas.DataFrame`
with symbol names as headers and timestamps as indices
(the same format as output... | def write_history(self, collection):
"""
Manually overwrite entire metadata history for symbols in `collection`
Parameters
----------
collection : `list of pandas.DataFrame`
with symbol names as headers and timestamps as indices
(the same format as output... | [
"Manually",
"overwrite",
"entire",
"metadata",
"history",
"for",
"symbols",
"in",
"collection"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/metadata_store.py#L169-L199 | [
"def",
"write_history",
"(",
"self",
",",
"collection",
")",
":",
"documents",
"=",
"[",
"]",
"for",
"dataframe",
"in",
"collection",
":",
"if",
"len",
"(",
"dataframe",
".",
"columns",
")",
"!=",
"1",
":",
"raise",
"ValueError",
"(",
"'More than one symbo... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | MetadataStore.append | Update metadata entry for `symbol`
Parameters
----------
symbol : `str`
symbol name for the item
metadata : `dict`
to be persisted
start_time : `datetime.datetime`
when metadata becomes effective
Default: datetime.datetime.utcnow() | arctic/store/metadata_store.py | def append(self, symbol, metadata, start_time=None):
"""
Update metadata entry for `symbol`
Parameters
----------
symbol : `str`
symbol name for the item
metadata : `dict`
to be persisted
start_time : `datetime.datetime`
when m... | def append(self, symbol, metadata, start_time=None):
"""
Update metadata entry for `symbol`
Parameters
----------
symbol : `str`
symbol name for the item
metadata : `dict`
to be persisted
start_time : `datetime.datetime`
when m... | [
"Update",
"metadata",
"entry",
"for",
"symbol"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/metadata_store.py#L201-L233 | [
"def",
"append",
"(",
"self",
",",
"symbol",
",",
"metadata",
",",
"start_time",
"=",
"None",
")",
":",
"if",
"start_time",
"is",
"None",
":",
"start_time",
"=",
"dt",
".",
"utcnow",
"(",
")",
"old_metadata",
"=",
"self",
".",
"find_one",
"(",
"{",
"... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.