repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 3
values | summary stringlengths 4 350 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
shexSpec/grammar | parsers/python/pyshexc/parser_impl/shex_oneofshape_parser.py | ShexOneOfShapeParser.visitInlineShapeExpression | def visitInlineShapeExpression(self, ctx: ShExDocParser.InlineShapeExpressionContext):
""" inlineShapeExpression: inlineShapeOr """
expr_parser = ShexShapeExpressionParser(self.context)
expr_parser.visitChildren(ctx)
self.expression.valueExpr = expr_parser.expr | python | def visitInlineShapeExpression(self, ctx: ShExDocParser.InlineShapeExpressionContext):
""" inlineShapeExpression: inlineShapeOr """
expr_parser = ShexShapeExpressionParser(self.context)
expr_parser.visitChildren(ctx)
self.expression.valueExpr = expr_parser.expr | [
"def",
"visitInlineShapeExpression",
"(",
"self",
",",
"ctx",
":",
"ShExDocParser",
".",
"InlineShapeExpressionContext",
")",
":",
"expr_parser",
"=",
"ShexShapeExpressionParser",
"(",
"self",
".",
"context",
")",
"expr_parser",
".",
"visitChildren",
"(",
"ctx",
")"... | inlineShapeExpression: inlineShapeOr | [
"inlineShapeExpression",
":",
"inlineShapeOr"
] | 4497cd1f73fa6703bca6e2cb53ba9c120f22e48c | https://github.com/shexSpec/grammar/blob/4497cd1f73fa6703bca6e2cb53ba9c120f22e48c/parsers/python/pyshexc/parser_impl/shex_oneofshape_parser.py#L125-L129 | train | inlineShapeExpression is an inlineShapeExpression node. |
andy-z/ged4py | ged4py/detail/date.py | CalendarDate.parse | def parse(cls, datestr):
"""Parse <DATE> string and make :py:class:`CalendarDate` from it.
:param str datestr: String with GEDCOM date.
"""
m = DATE_RE.match(datestr)
if m is not None:
day = None if m.group(2) is None else int(m.group(2))
return cls(m.gro... | python | def parse(cls, datestr):
"""Parse <DATE> string and make :py:class:`CalendarDate` from it.
:param str datestr: String with GEDCOM date.
"""
m = DATE_RE.match(datestr)
if m is not None:
day = None if m.group(2) is None else int(m.group(2))
return cls(m.gro... | [
"def",
"parse",
"(",
"cls",
",",
"datestr",
")",
":",
"m",
"=",
"DATE_RE",
".",
"match",
"(",
"datestr",
")",
"if",
"m",
"is",
"not",
"None",
":",
"day",
"=",
"None",
"if",
"m",
".",
"group",
"(",
"2",
")",
"is",
"None",
"else",
"int",
"(",
"... | Parse <DATE> string and make :py:class:`CalendarDate` from it.
:param str datestr: String with GEDCOM date. | [
"Parse",
"<DATE",
">",
"string",
"and",
"make",
":",
"py",
":",
"class",
":",
"CalendarDate",
"from",
"it",
"."
] | d0e0cceaadf0a84cbf052705e3c27303b12e1757 | https://github.com/andy-z/ged4py/blob/d0e0cceaadf0a84cbf052705e3c27303b12e1757/ged4py/detail/date.py#L131-L139 | train | Parse a GEDCOM date string and make a CalendarDate object from it. |
andy-z/ged4py | ged4py/detail/date.py | CalendarDate.as_tuple | def as_tuple(self):
"""Date as three-tuple of numbers"""
if self._tuple is None:
# extract leading digits from year
year = 9999
if self.year:
m = self.DIGITS.match(self.year)
if m:
year = int(m.group(0))
... | python | def as_tuple(self):
"""Date as three-tuple of numbers"""
if self._tuple is None:
# extract leading digits from year
year = 9999
if self.year:
m = self.DIGITS.match(self.year)
if m:
year = int(m.group(0))
... | [
"def",
"as_tuple",
"(",
"self",
")",
":",
"if",
"self",
".",
"_tuple",
"is",
"None",
":",
"# extract leading digits from year",
"year",
"=",
"9999",
"if",
"self",
".",
"year",
":",
"m",
"=",
"self",
".",
"DIGITS",
".",
"match",
"(",
"self",
".",
"year"... | Date as three-tuple of numbers | [
"Date",
"as",
"three",
"-",
"tuple",
"of",
"numbers"
] | d0e0cceaadf0a84cbf052705e3c27303b12e1757 | https://github.com/andy-z/ged4py/blob/d0e0cceaadf0a84cbf052705e3c27303b12e1757/ged4py/detail/date.py#L142-L157 | train | Return a three - tuple of numbers. |
andy-z/ged4py | ged4py/detail/date.py | CalendarDate.fmt | def fmt(self):
"""Make printable representation out of this instance.
"""
val = str(self.year)
if self.month is not None:
val += ' ' + str(self.month)
if self.day is not None:
val += ' ' + str(self.day)
return val | python | def fmt(self):
"""Make printable representation out of this instance.
"""
val = str(self.year)
if self.month is not None:
val += ' ' + str(self.month)
if self.day is not None:
val += ' ' + str(self.day)
return val | [
"def",
"fmt",
"(",
"self",
")",
":",
"val",
"=",
"str",
"(",
"self",
".",
"year",
")",
"if",
"self",
".",
"month",
"is",
"not",
"None",
":",
"val",
"+=",
"' '",
"+",
"str",
"(",
"self",
".",
"month",
")",
"if",
"self",
".",
"day",
"is",
"not"... | Make printable representation out of this instance. | [
"Make",
"printable",
"representation",
"out",
"of",
"this",
"instance",
"."
] | d0e0cceaadf0a84cbf052705e3c27303b12e1757 | https://github.com/andy-z/ged4py/blob/d0e0cceaadf0a84cbf052705e3c27303b12e1757/ged4py/detail/date.py#L177-L185 | train | Return a printable representation of the instance. |
andy-z/ged4py | ged4py/detail/date.py | DateValue.parse | def parse(cls, datestr):
"""Parse string <DATE_VALUE> string and make :py:class:`DateValue`
instance out of it.
:param str datestr: String with GEDCOM date, range, period, etc.
"""
# some apps generate DATE recods without any value, which is
# non-standard, return empty ... | python | def parse(cls, datestr):
"""Parse string <DATE_VALUE> string and make :py:class:`DateValue`
instance out of it.
:param str datestr: String with GEDCOM date, range, period, etc.
"""
# some apps generate DATE recods without any value, which is
# non-standard, return empty ... | [
"def",
"parse",
"(",
"cls",
",",
"datestr",
")",
":",
"# some apps generate DATE recods without any value, which is",
"# non-standard, return empty DateValue for those",
"if",
"not",
"datestr",
":",
"return",
"cls",
"(",
")",
"for",
"regex",
",",
"tmpl",
"in",
"DATES",
... | Parse string <DATE_VALUE> string and make :py:class:`DateValue`
instance out of it.
:param str datestr: String with GEDCOM date, range, period, etc. | [
"Parse",
"string",
"<DATE_VALUE",
">",
"string",
"and",
"make",
":",
"py",
":",
"class",
":",
"DateValue",
"instance",
"out",
"of",
"it",
"."
] | d0e0cceaadf0a84cbf052705e3c27303b12e1757 | https://github.com/andy-z/ged4py/blob/d0e0cceaadf0a84cbf052705e3c27303b12e1757/ged4py/detail/date.py#L214-L234 | train | Parse string <DATE_VALUE > string and return a new instance of DateValue. |
andy-z/ged4py | ged4py/detail/date.py | DateValue._cmp_date | def _cmp_date(self):
"""Returns Calendar date used for comparison.
Use the earliest date out of all CalendarDates in this instance,
or some date in the future if there are no CalendarDates (e.g.
when Date is a phrase).
"""
dates = sorted(val for val in self.kw.values()
... | python | def _cmp_date(self):
"""Returns Calendar date used for comparison.
Use the earliest date out of all CalendarDates in this instance,
or some date in the future if there are no CalendarDates (e.g.
when Date is a phrase).
"""
dates = sorted(val for val in self.kw.values()
... | [
"def",
"_cmp_date",
"(",
"self",
")",
":",
"dates",
"=",
"sorted",
"(",
"val",
"for",
"val",
"in",
"self",
".",
"kw",
".",
"values",
"(",
")",
"if",
"isinstance",
"(",
"val",
",",
"CalendarDate",
")",
")",
"if",
"dates",
":",
"return",
"dates",
"["... | Returns Calendar date used for comparison.
Use the earliest date out of all CalendarDates in this instance,
or some date in the future if there are no CalendarDates (e.g.
when Date is a phrase). | [
"Returns",
"Calendar",
"date",
"used",
"for",
"comparison",
"."
] | d0e0cceaadf0a84cbf052705e3c27303b12e1757 | https://github.com/andy-z/ged4py/blob/d0e0cceaadf0a84cbf052705e3c27303b12e1757/ged4py/detail/date.py#L237-L249 | train | Returns CalendarDate used for comparison. |
andy-z/ged4py | ged4py/detail/date.py | DateValue.fmt | def fmt(self):
"""Make printable representation out of this instance.
"""
tmpl = string.Template(self.template)
kw = {}
for key, val in self.kw.items():
if key == 'phrase':
kw[key] = val
else:
kw[key] = val.fmt()
ret... | python | def fmt(self):
"""Make printable representation out of this instance.
"""
tmpl = string.Template(self.template)
kw = {}
for key, val in self.kw.items():
if key == 'phrase':
kw[key] = val
else:
kw[key] = val.fmt()
ret... | [
"def",
"fmt",
"(",
"self",
")",
":",
"tmpl",
"=",
"string",
".",
"Template",
"(",
"self",
".",
"template",
")",
"kw",
"=",
"{",
"}",
"for",
"key",
",",
"val",
"in",
"self",
".",
"kw",
".",
"items",
"(",
")",
":",
"if",
"key",
"==",
"'phrase'",
... | Make printable representation out of this instance. | [
"Make",
"printable",
"representation",
"out",
"of",
"this",
"instance",
"."
] | d0e0cceaadf0a84cbf052705e3c27303b12e1757 | https://github.com/andy-z/ged4py/blob/d0e0cceaadf0a84cbf052705e3c27303b12e1757/ged4py/detail/date.py#L269-L279 | train | Make printable representation of this instance. |
lekhakpadmanabh/Summarizer | smrzr/better_sentences.py | better_sentences | def better_sentences(func):
"""takes care of some edge cases of sentence
tokenization for cases when websites don't
close sentences properly, usually after
blockquotes, image captions or attributions"""
@wraps(func)
def wrapped(*args):
sentences = func(*args)
new_senten... | python | def better_sentences(func):
"""takes care of some edge cases of sentence
tokenization for cases when websites don't
close sentences properly, usually after
blockquotes, image captions or attributions"""
@wraps(func)
def wrapped(*args):
sentences = func(*args)
new_senten... | [
"def",
"better_sentences",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapped",
"(",
"*",
"args",
")",
":",
"sentences",
"=",
"func",
"(",
"*",
"args",
")",
"new_sentences",
"=",
"[",
"]",
"for",
"i",
",",
"l",
"in",
"enumerate"... | takes care of some edge cases of sentence
tokenization for cases when websites don't
close sentences properly, usually after
blockquotes, image captions or attributions | [
"takes",
"care",
"of",
"some",
"edge",
"cases",
"of",
"sentence",
"tokenization",
"for",
"cases",
"when",
"websites",
"don",
"t",
"close",
"sentences",
"properly",
"usually",
"after",
"blockquotes",
"image",
"captions",
"or",
"attributions"
] | 143456a48217905c720d87331f410e5c8b4e24aa | https://github.com/lekhakpadmanabh/Summarizer/blob/143456a48217905c720d87331f410e5c8b4e24aa/smrzr/better_sentences.py#L3-L26 | train | takes care of some edge cases of sentence
tokenization for cases when websites don t have close sentences properly |
south-coast-science/scs_core | src/scs_core/gas/pid_datum.py | PIDDatum.__we_c | def __we_c(cls, calib, tc, temp, we_v):
"""
Compute weC from sensor temperature compensation of weV
"""
offset_v = calib.pid_elc_mv / 1000.0
response_v = we_v - offset_v # remove electronic zero
response_c = tc.correct(temp, response_v) # correct the res... | python | def __we_c(cls, calib, tc, temp, we_v):
"""
Compute weC from sensor temperature compensation of weV
"""
offset_v = calib.pid_elc_mv / 1000.0
response_v = we_v - offset_v # remove electronic zero
response_c = tc.correct(temp, response_v) # correct the res... | [
"def",
"__we_c",
"(",
"cls",
",",
"calib",
",",
"tc",
",",
"temp",
",",
"we_v",
")",
":",
"offset_v",
"=",
"calib",
".",
"pid_elc_mv",
"/",
"1000.0",
"response_v",
"=",
"we_v",
"-",
"offset_v",
"# remove electronic zero",
"response_c",
"=",
"tc",
".",
"c... | Compute weC from sensor temperature compensation of weV | [
"Compute",
"weC",
"from",
"sensor",
"temperature",
"compensation",
"of",
"weV"
] | a4152b0bbed6acbbf257e1bba6a912f6ebe578e5 | https://github.com/south-coast-science/scs_core/blob/a4152b0bbed6acbbf257e1bba6a912f6ebe578e5/src/scs_core/gas/pid_datum.py#L44-L58 | train | Compute weC from weV and weV |
south-coast-science/scs_core | src/scs_core/gas/pid_datum.py | PIDDatum.__cnc | def __cnc(cls, calib, we_c):
"""
Compute cnc from weC
"""
if we_c is None:
return None
offset_v = calib.pid_elc_mv / 1000.0
response_c = we_c - offset_v # remove electronic zero
cnc = response_c / calib.pid_sens_mv # pid_sens_mv... | python | def __cnc(cls, calib, we_c):
"""
Compute cnc from weC
"""
if we_c is None:
return None
offset_v = calib.pid_elc_mv / 1000.0
response_c = we_c - offset_v # remove electronic zero
cnc = response_c / calib.pid_sens_mv # pid_sens_mv... | [
"def",
"__cnc",
"(",
"cls",
",",
"calib",
",",
"we_c",
")",
":",
"if",
"we_c",
"is",
"None",
":",
"return",
"None",
"offset_v",
"=",
"calib",
".",
"pid_elc_mv",
"/",
"1000.0",
"response_c",
"=",
"we_c",
"-",
"offset_v",
"# remove electronic zero",
"cnc",
... | Compute cnc from weC | [
"Compute",
"cnc",
"from",
"weC"
] | a4152b0bbed6acbbf257e1bba6a912f6ebe578e5 | https://github.com/south-coast-science/scs_core/blob/a4152b0bbed6acbbf257e1bba6a912f6ebe578e5/src/scs_core/gas/pid_datum.py#L62-L74 | train | Compute cnc from weC
|
GearPlug/payu-python | payu/client.py | Client._request | def _request(self, method, url, headers=None, **kwargs):
"""
Normally the connection guarantees response times of 3 seconds on average,
if there is an abnormal situation, the maximum response time is 1 minute.
It is highly recommended that you set “timeouts” when you connect with PayU.
... | python | def _request(self, method, url, headers=None, **kwargs):
"""
Normally the connection guarantees response times of 3 seconds on average,
if there is an abnormal situation, the maximum response time is 1 minute.
It is highly recommended that you set “timeouts” when you connect with PayU.
... | [
"def",
"_request",
"(",
"self",
",",
"method",
",",
"url",
",",
"headers",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"_headers",
"=",
"{",
"'Accept'",
":",
"'application/json'",
",",
"'Content-Type'",
":",
"'application/json'",
"}",
"if",
"headers",
... | Normally the connection guarantees response times of 3 seconds on average,
if there is an abnormal situation, the maximum response time is 1 minute.
It is highly recommended that you set “timeouts” when you connect with PayU.
Args:
method:
url:
headers:
... | [
"Normally",
"the",
"connection",
"guarantees",
"response",
"times",
"of",
"3",
"seconds",
"on",
"average",
"if",
"there",
"is",
"an",
"abnormal",
"situation",
"the",
"maximum",
"response",
"time",
"is",
"1",
"minute",
".",
"It",
"is",
"highly",
"recommended",
... | 47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e | https://github.com/GearPlug/payu-python/blob/47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e/payu/client.py#L82-L106 | train | Internal method for making a request to PayU. |
cloudbase/python-hnvclient | hnv/common/model.py | Field.add_to_class | def add_to_class(self, model_class):
"""Replace the `Field` attribute with a named `_FieldDescriptor`.
.. note::
This method is called during construction of the `Model`.
"""
model_class._meta.add_field(self)
setattr(model_class, self.name, _FieldDescriptor(self)) | python | def add_to_class(self, model_class):
"""Replace the `Field` attribute with a named `_FieldDescriptor`.
.. note::
This method is called during construction of the `Model`.
"""
model_class._meta.add_field(self)
setattr(model_class, self.name, _FieldDescriptor(self)) | [
"def",
"add_to_class",
"(",
"self",
",",
"model_class",
")",
":",
"model_class",
".",
"_meta",
".",
"add_field",
"(",
"self",
")",
"setattr",
"(",
"model_class",
",",
"self",
".",
"name",
",",
"_FieldDescriptor",
"(",
"self",
")",
")"
] | Replace the `Field` attribute with a named `_FieldDescriptor`.
.. note::
This method is called during construction of the `Model`. | [
"Replace",
"the",
"Field",
"attribute",
"with",
"a",
"named",
"_FieldDescriptor",
"."
] | b019452af01db22629809b8930357a2ebf6494be | https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/common/model.py#L126-L133 | train | Replace the Field attribute with a named _FieldDescriptor. |
cloudbase/python-hnvclient | hnv/common/model.py | _ModelOptions.add_field | def add_field(self, field):
"""Add the received field to the model."""
self.remove_field(field.name)
self._fields[field.name] = field
if field.default is not None:
if six.callable(field.default):
self._default_callables[field.key] = field.default
... | python | def add_field(self, field):
"""Add the received field to the model."""
self.remove_field(field.name)
self._fields[field.name] = field
if field.default is not None:
if six.callable(field.default):
self._default_callables[field.key] = field.default
... | [
"def",
"add_field",
"(",
"self",
",",
"field",
")",
":",
"self",
".",
"remove_field",
"(",
"field",
".",
"name",
")",
"self",
".",
"_fields",
"[",
"field",
".",
"name",
"]",
"=",
"field",
"if",
"field",
".",
"default",
"is",
"not",
"None",
":",
"if... | Add the received field to the model. | [
"Add",
"the",
"received",
"field",
"to",
"the",
"model",
"."
] | b019452af01db22629809b8930357a2ebf6494be | https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/common/model.py#L157-L166 | train | Add the received field to the model. |
cloudbase/python-hnvclient | hnv/common/model.py | _ModelOptions.remove_field | def remove_field(self, field_name):
"""Remove the field with the received field name from model."""
field = self._fields.pop(field_name, None)
if field is not None and field.default is not None:
if six.callable(field.default):
self._default_callables.pop(field.key, No... | python | def remove_field(self, field_name):
"""Remove the field with the received field name from model."""
field = self._fields.pop(field_name, None)
if field is not None and field.default is not None:
if six.callable(field.default):
self._default_callables.pop(field.key, No... | [
"def",
"remove_field",
"(",
"self",
",",
"field_name",
")",
":",
"field",
"=",
"self",
".",
"_fields",
".",
"pop",
"(",
"field_name",
",",
"None",
")",
"if",
"field",
"is",
"not",
"None",
"and",
"field",
".",
"default",
"is",
"not",
"None",
":",
"if"... | Remove the field with the received field name from model. | [
"Remove",
"the",
"field",
"with",
"the",
"received",
"field",
"name",
"from",
"model",
"."
] | b019452af01db22629809b8930357a2ebf6494be | https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/common/model.py#L168-L175 | train | Remove the field with the received field name from model. |
cloudbase/python-hnvclient | hnv/common/model.py | _ModelOptions.get_defaults | def get_defaults(self):
"""Get a dictionary that contains all the available defaults."""
defaults = self._defaults.copy()
for field_key, default in self._default_callables.items():
defaults[field_key] = default()
return defaults | python | def get_defaults(self):
"""Get a dictionary that contains all the available defaults."""
defaults = self._defaults.copy()
for field_key, default in self._default_callables.items():
defaults[field_key] = default()
return defaults | [
"def",
"get_defaults",
"(",
"self",
")",
":",
"defaults",
"=",
"self",
".",
"_defaults",
".",
"copy",
"(",
")",
"for",
"field_key",
",",
"default",
"in",
"self",
".",
"_default_callables",
".",
"items",
"(",
")",
":",
"defaults",
"[",
"field_key",
"]",
... | Get a dictionary that contains all the available defaults. | [
"Get",
"a",
"dictionary",
"that",
"contains",
"all",
"the",
"available",
"defaults",
"."
] | b019452af01db22629809b8930357a2ebf6494be | https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/common/model.py#L177-L182 | train | Get a dictionary that contains all the available defaults. |
newfies-dialer/python-msspeak | msspeak/msspeak.py | Speech.speak | def speak(self, text, lang, gender, format):
"""
Gather parameters and call.
:param text: Text to be sent to Bing TTS API to be converted to speech
:param lang: Language to be spoken
:param gender: Gender of the speaker
:param format: File format (see link below)
... | python | def speak(self, text, lang, gender, format):
"""
Gather parameters and call.
:param text: Text to be sent to Bing TTS API to be converted to speech
:param lang: Language to be spoken
:param gender: Gender of the speaker
:param format: File format (see link below)
... | [
"def",
"speak",
"(",
"self",
",",
"text",
",",
"lang",
",",
"gender",
",",
"format",
")",
":",
"namemap",
"=",
"{",
"\"ar-EG,Female\"",
":",
"\"Microsoft Server Speech Text to Speech Voice (ar-EG, Hoda)\"",
",",
"\"de-DE,Female\"",
":",
"\"Microsoft Server Speech Text t... | Gather parameters and call.
:param text: Text to be sent to Bing TTS API to be converted to speech
:param lang: Language to be spoken
:param gender: Gender of the speaker
:param format: File format (see link below)
Name maps and file format specifications can be found here:
... | [
"Gather",
"parameters",
"and",
"call",
"."
] | 106475122be73df152865c4fe6e9388caf974085 | https://github.com/newfies-dialer/python-msspeak/blob/106475122be73df152865c4fe6e9388caf974085/msspeak/msspeak.py#L89-L163 | train | Speech the specified text using the specified language and gender and format. |
newfies-dialer/python-msspeak | msspeak/msspeak.py | MSSpeak.speak | def speak(self, textstr, lang='en-US', gender='female', format='riff-16khz-16bit-mono-pcm'):
"""
Run will call Microsoft Translate API and and produce audio
"""
# print("speak(textstr=%s, lang=%s, gender=%s, format=%s)" % (textstr, lang, gender, format))
concatkey = '%s-%s-%s-%s'... | python | def speak(self, textstr, lang='en-US', gender='female', format='riff-16khz-16bit-mono-pcm'):
"""
Run will call Microsoft Translate API and and produce audio
"""
# print("speak(textstr=%s, lang=%s, gender=%s, format=%s)" % (textstr, lang, gender, format))
concatkey = '%s-%s-%s-%s'... | [
"def",
"speak",
"(",
"self",
",",
"textstr",
",",
"lang",
"=",
"'en-US'",
",",
"gender",
"=",
"'female'",
",",
"format",
"=",
"'riff-16khz-16bit-mono-pcm'",
")",
":",
"# print(\"speak(textstr=%s, lang=%s, gender=%s, format=%s)\" % (textstr, lang, gender, format))",
"concatk... | Run will call Microsoft Translate API and and produce audio | [
"Run",
"will",
"call",
"Microsoft",
"Translate",
"API",
"and",
"and",
"produce",
"audio"
] | 106475122be73df152865c4fe6e9388caf974085 | https://github.com/newfies-dialer/python-msspeak/blob/106475122be73df152865c4fe6e9388caf974085/msspeak/msspeak.py#L193-L210 | train | This method will call Microsoft Translate API and produce audio using the specified textstr and lang and gender and format. |
lambdalisue/notify | src/notify/executor.py | call | def call(args):
"""
Call terminal command and return exit_code and stdout
Parameters
----------
args : list
A command and arguments list
Returns
-------
list : [exit_code, stdout]
exit_code indicate the exit code of the command and stdout indicate the
output of ... | python | def call(args):
"""
Call terminal command and return exit_code and stdout
Parameters
----------
args : list
A command and arguments list
Returns
-------
list : [exit_code, stdout]
exit_code indicate the exit code of the command and stdout indicate the
output of ... | [
"def",
"call",
"(",
"args",
")",
":",
"b",
"=",
"StringIO",
"(",
")",
"p",
"=",
"subprocess",
".",
"Popen",
"(",
"args",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
",",
"stderr",
"=",
"subprocess",
".",
"STDOUT",
")",
"encoding",
"=",
"getattr",
... | Call terminal command and return exit_code and stdout
Parameters
----------
args : list
A command and arguments list
Returns
-------
list : [exit_code, stdout]
exit_code indicate the exit code of the command and stdout indicate the
output of the command | [
"Call",
"terminal",
"command",
"and",
"return",
"exit_code",
"and",
"stdout"
] | 1b6d7d1faa2cea13bfaa1f35130f279a0115e686 | https://github.com/lambdalisue/notify/blob/1b6d7d1faa2cea13bfaa1f35130f279a0115e686/src/notify/executor.py#L17-L51 | train | Call a command and return exit_code and stdout |
lambdalisue/notify | src/notify/executor.py | get_command_str | def get_command_str(args):
"""
Get terminal command string from list of command and arguments
Parameters
----------
args : list
A command and arguments list (unicode list)
Returns
-------
str
A string indicate terminal command
"""
single_quote = "'"
double_q... | python | def get_command_str(args):
"""
Get terminal command string from list of command and arguments
Parameters
----------
args : list
A command and arguments list (unicode list)
Returns
-------
str
A string indicate terminal command
"""
single_quote = "'"
double_q... | [
"def",
"get_command_str",
"(",
"args",
")",
":",
"single_quote",
"=",
"\"'\"",
"double_quote",
"=",
"'\"'",
"for",
"i",
",",
"value",
"in",
"enumerate",
"(",
"args",
")",
":",
"if",
"\" \"",
"in",
"value",
"and",
"double_quote",
"not",
"in",
"value",
":"... | Get terminal command string from list of command and arguments
Parameters
----------
args : list
A command and arguments list (unicode list)
Returns
-------
str
A string indicate terminal command | [
"Get",
"terminal",
"command",
"string",
"from",
"list",
"of",
"command",
"and",
"arguments"
] | 1b6d7d1faa2cea13bfaa1f35130f279a0115e686 | https://github.com/lambdalisue/notify/blob/1b6d7d1faa2cea13bfaa1f35130f279a0115e686/src/notify/executor.py#L53-L74 | train | Get terminal command string from list of command and arguments |
gtaylor/django-athumb | athumb/upload_handlers/gunicorn_eventlet.py | EventletTmpFileUploadHandler.receive_data_chunk | def receive_data_chunk(self, raw_data, start):
"""
Over-ridden method to circumvent the worker timeouts on large uploads.
"""
self.file.write(raw_data)
# CHANGED: This un-hangs us long enough to keep things rolling.
eventlet.sleep(0) | python | def receive_data_chunk(self, raw_data, start):
"""
Over-ridden method to circumvent the worker timeouts on large uploads.
"""
self.file.write(raw_data)
# CHANGED: This un-hangs us long enough to keep things rolling.
eventlet.sleep(0) | [
"def",
"receive_data_chunk",
"(",
"self",
",",
"raw_data",
",",
"start",
")",
":",
"self",
".",
"file",
".",
"write",
"(",
"raw_data",
")",
"# CHANGED: This un-hangs us long enough to keep things rolling.",
"eventlet",
".",
"sleep",
"(",
"0",
")"
] | Over-ridden method to circumvent the worker timeouts on large uploads. | [
"Over",
"-",
"ridden",
"method",
"to",
"circumvent",
"the",
"worker",
"timeouts",
"on",
"large",
"uploads",
"."
] | 69261ace0dff81e33156a54440874456a7b38dfb | https://github.com/gtaylor/django-athumb/blob/69261ace0dff81e33156a54440874456a7b38dfb/athumb/upload_handlers/gunicorn_eventlet.py#L15-L21 | train | This method is called when the worker is listening for data. |
pennlabs/penn-sdk-python | penn/transit.py | Transit.stoptimes | def stoptimes(self, start_date, end_date):
"""Return all stop times in the date range
:param start_date:
The starting date for the query.
:param end_date:
The end date for the query.
>>> import datetime
>>> today = datetime.date.today()
>>> trans.... | python | def stoptimes(self, start_date, end_date):
"""Return all stop times in the date range
:param start_date:
The starting date for the query.
:param end_date:
The end date for the query.
>>> import datetime
>>> today = datetime.date.today()
>>> trans.... | [
"def",
"stoptimes",
"(",
"self",
",",
"start_date",
",",
"end_date",
")",
":",
"params",
"=",
"{",
"'start'",
":",
"self",
".",
"format_date",
"(",
"start_date",
")",
",",
"'end'",
":",
"self",
".",
"format_date",
"(",
"end_date",
")",
"}",
"response",
... | Return all stop times in the date range
:param start_date:
The starting date for the query.
:param end_date:
The end date for the query.
>>> import datetime
>>> today = datetime.date.today()
>>> trans.stoptimes(today - datetime.timedelta(days=1), today) | [
"Return",
"all",
"stop",
"times",
"in",
"the",
"date",
"range"
] | 31ff12c20d69438d63bc7a796f83ce4f4c828396 | https://github.com/pennlabs/penn-sdk-python/blob/31ff12c20d69438d63bc7a796f83ce4f4c828396/penn/transit.py#L115-L131 | train | Return all stop times in the date range
|
geophysics-ubonn/reda | lib/reda/main/logger.py | LoggingClass.setup_logger | def setup_logger(self):
"""Setup a logger
"""
self.log_list = []
handler = ListHandler(self.log_list)
formatter = logging.Formatter(
'%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
logger = logging.getLogger()
... | python | def setup_logger(self):
"""Setup a logger
"""
self.log_list = []
handler = ListHandler(self.log_list)
formatter = logging.Formatter(
'%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
logger = logging.getLogger()
... | [
"def",
"setup_logger",
"(",
"self",
")",
":",
"self",
".",
"log_list",
"=",
"[",
"]",
"handler",
"=",
"ListHandler",
"(",
"self",
".",
"log_list",
")",
"formatter",
"=",
"logging",
".",
"Formatter",
"(",
"'%(asctime)s - %(name)s - %(levelname)s - %(message)s'",
... | Setup a logger | [
"Setup",
"a",
"logger"
] | 46a939729e40c7c4723315c03679c40761152e9e | https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/main/logger.py#L30-L46 | train | Setup a logger that logs to the log_list |
frasertweedale/ledgertools | ltlib/balance.py | match_to_dict | def match_to_dict(match):
"""Convert a match object into a dict.
Values are:
indent: amount of indentation of this [sub]account
parent: the parent dict (None)
account_fragment: account name fragment
balance: decimal.Decimal balance
children: sub-accounts ([])
"""
... | python | def match_to_dict(match):
"""Convert a match object into a dict.
Values are:
indent: amount of indentation of this [sub]account
parent: the parent dict (None)
account_fragment: account name fragment
balance: decimal.Decimal balance
children: sub-accounts ([])
"""
... | [
"def",
"match_to_dict",
"(",
"match",
")",
":",
"balance",
",",
"indent",
",",
"account_fragment",
"=",
"match",
".",
"group",
"(",
"1",
",",
"2",
",",
"3",
")",
"return",
"{",
"'balance'",
":",
"decimal",
".",
"Decimal",
"(",
"balance",
")",
",",
"'... | Convert a match object into a dict.
Values are:
indent: amount of indentation of this [sub]account
parent: the parent dict (None)
account_fragment: account name fragment
balance: decimal.Decimal balance
children: sub-accounts ([]) | [
"Convert",
"a",
"match",
"object",
"into",
"a",
"dict",
"."
] | a695f8667d72253e5448693c12f0282d09902aaa | https://github.com/frasertweedale/ledgertools/blob/a695f8667d72253e5448693c12f0282d09902aaa/ltlib/balance.py#L24-L41 | train | Convert a match object into a dict. |
frasertweedale/ledgertools | ltlib/balance.py | balance | def balance(output):
"""Convert `ledger balance` output into an hierarchical data structure."""
lines = map(pattern.search, output.splitlines())
stack = []
top = []
for item in map(match_to_dict, itertools.takewhile(lambda x: x, lines)):
# pop items off stack while current item has indent <... | python | def balance(output):
"""Convert `ledger balance` output into an hierarchical data structure."""
lines = map(pattern.search, output.splitlines())
stack = []
top = []
for item in map(match_to_dict, itertools.takewhile(lambda x: x, lines)):
# pop items off stack while current item has indent <... | [
"def",
"balance",
"(",
"output",
")",
":",
"lines",
"=",
"map",
"(",
"pattern",
".",
"search",
",",
"output",
".",
"splitlines",
"(",
")",
")",
"stack",
"=",
"[",
"]",
"top",
"=",
"[",
"]",
"for",
"item",
"in",
"map",
"(",
"match_to_dict",
",",
"... | Convert `ledger balance` output into an hierarchical data structure. | [
"Convert",
"ledger",
"balance",
"output",
"into",
"an",
"hierarchical",
"data",
"structure",
"."
] | a695f8667d72253e5448693c12f0282d09902aaa | https://github.com/frasertweedale/ledgertools/blob/a695f8667d72253e5448693c12f0282d09902aaa/ltlib/balance.py#L44-L64 | train | Convert ledger balance output into an hierarchical data structure. |
kaustavdm/pyAvroPhonetic | pyavrophonetic/utils/validate.py | is_punctuation | def is_punctuation(text):
"""Check if given string is a punctuation"""
return not (text.lower() in config.AVRO_VOWELS or
text.lower() in config.AVRO_CONSONANTS) | python | def is_punctuation(text):
"""Check if given string is a punctuation"""
return not (text.lower() in config.AVRO_VOWELS or
text.lower() in config.AVRO_CONSONANTS) | [
"def",
"is_punctuation",
"(",
"text",
")",
":",
"return",
"not",
"(",
"text",
".",
"lower",
"(",
")",
"in",
"config",
".",
"AVRO_VOWELS",
"or",
"text",
".",
"lower",
"(",
")",
"in",
"config",
".",
"AVRO_CONSONANTS",
")"
] | Check if given string is a punctuation | [
"Check",
"if",
"given",
"string",
"is",
"a",
"punctuation"
] | 26b7d567d8db025f2cac4de817e716390d7ac337 | https://github.com/kaustavdm/pyAvroPhonetic/blob/26b7d567d8db025f2cac4de817e716390d7ac337/pyavrophonetic/utils/validate.py#L43-L46 | train | Check if given string is a punctuation |
kaustavdm/pyAvroPhonetic | pyavrophonetic/utils/validate.py | is_exact | def is_exact(needle, haystack, start, end, matchnot):
"""Check exact occurrence of needle in haystack"""
return ((start >= 0 and end < len(haystack) and
haystack[start:end] == needle) ^ matchnot) | python | def is_exact(needle, haystack, start, end, matchnot):
"""Check exact occurrence of needle in haystack"""
return ((start >= 0 and end < len(haystack) and
haystack[start:end] == needle) ^ matchnot) | [
"def",
"is_exact",
"(",
"needle",
",",
"haystack",
",",
"start",
",",
"end",
",",
"matchnot",
")",
":",
"return",
"(",
"(",
"start",
">=",
"0",
"and",
"end",
"<",
"len",
"(",
"haystack",
")",
"and",
"haystack",
"[",
"start",
":",
"end",
"]",
"==",
... | Check exact occurrence of needle in haystack | [
"Check",
"exact",
"occurrence",
"of",
"needle",
"in",
"haystack"
] | 26b7d567d8db025f2cac4de817e716390d7ac337 | https://github.com/kaustavdm/pyAvroPhonetic/blob/26b7d567d8db025f2cac4de817e716390d7ac337/pyavrophonetic/utils/validate.py#L52-L55 | train | Check exact occurrence of needle in haystack |
kaustavdm/pyAvroPhonetic | pyavrophonetic/utils/validate.py | fix_string_case | def fix_string_case(text):
"""Converts case-insensitive characters to lower case
Case-sensitive characters as defined in config.AVRO_CASESENSITIVES
retain their case, but others are converted to their lowercase
equivalents. The result is a string with phonetic-compatible case
which will the parser ... | python | def fix_string_case(text):
"""Converts case-insensitive characters to lower case
Case-sensitive characters as defined in config.AVRO_CASESENSITIVES
retain their case, but others are converted to their lowercase
equivalents. The result is a string with phonetic-compatible case
which will the parser ... | [
"def",
"fix_string_case",
"(",
"text",
")",
":",
"fixed",
"=",
"[",
"]",
"for",
"i",
"in",
"text",
":",
"if",
"is_case_sensitive",
"(",
"i",
")",
":",
"fixed",
".",
"append",
"(",
"i",
")",
"else",
":",
"fixed",
".",
"append",
"(",
"i",
".",
"low... | Converts case-insensitive characters to lower case
Case-sensitive characters as defined in config.AVRO_CASESENSITIVES
retain their case, but others are converted to their lowercase
equivalents. The result is a string with phonetic-compatible case
which will the parser will understand without confusion. | [
"Converts",
"case",
"-",
"insensitive",
"characters",
"to",
"lower",
"case"
] | 26b7d567d8db025f2cac4de817e716390d7ac337 | https://github.com/kaustavdm/pyAvroPhonetic/blob/26b7d567d8db025f2cac4de817e716390d7ac337/pyavrophonetic/utils/validate.py#L57-L71 | train | Converts case - insensitive characters to lower case and returns a string with phonetic - compatible case. |
geophysics-ubonn/reda | lib/reda/configs/configManager.py | ConfigManager._crmod_to_abmn | def _crmod_to_abmn(self, configs):
"""convert crmod-style configurations to a Nx4 array
CRMod-style configurations merge A and B, and M and N, electrode
numbers into one large integer each:
.. math ::
AB = A \cdot 10^4 + B
MN = M \cdot 10^4 + N
Parame... | python | def _crmod_to_abmn(self, configs):
"""convert crmod-style configurations to a Nx4 array
CRMod-style configurations merge A and B, and M and N, electrode
numbers into one large integer each:
.. math ::
AB = A \cdot 10^4 + B
MN = M \cdot 10^4 + N
Parame... | [
"def",
"_crmod_to_abmn",
"(",
"self",
",",
"configs",
")",
":",
"A",
"=",
"configs",
"[",
":",
",",
"0",
"]",
"%",
"1e4",
"B",
"=",
"np",
".",
"floor",
"(",
"configs",
"[",
":",
",",
"0",
"]",
"/",
"1e4",
")",
".",
"astype",
"(",
"int",
")",
... | convert crmod-style configurations to a Nx4 array
CRMod-style configurations merge A and B, and M and N, electrode
numbers into one large integer each:
.. math ::
AB = A \cdot 10^4 + B
MN = M \cdot 10^4 + N
Parameters
----------
configs: numpy... | [
"convert",
"crmod",
"-",
"style",
"configurations",
"to",
"a",
"Nx4",
"array"
] | 46a939729e40c7c4723315c03679c40761152e9e | https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/configs/configManager.py#L54-L93 | train | convert crmod - style configurations to a Nx4 array containing the unique values |
geophysics-ubonn/reda | lib/reda/configs/configManager.py | ConfigManager.load_configs | def load_configs(self, filename):
"""Load configurations from a file with four columns: a b m n
"""
configs = np.loadtxt(filename)
self.add_to_configs(configs) | python | def load_configs(self, filename):
"""Load configurations from a file with four columns: a b m n
"""
configs = np.loadtxt(filename)
self.add_to_configs(configs) | [
"def",
"load_configs",
"(",
"self",
",",
"filename",
")",
":",
"configs",
"=",
"np",
".",
"loadtxt",
"(",
"filename",
")",
"self",
".",
"add_to_configs",
"(",
"configs",
")"
] | Load configurations from a file with four columns: a b m n | [
"Load",
"configurations",
"from",
"a",
"file",
"with",
"four",
"columns",
":",
"a",
"b",
"m",
"n"
] | 46a939729e40c7c4723315c03679c40761152e9e | https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/configs/configManager.py#L95-L99 | train | Load configurations from a file with four columns a b m n
|
geophysics-ubonn/reda | lib/reda/configs/configManager.py | ConfigManager.load_crmod_config | def load_crmod_config(self, filename):
"""Load a CRMod configuration file
Parameters
----------
filename: string
absolute or relative path to a crmod config.dat file
"""
with open(filename, 'r') as fid:
nr_of_configs = int(fid.readline().strip())... | python | def load_crmod_config(self, filename):
"""Load a CRMod configuration file
Parameters
----------
filename: string
absolute or relative path to a crmod config.dat file
"""
with open(filename, 'r') as fid:
nr_of_configs = int(fid.readline().strip())... | [
"def",
"load_crmod_config",
"(",
"self",
",",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
"as",
"fid",
":",
"nr_of_configs",
"=",
"int",
"(",
"fid",
".",
"readline",
"(",
")",
".",
"strip",
"(",
")",
")",
"configs",
"=",
... | Load a CRMod configuration file
Parameters
----------
filename: string
absolute or relative path to a crmod config.dat file | [
"Load",
"a",
"CRMod",
"configuration",
"file"
] | 46a939729e40c7c4723315c03679c40761152e9e | https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/configs/configManager.py#L101-L119 | train | Load a CRMod configuration file and store it in self. configs |
geophysics-ubonn/reda | lib/reda/configs/configManager.py | ConfigManager.load_crmod_volt | def load_crmod_volt(self, filename):
"""Load a CRMod measurement file (commonly called volt.dat)
Parameters
----------
filename: string
path to filename
Returns
-------
list
list of measurement ids
"""
with open(filename, ... | python | def load_crmod_volt(self, filename):
"""Load a CRMod measurement file (commonly called volt.dat)
Parameters
----------
filename: string
path to filename
Returns
-------
list
list of measurement ids
"""
with open(filename, ... | [
"def",
"load_crmod_volt",
"(",
"self",
",",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
"as",
"fid",
":",
"nr_of_configs",
"=",
"int",
"(",
"fid",
".",
"readline",
"(",
")",
".",
"strip",
"(",
")",
")",
"measurements",
"="... | Load a CRMod measurement file (commonly called volt.dat)
Parameters
----------
filename: string
path to filename
Returns
-------
list
list of measurement ids | [
"Load",
"a",
"CRMod",
"measurement",
"file",
"(",
"commonly",
"called",
"volt",
".",
"dat",
")"
] | 46a939729e40c7c4723315c03679c40761152e9e | https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/configs/configManager.py#L121-L154 | train | Load a CRMod measurement file into a list of unique ids. |
geophysics-ubonn/reda | lib/reda/configs/configManager.py | ConfigManager._get_crmod_abmn | def _get_crmod_abmn(self):
"""return a Nx2 array with the measurement configurations formatted
CRTomo style
"""
ABMN = np.vstack((
self.configs[:, 0] * 1e4 + self.configs[:, 1],
self.configs[:, 2] * 1e4 + self.configs[:, 3],
)).T.astype(int)
return... | python | def _get_crmod_abmn(self):
"""return a Nx2 array with the measurement configurations formatted
CRTomo style
"""
ABMN = np.vstack((
self.configs[:, 0] * 1e4 + self.configs[:, 1],
self.configs[:, 2] * 1e4 + self.configs[:, 3],
)).T.astype(int)
return... | [
"def",
"_get_crmod_abmn",
"(",
"self",
")",
":",
"ABMN",
"=",
"np",
".",
"vstack",
"(",
"(",
"self",
".",
"configs",
"[",
":",
",",
"0",
"]",
"*",
"1e4",
"+",
"self",
".",
"configs",
"[",
":",
",",
"1",
"]",
",",
"self",
".",
"configs",
"[",
... | return a Nx2 array with the measurement configurations formatted
CRTomo style | [
"return",
"a",
"Nx2",
"array",
"with",
"the",
"measurement",
"configurations",
"formatted",
"CRTomo",
"style"
] | 46a939729e40c7c4723315c03679c40761152e9e | https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/configs/configManager.py#L156-L164 | train | return a Nx2 array with the measurement configurations formatted
CRTomo style
|
geophysics-ubonn/reda | lib/reda/configs/configManager.py | ConfigManager.write_crmod_volt | def write_crmod_volt(self, filename, mid):
"""Write the measurements to the output file in the volt.dat file
format that can be read by CRTomo.
Parameters
----------
filename: string
output filename
mid: int or [int, int]
measurement ids of magnit... | python | def write_crmod_volt(self, filename, mid):
"""Write the measurements to the output file in the volt.dat file
format that can be read by CRTomo.
Parameters
----------
filename: string
output filename
mid: int or [int, int]
measurement ids of magnit... | [
"def",
"write_crmod_volt",
"(",
"self",
",",
"filename",
",",
"mid",
")",
":",
"ABMN",
"=",
"self",
".",
"_get_crmod_abmn",
"(",
")",
"if",
"isinstance",
"(",
"mid",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"mag_data",
"=",
"self",
".",
"measur... | Write the measurements to the output file in the volt.dat file
format that can be read by CRTomo.
Parameters
----------
filename: string
output filename
mid: int or [int, int]
measurement ids of magnitude and phase measurements. If only one ID
... | [
"Write",
"the",
"measurements",
"to",
"the",
"output",
"file",
"in",
"the",
"volt",
".",
"dat",
"file",
"format",
"that",
"can",
"be",
"read",
"by",
"CRTomo",
"."
] | 46a939729e40c7c4723315c03679c40761152e9e | https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/configs/configManager.py#L166-L196 | train | Write the measurements to the output file in the volt. dat file format that can be read by CRTomo. |
geophysics-ubonn/reda | lib/reda/configs/configManager.py | ConfigManager.write_crmod_config | def write_crmod_config(self, filename):
"""Write the configurations to a configuration file in the CRMod format
All configurations are merged into one previor to writing to file
Parameters
----------
filename: string
absolute or relative path to output filename (usua... | python | def write_crmod_config(self, filename):
"""Write the configurations to a configuration file in the CRMod format
All configurations are merged into one previor to writing to file
Parameters
----------
filename: string
absolute or relative path to output filename (usua... | [
"def",
"write_crmod_config",
"(",
"self",
",",
"filename",
")",
":",
"ABMN",
"=",
"self",
".",
"_get_crmod_abmn",
"(",
")",
"with",
"open",
"(",
"filename",
",",
"'wb'",
")",
"as",
"fid",
":",
"fid",
".",
"write",
"(",
"bytes",
"(",
"'{0}\\n'",
".",
... | Write the configurations to a configuration file in the CRMod format
All configurations are merged into one previor to writing to file
Parameters
----------
filename: string
absolute or relative path to output filename (usually config.dat) | [
"Write",
"the",
"configurations",
"to",
"a",
"configuration",
"file",
"in",
"the",
"CRMod",
"format",
"All",
"configurations",
"are",
"merged",
"into",
"one",
"previor",
"to",
"writing",
"to",
"file"
] | 46a939729e40c7c4723315c03679c40761152e9e | https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/configs/configManager.py#L198-L214 | train | Write the configuration file in the CRMod format |
geophysics-ubonn/reda | lib/reda/configs/configManager.py | ConfigManager.gen_dipole_dipole | def gen_dipole_dipole(self,
skipc,
skipv=None,
stepc=1,
stepv=1,
nr_voltage_dipoles=10,
before_current=False,
start_skip=0,
... | python | def gen_dipole_dipole(self,
skipc,
skipv=None,
stepc=1,
stepv=1,
nr_voltage_dipoles=10,
before_current=False,
start_skip=0,
... | [
"def",
"gen_dipole_dipole",
"(",
"self",
",",
"skipc",
",",
"skipv",
"=",
"None",
",",
"stepc",
"=",
"1",
",",
"stepv",
"=",
"1",
",",
"nr_voltage_dipoles",
"=",
"10",
",",
"before_current",
"=",
"False",
",",
"start_skip",
"=",
"0",
",",
"N",
"=",
"... | Generate dipole-dipole configurations
Parameters
----------
skipc: int
number of electrode positions that are skipped between electrodes
of a given dipole
skipv: int
steplength between subsequent voltage dipoles. A steplength of 0
will pro... | [
"Generate",
"dipole",
"-",
"dipole",
"configurations"
] | 46a939729e40c7c4723315c03679c40761152e9e | https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/configs/configManager.py#L216-L311 | train | Generate the dipole - dipole configurations for a given set of electrodes and current energy. |
geophysics-ubonn/reda | lib/reda/configs/configManager.py | ConfigManager.gen_gradient | def gen_gradient(self, skip=0, step=1, vskip=0, vstep=1):
"""Generate gradient measurements
Parameters
----------
skip: int
distance between current electrodes
step: int
steplength between subsequent current dipoles
vskip: int
distance... | python | def gen_gradient(self, skip=0, step=1, vskip=0, vstep=1):
"""Generate gradient measurements
Parameters
----------
skip: int
distance between current electrodes
step: int
steplength between subsequent current dipoles
vskip: int
distance... | [
"def",
"gen_gradient",
"(",
"self",
",",
"skip",
"=",
"0",
",",
"step",
"=",
"1",
",",
"vskip",
"=",
"0",
",",
"vstep",
"=",
"1",
")",
":",
"N",
"=",
"self",
".",
"nr_electrodes",
"quadpoles",
"=",
"[",
"]",
"for",
"a",
"in",
"range",
"(",
"1",... | Generate gradient measurements
Parameters
----------
skip: int
distance between current electrodes
step: int
steplength between subsequent current dipoles
vskip: int
distance between voltage electrodes
vstep: int
steplength... | [
"Generate",
"gradient",
"measurements"
] | 46a939729e40c7c4723315c03679c40761152e9e | https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/configs/configManager.py#L313-L341 | train | Generate gradient measurements for the current electrodes and voltage electrodes. |
geophysics-ubonn/reda | lib/reda/configs/configManager.py | ConfigManager.gen_all_current_dipoles | def gen_all_current_dipoles(self):
"""Generate all possible current dipoles for the given number of
electrodes (self.nr_electrodes). Duplicates are removed in the process.
After Noel and Xu, 1991, for N electrodes, the number of possible
unique configurations is :math:`N \cdot (N - 1) /... | python | def gen_all_current_dipoles(self):
"""Generate all possible current dipoles for the given number of
electrodes (self.nr_electrodes). Duplicates are removed in the process.
After Noel and Xu, 1991, for N electrodes, the number of possible
unique configurations is :math:`N \cdot (N - 1) /... | [
"def",
"gen_all_current_dipoles",
"(",
"self",
")",
":",
"N",
"=",
"self",
".",
"nr_electrodes",
"celecs",
"=",
"list",
"(",
"range",
"(",
"1",
",",
"N",
"+",
"1",
")",
")",
"AB_list",
"=",
"itertools",
".",
"permutations",
"(",
"celecs",
",",
"2",
"... | Generate all possible current dipoles for the given number of
electrodes (self.nr_electrodes). Duplicates are removed in the process.
After Noel and Xu, 1991, for N electrodes, the number of possible
unique configurations is :math:`N \cdot (N - 1) / 2`. This excludes
duplicates in the f... | [
"Generate",
"all",
"possible",
"current",
"dipoles",
"for",
"the",
"given",
"number",
"of",
"electrodes",
"(",
"self",
".",
"nr_electrodes",
")",
".",
"Duplicates",
"are",
"removed",
"in",
"the",
"process",
"."
] | 46a939729e40c7c4723315c03679c40761152e9e | https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/configs/configManager.py#L405-L429 | train | Generate all possible current dipoles for the given number of electrodes. |
geophysics-ubonn/reda | lib/reda/configs/configManager.py | ConfigManager.remove_duplicates | def remove_duplicates(self, configs=None):
"""remove duplicate entries from 4-point configurations. If no
configurations are provided, then use self.configs. Unique
configurations are only returned if configs is not None.
Parameters
----------
configs: Nx4 numpy.ndarray,... | python | def remove_duplicates(self, configs=None):
"""remove duplicate entries from 4-point configurations. If no
configurations are provided, then use self.configs. Unique
configurations are only returned if configs is not None.
Parameters
----------
configs: Nx4 numpy.ndarray,... | [
"def",
"remove_duplicates",
"(",
"self",
",",
"configs",
"=",
"None",
")",
":",
"if",
"configs",
"is",
"None",
":",
"c",
"=",
"self",
".",
"configs",
"else",
":",
"c",
"=",
"configs",
"struct",
"=",
"c",
".",
"view",
"(",
"c",
".",
"dtype",
".",
... | remove duplicate entries from 4-point configurations. If no
configurations are provided, then use self.configs. Unique
configurations are only returned if configs is not None.
Parameters
----------
configs: Nx4 numpy.ndarray, optional
remove duplicates from these con... | [
"remove",
"duplicate",
"entries",
"from",
"4",
"-",
"point",
"configurations",
".",
"If",
"no",
"configurations",
"are",
"provided",
"then",
"use",
"self",
".",
"configs",
".",
"Unique",
"configurations",
"are",
"only",
"returned",
"if",
"configs",
"is",
"not"... | 46a939729e40c7c4723315c03679c40761152e9e | https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/configs/configManager.py#L431-L457 | train | remove duplicate entries from 4 - point configurations. If no duplicates are provided use self. configs. |
geophysics-ubonn/reda | lib/reda/configs/configManager.py | ConfigManager.gen_schlumberger | def gen_schlumberger(self, M, N, a=None):
"""generate one Schlumberger sounding configuration, that is, one set
of configurations for one potential dipole MN.
Parameters
----------
M: int
electrode number for the first potential electrode
N: int
e... | python | def gen_schlumberger(self, M, N, a=None):
"""generate one Schlumberger sounding configuration, that is, one set
of configurations for one potential dipole MN.
Parameters
----------
M: int
electrode number for the first potential electrode
N: int
e... | [
"def",
"gen_schlumberger",
"(",
"self",
",",
"M",
",",
"N",
",",
"a",
"=",
"None",
")",
":",
"if",
"a",
"is",
"None",
":",
"a",
"=",
"np",
".",
"abs",
"(",
"M",
"-",
"N",
")",
"nr_of_steps_left",
"=",
"int",
"(",
"min",
"(",
"M",
",",
"N",
... | generate one Schlumberger sounding configuration, that is, one set
of configurations for one potential dipole MN.
Parameters
----------
M: int
electrode number for the first potential electrode
N: int
electrode number for the second potential electrode
... | [
"generate",
"one",
"Schlumberger",
"sounding",
"configuration",
"that",
"is",
"one",
"set",
"of",
"configurations",
"for",
"one",
"potential",
"dipole",
"MN",
"."
] | 46a939729e40c7c4723315c03679c40761152e9e | https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/configs/configManager.py#L459-L498 | train | generate one Schlumberger sounding configuration that is one set of configurations for one potential dipole MN. |
geophysics-ubonn/reda | lib/reda/configs/configManager.py | ConfigManager.add_to_configs | def add_to_configs(self, configs):
"""Add one or more measurement configurations to the stored
configurations
Parameters
----------
configs: list or numpy.ndarray
list or array of configurations
Returns
-------
configs: Kx4 numpy.ndarray
... | python | def add_to_configs(self, configs):
"""Add one or more measurement configurations to the stored
configurations
Parameters
----------
configs: list or numpy.ndarray
list or array of configurations
Returns
-------
configs: Kx4 numpy.ndarray
... | [
"def",
"add_to_configs",
"(",
"self",
",",
"configs",
")",
":",
"if",
"len",
"(",
"configs",
")",
"==",
"0",
":",
"return",
"None",
"if",
"self",
".",
"configs",
"is",
"None",
":",
"self",
".",
"configs",
"=",
"np",
".",
"atleast_2d",
"(",
"configs",... | Add one or more measurement configurations to the stored
configurations
Parameters
----------
configs: list or numpy.ndarray
list or array of configurations
Returns
-------
configs: Kx4 numpy.ndarray
array holding all configurations of th... | [
"Add",
"one",
"or",
"more",
"measurement",
"configurations",
"to",
"the",
"stored",
"configurations"
] | 46a939729e40c7c4723315c03679c40761152e9e | https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/configs/configManager.py#L521-L543 | train | Adds one or more measurement configurations to the stored
|
geophysics-ubonn/reda | lib/reda/configs/configManager.py | ConfigManager.split_into_normal_and_reciprocal | def split_into_normal_and_reciprocal(self, pad=False,
return_indices=False):
"""Split the stored configurations into normal and reciprocal
measurements
** *Rule 1: the normal configuration contains the smallest electrode
number of the four involv... | python | def split_into_normal_and_reciprocal(self, pad=False,
return_indices=False):
"""Split the stored configurations into normal and reciprocal
measurements
** *Rule 1: the normal configuration contains the smallest electrode
number of the four involv... | [
"def",
"split_into_normal_and_reciprocal",
"(",
"self",
",",
"pad",
"=",
"False",
",",
"return_indices",
"=",
"False",
")",
":",
"# for simplicity, we create an array where AB and MN are sorted",
"configs",
"=",
"np",
".",
"hstack",
"(",
"(",
"np",
".",
"sort",
"(",... | Split the stored configurations into normal and reciprocal
measurements
** *Rule 1: the normal configuration contains the smallest electrode
number of the four involved electrodes in the current dipole* **
Parameters
----------
pad: bool, optional
if True, a... | [
"Split",
"the",
"stored",
"configurations",
"into",
"normal",
"and",
"reciprocal",
"measurements"
] | 46a939729e40c7c4723315c03679c40761152e9e | https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/configs/configManager.py#L545-L638 | train | This function splits the stored configurations into normal and reciprocal configurations. |
geophysics-ubonn/reda | lib/reda/configs/configManager.py | ConfigManager.gen_reciprocals | def gen_reciprocals(self, append=False):
""" Generate reciprocal configurations, sort by AB, and optionally
append to configurations.
Parameters
----------
append : bool
Append reciprocals to configs (the default is False).
Examples
--------
... | python | def gen_reciprocals(self, append=False):
""" Generate reciprocal configurations, sort by AB, and optionally
append to configurations.
Parameters
----------
append : bool
Append reciprocals to configs (the default is False).
Examples
--------
... | [
"def",
"gen_reciprocals",
"(",
"self",
",",
"append",
"=",
"False",
")",
":",
"# Switch AB and MN",
"reciprocals",
"=",
"self",
".",
"configs",
".",
"copy",
"(",
")",
"[",
":",
",",
":",
":",
"-",
"1",
"]",
"reciprocals",
"[",
":",
",",
"0",
":",
"... | Generate reciprocal configurations, sort by AB, and optionally
append to configurations.
Parameters
----------
append : bool
Append reciprocals to configs (the default is False).
Examples
--------
>>> cfgs = ConfigManager(nr_of_electrodes=5)
... | [
"Generate",
"reciprocal",
"configurations",
"sort",
"by",
"AB",
"and",
"optionally",
"append",
"to",
"configurations",
"."
] | 46a939729e40c7c4723315c03679c40761152e9e | https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/configs/configManager.py#L640-L673 | train | Generate reciprocal configurations sort by AB and optionally append to configurations. |
geophysics-ubonn/reda | lib/reda/configs/configManager.py | ConfigManager.gen_configs_permutate | def gen_configs_permutate(self,
injections_raw,
only_same_dipole_length=False,
ignore_crossed_dipoles=False,
silent=False):
""" Create measurement configurations out of a pool of current
... | python | def gen_configs_permutate(self,
injections_raw,
only_same_dipole_length=False,
ignore_crossed_dipoles=False,
silent=False):
""" Create measurement configurations out of a pool of current
... | [
"def",
"gen_configs_permutate",
"(",
"self",
",",
"injections_raw",
",",
"only_same_dipole_length",
"=",
"False",
",",
"ignore_crossed_dipoles",
"=",
"False",
",",
"silent",
"=",
"False",
")",
":",
"injections",
"=",
"np",
".",
"atleast_2d",
"(",
"injections_raw",... | Create measurement configurations out of a pool of current
injections. Use only the provided dipoles for potential dipole
selection. This means that we have always reciprocal measurements.
Remove quadpoles where electrodes are used both as current and voltage
dipoles.
Paramete... | [
"Create",
"measurement",
"configurations",
"out",
"of",
"a",
"pool",
"of",
"current",
"injections",
".",
"Use",
"only",
"the",
"provided",
"dipoles",
"for",
"potential",
"dipole",
"selection",
".",
"This",
"means",
"that",
"we",
"have",
"always",
"reciprocal",
... | 46a939729e40c7c4723315c03679c40761152e9e | https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/configs/configManager.py#L675-L753 | train | Generates the measurement configurations for the given set of current energy modules. |
geophysics-ubonn/reda | lib/reda/configs/configManager.py | ConfigManager.remove_max_dipole_sep | def remove_max_dipole_sep(self, maxsep=10):
"""Remove configurations with dipole separations higher than `maxsep`.
Parameters
----------
maxsep : int
Maximum separation between both dipoles (the default is 10).
"""
sep = np.abs(self.configs[:, 1] - self.confi... | python | def remove_max_dipole_sep(self, maxsep=10):
"""Remove configurations with dipole separations higher than `maxsep`.
Parameters
----------
maxsep : int
Maximum separation between both dipoles (the default is 10).
"""
sep = np.abs(self.configs[:, 1] - self.confi... | [
"def",
"remove_max_dipole_sep",
"(",
"self",
",",
"maxsep",
"=",
"10",
")",
":",
"sep",
"=",
"np",
".",
"abs",
"(",
"self",
".",
"configs",
"[",
":",
",",
"1",
"]",
"-",
"self",
".",
"configs",
"[",
":",
",",
"2",
"]",
")",
"self",
".",
"config... | Remove configurations with dipole separations higher than `maxsep`.
Parameters
----------
maxsep : int
Maximum separation between both dipoles (the default is 10). | [
"Remove",
"configurations",
"with",
"dipole",
"separations",
"higher",
"than",
"maxsep",
"."
] | 46a939729e40c7c4723315c03679c40761152e9e | https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/configs/configManager.py#L755-L764 | train | Removes configurations with dipole separations higher than maxsep. |
geophysics-ubonn/reda | lib/reda/configs/configManager.py | ConfigManager.to_pg_scheme | def to_pg_scheme(self, container=None, positions=None):
"""Convert the configuration to a pygimli measurement scheme
Parameters
----------
container: reda.containers.ERT.ERT
an ERT data container (we take the electrode positions from here)
positions = None
R... | python | def to_pg_scheme(self, container=None, positions=None):
"""Convert the configuration to a pygimli measurement scheme
Parameters
----------
container: reda.containers.ERT.ERT
an ERT data container (we take the electrode positions from here)
positions = None
R... | [
"def",
"to_pg_scheme",
"(",
"self",
",",
"container",
"=",
"None",
",",
"positions",
"=",
"None",
")",
":",
"if",
"container",
"is",
"None",
"and",
"positions",
"is",
"None",
":",
"raise",
"Exception",
"(",
"'electrode positions are required for BERT export'",
"... | Convert the configuration to a pygimli measurement scheme
Parameters
----------
container: reda.containers.ERT.ERT
an ERT data container (we take the electrode positions from here)
positions = None
Returns
-------
data: pybert.DataContainerERT
... | [
"Convert",
"the",
"configuration",
"to",
"a",
"pygimli",
"measurement",
"scheme"
] | 46a939729e40c7c4723315c03679c40761152e9e | https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/configs/configManager.py#L771-L836 | train | Convert the configuration to a pygimli measurement scheme. |
geophysics-ubonn/reda | lib/reda/configs/configManager.py | ConfigManager.to_iris_syscal | def to_iris_syscal(self, filename):
"""Export to IRIS Instrument configuration file
Parameters
----------
filename : string
Path to output filename
"""
with open(filename, 'w') as fid:
# fprintf(fod, '#\t X\t Y\t Z\n');
fid.write('#\t ... | python | def to_iris_syscal(self, filename):
"""Export to IRIS Instrument configuration file
Parameters
----------
filename : string
Path to output filename
"""
with open(filename, 'w') as fid:
# fprintf(fod, '#\t X\t Y\t Z\n');
fid.write('#\t ... | [
"def",
"to_iris_syscal",
"(",
"self",
",",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'w'",
")",
"as",
"fid",
":",
"# fprintf(fod, '#\\t X\\t Y\\t Z\\n');",
"fid",
".",
"write",
"(",
"'#\\t X\\t Y\\t Z\\n'",
")",
"# fprintf(fod, '%d\\t %.1f\\t %d\\... | Export to IRIS Instrument configuration file
Parameters
----------
filename : string
Path to output filename | [
"Export",
"to",
"IRIS",
"Instrument",
"configuration",
"file"
] | 46a939729e40c7c4723315c03679c40761152e9e | https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/configs/configManager.py#L838-L860 | train | Export to IRIS Instrument configuration file |
GearPlug/payu-python | payu/recurring.py | Recurring.create_plan | def create_plan(self, *, plan_code, description, interval, interval_count, max_payments_allowed,
payment_attempts_delay, plan_value, plan_tax, plan_tax_return_base, currency,
max_payment_attempts=None, max_pending_payments=None, trial_days=None):
"""
Creating a ne... | python | def create_plan(self, *, plan_code, description, interval, interval_count, max_payments_allowed,
payment_attempts_delay, plan_value, plan_tax, plan_tax_return_base, currency,
max_payment_attempts=None, max_pending_payments=None, trial_days=None):
"""
Creating a ne... | [
"def",
"create_plan",
"(",
"self",
",",
"*",
",",
"plan_code",
",",
"description",
",",
"interval",
",",
"interval_count",
",",
"max_payments_allowed",
",",
"payment_attempts_delay",
",",
"plan_value",
",",
"plan_tax",
",",
"plan_tax_return_base",
",",
"currency",
... | Creating a new plan for subscriptions associated with the merchant.
Args:
plan_code: Unique code assigned by the merchant to the plan in order to identify it.
Alphanumeric. Min: 1 Max: 255.
description: Plan description.
Alphanumeric. Min: 1 Max: 255.
... | [
"Creating",
"a",
"new",
"plan",
"for",
"subscriptions",
"associated",
"with",
"the",
"merchant",
"."
] | 47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e | https://github.com/GearPlug/payu-python/blob/47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e/payu/recurring.py#L10-L90 | train | Creates a new plan for subscriptions associated with the merchant. |
GearPlug/payu-python | payu/recurring.py | Recurring.get_plan | def get_plan(self, plan_code):
"""
Check all the information of a plan for subscriptions associated with the merchant.
Args:
plan_code: Plan’s identification code for the merchant.
Returns:
"""
return self.client._get(self.url + 'plans/{}'.format(plan_code)... | python | def get_plan(self, plan_code):
"""
Check all the information of a plan for subscriptions associated with the merchant.
Args:
plan_code: Plan’s identification code for the merchant.
Returns:
"""
return self.client._get(self.url + 'plans/{}'.format(plan_code)... | [
"def",
"get_plan",
"(",
"self",
",",
"plan_code",
")",
":",
"return",
"self",
".",
"client",
".",
"_get",
"(",
"self",
".",
"url",
"+",
"'plans/{}'",
".",
"format",
"(",
"plan_code",
")",
",",
"headers",
"=",
"self",
".",
"get_headers",
"(",
")",
")"... | Check all the information of a plan for subscriptions associated with the merchant.
Args:
plan_code: Plan’s identification code for the merchant.
Returns: | [
"Check",
"all",
"the",
"information",
"of",
"a",
"plan",
"for",
"subscriptions",
"associated",
"with",
"the",
"merchant",
"."
] | 47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e | https://github.com/GearPlug/payu-python/blob/47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e/payu/recurring.py#L92-L102 | train | Check all the information of a plan for subscriptions associated with the merchant. |
GearPlug/payu-python | payu/recurring.py | Recurring.delete_plan | def delete_plan(self, plan_code):
"""
Delete an entire subscription plan associated with the merchant.
Args:
plan_code: Plan’s identification code for the merchant.
Returns:
"""
return self.client._delete(self.url + 'plans/{}'.format(plan_code), headers=sel... | python | def delete_plan(self, plan_code):
"""
Delete an entire subscription plan associated with the merchant.
Args:
plan_code: Plan’s identification code for the merchant.
Returns:
"""
return self.client._delete(self.url + 'plans/{}'.format(plan_code), headers=sel... | [
"def",
"delete_plan",
"(",
"self",
",",
"plan_code",
")",
":",
"return",
"self",
".",
"client",
".",
"_delete",
"(",
"self",
".",
"url",
"+",
"'plans/{}'",
".",
"format",
"(",
"plan_code",
")",
",",
"headers",
"=",
"self",
".",
"get_headers",
"(",
")",... | Delete an entire subscription plan associated with the merchant.
Args:
plan_code: Plan’s identification code for the merchant.
Returns: | [
"Delete",
"an",
"entire",
"subscription",
"plan",
"associated",
"with",
"the",
"merchant",
"."
] | 47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e | https://github.com/GearPlug/payu-python/blob/47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e/payu/recurring.py#L107-L117 | train | Delete an entire subscription plan associated with the merchant. |
GearPlug/payu-python | payu/recurring.py | Recurring.create_customer | def create_customer(self, *, full_name, email):
"""
Creation of a customer in the system.
Args:
full_name: Customer's complete name.
Alphanumeric. Max: 255.
email: Customer's email address.
Alphanumeric. Max: 255.
Returns:
"""
... | python | def create_customer(self, *, full_name, email):
"""
Creation of a customer in the system.
Args:
full_name: Customer's complete name.
Alphanumeric. Max: 255.
email: Customer's email address.
Alphanumeric. Max: 255.
Returns:
"""
... | [
"def",
"create_customer",
"(",
"self",
",",
"*",
",",
"full_name",
",",
"email",
")",
":",
"payload",
"=",
"{",
"\"fullName\"",
":",
"full_name",
",",
"\"email\"",
":",
"email",
"}",
"return",
"self",
".",
"client",
".",
"_post",
"(",
"self",
".",
"url... | Creation of a customer in the system.
Args:
full_name: Customer's complete name.
Alphanumeric. Max: 255.
email: Customer's email address.
Alphanumeric. Max: 255.
Returns: | [
"Creation",
"of",
"a",
"customer",
"in",
"the",
"system",
"."
] | 47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e | https://github.com/GearPlug/payu-python/blob/47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e/payu/recurring.py#L119-L137 | train | This method creates a customer in the system. |
GearPlug/payu-python | payu/recurring.py | Recurring.get_customer | def get_customer(self, customer_id):
"""
Queries the information related to the customer.
Args:
customer_id: Identifier of the client from which you want to find the associated information.
Returns:
"""
return self.client._get(self.url + 'customers/{}'.form... | python | def get_customer(self, customer_id):
"""
Queries the information related to the customer.
Args:
customer_id: Identifier of the client from which you want to find the associated information.
Returns:
"""
return self.client._get(self.url + 'customers/{}'.form... | [
"def",
"get_customer",
"(",
"self",
",",
"customer_id",
")",
":",
"return",
"self",
".",
"client",
".",
"_get",
"(",
"self",
".",
"url",
"+",
"'customers/{}'",
".",
"format",
"(",
"customer_id",
")",
",",
"headers",
"=",
"self",
".",
"get_headers",
"(",
... | Queries the information related to the customer.
Args:
customer_id: Identifier of the client from which you want to find the associated information.
Returns: | [
"Queries",
"the",
"information",
"related",
"to",
"the",
"customer",
"."
] | 47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e | https://github.com/GearPlug/payu-python/blob/47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e/payu/recurring.py#L139-L149 | train | Queries the information related to the customer. |
GearPlug/payu-python | payu/recurring.py | Recurring.delete_customer | def delete_customer(self, customer_id):
"""
Removes a user from the system.
Args:
customer_id: Identifier of the client to be deleted.
Returns:
"""
return self.client._delete(self.url + 'customers/{}'.format(customer_id), headers=self.get_headers()) | python | def delete_customer(self, customer_id):
"""
Removes a user from the system.
Args:
customer_id: Identifier of the client to be deleted.
Returns:
"""
return self.client._delete(self.url + 'customers/{}'.format(customer_id), headers=self.get_headers()) | [
"def",
"delete_customer",
"(",
"self",
",",
"customer_id",
")",
":",
"return",
"self",
".",
"client",
".",
"_delete",
"(",
"self",
".",
"url",
"+",
"'customers/{}'",
".",
"format",
"(",
"customer_id",
")",
",",
"headers",
"=",
"self",
".",
"get_headers",
... | Removes a user from the system.
Args:
customer_id: Identifier of the client to be deleted.
Returns: | [
"Removes",
"a",
"user",
"from",
"the",
"system",
"."
] | 47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e | https://github.com/GearPlug/payu-python/blob/47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e/payu/recurring.py#L154-L164 | train | Removes a user from the system. |
GearPlug/payu-python | payu/recurring.py | Recurring.create_credit_card | def create_credit_card(self, *, customer_id, name, document, number, exp_month, exp_year, type, address):
"""
Creating a credit card (Token) and assigning it to a user.
Args:
customer_id: Identifier of the client with whom you are going to associate the token with.
name... | python | def create_credit_card(self, *, customer_id, name, document, number, exp_month, exp_year, type, address):
"""
Creating a credit card (Token) and assigning it to a user.
Args:
customer_id: Identifier of the client with whom you are going to associate the token with.
name... | [
"def",
"create_credit_card",
"(",
"self",
",",
"*",
",",
"customer_id",
",",
"name",
",",
"document",
",",
"number",
",",
"exp_month",
",",
"exp_year",
",",
"type",
",",
"address",
")",
":",
"payload",
"=",
"{",
"\"name\"",
":",
"name",
",",
"\"document\... | Creating a credit card (Token) and assigning it to a user.
Args:
customer_id: Identifier of the client with whom you are going to associate the token with.
name: Full name of the credit card holder as shown in the credit card.
Alphanumeric. Min: 1 Max: 255.
doc... | [
"Creating",
"a",
"credit",
"card",
"(",
"Token",
")",
"and",
"assigning",
"it",
"to",
"a",
"user",
"."
] | 47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e | https://github.com/GearPlug/payu-python/blob/47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e/payu/recurring.py#L166-L209 | train | Creates a credit card for the user. |
GearPlug/payu-python | payu/recurring.py | Recurring.get_credit_card | def get_credit_card(self, credit_card_id):
"""
Check the information of a credit card (Token) data identifier.
Args:
credit_card_id: Credit Card Token you want to consult.
Returns:
"""
return self.client._get(self.url + 'creditCards/{}'.format(credit_card_i... | python | def get_credit_card(self, credit_card_id):
"""
Check the information of a credit card (Token) data identifier.
Args:
credit_card_id: Credit Card Token you want to consult.
Returns:
"""
return self.client._get(self.url + 'creditCards/{}'.format(credit_card_i... | [
"def",
"get_credit_card",
"(",
"self",
",",
"credit_card_id",
")",
":",
"return",
"self",
".",
"client",
".",
"_get",
"(",
"self",
".",
"url",
"+",
"'creditCards/{}'",
".",
"format",
"(",
"credit_card_id",
")",
",",
"headers",
"=",
"self",
".",
"get_header... | Check the information of a credit card (Token) data identifier.
Args:
credit_card_id: Credit Card Token you want to consult.
Returns: | [
"Check",
"the",
"information",
"of",
"a",
"credit",
"card",
"(",
"Token",
")",
"data",
"identifier",
"."
] | 47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e | https://github.com/GearPlug/payu-python/blob/47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e/payu/recurring.py#L211-L221 | train | Check the information of a credit card token. |
GearPlug/payu-python | payu/recurring.py | Recurring.delete_credit_card | def delete_credit_card(self, *, customer_id, credit_card_id):
"""
Delete a credit card (Token) associated with a user.
Args:
customer_id: Identifier of the client of whom you are going to delete the token.
credit_card_id: Identifier of the token to be deleted.
R... | python | def delete_credit_card(self, *, customer_id, credit_card_id):
"""
Delete a credit card (Token) associated with a user.
Args:
customer_id: Identifier of the client of whom you are going to delete the token.
credit_card_id: Identifier of the token to be deleted.
R... | [
"def",
"delete_credit_card",
"(",
"self",
",",
"*",
",",
"customer_id",
",",
"credit_card_id",
")",
":",
"fmt",
"=",
"'customers/{}/creditCards/{}'",
".",
"format",
"(",
"customer_id",
",",
"credit_card_id",
")",
"return",
"self",
".",
"client",
".",
"_delete",
... | Delete a credit card (Token) associated with a user.
Args:
customer_id: Identifier of the client of whom you are going to delete the token.
credit_card_id: Identifier of the token to be deleted.
Returns: | [
"Delete",
"a",
"credit",
"card",
"(",
"Token",
")",
"associated",
"with",
"a",
"user",
"."
] | 47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e | https://github.com/GearPlug/payu-python/blob/47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e/payu/recurring.py#L226-L238 | train | Delete a credit card associated with a user. |
GearPlug/payu-python | payu/recurring.py | Recurring.create_subscription | def create_subscription(self, *, customer_id, credit_card_token, plan_code, quantity=None, installments=None,
trial_days=None, immediate_payment=None, extra1=None, extra2=None, delivery_address=None,
notify_url=None, recurring_bill_items=None):
"""
... | python | def create_subscription(self, *, customer_id, credit_card_token, plan_code, quantity=None, installments=None,
trial_days=None, immediate_payment=None, extra1=None, extra2=None, delivery_address=None,
notify_url=None, recurring_bill_items=None):
"""
... | [
"def",
"create_subscription",
"(",
"self",
",",
"*",
",",
"customer_id",
",",
"credit_card_token",
",",
"plan_code",
",",
"quantity",
"=",
"None",
",",
"installments",
"=",
"None",
",",
"trial_days",
"=",
"None",
",",
"immediate_payment",
"=",
"None",
",",
"... | Creating a new subscription of a client to a plan.
Args:
customer_id: Customer that will be associated to the subscription.
You can find more information in the "Customer" section of this page.
credit_card_token: Customer's credit card that is selected to make the payment.
... | [
"Creating",
"a",
"new",
"subscription",
"of",
"a",
"client",
"to",
"a",
"plan",
"."
] | 47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e | https://github.com/GearPlug/payu-python/blob/47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e/payu/recurring.py#L240-L303 | train | This method creates a new subscription of a client to a plan. |
GearPlug/payu-python | payu/recurring.py | Recurring.get_subscription | def get_subscription(self, subscription_id):
"""
Check the basic information associated with the specified subscription.
Args:
subscription_id: Identification of the subscription.
Returns:
"""
return self.client._put(self.url + 'subscriptions/{}'.format(sub... | python | def get_subscription(self, subscription_id):
"""
Check the basic information associated with the specified subscription.
Args:
subscription_id: Identification of the subscription.
Returns:
"""
return self.client._put(self.url + 'subscriptions/{}'.format(sub... | [
"def",
"get_subscription",
"(",
"self",
",",
"subscription_id",
")",
":",
"return",
"self",
".",
"client",
".",
"_put",
"(",
"self",
".",
"url",
"+",
"'subscriptions/{}'",
".",
"format",
"(",
"subscription_id",
")",
",",
"headers",
"=",
"self",
".",
"get_h... | Check the basic information associated with the specified subscription.
Args:
subscription_id: Identification of the subscription.
Returns: | [
"Check",
"the",
"basic",
"information",
"associated",
"with",
"the",
"specified",
"subscription",
"."
] | 47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e | https://github.com/GearPlug/payu-python/blob/47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e/payu/recurring.py#L305-L315 | train | Check the basic information associated with the specified subscription. |
GearPlug/payu-python | payu/recurring.py | Recurring.update_subscription | def update_subscription(self, *, subscription_id, credit_card_token):
"""
Update information associated with the specified subscription. At the moment it is only possible
to update the token of the credit card to which the charge of the subscription is made.
Args:
subscripti... | python | def update_subscription(self, *, subscription_id, credit_card_token):
"""
Update information associated with the specified subscription. At the moment it is only possible
to update the token of the credit card to which the charge of the subscription is made.
Args:
subscripti... | [
"def",
"update_subscription",
"(",
"self",
",",
"*",
",",
"subscription_id",
",",
"credit_card_token",
")",
":",
"payload",
"=",
"{",
"\"creditCardToken\"",
":",
"credit_card_token",
"}",
"fmt",
"=",
"'subscriptions/{}'",
".",
"format",
"(",
"subscription_id",
")"... | Update information associated with the specified subscription. At the moment it is only possible
to update the token of the credit card to which the charge of the subscription is made.
Args:
subscription_id: Identification of the subscription.
credit_card_token:
Returns... | [
"Update",
"information",
"associated",
"with",
"the",
"specified",
"subscription",
".",
"At",
"the",
"moment",
"it",
"is",
"only",
"possible",
"to",
"update",
"the",
"token",
"of",
"the",
"credit",
"card",
"to",
"which",
"the",
"charge",
"of",
"the",
"subscr... | 47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e | https://github.com/GearPlug/payu-python/blob/47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e/payu/recurring.py#L317-L333 | train | Update the information associated with the specified subscription. |
GearPlug/payu-python | payu/recurring.py | Recurring.delete_subscription | def delete_subscription(self, subscription_id):
"""
Unsubscribe, delete the relationship of the customer with the plan.
Args:
subscription_id: Identification of the subscription.
Returns:
"""
return self.client._delete(self.url + 'subscriptions/{}'.format(s... | python | def delete_subscription(self, subscription_id):
"""
Unsubscribe, delete the relationship of the customer with the plan.
Args:
subscription_id: Identification of the subscription.
Returns:
"""
return self.client._delete(self.url + 'subscriptions/{}'.format(s... | [
"def",
"delete_subscription",
"(",
"self",
",",
"subscription_id",
")",
":",
"return",
"self",
".",
"client",
".",
"_delete",
"(",
"self",
".",
"url",
"+",
"'subscriptions/{}'",
".",
"format",
"(",
"subscription_id",
")",
",",
"headers",
"=",
"self",
".",
... | Unsubscribe, delete the relationship of the customer with the plan.
Args:
subscription_id: Identification of the subscription.
Returns: | [
"Unsubscribe",
"delete",
"the",
"relationship",
"of",
"the",
"customer",
"with",
"the",
"plan",
"."
] | 47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e | https://github.com/GearPlug/payu-python/blob/47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e/payu/recurring.py#L335-L345 | train | Unsubscribe the relationship of the customer with the plan with the subscription. |
GearPlug/payu-python | payu/recurring.py | Recurring.create_additional_charge | def create_additional_charge(self, *, subscription_id, description, plan_value, plan_tax, plan_tax_return_base,
currency):
"""
Adds extra charges to the respective invoice for the current period.
Args:
subscription_id: Identification of the subscript... | python | def create_additional_charge(self, *, subscription_id, description, plan_value, plan_tax, plan_tax_return_base,
currency):
"""
Adds extra charges to the respective invoice for the current period.
Args:
subscription_id: Identification of the subscript... | [
"def",
"create_additional_charge",
"(",
"self",
",",
"*",
",",
"subscription_id",
",",
"description",
",",
"plan_value",
",",
"plan_tax",
",",
"plan_tax_return_base",
",",
"currency",
")",
":",
"payload",
"=",
"{",
"\"description\"",
":",
"description",
",",
"\"... | Adds extra charges to the respective invoice for the current period.
Args:
subscription_id: Identification of the subscription
description:
plan_value:
plan_tax:
plan_tax_return_base:
currency:
Returns: | [
"Adds",
"extra",
"charges",
"to",
"the",
"respective",
"invoice",
"for",
"the",
"current",
"period",
"."
] | 47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e | https://github.com/GearPlug/payu-python/blob/47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e/payu/recurring.py#L347-L384 | train | This method creates an additional charge for the current period. |
GearPlug/payu-python | payu/recurring.py | Recurring.get_additional_charge_by_identifier | def get_additional_charge_by_identifier(self, recurring_billing_id):
"""
Query extra charge information of an invoice from its identifier.
Args:
recurring_billing_id: Identifier of the additional charge.
Returns:
"""
fmt = 'recurringBillItems/{}'.format(rec... | python | def get_additional_charge_by_identifier(self, recurring_billing_id):
"""
Query extra charge information of an invoice from its identifier.
Args:
recurring_billing_id: Identifier of the additional charge.
Returns:
"""
fmt = 'recurringBillItems/{}'.format(rec... | [
"def",
"get_additional_charge_by_identifier",
"(",
"self",
",",
"recurring_billing_id",
")",
":",
"fmt",
"=",
"'recurringBillItems/{}'",
".",
"format",
"(",
"recurring_billing_id",
")",
"return",
"self",
".",
"client",
".",
"_get",
"(",
"self",
".",
"url",
"+",
... | Query extra charge information of an invoice from its identifier.
Args:
recurring_billing_id: Identifier of the additional charge.
Returns: | [
"Query",
"extra",
"charge",
"information",
"of",
"an",
"invoice",
"from",
"its",
"identifier",
"."
] | 47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e | https://github.com/GearPlug/payu-python/blob/47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e/payu/recurring.py#L386-L397 | train | Query the additional charge information of an invoice from its identifier. |
GearPlug/payu-python | payu/recurring.py | Recurring.get_additional_charge_by_description | def get_additional_charge_by_description(self, description):
"""
Query extra charges of shop’s invoices that meet the stipulated filters.
Args:
description: Description entered in the extra charge.
Returns:
"""
params = {
"description": descript... | python | def get_additional_charge_by_description(self, description):
"""
Query extra charges of shop’s invoices that meet the stipulated filters.
Args:
description: Description entered in the extra charge.
Returns:
"""
params = {
"description": descript... | [
"def",
"get_additional_charge_by_description",
"(",
"self",
",",
"description",
")",
":",
"params",
"=",
"{",
"\"description\"",
":",
"description",
"}",
"return",
"self",
".",
"client",
".",
"_get",
"(",
"self",
".",
"url",
"+",
"'recurringBillItems/'",
",",
... | Query extra charges of shop’s invoices that meet the stipulated filters.
Args:
description: Description entered in the extra charge.
Returns: | [
"Query",
"extra",
"charges",
"of",
"shop’s",
"invoices",
"that",
"meet",
"the",
"stipulated",
"filters",
"."
] | 47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e | https://github.com/GearPlug/payu-python/blob/47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e/payu/recurring.py#L399-L412 | train | Query extra charges of shop’s invoices that meet the stipulated filters. |
GearPlug/payu-python | payu/recurring.py | Recurring.update_additional_charge | def update_additional_charge(self, *, recurring_billing_id, description, plan_value, plan_tax, plan_tax_return_base,
currency):
"""
Updates the information from an additional charge in an invoice.
Args:
recurring_billing_id: Identifier of the additio... | python | def update_additional_charge(self, *, recurring_billing_id, description, plan_value, plan_tax, plan_tax_return_base,
currency):
"""
Updates the information from an additional charge in an invoice.
Args:
recurring_billing_id: Identifier of the additio... | [
"def",
"update_additional_charge",
"(",
"self",
",",
"*",
",",
"recurring_billing_id",
",",
"description",
",",
"plan_value",
",",
"plan_tax",
",",
"plan_tax_return_base",
",",
"currency",
")",
":",
"payload",
"=",
"{",
"\"description\"",
":",
"description",
",",
... | Updates the information from an additional charge in an invoice.
Args:
recurring_billing_id: Identifier of the additional charge.
description:
plan_value:
plan_tax:
plan_tax_return_base:
currency:
Returns: | [
"Updates",
"the",
"information",
"from",
"an",
"additional",
"charge",
"in",
"an",
"invoice",
"."
] | 47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e | https://github.com/GearPlug/payu-python/blob/47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e/payu/recurring.py#L429-L466 | train | Updates the information from an additional charge in an invoice. |
GearPlug/payu-python | payu/recurring.py | Recurring.delete_additional_charge | def delete_additional_charge(self, recurring_billing_id):
"""
Remove an extra charge from an invoice.
Args:
recurring_billing_id: Identifier of the additional charge.
Returns:
"""
fmt = 'recurringBillItems/{}'.format(recurring_billing_id)
return sel... | python | def delete_additional_charge(self, recurring_billing_id):
"""
Remove an extra charge from an invoice.
Args:
recurring_billing_id: Identifier of the additional charge.
Returns:
"""
fmt = 'recurringBillItems/{}'.format(recurring_billing_id)
return sel... | [
"def",
"delete_additional_charge",
"(",
"self",
",",
"recurring_billing_id",
")",
":",
"fmt",
"=",
"'recurringBillItems/{}'",
".",
"format",
"(",
"recurring_billing_id",
")",
"return",
"self",
".",
"client",
".",
"_delete",
"(",
"self",
".",
"url",
"+",
"fmt",
... | Remove an extra charge from an invoice.
Args:
recurring_billing_id: Identifier of the additional charge.
Returns: | [
"Remove",
"an",
"extra",
"charge",
"from",
"an",
"invoice",
"."
] | 47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e | https://github.com/GearPlug/payu-python/blob/47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e/payu/recurring.py#L468-L479 | train | Remove an additional charge from an invoice. |
GearPlug/payu-python | payu/recurring.py | Recurring.get_recurring_bill_by_client | def get_recurring_bill_by_client(self, *, customer_id, date_begin=None, date_final=None):
"""
Consulta de las facturas que están pagadas o pendientes por pagar. Se puede consultar por cliente,
por suscripción o por rango de fechas.
Args:
customer_id:
date_begin:
... | python | def get_recurring_bill_by_client(self, *, customer_id, date_begin=None, date_final=None):
"""
Consulta de las facturas que están pagadas o pendientes por pagar. Se puede consultar por cliente,
por suscripción o por rango de fechas.
Args:
customer_id:
date_begin:
... | [
"def",
"get_recurring_bill_by_client",
"(",
"self",
",",
"*",
",",
"customer_id",
",",
"date_begin",
"=",
"None",
",",
"date_final",
"=",
"None",
")",
":",
"params",
"=",
"{",
"\"customerId\"",
":",
"customer_id",
",",
"}",
"if",
"date_begin",
"and",
"date_f... | Consulta de las facturas que están pagadas o pendientes por pagar. Se puede consultar por cliente,
por suscripción o por rango de fechas.
Args:
customer_id:
date_begin:
date_final:
Returns: | [
"Consulta",
"de",
"las",
"facturas",
"que",
"están",
"pagadas",
"o",
"pendientes",
"por",
"pagar",
".",
"Se",
"puede",
"consultar",
"por",
"cliente",
"por",
"suscripción",
"o",
"por",
"rango",
"de",
"fechas",
"."
] | 47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e | https://github.com/GearPlug/payu-python/blob/47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e/payu/recurring.py#L481-L500 | train | Get a list of all the recurring bills for a given customer. |
GearPlug/payu-python | payu/recurring.py | Recurring.get_recurring_bill_by_subscription | def get_recurring_bill_by_subscription(self, subscription_id):
"""
Consulta de las facturas que están pagadas o pendientes por pagar. Se puede consultar por cliente,
por suscripción o por rango de fechas.
Args:
subscription_id:
Returns:
"""
params =... | python | def get_recurring_bill_by_subscription(self, subscription_id):
"""
Consulta de las facturas que están pagadas o pendientes por pagar. Se puede consultar por cliente,
por suscripción o por rango de fechas.
Args:
subscription_id:
Returns:
"""
params =... | [
"def",
"get_recurring_bill_by_subscription",
"(",
"self",
",",
"subscription_id",
")",
":",
"params",
"=",
"{",
"\"subscriptionId\"",
":",
"subscription_id",
",",
"}",
"return",
"self",
".",
"client",
".",
"_get",
"(",
"self",
".",
"url",
"+",
"'recurringBill'",... | Consulta de las facturas que están pagadas o pendientes por pagar. Se puede consultar por cliente,
por suscripción o por rango de fechas.
Args:
subscription_id:
Returns: | [
"Consulta",
"de",
"las",
"facturas",
"que",
"están",
"pagadas",
"o",
"pendientes",
"por",
"pagar",
".",
"Se",
"puede",
"consultar",
"por",
"cliente",
"por",
"suscripción",
"o",
"por",
"rango",
"de",
"fechas",
"."
] | 47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e | https://github.com/GearPlug/payu-python/blob/47ec5c9fc89f1f89a53ec0a68c84f358bbe3394e/payu/recurring.py#L502-L516 | train | Get a list of all the recurring bills for a given subscription. |
gtaylor/django-athumb | athumb/templatetags/thumbnail.py | split_args | def split_args(args):
"""
Split a list of argument strings into a dictionary where each key is an
argument name.
An argument looks like ``force_ssl=True``.
"""
if not args:
return {}
# Handle the old comma separated argument format.
if len(args) == 1 and not REGEXP_ARGS.search(... | python | def split_args(args):
"""
Split a list of argument strings into a dictionary where each key is an
argument name.
An argument looks like ``force_ssl=True``.
"""
if not args:
return {}
# Handle the old comma separated argument format.
if len(args) == 1 and not REGEXP_ARGS.search(... | [
"def",
"split_args",
"(",
"args",
")",
":",
"if",
"not",
"args",
":",
"return",
"{",
"}",
"# Handle the old comma separated argument format.",
"if",
"len",
"(",
"args",
")",
"==",
"1",
"and",
"not",
"REGEXP_ARGS",
".",
"search",
"(",
"args",
"[",
"0",
"]",... | Split a list of argument strings into a dictionary where each key is an
argument name.
An argument looks like ``force_ssl=True``. | [
"Split",
"a",
"list",
"of",
"argument",
"strings",
"into",
"a",
"dictionary",
"where",
"each",
"key",
"is",
"an",
"argument",
"name",
"."
] | 69261ace0dff81e33156a54440874456a7b38dfb | https://github.com/gtaylor/django-athumb/blob/69261ace0dff81e33156a54440874456a7b38dfb/athumb/templatetags/thumbnail.py#L28-L49 | train | Split a list of argument strings into a dictionary where each key is an anonymized argument name and each value is the value of the argument. |
gtaylor/django-athumb | athumb/templatetags/thumbnail.py | thumbnail | def thumbnail(parser, token):
"""
Creates a thumbnail of for an ImageField.
To just output the absolute url to the thumbnail::
{% thumbnail image 80x80 %}
After the image path and dimensions, you can put any options::
{% thumbnail image 80x80 force_ssl=True %}
To put the thumbna... | python | def thumbnail(parser, token):
"""
Creates a thumbnail of for an ImageField.
To just output the absolute url to the thumbnail::
{% thumbnail image 80x80 %}
After the image path and dimensions, you can put any options::
{% thumbnail image 80x80 force_ssl=True %}
To put the thumbna... | [
"def",
"thumbnail",
"(",
"parser",
",",
"token",
")",
":",
"args",
"=",
"token",
".",
"split_contents",
"(",
")",
"tag",
"=",
"args",
"[",
"0",
"]",
"# Check to see if we're setting to a context variable.",
"if",
"len",
"(",
"args",
")",
">",
"4",
"and",
"... | Creates a thumbnail of for an ImageField.
To just output the absolute url to the thumbnail::
{% thumbnail image 80x80 %}
After the image path and dimensions, you can put any options::
{% thumbnail image 80x80 force_ssl=True %}
To put the thumbnail URL on the context instead of just rend... | [
"Creates",
"a",
"thumbnail",
"of",
"for",
"an",
"ImageField",
"."
] | 69261ace0dff81e33156a54440874456a7b38dfb | https://github.com/gtaylor/django-athumb/blob/69261ace0dff81e33156a54440874456a7b38dfb/athumb/templatetags/thumbnail.py#L142-L201 | train | Creates a thumbnail of an image field. |
geophysics-ubonn/reda | lib/reda/utils/fix_sign_with_K.py | fix_sign_with_K | def fix_sign_with_K(dataframe):
"""Swap electrode denotations so that geometrical (K) factors become
positive. Also, swap signs of all parameters affected by this process.
Affected parameters, at the moment, are:
* K
* r
* Vmn
* Zt
* rho_a
* rpha
Parame... | python | def fix_sign_with_K(dataframe):
"""Swap electrode denotations so that geometrical (K) factors become
positive. Also, swap signs of all parameters affected by this process.
Affected parameters, at the moment, are:
* K
* r
* Vmn
* Zt
* rho_a
* rpha
Parame... | [
"def",
"fix_sign_with_K",
"(",
"dataframe",
")",
":",
"# check for required columns",
"if",
"'k'",
"not",
"in",
"dataframe",
"or",
"'r'",
"not",
"in",
"dataframe",
":",
"raise",
"Exception",
"(",
"'k and r columns required!'",
")",
"indices_negative",
"=",
"(",
"d... | Swap electrode denotations so that geometrical (K) factors become
positive. Also, swap signs of all parameters affected by this process.
Affected parameters, at the moment, are:
* K
* r
* Vmn
* Zt
* rho_a
* rpha
Parameters
----------
dataframe : pan... | [
"Swap",
"electrode",
"denotations",
"so",
"that",
"geometrical",
"(",
"K",
")",
"factors",
"become",
"positive",
".",
"Also",
"swap",
"signs",
"of",
"all",
"parameters",
"affected",
"by",
"this",
"process",
"."
] | 46a939729e40c7c4723315c03679c40761152e9e | https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/utils/fix_sign_with_K.py#L8-L100 | train | Swap electrode denotations so that geometrical factors become
positive. |
gtaylor/django-athumb | athumb/pial/parsers.py | get_cropping_offset | def get_cropping_offset(crop, epsilon):
"""
Calculates the cropping offset for the cropped image. This only calculates
the offset for one dimension (X or Y). This should be called twice to get
the offsets for the X and Y dimensions.
:param str crop: A percentage cropping value for the plane. This i... | python | def get_cropping_offset(crop, epsilon):
"""
Calculates the cropping offset for the cropped image. This only calculates
the offset for one dimension (X or Y). This should be called twice to get
the offsets for the X and Y dimensions.
:param str crop: A percentage cropping value for the plane. This i... | [
"def",
"get_cropping_offset",
"(",
"crop",
",",
"epsilon",
")",
":",
"m",
"=",
"_CROP_PERCENT_PATTERN",
".",
"match",
"(",
"crop",
")",
"if",
"not",
"m",
":",
"raise",
"ThumbnailParseError",
"(",
"'Unrecognized crop option: %s'",
"%",
"crop",
")",
"value",
"="... | Calculates the cropping offset for the cropped image. This only calculates
the offset for one dimension (X or Y). This should be called twice to get
the offsets for the X and Y dimensions.
:param str crop: A percentage cropping value for the plane. This is in the
form of something like '50%'.
:... | [
"Calculates",
"the",
"cropping",
"offset",
"for",
"the",
"cropped",
"image",
".",
"This",
"only",
"calculates",
"the",
"offset",
"for",
"one",
"dimension",
"(",
"X",
"or",
"Y",
")",
".",
"This",
"should",
"be",
"called",
"twice",
"to",
"get",
"the",
"off... | 69261ace0dff81e33156a54440874456a7b38dfb | https://github.com/gtaylor/django-athumb/blob/69261ace0dff81e33156a54440874456a7b38dfb/athumb/pial/parsers.py#L27-L48 | train | Calculates the cropping offset for the cropped image. |
gtaylor/django-athumb | athumb/pial/parsers.py | parse_crop | def parse_crop(crop, xy_image, xy_window):
"""
Returns x, y offsets for cropping. The window area should fit inside
image but it works out anyway
:param str crop: A cropping offset string. This is either one or two
space-separated values. If only one value is specified, the cropping
amo... | python | def parse_crop(crop, xy_image, xy_window):
"""
Returns x, y offsets for cropping. The window area should fit inside
image but it works out anyway
:param str crop: A cropping offset string. This is either one or two
space-separated values. If only one value is specified, the cropping
amo... | [
"def",
"parse_crop",
"(",
"crop",
",",
"xy_image",
",",
"xy_window",
")",
":",
"# Cropping percentages are space-separated by axis. For example:",
"# '50% 75%' would be a 50% cropping ratio for X, and 75% for Y.",
"xy_crop",
"=",
"crop",
".",
"split",
"(",
"' '",
")",
"if",
... | Returns x, y offsets for cropping. The window area should fit inside
image but it works out anyway
:param str crop: A cropping offset string. This is either one or two
space-separated values. If only one value is specified, the cropping
amount (pixels or percentage) for both X and Y dimensions ... | [
"Returns",
"x",
"y",
"offsets",
"for",
"cropping",
".",
"The",
"window",
"area",
"should",
"fit",
"inside",
"image",
"but",
"it",
"works",
"out",
"anyway"
] | 69261ace0dff81e33156a54440874456a7b38dfb | https://github.com/gtaylor/django-athumb/blob/69261ace0dff81e33156a54440874456a7b38dfb/athumb/pial/parsers.py#L50-L92 | train | Parses the crop string and returns x y offsets for the image and window area of the image. |
spacetelescope/stsci.imagestats | stsci/imagestats/__init__.py | ImageStats._computeStats | def _computeStats(self):
""" Compute all the basic statistics from the array object. """
# Initialize the local max and min
_clipmin = self.lower
_clipmax = self.upper
# Compute the clipped mean iterating the user specified numer of iterations
for iter in range(self.ncl... | python | def _computeStats(self):
""" Compute all the basic statistics from the array object. """
# Initialize the local max and min
_clipmin = self.lower
_clipmax = self.upper
# Compute the clipped mean iterating the user specified numer of iterations
for iter in range(self.ncl... | [
"def",
"_computeStats",
"(",
"self",
")",
":",
"# Initialize the local max and min",
"_clipmin",
"=",
"self",
".",
"lower",
"_clipmax",
"=",
"self",
".",
"upper",
"# Compute the clipped mean iterating the user specified numer of iterations",
"for",
"iter",
"in",
"range",
... | Compute all the basic statistics from the array object. | [
"Compute",
"all",
"the",
"basic",
"statistics",
"from",
"the",
"array",
"object",
"."
] | d7fc9fe9783f7ed3dc9e4af47acd357a5ccd68e3 | https://github.com/spacetelescope/stsci.imagestats/blob/d7fc9fe9783f7ed3dc9e4af47acd357a5ccd68e3/stsci/imagestats/__init__.py#L205-L326 | train | Compute all the basic statistics from the array object. |
spacetelescope/stsci.imagestats | stsci/imagestats/__init__.py | ImageStats.printStats | def printStats(self):
""" Print the requested statistics values for those fields specified on input. """
print("--- Imagestats Results ---")
if (self.fields.find('npix') != -1 ):
print("Number of pixels : ",self.npix)
if (self.fields.find('min') != -1 ):
print(... | python | def printStats(self):
""" Print the requested statistics values for those fields specified on input. """
print("--- Imagestats Results ---")
if (self.fields.find('npix') != -1 ):
print("Number of pixels : ",self.npix)
if (self.fields.find('min') != -1 ):
print(... | [
"def",
"printStats",
"(",
"self",
")",
":",
"print",
"(",
"\"--- Imagestats Results ---\"",
")",
"if",
"(",
"self",
".",
"fields",
".",
"find",
"(",
"'npix'",
")",
"!=",
"-",
"1",
")",
":",
"print",
"(",
"\"Number of pixels : \"",
",",
"self",
".",
"np... | Print the requested statistics values for those fields specified on input. | [
"Print",
"the",
"requested",
"statistics",
"values",
"for",
"those",
"fields",
"specified",
"on",
"input",
"."
] | d7fc9fe9783f7ed3dc9e4af47acd357a5ccd68e3 | https://github.com/spacetelescope/stsci.imagestats/blob/d7fc9fe9783f7ed3dc9e4af47acd357a5ccd68e3/stsci/imagestats/__init__.py#L332-L351 | train | Prints the requested statistics values for those fields specified on input. |
digidotcom/python-wvalib | wva/http_client.py | WVAHttpClient.raw_request | def raw_request(self, method, uri, **kwargs):
"""Perform a WVA web services request and return the raw response object
:param method: The HTTP method to use when making this request
:param uri: The path past /ws to request. That is, the path requested for
a relpath of `a/b/c` would... | python | def raw_request(self, method, uri, **kwargs):
"""Perform a WVA web services request and return the raw response object
:param method: The HTTP method to use when making this request
:param uri: The path past /ws to request. That is, the path requested for
a relpath of `a/b/c` would... | [
"def",
"raw_request",
"(",
"self",
",",
"method",
",",
"uri",
",",
"*",
"*",
"kwargs",
")",
":",
"with",
"warnings",
".",
"catch_warnings",
"(",
")",
":",
"# catch warning about certs not being verified",
"warnings",
".",
"simplefilter",
"(",
"\"ignore\"",
",",
... | Perform a WVA web services request and return the raw response object
:param method: The HTTP method to use when making this request
:param uri: The path past /ws to request. That is, the path requested for
a relpath of `a/b/c` would be `/ws/a/b/c`.
:raises WVAHttpSocketError: if t... | [
"Perform",
"a",
"WVA",
"web",
"services",
"request",
"and",
"return",
"the",
"raw",
"response",
"object"
] | 4252735e2775f80ebaffd813fbe84046d26906b3 | https://github.com/digidotcom/python-wvalib/blob/4252735e2775f80ebaffd813fbe84046d26906b3/wva/http_client.py#L79-L97 | train | Perform a WVA request and return the raw response. |
digidotcom/python-wvalib | wva/http_client.py | WVAHttpClient.request | def request(self, method, uri, **kwargs):
"""Perform a WVA web services request and return the decoded value if successful
:param method: The HTTP method to use when making this request
:param uri: The path past /ws to request. That is, the path requested for
a relpath of `a/b/c` w... | python | def request(self, method, uri, **kwargs):
"""Perform a WVA web services request and return the decoded value if successful
:param method: The HTTP method to use when making this request
:param uri: The path past /ws to request. That is, the path requested for
a relpath of `a/b/c` w... | [
"def",
"request",
"(",
"self",
",",
"method",
",",
"uri",
",",
"*",
"*",
"kwargs",
")",
":",
"response",
"=",
"self",
".",
"raw_request",
"(",
"method",
",",
"uri",
",",
"*",
"*",
"kwargs",
")",
"if",
"response",
".",
"status_code",
"!=",
"200",
":... | Perform a WVA web services request and return the decoded value if successful
:param method: The HTTP method to use when making this request
:param uri: The path past /ws to request. That is, the path requested for
a relpath of `a/b/c` would be `/ws/a/b/c`.
:raises WVAHttpError: if... | [
"Perform",
"a",
"WVA",
"web",
"services",
"request",
"and",
"return",
"the",
"decoded",
"value",
"if",
"successful"
] | 4252735e2775f80ebaffd813fbe84046d26906b3 | https://github.com/digidotcom/python-wvalib/blob/4252735e2775f80ebaffd813fbe84046d26906b3/wva/http_client.py#L99-L121 | train | Perform a WVA request and return the decoded value if successful. |
digidotcom/python-wvalib | wva/http_client.py | WVAHttpClient.post | def post(self, uri, data, **kwargs):
"""POST the provided data to the specified path
See :meth:`request` for additional details. The `data` parameter here is
expected to be a string type.
"""
return self.request("POST", uri, data=data, **kwargs) | python | def post(self, uri, data, **kwargs):
"""POST the provided data to the specified path
See :meth:`request` for additional details. The `data` parameter here is
expected to be a string type.
"""
return self.request("POST", uri, data=data, **kwargs) | [
"def",
"post",
"(",
"self",
",",
"uri",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"request",
"(",
"\"POST\"",
",",
"uri",
",",
"data",
"=",
"data",
",",
"*",
"*",
"kwargs",
")"
] | POST the provided data to the specified path
See :meth:`request` for additional details. The `data` parameter here is
expected to be a string type. | [
"POST",
"the",
"provided",
"data",
"to",
"the",
"specified",
"path"
] | 4252735e2775f80ebaffd813fbe84046d26906b3 | https://github.com/digidotcom/python-wvalib/blob/4252735e2775f80ebaffd813fbe84046d26906b3/wva/http_client.py#L137-L143 | train | POST the provided data to the specified path |
digidotcom/python-wvalib | wva/http_client.py | WVAHttpClient.post_json | def post_json(self, uri, data, **kwargs):
"""POST the provided data as json to the specified path
See :meth:`request` for additional details.
"""
encoded_data = json.dumps(data)
kwargs.setdefault("headers", {}).update({
"Content-Type": "application/json", # tell ser... | python | def post_json(self, uri, data, **kwargs):
"""POST the provided data as json to the specified path
See :meth:`request` for additional details.
"""
encoded_data = json.dumps(data)
kwargs.setdefault("headers", {}).update({
"Content-Type": "application/json", # tell ser... | [
"def",
"post_json",
"(",
"self",
",",
"uri",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"encoded_data",
"=",
"json",
".",
"dumps",
"(",
"data",
")",
"kwargs",
".",
"setdefault",
"(",
"\"headers\"",
",",
"{",
"}",
")",
".",
"update",
"(",
"{",
... | POST the provided data as json to the specified path
See :meth:`request` for additional details. | [
"POST",
"the",
"provided",
"data",
"as",
"json",
"to",
"the",
"specified",
"path"
] | 4252735e2775f80ebaffd813fbe84046d26906b3 | https://github.com/digidotcom/python-wvalib/blob/4252735e2775f80ebaffd813fbe84046d26906b3/wva/http_client.py#L145-L154 | train | POST the provided data as json to the specified path
|
digidotcom/python-wvalib | wva/http_client.py | WVAHttpClient.put | def put(self, uri, data, **kwargs):
"""PUT the provided data to the specified path
See :meth:`request` for additional details. The `data` parameter here is
expected to be a string type.
"""
return self.request("PUT", uri, data=data, **kwargs) | python | def put(self, uri, data, **kwargs):
"""PUT the provided data to the specified path
See :meth:`request` for additional details. The `data` parameter here is
expected to be a string type.
"""
return self.request("PUT", uri, data=data, **kwargs) | [
"def",
"put",
"(",
"self",
",",
"uri",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"request",
"(",
"\"PUT\"",
",",
"uri",
",",
"data",
"=",
"data",
",",
"*",
"*",
"kwargs",
")"
] | PUT the provided data to the specified path
See :meth:`request` for additional details. The `data` parameter here is
expected to be a string type. | [
"PUT",
"the",
"provided",
"data",
"to",
"the",
"specified",
"path"
] | 4252735e2775f80ebaffd813fbe84046d26906b3 | https://github.com/digidotcom/python-wvalib/blob/4252735e2775f80ebaffd813fbe84046d26906b3/wva/http_client.py#L156-L162 | train | PUT the provided data to the specified path |
digidotcom/python-wvalib | wva/http_client.py | WVAHttpClient.put_json | def put_json(self, uri, data, **kwargs):
"""PUT the provided data as json to the specified path
See :meth:`request` for additional details.
"""
encoded_data = json.dumps(data)
kwargs.setdefault("headers", {}).update({
"Content-Type": "application/json", # tell serve... | python | def put_json(self, uri, data, **kwargs):
"""PUT the provided data as json to the specified path
See :meth:`request` for additional details.
"""
encoded_data = json.dumps(data)
kwargs.setdefault("headers", {}).update({
"Content-Type": "application/json", # tell serve... | [
"def",
"put_json",
"(",
"self",
",",
"uri",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"encoded_data",
"=",
"json",
".",
"dumps",
"(",
"data",
")",
"kwargs",
".",
"setdefault",
"(",
"\"headers\"",
",",
"{",
"}",
")",
".",
"update",
"(",
"{",
... | PUT the provided data as json to the specified path
See :meth:`request` for additional details. | [
"PUT",
"the",
"provided",
"data",
"as",
"json",
"to",
"the",
"specified",
"path"
] | 4252735e2775f80ebaffd813fbe84046d26906b3 | https://github.com/digidotcom/python-wvalib/blob/4252735e2775f80ebaffd813fbe84046d26906b3/wva/http_client.py#L164-L173 | train | PUT the provided data as json to the specified path
|
frawau/aiolifx | aiolifx/aiolifx.py | mac_to_ipv6_linklocal | def mac_to_ipv6_linklocal(mac,prefix="fe80::"):
""" Translate a MAC address into an IPv6 address in the prefixed network.
This function calculates the EUI (Extended Unique Identifier) from the given
MAC address and prepend the needed prefix to come up with a valid IPv6 address.
The default prefix is th... | python | def mac_to_ipv6_linklocal(mac,prefix="fe80::"):
""" Translate a MAC address into an IPv6 address in the prefixed network.
This function calculates the EUI (Extended Unique Identifier) from the given
MAC address and prepend the needed prefix to come up with a valid IPv6 address.
The default prefix is th... | [
"def",
"mac_to_ipv6_linklocal",
"(",
"mac",
",",
"prefix",
"=",
"\"fe80::\"",
")",
":",
"# Remove the most common delimiters; dots, dashes, etc.",
"mac_value",
"=",
"int",
"(",
"mac",
".",
"translate",
"(",
"str",
".",
"maketrans",
"(",
"dict",
"(",
"[",
"(",
"x... | Translate a MAC address into an IPv6 address in the prefixed network.
This function calculates the EUI (Extended Unique Identifier) from the given
MAC address and prepend the needed prefix to come up with a valid IPv6 address.
The default prefix is the link local prefix defined by RFC 4291 .
:para... | [
"Translate",
"a",
"MAC",
"address",
"into",
"an",
"IPv6",
"address",
"in",
"the",
"prefixed",
"network",
"."
] | 9bd8c5e6d291f4c79314989402f7e2c6476d5851 | https://github.com/frawau/aiolifx/blob/9bd8c5e6d291f4c79314989402f7e2c6476d5851/aiolifx/aiolifx.py#L41-L67 | train | Translate a MAC address into an IPv6 address in the prefixed network. |
frawau/aiolifx | aiolifx/aiolifx.py | Device.datagram_received | def datagram_received(self, data, addr):
"""Method run when data is received from the device
This method will unpack the data according to the LIFX protocol.
If the message represents some state information, it will update
the device state. Following that it will execute the callback co... | python | def datagram_received(self, data, addr):
"""Method run when data is received from the device
This method will unpack the data according to the LIFX protocol.
If the message represents some state information, it will update
the device state. Following that it will execute the callback co... | [
"def",
"datagram_received",
"(",
"self",
",",
"data",
",",
"addr",
")",
":",
"self",
".",
"register",
"(",
")",
"response",
"=",
"unpack_lifx_message",
"(",
"data",
")",
"self",
".",
"lastmsg",
"=",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
"i... | Method run when data is received from the device
This method will unpack the data according to the LIFX protocol.
If the message represents some state information, it will update
the device state. Following that it will execute the callback corresponding
to the message sequence number. ... | [
"Method",
"run",
"when",
"data",
"is",
"received",
"from",
"the",
"device"
] | 9bd8c5e6d291f4c79314989402f7e2c6476d5851 | https://github.com/frawau/aiolifx/blob/9bd8c5e6d291f4c79314989402f7e2c6476d5851/aiolifx/aiolifx.py#L146-L180 | train | This method is run when data is received from the device. It will unpack the data according to the LIFX protocol and then execute the appropriate callback corresponding
to the message sequence number. |
frawau/aiolifx | aiolifx/aiolifx.py | Device.register | def register(self):
"""Proxy method to register the device with the parent.
"""
if not self.registered:
self.registered = True
if self.parent:
self.parent.register(self) | python | def register(self):
"""Proxy method to register the device with the parent.
"""
if not self.registered:
self.registered = True
if self.parent:
self.parent.register(self) | [
"def",
"register",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"registered",
":",
"self",
".",
"registered",
"=",
"True",
"if",
"self",
".",
"parent",
":",
"self",
".",
"parent",
".",
"register",
"(",
"self",
")"
] | Proxy method to register the device with the parent. | [
"Proxy",
"method",
"to",
"register",
"the",
"device",
"with",
"the",
"parent",
"."
] | 9bd8c5e6d291f4c79314989402f7e2c6476d5851 | https://github.com/frawau/aiolifx/blob/9bd8c5e6d291f4c79314989402f7e2c6476d5851/aiolifx/aiolifx.py#L182-L188 | train | Proxy method to register the device with the parent. |
frawau/aiolifx | aiolifx/aiolifx.py | Device.unregister | def unregister(self):
"""Proxy method to unregister the device with the parent.
"""
if self.registered:
#Only if we have not received any message recently.
if datetime.datetime.now()-datetime.timedelta(seconds=self.unregister_timeout) > self.lastmsg:
self.... | python | def unregister(self):
"""Proxy method to unregister the device with the parent.
"""
if self.registered:
#Only if we have not received any message recently.
if datetime.datetime.now()-datetime.timedelta(seconds=self.unregister_timeout) > self.lastmsg:
self.... | [
"def",
"unregister",
"(",
"self",
")",
":",
"if",
"self",
".",
"registered",
":",
"#Only if we have not received any message recently.",
"if",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
"-",
"datetime",
".",
"timedelta",
"(",
"seconds",
"=",
"self",
".... | Proxy method to unregister the device with the parent. | [
"Proxy",
"method",
"to",
"unregister",
"the",
"device",
"with",
"the",
"parent",
"."
] | 9bd8c5e6d291f4c79314989402f7e2c6476d5851 | https://github.com/frawau/aiolifx/blob/9bd8c5e6d291f4c79314989402f7e2c6476d5851/aiolifx/aiolifx.py#L190-L198 | train | Unregisters the device with the parent. |
frawau/aiolifx | aiolifx/aiolifx.py | Device.cleanup | def cleanup(self):
"""Method to call to cleanly terminate the connection to the device.
"""
if self.transport:
self.transport.close()
self.transport = None
if self.task:
self.task.cancel()
self.task = None | python | def cleanup(self):
"""Method to call to cleanly terminate the connection to the device.
"""
if self.transport:
self.transport.close()
self.transport = None
if self.task:
self.task.cancel()
self.task = None | [
"def",
"cleanup",
"(",
"self",
")",
":",
"if",
"self",
".",
"transport",
":",
"self",
".",
"transport",
".",
"close",
"(",
")",
"self",
".",
"transport",
"=",
"None",
"if",
"self",
".",
"task",
":",
"self",
".",
"task",
".",
"cancel",
"(",
")",
"... | Method to call to cleanly terminate the connection to the device. | [
"Method",
"to",
"call",
"to",
"cleanly",
"terminate",
"the",
"connection",
"to",
"the",
"device",
"."
] | 9bd8c5e6d291f4c79314989402f7e2c6476d5851 | https://github.com/frawau/aiolifx/blob/9bd8c5e6d291f4c79314989402f7e2c6476d5851/aiolifx/aiolifx.py#L200-L208 | train | Method to cleanly terminate the connection to the device. |
frawau/aiolifx | aiolifx/aiolifx.py | Device.fire_sending | async def fire_sending(self,msg,num_repeats):
"""Coroutine used to send message to the device when no response is needed.
:param msg: Message to send
:type msg: aiolifx.
:param num_repeats: number of times the message is to be sent.
:returns: The coroutine that c... | python | async def fire_sending(self,msg,num_repeats):
"""Coroutine used to send message to the device when no response is needed.
:param msg: Message to send
:type msg: aiolifx.
:param num_repeats: number of times the message is to be sent.
:returns: The coroutine that c... | [
"async",
"def",
"fire_sending",
"(",
"self",
",",
"msg",
",",
"num_repeats",
")",
":",
"if",
"num_repeats",
"is",
"None",
":",
"num_repeats",
"=",
"self",
".",
"retry_count",
"sent_msg_count",
"=",
"0",
"sleep_interval",
"=",
"0.05",
"while",
"(",
"sent_msg_... | Coroutine used to send message to the device when no response is needed.
:param msg: Message to send
:type msg: aiolifx.
:param num_repeats: number of times the message is to be sent.
:returns: The coroutine that can be scheduled to run
:rtype: coroutine | [
"Coroutine",
"used",
"to",
"send",
"message",
"to",
"the",
"device",
"when",
"no",
"response",
"is",
"needed",
"."
] | 9bd8c5e6d291f4c79314989402f7e2c6476d5851 | https://github.com/frawau/aiolifx/blob/9bd8c5e6d291f4c79314989402f7e2c6476d5851/aiolifx/aiolifx.py#L214-L231 | train | Coroutine used to send a message to the device when no response is needed. |
frawau/aiolifx | aiolifx/aiolifx.py | Device.fire_and_forget | def fire_and_forget(self, msg_type, payload={}, timeout_secs=None, num_repeats=None):
"""Method used to send message to the device when no response/ack is needed.
:param msg_type: The type of the message to send, a subclass of aiolifx.Message
:type msg_type: class
:param pay... | python | def fire_and_forget(self, msg_type, payload={}, timeout_secs=None, num_repeats=None):
"""Method used to send message to the device when no response/ack is needed.
:param msg_type: The type of the message to send, a subclass of aiolifx.Message
:type msg_type: class
:param pay... | [
"def",
"fire_and_forget",
"(",
"self",
",",
"msg_type",
",",
"payload",
"=",
"{",
"}",
",",
"timeout_secs",
"=",
"None",
",",
"num_repeats",
"=",
"None",
")",
":",
"msg",
"=",
"msg_type",
"(",
"self",
".",
"mac_addr",
",",
"self",
".",
"source_id",
","... | Method used to send message to the device when no response/ack is needed.
:param msg_type: The type of the message to send, a subclass of aiolifx.Message
:type msg_type: class
:param payload: value to use when instantiating msg_type
:type payload: dict
:param... | [
"Method",
"used",
"to",
"send",
"message",
"to",
"the",
"device",
"when",
"no",
"response",
"/",
"ack",
"is",
"needed",
"."
] | 9bd8c5e6d291f4c79314989402f7e2c6476d5851 | https://github.com/frawau/aiolifx/blob/9bd8c5e6d291f4c79314989402f7e2c6476d5851/aiolifx/aiolifx.py#L234-L250 | train | Method used to send a message to the device when no response or ack is needed. |
frawau/aiolifx | aiolifx/aiolifx.py | Device.try_sending | async def try_sending(self,msg,timeout_secs, max_attempts):
"""Coroutine used to send message to the device when a response or ack is needed.
This coroutine will try to send up to max_attempts time the message, waiting timeout_secs
for an answer. If no answer is received, it will consider that ... | python | async def try_sending(self,msg,timeout_secs, max_attempts):
"""Coroutine used to send message to the device when a response or ack is needed.
This coroutine will try to send up to max_attempts time the message, waiting timeout_secs
for an answer. If no answer is received, it will consider that ... | [
"async",
"def",
"try_sending",
"(",
"self",
",",
"msg",
",",
"timeout_secs",
",",
"max_attempts",
")",
":",
"if",
"timeout_secs",
"is",
"None",
":",
"timeout_secs",
"=",
"self",
".",
"timeout",
"if",
"max_attempts",
"is",
"None",
":",
"max_attempts",
"=",
... | Coroutine used to send message to the device when a response or ack is needed.
This coroutine will try to send up to max_attempts time the message, waiting timeout_secs
for an answer. If no answer is received, it will consider that the device is no longer
accessible and will unregister it.
... | [
"Coroutine",
"used",
"to",
"send",
"message",
"to",
"the",
"device",
"when",
"a",
"response",
"or",
"ack",
"is",
"needed",
"."
] | 9bd8c5e6d291f4c79314989402f7e2c6476d5851 | https://github.com/frawau/aiolifx/blob/9bd8c5e6d291f4c79314989402f7e2c6476d5851/aiolifx/aiolifx.py#L253-L293 | train | Coroutine used to send a message to the device. |
frawau/aiolifx | aiolifx/aiolifx.py | Device.req_with_ack | def req_with_ack(self, msg_type, payload, callb = None, timeout_secs=None, max_attempts=None):
"""Method to send a message expecting to receive an ACK.
:param msg_type: The type of the message to send, a subclass of aiolifx.Message
:type msg_type: class
:param payload: value... | python | def req_with_ack(self, msg_type, payload, callb = None, timeout_secs=None, max_attempts=None):
"""Method to send a message expecting to receive an ACK.
:param msg_type: The type of the message to send, a subclass of aiolifx.Message
:type msg_type: class
:param payload: value... | [
"def",
"req_with_ack",
"(",
"self",
",",
"msg_type",
",",
"payload",
",",
"callb",
"=",
"None",
",",
"timeout_secs",
"=",
"None",
",",
"max_attempts",
"=",
"None",
")",
":",
"msg",
"=",
"msg_type",
"(",
"self",
".",
"mac_addr",
",",
"self",
".",
"sourc... | Method to send a message expecting to receive an ACK.
:param msg_type: The type of the message to send, a subclass of aiolifx.Message
:type msg_type: class
:param payload: value to use when instantiating msg_type
:type payload: dict
:param callb: A callback t... | [
"Method",
"to",
"send",
"a",
"message",
"expecting",
"to",
"receive",
"an",
"ACK",
"."
] | 9bd8c5e6d291f4c79314989402f7e2c6476d5851 | https://github.com/frawau/aiolifx/blob/9bd8c5e6d291f4c79314989402f7e2c6476d5851/aiolifx/aiolifx.py#L296-L315 | train | Method to send a message expecting to receive an ACK. |
frawau/aiolifx | aiolifx/aiolifx.py | Device.get_label | def get_label(self,callb=None):
"""Convenience method to request the label from the device
This method will check whether the value has already been retrieved from the device,
if so, it will simply return it. If no, it will request the information from the device
and request that callb ... | python | def get_label(self,callb=None):
"""Convenience method to request the label from the device
This method will check whether the value has already been retrieved from the device,
if so, it will simply return it. If no, it will request the information from the device
and request that callb ... | [
"def",
"get_label",
"(",
"self",
",",
"callb",
"=",
"None",
")",
":",
"if",
"self",
".",
"label",
"is",
"None",
":",
"mypartial",
"=",
"partial",
"(",
"self",
".",
"resp_set_label",
")",
"if",
"callb",
":",
"mycallb",
"=",
"lambda",
"x",
",",
"y",
... | Convenience method to request the label from the device
This method will check whether the value has already been retrieved from the device,
if so, it will simply return it. If no, it will request the information from the device
and request that callb be executed when a response is received. Th... | [
"Convenience",
"method",
"to",
"request",
"the",
"label",
"from",
"the",
"device"
] | 9bd8c5e6d291f4c79314989402f7e2c6476d5851 | https://github.com/frawau/aiolifx/blob/9bd8c5e6d291f4c79314989402f7e2c6476d5851/aiolifx/aiolifx.py#L367-L388 | train | Convenience method to request the label from the device. |
frawau/aiolifx | aiolifx/aiolifx.py | Device.set_label | def set_label(self, value,callb=None):
"""Convenience method to set the label of the device
This method will send a SetLabel message to the device, and request callb be executed
when an ACK is received. The default callback will simply cache the value.
:param value: The new label
... | python | def set_label(self, value,callb=None):
"""Convenience method to set the label of the device
This method will send a SetLabel message to the device, and request callb be executed
when an ACK is received. The default callback will simply cache the value.
:param value: The new label
... | [
"def",
"set_label",
"(",
"self",
",",
"value",
",",
"callb",
"=",
"None",
")",
":",
"if",
"len",
"(",
"value",
")",
">",
"32",
":",
"value",
"=",
"value",
"[",
":",
"32",
"]",
"mypartial",
"=",
"partial",
"(",
"self",
".",
"resp_set_label",
",",
... | Convenience method to set the label of the device
This method will send a SetLabel message to the device, and request callb be executed
when an ACK is received. The default callback will simply cache the value.
:param value: The new label
:type value: str
:param cal... | [
"Convenience",
"method",
"to",
"set",
"the",
"label",
"of",
"the",
"device"
] | 9bd8c5e6d291f4c79314989402f7e2c6476d5851 | https://github.com/frawau/aiolifx/blob/9bd8c5e6d291f4c79314989402f7e2c6476d5851/aiolifx/aiolifx.py#L390-L410 | train | Convenience method to set the label of the device. |
frawau/aiolifx | aiolifx/aiolifx.py | Device.resp_set_label | def resp_set_label(self, resp, label=None):
"""Default callback for get_label/set_label
"""
if label:
self.label=label
elif resp:
self.label=resp.label.decode().replace("\x00", "") | python | def resp_set_label(self, resp, label=None):
"""Default callback for get_label/set_label
"""
if label:
self.label=label
elif resp:
self.label=resp.label.decode().replace("\x00", "") | [
"def",
"resp_set_label",
"(",
"self",
",",
"resp",
",",
"label",
"=",
"None",
")",
":",
"if",
"label",
":",
"self",
".",
"label",
"=",
"label",
"elif",
"resp",
":",
"self",
".",
"label",
"=",
"resp",
".",
"label",
".",
"decode",
"(",
")",
".",
"r... | Default callback for get_label/set_label | [
"Default",
"callback",
"for",
"get_label",
"/",
"set_label"
] | 9bd8c5e6d291f4c79314989402f7e2c6476d5851 | https://github.com/frawau/aiolifx/blob/9bd8c5e6d291f4c79314989402f7e2c6476d5851/aiolifx/aiolifx.py#L412-L418 | train | Default callback for get_label and set_label
|
frawau/aiolifx | aiolifx/aiolifx.py | Device.get_location | def get_location(self,callb=None):
"""Convenience method to request the location from the device
This method will check whether the value has already been retrieved from the device,
if so, it will simply return it. If no, it will request the information from the device
and request that ... | python | def get_location(self,callb=None):
"""Convenience method to request the location from the device
This method will check whether the value has already been retrieved from the device,
if so, it will simply return it. If no, it will request the information from the device
and request that ... | [
"def",
"get_location",
"(",
"self",
",",
"callb",
"=",
"None",
")",
":",
"if",
"self",
".",
"location",
"is",
"None",
":",
"mypartial",
"=",
"partial",
"(",
"self",
".",
"resp_set_location",
")",
"if",
"callb",
":",
"mycallb",
"=",
"lambda",
"x",
",",
... | Convenience method to request the location from the device
This method will check whether the value has already been retrieved from the device,
if so, it will simply return it. If no, it will request the information from the device
and request that callb be executed when a response is received.... | [
"Convenience",
"method",
"to",
"request",
"the",
"location",
"from",
"the",
"device"
] | 9bd8c5e6d291f4c79314989402f7e2c6476d5851 | https://github.com/frawau/aiolifx/blob/9bd8c5e6d291f4c79314989402f7e2c6476d5851/aiolifx/aiolifx.py#L420-L441 | train | Convenience method to request the location from the device. |
frawau/aiolifx | aiolifx/aiolifx.py | Device.resp_set_location | def resp_set_location(self, resp, location=None):
"""Default callback for get_location/set_location
"""
if location:
self.location=location
elif resp:
self.location=resp.label.decode().replace("\x00", "") | python | def resp_set_location(self, resp, location=None):
"""Default callback for get_location/set_location
"""
if location:
self.location=location
elif resp:
self.location=resp.label.decode().replace("\x00", "") | [
"def",
"resp_set_location",
"(",
"self",
",",
"resp",
",",
"location",
"=",
"None",
")",
":",
"if",
"location",
":",
"self",
".",
"location",
"=",
"location",
"elif",
"resp",
":",
"self",
".",
"location",
"=",
"resp",
".",
"label",
".",
"decode",
"(",
... | Default callback for get_location/set_location | [
"Default",
"callback",
"for",
"get_location",
"/",
"set_location"
] | 9bd8c5e6d291f4c79314989402f7e2c6476d5851 | https://github.com/frawau/aiolifx/blob/9bd8c5e6d291f4c79314989402f7e2c6476d5851/aiolifx/aiolifx.py#L450-L456 | train | Default callback for get_location and set_location |
frawau/aiolifx | aiolifx/aiolifx.py | Device.get_group | def get_group(self,callb=None):
"""Convenience method to request the group from the device
This method will check whether the value has already been retrieved from the device,
if so, it will simply return it. If no, it will request the information from the device
and request that callb ... | python | def get_group(self,callb=None):
"""Convenience method to request the group from the device
This method will check whether the value has already been retrieved from the device,
if so, it will simply return it. If no, it will request the information from the device
and request that callb ... | [
"def",
"get_group",
"(",
"self",
",",
"callb",
"=",
"None",
")",
":",
"if",
"self",
".",
"group",
"is",
"None",
":",
"mypartial",
"=",
"partial",
"(",
"self",
".",
"resp_set_group",
")",
"if",
"callb",
":",
"mycallb",
"=",
"lambda",
"x",
",",
"y",
... | Convenience method to request the group from the device
This method will check whether the value has already been retrieved from the device,
if so, it will simply return it. If no, it will request the information from the device
and request that callb be executed when a response is received. Th... | [
"Convenience",
"method",
"to",
"request",
"the",
"group",
"from",
"the",
"device"
] | 9bd8c5e6d291f4c79314989402f7e2c6476d5851 | https://github.com/frawau/aiolifx/blob/9bd8c5e6d291f4c79314989402f7e2c6476d5851/aiolifx/aiolifx.py#L460-L481 | train | Convenience method to request the group from the device |
frawau/aiolifx | aiolifx/aiolifx.py | Device.resp_set_group | def resp_set_group(self, resp, group=None):
"""Default callback for get_group/set_group
"""
if group:
self.group=group
elif resp:
self.group=resp.label.decode().replace("\x00", "") | python | def resp_set_group(self, resp, group=None):
"""Default callback for get_group/set_group
"""
if group:
self.group=group
elif resp:
self.group=resp.label.decode().replace("\x00", "") | [
"def",
"resp_set_group",
"(",
"self",
",",
"resp",
",",
"group",
"=",
"None",
")",
":",
"if",
"group",
":",
"self",
".",
"group",
"=",
"group",
"elif",
"resp",
":",
"self",
".",
"group",
"=",
"resp",
".",
"label",
".",
"decode",
"(",
")",
".",
"r... | Default callback for get_group/set_group | [
"Default",
"callback",
"for",
"get_group",
"/",
"set_group"
] | 9bd8c5e6d291f4c79314989402f7e2c6476d5851 | https://github.com/frawau/aiolifx/blob/9bd8c5e6d291f4c79314989402f7e2c6476d5851/aiolifx/aiolifx.py#L490-L496 | train | Default callback for get_group and set_group |
frawau/aiolifx | aiolifx/aiolifx.py | Device.get_power | def get_power(self,callb=None):
"""Convenience method to request the power status from the device
This method will check whether the value has already been retrieved from the device,
if so, it will simply return it. If no, it will request the information from the device
and request that... | python | def get_power(self,callb=None):
"""Convenience method to request the power status from the device
This method will check whether the value has already been retrieved from the device,
if so, it will simply return it. If no, it will request the information from the device
and request that... | [
"def",
"get_power",
"(",
"self",
",",
"callb",
"=",
"None",
")",
":",
"if",
"self",
".",
"power_level",
"is",
"None",
":",
"response",
"=",
"self",
".",
"req_with_resp",
"(",
"GetPower",
",",
"StatePower",
",",
"callb",
"=",
"callb",
")",
"return",
"se... | Convenience method to request the power status from the device
This method will check whether the value has already been retrieved from the device,
if so, it will simply return it. If no, it will request the information from the device
and request that callb be executed when a response is recei... | [
"Convenience",
"method",
"to",
"request",
"the",
"power",
"status",
"from",
"the",
"device"
] | 9bd8c5e6d291f4c79314989402f7e2c6476d5851 | https://github.com/frawau/aiolifx/blob/9bd8c5e6d291f4c79314989402f7e2c6476d5851/aiolifx/aiolifx.py#L499-L515 | train | Convenience method to request the power status of the current resource from the device |
frawau/aiolifx | aiolifx/aiolifx.py | Device.resp_set_power | def resp_set_power(self, resp, power_level=None):
"""Default callback for get_power/set_power
"""
if power_level is not None:
self.power_level=power_level
elif resp:
self.power_level=resp.power_level | python | def resp_set_power(self, resp, power_level=None):
"""Default callback for get_power/set_power
"""
if power_level is not None:
self.power_level=power_level
elif resp:
self.power_level=resp.power_level | [
"def",
"resp_set_power",
"(",
"self",
",",
"resp",
",",
"power_level",
"=",
"None",
")",
":",
"if",
"power_level",
"is",
"not",
"None",
":",
"self",
".",
"power_level",
"=",
"power_level",
"elif",
"resp",
":",
"self",
".",
"power_level",
"=",
"resp",
"."... | Default callback for get_power/set_power | [
"Default",
"callback",
"for",
"get_power",
"/",
"set_power"
] | 9bd8c5e6d291f4c79314989402f7e2c6476d5851 | https://github.com/frawau/aiolifx/blob/9bd8c5e6d291f4c79314989402f7e2c6476d5851/aiolifx/aiolifx.py#L551-L557 | train | Default callback for get_power and set_power |
frawau/aiolifx | aiolifx/aiolifx.py | Device.get_wififirmware | def get_wififirmware(self,callb=None):
"""Convenience method to request the wifi firmware info from the device
This method will check whether the value has already been retrieved from the device,
if so, it will simply return it. If no, it will request the information from the device
and... | python | def get_wififirmware(self,callb=None):
"""Convenience method to request the wifi firmware info from the device
This method will check whether the value has already been retrieved from the device,
if so, it will simply return it. If no, it will request the information from the device
and... | [
"def",
"get_wififirmware",
"(",
"self",
",",
"callb",
"=",
"None",
")",
":",
"if",
"self",
".",
"wifi_firmware_version",
"is",
"None",
":",
"mypartial",
"=",
"partial",
"(",
"self",
".",
"resp_set_wififirmware",
")",
"if",
"callb",
":",
"mycallb",
"=",
"la... | Convenience method to request the wifi firmware info from the device
This method will check whether the value has already been retrieved from the device,
if so, it will simply return it. If no, it will request the information from the device
and request that callb be executed when a response is... | [
"Convenience",
"method",
"to",
"request",
"the",
"wifi",
"firmware",
"info",
"from",
"the",
"device"
] | 9bd8c5e6d291f4c79314989402f7e2c6476d5851 | https://github.com/frawau/aiolifx/blob/9bd8c5e6d291f4c79314989402f7e2c6476d5851/aiolifx/aiolifx.py#L560-L581 | train | Convenience method to request the wifi firmware info from the device. |
frawau/aiolifx | aiolifx/aiolifx.py | Device.resp_set_wififirmware | def resp_set_wififirmware(self, resp):
"""Default callback for get_wififirmware
"""
if resp:
self.wifi_firmware_version = float(str(str(resp.version >> 16) + "." + str(resp.version & 0xff)))
self.wifi_firmware_build_timestamp = resp.build | python | def resp_set_wififirmware(self, resp):
"""Default callback for get_wififirmware
"""
if resp:
self.wifi_firmware_version = float(str(str(resp.version >> 16) + "." + str(resp.version & 0xff)))
self.wifi_firmware_build_timestamp = resp.build | [
"def",
"resp_set_wififirmware",
"(",
"self",
",",
"resp",
")",
":",
"if",
"resp",
":",
"self",
".",
"wifi_firmware_version",
"=",
"float",
"(",
"str",
"(",
"str",
"(",
"resp",
".",
"version",
">>",
"16",
")",
"+",
"\".\"",
"+",
"str",
"(",
"resp",
".... | Default callback for get_wififirmware | [
"Default",
"callback",
"for",
"get_wififirmware"
] | 9bd8c5e6d291f4c79314989402f7e2c6476d5851 | https://github.com/frawau/aiolifx/blob/9bd8c5e6d291f4c79314989402f7e2c6476d5851/aiolifx/aiolifx.py#L583-L588 | train | Default callback for get_wififirmware |
frawau/aiolifx | aiolifx/aiolifx.py | Device.get_wifiinfo | def get_wifiinfo(self,callb=None):
"""Convenience method to request the wifi info from the device
This will request the information from the device and request that callb be executed
when a response is received. The is no default callback
:param callb: Callable to be used when the... | python | def get_wifiinfo(self,callb=None):
"""Convenience method to request the wifi info from the device
This will request the information from the device and request that callb be executed
when a response is received. The is no default callback
:param callb: Callable to be used when the... | [
"def",
"get_wifiinfo",
"(",
"self",
",",
"callb",
"=",
"None",
")",
":",
"response",
"=",
"self",
".",
"req_with_resp",
"(",
"GetWifiInfo",
",",
"StateWifiInfo",
",",
"callb",
"=",
"callb",
")",
"return",
"None"
] | Convenience method to request the wifi info from the device
This will request the information from the device and request that callb be executed
when a response is received. The is no default callback
:param callb: Callable to be used when the response is received. If not set,
... | [
"Convenience",
"method",
"to",
"request",
"the",
"wifi",
"info",
"from",
"the",
"device"
] | 9bd8c5e6d291f4c79314989402f7e2c6476d5851 | https://github.com/frawau/aiolifx/blob/9bd8c5e6d291f4c79314989402f7e2c6476d5851/aiolifx/aiolifx.py#L591-L604 | train | Convenience method to request the wifi info from the device |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.