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 | MetadataStore.prepend | Prepend a 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.min | arctic/store/metadata_store.py | def prepend(self, symbol, metadata, start_time=None):
"""
Prepend a metadata entry for `symbol`
Parameters
----------
symbol : `str`
symbol name for the item
metadata : `dict`
to be persisted
start_time : `datetime.datetime`
wh... | def prepend(self, symbol, metadata, start_time=None):
"""
Prepend a metadata entry for `symbol`
Parameters
----------
symbol : `str`
symbol name for the item
metadata : `dict`
to be persisted
start_time : `datetime.datetime`
wh... | [
"Prepend",
"a",
"metadata",
"entry",
"for",
"symbol"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/metadata_store.py#L235-L273 | [
"def",
"prepend",
"(",
"self",
",",
"symbol",
",",
"metadata",
",",
"start_time",
"=",
"None",
")",
":",
"if",
"metadata",
"is",
"None",
":",
"return",
"if",
"start_time",
"is",
"None",
":",
"start_time",
"=",
"dt",
".",
"min",
"old_metadata",
"=",
"se... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | MetadataStore.pop | Delete current metadata of `symbol`
Parameters
----------
symbol : `str`
symbol name to delete
Returns
-------
Deleted metadata | arctic/store/metadata_store.py | def pop(self, symbol):
"""
Delete current metadata of `symbol`
Parameters
----------
symbol : `str`
symbol name to delete
Returns
-------
Deleted metadata
"""
last_metadata = self.find_one({'symbol': symbol}, sort=[('start_tim... | def pop(self, symbol):
"""
Delete current metadata of `symbol`
Parameters
----------
symbol : `str`
symbol name to delete
Returns
-------
Deleted metadata
"""
last_metadata = self.find_one({'symbol': symbol}, sort=[('start_tim... | [
"Delete",
"current",
"metadata",
"of",
"symbol"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/metadata_store.py#L275-L296 | [
"def",
"pop",
"(",
"self",
",",
"symbol",
")",
":",
"last_metadata",
"=",
"self",
".",
"find_one",
"(",
"{",
"'symbol'",
":",
"symbol",
"}",
",",
"sort",
"=",
"[",
"(",
"'start_time'",
",",
"pymongo",
".",
"DESCENDING",
")",
"]",
")",
"if",
"last_met... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | MetadataStore.purge | Delete all metadata of `symbol`
Parameters
----------
symbol : `str`
symbol name to delete | arctic/store/metadata_store.py | def purge(self, symbol):
"""
Delete all metadata of `symbol`
Parameters
----------
symbol : `str`
symbol name to delete
"""
logger.warning("Deleting entire metadata history for %r from %r" % (symbol, self._arctic_lib.get_name()))
self.delete_m... | def purge(self, symbol):
"""
Delete all metadata of `symbol`
Parameters
----------
symbol : `str`
symbol name to delete
"""
logger.warning("Deleting entire metadata history for %r from %r" % (symbol, self._arctic_lib.get_name()))
self.delete_m... | [
"Delete",
"all",
"metadata",
"of",
"symbol"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/metadata_store.py#L299-L309 | [
"def",
"purge",
"(",
"self",
",",
"symbol",
")",
":",
"logger",
".",
"warning",
"(",
"\"Deleting entire metadata history for %r from %r\"",
"%",
"(",
"symbol",
",",
"self",
".",
"_arctic_lib",
".",
"get_name",
"(",
")",
")",
")",
"self",
".",
"delete_many",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | CustomArcticLibType.query | Generic query method.
In reality, your storage class would have its own query methods,
Performs a Mongo find on the Marketdata index metadata collection.
See:
http://api.mongodb.org/python/current/api/pymongo/collection.html | howtos/how_to_custom_arctic_library.py | def query(self, *args, **kwargs):
"""
Generic query method.
In reality, your storage class would have its own query methods,
Performs a Mongo find on the Marketdata index metadata collection.
See:
http://api.mongodb.org/python/current/api/pymongo/collection.html
... | def query(self, *args, **kwargs):
"""
Generic query method.
In reality, your storage class would have its own query methods,
Performs a Mongo find on the Marketdata index metadata collection.
See:
http://api.mongodb.org/python/current/api/pymongo/collection.html
... | [
"Generic",
"query",
"method",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/howtos/how_to_custom_arctic_library.py#L83-L96 | [
"def",
"query",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"x",
"in",
"self",
".",
"_collection",
".",
"find",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"x",
"[",
"'stuff'",
"]",
"=",
"cPickle",
".",
"... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | CustomArcticLibType.stats | Database usage statistics. Used by quota. | howtos/how_to_custom_arctic_library.py | def stats(self):
"""
Database usage statistics. Used by quota.
"""
res = {}
db = self._collection.database
res['dbstats'] = db.command('dbstats')
res['data'] = db.command('collstats', self._collection.name)
res['totals'] = {'count': res['data']['count'],
... | def stats(self):
"""
Database usage statistics. Used by quota.
"""
res = {}
db = self._collection.database
res['dbstats'] = db.command('dbstats')
res['data'] = db.command('collstats', self._collection.name)
res['totals'] = {'count': res['data']['count'],
... | [
"Database",
"usage",
"statistics",
".",
"Used",
"by",
"quota",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/howtos/how_to_custom_arctic_library.py#L99-L110 | [
"def",
"stats",
"(",
"self",
")",
":",
"res",
"=",
"{",
"}",
"db",
"=",
"self",
".",
"_collection",
".",
"database",
"res",
"[",
"'dbstats'",
"]",
"=",
"db",
".",
"command",
"(",
"'dbstats'",
")",
"res",
"[",
"'data'",
"]",
"=",
"db",
".",
"comma... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | CustomArcticLibType.store | Simple persistence method | howtos/how_to_custom_arctic_library.py | def store(self, thing):
"""
Simple persistence method
"""
to_store = {'field1': thing.field1,
'date_field': thing.date_field,
}
to_store['stuff'] = Binary(cPickle.dumps(thing.stuff))
# Respect any soft-quota on write - raises if sta... | def store(self, thing):
"""
Simple persistence method
"""
to_store = {'field1': thing.field1,
'date_field': thing.date_field,
}
to_store['stuff'] = Binary(cPickle.dumps(thing.stuff))
# Respect any soft-quota on write - raises if sta... | [
"Simple",
"persistence",
"method"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/howtos/how_to_custom_arctic_library.py#L113-L123 | [
"def",
"store",
"(",
"self",
",",
"thing",
")",
":",
"to_store",
"=",
"{",
"'field1'",
":",
"thing",
".",
"field1",
",",
"'date_field'",
":",
"thing",
".",
"date_field",
",",
"}",
"to_store",
"[",
"'stuff'",
"]",
"=",
"Binary",
"(",
"cPickle",
".",
"... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | BitemporalStore.read | Read data for the named symbol. Returns a BitemporalItem object with
a data and metdata element (as passed into write).
Parameters
----------
symbol : `str`
symbol name for the item
as_of : `datetime.datetime`
Return the data as it was as_of the point in ... | arctic/store/bitemporal_store.py | def read(self, symbol, as_of=None, raw=False, **kwargs):
# TODO: shall we block from_version from getting into super.read?
"""Read data for the named symbol. Returns a BitemporalItem object with
a data and metdata element (as passed into write).
Parameters
----------
sym... | def read(self, symbol, as_of=None, raw=False, **kwargs):
# TODO: shall we block from_version from getting into super.read?
"""Read data for the named symbol. Returns a BitemporalItem object with
a data and metdata element (as passed into write).
Parameters
----------
sym... | [
"Read",
"data",
"for",
"the",
"named",
"symbol",
".",
"Returns",
"a",
"BitemporalItem",
"object",
"with",
"a",
"data",
"and",
"metdata",
"element",
"(",
"as",
"passed",
"into",
"write",
")",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/bitemporal_store.py#L31-L62 | [
"def",
"read",
"(",
"self",
",",
"symbol",
",",
"as_of",
"=",
"None",
",",
"raw",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# TODO: shall we block from_version from getting into super.read?",
"item",
"=",
"self",
".",
"_store",
".",
"read",
"(",
"sym... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | BitemporalStore.update | Append 'data' under the specified 'symbol' name to this library.
Parameters
----------
symbol : `str`
symbol name for the item
data : `pd.DataFrame`
to be persisted
metadata : `dict`
An optional dictionary of metadata to persist along with the... | arctic/store/bitemporal_store.py | def update(self, symbol, data, metadata=None, upsert=True, as_of=None, **kwargs):
""" Append 'data' under the specified 'symbol' name to this library.
Parameters
----------
symbol : `str`
symbol name for the item
data : `pd.DataFrame`
to be persisted
... | def update(self, symbol, data, metadata=None, upsert=True, as_of=None, **kwargs):
""" Append 'data' under the specified 'symbol' name to this library.
Parameters
----------
symbol : `str`
symbol name for the item
data : `pd.DataFrame`
to be persisted
... | [
"Append",
"data",
"under",
"the",
"specified",
"symbol",
"name",
"to",
"this",
"library",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/bitemporal_store.py#L64-L94 | [
"def",
"update",
"(",
"self",
",",
"symbol",
",",
"data",
",",
"metadata",
"=",
"None",
",",
"upsert",
"=",
"True",
",",
"as_of",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"local_tz",
"=",
"mktz",
"(",
")",
"if",
"not",
"as_of",
":",
"as_of... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | string_to_daterange | Convert a string to a DateRange type. If you put only one date, it generates the
relevant range for just that date or datetime till 24 hours later. You can optionally
use mixtures of []/() around the DateRange for OPEN/CLOSED interval behaviour.
Parameters
----------
str_range : `String`
Th... | arctic/date/_util.py | def string_to_daterange(str_range, delimiter='-', as_dates=False, interval=CLOSED_CLOSED):
"""
Convert a string to a DateRange type. If you put only one date, it generates the
relevant range for just that date or datetime till 24 hours later. You can optionally
use mixtures of []/() around the DateRange... | def string_to_daterange(str_range, delimiter='-', as_dates=False, interval=CLOSED_CLOSED):
"""
Convert a string to a DateRange type. If you put only one date, it generates the
relevant range for just that date or datetime till 24 hours later. You can optionally
use mixtures of []/() around the DateRange... | [
"Convert",
"a",
"string",
"to",
"a",
"DateRange",
"type",
".",
"If",
"you",
"put",
"only",
"one",
"date",
"it",
"generates",
"the",
"relevant",
"range",
"for",
"just",
"that",
"date",
"or",
"datetime",
"till",
"24",
"hours",
"later",
".",
"You",
"can",
... | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/date/_util.py#L22-L82 | [
"def",
"string_to_daterange",
"(",
"str_range",
",",
"delimiter",
"=",
"'-'",
",",
"as_dates",
"=",
"False",
",",
"interval",
"=",
"CLOSED_CLOSED",
")",
":",
"num_dates",
"=",
"str_range",
".",
"count",
"(",
"delimiter",
")",
"+",
"1",
"if",
"num_dates",
"... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | to_dt | Returns a non-naive datetime.datetime.
Interprets numbers as ms-since-epoch.
Parameters
----------
date : `int` or `datetime.datetime`
The datetime to convert
default_tz : tzinfo
The TimeZone to use if none is found. If not supplied, and the
datetime doesn't have a timezo... | arctic/date/_util.py | def to_dt(date, default_tz=None):
"""
Returns a non-naive datetime.datetime.
Interprets numbers as ms-since-epoch.
Parameters
----------
date : `int` or `datetime.datetime`
The datetime to convert
default_tz : tzinfo
The TimeZone to use if none is found. If not supplied, ... | def to_dt(date, default_tz=None):
"""
Returns a non-naive datetime.datetime.
Interprets numbers as ms-since-epoch.
Parameters
----------
date : `int` or `datetime.datetime`
The datetime to convert
default_tz : tzinfo
The TimeZone to use if none is found. If not supplied, ... | [
"Returns",
"a",
"non",
"-",
"naive",
"datetime",
".",
"datetime",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/date/_util.py#L85-L110 | [
"def",
"to_dt",
"(",
"date",
",",
"default_tz",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"date",
",",
"(",
"int",
",",
"long",
")",
")",
":",
"return",
"ms_to_datetime",
"(",
"date",
",",
"default_tz",
")",
"elif",
"date",
".",
"tzinfo",
"is",... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | to_pandas_closed_closed | Pandas DateRange slicing is CLOSED-CLOSED inclusive at both ends.
Parameters
----------
date_range : `DateRange` object
converted to CLOSED_CLOSED form for Pandas slicing
add_tz : `bool`
Adds a TimeZone to the daterange start and end if it doesn't
have one.
Returns
---... | arctic/date/_util.py | def to_pandas_closed_closed(date_range, add_tz=True):
"""
Pandas DateRange slicing is CLOSED-CLOSED inclusive at both ends.
Parameters
----------
date_range : `DateRange` object
converted to CLOSED_CLOSED form for Pandas slicing
add_tz : `bool`
Adds a TimeZone to the daterange ... | def to_pandas_closed_closed(date_range, add_tz=True):
"""
Pandas DateRange slicing is CLOSED-CLOSED inclusive at both ends.
Parameters
----------
date_range : `DateRange` object
converted to CLOSED_CLOSED form for Pandas slicing
add_tz : `bool`
Adds a TimeZone to the daterange ... | [
"Pandas",
"DateRange",
"slicing",
"is",
"CLOSED",
"-",
"CLOSED",
"inclusive",
"at",
"both",
"ends",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/date/_util.py#L113-L144 | [
"def",
"to_pandas_closed_closed",
"(",
"date_range",
",",
"add_tz",
"=",
"True",
")",
":",
"if",
"not",
"date_range",
":",
"return",
"None",
"start",
"=",
"date_range",
".",
"start",
"end",
"=",
"date_range",
".",
"end",
"if",
"start",
":",
"start",
"=",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | ms_to_datetime | Convert a millisecond time value to an offset-aware Python datetime object. | arctic/date/_util.py | def ms_to_datetime(ms, tzinfo=None):
"""Convert a millisecond time value to an offset-aware Python datetime object."""
if not isinstance(ms, (int, long)):
raise TypeError('expected integer, not %s' % type(ms))
if tzinfo is None:
tzinfo = mktz()
return datetime.datetime.fromtimestamp(ms... | def ms_to_datetime(ms, tzinfo=None):
"""Convert a millisecond time value to an offset-aware Python datetime object."""
if not isinstance(ms, (int, long)):
raise TypeError('expected integer, not %s' % type(ms))
if tzinfo is None:
tzinfo = mktz()
return datetime.datetime.fromtimestamp(ms... | [
"Convert",
"a",
"millisecond",
"time",
"value",
"to",
"an",
"offset",
"-",
"aware",
"Python",
"datetime",
"object",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/date/_util.py#L147-L155 | [
"def",
"ms_to_datetime",
"(",
"ms",
",",
"tzinfo",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"ms",
",",
"(",
"int",
",",
"long",
")",
")",
":",
"raise",
"TypeError",
"(",
"'expected integer, not %s'",
"%",
"type",
"(",
"ms",
")",
")",
"i... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | datetime_to_ms | Convert a Python datetime object to a millisecond epoch (UTC) time value. | arctic/date/_util.py | def datetime_to_ms(d):
"""Convert a Python datetime object to a millisecond epoch (UTC) time value."""
try:
millisecond = d.microsecond // 1000
return calendar.timegm(_add_tzone(d).utctimetuple()) * 1000 + millisecond
except AttributeError:
raise TypeError('expect Python datetime obj... | def datetime_to_ms(d):
"""Convert a Python datetime object to a millisecond epoch (UTC) time value."""
try:
millisecond = d.microsecond // 1000
return calendar.timegm(_add_tzone(d).utctimetuple()) * 1000 + millisecond
except AttributeError:
raise TypeError('expect Python datetime obj... | [
"Convert",
"a",
"Python",
"datetime",
"object",
"to",
"a",
"millisecond",
"epoch",
"(",
"UTC",
")",
"time",
"value",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/date/_util.py#L164-L170 | [
"def",
"datetime_to_ms",
"(",
"d",
")",
":",
"try",
":",
"millisecond",
"=",
"d",
".",
"microsecond",
"//",
"1000",
"return",
"calendar",
".",
"timegm",
"(",
"_add_tzone",
"(",
"d",
")",
".",
"utctimetuple",
"(",
")",
")",
"*",
"1000",
"+",
"millisecon... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | utc_dt_to_local_dt | Convert a UTC datetime to datetime in local timezone | arctic/date/_util.py | def utc_dt_to_local_dt(dtm):
"""Convert a UTC datetime to datetime in local timezone"""
utc_zone = mktz("UTC")
if dtm.tzinfo is not None and dtm.tzinfo != utc_zone:
raise ValueError(
"Expected dtm without tzinfo or with UTC, not %r" % (
dtm.tzinfo
)
)
... | def utc_dt_to_local_dt(dtm):
"""Convert a UTC datetime to datetime in local timezone"""
utc_zone = mktz("UTC")
if dtm.tzinfo is not None and dtm.tzinfo != utc_zone:
raise ValueError(
"Expected dtm without tzinfo or with UTC, not %r" % (
dtm.tzinfo
)
)
... | [
"Convert",
"a",
"UTC",
"datetime",
"to",
"datetime",
"in",
"local",
"timezone"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/date/_util.py#L173-L185 | [
"def",
"utc_dt_to_local_dt",
"(",
"dtm",
")",
":",
"utc_zone",
"=",
"mktz",
"(",
"\"UTC\"",
")",
"if",
"dtm",
".",
"tzinfo",
"is",
"not",
"None",
"and",
"dtm",
".",
"tzinfo",
"!=",
"utc_zone",
":",
"raise",
"ValueError",
"(",
"\"Expected dtm without tzinfo o... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | DateRange.intersection | Create a new DateRange representing the maximal range enclosed by this range and other | arctic/date/_daterange.py | def intersection(self, other):
"""
Create a new DateRange representing the maximal range enclosed by this range and other
"""
startopen = other.startopen if self.start is None \
else self.startopen if other.start is None \
else other.startopen if self.start < othe... | def intersection(self, other):
"""
Create a new DateRange representing the maximal range enclosed by this range and other
"""
startopen = other.startopen if self.start is None \
else self.startopen if other.start is None \
else other.startopen if self.start < othe... | [
"Create",
"a",
"new",
"DateRange",
"representing",
"the",
"maximal",
"range",
"enclosed",
"by",
"this",
"range",
"and",
"other"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/date/_daterange.py#L80-L104 | [
"def",
"intersection",
"(",
"self",
",",
"other",
")",
":",
"startopen",
"=",
"other",
".",
"startopen",
"if",
"self",
".",
"start",
"is",
"None",
"else",
"self",
".",
"startopen",
"if",
"other",
".",
"start",
"is",
"None",
"else",
"other",
".",
"start... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | DateRange.as_dates | Create a new DateRange with the datetimes converted to dates and changing to CLOSED/CLOSED. | arctic/date/_daterange.py | def as_dates(self):
"""
Create a new DateRange with the datetimes converted to dates and changing to CLOSED/CLOSED.
"""
new_start = self.start.date() if self.start and isinstance(self.start, datetime.datetime) else self.start
new_end = self.end.date() if self.end and isinstance(s... | def as_dates(self):
"""
Create a new DateRange with the datetimes converted to dates and changing to CLOSED/CLOSED.
"""
new_start = self.start.date() if self.start and isinstance(self.start, datetime.datetime) else self.start
new_end = self.end.date() if self.end and isinstance(s... | [
"Create",
"a",
"new",
"DateRange",
"with",
"the",
"datetimes",
"converted",
"to",
"dates",
"and",
"changing",
"to",
"CLOSED",
"/",
"CLOSED",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/date/_daterange.py#L106-L112 | [
"def",
"as_dates",
"(",
"self",
")",
":",
"new_start",
"=",
"self",
".",
"start",
".",
"date",
"(",
")",
"if",
"self",
".",
"start",
"and",
"isinstance",
"(",
"self",
".",
"start",
",",
"datetime",
".",
"datetime",
")",
"else",
"self",
".",
"start",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | DateRange.mongo_query | Convert a DateRange into a MongoDb query string. FIXME: Mongo can only handle
datetimes in queries, so we should make this handle the case where start/end are
datetime.date and extend accordingly (being careful about the interval logic). | arctic/date/_daterange.py | def mongo_query(self):
"""
Convert a DateRange into a MongoDb query string. FIXME: Mongo can only handle
datetimes in queries, so we should make this handle the case where start/end are
datetime.date and extend accordingly (being careful about the interval logic).
"""
com... | def mongo_query(self):
"""
Convert a DateRange into a MongoDb query string. FIXME: Mongo can only handle
datetimes in queries, so we should make this handle the case where start/end are
datetime.date and extend accordingly (being careful about the interval logic).
"""
com... | [
"Convert",
"a",
"DateRange",
"into",
"a",
"MongoDb",
"query",
"string",
".",
"FIXME",
":",
"Mongo",
"can",
"only",
"handle",
"datetimes",
"in",
"queries",
"so",
"we",
"should",
"make",
"this",
"handle",
"the",
"case",
"where",
"start",
"/",
"end",
"are",
... | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/date/_daterange.py#L114-L128 | [
"def",
"mongo_query",
"(",
"self",
")",
":",
"comps",
"=",
"{",
"OPEN_CLOSED",
":",
"(",
"'t'",
",",
"'te'",
")",
",",
"OPEN_OPEN",
":",
"(",
"'t'",
",",
"'t'",
")",
",",
"CLOSED_OPEN",
":",
"(",
"'te'",
",",
"'t'",
")",
",",
"CLOSED_CLOSED",
":",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | DateRange.get_date_bounds | Return the upper and lower bounds along
with operators that are needed to do an 'in range' test.
Useful for SQL commands.
Returns
-------
tuple: (`str`, `date`, `str`, `date`)
(date_gt, start, date_lt, end)
e.g.:
('>=', start_date, '<', en... | arctic/date/_daterange.py | def get_date_bounds(self):
"""
Return the upper and lower bounds along
with operators that are needed to do an 'in range' test.
Useful for SQL commands.
Returns
-------
tuple: (`str`, `date`, `str`, `date`)
(date_gt, start, date_lt, end)
e... | def get_date_bounds(self):
"""
Return the upper and lower bounds along
with operators that are needed to do an 'in range' test.
Useful for SQL commands.
Returns
-------
tuple: (`str`, `date`, `str`, `date`)
(date_gt, start, date_lt, end)
e... | [
"Return",
"the",
"upper",
"and",
"lower",
"bounds",
"along",
"with",
"operators",
"that",
"are",
"needed",
"to",
"do",
"an",
"in",
"range",
"test",
".",
"Useful",
"for",
"SQL",
"commands",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/date/_daterange.py#L130-L156 | [
"def",
"get_date_bounds",
"(",
"self",
")",
":",
"start",
"=",
"end",
"=",
"None",
"date_gt",
"=",
"'>='",
"date_lt",
"=",
"'<='",
"if",
"self",
":",
"if",
"self",
".",
"start",
":",
"start",
"=",
"self",
".",
"start",
"if",
"self",
".",
"end",
":"... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | DateChunker.to_chunks | chunks the dataframe/series by dates
Parameters
----------
df: pandas dataframe or series
chunk_size: str
any valid Pandas frequency string
func: function
func will be applied to each `chunk` generated by the chunker.
This function CANNOT modi... | arctic/chunkstore/date_chunker.py | def to_chunks(self, df, chunk_size='D', func=None, **kwargs):
"""
chunks the dataframe/series by dates
Parameters
----------
df: pandas dataframe or series
chunk_size: str
any valid Pandas frequency string
func: function
func will be appli... | def to_chunks(self, df, chunk_size='D', func=None, **kwargs):
"""
chunks the dataframe/series by dates
Parameters
----------
df: pandas dataframe or series
chunk_size: str
any valid Pandas frequency string
func: function
func will be appli... | [
"chunks",
"the",
"dataframe",
"/",
"series",
"by",
"dates"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/chunkstore/date_chunker.py#L10-L55 | [
"def",
"to_chunks",
"(",
"self",
",",
"df",
",",
"chunk_size",
"=",
"'D'",
",",
"func",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'date'",
"in",
"df",
".",
"index",
".",
"names",
":",
"dates",
"=",
"df",
".",
"index",
".",
"get_level... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | DateChunker.to_mongo | takes the range object used for this chunker type
and converts it into a string that can be use for a
mongo query that filters by the range
returns
-------
dict | arctic/chunkstore/date_chunker.py | def to_mongo(self, range_obj):
"""
takes the range object used for this chunker type
and converts it into a string that can be use for a
mongo query that filters by the range
returns
-------
dict
"""
if isinstance(range_obj, (pd.DatetimeIndex, tup... | def to_mongo(self, range_obj):
"""
takes the range object used for this chunker type
and converts it into a string that can be use for a
mongo query that filters by the range
returns
-------
dict
"""
if isinstance(range_obj, (pd.DatetimeIndex, tup... | [
"takes",
"the",
"range",
"object",
"used",
"for",
"this",
"chunker",
"type",
"and",
"converts",
"it",
"into",
"a",
"string",
"that",
"can",
"be",
"use",
"for",
"a",
"mongo",
"query",
"that",
"filters",
"by",
"the",
"range"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/chunkstore/date_chunker.py#L80-L99 | [
"def",
"to_mongo",
"(",
"self",
",",
"range_obj",
")",
":",
"if",
"isinstance",
"(",
"range_obj",
",",
"(",
"pd",
".",
"DatetimeIndex",
",",
"tuple",
")",
")",
":",
"range_obj",
"=",
"DateRange",
"(",
"range_obj",
"[",
"0",
"]",
",",
"range_obj",
"[",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | DateChunker.filter | ensures data is properly subset to the range in range_obj.
(Depending on how the chunking is implemented, it might be possible
to specify a chunk range that reads out more than the actual range
eg: date range, chunked monthly. read out 2016-01-01 to 2016-01-02.
This will read ALL of Janu... | arctic/chunkstore/date_chunker.py | def filter(self, data, range_obj):
"""
ensures data is properly subset to the range in range_obj.
(Depending on how the chunking is implemented, it might be possible
to specify a chunk range that reads out more than the actual range
eg: date range, chunked monthly. read out 2016-... | def filter(self, data, range_obj):
"""
ensures data is properly subset to the range in range_obj.
(Depending on how the chunking is implemented, it might be possible
to specify a chunk range that reads out more than the actual range
eg: date range, chunked monthly. read out 2016-... | [
"ensures",
"data",
"is",
"properly",
"subset",
"to",
"the",
"range",
"in",
"range_obj",
".",
"(",
"Depending",
"on",
"how",
"the",
"chunking",
"is",
"implemented",
"it",
"might",
"be",
"possible",
"to",
"specify",
"a",
"chunk",
"range",
"that",
"reads",
"o... | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/chunkstore/date_chunker.py#L101-L133 | [
"def",
"filter",
"(",
"self",
",",
"data",
",",
"range_obj",
")",
":",
"if",
"isinstance",
"(",
"range_obj",
",",
"(",
"pd",
".",
"DatetimeIndex",
",",
"tuple",
")",
")",
":",
"range_obj",
"=",
"DateRange",
"(",
"range_obj",
"[",
"0",
"]",
",",
"rang... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | DateChunker.exclude | Removes data within the bounds of the range object (inclusive)
returns
-------
data, filtered by range_obj | arctic/chunkstore/date_chunker.py | def exclude(self, data, range_obj):
"""
Removes data within the bounds of the range object (inclusive)
returns
-------
data, filtered by range_obj
"""
if isinstance(range_obj, (pd.DatetimeIndex, tuple)):
range_obj = DateRange(range_obj[0], range_obj[-... | def exclude(self, data, range_obj):
"""
Removes data within the bounds of the range object (inclusive)
returns
-------
data, filtered by range_obj
"""
if isinstance(range_obj, (pd.DatetimeIndex, tuple)):
range_obj = DateRange(range_obj[0], range_obj[-... | [
"Removes",
"data",
"within",
"the",
"bounds",
"of",
"the",
"range",
"object",
"(",
"inclusive",
")"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/chunkstore/date_chunker.py#L135-L150 | [
"def",
"exclude",
"(",
"self",
",",
"data",
",",
"range_obj",
")",
":",
"if",
"isinstance",
"(",
"range_obj",
",",
"(",
"pd",
".",
"DatetimeIndex",
",",
"tuple",
")",
")",
":",
"range_obj",
"=",
"DateRange",
"(",
"range_obj",
"[",
"0",
"]",
",",
"ran... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | enable_sharding | Enable sharding on a library
Parameters:
-----------
arctic: `arctic.Arctic` Arctic class
library_name: `basestring` library name
hashed: `bool` if True, use hashed sharding, if False, use range sharding
See https://docs.mongodb.com/manual/core/hashed-sharding/,
as well as... | arctic/_util.py | def enable_sharding(arctic, library_name, hashed=True, key='symbol'):
"""
Enable sharding on a library
Parameters:
-----------
arctic: `arctic.Arctic` Arctic class
library_name: `basestring` library name
hashed: `bool` if True, use hashed sharding, if False, use range sharding
... | def enable_sharding(arctic, library_name, hashed=True, key='symbol'):
"""
Enable sharding on a library
Parameters:
-----------
arctic: `arctic.Arctic` Arctic class
library_name: `basestring` library name
hashed: `bool` if True, use hashed sharding, if False, use range sharding
... | [
"Enable",
"sharding",
"on",
"a",
"library"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/_util.py#L47-L79 | [
"def",
"enable_sharding",
"(",
"arctic",
",",
"library_name",
",",
"hashed",
"=",
"True",
",",
"key",
"=",
"'symbol'",
")",
":",
"c",
"=",
"arctic",
".",
"_conn",
"lib",
"=",
"arctic",
"[",
"library_name",
"]",
".",
"_arctic_lib",
"dbname",
"=",
"lib",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | BSONStore.insert_one | See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.insert_one | arctic/store/bson_store.py | def insert_one(self, document, **kwargs):
"""
See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.insert_one
"""
self._arctic_lib.check_quota()
return self._collection.insert_one(document, **kwargs) | def insert_one(self, document, **kwargs):
"""
See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.insert_one
"""
self._arctic_lib.check_quota()
return self._collection.insert_one(document, **kwargs) | [
"See",
"http",
":",
"//",
"api",
".",
"mongodb",
".",
"com",
"/",
"python",
"/",
"current",
"/",
"api",
"/",
"pymongo",
"/",
"collection",
".",
"html#pymongo",
".",
"collection",
".",
"Collection",
".",
"insert_one"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/bson_store.py#L83-L88 | [
"def",
"insert_one",
"(",
"self",
",",
"document",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_arctic_lib",
".",
"check_quota",
"(",
")",
"return",
"self",
".",
"_collection",
".",
"insert_one",
"(",
"document",
",",
"*",
"*",
"kwargs",
")"
] | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | BSONStore.insert_many | See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.insert_many | arctic/store/bson_store.py | def insert_many(self, documents, **kwargs):
"""
See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.insert_many
"""
self._arctic_lib.check_quota()
return self._collection.insert_many(documents, **kwargs) | def insert_many(self, documents, **kwargs):
"""
See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.insert_many
"""
self._arctic_lib.check_quota()
return self._collection.insert_many(documents, **kwargs) | [
"See",
"http",
":",
"//",
"api",
".",
"mongodb",
".",
"com",
"/",
"python",
"/",
"current",
"/",
"api",
"/",
"pymongo",
"/",
"collection",
".",
"html#pymongo",
".",
"collection",
".",
"Collection",
".",
"insert_many"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/bson_store.py#L91-L96 | [
"def",
"insert_many",
"(",
"self",
",",
"documents",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_arctic_lib",
".",
"check_quota",
"(",
")",
"return",
"self",
".",
"_collection",
".",
"insert_many",
"(",
"documents",
",",
"*",
"*",
"kwargs",
")"
] | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | BSONStore.update_one | See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.update_one | arctic/store/bson_store.py | def update_one(self, filter, update, **kwargs):
"""
See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.update_one
"""
self._arctic_lib.check_quota()
return self._collection.update_one(filter, update, **kwargs) | def update_one(self, filter, update, **kwargs):
"""
See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.update_one
"""
self._arctic_lib.check_quota()
return self._collection.update_one(filter, update, **kwargs) | [
"See",
"http",
":",
"//",
"api",
".",
"mongodb",
".",
"com",
"/",
"python",
"/",
"current",
"/",
"api",
"/",
"pymongo",
"/",
"collection",
".",
"html#pymongo",
".",
"collection",
".",
"Collection",
".",
"update_one"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/bson_store.py#L112-L117 | [
"def",
"update_one",
"(",
"self",
",",
"filter",
",",
"update",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_arctic_lib",
".",
"check_quota",
"(",
")",
"return",
"self",
".",
"_collection",
".",
"update_one",
"(",
"filter",
",",
"update",
",",
"*"... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | BSONStore.update_many | See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.update_many | arctic/store/bson_store.py | def update_many(self, filter, update, **kwargs):
"""
See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.update_many
"""
self._arctic_lib.check_quota()
return self._collection.update_many(filter, update, **kwargs) | def update_many(self, filter, update, **kwargs):
"""
See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.update_many
"""
self._arctic_lib.check_quota()
return self._collection.update_many(filter, update, **kwargs) | [
"See",
"http",
":",
"//",
"api",
".",
"mongodb",
".",
"com",
"/",
"python",
"/",
"current",
"/",
"api",
"/",
"pymongo",
"/",
"collection",
".",
"html#pymongo",
".",
"collection",
".",
"Collection",
".",
"update_many"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/bson_store.py#L120-L125 | [
"def",
"update_many",
"(",
"self",
",",
"filter",
",",
"update",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_arctic_lib",
".",
"check_quota",
"(",
")",
"return",
"self",
".",
"_collection",
".",
"update_many",
"(",
"filter",
",",
"update",
",",
"... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | BSONStore.replace_one | See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.replace_one | arctic/store/bson_store.py | def replace_one(self, filter, replacement, **kwargs):
"""
See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.replace_one
"""
self._arctic_lib.check_quota()
return self._collection.replace_one(filter, replacement, **kwargs) | def replace_one(self, filter, replacement, **kwargs):
"""
See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.replace_one
"""
self._arctic_lib.check_quota()
return self._collection.replace_one(filter, replacement, **kwargs) | [
"See",
"http",
":",
"//",
"api",
".",
"mongodb",
".",
"com",
"/",
"python",
"/",
"current",
"/",
"api",
"/",
"pymongo",
"/",
"collection",
".",
"html#pymongo",
".",
"collection",
".",
"Collection",
".",
"replace_one"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/bson_store.py#L128-L133 | [
"def",
"replace_one",
"(",
"self",
",",
"filter",
",",
"replacement",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_arctic_lib",
".",
"check_quota",
"(",
")",
"return",
"self",
".",
"_collection",
".",
"replace_one",
"(",
"filter",
",",
"replacement",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | BSONStore.find_one_and_replace | See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.find_one_and_replace | arctic/store/bson_store.py | def find_one_and_replace(self, filter, replacement, **kwargs):
"""
See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.find_one_and_replace
"""
self._arctic_lib.check_quota()
return self._collection.find_one_and_replace(filter, repl... | def find_one_and_replace(self, filter, replacement, **kwargs):
"""
See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.find_one_and_replace
"""
self._arctic_lib.check_quota()
return self._collection.find_one_and_replace(filter, repl... | [
"See",
"http",
":",
"//",
"api",
".",
"mongodb",
".",
"com",
"/",
"python",
"/",
"current",
"/",
"api",
"/",
"pymongo",
"/",
"collection",
".",
"html#pymongo",
".",
"collection",
".",
"Collection",
".",
"find_one_and_replace"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/bson_store.py#L136-L141 | [
"def",
"find_one_and_replace",
"(",
"self",
",",
"filter",
",",
"replacement",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_arctic_lib",
".",
"check_quota",
"(",
")",
"return",
"self",
".",
"_collection",
".",
"find_one_and_replace",
"(",
"filter",
",",... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | BSONStore.find_one_and_update | See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.find_one_and_update | arctic/store/bson_store.py | def find_one_and_update(self, filter, update, **kwargs):
"""
See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.find_one_and_update
"""
self._arctic_lib.check_quota()
return self._collection.find_one_and_update(filter, update, **kw... | def find_one_and_update(self, filter, update, **kwargs):
"""
See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.find_one_and_update
"""
self._arctic_lib.check_quota()
return self._collection.find_one_and_update(filter, update, **kw... | [
"See",
"http",
":",
"//",
"api",
".",
"mongodb",
".",
"com",
"/",
"python",
"/",
"current",
"/",
"api",
"/",
"pymongo",
"/",
"collection",
".",
"html#pymongo",
".",
"collection",
".",
"Collection",
".",
"find_one_and_update"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/bson_store.py#L144-L149 | [
"def",
"find_one_and_update",
"(",
"self",
",",
"filter",
",",
"update",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_arctic_lib",
".",
"check_quota",
"(",
")",
"return",
"self",
".",
"_collection",
".",
"find_one_and_update",
"(",
"filter",
",",
"upd... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | BSONStore.bulk_write | See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.bulk_write
Warning: this is wrapped in mongo_retry, and is therefore potentially unsafe if the write you want to execute
isn't idempotent. | arctic/store/bson_store.py | def bulk_write(self, requests, **kwargs):
"""
See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.bulk_write
Warning: this is wrapped in mongo_retry, and is therefore potentially unsafe if the write you want to execute
isn't idempotent.
... | def bulk_write(self, requests, **kwargs):
"""
See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.bulk_write
Warning: this is wrapped in mongo_retry, and is therefore potentially unsafe if the write you want to execute
isn't idempotent.
... | [
"See",
"http",
":",
"//",
"api",
".",
"mongodb",
".",
"com",
"/",
"python",
"/",
"current",
"/",
"api",
"/",
"pymongo",
"/",
"collection",
".",
"html#pymongo",
".",
"collection",
".",
"Collection",
".",
"bulk_write"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/bson_store.py#L158-L166 | [
"def",
"bulk_write",
"(",
"self",
",",
"requests",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_arctic_lib",
".",
"check_quota",
"(",
")",
"return",
"self",
".",
"_collection",
".",
"bulk_write",
"(",
"requests",
",",
"*",
"*",
"kwargs",
")"
] | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | BSONStore.count | See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.count | arctic/store/bson_store.py | def count(self, filter, **kwargs):
"""
See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.count
"""
return mongo_count(self._collection, filter=filter, **kwargs) | def count(self, filter, **kwargs):
"""
See http://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.count
"""
return mongo_count(self._collection, filter=filter, **kwargs) | [
"See",
"http",
":",
"//",
"api",
".",
"mongodb",
".",
"com",
"/",
"python",
"/",
"current",
"/",
"api",
"/",
"pymongo",
"/",
"collection",
".",
"html#pymongo",
".",
"collection",
".",
"Collection",
".",
"count"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/bson_store.py#L169-L173 | [
"def",
"count",
"(",
"self",
",",
"filter",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"mongo_count",
"(",
"self",
".",
"_collection",
",",
"filter",
"=",
"filter",
",",
"*",
"*",
"kwargs",
")"
] | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | mktz | Return a new timezone (tzinfo object) based on the zone using the python-dateutil
package.
The concise name 'mktz' is for convenient when using it on the
console.
Parameters
----------
zone : `String`
The zone for the timezone. This defaults to local, returning:
tzlocal.g... | arctic/date/_mktz.py | def mktz(zone=None):
"""
Return a new timezone (tzinfo object) based on the zone using the python-dateutil
package.
The concise name 'mktz' is for convenient when using it on the
console.
Parameters
----------
zone : `String`
The zone for the timezone. This defaults to local... | def mktz(zone=None):
"""
Return a new timezone (tzinfo object) based on the zone using the python-dateutil
package.
The concise name 'mktz' is for convenient when using it on the
console.
Parameters
----------
zone : `String`
The zone for the timezone. This defaults to local... | [
"Return",
"a",
"new",
"timezone",
"(",
"tzinfo",
"object",
")",
"based",
"on",
"the",
"zone",
"using",
"the",
"python",
"-",
"dateutil",
"package",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/date/_mktz.py#L10-L45 | [
"def",
"mktz",
"(",
"zone",
"=",
"None",
")",
":",
"if",
"zone",
"is",
"None",
":",
"zone",
"=",
"tzlocal",
".",
"get_localzone",
"(",
")",
".",
"zone",
"zone",
"=",
"six",
".",
"u",
"(",
"zone",
")",
"tz",
"=",
"dateutil",
".",
"tz",
".",
"get... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | segment_id_repair | Ensure that symbol(s) have contiguous segment ids
Parameters
----------
library: arctic library
symbol: None, str, list of str
None: all symbols
str: single symbol
list: list of symbols
Returns
-------
list of str - Symbols 'fixed' | arctic/chunkstore/tools/tools.py | def segment_id_repair(library, symbol=None):
"""
Ensure that symbol(s) have contiguous segment ids
Parameters
----------
library: arctic library
symbol: None, str, list of str
None: all symbols
str: single symbol
list: list of symbols
Returns
-------
list of... | def segment_id_repair(library, symbol=None):
"""
Ensure that symbol(s) have contiguous segment ids
Parameters
----------
library: arctic library
symbol: None, str, list of str
None: all symbols
str: single symbol
list: list of symbols
Returns
-------
list of... | [
"Ensure",
"that",
"symbol",
"(",
"s",
")",
"have",
"contiguous",
"segment",
"ids"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/chunkstore/tools/tools.py#L8-L49 | [
"def",
"segment_id_repair",
"(",
"library",
",",
"symbol",
"=",
"None",
")",
":",
"ret",
"=",
"[",
"]",
"if",
"symbol",
"is",
"None",
":",
"symbol",
"=",
"library",
".",
"list_symbols",
"(",
")",
"elif",
"not",
"isinstance",
"(",
"symbol",
",",
"list",... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | multicolumn_store_with_uncompressed_write | The database state created by this fixture is equivalent to the following operations using arctic 1.40
or previous:
arctic.initialize_library('arctic_test.TEST', m.VERSION_STORE, segment='month')
library = arctic.get_library('arctic_test.TEST')
df = pd.DataFrame([[1,2], [3,4]], index=['x','... | arctic/fixtures/arctic.py | def multicolumn_store_with_uncompressed_write(mongo_server):
"""
The database state created by this fixture is equivalent to the following operations using arctic 1.40
or previous:
arctic.initialize_library('arctic_test.TEST', m.VERSION_STORE, segment='month')
library = arctic.get_library('... | def multicolumn_store_with_uncompressed_write(mongo_server):
"""
The database state created by this fixture is equivalent to the following operations using arctic 1.40
or previous:
arctic.initialize_library('arctic_test.TEST', m.VERSION_STORE, segment='month')
library = arctic.get_library('... | [
"The",
"database",
"state",
"created",
"by",
"this",
"fixture",
"is",
"equivalent",
"to",
"the",
"following",
"operations",
"using",
"arctic",
"1",
".",
"40",
"or",
"previous",
":"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/fixtures/arctic.py#L40-L123 | [
"def",
"multicolumn_store_with_uncompressed_write",
"(",
"mongo_server",
")",
":",
"mongo_server",
".",
"api",
".",
"drop_database",
"(",
"'arctic_test'",
")",
"library_name",
"=",
"'arctic_test.TEST'",
"arctic",
"=",
"m",
".",
"Arctic",
"(",
"mongo_host",
"=",
"mon... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | ndarray_store_with_uncompressed_write | The database state created by this fixture is equivalent to the following operations using arctic 1.40
or previous:
arctic.initialize_library('arctic_test.TEST', m.VERSION_STORE, segment='month')
library = arctic.get_library('arctic_test.TEST')
arr = np.arange(2).astype([('abc', 'int64')])
... | arctic/fixtures/arctic.py | def ndarray_store_with_uncompressed_write(mongo_server):
"""
The database state created by this fixture is equivalent to the following operations using arctic 1.40
or previous:
arctic.initialize_library('arctic_test.TEST', m.VERSION_STORE, segment='month')
library = arctic.get_library('arct... | def ndarray_store_with_uncompressed_write(mongo_server):
"""
The database state created by this fixture is equivalent to the following operations using arctic 1.40
or previous:
arctic.initialize_library('arctic_test.TEST', m.VERSION_STORE, segment='month')
library = arctic.get_library('arct... | [
"The",
"database",
"state",
"created",
"by",
"this",
"fixture",
"is",
"equivalent",
"to",
"the",
"following",
"operations",
"using",
"arctic",
"1",
".",
"40",
"or",
"previous",
":"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/fixtures/arctic.py#L127-L205 | [
"def",
"ndarray_store_with_uncompressed_write",
"(",
"mongo_server",
")",
":",
"mongo_server",
".",
"api",
".",
"drop_database",
"(",
"'arctic_test'",
")",
"library_name",
"=",
"'arctic_test.TEST'",
"arctic",
"=",
"m",
".",
"Arctic",
"(",
"mongo_host",
"=",
"mongo_s... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | VersionStore.list_symbols | Return the symbols in this library.
Parameters
----------
all_symbols : `bool`
If True returns all symbols under all snapshots, even if the symbol has been deleted
in the current version (i.e. it exists under a snapshot... Default: False
snapshot : `str`
... | arctic/store/version_store.py | def list_symbols(self, all_symbols=False, snapshot=None, regex=None, **kwargs):
"""
Return the symbols in this library.
Parameters
----------
all_symbols : `bool`
If True returns all symbols under all snapshots, even if the symbol has been deleted
in the ... | def list_symbols(self, all_symbols=False, snapshot=None, regex=None, **kwargs):
"""
Return the symbols in this library.
Parameters
----------
all_symbols : `bool`
If True returns all symbols under all snapshots, even if the symbol has been deleted
in the ... | [
"Return",
"the",
"symbols",
"in",
"this",
"library",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/version_store.py#L129-L198 | [
"def",
"list_symbols",
"(",
"self",
",",
"all_symbols",
"=",
"False",
",",
"snapshot",
"=",
"None",
",",
"regex",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"query",
"=",
"{",
"}",
"if",
"regex",
"is",
"not",
"None",
":",
"query",
"[",
"'symbo... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | VersionStore.has_symbol | Return True if the 'symbol' exists in this library AND the symbol
isn't deleted in the specified as_of.
It's possible for a deleted symbol to exist in older snapshots.
Parameters
----------
symbol : `str`
symbol name for the item
as_of : `str` or int or `dat... | arctic/store/version_store.py | def has_symbol(self, symbol, as_of=None):
"""
Return True if the 'symbol' exists in this library AND the symbol
isn't deleted in the specified as_of.
It's possible for a deleted symbol to exist in older snapshots.
Parameters
----------
symbol : `str`
... | def has_symbol(self, symbol, as_of=None):
"""
Return True if the 'symbol' exists in this library AND the symbol
isn't deleted in the specified as_of.
It's possible for a deleted symbol to exist in older snapshots.
Parameters
----------
symbol : `str`
... | [
"Return",
"True",
"if",
"the",
"symbol",
"exists",
"in",
"this",
"library",
"AND",
"the",
"symbol",
"isn",
"t",
"deleted",
"in",
"the",
"specified",
"as_of",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/version_store.py#L201-L223 | [
"def",
"has_symbol",
"(",
"self",
",",
"symbol",
",",
"as_of",
"=",
"None",
")",
":",
"try",
":",
"# Always use the primary for has_symbol, it's safer",
"self",
".",
"_read_metadata",
"(",
"symbol",
",",
"as_of",
"=",
"as_of",
",",
"read_preference",
"=",
"ReadP... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | VersionStore.read_audit_log | Return the audit log associated with a given symbol
Parameters
----------
symbol : `str`
symbol name for the item | arctic/store/version_store.py | def read_audit_log(self, symbol=None, message=None):
"""
Return the audit log associated with a given symbol
Parameters
----------
symbol : `str`
symbol name for the item
"""
query = {}
if symbol:
if isinstance(symbol, six.string_t... | def read_audit_log(self, symbol=None, message=None):
"""
Return the audit log associated with a given symbol
Parameters
----------
symbol : `str`
symbol name for the item
"""
query = {}
if symbol:
if isinstance(symbol, six.string_t... | [
"Return",
"the",
"audit",
"log",
"associated",
"with",
"a",
"given",
"symbol"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/version_store.py#L225-L248 | [
"def",
"read_audit_log",
"(",
"self",
",",
"symbol",
"=",
"None",
",",
"message",
"=",
"None",
")",
":",
"query",
"=",
"{",
"}",
"if",
"symbol",
":",
"if",
"isinstance",
"(",
"symbol",
",",
"six",
".",
"string_types",
")",
":",
"query",
"[",
"'symbol... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | VersionStore.list_versions | Return a list of versions filtered by the passed in parameters.
Parameters
----------
symbol : `str`
Symbol to return versions for. If None returns versions across all
symbols in the library.
snapshot : `str`
Return the versions contained in the name... | arctic/store/version_store.py | def list_versions(self, symbol=None, snapshot=None, latest_only=False):
"""
Return a list of versions filtered by the passed in parameters.
Parameters
----------
symbol : `str`
Symbol to return versions for. If None returns versions across all
symbols in... | def list_versions(self, symbol=None, snapshot=None, latest_only=False):
"""
Return a list of versions filtered by the passed in parameters.
Parameters
----------
symbol : `str`
Symbol to return versions for. If None returns versions across all
symbols in... | [
"Return",
"a",
"list",
"of",
"versions",
"filtered",
"by",
"the",
"passed",
"in",
"parameters",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/version_store.py#L250-L296 | [
"def",
"list_versions",
"(",
"self",
",",
"symbol",
"=",
"None",
",",
"snapshot",
"=",
"None",
",",
"latest_only",
"=",
"False",
")",
":",
"if",
"symbol",
"is",
"None",
":",
"symbols",
"=",
"self",
".",
"list_symbols",
"(",
"snapshot",
"=",
"snapshot",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | VersionStore.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
as_of : `str` or `int` or `datetime.datetime`
Return the data as it was a... | arctic/store/version_store.py | def read(self, symbol, as_of=None, date_range=None, from_version=None, allow_secondary=None, **kwargs):
"""
Read data for the named symbol. Returns a VersionedItem object with
a data and metdata element (as passed into write).
Parameters
----------
symbol : `str`
... | def read(self, symbol, as_of=None, date_range=None, from_version=None, allow_secondary=None, **kwargs):
"""
Read data for the named symbol. Returns a VersionedItem object with
a data and metdata element (as passed into write).
Parameters
----------
symbol : `str`
... | [
"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/store/version_store.py#L338-L383 | [
"def",
"read",
"(",
"self",
",",
"symbol",
",",
"as_of",
"=",
"None",
",",
"date_range",
"=",
"None",
",",
"from_version",
"=",
"None",
",",
"allow_secondary",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"read_preference",
"=",
"self",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | VersionStore.get_info | Reads and returns information about the data stored for symbol
Parameters
----------
symbol : `str`
symbol name for the item
as_of : `str` or int or `datetime.datetime`
Return the data as it was as_of the point in time.
`int` : specific version number... | arctic/store/version_store.py | def get_info(self, symbol, as_of=None):
"""
Reads and returns information about the data stored for symbol
Parameters
----------
symbol : `str`
symbol name for the item
as_of : `str` or int or `datetime.datetime`
Return the data as it was as_of th... | def get_info(self, symbol, as_of=None):
"""
Reads and returns information about the data stored for symbol
Parameters
----------
symbol : `str`
symbol name for the item
as_of : `str` or int or `datetime.datetime`
Return the data as it was as_of th... | [
"Reads",
"and",
"returns",
"information",
"about",
"the",
"data",
"stored",
"for",
"symbol"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/version_store.py#L386-L408 | [
"def",
"get_info",
"(",
"self",
",",
"symbol",
",",
"as_of",
"=",
"None",
")",
":",
"version",
"=",
"self",
".",
"_read_metadata",
"(",
"symbol",
",",
"as_of",
"=",
"as_of",
",",
"read_preference",
"=",
"None",
")",
"handler",
"=",
"self",
".",
"_read_... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | VersionStore.get_arctic_version | Return the numerical representation of the arctic version used to write the last (or as_of) version for
the given symbol.
Parameters
----------
symbol : `str`
symbol name for the item
as_of : `str` or int or `datetime.datetime`
Return the data as it was a... | arctic/store/version_store.py | def get_arctic_version(self, symbol, as_of=None):
"""
Return the numerical representation of the arctic version used to write the last (or as_of) version for
the given symbol.
Parameters
----------
symbol : `str`
symbol name for the item
as_of : `str`... | def get_arctic_version(self, symbol, as_of=None):
"""
Return the numerical representation of the arctic version used to write the last (or as_of) version for
the given symbol.
Parameters
----------
symbol : `str`
symbol name for the item
as_of : `str`... | [
"Return",
"the",
"numerical",
"representation",
"of",
"the",
"arctic",
"version",
"used",
"to",
"write",
"the",
"last",
"(",
"or",
"as_of",
")",
"version",
"for",
"the",
"given",
"symbol",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/version_store.py#L420-L440 | [
"def",
"get_arctic_version",
"(",
"self",
",",
"symbol",
",",
"as_of",
"=",
"None",
")",
":",
"return",
"self",
".",
"_read_metadata",
"(",
"symbol",
",",
"as_of",
"=",
"as_of",
")",
".",
"get",
"(",
"'arctic_version'",
",",
"0",
")"
] | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | VersionStore.read_metadata | Return the metadata saved for a symbol. This method is fast as it doesn't
actually load the data.
Parameters
----------
symbol : `str`
symbol name for the item
as_of : `str` or int or `datetime.datetime`
Return the data as it was as_of the point in time.... | arctic/store/version_store.py | def read_metadata(self, symbol, as_of=None, allow_secondary=None):
"""
Return the metadata saved for a symbol. This method is fast as it doesn't
actually load the data.
Parameters
----------
symbol : `str`
symbol name for the item
as_of : `str` or in... | def read_metadata(self, symbol, as_of=None, allow_secondary=None):
"""
Return the metadata saved for a symbol. This method is fast as it doesn't
actually load the data.
Parameters
----------
symbol : `str`
symbol name for the item
as_of : `str` or in... | [
"Return",
"the",
"metadata",
"saved",
"for",
"a",
"symbol",
".",
"This",
"method",
"is",
"fast",
"as",
"it",
"doesn",
"t",
"actually",
"load",
"the",
"data",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/version_store.py#L460-L483 | [
"def",
"read_metadata",
"(",
"self",
",",
"symbol",
",",
"as_of",
"=",
"None",
",",
"allow_secondary",
"=",
"None",
")",
":",
"_version",
"=",
"self",
".",
"_read_metadata",
"(",
"symbol",
",",
"as_of",
"=",
"as_of",
",",
"read_preference",
"=",
"self",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | VersionStore.append | Append 'data' under the specified 'symbol' name to this library.
The exact meaning of 'append' is left up to the underlying store implementation.
Parameters
----------
symbol : `str`
symbol name for the item
data :
to be persisted
metadata : `dict... | arctic/store/version_store.py | def append(self, symbol, data, metadata=None, prune_previous_version=True, upsert=True, **kwargs):
"""
Append 'data' under the specified 'symbol' name to this library.
The exact meaning of 'append' is left up to the underlying store implementation.
Parameters
----------
... | def append(self, symbol, data, metadata=None, prune_previous_version=True, upsert=True, **kwargs):
"""
Append 'data' under the specified 'symbol' name to this library.
The exact meaning of 'append' is left up to the underlying store implementation.
Parameters
----------
... | [
"Append",
"data",
"under",
"the",
"specified",
"symbol",
"name",
"to",
"this",
"library",
".",
"The",
"exact",
"meaning",
"of",
"append",
"is",
"left",
"up",
"to",
"the",
"underlying",
"store",
"implementation",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/version_store.py#L535-L618 | [
"def",
"append",
"(",
"self",
",",
"symbol",
",",
"data",
",",
"metadata",
"=",
"None",
",",
"prune_previous_version",
"=",
"True",
",",
"upsert",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_arctic_lib",
".",
"check_quota",
"(",
")",... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | VersionStore.write | Write 'data' under the specified 'symbol' name to this library.
Parameters
----------
symbol : `str`
symbol name for the item
data :
to be persisted
metadata : `dict`
an optional dictionary of metadata to persist along with the symbol.
... | arctic/store/version_store.py | def write(self, symbol, data, metadata=None, prune_previous_version=True, **kwargs):
"""
Write 'data' under the specified 'symbol' name to this library.
Parameters
----------
symbol : `str`
symbol name for the item
data :
to be persisted
m... | def write(self, symbol, data, metadata=None, prune_previous_version=True, **kwargs):
"""
Write 'data' under the specified 'symbol' name to this library.
Parameters
----------
symbol : `str`
symbol name for the item
data :
to be persisted
m... | [
"Write",
"data",
"under",
"the",
"specified",
"symbol",
"name",
"to",
"this",
"library",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/version_store.py#L621-L670 | [
"def",
"write",
"(",
"self",
",",
"symbol",
",",
"data",
",",
"metadata",
"=",
"None",
",",
"prune_previous_version",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_arctic_lib",
".",
"check_quota",
"(",
")",
"version",
"=",
"{",
"'_id'"... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | VersionStore.write_metadata | Write 'metadata' under the specified 'symbol' name to this library.
The data will remain unchanged. A new version will be created.
If the symbol is missing, it causes a write with empty data (None, pickled, can't append)
and the supplied metadata.
Returns a VersionedItem object only with... | arctic/store/version_store.py | def write_metadata(self, symbol, metadata, prune_previous_version=True, **kwargs):
"""
Write 'metadata' under the specified 'symbol' name to this library.
The data will remain unchanged. A new version will be created.
If the symbol is missing, it causes a write with empty data (None, pic... | def write_metadata(self, symbol, metadata, prune_previous_version=True, **kwargs):
"""
Write 'metadata' under the specified 'symbol' name to this library.
The data will remain unchanged. A new version will be created.
If the symbol is missing, it causes a write with empty data (None, pic... | [
"Write",
"metadata",
"under",
"the",
"specified",
"symbol",
"name",
"to",
"this",
"library",
".",
"The",
"data",
"will",
"remain",
"unchanged",
".",
"A",
"new",
"version",
"will",
"be",
"created",
".",
"If",
"the",
"symbol",
"is",
"missing",
"it",
"causes"... | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/version_store.py#L716-L761 | [
"def",
"write_metadata",
"(",
"self",
",",
"symbol",
",",
"metadata",
",",
"prune_previous_version",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"# Make a normal write with empty data and supplied metadata if symbol does not exist",
"try",
":",
"previous_version",
"="... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | VersionStore.restore_version | Restore the specified 'symbol' data and metadata to the state of a given version/snapshot/date.
Returns a VersionedItem object only with a metadata element.
Fast operation: Zero data/segment read/write operations.
Parameters
----------
symbol : `str`
symbol name for ... | arctic/store/version_store.py | def restore_version(self, symbol, as_of, prune_previous_version=True):
"""
Restore the specified 'symbol' data and metadata to the state of a given version/snapshot/date.
Returns a VersionedItem object only with a metadata element.
Fast operation: Zero data/segment read/write operations.... | def restore_version(self, symbol, as_of, prune_previous_version=True):
"""
Restore the specified 'symbol' data and metadata to the state of a given version/snapshot/date.
Returns a VersionedItem object only with a metadata element.
Fast operation: Zero data/segment read/write operations.... | [
"Restore",
"the",
"specified",
"symbol",
"data",
"and",
"metadata",
"to",
"the",
"state",
"of",
"a",
"given",
"version",
"/",
"snapshot",
"/",
"date",
".",
"Returns",
"a",
"VersionedItem",
"object",
"only",
"with",
"a",
"metadata",
"element",
".",
"Fast",
... | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/version_store.py#L764-L810 | [
"def",
"restore_version",
"(",
"self",
",",
"symbol",
",",
"as_of",
",",
"prune_previous_version",
"=",
"True",
")",
":",
"# TODO: This operation is tricky as it may create history branches and lead to corrupted symbols.",
"# To avoid this we do concat_rewrite (see Issue #579)",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | VersionStore._find_prunable_version_ids | Find all non-snapshotted versions of a symbol that are older than a version that's at least keep_mins
minutes old.
Based on documents available on the secondary. | arctic/store/version_store.py | def _find_prunable_version_ids(self, symbol, keep_mins):
"""
Find all non-snapshotted versions of a symbol that are older than a version that's at least keep_mins
minutes old.
Based on documents available on the secondary.
"""
read_preference = ReadPreference.SECONDARY_P... | def _find_prunable_version_ids(self, symbol, keep_mins):
"""
Find all non-snapshotted versions of a symbol that are older than a version that's at least keep_mins
minutes old.
Based on documents available on the secondary.
"""
read_preference = ReadPreference.SECONDARY_P... | [
"Find",
"all",
"non",
"-",
"snapshotted",
"versions",
"of",
"a",
"symbol",
"that",
"are",
"older",
"than",
"a",
"version",
"that",
"s",
"at",
"least",
"keep_mins",
"minutes",
"old",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/version_store.py#L813-L844 | [
"def",
"_find_prunable_version_ids",
"(",
"self",
",",
"symbol",
",",
"keep_mins",
")",
":",
"read_preference",
"=",
"ReadPreference",
".",
"SECONDARY_PREFERRED",
"if",
"keep_mins",
">",
"0",
"else",
"ReadPreference",
".",
"PRIMARY",
"versions",
"=",
"self",
".",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | VersionStore._find_base_version_ids | Return all base_version_ids for a symbol that are not bases of version_ids | arctic/store/version_store.py | def _find_base_version_ids(self, symbol, version_ids):
"""
Return all base_version_ids for a symbol that are not bases of version_ids
"""
cursor = self._versions.find({'symbol': symbol,
'_id': {'$nin': version_ids},
... | def _find_base_version_ids(self, symbol, version_ids):
"""
Return all base_version_ids for a symbol that are not bases of version_ids
"""
cursor = self._versions.find({'symbol': symbol,
'_id': {'$nin': version_ids},
... | [
"Return",
"all",
"base_version_ids",
"for",
"a",
"symbol",
"that",
"are",
"not",
"bases",
"of",
"version_ids"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/version_store.py#L847-L856 | [
"def",
"_find_base_version_ids",
"(",
"self",
",",
"symbol",
",",
"version_ids",
")",
":",
"cursor",
"=",
"self",
".",
"_versions",
".",
"find",
"(",
"{",
"'symbol'",
":",
"symbol",
",",
"'_id'",
":",
"{",
"'$nin'",
":",
"version_ids",
"}",
",",
"'base_v... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | VersionStore._prune_previous_versions | Prune versions, not pointed at by snapshots which are at least keep_mins old. Prune will never
remove all versions. | arctic/store/version_store.py | def _prune_previous_versions(self, symbol, keep_mins=120, keep_version=None, new_version_shas=None):
"""
Prune versions, not pointed at by snapshots which are at least keep_mins old. Prune will never
remove all versions.
"""
new_version_shas = new_version_shas if new_version_shas... | def _prune_previous_versions(self, symbol, keep_mins=120, keep_version=None, new_version_shas=None):
"""
Prune versions, not pointed at by snapshots which are at least keep_mins old. Prune will never
remove all versions.
"""
new_version_shas = new_version_shas if new_version_shas... | [
"Prune",
"versions",
"not",
"pointed",
"at",
"by",
"snapshots",
"which",
"are",
"at",
"least",
"keep_mins",
"old",
".",
"Prune",
"will",
"never",
"remove",
"all",
"versions",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/version_store.py#L858-L890 | [
"def",
"_prune_previous_versions",
"(",
"self",
",",
"symbol",
",",
"keep_mins",
"=",
"120",
",",
"keep_version",
"=",
"None",
",",
"new_version_shas",
"=",
"None",
")",
":",
"new_version_shas",
"=",
"new_version_shas",
"if",
"new_version_shas",
"else",
"[",
"]"... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | VersionStore._delete_version | Delete the n'th version of this symbol from the historical collection. | arctic/store/version_store.py | def _delete_version(self, symbol, version_num, do_cleanup=True):
"""
Delete the n'th version of this symbol from the historical collection.
"""
version = self._versions.find_one({'symbol': symbol, 'version': version_num})
if not version:
logger.error("Can't delete %s:... | def _delete_version(self, symbol, version_num, do_cleanup=True):
"""
Delete the n'th version of this symbol from the historical collection.
"""
version = self._versions.find_one({'symbol': symbol, 'version': version_num})
if not version:
logger.error("Can't delete %s:... | [
"Delete",
"the",
"n",
"th",
"version",
"of",
"this",
"symbol",
"from",
"the",
"historical",
"collection",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/version_store.py#L893-L917 | [
"def",
"_delete_version",
"(",
"self",
",",
"symbol",
",",
"version_num",
",",
"do_cleanup",
"=",
"True",
")",
":",
"version",
"=",
"self",
".",
"_versions",
".",
"find_one",
"(",
"{",
"'symbol'",
":",
"symbol",
",",
"'version'",
":",
"version_num",
"}",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | VersionStore.delete | Delete all versions of the item from the current library which aren't
currently part of some snapshot.
Parameters
----------
symbol : `str`
symbol name to delete | arctic/store/version_store.py | def delete(self, symbol):
"""
Delete all versions of the item from the current library which aren't
currently part of some snapshot.
Parameters
----------
symbol : `str`
symbol name to delete
"""
logger.info("Deleting data item: %r from %r" % ... | def delete(self, symbol):
"""
Delete all versions of the item from the current library which aren't
currently part of some snapshot.
Parameters
----------
symbol : `str`
symbol name to delete
"""
logger.info("Deleting data item: %r from %r" % ... | [
"Delete",
"all",
"versions",
"of",
"the",
"item",
"from",
"the",
"current",
"library",
"which",
"aren",
"t",
"currently",
"part",
"of",
"some",
"snapshot",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/version_store.py#L920-L941 | [
"def",
"delete",
"(",
"self",
",",
"symbol",
")",
":",
"logger",
".",
"info",
"(",
"\"Deleting data item: %r from %r\"",
"%",
"(",
"symbol",
",",
"self",
".",
"_arctic_lib",
".",
"get_name",
"(",
")",
")",
")",
"# None is the magic sentinel value that indicates an... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | VersionStore._write_audit | Creates an audit entry, which is much like a snapshot in that
it references versions and provides some history of the changes made. | arctic/store/version_store.py | def _write_audit(self, user, message, changed_version):
"""
Creates an audit entry, which is much like a snapshot in that
it references versions and provides some history of the changes made.
"""
audit = {'_id': bson.ObjectId(),
'user': user,
'me... | def _write_audit(self, user, message, changed_version):
"""
Creates an audit entry, which is much like a snapshot in that
it references versions and provides some history of the changes made.
"""
audit = {'_id': bson.ObjectId(),
'user': user,
'me... | [
"Creates",
"an",
"audit",
"entry",
"which",
"is",
"much",
"like",
"a",
"snapshot",
"in",
"that",
"it",
"references",
"versions",
"and",
"provides",
"some",
"history",
"of",
"the",
"changes",
"made",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/version_store.py#L943-L963 | [
"def",
"_write_audit",
"(",
"self",
",",
"user",
",",
"message",
",",
"changed_version",
")",
":",
"audit",
"=",
"{",
"'_id'",
":",
"bson",
".",
"ObjectId",
"(",
")",
",",
"'user'",
":",
"user",
",",
"'message'",
":",
"message",
",",
"'symbol'",
":",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | VersionStore.snapshot | Snapshot versions of symbols in the library. Can be used like:
Parameters
----------
snap_name : `str`
name of the snapshot
metadata : `dict`
an optional dictionary of metadata to persist along with the symbol.
skip_symbols : `collections.Iterable`
... | arctic/store/version_store.py | def snapshot(self, snap_name, metadata=None, skip_symbols=None, versions=None):
"""
Snapshot versions of symbols in the library. Can be used like:
Parameters
----------
snap_name : `str`
name of the snapshot
metadata : `dict`
an optional dictiona... | def snapshot(self, snap_name, metadata=None, skip_symbols=None, versions=None):
"""
Snapshot versions of symbols in the library. Can be used like:
Parameters
----------
snap_name : `str`
name of the snapshot
metadata : `dict`
an optional dictiona... | [
"Snapshot",
"versions",
"of",
"symbols",
"in",
"the",
"library",
".",
"Can",
"be",
"used",
"like",
":"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/version_store.py#L966-L1007 | [
"def",
"snapshot",
"(",
"self",
",",
"snap_name",
",",
"metadata",
"=",
"None",
",",
"skip_symbols",
"=",
"None",
",",
"versions",
"=",
"None",
")",
":",
"# Ensure the user doesn't insert duplicates",
"snapshot",
"=",
"self",
".",
"_snapshots",
".",
"find_one",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | VersionStore.delete_snapshot | Delete a named snapshot
Parameters
----------
symbol : `str`
The snapshot name to delete | arctic/store/version_store.py | def delete_snapshot(self, snap_name):
"""
Delete a named snapshot
Parameters
----------
symbol : `str`
The snapshot name to delete
"""
snapshot = self._snapshots.find_one({'name': snap_name})
if not snapshot:
raise NoDataFoundExcep... | def delete_snapshot(self, snap_name):
"""
Delete a named snapshot
Parameters
----------
symbol : `str`
The snapshot name to delete
"""
snapshot = self._snapshots.find_one({'name': snap_name})
if not snapshot:
raise NoDataFoundExcep... | [
"Delete",
"a",
"named",
"snapshot"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/version_store.py#L1010-L1027 | [
"def",
"delete_snapshot",
"(",
"self",
",",
"snap_name",
")",
":",
"snapshot",
"=",
"self",
".",
"_snapshots",
".",
"find_one",
"(",
"{",
"'name'",
":",
"snap_name",
"}",
")",
"if",
"not",
"snapshot",
":",
"raise",
"NoDataFoundException",
"(",
"\"Snapshot %s... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | VersionStore.stats | Return storage statistics about the library
Returns
-------
dictionary of storage stats | arctic/store/version_store.py | def stats(self):
"""
Return storage statistics about the library
Returns
-------
dictionary of storage stats
"""
res = {}
db = self._collection.database
conn = db.connection
res['sharding'] = {}
try:
sharding = conn.co... | def stats(self):
"""
Return storage statistics about the library
Returns
-------
dictionary of storage stats
"""
res = {}
db = self._collection.database
conn = db.connection
res['sharding'] = {}
try:
sharding = conn.co... | [
"Return",
"storage",
"statistics",
"about",
"the",
"library"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/version_store.py#L1041-L1069 | [
"def",
"stats",
"(",
"self",
")",
":",
"res",
"=",
"{",
"}",
"db",
"=",
"self",
".",
"_collection",
".",
"database",
"conn",
"=",
"db",
".",
"connection",
"res",
"[",
"'sharding'",
"]",
"=",
"{",
"}",
"try",
":",
"sharding",
"=",
"conn",
".",
"co... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | VersionStore._fsck | Run a consistency check on this VersionStore library. | arctic/store/version_store.py | def _fsck(self, dry_run):
"""
Run a consistency check on this VersionStore library.
"""
# Cleanup Orphaned Chunks
self._cleanup_orphaned_chunks(dry_run)
# Cleanup unreachable SHAs (forward pointers)
self._cleanup_unreachable_shas(dry_run)
# Cleanup Orphane... | def _fsck(self, dry_run):
"""
Run a consistency check on this VersionStore library.
"""
# Cleanup Orphaned Chunks
self._cleanup_orphaned_chunks(dry_run)
# Cleanup unreachable SHAs (forward pointers)
self._cleanup_unreachable_shas(dry_run)
# Cleanup Orphane... | [
"Run",
"a",
"consistency",
"check",
"on",
"this",
"VersionStore",
"library",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/version_store.py#L1071-L1080 | [
"def",
"_fsck",
"(",
"self",
",",
"dry_run",
")",
":",
"# Cleanup Orphaned Chunks",
"self",
".",
"_cleanup_orphaned_chunks",
"(",
"dry_run",
")",
"# Cleanup unreachable SHAs (forward pointers)",
"self",
".",
"_cleanup_unreachable_shas",
"(",
"dry_run",
")",
"# Cleanup Orp... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | VersionStore._cleanup_orphaned_chunks | Fixes any chunks who have parent pointers to missing versions.
Removes the broken parent pointer and, if there are no other parent pointers for the chunk,
removes the chunk. | arctic/store/version_store.py | def _cleanup_orphaned_chunks(self, dry_run):
"""
Fixes any chunks who have parent pointers to missing versions.
Removes the broken parent pointer and, if there are no other parent pointers for the chunk,
removes the chunk.
"""
lib = self
chunks_coll = lib._collect... | def _cleanup_orphaned_chunks(self, dry_run):
"""
Fixes any chunks who have parent pointers to missing versions.
Removes the broken parent pointer and, if there are no other parent pointers for the chunk,
removes the chunk.
"""
lib = self
chunks_coll = lib._collect... | [
"Fixes",
"any",
"chunks",
"who",
"have",
"parent",
"pointers",
"to",
"missing",
"versions",
".",
"Removes",
"the",
"broken",
"parent",
"pointer",
"and",
"if",
"there",
"are",
"no",
"other",
"parent",
"pointers",
"for",
"the",
"chunk",
"removes",
"the",
"chun... | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/version_store.py#L1109-L1154 | [
"def",
"_cleanup_orphaned_chunks",
"(",
"self",
",",
"dry_run",
")",
":",
"lib",
"=",
"self",
"chunks_coll",
"=",
"lib",
".",
"_collection",
"versions_coll",
"=",
"chunks_coll",
".",
"versions",
"logger",
".",
"info",
"(",
"\"ORPHANED CHUNK CHECK: %s\"",
"%",
"s... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | VersionStore._cleanup_orphaned_versions | Fixes any versions who have parent pointers to missing snapshots.
Note, doesn't delete the versions, just removes the parent pointer if it no longer
exists in snapshots. | arctic/store/version_store.py | def _cleanup_orphaned_versions(self, dry_run):
"""
Fixes any versions who have parent pointers to missing snapshots.
Note, doesn't delete the versions, just removes the parent pointer if it no longer
exists in snapshots.
"""
lib = self
versions_coll = lib._collect... | def _cleanup_orphaned_versions(self, dry_run):
"""
Fixes any versions who have parent pointers to missing snapshots.
Note, doesn't delete the versions, just removes the parent pointer if it no longer
exists in snapshots.
"""
lib = self
versions_coll = lib._collect... | [
"Fixes",
"any",
"versions",
"who",
"have",
"parent",
"pointers",
"to",
"missing",
"snapshots",
".",
"Note",
"doesn",
"t",
"delete",
"the",
"versions",
"just",
"removes",
"the",
"parent",
"pointer",
"if",
"it",
"no",
"longer",
"exists",
"in",
"snapshots",
"."... | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/version_store.py#L1156-L1198 | [
"def",
"_cleanup_orphaned_versions",
"(",
"self",
",",
"dry_run",
")",
":",
"lib",
"=",
"self",
"versions_coll",
"=",
"lib",
".",
"_collection",
".",
"versions",
"snapshots_coll",
"=",
"lib",
".",
"_collection",
".",
"snapshots",
"logger",
".",
"info",
"(",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | enable_parallel_lz4 | Set the global multithread compression mode
Parameters
----------
mode: `bool`
True: Use parallel compression. False: Use sequential compression | arctic/_compression.py | def enable_parallel_lz4(mode):
"""
Set the global multithread compression mode
Parameters
----------
mode: `bool`
True: Use parallel compression. False: Use sequential compression
"""
global ENABLE_PARALLEL
ENABLE_PARALLEL = bool(mode)
logger.info("Setting parallelis... | def enable_parallel_lz4(mode):
"""
Set the global multithread compression mode
Parameters
----------
mode: `bool`
True: Use parallel compression. False: Use sequential compression
"""
global ENABLE_PARALLEL
ENABLE_PARALLEL = bool(mode)
logger.info("Setting parallelis... | [
"Set",
"the",
"global",
"multithread",
"compression",
"mode"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/_compression.py#L20-L31 | [
"def",
"enable_parallel_lz4",
"(",
"mode",
")",
":",
"global",
"ENABLE_PARALLEL",
"ENABLE_PARALLEL",
"=",
"bool",
"(",
"mode",
")",
"logger",
".",
"info",
"(",
"\"Setting parallelisation mode to {}\"",
".",
"format",
"(",
"\"multi-threaded\"",
"if",
"mode",
"else",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | set_compression_pool_size | Set the size of the compression workers thread pool.
If the pool is already created, it waits until all jobs are finished, and then proceeds with setting the new size.
Parameters
----------
pool_size : `int`
The size of the pool (must be a positive integer)
Returns
-------
... | arctic/_compression.py | def set_compression_pool_size(pool_size):
"""
Set the size of the compression workers thread pool.
If the pool is already created, it waits until all jobs are finished, and then proceeds with setting the new size.
Parameters
----------
pool_size : `int`
The size of the pool (mus... | def set_compression_pool_size(pool_size):
"""
Set the size of the compression workers thread pool.
If the pool is already created, it waits until all jobs are finished, and then proceeds with setting the new size.
Parameters
----------
pool_size : `int`
The size of the pool (mus... | [
"Set",
"the",
"size",
"of",
"the",
"compression",
"workers",
"thread",
"pool",
".",
"If",
"the",
"pool",
"is",
"already",
"created",
"it",
"waits",
"until",
"all",
"jobs",
"are",
"finished",
"and",
"then",
"proceeds",
"with",
"setting",
"the",
"new",
"size... | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/_compression.py#L34-L56 | [
"def",
"set_compression_pool_size",
"(",
"pool_size",
")",
":",
"pool_size",
"=",
"int",
"(",
"pool_size",
")",
"if",
"pool_size",
"<",
"1",
":",
"raise",
"ValueError",
"(",
"\"The compression thread pool size cannot be of size {}\"",
".",
"format",
"(",
"pool_size",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | compress_array | Compress an array of strings
Parameters
----------
str_list: `list[str]`
The input list of strings which need to be compressed.
withHC: `bool`
This flag controls whether lz4HC will be used.
Returns
-------
`list[str`
The list of the compressed strings. | arctic/_compression.py | def compress_array(str_list, withHC=LZ4_HIGH_COMPRESSION):
"""
Compress an array of strings
Parameters
----------
str_list: `list[str]`
The input list of strings which need to be compressed.
withHC: `bool`
This flag controls whether lz4HC will be used.
Retur... | def compress_array(str_list, withHC=LZ4_HIGH_COMPRESSION):
"""
Compress an array of strings
Parameters
----------
str_list: `list[str]`
The input list of strings which need to be compressed.
withHC: `bool`
This flag controls whether lz4HC will be used.
Retur... | [
"Compress",
"an",
"array",
"of",
"strings"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/_compression.py#L59-L92 | [
"def",
"compress_array",
"(",
"str_list",
",",
"withHC",
"=",
"LZ4_HIGH_COMPRESSION",
")",
":",
"global",
"_compress_thread_pool",
"if",
"not",
"str_list",
":",
"return",
"str_list",
"do_compress",
"=",
"lz4_compressHC",
"if",
"withHC",
"else",
"lz4_compress",
"def"... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | decompress_array | Decompress a list of strings | arctic/_compression.py | def decompress_array(str_list):
"""
Decompress a list of strings
"""
global _compress_thread_pool
if not str_list:
return str_list
if not ENABLE_PARALLEL or len(str_list) <= LZ4_N_PARALLEL:
return [lz4_decompress(chunk) for chunk in str_list]
if _compress_thread_pool is No... | def decompress_array(str_list):
"""
Decompress a list of strings
"""
global _compress_thread_pool
if not str_list:
return str_list
if not ENABLE_PARALLEL or len(str_list) <= LZ4_N_PARALLEL:
return [lz4_decompress(chunk) for chunk in str_list]
if _compress_thread_pool is No... | [
"Decompress",
"a",
"list",
"of",
"strings"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/_compression.py#L126-L140 | [
"def",
"decompress_array",
"(",
"str_list",
")",
":",
"global",
"_compress_thread_pool",
"if",
"not",
"str_list",
":",
"return",
"str_list",
"if",
"not",
"ENABLE_PARALLEL",
"or",
"len",
"(",
"str_list",
")",
"<=",
"LZ4_N_PARALLEL",
":",
"return",
"[",
"lz4_decom... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | _split_arrs | Equivalent to numpy.split(array_2d, slices),
but avoids fancy indexing | arctic/store/_version_store_utils.py | def _split_arrs(array_2d, slices):
"""
Equivalent to numpy.split(array_2d, slices),
but avoids fancy indexing
"""
if len(array_2d) == 0:
return np.empty(0, dtype=np.object)
rtn = np.empty(len(slices) + 1, dtype=np.object)
start = 0
for i, s in enumerate(slices):
rtn[i] =... | def _split_arrs(array_2d, slices):
"""
Equivalent to numpy.split(array_2d, slices),
but avoids fancy indexing
"""
if len(array_2d) == 0:
return np.empty(0, dtype=np.object)
rtn = np.empty(len(slices) + 1, dtype=np.object)
start = 0
for i, s in enumerate(slices):
rtn[i] =... | [
"Equivalent",
"to",
"numpy",
".",
"split",
"(",
"array_2d",
"slices",
")",
"but",
"avoids",
"fancy",
"indexing"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/_version_store_utils.py#L18-L32 | [
"def",
"_split_arrs",
"(",
"array_2d",
",",
"slices",
")",
":",
"if",
"len",
"(",
"array_2d",
")",
"==",
"0",
":",
"return",
"np",
".",
"empty",
"(",
"0",
",",
"dtype",
"=",
"np",
".",
"object",
")",
"rtn",
"=",
"np",
".",
"empty",
"(",
"len",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | checksum | Checksum the passed in dictionary | arctic/store/_version_store_utils.py | def checksum(symbol, doc):
"""
Checksum the passed in dictionary
"""
sha = hashlib.sha1()
sha.update(symbol.encode('ascii'))
for k in sorted(iter(doc.keys()), reverse=True):
v = doc[k]
if isinstance(v, six.binary_type):
sha.update(doc[k])
else:
sha... | def checksum(symbol, doc):
"""
Checksum the passed in dictionary
"""
sha = hashlib.sha1()
sha.update(symbol.encode('ascii'))
for k in sorted(iter(doc.keys()), reverse=True):
v = doc[k]
if isinstance(v, six.binary_type):
sha.update(doc[k])
else:
sha... | [
"Checksum",
"the",
"passed",
"in",
"dictionary"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/_version_store_utils.py#L35-L47 | [
"def",
"checksum",
"(",
"symbol",
",",
"doc",
")",
":",
"sha",
"=",
"hashlib",
".",
"sha1",
"(",
")",
"sha",
".",
"update",
"(",
"symbol",
".",
"encode",
"(",
"'ascii'",
")",
")",
"for",
"k",
"in",
"sorted",
"(",
"iter",
"(",
"doc",
".",
"keys",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | cleanup | Helper method for cleaning up chunks from a version store | arctic/store/_version_store_utils.py | def cleanup(arctic_lib, symbol, version_ids, versions_coll, shas_to_delete=None, pointers_cfgs=None):
"""
Helper method for cleaning up chunks from a version store
"""
pointers_cfgs = set(pointers_cfgs) if pointers_cfgs else set()
collection = arctic_lib.get_top_level_collection()
version_ids = ... | def cleanup(arctic_lib, symbol, version_ids, versions_coll, shas_to_delete=None, pointers_cfgs=None):
"""
Helper method for cleaning up chunks from a version store
"""
pointers_cfgs = set(pointers_cfgs) if pointers_cfgs else set()
collection = arctic_lib.get_top_level_collection()
version_ids = ... | [
"Helper",
"method",
"for",
"cleaning",
"up",
"chunks",
"from",
"a",
"version",
"store"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/_version_store_utils.py#L107-L133 | [
"def",
"cleanup",
"(",
"arctic_lib",
",",
"symbol",
",",
"version_ids",
",",
"versions_coll",
",",
"shas_to_delete",
"=",
"None",
",",
"pointers_cfgs",
"=",
"None",
")",
":",
"pointers_cfgs",
"=",
"set",
"(",
"pointers_cfgs",
")",
"if",
"pointers_cfgs",
"else"... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | _define_compat_pickle_load | Factory function to initialise the correct Pickle load function based on
the Pandas version. | arctic/store/_version_store_utils.py | def _define_compat_pickle_load():
"""Factory function to initialise the correct Pickle load function based on
the Pandas version.
"""
if pd.__version__.startswith("0.14"):
return pickle.load
return functools.partial(pickle_compat.load, compat=True) | def _define_compat_pickle_load():
"""Factory function to initialise the correct Pickle load function based on
the Pandas version.
"""
if pd.__version__.startswith("0.14"):
return pickle.load
return functools.partial(pickle_compat.load, compat=True) | [
"Factory",
"function",
"to",
"initialise",
"the",
"correct",
"Pickle",
"load",
"function",
"based",
"on",
"the",
"Pandas",
"version",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/_version_store_utils.py#L140-L146 | [
"def",
"_define_compat_pickle_load",
"(",
")",
":",
"if",
"pd",
".",
"__version__",
".",
"startswith",
"(",
"\"0.14\"",
")",
":",
"return",
"pickle",
".",
"load",
"return",
"functools",
".",
"partial",
"(",
"pickle_compat",
".",
"load",
",",
"compat",
"=",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | analyze_symbol | This is a utility function to produce text output with details about the versions of a given symbol.
It is useful for debugging corruption issues and to mark corrupted versions.
Parameters
----------
l : `arctic.store.version_store.VersionStore`
The VersionStore instance against which the analys... | arctic/store/_version_store_utils.py | def analyze_symbol(l, sym, from_ver, to_ver, do_reads=False):
"""
This is a utility function to produce text output with details about the versions of a given symbol.
It is useful for debugging corruption issues and to mark corrupted versions.
Parameters
----------
l : `arctic.store.version_stor... | def analyze_symbol(l, sym, from_ver, to_ver, do_reads=False):
"""
This is a utility function to produce text output with details about the versions of a given symbol.
It is useful for debugging corruption issues and to mark corrupted versions.
Parameters
----------
l : `arctic.store.version_stor... | [
"This",
"is",
"a",
"utility",
"function",
"to",
"produce",
"text",
"output",
"with",
"details",
"about",
"the",
"versions",
"of",
"a",
"given",
"symbol",
".",
"It",
"is",
"useful",
"for",
"debugging",
"corruption",
"issues",
"and",
"to",
"mark",
"corrupted",... | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/_version_store_utils.py#L149-L243 | [
"def",
"analyze_symbol",
"(",
"l",
",",
"sym",
",",
"from_ver",
",",
"to_ver",
",",
"do_reads",
"=",
"False",
")",
":",
"logging",
".",
"info",
"(",
"'Analyzing symbol {}. Versions range is [v{}, v{}]'",
".",
"format",
"(",
"sym",
",",
"from_ver",
",",
"to_ver... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | is_safe_to_append | This method hints whether the symbol/version are safe for appending in two ways:
1. It verifies whether the symbol is already corrupted (fast, doesn't read the data)
2. It verififes that the symbol is safe to append, i.e. there are no subsequent appends,
or dangling segments from a failed append.
Par... | arctic/store/_version_store_utils.py | def is_safe_to_append(l, sym, input_v):
"""
This method hints whether the symbol/version are safe for appending in two ways:
1. It verifies whether the symbol is already corrupted (fast, doesn't read the data)
2. It verififes that the symbol is safe to append, i.e. there are no subsequent appends,
... | def is_safe_to_append(l, sym, input_v):
"""
This method hints whether the symbol/version are safe for appending in two ways:
1. It verifies whether the symbol is already corrupted (fast, doesn't read the data)
2. It verififes that the symbol is safe to append, i.e. there are no subsequent appends,
... | [
"This",
"method",
"hints",
"whether",
"the",
"symbol",
"/",
"version",
"are",
"safe",
"for",
"appending",
"in",
"two",
"ways",
":",
"1",
".",
"It",
"verifies",
"whether",
"the",
"symbol",
"is",
"already",
"corrupted",
"(",
"fast",
"doesn",
"t",
"read",
"... | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/_version_store_utils.py#L296-L318 | [
"def",
"is_safe_to_append",
"(",
"l",
",",
"sym",
",",
"input_v",
")",
":",
"input_v",
"=",
"l",
".",
"_versions",
".",
"find_one",
"(",
"{",
"'symbol'",
":",
"sym",
",",
"'version'",
":",
"input_v",
"}",
")",
"if",
"isinstance",
"(",
"input_v",
",",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | is_corrupted | This method can be used to check for a corrupted version.
Will continue to a full read (slower) if the internally invoked fast-detection does not locate a corruption.
Parameters
----------
l : `arctic.store.version_store.VersionStore`
The VersionStore instance against which ... | arctic/store/_version_store_utils.py | def is_corrupted(l, sym, input_v):
"""
This method can be used to check for a corrupted version.
Will continue to a full read (slower) if the internally invoked fast-detection does not locate a corruption.
Parameters
----------
l : `arctic.store.version_store.VersionStore`
... | def is_corrupted(l, sym, input_v):
"""
This method can be used to check for a corrupted version.
Will continue to a full read (slower) if the internally invoked fast-detection does not locate a corruption.
Parameters
----------
l : `arctic.store.version_store.VersionStore`
... | [
"This",
"method",
"can",
"be",
"used",
"to",
"check",
"for",
"a",
"corrupted",
"version",
".",
"Will",
"continue",
"to",
"a",
"full",
"read",
"(",
"slower",
")",
"if",
"the",
"internally",
"invoked",
"fast",
"-",
"detection",
"does",
"not",
"locate",
"a"... | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/store/_version_store_utils.py#L344-L373 | [
"def",
"is_corrupted",
"(",
"l",
",",
"sym",
",",
"input_v",
")",
":",
"# If version is just a number, read the version document",
"input_v",
"=",
"l",
".",
"_versions",
".",
"find_one",
"(",
"{",
"'symbol'",
":",
"sym",
",",
"'version'",
":",
"input_v",
"}",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | FrameConverter._convert_types | Converts object arrays of strings to numpy string arrays | arctic/serialization/numpy_arrays.py | def _convert_types(self, a):
"""
Converts object arrays of strings to numpy string arrays
"""
# No conversion for scalar type
if a.dtype != 'object':
return a, None
# We can't infer the type of an empty array, so just
# assume strings
if len(a... | def _convert_types(self, a):
"""
Converts object arrays of strings to numpy string arrays
"""
# No conversion for scalar type
if a.dtype != 'object':
return a, None
# We can't infer the type of an empty array, so just
# assume strings
if len(a... | [
"Converts",
"object",
"arrays",
"of",
"strings",
"to",
"numpy",
"string",
"arrays"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/serialization/numpy_arrays.py#L58-L93 | [
"def",
"_convert_types",
"(",
"self",
",",
"a",
")",
":",
"# No conversion for scalar type",
"if",
"a",
".",
"dtype",
"!=",
"'object'",
":",
"return",
"a",
",",
"None",
"# We can't infer the type of an empty array, so just",
"# assume strings",
"if",
"len",
"(",
"a"... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | FrameConverter.docify | Convert a Pandas DataFrame to SON.
Parameters
----------
df: DataFrame
The Pandas DataFrame to encode | arctic/serialization/numpy_arrays.py | def docify(self, df):
"""
Convert a Pandas DataFrame to SON.
Parameters
----------
df: DataFrame
The Pandas DataFrame to encode
"""
dtypes = {}
masks = {}
lengths = {}
columns = []
data = Binary(b'')
start = 0
... | def docify(self, df):
"""
Convert a Pandas DataFrame to SON.
Parameters
----------
df: DataFrame
The Pandas DataFrame to encode
"""
dtypes = {}
masks = {}
lengths = {}
columns = []
data = Binary(b'')
start = 0
... | [
"Convert",
"a",
"Pandas",
"DataFrame",
"to",
"SON",
"."
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/serialization/numpy_arrays.py#L95-L140 | [
"def",
"docify",
"(",
"self",
",",
"df",
")",
":",
"dtypes",
"=",
"{",
"}",
"masks",
"=",
"{",
"}",
"lengths",
"=",
"{",
"}",
"columns",
"=",
"[",
"]",
"data",
"=",
"Binary",
"(",
"b''",
")",
"start",
"=",
"0",
"arrays",
"=",
"[",
"]",
"for",... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | FrameConverter.objify | Decode a Pymongo SON object into an Pandas DataFrame | arctic/serialization/numpy_arrays.py | def objify(self, doc, columns=None):
"""
Decode a Pymongo SON object into an Pandas DataFrame
"""
cols = columns or doc[METADATA][COLUMNS]
data = {}
for col in cols:
# if there is missing data in a chunk, we can default to NaN
# and pandas will au... | def objify(self, doc, columns=None):
"""
Decode a Pymongo SON object into an Pandas DataFrame
"""
cols = columns or doc[METADATA][COLUMNS]
data = {}
for col in cols:
# if there is missing data in a chunk, we can default to NaN
# and pandas will au... | [
"Decode",
"a",
"Pymongo",
"SON",
"object",
"into",
"an",
"Pandas",
"DataFrame"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/serialization/numpy_arrays.py#L142-L166 | [
"def",
"objify",
"(",
"self",
",",
"doc",
",",
"columns",
"=",
"None",
")",
":",
"cols",
"=",
"columns",
"or",
"doc",
"[",
"METADATA",
"]",
"[",
"COLUMNS",
"]",
"data",
"=",
"{",
"}",
"for",
"col",
"in",
"cols",
":",
"# if there is missing data in a ch... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | FrametoArraySerializer.deserialize | Deserializes SON to a DataFrame
Parameters
----------
data: SON data
columns: None, or list of strings
optionally you can deserialize a subset of the data in the SON. Index
columns are ALWAYS deserialized, and should not be specified
Returns
----... | arctic/serialization/numpy_arrays.py | def deserialize(self, data, columns=None):
"""
Deserializes SON to a DataFrame
Parameters
----------
data: SON data
columns: None, or list of strings
optionally you can deserialize a subset of the data in the SON. Index
columns are ALWAYS deserial... | def deserialize(self, data, columns=None):
"""
Deserializes SON to a DataFrame
Parameters
----------
data: SON data
columns: None, or list of strings
optionally you can deserialize a subset of the data in the SON. Index
columns are ALWAYS deserial... | [
"Deserializes",
"SON",
"to",
"a",
"DataFrame"
] | manahl/arctic | python | https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/serialization/numpy_arrays.py#L196-L233 | [
"def",
"deserialize",
"(",
"self",
",",
"data",
",",
"columns",
"=",
"None",
")",
":",
"if",
"not",
"data",
":",
"return",
"pd",
".",
"DataFrame",
"(",
")",
"meta",
"=",
"data",
"[",
"0",
"]",
"[",
"METADATA",
"]",
"if",
"isinstance",
"(",
"data",
... | 57e110b6e182dbab00e7e214dc26f7d9ec47c120 |
train | KeyManager._create_key_manager | Create and initialize the keybinding manager.
:type get_fuzzy_match: callable
:param get_fuzzy_match: Gets the fuzzy matching config.
:type set_fuzzy_match: callable
:param set_fuzzy_match: Sets the fuzzy matching config.
:type get_enable_vi_bindings: callable
:param g... | awsshell/keys.py | def _create_key_manager(self, get_match_fuzzy, set_match_fuzzy,
get_enable_vi_bindings, set_enable_vi_bindings,
get_show_completion_columns,
set_show_completion_columns,
get_show_help, set_show_help,
... | def _create_key_manager(self, get_match_fuzzy, set_match_fuzzy,
get_enable_vi_bindings, set_enable_vi_bindings,
get_show_completion_columns,
set_show_completion_columns,
get_show_help, set_show_help,
... | [
"Create",
"and",
"initialize",
"the",
"keybinding",
"manager",
"."
] | awslabs/aws-shell | python | https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/keys.py#L41-L170 | [
"def",
"_create_key_manager",
"(",
"self",
",",
"get_match_fuzzy",
",",
"set_match_fuzzy",
",",
"get_enable_vi_bindings",
",",
"set_enable_vi_bindings",
",",
"get_show_completion_columns",
",",
"set_show_completion_columns",
",",
"get_show_help",
",",
"set_show_help",
",",
... | 8950f03d9d720879890af6c11537b8f9789ce5a9 |
train | CompleterDescriber.describe_autocomplete | Describe operation and args needed for server side completion.
:type service: str
:param service: The AWS service name.
:type operation: str
:param operation: The AWS operation name.
:type param: str
:param param: The name of the parameter being completed. This must
... | awsshell/resource/index.py | def describe_autocomplete(self, service, operation, param):
"""Describe operation and args needed for server side completion.
:type service: str
:param service: The AWS service name.
:type operation: str
:param operation: The AWS operation name.
:type param: str
... | def describe_autocomplete(self, service, operation, param):
"""Describe operation and args needed for server side completion.
:type service: str
:param service: The AWS service name.
:type operation: str
:param operation: The AWS operation name.
:type param: str
... | [
"Describe",
"operation",
"and",
"args",
"needed",
"for",
"server",
"side",
"completion",
"."
] | awslabs/aws-shell | python | https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/resource/index.py#L105-L137 | [
"def",
"describe_autocomplete",
"(",
"self",
",",
"service",
",",
"operation",
",",
"param",
")",
":",
"service_index",
"=",
"self",
".",
"_index",
"[",
"service",
"]",
"LOG",
".",
"debug",
"(",
"service_index",
")",
"if",
"param",
"not",
"in",
"service_in... | 8950f03d9d720879890af6c11537b8f9789ce5a9 |
train | CompleterDescriberCreator.create_completer_query | Create a CompleterDescriber for a service.
:type service_name: str
:param service_name: The name of the service, e.g. 'ec2'
:return: A CompleterDescriber object. | awsshell/resource/index.py | def create_completer_query(self, service_name):
"""Create a CompleterDescriber for a service.
:type service_name: str
:param service_name: The name of the service, e.g. 'ec2'
:return: A CompleterDescriber object.
"""
if service_name not in self._describer_cache:
... | def create_completer_query(self, service_name):
"""Create a CompleterDescriber for a service.
:type service_name: str
:param service_name: The name of the service, e.g. 'ec2'
:return: A CompleterDescriber object.
"""
if service_name not in self._describer_cache:
... | [
"Create",
"a",
"CompleterDescriber",
"for",
"a",
"service",
"."
] | awslabs/aws-shell | python | https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/resource/index.py#L162-L174 | [
"def",
"create_completer_query",
"(",
"self",
",",
"service_name",
")",
":",
"if",
"service_name",
"not",
"in",
"self",
".",
"_describer_cache",
":",
"query",
"=",
"self",
".",
"_create_completer_query",
"(",
"service_name",
")",
"self",
".",
"_describer_cache",
... | 8950f03d9d720879890af6c11537b8f9789ce5a9 |
train | ServerSideCompleter.retrieve_candidate_values | Retrieve server side completions.
:type service: str
:param service: The service name, e.g. 'ec2', 'iam'.
:type operation: str
:param operation: The operation name, in the casing
used by the CLI (words separated by hyphens), e.g.
'describe-instances', 'delete-us... | awsshell/resource/index.py | def retrieve_candidate_values(self, service, operation, param):
"""Retrieve server side completions.
:type service: str
:param service: The service name, e.g. 'ec2', 'iam'.
:type operation: str
:param operation: The operation name, in the casing
used by the CLI (wor... | def retrieve_candidate_values(self, service, operation, param):
"""Retrieve server side completions.
:type service: str
:param service: The service name, e.g. 'ec2', 'iam'.
:type operation: str
:param operation: The operation name, in the casing
used by the CLI (wor... | [
"Retrieve",
"server",
"side",
"completions",
"."
] | awslabs/aws-shell | python | https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/resource/index.py#L195-L251 | [
"def",
"retrieve_candidate_values",
"(",
"self",
",",
"service",
",",
"operation",
",",
"param",
")",
":",
"# Example call:",
"# service='ec2',",
"# operation='terminate-instances',",
"# param='InstanceIds'.",
"if",
"service",
"not",
"in",
"self",
".",
"_describer_creator... | 8950f03d9d720879890af6c11537b8f9789ce5a9 |
train | convert_rst_to_basic_text | Convert restructured text to basic text output.
This function removes most of the decorations added
in restructured text.
This function is used to generate documentation we
can show to users in a cross platform manner.
Basic indentation and list formatting are kept,
but many RST features are ... | awsshell/makeindex.py | def convert_rst_to_basic_text(contents):
"""Convert restructured text to basic text output.
This function removes most of the decorations added
in restructured text.
This function is used to generate documentation we
can show to users in a cross platform manner.
Basic indentation and list for... | def convert_rst_to_basic_text(contents):
"""Convert restructured text to basic text output.
This function removes most of the decorations added
in restructured text.
This function is used to generate documentation we
can show to users in a cross platform manner.
Basic indentation and list for... | [
"Convert",
"restructured",
"text",
"to",
"basic",
"text",
"output",
"."
] | awslabs/aws-shell | python | https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/makeindex.py#L128-L147 | [
"def",
"convert_rst_to_basic_text",
"(",
"contents",
")",
":",
"# The report_level override is so that we don't print anything",
"# to stdout/stderr on rendering issues.",
"converted",
"=",
"publish_string",
"(",
"contents",
",",
"writer",
"=",
"BasicTextWriter",
"(",
")",
",",... | 8950f03d9d720879890af6c11537b8f9789ce5a9 |
train | Config.load | Read the config file if it exists, else read the default config.
Creates the user config file if it doesn't exist using the template.
:type config_template: str
:param config_template: The config template file name.
:type config_file: str
:param config_file: (Optional) The con... | awsshell/config.py | def load(self, config_template, config_file=None):
"""Read the config file if it exists, else read the default config.
Creates the user config file if it doesn't exist using the template.
:type config_template: str
:param config_template: The config template file name.
:type c... | def load(self, config_template, config_file=None):
"""Read the config file if it exists, else read the default config.
Creates the user config file if it doesn't exist using the template.
:type config_template: str
:param config_template: The config template file name.
:type c... | [
"Read",
"the",
"config",
"file",
"if",
"it",
"exists",
"else",
"read",
"the",
"default",
"config",
"."
] | awslabs/aws-shell | python | https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/config.py#L24-L45 | [
"def",
"load",
"(",
"self",
",",
"config_template",
",",
"config_file",
"=",
"None",
")",
":",
"if",
"config_file",
"is",
"None",
":",
"config_file",
"=",
"config_template",
"config_path",
"=",
"build_config_file_path",
"(",
"config_file",
")",
"template_path",
... | 8950f03d9d720879890af6c11537b8f9789ce5a9 |
train | Config._load_template_or_config | Load the config file if it exists, else read the default config.
:type template_path: str
:param template_path: The template config file path.
:type config_path: str
:param config_path: The user's config file path.
:rtype: :class:`configobj.ConfigObj`
:return: The conf... | awsshell/config.py | def _load_template_or_config(self, template_path, config_path):
"""Load the config file if it exists, else read the default config.
:type template_path: str
:param template_path: The template config file path.
:type config_path: str
:param config_path: The user's config file pa... | def _load_template_or_config(self, template_path, config_path):
"""Load the config file if it exists, else read the default config.
:type template_path: str
:param template_path: The template config file path.
:type config_path: str
:param config_path: The user's config file pa... | [
"Load",
"the",
"config",
"file",
"if",
"it",
"exists",
"else",
"read",
"the",
"default",
"config",
"."
] | awslabs/aws-shell | python | https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/config.py#L47-L64 | [
"def",
"_load_template_or_config",
"(",
"self",
",",
"template_path",
",",
"config_path",
")",
":",
"expanded_config_path",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"config_path",
")",
"cfg",
"=",
"ConfigObj",
"(",
")",
"cfg",
".",
"filename",
"=",
"e... | 8950f03d9d720879890af6c11537b8f9789ce5a9 |
train | Config._copy_template_to_config | Write the default config from a template.
:type template_path: str
:param template_path: The template config file path.
:type config_path: str
:param config_path: The user's config file path.
:type overwrite: bool
:param overwrite: (Optional) Determines whether to over... | awsshell/config.py | def _copy_template_to_config(self, template_path,
config_path, overwrite=False):
"""Write the default config from a template.
:type template_path: str
:param template_path: The template config file path.
:type config_path: str
:param config_path... | def _copy_template_to_config(self, template_path,
config_path, overwrite=False):
"""Write the default config from a template.
:type template_path: str
:param template_path: The template config file path.
:type config_path: str
:param config_path... | [
"Write",
"the",
"default",
"config",
"from",
"a",
"template",
"."
] | awslabs/aws-shell | python | https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/config.py#L66-L92 | [
"def",
"_copy_template_to_config",
"(",
"self",
",",
"template_path",
",",
"config_path",
",",
"overwrite",
"=",
"False",
")",
":",
"config_path",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"config_path",
")",
"if",
"not",
"overwrite",
"and",
"os",
".",... | 8950f03d9d720879890af6c11537b8f9789ce5a9 |
train | StyleFactory.style_factory | Retrieve the specified pygments style.
If the specified style is not found, the vim style is returned.
:type style_name: str
:param style_name: The pygments style name.
:rtype: :class:`pygments.style.StyleMeta`
:return: Pygments style info. | awsshell/style.py | def style_factory(self, style_name):
"""Retrieve the specified pygments style.
If the specified style is not found, the vim style is returned.
:type style_name: str
:param style_name: The pygments style name.
:rtype: :class:`pygments.style.StyleMeta`
:return: Pygments ... | def style_factory(self, style_name):
"""Retrieve the specified pygments style.
If the specified style is not found, the vim style is returned.
:type style_name: str
:param style_name: The pygments style name.
:rtype: :class:`pygments.style.StyleMeta`
:return: Pygments ... | [
"Retrieve",
"the",
"specified",
"pygments",
"style",
"."
] | awslabs/aws-shell | python | https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/style.py#L29-L67 | [
"def",
"style_factory",
"(",
"self",
",",
"style_name",
")",
":",
"try",
":",
"style",
"=",
"get_style_by_name",
"(",
"style_name",
")",
"except",
"ClassNotFound",
":",
"style",
"=",
"get_style_by_name",
"(",
"'vim'",
")",
"# Create a style dictionary.",
"styles",... | 8950f03d9d720879890af6c11537b8f9789ce5a9 |
train | AWSShellCompleter.change_profile | Change the profile used for server side completions. | awsshell/shellcomplete.py | def change_profile(self, profile_name):
"""Change the profile used for server side completions."""
self._server_side_completer = self._create_server_side_completer(
session=botocore.session.Session(profile=profile_name)) | def change_profile(self, profile_name):
"""Change the profile used for server side completions."""
self._server_side_completer = self._create_server_side_completer(
session=botocore.session.Session(profile=profile_name)) | [
"Change",
"the",
"profile",
"used",
"for",
"server",
"side",
"completions",
"."
] | awslabs/aws-shell | python | https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/shellcomplete.py#L53-L56 | [
"def",
"change_profile",
"(",
"self",
",",
"profile_name",
")",
":",
"self",
".",
"_server_side_completer",
"=",
"self",
".",
"_create_server_side_completer",
"(",
"session",
"=",
"botocore",
".",
"session",
".",
"Session",
"(",
"profile",
"=",
"profile_name",
"... | 8950f03d9d720879890af6c11537b8f9789ce5a9 |
train | AWSCLIModelCompleter.autocomplete | Given a line, return a list of suggestions. | awsshell/autocomplete.py | def autocomplete(self, line):
"""Given a line, return a list of suggestions."""
current_length = len(line)
self._current_line = line
if current_length == 1 and self._last_position > 1:
# Reset state. This is likely from a user completing
# a previous command.
... | def autocomplete(self, line):
"""Given a line, return a list of suggestions."""
current_length = len(line)
self._current_line = line
if current_length == 1 and self._last_position > 1:
# Reset state. This is likely from a user completing
# a previous command.
... | [
"Given",
"a",
"line",
"return",
"a",
"list",
"of",
"suggestions",
"."
] | awslabs/aws-shell | python | https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/autocomplete.py#L46-L115 | [
"def",
"autocomplete",
"(",
"self",
",",
"line",
")",
":",
"current_length",
"=",
"len",
"(",
"line",
")",
"self",
".",
"_current_line",
"=",
"line",
"if",
"current_length",
"==",
"1",
"and",
"self",
".",
"_last_position",
">",
"1",
":",
"# Reset state. T... | 8950f03d9d720879890af6c11537b8f9789ce5a9 |
train | EditHandler.run | Open application's history buffer in an editor.
:type command: list
:param command: The dot command as a list split
on whitespace, e.g ``['.foo', 'arg1', 'arg2']``
:type application: AWSShell
:param application: The application object. | awsshell/app.py | def run(self, command, application):
"""Open application's history buffer in an editor.
:type command: list
:param command: The dot command as a list split
on whitespace, e.g ``['.foo', 'arg1', 'arg2']``
:type application: AWSShell
:param application: The applicatio... | def run(self, command, application):
"""Open application's history buffer in an editor.
:type command: list
:param command: The dot command as a list split
on whitespace, e.g ``['.foo', 'arg1', 'arg2']``
:type application: AWSShell
:param application: The applicatio... | [
"Open",
"application",
"s",
"history",
"buffer",
"in",
"an",
"editor",
"."
] | awslabs/aws-shell | python | https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/app.py#L88-L111 | [
"def",
"run",
"(",
"self",
",",
"command",
",",
"application",
")",
":",
"with",
"temporary_file",
"(",
"'w'",
")",
"as",
"f",
":",
"all_commands",
"=",
"self",
".",
"_generate_edit_history",
"(",
"application",
")",
"f",
".",
"write",
"(",
"all_commands",... | 8950f03d9d720879890af6c11537b8f9789ce5a9 |
train | ProfileHandler.run | Get or set the profile.
If .profile is called with no args, the current profile
is displayed. If the .profile command is called with a
single arg, then the current profile for the application
will be set to the new value. | awsshell/app.py | def run(self, command, application):
"""Get or set the profile.
If .profile is called with no args, the current profile
is displayed. If the .profile command is called with a
single arg, then the current profile for the application
will be set to the new value.
"""
... | def run(self, command, application):
"""Get or set the profile.
If .profile is called with no args, the current profile
is displayed. If the .profile command is called with a
single arg, then the current profile for the application
will be set to the new value.
"""
... | [
"Get",
"or",
"set",
"the",
"profile",
"."
] | awslabs/aws-shell | python | https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/app.py#L124-L146 | [
"def",
"run",
"(",
"self",
",",
"command",
",",
"application",
")",
":",
"if",
"len",
"(",
"command",
")",
"==",
"1",
":",
"profile",
"=",
"application",
".",
"profile",
"if",
"profile",
"is",
"None",
":",
"self",
".",
"_output",
".",
"write",
"(",
... | 8950f03d9d720879890af6c11537b8f9789ce5a9 |
train | DotCommandHandler.handle_cmd | Handle running a given dot command from a user.
:type command: str
:param command: The full dot command string, e.g. ``.edit``,
of ``.profile prod``.
:type application: AWSShell
:param application: The application object. | awsshell/app.py | def handle_cmd(self, command, application):
"""Handle running a given dot command from a user.
:type command: str
:param command: The full dot command string, e.g. ``.edit``,
of ``.profile prod``.
:type application: AWSShell
:param application: The application objec... | def handle_cmd(self, command, application):
"""Handle running a given dot command from a user.
:type command: str
:param command: The full dot command string, e.g. ``.edit``,
of ``.profile prod``.
:type application: AWSShell
:param application: The application objec... | [
"Handle",
"running",
"a",
"given",
"dot",
"command",
"from",
"a",
"user",
"."
] | awslabs/aws-shell | python | https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/app.py#L167-L185 | [
"def",
"handle_cmd",
"(",
"self",
",",
"command",
",",
"application",
")",
":",
"parts",
"=",
"command",
".",
"split",
"(",
")",
"cmd_name",
"=",
"parts",
"[",
"0",
"]",
"[",
"1",
":",
"]",
"if",
"cmd_name",
"not",
"in",
"self",
".",
"HANDLER_CLASSES... | 8950f03d9d720879890af6c11537b8f9789ce5a9 |
train | AWSShell.load_config | Load the config from the config file or template. | awsshell/app.py | def load_config(self):
"""Load the config from the config file or template."""
config = Config()
self.config_obj = config.load('awsshellrc')
self.config_section = self.config_obj['aws-shell']
self.model_completer.match_fuzzy = self.config_section.as_bool(
'match_fuzzy... | def load_config(self):
"""Load the config from the config file or template."""
config = Config()
self.config_obj = config.load('awsshellrc')
self.config_section = self.config_obj['aws-shell']
self.model_completer.match_fuzzy = self.config_section.as_bool(
'match_fuzzy... | [
"Load",
"the",
"config",
"from",
"the",
"config",
"file",
"or",
"template",
"."
] | awslabs/aws-shell | python | https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/app.py#L258-L270 | [
"def",
"load_config",
"(",
"self",
")",
":",
"config",
"=",
"Config",
"(",
")",
"self",
".",
"config_obj",
"=",
"config",
".",
"load",
"(",
"'awsshellrc'",
")",
"self",
".",
"config_section",
"=",
"self",
".",
"config_obj",
"[",
"'aws-shell'",
"]",
"self... | 8950f03d9d720879890af6c11537b8f9789ce5a9 |
train | AWSShell.save_config | Save the config to the config file. | awsshell/app.py | def save_config(self):
"""Save the config to the config file."""
self.config_section['match_fuzzy'] = self.model_completer.match_fuzzy
self.config_section['enable_vi_bindings'] = self.enable_vi_bindings
self.config_section['show_completion_columns'] = \
self.show_completion_c... | def save_config(self):
"""Save the config to the config file."""
self.config_section['match_fuzzy'] = self.model_completer.match_fuzzy
self.config_section['enable_vi_bindings'] = self.enable_vi_bindings
self.config_section['show_completion_columns'] = \
self.show_completion_c... | [
"Save",
"the",
"config",
"to",
"the",
"config",
"file",
"."
] | awslabs/aws-shell | python | https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/app.py#L272-L280 | [
"def",
"save_config",
"(",
"self",
")",
":",
"self",
".",
"config_section",
"[",
"'match_fuzzy'",
"]",
"=",
"self",
".",
"model_completer",
".",
"match_fuzzy",
"self",
".",
"config_section",
"[",
"'enable_vi_bindings'",
"]",
"=",
"self",
".",
"enable_vi_bindings... | 8950f03d9d720879890af6c11537b8f9789ce5a9 |
train | AWSShell.create_key_manager | Create the :class:`KeyManager`.
The inputs to KeyManager are expected to be callable, so we can't
use the standard @property and @attrib.setter for these attributes.
Lambdas cannot contain assignments so we're forced to define setters.
:rtype: :class:`KeyManager`
:return: A Key... | awsshell/app.py | def create_key_manager(self):
"""Create the :class:`KeyManager`.
The inputs to KeyManager are expected to be callable, so we can't
use the standard @property and @attrib.setter for these attributes.
Lambdas cannot contain assignments so we're forced to define setters.
:rtype: :... | def create_key_manager(self):
"""Create the :class:`KeyManager`.
The inputs to KeyManager are expected to be callable, so we can't
use the standard @property and @attrib.setter for these attributes.
Lambdas cannot contain assignments so we're forced to define setters.
:rtype: :... | [
"Create",
"the",
":",
"class",
":",
"KeyManager",
"."
] | awslabs/aws-shell | python | https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/app.py#L355-L413 | [
"def",
"create_key_manager",
"(",
"self",
")",
":",
"def",
"set_match_fuzzy",
"(",
"match_fuzzy",
")",
":",
"\"\"\"Setter for fuzzy matching mode.\n\n :type match_fuzzy: bool\n :param match_fuzzy: The match fuzzy flag.\n\n \"\"\"",
"self",
".",
"model_c... | 8950f03d9d720879890af6c11537b8f9789ce5a9 |
train | calculate_score | Calculate how well the search string matches the word. | awsshell/fuzzy.py | def calculate_score(search_string, word):
"""Calculate how well the search string matches the word."""
# See the module docstring for a high level description
# of what we're trying to do.
# * If the search string is larger than the word, we know
# immediately that this can't be a match.
if le... | def calculate_score(search_string, word):
"""Calculate how well the search string matches the word."""
# See the module docstring for a high level description
# of what we're trying to do.
# * If the search string is larger than the word, we know
# immediately that this can't be a match.
if le... | [
"Calculate",
"how",
"well",
"the",
"search",
"string",
"matches",
"the",
"word",
"."
] | awslabs/aws-shell | python | https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/fuzzy.py#L54-L84 | [
"def",
"calculate_score",
"(",
"search_string",
",",
"word",
")",
":",
"# See the module docstring for a high level description",
"# of what we're trying to do.",
"# * If the search string is larger than the word, we know",
"# immediately that this can't be a match.",
"if",
"len",
"(",... | 8950f03d9d720879890af6c11537b8f9789ce5a9 |
train | substring_search | Find all matches in the `collection` for the specified `word`.
If `word` is empty, returns all items in `collection`.
:type word: str
:param word: The substring to search for.
:type collection: collection, usually a list
:param collection: A collection of words to match.
:rtype: list of stri... | awsshell/substring.py | def substring_search(word, collection):
"""Find all matches in the `collection` for the specified `word`.
If `word` is empty, returns all items in `collection`.
:type word: str
:param word: The substring to search for.
:type collection: collection, usually a list
:param collection: A collecti... | def substring_search(word, collection):
"""Find all matches in the `collection` for the specified `word`.
If `word` is empty, returns all items in `collection`.
:type word: str
:param word: The substring to search for.
:type collection: collection, usually a list
:param collection: A collecti... | [
"Find",
"all",
"matches",
"in",
"the",
"collection",
"for",
"the",
"specified",
"word",
"."
] | awslabs/aws-shell | python | https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/substring.py#L15-L29 | [
"def",
"substring_search",
"(",
"word",
",",
"collection",
")",
":",
"return",
"[",
"item",
"for",
"item",
"in",
"sorted",
"(",
"collection",
")",
"if",
"item",
".",
"startswith",
"(",
"word",
")",
"]"
] | 8950f03d9d720879890af6c11537b8f9789ce5a9 |
train | Toolbar._create_toolbar_handler | Create the toolbar handler.
:type get_fuzzy_match: callable
:param fuzzy_match: Gets the fuzzy matching config.
:type get_enable_vi_bindings: callable
:param get_enable_vi_bindings: Gets the vi (or emacs) key bindings
config.
:type get_show_completion_columns: call... | awsshell/toolbar.py | def _create_toolbar_handler(self, get_match_fuzzy, get_enable_vi_bindings,
get_show_completion_columns, get_show_help):
"""Create the toolbar handler.
:type get_fuzzy_match: callable
:param fuzzy_match: Gets the fuzzy matching config.
:type get_enable_vi... | def _create_toolbar_handler(self, get_match_fuzzy, get_enable_vi_bindings,
get_show_completion_columns, get_show_help):
"""Create the toolbar handler.
:type get_fuzzy_match: callable
:param fuzzy_match: Gets the fuzzy matching config.
:type get_enable_vi... | [
"Create",
"the",
"toolbar",
"handler",
"."
] | awslabs/aws-shell | python | https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/toolbar.py#L30-L109 | [
"def",
"_create_toolbar_handler",
"(",
"self",
",",
"get_match_fuzzy",
",",
"get_enable_vi_bindings",
",",
"get_show_completion_columns",
",",
"get_show_help",
")",
":",
"assert",
"callable",
"(",
"get_match_fuzzy",
")",
"assert",
"callable",
"(",
"get_enable_vi_bindings"... | 8950f03d9d720879890af6c11537b8f9789ce5a9 |
train | create_default_layout | Generate default layout.
Returns a ``Layout`` instance.
:param message: Text to be used as prompt.
:param lexer: Lexer to be used for the highlighting.
:param is_password: `bool` or `CLIFilter`. When True, display input as '*'.
:param reserve_space_for_menu: When True, make sure that a minimal hei... | awsshell/ui.py | def create_default_layout(app, message='',
lexer=None, is_password=False,
reserve_space_for_menu=False,
get_prompt_tokens=None,
get_bottom_toolbar_tokens=None,
display_completions_in_columns... | def create_default_layout(app, message='',
lexer=None, is_password=False,
reserve_space_for_menu=False,
get_prompt_tokens=None,
get_bottom_toolbar_tokens=None,
display_completions_in_columns... | [
"Generate",
"default",
"layout",
"."
] | awslabs/aws-shell | python | https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/ui.py#L28-L197 | [
"def",
"create_default_layout",
"(",
"app",
",",
"message",
"=",
"''",
",",
"lexer",
"=",
"None",
",",
"is_password",
"=",
"False",
",",
"reserve_space_for_menu",
"=",
"False",
",",
"get_prompt_tokens",
"=",
"None",
",",
"get_bottom_toolbar_tokens",
"=",
"None",... | 8950f03d9d720879890af6c11537b8f9789ce5a9 |
train | temporary_file | Cross platform temporary file creation.
This is an alternative to ``tempfile.NamedTemporaryFile`` that
also works on windows and avoids the "file being used by
another process" error. | awsshell/utils.py | def temporary_file(mode):
"""Cross platform temporary file creation.
This is an alternative to ``tempfile.NamedTemporaryFile`` that
also works on windows and avoids the "file being used by
another process" error.
"""
tempdir = tempfile.gettempdir()
basename = 'tmpfile-%s' % (uuid.uuid4())
... | def temporary_file(mode):
"""Cross platform temporary file creation.
This is an alternative to ``tempfile.NamedTemporaryFile`` that
also works on windows and avoids the "file being used by
another process" error.
"""
tempdir = tempfile.gettempdir()
basename = 'tmpfile-%s' % (uuid.uuid4())
... | [
"Cross",
"platform",
"temporary",
"file",
"creation",
"."
] | awslabs/aws-shell | python | https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/utils.py#L31-L49 | [
"def",
"temporary_file",
"(",
"mode",
")",
":",
"tempdir",
"=",
"tempfile",
".",
"gettempdir",
"(",
")",
"basename",
"=",
"'tmpfile-%s'",
"%",
"(",
"uuid",
".",
"uuid4",
"(",
")",
")",
"full_filename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tempdir... | 8950f03d9d720879890af6c11537b8f9789ce5a9 |
train | FSLayer.file_contents | Return the file for a given filename.
If you want binary content use ``mode='rb'``. | awsshell/utils.py | def file_contents(self, filename, binary=False):
"""Return the file for a given filename.
If you want binary content use ``mode='rb'``.
"""
if binary:
mode = 'rb'
else:
mode = 'r'
try:
with open(filename, mode) as f:
r... | def file_contents(self, filename, binary=False):
"""Return the file for a given filename.
If you want binary content use ``mode='rb'``.
"""
if binary:
mode = 'rb'
else:
mode = 'r'
try:
with open(filename, mode) as f:
r... | [
"Return",
"the",
"file",
"for",
"a",
"given",
"filename",
"."
] | awslabs/aws-shell | python | https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/utils.py#L73-L87 | [
"def",
"file_contents",
"(",
"self",
",",
"filename",
",",
"binary",
"=",
"False",
")",
":",
"if",
"binary",
":",
"mode",
"=",
"'rb'",
"else",
":",
"mode",
"=",
"'r'",
"try",
":",
"with",
"open",
"(",
"filename",
",",
"mode",
")",
"as",
"f",
":",
... | 8950f03d9d720879890af6c11537b8f9789ce5a9 |
train | CompletionIndex.load_index | Load the completion index for a given CLI version.
:type version_string: str
:param version_string: The AWS CLI version, e.g "1.9.2".
:raises: :class:`IndexLoadError <exceptions.IndexLoadError>` | awsshell/index/completion.py | def load_index(self, version_string):
"""Load the completion index for a given CLI version.
:type version_string: str
:param version_string: The AWS CLI version, e.g "1.9.2".
:raises: :class:`IndexLoadError <exceptions.IndexLoadError>`
"""
filename = self._filename_for_... | def load_index(self, version_string):
"""Load the completion index for a given CLI version.
:type version_string: str
:param version_string: The AWS CLI version, e.g "1.9.2".
:raises: :class:`IndexLoadError <exceptions.IndexLoadError>`
"""
filename = self._filename_for_... | [
"Load",
"the",
"completion",
"index",
"for",
"a",
"given",
"CLI",
"version",
"."
] | awslabs/aws-shell | python | https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/index/completion.py#L53-L66 | [
"def",
"load_index",
"(",
"self",
",",
"version_string",
")",
":",
"filename",
"=",
"self",
".",
"_filename_for_version",
"(",
"version_string",
")",
"try",
":",
"contents",
"=",
"self",
".",
"_fslayer",
".",
"file_contents",
"(",
"filename",
")",
"except",
... | 8950f03d9d720879890af6c11537b8f9789ce5a9 |
train | CompletionIndex.load_completions | Load completions from the completion index.
Updates the following attributes:
* commands
* subcommands
* global_opts
* args_opts | awsshell/index/completion.py | def load_completions(self):
"""Load completions from the completion index.
Updates the following attributes:
* commands
* subcommands
* global_opts
* args_opts
"""
try:
index_str = self.load_index(utils.AWSCLI_VERSION)
... | def load_completions(self):
"""Load completions from the completion index.
Updates the following attributes:
* commands
* subcommands
* global_opts
* args_opts
"""
try:
index_str = self.load_index(utils.AWSCLI_VERSION)
... | [
"Load",
"completions",
"from",
"the",
"completion",
"index",
"."
] | awslabs/aws-shell | python | https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/index/completion.py#L72-L102 | [
"def",
"load_completions",
"(",
"self",
")",
":",
"try",
":",
"index_str",
"=",
"self",
".",
"load_index",
"(",
"utils",
".",
"AWSCLI_VERSION",
")",
"except",
"IndexLoadError",
":",
"return",
"index_str",
"=",
"self",
".",
"load_index",
"(",
"utils",
".",
... | 8950f03d9d720879890af6c11537b8f9789ce5a9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.