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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
neithere/eav-django | eav/facets.py | Facet.form_field | def form_field(self):
"Returns appropriate form field."
label = unicode(self)
defaults = dict(required=False, label=label, widget=self.widget)
defaults.update(self.extra)
return self.field_class(**defaults) | python | def form_field(self):
"Returns appropriate form field."
label = unicode(self)
defaults = dict(required=False, label=label, widget=self.widget)
defaults.update(self.extra)
return self.field_class(**defaults) | [
"def",
"form_field",
"(",
"self",
")",
":",
"label",
"=",
"unicode",
"(",
"self",
")",
"defaults",
"=",
"dict",
"(",
"required",
"=",
"False",
",",
"label",
"=",
"label",
",",
"widget",
"=",
"self",
".",
"widget",
")",
"defaults",
".",
"update",
"(",... | Returns appropriate form field. | [
"Returns",
"appropriate",
"form",
"field",
"."
] | 7f2e9fe17bbe740622cfb38f6ce0e8413b7da3d7 | https://github.com/neithere/eav-django/blob/7f2e9fe17bbe740622cfb38f6ce0e8413b7da3d7/eav/facets.py#L69-L74 | train | Returns appropriate form field. |
neithere/eav-django | eav/facets.py | Facet.attr_name | def attr_name(self):
"Returns attribute name for this facet"
return self.schema.name if self.schema else self.field.name | python | def attr_name(self):
"Returns attribute name for this facet"
return self.schema.name if self.schema else self.field.name | [
"def",
"attr_name",
"(",
"self",
")",
":",
"return",
"self",
".",
"schema",
".",
"name",
"if",
"self",
".",
"schema",
"else",
"self",
".",
"field",
".",
"name"
] | Returns attribute name for this facet | [
"Returns",
"attribute",
"name",
"for",
"this",
"facet"
] | 7f2e9fe17bbe740622cfb38f6ce0e8413b7da3d7 | https://github.com/neithere/eav-django/blob/7f2e9fe17bbe740622cfb38f6ce0e8413b7da3d7/eav/facets.py#L77-L79 | train | Returns attribute name for this facet |
neithere/eav-django | eav/facets.py | BaseFacetSet.get_field_and_lookup | def get_field_and_lookup(self, name):
"""
Returns field instance and lookup prefix for given attribute name.
Can be overloaded in subclasses to provide filtering across multiple models.
"""
name = self.get_queryset().model._meta.get_field(name)
lookup_prefix = ''
... | python | def get_field_and_lookup(self, name):
"""
Returns field instance and lookup prefix for given attribute name.
Can be overloaded in subclasses to provide filtering across multiple models.
"""
name = self.get_queryset().model._meta.get_field(name)
lookup_prefix = ''
... | [
"def",
"get_field_and_lookup",
"(",
"self",
",",
"name",
")",
":",
"name",
"=",
"self",
".",
"get_queryset",
"(",
")",
".",
"model",
".",
"_meta",
".",
"get_field",
"(",
"name",
")",
"lookup_prefix",
"=",
"''",
"return",
"name",
",",
"lookup_prefix"
] | Returns field instance and lookup prefix for given attribute name.
Can be overloaded in subclasses to provide filtering across multiple models. | [
"Returns",
"field",
"instance",
"and",
"lookup",
"prefix",
"for",
"given",
"attribute",
"name",
".",
"Can",
"be",
"overloaded",
"in",
"subclasses",
"to",
"provide",
"filtering",
"across",
"multiple",
"models",
"."
] | 7f2e9fe17bbe740622cfb38f6ce0e8413b7da3d7 | https://github.com/neithere/eav-django/blob/7f2e9fe17bbe740622cfb38f6ce0e8413b7da3d7/eav/facets.py#L304-L311 | train | Returns field instance and lookup prefix for given attribute name. |
neithere/eav-django | eav/facets.py | BaseFacetSet.sort_by_attribute | def sort_by_attribute(self, qs, name):
"""
A wrapper around standard order_by() method. Allows to sort by both normal
fields and EAV attributes without thinking about implementation details.
Usage::
qs = sort_by_attributes(qs, 'price', 'colour')
...where `price` is ... | python | def sort_by_attribute(self, qs, name):
"""
A wrapper around standard order_by() method. Allows to sort by both normal
fields and EAV attributes without thinking about implementation details.
Usage::
qs = sort_by_attributes(qs, 'price', 'colour')
...where `price` is ... | [
"def",
"sort_by_attribute",
"(",
"self",
",",
"qs",
",",
"name",
")",
":",
"fields",
"=",
"self",
".",
"get_queryset",
"(",
")",
".",
"model",
".",
"_meta",
".",
"get_all_field_names",
"(",
")",
"schemata",
"=",
"self",
".",
"sortable_names",
"direction",
... | A wrapper around standard order_by() method. Allows to sort by both normal
fields and EAV attributes without thinking about implementation details.
Usage::
qs = sort_by_attributes(qs, 'price', 'colour')
...where `price` is a FloatField, and `colour` is the name of an EAV attribute
... | [
"A",
"wrapper",
"around",
"standard",
"order_by",
"()",
"method",
".",
"Allows",
"to",
"sort",
"by",
"both",
"normal",
"fields",
"and",
"EAV",
"attributes",
"without",
"thinking",
"about",
"implementation",
"details",
".",
"Usage",
"::"
] | 7f2e9fe17bbe740622cfb38f6ce0e8413b7da3d7 | https://github.com/neithere/eav-django/blob/7f2e9fe17bbe740622cfb38f6ce0e8413b7da3d7/eav/facets.py#L344-L369 | train | A wrapper around standard order_by method. Allows to sort by normal fields and EAV attributes without thinking about implementation details. |
bitesofcode/projexui | projexui/widgets/xviewwidget/xviewdialog.py | XViewDialog.closeEvent | def closeEvent(self, event):
"""
Checks to make sure that the view widget can be properly closed.
:param event | <QCloseEvent>
"""
if not self.viewWidget().canClose():
event.ignore()
else:
super(XViewDialog, self).closeEvent(event) | python | def closeEvent(self, event):
"""
Checks to make sure that the view widget can be properly closed.
:param event | <QCloseEvent>
"""
if not self.viewWidget().canClose():
event.ignore()
else:
super(XViewDialog, self).closeEvent(event) | [
"def",
"closeEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"not",
"self",
".",
"viewWidget",
"(",
")",
".",
"canClose",
"(",
")",
":",
"event",
".",
"ignore",
"(",
")",
"else",
":",
"super",
"(",
"XViewDialog",
",",
"self",
")",
".",
"closeEve... | Checks to make sure that the view widget can be properly closed.
:param event | <QCloseEvent> | [
"Checks",
"to",
"make",
"sure",
"that",
"the",
"view",
"widget",
"can",
"be",
"properly",
"closed",
".",
":",
"param",
"event",
"|",
"<QCloseEvent",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewdialog.py#L43-L52 | train | Check to make sure that the view widget can be properly closed. |
bitesofcode/projexui | projexui/exporters/xexcelexporter.py | XExcelExporter.exportTree | def exportTree(self, tree, filename):
"""
Exports the inputed tree object to the given excel file.
:param tree | <QTreeWidget>
filename | <str>
:return <bool>
"""
book = xlwt.Workbook()
# deter... | python | def exportTree(self, tree, filename):
"""
Exports the inputed tree object to the given excel file.
:param tree | <QTreeWidget>
filename | <str>
:return <bool>
"""
book = xlwt.Workbook()
# deter... | [
"def",
"exportTree",
"(",
"self",
",",
"tree",
",",
"filename",
")",
":",
"book",
"=",
"xlwt",
".",
"Workbook",
"(",
")",
"# determine the title for the sheet to export\r",
"title",
"=",
"nativestring",
"(",
"tree",
".",
"windowTitle",
"(",
")",
")",
"if",
"... | Exports the inputed tree object to the given excel file.
:param tree | <QTreeWidget>
filename | <str>
:return <bool> | [
"Exports",
"the",
"inputed",
"tree",
"object",
"to",
"the",
"given",
"excel",
"file",
".",
":",
"param",
"tree",
"|",
"<QTreeWidget",
">",
"filename",
"|",
"<str",
">",
":",
"return",
"<bool",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/exporters/xexcelexporter.py#L40-L74 | train | Exports the inputed tree object to the given excel file. |
bitesofcode/projexui | projexui/exporters/xexcelexporter.py | XExcelExporter.exportTreeItem | def exportTreeItem(self, sheet, cols, item):
"""
Exports the inputed item to the given Excel worksheet for the
given visible columns.
:param sheet | <xlwt.WorkSheet>
cols | [<int>, ..]
item | <QTreeWidgetItem>
"""
... | python | def exportTreeItem(self, sheet, cols, item):
"""
Exports the inputed item to the given Excel worksheet for the
given visible columns.
:param sheet | <xlwt.WorkSheet>
cols | [<int>, ..]
item | <QTreeWidgetItem>
"""
... | [
"def",
"exportTreeItem",
"(",
"self",
",",
"sheet",
",",
"cols",
",",
"item",
")",
":",
"# export item information\r",
"for",
"c",
",",
"col",
"in",
"enumerate",
"(",
"cols",
")",
":",
"data",
"=",
"unwrapVariant",
"(",
"item",
".",
"data",
"(",
"Qt",
... | Exports the inputed item to the given Excel worksheet for the
given visible columns.
:param sheet | <xlwt.WorkSheet>
cols | [<int>, ..]
item | <QTreeWidgetItem> | [
"Exports",
"the",
"inputed",
"item",
"to",
"the",
"given",
"Excel",
"worksheet",
"for",
"the",
"given",
"visible",
"columns",
".",
":",
"param",
"sheet",
"|",
"<xlwt",
".",
"WorkSheet",
">",
"cols",
"|",
"[",
"<int",
">",
"..",
"]",
"item",
"|",
"<QTre... | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/exporters/xexcelexporter.py#L76-L97 | train | Exports the inputed item to the given Excel worksheet for the
cols | [ <int >.. ] |
bitesofcode/projexui | projexui/widgets/xloggerwidget/xloggerwidgethandler.py | XLoggerWidgetHandler.emit | def emit(self, record):
"""
Throws an error based on the information that the logger reported,
given the logging level.
:param record | <logging.LogRecord>
"""
# if we've already processed this record, ignore it
if record in self._recordQueu... | python | def emit(self, record):
"""
Throws an error based on the information that the logger reported,
given the logging level.
:param record | <logging.LogRecord>
"""
# if we've already processed this record, ignore it
if record in self._recordQueu... | [
"def",
"emit",
"(",
"self",
",",
"record",
")",
":",
"# if we've already processed this record, ignore it\r",
"if",
"record",
"in",
"self",
".",
"_recordQueue",
":",
"return",
"if",
"self",
".",
"_activeLevels",
"and",
"not",
"record",
".",
"levelno",
"in",
"sel... | Throws an error based on the information that the logger reported,
given the logging level.
:param record | <logging.LogRecord> | [
"Throws",
"an",
"error",
"based",
"on",
"the",
"information",
"that",
"the",
"logger",
"reported",
"given",
"the",
"logging",
"level",
".",
":",
"param",
"record",
"|",
"<logging",
".",
"LogRecord",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xloggerwidget/xloggerwidgethandler.py#L43-L68 | train | Emits the given record. |
intelsdi-x/snap-plugin-lib-py | snap_plugin/v1/stream_collector_proxy.py | _StreamCollectorProxy.StreamMetrics | def StreamMetrics(self, request_iterator, context):
"""Dispatches metrics streamed by collector"""
LOG.debug("StreamMetrics called")
# set up arguments
collect_args = (next(request_iterator))
max_metrics_buffer = 0
max_collect_duration = 0
cfg = Metric(pb=collect... | python | def StreamMetrics(self, request_iterator, context):
"""Dispatches metrics streamed by collector"""
LOG.debug("StreamMetrics called")
# set up arguments
collect_args = (next(request_iterator))
max_metrics_buffer = 0
max_collect_duration = 0
cfg = Metric(pb=collect... | [
"def",
"StreamMetrics",
"(",
"self",
",",
"request_iterator",
",",
"context",
")",
":",
"LOG",
".",
"debug",
"(",
"\"StreamMetrics called\"",
")",
"# set up arguments",
"collect_args",
"=",
"(",
"next",
"(",
"request_iterator",
")",
")",
"max_metrics_buffer",
"=",... | Dispatches metrics streamed by collector | [
"Dispatches",
"metrics",
"streamed",
"by",
"collector"
] | 8da5d00ac5f9d2b48a7239563ac7788209891ca4 | https://github.com/intelsdi-x/snap-plugin-lib-py/blob/8da5d00ac5f9d2b48a7239563ac7788209891ca4/snap_plugin/v1/stream_collector_proxy.py#L57-L120 | train | Dispatches metrics streamed by collector. |
intelsdi-x/snap-plugin-lib-py | snap_plugin/v1/stream_collector_proxy.py | _StreamCollectorProxy.GetMetricTypes | def GetMetricTypes(self, request, context):
"""Dispatches the request to the plugins update_catalog method"""
LOG.debug("GetMetricTypes called")
try:
metrics = self.plugin.update_catalog(ConfigMap(pb=request.config))
return MetricsReply(metrics=[m.pb for m in metrics])
... | python | def GetMetricTypes(self, request, context):
"""Dispatches the request to the plugins update_catalog method"""
LOG.debug("GetMetricTypes called")
try:
metrics = self.plugin.update_catalog(ConfigMap(pb=request.config))
return MetricsReply(metrics=[m.pb for m in metrics])
... | [
"def",
"GetMetricTypes",
"(",
"self",
",",
"request",
",",
"context",
")",
":",
"LOG",
".",
"debug",
"(",
"\"GetMetricTypes called\"",
")",
"try",
":",
"metrics",
"=",
"self",
".",
"plugin",
".",
"update_catalog",
"(",
"ConfigMap",
"(",
"pb",
"=",
"request... | Dispatches the request to the plugins update_catalog method | [
"Dispatches",
"the",
"request",
"to",
"the",
"plugins",
"update_catalog",
"method"
] | 8da5d00ac5f9d2b48a7239563ac7788209891ca4 | https://github.com/intelsdi-x/snap-plugin-lib-py/blob/8da5d00ac5f9d2b48a7239563ac7788209891ca4/snap_plugin/v1/stream_collector_proxy.py#L122-L131 | train | Dispatches the request to the plugins update_catalog method and returns the list of metrics that were added to the cluster. |
davidemoro/play_mqtt | play_mqtt/providers.py | MQTTProvider.command_publish | def command_publish(self, command, **kwargs):
""" Publish a MQTT message """
mqttc = mqtt.Client()
mqttc.connect(
command['host'],
port=int(command['port']))
mqttc.loop_start()
try:
mqttc.publish(
command['endpoint'],
... | python | def command_publish(self, command, **kwargs):
""" Publish a MQTT message """
mqttc = mqtt.Client()
mqttc.connect(
command['host'],
port=int(command['port']))
mqttc.loop_start()
try:
mqttc.publish(
command['endpoint'],
... | [
"def",
"command_publish",
"(",
"self",
",",
"command",
",",
"*",
"*",
"kwargs",
")",
":",
"mqttc",
"=",
"mqtt",
".",
"Client",
"(",
")",
"mqttc",
".",
"connect",
"(",
"command",
"[",
"'host'",
"]",
",",
"port",
"=",
"int",
"(",
"command",
"[",
"'po... | Publish a MQTT message | [
"Publish",
"a",
"MQTT",
"message"
] | 4994074c20ab8a5abd221f8b8088e5fc44ba2a5e | https://github.com/davidemoro/play_mqtt/blob/4994074c20ab8a5abd221f8b8088e5fc44ba2a5e/play_mqtt/providers.py#L8-L22 | train | Publish a MQTT message |
davidemoro/play_mqtt | play_mqtt/providers.py | MQTTProvider.command_subscribe | def command_subscribe(self, command, **kwargs):
""" Subscribe to a topic or list of topics """
topic = command['topic']
encoding = command.get('encoding', 'utf-8')
name = command['name']
if not hasattr(self.engine, '_mqtt'):
self.engine._mqtt = {}
self.engine.... | python | def command_subscribe(self, command, **kwargs):
""" Subscribe to a topic or list of topics """
topic = command['topic']
encoding = command.get('encoding', 'utf-8')
name = command['name']
if not hasattr(self.engine, '_mqtt'):
self.engine._mqtt = {}
self.engine.... | [
"def",
"command_subscribe",
"(",
"self",
",",
"command",
",",
"*",
"*",
"kwargs",
")",
":",
"topic",
"=",
"command",
"[",
"'topic'",
"]",
"encoding",
"=",
"command",
".",
"get",
"(",
"'encoding'",
",",
"'utf-8'",
")",
"name",
"=",
"command",
"[",
"'nam... | Subscribe to a topic or list of topics | [
"Subscribe",
"to",
"a",
"topic",
"or",
"list",
"of",
"topics"
] | 4994074c20ab8a5abd221f8b8088e5fc44ba2a5e | https://github.com/davidemoro/play_mqtt/blob/4994074c20ab8a5abd221f8b8088e5fc44ba2a5e/play_mqtt/providers.py#L24-L45 | train | Subscribe to a topic or list of topics |
Danielhiversen/pyMetno | metno/__init__.py | get_data | def get_data(param, data):
"""Retrieve weather parameter."""
try:
for (_, selected_time_entry) in data:
loc_data = selected_time_entry['location']
if param not in loc_data:
continue
if param == 'precipitation':
new_state = loc_data[par... | python | def get_data(param, data):
"""Retrieve weather parameter."""
try:
for (_, selected_time_entry) in data:
loc_data = selected_time_entry['location']
if param not in loc_data:
continue
if param == 'precipitation':
new_state = loc_data[par... | [
"def",
"get_data",
"(",
"param",
",",
"data",
")",
":",
"try",
":",
"for",
"(",
"_",
",",
"selected_time_entry",
")",
"in",
"data",
":",
"loc_data",
"=",
"selected_time_entry",
"[",
"'location'",
"]",
"if",
"param",
"not",
"in",
"loc_data",
":",
"continu... | Retrieve weather parameter. | [
"Retrieve",
"weather",
"parameter",
"."
] | 7d200a495fdea0e1a9310069fdcd65f205d6e6f5 | https://github.com/Danielhiversen/pyMetno/blob/7d200a495fdea0e1a9310069fdcd65f205d6e6f5/metno/__init__.py#L144-L168 | train | Retrieve weather parameter. |
Danielhiversen/pyMetno | metno/__init__.py | parse_datetime | def parse_datetime(dt_str):
"""Parse datetime."""
date_format = "%Y-%m-%dT%H:%M:%S %z"
dt_str = dt_str.replace("Z", " +0000")
return datetime.datetime.strptime(dt_str, date_format) | python | def parse_datetime(dt_str):
"""Parse datetime."""
date_format = "%Y-%m-%dT%H:%M:%S %z"
dt_str = dt_str.replace("Z", " +0000")
return datetime.datetime.strptime(dt_str, date_format) | [
"def",
"parse_datetime",
"(",
"dt_str",
")",
":",
"date_format",
"=",
"\"%Y-%m-%dT%H:%M:%S %z\"",
"dt_str",
"=",
"dt_str",
".",
"replace",
"(",
"\"Z\"",
",",
"\" +0000\"",
")",
"return",
"datetime",
".",
"datetime",
".",
"strptime",
"(",
"dt_str",
",",
"date_f... | Parse datetime. | [
"Parse",
"datetime",
"."
] | 7d200a495fdea0e1a9310069fdcd65f205d6e6f5 | https://github.com/Danielhiversen/pyMetno/blob/7d200a495fdea0e1a9310069fdcd65f205d6e6f5/metno/__init__.py#L257-L261 | train | Parse datetime. |
Danielhiversen/pyMetno | metno/__init__.py | MetWeatherData.fetching_data | async def fetching_data(self, *_):
"""Get the latest data from met.no."""
try:
with async_timeout.timeout(10):
resp = await self._websession.get(self._api_url, params=self._urlparams)
if resp.status != 200:
_LOGGER.error('%s returned %s', self._ap... | python | async def fetching_data(self, *_):
"""Get the latest data from met.no."""
try:
with async_timeout.timeout(10):
resp = await self._websession.get(self._api_url, params=self._urlparams)
if resp.status != 200:
_LOGGER.error('%s returned %s', self._ap... | [
"async",
"def",
"fetching_data",
"(",
"self",
",",
"*",
"_",
")",
":",
"try",
":",
"with",
"async_timeout",
".",
"timeout",
"(",
"10",
")",
":",
"resp",
"=",
"await",
"self",
".",
"_websession",
".",
"get",
"(",
"self",
".",
"_api_url",
",",
"params"... | Get the latest data from met.no. | [
"Get",
"the",
"latest",
"data",
"from",
"met",
".",
"no",
"."
] | 7d200a495fdea0e1a9310069fdcd65f205d6e6f5 | https://github.com/Danielhiversen/pyMetno/blob/7d200a495fdea0e1a9310069fdcd65f205d6e6f5/metno/__init__.py#L75-L93 | train | Get the latest data from met. no. |
Danielhiversen/pyMetno | metno/__init__.py | MetWeatherData.get_forecast | def get_forecast(self, time_zone):
"""Get the forecast weather data from met.no."""
if self.data is None:
return []
now = datetime.datetime.now(time_zone).replace(hour=12, minute=0,
second=0, microsecond=0)
times = [now ... | python | def get_forecast(self, time_zone):
"""Get the forecast weather data from met.no."""
if self.data is None:
return []
now = datetime.datetime.now(time_zone).replace(hour=12, minute=0,
second=0, microsecond=0)
times = [now ... | [
"def",
"get_forecast",
"(",
"self",
",",
"time_zone",
")",
":",
"if",
"self",
".",
"data",
"is",
"None",
":",
"return",
"[",
"]",
"now",
"=",
"datetime",
".",
"datetime",
".",
"now",
"(",
"time_zone",
")",
".",
"replace",
"(",
"hour",
"=",
"12",
",... | Get the forecast weather data from met.no. | [
"Get",
"the",
"forecast",
"weather",
"data",
"from",
"met",
".",
"no",
"."
] | 7d200a495fdea0e1a9310069fdcd65f205d6e6f5 | https://github.com/Danielhiversen/pyMetno/blob/7d200a495fdea0e1a9310069fdcd65f205d6e6f5/metno/__init__.py#L99-L107 | train | Get the forecast weather data from met. no. |
Danielhiversen/pyMetno | metno/__init__.py | MetWeatherData.get_weather | def get_weather(self, time, max_hour=6):
"""Get the current weather data from met.no."""
if self.data is None:
return {}
ordered_entries = []
for time_entry in self.data['product']['time']:
valid_from = parse_datetime(time_entry['@from'])
valid_to = p... | python | def get_weather(self, time, max_hour=6):
"""Get the current weather data from met.no."""
if self.data is None:
return {}
ordered_entries = []
for time_entry in self.data['product']['time']:
valid_from = parse_datetime(time_entry['@from'])
valid_to = p... | [
"def",
"get_weather",
"(",
"self",
",",
"time",
",",
"max_hour",
"=",
"6",
")",
":",
"if",
"self",
".",
"data",
"is",
"None",
":",
"return",
"{",
"}",
"ordered_entries",
"=",
"[",
"]",
"for",
"time_entry",
"in",
"self",
".",
"data",
"[",
"'product'",... | Get the current weather data from met.no. | [
"Get",
"the",
"current",
"weather",
"data",
"from",
"met",
".",
"no",
"."
] | 7d200a495fdea0e1a9310069fdcd65f205d6e6f5 | https://github.com/Danielhiversen/pyMetno/blob/7d200a495fdea0e1a9310069fdcd65f205d6e6f5/metno/__init__.py#L109-L141 | train | Get the current weather data from met. no. |
Danielhiversen/pyMetno | metno/__init__.py | AirQualityData.update | async def update(self):
"""Update data."""
if self._last_update is None or datetime.datetime.now() - self._last_update > datetime.timedelta(3600):
try:
with async_timeout.timeout(10):
resp = await self._websession.get(self._api_url, params=self._urlparams)... | python | async def update(self):
"""Update data."""
if self._last_update is None or datetime.datetime.now() - self._last_update > datetime.timedelta(3600):
try:
with async_timeout.timeout(10):
resp = await self._websession.get(self._api_url, params=self._urlparams)... | [
"async",
"def",
"update",
"(",
"self",
")",
":",
"if",
"self",
".",
"_last_update",
"is",
"None",
"or",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
"-",
"self",
".",
"_last_update",
">",
"datetime",
".",
"timedelta",
"(",
"3600",
")",
":",
"tr... | Update data. | [
"Update",
"data",
"."
] | 7d200a495fdea0e1a9310069fdcd65f205d6e6f5 | https://github.com/Danielhiversen/pyMetno/blob/7d200a495fdea0e1a9310069fdcd65f205d6e6f5/metno/__init__.py#L187-L254 | train | Update data. |
johnnoone/aioconsul | aioconsul/client/util.py | prepare_node | def prepare_node(data):
"""Prepare node for catalog endpoint
Parameters:
data (Union[str, dict]): Node ID or node definition
Returns:
Tuple[str, dict]: where first is ID and second is node definition
Extract from /v1/health/service/<service>::
{
"Node": {
... | python | def prepare_node(data):
"""Prepare node for catalog endpoint
Parameters:
data (Union[str, dict]): Node ID or node definition
Returns:
Tuple[str, dict]: where first is ID and second is node definition
Extract from /v1/health/service/<service>::
{
"Node": {
... | [
"def",
"prepare_node",
"(",
"data",
")",
":",
"if",
"not",
"data",
":",
"return",
"None",
",",
"{",
"}",
"if",
"isinstance",
"(",
"data",
",",
"str",
")",
":",
"return",
"data",
",",
"{",
"}",
"# from /v1/health/service/<service>",
"if",
"all",
"(",
"f... | Prepare node for catalog endpoint
Parameters:
data (Union[str, dict]): Node ID or node definition
Returns:
Tuple[str, dict]: where first is ID and second is node definition
Extract from /v1/health/service/<service>::
{
"Node": {
"Node": "foobar",
... | [
"Prepare",
"node",
"for",
"catalog",
"endpoint"
] | 02f7a529d7dc2e49bed942111067aa5faf320e90 | https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/util.py#L3-L46 | train | Prepare node for catalog endpoint |
johnnoone/aioconsul | aioconsul/client/util.py | prepare_service | def prepare_service(data):
"""Prepare service for catalog endpoint
Parameters:
data (Union[str, dict]): Service ID or service definition
Returns:
Tuple[str, dict]: str is ID and dict is service
Transform ``/v1/health/state/<state>``::
{
"Node": "foobar",
... | python | def prepare_service(data):
"""Prepare service for catalog endpoint
Parameters:
data (Union[str, dict]): Service ID or service definition
Returns:
Tuple[str, dict]: str is ID and dict is service
Transform ``/v1/health/state/<state>``::
{
"Node": "foobar",
... | [
"def",
"prepare_service",
"(",
"data",
")",
":",
"if",
"not",
"data",
":",
"return",
"None",
",",
"{",
"}",
"if",
"isinstance",
"(",
"data",
",",
"str",
")",
":",
"return",
"data",
",",
"{",
"}",
"# from /v1/health/service/<service>",
"if",
"all",
"(",
... | Prepare service for catalog endpoint
Parameters:
data (Union[str, dict]): Service ID or service definition
Returns:
Tuple[str, dict]: str is ID and dict is service
Transform ``/v1/health/state/<state>``::
{
"Node": "foobar",
"CheckID": "service:redis",
... | [
"Prepare",
"service",
"for",
"catalog",
"endpoint"
] | 02f7a529d7dc2e49bed942111067aa5faf320e90 | https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/util.py#L49-L125 | train | Prepare a service for catalog endpoint |
johnnoone/aioconsul | aioconsul/client/util.py | prepare_check | def prepare_check(data):
"""Prepare check for catalog endpoint
Parameters:
data (Object or ObjectID): Check ID or check definition
Returns:
Tuple[str, dict]: where first is ID and second is check definition
"""
if not data:
return None, {}
if isinstance(data, str):
... | python | def prepare_check(data):
"""Prepare check for catalog endpoint
Parameters:
data (Object or ObjectID): Check ID or check definition
Returns:
Tuple[str, dict]: where first is ID and second is check definition
"""
if not data:
return None, {}
if isinstance(data, str):
... | [
"def",
"prepare_check",
"(",
"data",
")",
":",
"if",
"not",
"data",
":",
"return",
"None",
",",
"{",
"}",
"if",
"isinstance",
"(",
"data",
",",
"str",
")",
":",
"return",
"data",
",",
"{",
"}",
"result",
"=",
"{",
"}",
"if",
"\"ID\"",
"in",
"data... | Prepare check for catalog endpoint
Parameters:
data (Object or ObjectID): Check ID or check definition
Returns:
Tuple[str, dict]: where first is ID and second is check definition | [
"Prepare",
"check",
"for",
"catalog",
"endpoint"
] | 02f7a529d7dc2e49bed942111067aa5faf320e90 | https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/util.py#L128-L150 | train | Prepare check for catalog endpoint |
ponty/pyavrutils | pyavrutils/avrgcc.py | AvrGcc.optimize_for_size | def optimize_for_size(self):
'''
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=90752
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=69813
'''
self.optimization = 's'
self.relax = True
self.gc_sections = True
self.ffu... | python | def optimize_for_size(self):
'''
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=90752
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=69813
'''
self.optimization = 's'
self.relax = True
self.gc_sections = True
self.ffu... | [
"def",
"optimize_for_size",
"(",
"self",
")",
":",
"self",
".",
"optimization",
"=",
"'s'",
"self",
".",
"relax",
"=",
"True",
"self",
".",
"gc_sections",
"=",
"True",
"self",
".",
"ffunction_sections",
"=",
"True",
"self",
".",
"fdata_sections",
"=",
"Tru... | http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=90752
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=69813 | [
"http",
":",
"//",
"www",
".",
"avrfreaks",
".",
"net",
"/",
"index",
".",
"php?name",
"=",
"PNphpBB2&file",
"=",
"viewtopic&t",
"=",
"90752"
] | 7a396a25b3ac076ede07b5cd5cbd416ebb578a28 | https://github.com/ponty/pyavrutils/blob/7a396a25b3ac076ede07b5cd5cbd416ebb578a28/pyavrutils/avrgcc.py#L63-L74 | train | This method is used to set the optimization to s to optimize the size of the current cache entry. |
ponty/pyavrutils | pyavrutils/avrgcc.py | AvrGcc.optimize_no | def optimize_no(self):
''' all options set to default
'''
self.optimization = 0
self.relax = False
self.gc_sections = False
self.ffunction_sections = False
self.fdata_sections = False
self.fno_inline_small_functions = False | python | def optimize_no(self):
''' all options set to default
'''
self.optimization = 0
self.relax = False
self.gc_sections = False
self.ffunction_sections = False
self.fdata_sections = False
self.fno_inline_small_functions = False | [
"def",
"optimize_no",
"(",
"self",
")",
":",
"self",
".",
"optimization",
"=",
"0",
"self",
".",
"relax",
"=",
"False",
"self",
".",
"gc_sections",
"=",
"False",
"self",
".",
"ffunction_sections",
"=",
"False",
"self",
".",
"fdata_sections",
"=",
"False",
... | all options set to default | [
"all",
"options",
"set",
"to",
"default"
] | 7a396a25b3ac076ede07b5cd5cbd416ebb578a28 | https://github.com/ponty/pyavrutils/blob/7a396a25b3ac076ede07b5cd5cbd416ebb578a28/pyavrutils/avrgcc.py#L76-L84 | train | set all options to default |
ponty/pyavrutils | pyavrutils/avrgcc.py | AvrGcc.command_list | def command_list(self, sources, _opt=False):
'''command line as list'''
def abspath(x):
x = Path(x).abspath()
if not x.exists():
raise ValueError('file not found! ' + x)
return x
self.f_cpu = int(self.f_cpu)
self.mcu = str(self.mcu)
#... | python | def command_list(self, sources, _opt=False):
'''command line as list'''
def abspath(x):
x = Path(x).abspath()
if not x.exists():
raise ValueError('file not found! ' + x)
return x
self.f_cpu = int(self.f_cpu)
self.mcu = str(self.mcu)
#... | [
"def",
"command_list",
"(",
"self",
",",
"sources",
",",
"_opt",
"=",
"False",
")",
":",
"def",
"abspath",
"(",
"x",
")",
":",
"x",
"=",
"Path",
"(",
"x",
")",
".",
"abspath",
"(",
")",
"if",
"not",
"x",
".",
"exists",
"(",
")",
":",
"raise",
... | command line as list | [
"command",
"line",
"as",
"list"
] | 7a396a25b3ac076ede07b5cd5cbd416ebb578a28 | https://github.com/ponty/pyavrutils/blob/7a396a25b3ac076ede07b5cd5cbd416ebb578a28/pyavrutils/avrgcc.py#L140-L188 | train | command line as list |
ponty/pyavrutils | pyavrutils/avrgcc.py | AvrGcc.build | def build(self, sources=None, headers=None):
''' sources can be file name or code:
sources=['x.c','int main(){}']
or
sources='int main(){}'
'''
tempdir = None
strings, files = separate_sources(sources)
if len(strings) or headers:
# TODO: remove... | python | def build(self, sources=None, headers=None):
''' sources can be file name or code:
sources=['x.c','int main(){}']
or
sources='int main(){}'
'''
tempdir = None
strings, files = separate_sources(sources)
if len(strings) or headers:
# TODO: remove... | [
"def",
"build",
"(",
"self",
",",
"sources",
"=",
"None",
",",
"headers",
"=",
"None",
")",
":",
"tempdir",
"=",
"None",
"strings",
",",
"files",
"=",
"separate_sources",
"(",
"sources",
")",
"if",
"len",
"(",
"strings",
")",
"or",
"headers",
":",
"#... | sources can be file name or code:
sources=['x.c','int main(){}']
or
sources='int main(){}' | [
"sources",
"can",
"be",
"file",
"name",
"or",
"code",
":",
"sources",
"=",
"[",
"x",
".",
"c",
"int",
"main",
"()",
"{}",
"]",
"or",
"sources",
"=",
"int",
"main",
"()",
"{}"
] | 7a396a25b3ac076ede07b5cd5cbd416ebb578a28 | https://github.com/ponty/pyavrutils/blob/7a396a25b3ac076ede07b5cd5cbd416ebb578a28/pyavrutils/avrgcc.py#L190-L216 | train | build a new entry set |
bitesofcode/projexui | projexui/xresourcemanager.py | XResourceManager.build | def build(self, force=False):
"""
Generates the resource file and module for the given path.
:param force | <bool>
"""
basepath = self.resourcePath()
if basepath is None:
return
outpath = self.pluginPath()
logg... | python | def build(self, force=False):
"""
Generates the resource file and module for the given path.
:param force | <bool>
"""
basepath = self.resourcePath()
if basepath is None:
return
outpath = self.pluginPath()
logg... | [
"def",
"build",
"(",
"self",
",",
"force",
"=",
"False",
")",
":",
"basepath",
"=",
"self",
".",
"resourcePath",
"(",
")",
"if",
"basepath",
"is",
"None",
":",
"return",
"outpath",
"=",
"self",
".",
"pluginPath",
"(",
")",
"logger",
"=",
"self",
".",... | Generates the resource file and module for the given path.
:param force | <bool> | [
"Generates",
"the",
"resource",
"file",
"and",
"module",
"for",
"the",
"given",
"path",
".",
":",
"param",
"force",
"|",
"<bool",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/xresourcemanager.py#L87-L145 | train | Builds the resource file and module for the given path. |
bitesofcode/projexui | projexui/xresourcemanager.py | XResourceManager.exists | def exists(self, relpath, rsc=None, useFilepath=None):
"""
Checks to see if the inputed path represents an existing file or directory.
:param relpath | <str>
rsc | <str>
useFilepath | <bool> or None
"""
path = self... | python | def exists(self, relpath, rsc=None, useFilepath=None):
"""
Checks to see if the inputed path represents an existing file or directory.
:param relpath | <str>
rsc | <str>
useFilepath | <bool> or None
"""
path = self... | [
"def",
"exists",
"(",
"self",
",",
"relpath",
",",
"rsc",
"=",
"None",
",",
"useFilepath",
"=",
"None",
")",
":",
"path",
"=",
"self",
".",
"find",
"(",
"relpath",
",",
"rsc",
",",
"useFilepath",
")",
"if",
"path",
".",
"startswith",
"(",
"':'",
")... | Checks to see if the inputed path represents an existing file or directory.
:param relpath | <str>
rsc | <str>
useFilepath | <bool> or None | [
"Checks",
"to",
"see",
"if",
"the",
"inputed",
"path",
"represents",
"an",
"existing",
"file",
"or",
"directory",
".",
":",
"param",
"relpath",
"|",
"<str",
">",
"rsc",
"|",
"<str",
">",
"useFilepath",
"|",
"<bool",
">",
"or",
"None"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/xresourcemanager.py#L159-L171 | train | Checks to see if the inputed path represents an existing file or directory. |
bitesofcode/projexui | projexui/xresourcemanager.py | XResourceManager.find | def find(self, relpath, rsc=None, useFilepath=None):
"""
Looks up the path for the resource based on the inputed relative path.
:param relpath | <str>
:return <str>
"""
self.init()
# load the default resource informati... | python | def find(self, relpath, rsc=None, useFilepath=None):
"""
Looks up the path for the resource based on the inputed relative path.
:param relpath | <str>
:return <str>
"""
self.init()
# load the default resource informati... | [
"def",
"find",
"(",
"self",
",",
"relpath",
",",
"rsc",
"=",
"None",
",",
"useFilepath",
"=",
"None",
")",
":",
"self",
".",
"init",
"(",
")",
"# load the default resource information\r",
"if",
"rsc",
"is",
"None",
":",
"try",
":",
"key",
"=",
"relpath",... | Looks up the path for the resource based on the inputed relative path.
:param relpath | <str>
:return <str> | [
"Looks",
"up",
"the",
"path",
"for",
"the",
"resource",
"based",
"on",
"the",
"inputed",
"relative",
"path",
".",
":",
"param",
"relpath",
"|",
"<str",
">",
":",
"return",
"<str",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/xresourcemanager.py#L173-L216 | train | Returns the path for the resource based on the inputed relative path. |
bitesofcode/projexui | projexui/xresourcemanager.py | XResourceManager.listdir | def listdir(self, relpath, rsc=None):
"""
Returns a list of the files within a path. When compiled, it will
list the files within a QResource, otherwise will list the files
within the directory.
:param relpath | <str>
rsc | <str> || N... | python | def listdir(self, relpath, rsc=None):
"""
Returns a list of the files within a path. When compiled, it will
list the files within a QResource, otherwise will list the files
within the directory.
:param relpath | <str>
rsc | <str> || N... | [
"def",
"listdir",
"(",
"self",
",",
"relpath",
",",
"rsc",
"=",
"None",
")",
":",
"filepath",
"=",
"self",
".",
"find",
"(",
"relpath",
",",
"rsc",
")",
"# parse a resource object\r",
"if",
"filepath",
".",
"startswith",
"(",
"':'",
")",
":",
"resource",... | Returns a list of the files within a path. When compiled, it will
list the files within a QResource, otherwise will list the files
within the directory.
:param relpath | <str>
rsc | <str> || None
:return [<str>, ..] | [
"Returns",
"a",
"list",
"of",
"the",
"files",
"within",
"a",
"path",
".",
"When",
"compiled",
"it",
"will",
"list",
"the",
"files",
"within",
"a",
"QResource",
"otherwise",
"will",
"list",
"the",
"files",
"within",
"the",
"directory",
".",
":",
"param",
... | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/xresourcemanager.py#L218-L242 | train | Returns a list of the files within a path. |
bitesofcode/projexui | projexui/xresourcemanager.py | XResourceManager.init | def init(self):
"""
Initializes the plugins for this resource manager.
"""
# import any compiled resource modules
if not self._initialized:
self._initialized = True
wrap = projexui.qt.QT_WRAPPER.lower()
ignore = lambda x: not x.split('.... | python | def init(self):
"""
Initializes the plugins for this resource manager.
"""
# import any compiled resource modules
if not self._initialized:
self._initialized = True
wrap = projexui.qt.QT_WRAPPER.lower()
ignore = lambda x: not x.split('.... | [
"def",
"init",
"(",
"self",
")",
":",
"# import any compiled resource modules\r",
"if",
"not",
"self",
".",
"_initialized",
":",
"self",
".",
"_initialized",
"=",
"True",
"wrap",
"=",
"projexui",
".",
"qt",
".",
"QT_WRAPPER",
".",
"lower",
"(",
")",
"ignore"... | Initializes the plugins for this resource manager. | [
"Initializes",
"the",
"plugins",
"for",
"this",
"resource",
"manager",
"."
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/xresourcemanager.py#L244-L253 | train | Initializes the plugins for this resource manager. |
bitesofcode/projexui | projexui/xresourcemanager.py | XResourceManager.isdir | def isdir(self, relpath, rsc=None):
"""
Returns whether or not the resource is a directory.
:return <bool>
"""
filepath = self.find(relpath, rsc)
if filepath.startswith(':'):
resource = QtCore.QResource(filepath)
return not re... | python | def isdir(self, relpath, rsc=None):
"""
Returns whether or not the resource is a directory.
:return <bool>
"""
filepath = self.find(relpath, rsc)
if filepath.startswith(':'):
resource = QtCore.QResource(filepath)
return not re... | [
"def",
"isdir",
"(",
"self",
",",
"relpath",
",",
"rsc",
"=",
"None",
")",
":",
"filepath",
"=",
"self",
".",
"find",
"(",
"relpath",
",",
"rsc",
")",
"if",
"filepath",
".",
"startswith",
"(",
"':'",
")",
":",
"resource",
"=",
"QtCore",
".",
"QReso... | Returns whether or not the resource is a directory.
:return <bool> | [
"Returns",
"whether",
"or",
"not",
"the",
"resource",
"is",
"a",
"directory",
".",
":",
"return",
"<bool",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/xresourcemanager.py#L255-L266 | train | Returns whether or not the resource is a directory. |
bitesofcode/projexui | projexui/xresourcemanager.py | XResourceManager.load | def load(self, relpath, rsc=None, mode='r', useFilepath=None):
"""
Opens a file like object for reading for the given relpath.
:param relpath | <str>
:return <File> || <QFile> || None
"""
filepath = self.find(relpath, rsc, useFilepath=us... | python | def load(self, relpath, rsc=None, mode='r', useFilepath=None):
"""
Opens a file like object for reading for the given relpath.
:param relpath | <str>
:return <File> || <QFile> || None
"""
filepath = self.find(relpath, rsc, useFilepath=us... | [
"def",
"load",
"(",
"self",
",",
"relpath",
",",
"rsc",
"=",
"None",
",",
"mode",
"=",
"'r'",
",",
"useFilepath",
"=",
"None",
")",
":",
"filepath",
"=",
"self",
".",
"find",
"(",
"relpath",
",",
"rsc",
",",
"useFilepath",
"=",
"useFilepath",
")",
... | Opens a file like object for reading for the given relpath.
:param relpath | <str>
:return <File> || <QFile> || None | [
"Opens",
"a",
"file",
"like",
"object",
"for",
"reading",
"for",
"the",
"given",
"relpath",
".",
":",
"param",
"relpath",
"|",
"<str",
">",
":",
"return",
"<File",
">",
"||",
"<QFile",
">",
"||",
"None"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/xresourcemanager.py#L281-L301 | train | Returns a file like object for reading for the given relpath. |
bitesofcode/projexui | projexui/xresourcemanager.py | XResourceManager.read | def read(self, relpath, rsc=None, mode='r', useFilepath=None):
"""
Reads the contents for a given relative filepath. This will call
the load function and do a full read on the file contents.
:param relpath | <str>
rsc | <str> || None
... | python | def read(self, relpath, rsc=None, mode='r', useFilepath=None):
"""
Reads the contents for a given relative filepath. This will call
the load function and do a full read on the file contents.
:param relpath | <str>
rsc | <str> || None
... | [
"def",
"read",
"(",
"self",
",",
"relpath",
",",
"rsc",
"=",
"None",
",",
"mode",
"=",
"'r'",
",",
"useFilepath",
"=",
"None",
")",
":",
"f",
"=",
"self",
".",
"load",
"(",
"relpath",
",",
"rsc",
",",
"mode",
",",
"useFilepath",
"=",
"useFilepath",... | Reads the contents for a given relative filepath. This will call
the load function and do a full read on the file contents.
:param relpath | <str>
rsc | <str> || None
mode | <str> | 'r' or 'rb'
:return <str> | [
"Reads",
"the",
"contents",
"for",
"a",
"given",
"relative",
"filepath",
".",
"This",
"will",
"call",
"the",
"load",
"function",
"and",
"do",
"a",
"full",
"read",
"on",
"the",
"file",
"contents",
".",
":",
"param",
"relpath",
"|",
"<str",
">",
"rsc",
"... | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/xresourcemanager.py#L338-L364 | train | Reads the contents of a given relative filepath. |
bitesofcode/projexui | projexui/xresourcemanager.py | XResourceManager.walk | def walk(self, root):
"""
Walks the path for a returning the folders and roots for the
files found, similar to os.walk.
:param path | <str>
"""
files = []
folders = []
for relpath in self.listdir(root):
if self... | python | def walk(self, root):
"""
Walks the path for a returning the folders and roots for the
files found, similar to os.walk.
:param path | <str>
"""
files = []
folders = []
for relpath in self.listdir(root):
if self... | [
"def",
"walk",
"(",
"self",
",",
"root",
")",
":",
"files",
"=",
"[",
"]",
"folders",
"=",
"[",
"]",
"for",
"relpath",
"in",
"self",
".",
"listdir",
"(",
"root",
")",
":",
"if",
"self",
".",
"isfile",
"(",
"root",
"+",
"'/'",
"+",
"relpath",
")... | Walks the path for a returning the folders and roots for the
files found, similar to os.walk.
:param path | <str> | [
"Walks",
"the",
"path",
"for",
"a",
"returning",
"the",
"folders",
"and",
"roots",
"for",
"the",
"files",
"found",
"similar",
"to",
"os",
".",
"walk",
".",
":",
"param",
"path",
"|",
"<str",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/xresourcemanager.py#L375-L396 | train | Walks the path for a returning the folders and roots for the
files found. |
bitesofcode/projexui | projexui/xresourcemanager.py | XResourceManager.setup | def setup(self, glbls):
"""
Sets up the resource manager as modular functions.
:param glbls | <dict>
"""
if not self.pluginPath() in sys.path:
log.debug(self.pluginPath())
sys.path.append(self.pluginPath())
glbls['f... | python | def setup(self, glbls):
"""
Sets up the resource manager as modular functions.
:param glbls | <dict>
"""
if not self.pluginPath() in sys.path:
log.debug(self.pluginPath())
sys.path.append(self.pluginPath())
glbls['f... | [
"def",
"setup",
"(",
"self",
",",
"glbls",
")",
":",
"if",
"not",
"self",
".",
"pluginPath",
"(",
")",
"in",
"sys",
".",
"path",
":",
"log",
".",
"debug",
"(",
"self",
".",
"pluginPath",
"(",
")",
")",
"sys",
".",
"path",
".",
"append",
"(",
"s... | Sets up the resource manager as modular functions.
:param glbls | <dict> | [
"Sets",
"up",
"the",
"resource",
"manager",
"as",
"modular",
"functions",
".",
":",
"param",
"glbls",
"|",
"<dict",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/xresourcemanager.py#L398-L423 | train | Sets up the resource manager as modular functions. |
bitesofcode/projexui | projexui/xresourcemanager.py | XResourceManager.setDefault | def setDefault(self, key, value):
"""
Sets the default for a given key to the value.
:param key | <str>
value | <str> || <XResourceManager>
"""
if value is None:
self._defaults.pop(key, None)
else:
self._... | python | def setDefault(self, key, value):
"""
Sets the default for a given key to the value.
:param key | <str>
value | <str> || <XResourceManager>
"""
if value is None:
self._defaults.pop(key, None)
else:
self._... | [
"def",
"setDefault",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"self",
".",
"_defaults",
".",
"pop",
"(",
"key",
",",
"None",
")",
"else",
":",
"self",
".",
"_defaults",
"[",
"key",
"]",
"=",
"value"
] | Sets the default for a given key to the value.
:param key | <str>
value | <str> || <XResourceManager> | [
"Sets",
"the",
"default",
"for",
"a",
"given",
"key",
"to",
"the",
"value",
".",
":",
"param",
"key",
"|",
"<str",
">",
"value",
"|",
"<str",
">",
"||",
"<XResourceManager",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/xresourcemanager.py#L433-L443 | train | Sets the default value for a given key. |
intelsdi-x/snap-plugin-lib-py | snap_plugin/v1/config_policy.py | ConfigPolicy.policies | def policies(self):
"""Return list of policies zipped with their respective data type"""
policies = [self._pb.integer_policy, self._pb.float_policy,
self._pb.string_policy, self._pb.bool_policy]
key_types = ["integer", "float", "string", "bool"]
return zip(key_types, ... | python | def policies(self):
"""Return list of policies zipped with their respective data type"""
policies = [self._pb.integer_policy, self._pb.float_policy,
self._pb.string_policy, self._pb.bool_policy]
key_types = ["integer", "float", "string", "bool"]
return zip(key_types, ... | [
"def",
"policies",
"(",
"self",
")",
":",
"policies",
"=",
"[",
"self",
".",
"_pb",
".",
"integer_policy",
",",
"self",
".",
"_pb",
".",
"float_policy",
",",
"self",
".",
"_pb",
".",
"string_policy",
",",
"self",
".",
"_pb",
".",
"bool_policy",
"]",
... | Return list of policies zipped with their respective data type | [
"Return",
"list",
"of",
"policies",
"zipped",
"with",
"their",
"respective",
"data",
"type"
] | 8da5d00ac5f9d2b48a7239563ac7788209891ca4 | https://github.com/intelsdi-x/snap-plugin-lib-py/blob/8da5d00ac5f9d2b48a7239563ac7788209891ca4/snap_plugin/v1/config_policy.py#L140-L145 | train | Return list of policies zipped with their respective data type |
sprockets/sprockets-influxdb | sprockets_influxdb.py | add_measurement | def add_measurement(measurement):
"""Add measurement data to the submission buffer for eventual writing to
InfluxDB.
Example:
.. code:: python
import sprockets_influxdb as influxdb
measurement = influxdb.Measurement('example', 'measurement-name')
measurement.set_tag('foo', 'b... | python | def add_measurement(measurement):
"""Add measurement data to the submission buffer for eventual writing to
InfluxDB.
Example:
.. code:: python
import sprockets_influxdb as influxdb
measurement = influxdb.Measurement('example', 'measurement-name')
measurement.set_tag('foo', 'b... | [
"def",
"add_measurement",
"(",
"measurement",
")",
":",
"global",
"_buffer_size",
"if",
"not",
"_enabled",
":",
"LOGGER",
".",
"debug",
"(",
"'Discarding measurement for %s while not enabled'",
",",
"measurement",
".",
"database",
")",
"return",
"if",
"_stopping",
"... | Add measurement data to the submission buffer for eventual writing to
InfluxDB.
Example:
.. code:: python
import sprockets_influxdb as influxdb
measurement = influxdb.Measurement('example', 'measurement-name')
measurement.set_tag('foo', 'bar')
measurement.set_field('baz',... | [
"Add",
"measurement",
"data",
"to",
"the",
"submission",
"buffer",
"for",
"eventual",
"writing",
"to",
"InfluxDB",
"."
] | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L159-L212 | train | Adds a measurement to the submission buffer for eventual writing to InfluxDB. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | flush | def flush():
"""Flush all pending measurements to InfluxDB. This will ensure that all
measurements that are in the buffer for any database are written. If the
requests fail, it will continue to try and submit the metrics until they
are successfully written.
:rtype: :class:`~tornado.concurrent.Futur... | python | def flush():
"""Flush all pending measurements to InfluxDB. This will ensure that all
measurements that are in the buffer for any database are written. If the
requests fail, it will continue to try and submit the metrics until they
are successfully written.
:rtype: :class:`~tornado.concurrent.Futur... | [
"def",
"flush",
"(",
")",
":",
"flush_future",
"=",
"concurrent",
".",
"Future",
"(",
")",
"if",
"_batch_future",
"and",
"not",
"_batch_future",
".",
"done",
"(",
")",
":",
"LOGGER",
".",
"debug",
"(",
"'Flush waiting on incomplete _batch_future'",
")",
"_flus... | Flush all pending measurements to InfluxDB. This will ensure that all
measurements that are in the buffer for any database are written. If the
requests fail, it will continue to try and submit the metrics until they
are successfully written.
:rtype: :class:`~tornado.concurrent.Future` | [
"Flush",
"all",
"pending",
"measurements",
"to",
"InfluxDB",
".",
"This",
"will",
"ensure",
"that",
"all",
"measurements",
"that",
"are",
"in",
"the",
"buffer",
"for",
"any",
"database",
"are",
"written",
".",
"If",
"the",
"requests",
"fail",
"it",
"will",
... | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L215-L232 | train | Flush all pending measurements to InfluxDB. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | install | def install(url=None, auth_username=None, auth_password=None,
submission_interval=None, max_batch_size=None, max_clients=10,
base_tags=None, max_buffer_size=None, trigger_size=None,
sample_probability=1.0):
"""Call this to install/setup the InfluxDB client collector. All argument... | python | def install(url=None, auth_username=None, auth_password=None,
submission_interval=None, max_batch_size=None, max_clients=10,
base_tags=None, max_buffer_size=None, trigger_size=None,
sample_probability=1.0):
"""Call this to install/setup the InfluxDB client collector. All argument... | [
"def",
"install",
"(",
"url",
"=",
"None",
",",
"auth_username",
"=",
"None",
",",
"auth_password",
"=",
"None",
",",
"submission_interval",
"=",
"None",
",",
"max_batch_size",
"=",
"None",
",",
"max_clients",
"=",
"10",
",",
"base_tags",
"=",
"None",
",",... | Call this to install/setup the InfluxDB client collector. All arguments
are optional.
:param str url: The InfluxDB API URL. If URL is not specified, the
``INFLUXDB_SCHEME``, ``INFLUXDB_HOST`` and ``INFLUXDB_PORT``
environment variables will be used to construct the base URL. Default:
``... | [
"Call",
"this",
"to",
"install",
"/",
"setup",
"the",
"InfluxDB",
"client",
"collector",
".",
"All",
"arguments",
"are",
"optional",
"."
] | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L235-L331 | train | Installs and sets up the InfluxDB client collector. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | set_auth_credentials | def set_auth_credentials(username, password):
"""Override the default authentication credentials obtained from the
environment variable configuration.
:param str username: The username to use
:param str password: The password to use
"""
global _credentials, _dirty
LOGGER.debug('Setting au... | python | def set_auth_credentials(username, password):
"""Override the default authentication credentials obtained from the
environment variable configuration.
:param str username: The username to use
:param str password: The password to use
"""
global _credentials, _dirty
LOGGER.debug('Setting au... | [
"def",
"set_auth_credentials",
"(",
"username",
",",
"password",
")",
":",
"global",
"_credentials",
",",
"_dirty",
"LOGGER",
".",
"debug",
"(",
"'Setting authentication credentials'",
")",
"_credentials",
"=",
"username",
",",
"password",
"_dirty",
"=",
"True"
] | Override the default authentication credentials obtained from the
environment variable configuration.
:param str username: The username to use
:param str password: The password to use | [
"Override",
"the",
"default",
"authentication",
"credentials",
"obtained",
"from",
"the",
"environment",
"variable",
"configuration",
"."
] | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L334-L346 | train | Override the default authentication credentials obtained from the
environment variable configuration. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | set_base_url | def set_base_url(url):
"""Override the default base URL value created from the environment
variable configuration.
:param str url: The base URL to use when submitting measurements
"""
global _base_url, _dirty
LOGGER.debug('Setting base URL to %s', url)
_base_url = url
_dirty = True | python | def set_base_url(url):
"""Override the default base URL value created from the environment
variable configuration.
:param str url: The base URL to use when submitting measurements
"""
global _base_url, _dirty
LOGGER.debug('Setting base URL to %s', url)
_base_url = url
_dirty = True | [
"def",
"set_base_url",
"(",
"url",
")",
":",
"global",
"_base_url",
",",
"_dirty",
"LOGGER",
".",
"debug",
"(",
"'Setting base URL to %s'",
",",
"url",
")",
"_base_url",
"=",
"url",
"_dirty",
"=",
"True"
] | Override the default base URL value created from the environment
variable configuration.
:param str url: The base URL to use when submitting measurements | [
"Override",
"the",
"default",
"base",
"URL",
"value",
"created",
"from",
"the",
"environment",
"variable",
"configuration",
"."
] | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L349-L360 | train | Override the default base URL value created from the environment
variable configuration. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | set_max_clients | def set_max_clients(limit):
"""Set the maximum number of simultaneous batch submission that can execute
in parallel.
:param int limit: The maximum number of simultaneous batch submissions
"""
global _dirty, _max_clients
LOGGER.debug('Setting maximum client limit to %i', limit)
_dirty = Tr... | python | def set_max_clients(limit):
"""Set the maximum number of simultaneous batch submission that can execute
in parallel.
:param int limit: The maximum number of simultaneous batch submissions
"""
global _dirty, _max_clients
LOGGER.debug('Setting maximum client limit to %i', limit)
_dirty = Tr... | [
"def",
"set_max_clients",
"(",
"limit",
")",
":",
"global",
"_dirty",
",",
"_max_clients",
"LOGGER",
".",
"debug",
"(",
"'Setting maximum client limit to %i'",
",",
"limit",
")",
"_dirty",
"=",
"True",
"_max_clients",
"=",
"limit"
] | Set the maximum number of simultaneous batch submission that can execute
in parallel.
:param int limit: The maximum number of simultaneous batch submissions | [
"Set",
"the",
"maximum",
"number",
"of",
"simultaneous",
"batch",
"submission",
"that",
"can",
"execute",
"in",
"parallel",
"."
] | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L390-L401 | train | Sets the maximum number of simultaneous batch submission that can execute
in parallel. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | set_sample_probability | def set_sample_probability(probability):
"""Set the probability that a batch will be submitted to the InfluxDB
server. This should be a value that is greater than or equal to ``0`` and
less than or equal to ``1.0``. A value of ``0.25`` would represent a
probability of 25% that a batch would be written t... | python | def set_sample_probability(probability):
"""Set the probability that a batch will be submitted to the InfluxDB
server. This should be a value that is greater than or equal to ``0`` and
less than or equal to ``1.0``. A value of ``0.25`` would represent a
probability of 25% that a batch would be written t... | [
"def",
"set_sample_probability",
"(",
"probability",
")",
":",
"global",
"_sample_probability",
"if",
"not",
"0.0",
"<=",
"probability",
"<=",
"1.0",
":",
"raise",
"ValueError",
"(",
"'Invalid probability value'",
")",
"LOGGER",
".",
"debug",
"(",
"'Setting sample p... | Set the probability that a batch will be submitted to the InfluxDB
server. This should be a value that is greater than or equal to ``0`` and
less than or equal to ``1.0``. A value of ``0.25`` would represent a
probability of 25% that a batch would be written to InfluxDB.
:param float probability: The v... | [
"Set",
"the",
"probability",
"that",
"a",
"batch",
"will",
"be",
"submitted",
"to",
"the",
"InfluxDB",
"server",
".",
"This",
"should",
"be",
"a",
"value",
"that",
"is",
"greater",
"than",
"or",
"equal",
"to",
"0",
"and",
"less",
"than",
"or",
"equal",
... | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L404-L420 | train | Set the probability that a batch will be submitted to the InfluxDB server. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | set_timeout | def set_timeout(milliseconds):
"""Override the maximum duration to wait for submitting measurements to
InfluxDB.
:param int milliseconds: Maximum wait in milliseconds
"""
global _timeout, _timeout_interval
LOGGER.debug('Setting batch wait timeout to %i ms', milliseconds)
_timeout_interval... | python | def set_timeout(milliseconds):
"""Override the maximum duration to wait for submitting measurements to
InfluxDB.
:param int milliseconds: Maximum wait in milliseconds
"""
global _timeout, _timeout_interval
LOGGER.debug('Setting batch wait timeout to %i ms', milliseconds)
_timeout_interval... | [
"def",
"set_timeout",
"(",
"milliseconds",
")",
":",
"global",
"_timeout",
",",
"_timeout_interval",
"LOGGER",
".",
"debug",
"(",
"'Setting batch wait timeout to %i ms'",
",",
"milliseconds",
")",
"_timeout_interval",
"=",
"milliseconds",
"_maybe_stop_timeout",
"(",
")"... | Override the maximum duration to wait for submitting measurements to
InfluxDB.
:param int milliseconds: Maximum wait in milliseconds | [
"Override",
"the",
"maximum",
"duration",
"to",
"wait",
"for",
"submitting",
"measurements",
"to",
"InfluxDB",
"."
] | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L423-L435 | train | Override the maximum duration to wait for submitting measurements to
InfluxDB. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | _create_http_client | def _create_http_client():
"""Create the HTTP client with authentication credentials if required."""
global _http_client
defaults = {'user_agent': USER_AGENT}
auth_username, auth_password = _credentials
if auth_username and auth_password:
defaults['auth_username'] = auth_username
de... | python | def _create_http_client():
"""Create the HTTP client with authentication credentials if required."""
global _http_client
defaults = {'user_agent': USER_AGENT}
auth_username, auth_password = _credentials
if auth_username and auth_password:
defaults['auth_username'] = auth_username
de... | [
"def",
"_create_http_client",
"(",
")",
":",
"global",
"_http_client",
"defaults",
"=",
"{",
"'user_agent'",
":",
"USER_AGENT",
"}",
"auth_username",
",",
"auth_password",
"=",
"_credentials",
"if",
"auth_username",
"and",
"auth_password",
":",
"defaults",
"[",
"'... | Create the HTTP client with authentication credentials if required. | [
"Create",
"the",
"HTTP",
"client",
"with",
"authentication",
"credentials",
"if",
"required",
"."
] | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L472-L484 | train | Create the HTTP client with authentication credentials if required. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | _flush_wait | def _flush_wait(flush_future, write_future):
"""Pause briefly allowing any pending metric writes to complete before
shutting down.
:param tornado.concurrent.Future flush_future: The future to resolve
when the shutdown is complete.
:param tornado.concurrent.Future write_future: The future that i... | python | def _flush_wait(flush_future, write_future):
"""Pause briefly allowing any pending metric writes to complete before
shutting down.
:param tornado.concurrent.Future flush_future: The future to resolve
when the shutdown is complete.
:param tornado.concurrent.Future write_future: The future that i... | [
"def",
"_flush_wait",
"(",
"flush_future",
",",
"write_future",
")",
":",
"if",
"write_future",
".",
"done",
"(",
")",
":",
"if",
"not",
"_pending_measurements",
"(",
")",
":",
"flush_future",
".",
"set_result",
"(",
"True",
")",
"return",
"else",
":",
"wr... | Pause briefly allowing any pending metric writes to complete before
shutting down.
:param tornado.concurrent.Future flush_future: The future to resolve
when the shutdown is complete.
:param tornado.concurrent.Future write_future: The future that is for the
current batch write operation. | [
"Pause",
"briefly",
"allowing",
"any",
"pending",
"metric",
"writes",
"to",
"complete",
"before",
"shutting",
"down",
"."
] | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L487-L505 | train | Pause briefly allowing any pending metric writes to complete before the shutdown is complete. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | _futures_wait | def _futures_wait(wait_future, futures):
"""Waits for all futures to be completed. If the futures are not done,
wait 100ms and then invoke itself via the ioloop and check again. If
they are done, set a result on `wait_future` indicating the list of
futures are done.
:param wait_future: The future t... | python | def _futures_wait(wait_future, futures):
"""Waits for all futures to be completed. If the futures are not done,
wait 100ms and then invoke itself via the ioloop and check again. If
they are done, set a result on `wait_future` indicating the list of
futures are done.
:param wait_future: The future t... | [
"def",
"_futures_wait",
"(",
"wait_future",
",",
"futures",
")",
":",
"global",
"_buffer_size",
",",
"_writing",
"remaining",
"=",
"[",
"]",
"for",
"(",
"future",
",",
"batch",
",",
"database",
",",
"measurements",
")",
"in",
"futures",
":",
"# If the future... | Waits for all futures to be completed. If the futures are not done,
wait 100ms and then invoke itself via the ioloop and check again. If
they are done, set a result on `wait_future` indicating the list of
futures are done.
:param wait_future: The future to complete when all `futures` are done
:type... | [
"Waits",
"for",
"all",
"futures",
"to",
"be",
"completed",
".",
"If",
"the",
"futures",
"are",
"not",
"done",
"wait",
"100ms",
"and",
"then",
"invoke",
"itself",
"via",
"the",
"ioloop",
"and",
"check",
"again",
".",
"If",
"they",
"are",
"done",
"set",
... | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L508-L558 | train | Waits for all futures to be completed and returns a tornado. concurrent. Future that is ready to be returned. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | _maybe_stop_timeout | def _maybe_stop_timeout():
"""If there is a pending timeout, remove it from the IOLoop and set the
``_timeout`` global to None.
"""
global _timeout
if _timeout is not None:
LOGGER.debug('Removing the pending timeout (%r)', _timeout)
ioloop.IOLoop.current().remove_timeout(_timeout)
... | python | def _maybe_stop_timeout():
"""If there is a pending timeout, remove it from the IOLoop and set the
``_timeout`` global to None.
"""
global _timeout
if _timeout is not None:
LOGGER.debug('Removing the pending timeout (%r)', _timeout)
ioloop.IOLoop.current().remove_timeout(_timeout)
... | [
"def",
"_maybe_stop_timeout",
"(",
")",
":",
"global",
"_timeout",
"if",
"_timeout",
"is",
"not",
"None",
":",
"LOGGER",
".",
"debug",
"(",
"'Removing the pending timeout (%r)'",
",",
"_timeout",
")",
"ioloop",
".",
"IOLoop",
".",
"current",
"(",
")",
".",
"... | If there is a pending timeout, remove it from the IOLoop and set the
``_timeout`` global to None. | [
"If",
"there",
"is",
"a",
"pending",
"timeout",
"remove",
"it",
"from",
"the",
"IOLoop",
"and",
"set",
"the",
"_timeout",
"global",
"to",
"None",
"."
] | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L561-L571 | train | Stop the timeout if there is one. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | _maybe_warn_about_buffer_size | def _maybe_warn_about_buffer_size():
"""Check the buffer size and issue a warning if it's too large and
a warning has not been issued for more than 60 seconds.
"""
global _last_warning
if not _last_warning:
_last_warning = time.time()
if _buffer_size > _warn_threshold and (time.time()... | python | def _maybe_warn_about_buffer_size():
"""Check the buffer size and issue a warning if it's too large and
a warning has not been issued for more than 60 seconds.
"""
global _last_warning
if not _last_warning:
_last_warning = time.time()
if _buffer_size > _warn_threshold and (time.time()... | [
"def",
"_maybe_warn_about_buffer_size",
"(",
")",
":",
"global",
"_last_warning",
"if",
"not",
"_last_warning",
":",
"_last_warning",
"=",
"time",
".",
"time",
"(",
")",
"if",
"_buffer_size",
">",
"_warn_threshold",
"and",
"(",
"time",
".",
"time",
"(",
")",
... | Check the buffer size and issue a warning if it's too large and
a warning has not been issued for more than 60 seconds. | [
"Check",
"the",
"buffer",
"size",
"and",
"issue",
"a",
"warning",
"if",
"it",
"s",
"too",
"large",
"and",
"a",
"warning",
"has",
"not",
"been",
"issued",
"for",
"more",
"than",
"60",
"seconds",
"."
] | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L574-L586 | train | Check the buffer size and issue a warning if it s too large and
has not been issued for more than 60 seconds. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | _on_5xx_error | def _on_5xx_error(batch, error, database, measurements):
"""Handle a batch submission error, logging the problem and adding the
measurements back to the stack.
:param str batch: The batch ID
:param mixed error: The error that was returned
:param str database: The database the submission failed for
... | python | def _on_5xx_error(batch, error, database, measurements):
"""Handle a batch submission error, logging the problem and adding the
measurements back to the stack.
:param str batch: The batch ID
:param mixed error: The error that was returned
:param str database: The database the submission failed for
... | [
"def",
"_on_5xx_error",
"(",
"batch",
",",
"error",
",",
"database",
",",
"measurements",
")",
":",
"LOGGER",
".",
"info",
"(",
"'Appending %s measurements to stack due to batch %s %r'",
",",
"database",
",",
"batch",
",",
"error",
")",
"_measurements",
"[",
"data... | Handle a batch submission error, logging the problem and adding the
measurements back to the stack.
:param str batch: The batch ID
:param mixed error: The error that was returned
:param str database: The database the submission failed for
:param list measurements: The measurements to add back to th... | [
"Handle",
"a",
"batch",
"submission",
"error",
"logging",
"the",
"problem",
"and",
"adding",
"the",
"measurements",
"back",
"to",
"the",
"stack",
"."
] | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L589-L601 | train | Handle a batch submission error logging the problem and adding the measurements back to the stack. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | _on_timeout | def _on_timeout():
"""Invoked periodically to ensure that metrics that have been collected
are submitted to InfluxDB.
:rtype: tornado.concurrent.Future or None
"""
global _buffer_size
LOGGER.debug('No metrics submitted in the last %.2f seconds',
_timeout_interval / 1000.0)
... | python | def _on_timeout():
"""Invoked periodically to ensure that metrics that have been collected
are submitted to InfluxDB.
:rtype: tornado.concurrent.Future or None
"""
global _buffer_size
LOGGER.debug('No metrics submitted in the last %.2f seconds',
_timeout_interval / 1000.0)
... | [
"def",
"_on_timeout",
"(",
")",
":",
"global",
"_buffer_size",
"LOGGER",
".",
"debug",
"(",
"'No metrics submitted in the last %.2f seconds'",
",",
"_timeout_interval",
"/",
"1000.0",
")",
"_buffer_size",
"=",
"_pending_measurements",
"(",
")",
"if",
"_buffer_size",
"... | Invoked periodically to ensure that metrics that have been collected
are submitted to InfluxDB.
:rtype: tornado.concurrent.Future or None | [
"Invoked",
"periodically",
"to",
"ensure",
"that",
"metrics",
"that",
"have",
"been",
"collected",
"are",
"submitted",
"to",
"InfluxDB",
"."
] | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L604-L618 | train | Called periodically to ensure that metrics that have been collected have been submitted to InfluxDB. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | _sample_batch | def _sample_batch():
"""Determine if a batch should be processed and if not, pop off all of
the pending metrics for that batch.
:rtype: bool
"""
if _sample_probability == 1.0 or random.random() < _sample_probability:
return True
# Pop off all the metrics for the batch
for database... | python | def _sample_batch():
"""Determine if a batch should be processed and if not, pop off all of
the pending metrics for that batch.
:rtype: bool
"""
if _sample_probability == 1.0 or random.random() < _sample_probability:
return True
# Pop off all the metrics for the batch
for database... | [
"def",
"_sample_batch",
"(",
")",
":",
"if",
"_sample_probability",
"==",
"1.0",
"or",
"random",
".",
"random",
"(",
")",
"<",
"_sample_probability",
":",
"return",
"True",
"# Pop off all the metrics for the batch",
"for",
"database",
"in",
"_measurements",
":",
"... | Determine if a batch should be processed and if not, pop off all of
the pending metrics for that batch.
:rtype: bool | [
"Determine",
"if",
"a",
"batch",
"should",
"be",
"processed",
"and",
"if",
"not",
"pop",
"off",
"all",
"of",
"the",
"pending",
"metrics",
"for",
"that",
"batch",
"."
] | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L631-L644 | train | Determine if a batch should be processed and pop off all of the pending metrics for that batch. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | _start_timeout | def _start_timeout():
"""Stop a running timeout if it's there, then create a new one."""
global _timeout
LOGGER.debug('Adding a new timeout in %i ms', _timeout_interval)
_maybe_stop_timeout()
_timeout = ioloop.IOLoop.current().add_timeout(
ioloop.IOLoop.current().time() + _timeout_interval ... | python | def _start_timeout():
"""Stop a running timeout if it's there, then create a new one."""
global _timeout
LOGGER.debug('Adding a new timeout in %i ms', _timeout_interval)
_maybe_stop_timeout()
_timeout = ioloop.IOLoop.current().add_timeout(
ioloop.IOLoop.current().time() + _timeout_interval ... | [
"def",
"_start_timeout",
"(",
")",
":",
"global",
"_timeout",
"LOGGER",
".",
"debug",
"(",
"'Adding a new timeout in %i ms'",
",",
"_timeout_interval",
")",
"_maybe_stop_timeout",
"(",
")",
"_timeout",
"=",
"ioloop",
".",
"IOLoop",
".",
"current",
"(",
")",
".",... | Stop a running timeout if it's there, then create a new one. | [
"Stop",
"a",
"running",
"timeout",
"if",
"it",
"s",
"there",
"then",
"create",
"a",
"new",
"one",
"."
] | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L647-L655 | train | Start a new timeout if it s not already running. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | _trigger_batch_write | def _trigger_batch_write():
"""Stop a timeout if it's running, and then write the measurements."""
global _batch_future
LOGGER.debug('Batch write triggered (%r/%r)',
_buffer_size, _trigger_size)
_maybe_stop_timeout()
_maybe_warn_about_buffer_size()
_batch_future = _write_measur... | python | def _trigger_batch_write():
"""Stop a timeout if it's running, and then write the measurements."""
global _batch_future
LOGGER.debug('Batch write triggered (%r/%r)',
_buffer_size, _trigger_size)
_maybe_stop_timeout()
_maybe_warn_about_buffer_size()
_batch_future = _write_measur... | [
"def",
"_trigger_batch_write",
"(",
")",
":",
"global",
"_batch_future",
"LOGGER",
".",
"debug",
"(",
"'Batch write triggered (%r/%r)'",
",",
"_buffer_size",
",",
"_trigger_size",
")",
"_maybe_stop_timeout",
"(",
")",
"_maybe_warn_about_buffer_size",
"(",
")",
"_batch_f... | Stop a timeout if it's running, and then write the measurements. | [
"Stop",
"a",
"timeout",
"if",
"it",
"s",
"running",
"and",
"then",
"write",
"the",
"measurements",
"."
] | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L658-L667 | train | Stop a timeout if it s running and then write the measurements. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | _write_measurements | def _write_measurements():
"""Write out all of the metrics in each of the databases,
returning a future that will indicate all metrics have been written
when that future is done.
:rtype: tornado.concurrent.Future
"""
global _timeout, _writing
future = concurrent.Future()
if _writing:... | python | def _write_measurements():
"""Write out all of the metrics in each of the databases,
returning a future that will indicate all metrics have been written
when that future is done.
:rtype: tornado.concurrent.Future
"""
global _timeout, _writing
future = concurrent.Future()
if _writing:... | [
"def",
"_write_measurements",
"(",
")",
":",
"global",
"_timeout",
",",
"_writing",
"future",
"=",
"concurrent",
".",
"Future",
"(",
")",
"if",
"_writing",
":",
"LOGGER",
".",
"warning",
"(",
"'Currently writing measurements, skipping write'",
")",
"future",
".",
... | Write out all of the metrics in each of the databases,
returning a future that will indicate all metrics have been written
when that future is done.
:rtype: tornado.concurrent.Future | [
"Write",
"out",
"all",
"of",
"the",
"metrics",
"in",
"each",
"of",
"the",
"databases",
"returning",
"a",
"future",
"that",
"will",
"indicate",
"all",
"metrics",
"have",
"been",
"written",
"when",
"that",
"future",
"is",
"done",
"."
] | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L670-L724 | train | Write out all of the metrics in each of the databases and return a future that will indicate all metrics have been written to the server. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | _write_error_batch | def _write_error_batch(batch, database, measurements):
"""Invoked when a batch submission fails, this method will submit one
measurement to InfluxDB. It then adds a timeout to the IOLoop which will
invoke :meth:`_write_error_batch_wait` which will evaluate the result and
then determine what to do next.
... | python | def _write_error_batch(batch, database, measurements):
"""Invoked when a batch submission fails, this method will submit one
measurement to InfluxDB. It then adds a timeout to the IOLoop which will
invoke :meth:`_write_error_batch_wait` which will evaluate the result and
then determine what to do next.
... | [
"def",
"_write_error_batch",
"(",
"batch",
",",
"database",
",",
"measurements",
")",
":",
"if",
"not",
"measurements",
":",
"LOGGER",
".",
"info",
"(",
"'All %s measurements from batch %s processed'",
",",
"database",
",",
"batch",
")",
"return",
"LOGGER",
".",
... | Invoked when a batch submission fails, this method will submit one
measurement to InfluxDB. It then adds a timeout to the IOLoop which will
invoke :meth:`_write_error_batch_wait` which will evaluate the result and
then determine what to do next.
:param str batch: The batch ID for correlation purposes
... | [
"Invoked",
"when",
"a",
"batch",
"submission",
"fails",
"this",
"method",
"will",
"submit",
"one",
"measurement",
"to",
"InfluxDB",
".",
"It",
"then",
"adds",
"a",
"timeout",
"to",
"the",
"IOLoop",
"which",
"will",
"invoke",
":",
"meth",
":",
"_write_error_b... | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L727-L758 | train | Invoked when a batch submission fails this method will submit one
measurement to InfluxDB and then wait for the result to be done. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | _write_error_batch_wait | def _write_error_batch_wait(future, batch, database, measurement,
measurements):
"""Invoked by the IOLoop, this method checks if the HTTP request future
created by :meth:`_write_error_batch` is done. If it's done it will
evaluate the result, logging any error and moving on to the... | python | def _write_error_batch_wait(future, batch, database, measurement,
measurements):
"""Invoked by the IOLoop, this method checks if the HTTP request future
created by :meth:`_write_error_batch` is done. If it's done it will
evaluate the result, logging any error and moving on to the... | [
"def",
"_write_error_batch_wait",
"(",
"future",
",",
"batch",
",",
"database",
",",
"measurement",
",",
"measurements",
")",
":",
"if",
"not",
"future",
".",
"done",
"(",
")",
":",
"ioloop",
".",
"IOLoop",
".",
"current",
"(",
")",
".",
"add_timeout",
"... | Invoked by the IOLoop, this method checks if the HTTP request future
created by :meth:`_write_error_batch` is done. If it's done it will
evaluate the result, logging any error and moving on to the next
measurement. If there are no measurements left in the `measurements`
argument, it will consider the ba... | [
"Invoked",
"by",
"the",
"IOLoop",
"this",
"method",
"checks",
"if",
"the",
"HTTP",
"request",
"future",
"created",
"by",
":",
"meth",
":",
"_write_error_batch",
"is",
"done",
".",
"If",
"it",
"s",
"done",
"it",
"will",
"evaluate",
"the",
"result",
"logging... | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L761-L810 | train | This method is called by the IOLoop when the HTTP request is done. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | InfluxDBMixin._get_path_pattern_tornado4 | def _get_path_pattern_tornado4(self):
"""Return the path pattern used when routing a request. (Tornado<4.5)
:rtype: str
"""
for host, handlers in self.application.handlers:
if host.match(self.request.host):
for handler in handlers:
if hand... | python | def _get_path_pattern_tornado4(self):
"""Return the path pattern used when routing a request. (Tornado<4.5)
:rtype: str
"""
for host, handlers in self.application.handlers:
if host.match(self.request.host):
for handler in handlers:
if hand... | [
"def",
"_get_path_pattern_tornado4",
"(",
"self",
")",
":",
"for",
"host",
",",
"handlers",
"in",
"self",
".",
"application",
".",
"handlers",
":",
"if",
"host",
".",
"match",
"(",
"self",
".",
"request",
".",
"host",
")",
":",
"for",
"handler",
"in",
... | Return the path pattern used when routing a request. (Tornado<4.5)
:rtype: str | [
"Return",
"the",
"path",
"pattern",
"used",
"when",
"routing",
"a",
"request",
".",
"(",
"Tornado<4",
".",
"5",
")"
] | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L121-L130 | train | Return the path pattern used when routing a request. Tornado < 4. 5. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | InfluxDBMixin._get_path_pattern_tornado45 | def _get_path_pattern_tornado45(self, router=None):
"""Return the path pattern used when routing a request. (Tornado>=4.5)
:param tornado.routing.Router router: (Optional) The router to scan.
Defaults to the application's router.
:rtype: str
"""
if router is None:
... | python | def _get_path_pattern_tornado45(self, router=None):
"""Return the path pattern used when routing a request. (Tornado>=4.5)
:param tornado.routing.Router router: (Optional) The router to scan.
Defaults to the application's router.
:rtype: str
"""
if router is None:
... | [
"def",
"_get_path_pattern_tornado45",
"(",
"self",
",",
"router",
"=",
"None",
")",
":",
"if",
"router",
"is",
"None",
":",
"router",
"=",
"self",
".",
"application",
".",
"default_router",
"for",
"rule",
"in",
"router",
".",
"rules",
":",
"if",
"rule",
... | Return the path pattern used when routing a request. (Tornado>=4.5)
:param tornado.routing.Router router: (Optional) The router to scan.
Defaults to the application's router.
:rtype: str | [
"Return",
"the",
"path",
"pattern",
"used",
"when",
"routing",
"a",
"request",
".",
"(",
"Tornado",
">",
"=",
"4",
".",
"5",
")"
] | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L132-L147 | train | Returns the path pattern used when routing a request. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | Measurement.duration | def duration(self, name):
"""Record the time it takes to run an arbitrary code block.
:param str name: The field name to record the timing in
This method returns a context manager that records the amount
of time spent inside of the context, adding the timing to the
measurement.... | python | def duration(self, name):
"""Record the time it takes to run an arbitrary code block.
:param str name: The field name to record the timing in
This method returns a context manager that records the amount
of time spent inside of the context, adding the timing to the
measurement.... | [
"def",
"duration",
"(",
"self",
",",
"name",
")",
":",
"start",
"=",
"time",
".",
"time",
"(",
")",
"try",
":",
"yield",
"finally",
":",
"self",
".",
"set_field",
"(",
"name",
",",
"max",
"(",
"time",
".",
"time",
"(",
")",
",",
"start",
")",
"... | Record the time it takes to run an arbitrary code block.
:param str name: The field name to record the timing in
This method returns a context manager that records the amount
of time spent inside of the context, adding the timing to the
measurement. | [
"Record",
"the",
"time",
"it",
"takes",
"to",
"run",
"an",
"arbitrary",
"code",
"block",
"."
] | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L842-L856 | train | Record the time spent inside of a context. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | Measurement.marshall | def marshall(self):
"""Return the measurement in the line protocol format.
:rtype: str
"""
return '{},{} {} {}'.format(
self._escape(self.name),
','.join(['{}={}'.format(self._escape(k), self._escape(v))
for k, v in self.tags.items()]),
... | python | def marshall(self):
"""Return the measurement in the line protocol format.
:rtype: str
"""
return '{},{} {} {}'.format(
self._escape(self.name),
','.join(['{}={}'.format(self._escape(k), self._escape(v))
for k, v in self.tags.items()]),
... | [
"def",
"marshall",
"(",
"self",
")",
":",
"return",
"'{},{} {} {}'",
".",
"format",
"(",
"self",
".",
"_escape",
"(",
"self",
".",
"name",
")",
",",
"','",
".",
"join",
"(",
"[",
"'{}={}'",
".",
"format",
"(",
"self",
".",
"_escape",
"(",
"k",
")",... | Return the measurement in the line protocol format.
:rtype: str | [
"Return",
"the",
"measurement",
"in",
"the",
"line",
"protocol",
"format",
"."
] | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L858-L869 | train | Return the measurement in the line protocol format. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | Measurement.set_field | def set_field(self, name, value):
"""Set the value of a field in the measurement.
:param str name: The name of the field to set the value for
:param int|float|bool|str value: The value of the field
:raises: ValueError
"""
if not any([isinstance(value, t) for t in {int, ... | python | def set_field(self, name, value):
"""Set the value of a field in the measurement.
:param str name: The name of the field to set the value for
:param int|float|bool|str value: The value of the field
:raises: ValueError
"""
if not any([isinstance(value, t) for t in {int, ... | [
"def",
"set_field",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"if",
"not",
"any",
"(",
"[",
"isinstance",
"(",
"value",
",",
"t",
")",
"for",
"t",
"in",
"{",
"int",
",",
"float",
",",
"bool",
",",
"str",
"}",
"]",
")",
":",
"LOGGER",
... | Set the value of a field in the measurement.
:param str name: The name of the field to set the value for
:param int|float|bool|str value: The value of the field
:raises: ValueError | [
"Set",
"the",
"value",
"of",
"a",
"field",
"in",
"the",
"measurement",
"."
] | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L871-L882 | train | Set the value of a field in the measurement. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | Measurement.set_tags | def set_tags(self, tags):
"""Set multiple tags for the measurement.
:param dict tags: Tag key/value pairs to assign
This will overwrite the current value assigned to a tag
if one exists with the same name.
"""
for key, value in tags.items():
self.set_tag(ke... | python | def set_tags(self, tags):
"""Set multiple tags for the measurement.
:param dict tags: Tag key/value pairs to assign
This will overwrite the current value assigned to a tag
if one exists with the same name.
"""
for key, value in tags.items():
self.set_tag(ke... | [
"def",
"set_tags",
"(",
"self",
",",
"tags",
")",
":",
"for",
"key",
",",
"value",
"in",
"tags",
".",
"items",
"(",
")",
":",
"self",
".",
"set_tag",
"(",
"key",
",",
"value",
")"
] | Set multiple tags for the measurement.
:param dict tags: Tag key/value pairs to assign
This will overwrite the current value assigned to a tag
if one exists with the same name. | [
"Set",
"multiple",
"tags",
"for",
"the",
"measurement",
"."
] | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L896-L906 | train | Set multiple tags for the measurement. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | Measurement._escape | def _escape(value):
"""Escape a string (key or value) for InfluxDB's line protocol.
:param str|int|float|bool value: The value to be escaped
:rtype: str
"""
value = str(value)
for char, escaped in {' ': '\ ', ',': '\,', '"': '\"'}.items():
value = value.repl... | python | def _escape(value):
"""Escape a string (key or value) for InfluxDB's line protocol.
:param str|int|float|bool value: The value to be escaped
:rtype: str
"""
value = str(value)
for char, escaped in {' ': '\ ', ',': '\,', '"': '\"'}.items():
value = value.repl... | [
"def",
"_escape",
"(",
"value",
")",
":",
"value",
"=",
"str",
"(",
"value",
")",
"for",
"char",
",",
"escaped",
"in",
"{",
"' '",
":",
"'\\ '",
",",
"','",
":",
"'\\,'",
",",
"'\"'",
":",
"'\\\"'",
"}",
".",
"items",
"(",
")",
":",
"value",
"=... | Escape a string (key or value) for InfluxDB's line protocol.
:param str|int|float|bool value: The value to be escaped
:rtype: str | [
"Escape",
"a",
"string",
"(",
"key",
"or",
"value",
")",
"for",
"InfluxDB",
"s",
"line",
"protocol",
"."
] | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L917-L927 | train | Escape a string for InfluxDB s line protocol. |
sprockets/sprockets-influxdb | sprockets_influxdb.py | Measurement._marshall_fields | def _marshall_fields(self):
"""Convert the field dict into the string segment of field key/value
pairs.
:rtype: str
"""
values = {}
for key, value in self.fields.items():
if (isinstance(value, int) or
(isinstance(value, str) and value.isd... | python | def _marshall_fields(self):
"""Convert the field dict into the string segment of field key/value
pairs.
:rtype: str
"""
values = {}
for key, value in self.fields.items():
if (isinstance(value, int) or
(isinstance(value, str) and value.isd... | [
"def",
"_marshall_fields",
"(",
"self",
")",
":",
"values",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"in",
"self",
".",
"fields",
".",
"items",
"(",
")",
":",
"if",
"(",
"isinstance",
"(",
"value",
",",
"int",
")",
"or",
"(",
"isinstance",
"(",
... | Convert the field dict into the string segment of field key/value
pairs.
:rtype: str | [
"Convert",
"the",
"field",
"dict",
"into",
"the",
"string",
"segment",
"of",
"field",
"key",
"/",
"value",
"pairs",
"."
] | cce73481b8f26b02e65e3f9914a9a22eceff3063 | https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L929-L949 | train | Convert the field dict into a string segment of field key value pairs. |
bearyinnovative/bearychat.py | bearychat/rtm_message.py | RTMMessage.refer | def refer(self, text):
"""Refers current message and replys a new message
Args:
text(str): message content
Returns:
RTMMessage
"""
data = self.reply(text)
data['refer_key'] = self['key']
return data | python | def refer(self, text):
"""Refers current message and replys a new message
Args:
text(str): message content
Returns:
RTMMessage
"""
data = self.reply(text)
data['refer_key'] = self['key']
return data | [
"def",
"refer",
"(",
"self",
",",
"text",
")",
":",
"data",
"=",
"self",
".",
"reply",
"(",
"text",
")",
"data",
"[",
"'refer_key'",
"]",
"=",
"self",
"[",
"'key'",
"]",
"return",
"data"
] | Refers current message and replys a new message
Args:
text(str): message content
Returns:
RTMMessage | [
"Refers",
"current",
"message",
"and",
"replys",
"a",
"new",
"message"
] | 6c7af2d215c2ff7135bb5af66ca333d0ea1089fd | https://github.com/bearyinnovative/bearychat.py/blob/6c7af2d215c2ff7135bb5af66ca333d0ea1089fd/bearychat/rtm_message.py#L71-L82 | train | Refers current message and replies a new one |
damnit/pymite | pymite/mite.py | MiteAPI._get | def _get(self, path, **kwargs):
""" return a dict. """
# clean kwargs (filter None and empty string)
clean_kwargs = clean_dict(kwargs)
data = urllib.parse.urlencode(clean_kwargs)
if len(data) > 0:
api = self._api('%s.json?%s' % (path, data))
else:
... | python | def _get(self, path, **kwargs):
""" return a dict. """
# clean kwargs (filter None and empty string)
clean_kwargs = clean_dict(kwargs)
data = urllib.parse.urlencode(clean_kwargs)
if len(data) > 0:
api = self._api('%s.json?%s' % (path, data))
else:
... | [
"def",
"_get",
"(",
"self",
",",
"path",
",",
"*",
"*",
"kwargs",
")",
":",
"# clean kwargs (filter None and empty string)",
"clean_kwargs",
"=",
"clean_dict",
"(",
"kwargs",
")",
"data",
"=",
"urllib",
".",
"parse",
".",
"urlencode",
"(",
"clean_kwargs",
")",... | return a dict. | [
"return",
"a",
"dict",
"."
] | 1e9b9bf6aef790af2d8781f9f77c098c54ca0342 | https://github.com/damnit/pymite/blob/1e9b9bf6aef790af2d8781f9f77c098c54ca0342/pymite/mite.py#L58-L75 | train | Get a dict from a resource. |
damnit/pymite | pymite/mite.py | MiteAPI._post | def _post(self, path, **kwargs):
""" return a dict. """
# clean kwargs (filter None and empty string)
clean_kwargs = clean_dict(kwargs)
data = bytes(json.dumps(clean_kwargs), encoding='UTF-8')
# change content type on post
self._headers['Content-Type'] = 'application/jso... | python | def _post(self, path, **kwargs):
""" return a dict. """
# clean kwargs (filter None and empty string)
clean_kwargs = clean_dict(kwargs)
data = bytes(json.dumps(clean_kwargs), encoding='UTF-8')
# change content type on post
self._headers['Content-Type'] = 'application/jso... | [
"def",
"_post",
"(",
"self",
",",
"path",
",",
"*",
"*",
"kwargs",
")",
":",
"# clean kwargs (filter None and empty string)",
"clean_kwargs",
"=",
"clean_dict",
"(",
"kwargs",
")",
"data",
"=",
"bytes",
"(",
"json",
".",
"dumps",
"(",
"clean_kwargs",
")",
",... | return a dict. | [
"return",
"a",
"dict",
"."
] | 1e9b9bf6aef790af2d8781f9f77c098c54ca0342 | https://github.com/damnit/pymite/blob/1e9b9bf6aef790af2d8781f9f77c098c54ca0342/pymite/mite.py#L77-L94 | train | POST a dict. |
bitesofcode/projexui | projexui/widgets/xtimerlabel.py | XTimerLabel.increment | def increment(self):
"""
Increments the delta information and refreshes the interface.
"""
if self._starttime is not None:
self._delta = datetime.datetime.now() - self._starttime
else:
self._delta = datetime.timedelta()
self.refre... | python | def increment(self):
"""
Increments the delta information and refreshes the interface.
"""
if self._starttime is not None:
self._delta = datetime.datetime.now() - self._starttime
else:
self._delta = datetime.timedelta()
self.refre... | [
"def",
"increment",
"(",
"self",
")",
":",
"if",
"self",
".",
"_starttime",
"is",
"not",
"None",
":",
"self",
".",
"_delta",
"=",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
"-",
"self",
".",
"_starttime",
"else",
":",
"self",
".",
"_delta",
... | Increments the delta information and refreshes the interface. | [
"Increments",
"the",
"delta",
"information",
"and",
"refreshes",
"the",
"interface",
"."
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtimerlabel.py#L87-L97 | train | Increments the delta information and refreshes the interface. |
bitesofcode/projexui | projexui/widgets/xtimerlabel.py | XTimerLabel.refresh | def refresh(self):
"""
Updates the label display with the current timer information.
"""
delta = self.elapsed()
seconds = delta.seconds
limit = self.limit()
options = {}
options['hours'] = self.hours()
options['minutes'] = self.m... | python | def refresh(self):
"""
Updates the label display with the current timer information.
"""
delta = self.elapsed()
seconds = delta.seconds
limit = self.limit()
options = {}
options['hours'] = self.hours()
options['minutes'] = self.m... | [
"def",
"refresh",
"(",
"self",
")",
":",
"delta",
"=",
"self",
".",
"elapsed",
"(",
")",
"seconds",
"=",
"delta",
".",
"seconds",
"limit",
"=",
"self",
".",
"limit",
"(",
")",
"options",
"=",
"{",
"}",
"options",
"[",
"'hours'",
"]",
"=",
"self",
... | Updates the label display with the current timer information. | [
"Updates",
"the",
"label",
"display",
"with",
"the",
"current",
"timer",
"information",
"."
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtimerlabel.py#L132-L154 | train | Updates the label display with the current timer information. |
bitesofcode/projexui | projexui/widgets/xtimerlabel.py | XTimerLabel.reset | def reset(self):
"""
Stops the timer and resets its values to 0.
"""
self._elapsed = datetime.timedelta()
self._delta = datetime.timedelta()
self._starttime = datetime.datetime.now()
self.refresh() | python | def reset(self):
"""
Stops the timer and resets its values to 0.
"""
self._elapsed = datetime.timedelta()
self._delta = datetime.timedelta()
self._starttime = datetime.datetime.now()
self.refresh() | [
"def",
"reset",
"(",
"self",
")",
":",
"self",
".",
"_elapsed",
"=",
"datetime",
".",
"timedelta",
"(",
")",
"self",
".",
"_delta",
"=",
"datetime",
".",
"timedelta",
"(",
")",
"self",
".",
"_starttime",
"=",
"datetime",
".",
"datetime",
".",
"now",
... | Stops the timer and resets its values to 0. | [
"Stops",
"the",
"timer",
"and",
"resets",
"its",
"values",
"to",
"0",
"."
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtimerlabel.py#L157-L165 | train | Resets the timer to 0. |
bitesofcode/projexui | projexui/widgets/xtimerlabel.py | XTimerLabel.seconds | def seconds(self):
"""
Returns the elapsed number of seconds that this timer has been running.
:return <int>
"""
seconds = self.elapsed().seconds
if self.limit() and self.countdown():
seconds = (self.limit() - self.elapsed().seconds)
retu... | python | def seconds(self):
"""
Returns the elapsed number of seconds that this timer has been running.
:return <int>
"""
seconds = self.elapsed().seconds
if self.limit() and self.countdown():
seconds = (self.limit() - self.elapsed().seconds)
retu... | [
"def",
"seconds",
"(",
"self",
")",
":",
"seconds",
"=",
"self",
".",
"elapsed",
"(",
")",
".",
"seconds",
"if",
"self",
".",
"limit",
"(",
")",
"and",
"self",
".",
"countdown",
"(",
")",
":",
"seconds",
"=",
"(",
"self",
".",
"limit",
"(",
")",
... | Returns the elapsed number of seconds that this timer has been running.
:return <int> | [
"Returns",
"the",
"elapsed",
"number",
"of",
"seconds",
"that",
"this",
"timer",
"has",
"been",
"running",
".",
":",
"return",
"<int",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtimerlabel.py#L175-L184 | train | Returns the elapsed number of seconds that this timer has been running. |
bitesofcode/projexui | projexui/widgets/xtimerlabel.py | XTimerLabel.start | def start(self):
"""
Starts running the timer. If the timer is currently running, then
this method will do nothing.
:sa stop, reset
"""
if self._timer.isActive():
return
self._starttime = datetime.datetime.now()
self._timer.st... | python | def start(self):
"""
Starts running the timer. If the timer is currently running, then
this method will do nothing.
:sa stop, reset
"""
if self._timer.isActive():
return
self._starttime = datetime.datetime.now()
self._timer.st... | [
"def",
"start",
"(",
"self",
")",
":",
"if",
"self",
".",
"_timer",
".",
"isActive",
"(",
")",
":",
"return",
"self",
".",
"_starttime",
"=",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
"self",
".",
"_timer",
".",
"start",
"(",
")"
] | Starts running the timer. If the timer is currently running, then
this method will do nothing.
:sa stop, reset | [
"Starts",
"running",
"the",
"timer",
".",
"If",
"the",
"timer",
"is",
"currently",
"running",
"then",
"this",
"method",
"will",
"do",
"nothing",
".",
":",
"sa",
"stop",
"reset"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtimerlabel.py#L223-L234 | train | Starts running the timer. |
bitesofcode/projexui | projexui/widgets/xtimerlabel.py | XTimerLabel.stop | def stop(self):
"""
Stops the timer. If the timer is not currently running, then
this method will do nothing.
"""
if not self._timer.isActive():
return
self._elapsed += self._delta
self._timer.stop() | python | def stop(self):
"""
Stops the timer. If the timer is not currently running, then
this method will do nothing.
"""
if not self._timer.isActive():
return
self._elapsed += self._delta
self._timer.stop() | [
"def",
"stop",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_timer",
".",
"isActive",
"(",
")",
":",
"return",
"self",
".",
"_elapsed",
"+=",
"self",
".",
"_delta",
"self",
".",
"_timer",
".",
"stop",
"(",
")"
] | Stops the timer. If the timer is not currently running, then
this method will do nothing. | [
"Stops",
"the",
"timer",
".",
"If",
"the",
"timer",
"is",
"not",
"currently",
"running",
"then",
"this",
"method",
"will",
"do",
"nothing",
"."
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtimerlabel.py#L237-L246 | train | Stops the timer. |
bitesofcode/projexui | projexui/xthread.py | XThread.start | def start( self ):
"""
Starts the thread in its own event loop if the local and global thread
options are true, otherwise runs the thread logic in the main event
loop.
"""
if ( self.localThreadingEnabled() and self.globalThreadingEnabled() ):
super(XThread, se... | python | def start( self ):
"""
Starts the thread in its own event loop if the local and global thread
options are true, otherwise runs the thread logic in the main event
loop.
"""
if ( self.localThreadingEnabled() and self.globalThreadingEnabled() ):
super(XThread, se... | [
"def",
"start",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"localThreadingEnabled",
"(",
")",
"and",
"self",
".",
"globalThreadingEnabled",
"(",
")",
")",
":",
"super",
"(",
"XThread",
",",
"self",
")",
".",
"start",
"(",
")",
"else",
":",
"self"... | Starts the thread in its own event loop if the local and global thread
options are true, otherwise runs the thread logic in the main event
loop. | [
"Starts",
"the",
"thread",
"in",
"its",
"own",
"event",
"loop",
"if",
"the",
"local",
"and",
"global",
"thread",
"options",
"are",
"true",
"otherwise",
"runs",
"the",
"thread",
"logic",
"in",
"the",
"main",
"event",
"loop",
"."
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/xthread.py#L57-L67 | train | Starts the thread in its own event loop. |
bitesofcode/projexui | projexui/widgets/xorbtreewidget/xorbtreewidget.py | XOrbTreeWidgetDelegate.createEditor | def createEditor( self, parent, option, index ):
"""
Creates a new editor for the given index parented to the inputed widget.
:param parent | <QWidget>
option | <QStyleOption>
index | <QModelIndex>
:return <QWidg... | python | def createEditor( self, parent, option, index ):
"""
Creates a new editor for the given index parented to the inputed widget.
:param parent | <QWidget>
option | <QStyleOption>
index | <QModelIndex>
:return <QWidg... | [
"def",
"createEditor",
"(",
"self",
",",
"parent",
",",
"option",
",",
"index",
")",
":",
"# determine the editor to use for the inputed index based on the\r",
"# table column\r",
"item",
"=",
"self",
".",
"parent",
"(",
")",
".",
"itemFromIndex",
"(",
"index",
")",... | Creates a new editor for the given index parented to the inputed widget.
:param parent | <QWidget>
option | <QStyleOption>
index | <QModelIndex>
:return <QWidget> || None | [
"Creates",
"a",
"new",
"editor",
"for",
"the",
"given",
"index",
"parented",
"to",
"the",
"inputed",
"widget",
".",
":",
"param",
"parent",
"|",
"<QWidget",
">",
"option",
"|",
"<QStyleOption",
">",
"index",
"|",
"<QModelIndex",
">",
":",
"return",
"<QWidg... | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L191-L218 | train | Create a new editor for the given index parented to the inputed widget. |
bitesofcode/projexui | projexui/widgets/xorbtreewidget/xorbtreewidget.py | XBatchItem.startLoading | def startLoading(self):
"""
Starts loading this item for the batch.
"""
if super(XBatchItem, self).startLoading():
tree = self.treeWidget()
if not isinstance(tree, XOrbTreeWidget):
self.takeFromTree()
return
... | python | def startLoading(self):
"""
Starts loading this item for the batch.
"""
if super(XBatchItem, self).startLoading():
tree = self.treeWidget()
if not isinstance(tree, XOrbTreeWidget):
self.takeFromTree()
return
... | [
"def",
"startLoading",
"(",
"self",
")",
":",
"if",
"super",
"(",
"XBatchItem",
",",
"self",
")",
".",
"startLoading",
"(",
")",
":",
"tree",
"=",
"self",
".",
"treeWidget",
"(",
")",
"if",
"not",
"isinstance",
"(",
"tree",
",",
"XOrbTreeWidget",
")",
... | Starts loading this item for the batch. | [
"Starts",
"loading",
"this",
"item",
"for",
"the",
"batch",
"."
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L307-L318 | train | Starts loading this item for the batch. |
bitesofcode/projexui | projexui/widgets/xorbtreewidget/xorbtreewidget.py | XOrbTreeWidget._loadBatch | def _loadBatch(self, item, batch):
"""
Loads the batch of items for this tree based on the inputed batch item.
:param item | <XBatchItem>
batch | <orb.RecordSet>
"""
if self.isThreadEnabled() and batch.isThreadEnabled():
self... | python | def _loadBatch(self, item, batch):
"""
Loads the batch of items for this tree based on the inputed batch item.
:param item | <XBatchItem>
batch | <orb.RecordSet>
"""
if self.isThreadEnabled() and batch.isThreadEnabled():
self... | [
"def",
"_loadBatch",
"(",
"self",
",",
"item",
",",
"batch",
")",
":",
"if",
"self",
".",
"isThreadEnabled",
"(",
")",
"and",
"batch",
".",
"isThreadEnabled",
"(",
")",
":",
"self",
".",
"loadBatchRequested",
".",
"emit",
"(",
"batch",
")",
"self",
"."... | Loads the batch of items for this tree based on the inputed batch item.
:param item | <XBatchItem>
batch | <orb.RecordSet> | [
"Loads",
"the",
"batch",
"of",
"items",
"for",
"this",
"tree",
"based",
"on",
"the",
"inputed",
"batch",
"item",
".",
":",
"param",
"item",
"|",
"<XBatchItem",
">",
"batch",
"|",
"<orb",
".",
"RecordSet",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L471-L484 | train | Load the items for this tree based on the inputed batch item. |
bitesofcode/projexui | projexui/widgets/xorbtreewidget/xorbtreewidget.py | XOrbTreeWidget._loadColumns | def _loadColumns(self, record, columnName, value):
"""
Loads the column information for this tree widget for the given record.
:param record | <orb.Table>
columnName | <str>
value | <variant>
"""
value = un... | python | def _loadColumns(self, record, columnName, value):
"""
Loads the column information for this tree widget for the given record.
:param record | <orb.Table>
columnName | <str>
value | <variant>
"""
value = un... | [
"def",
"_loadColumns",
"(",
"self",
",",
"record",
",",
"columnName",
",",
"value",
")",
":",
"value",
"=",
"unwrapNone",
"(",
"value",
")",
"item",
"=",
"self",
".",
"findRecordItem",
"(",
"record",
")",
"if",
"item",
":",
"item",
".",
"updateColumnValu... | Loads the column information for this tree widget for the given record.
:param record | <orb.Table>
columnName | <str>
value | <variant> | [
"Loads",
"the",
"column",
"information",
"for",
"this",
"tree",
"widget",
"for",
"the",
"given",
"record",
".",
":",
"param",
"record",
"|",
"<orb",
".",
"Table",
">",
"columnName",
"|",
"<str",
">",
"value",
"|",
"<variant",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L491-L504 | train | Loads the column information for this tree widget for the given record. |
bitesofcode/projexui | projexui/widgets/xorbtreewidget/xorbtreewidget.py | XOrbTreeWidget._setCurrentRecord | def _setCurrentRecord(self, item, record):
"""
Sets the current record for this tree to the inputed record.
:param item | <QTreeWidgetItem>
record | <orb.Table>
"""
try:
is_record = item.record() == record
except:
... | python | def _setCurrentRecord(self, item, record):
"""
Sets the current record for this tree to the inputed record.
:param item | <QTreeWidgetItem>
record | <orb.Table>
"""
try:
is_record = item.record() == record
except:
... | [
"def",
"_setCurrentRecord",
"(",
"self",
",",
"item",
",",
"record",
")",
":",
"try",
":",
"is_record",
"=",
"item",
".",
"record",
"(",
")",
"==",
"record",
"except",
":",
"is_record",
"=",
"False",
"if",
"is_record",
":",
"self",
".",
"setCurrentItem",... | Sets the current record for this tree to the inputed record.
:param item | <QTreeWidgetItem>
record | <orb.Table> | [
"Sets",
"the",
"current",
"record",
"for",
"this",
"tree",
"to",
"the",
"inputed",
"record",
".",
":",
"param",
"item",
"|",
"<QTreeWidgetItem",
">",
"record",
"|",
"<orb",
".",
"Table",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L533-L553 | train | Sets the current record for this tree item to the inputed record. |
bitesofcode/projexui | projexui/widgets/xorbtreewidget/xorbtreewidget.py | XOrbTreeWidget._updateColumnValues | def _updateColumnValues(self, index, hidden):
"""
Updates the column values for the inputed column.
:param column | <int>
state | <bool>
"""
if hidden or not self.isVisible():
return
column = self.columnOf(... | python | def _updateColumnValues(self, index, hidden):
"""
Updates the column values for the inputed column.
:param column | <int>
state | <bool>
"""
if hidden or not self.isVisible():
return
column = self.columnOf(... | [
"def",
"_updateColumnValues",
"(",
"self",
",",
"index",
",",
"hidden",
")",
":",
"if",
"hidden",
"or",
"not",
"self",
".",
"isVisible",
"(",
")",
":",
"return",
"column",
"=",
"self",
".",
"columnOf",
"(",
"index",
")",
"if",
"not",
"column",
"in",
... | Updates the column values for the inputed column.
:param column | <int>
state | <bool> | [
"Updates",
"the",
"column",
"values",
"for",
"the",
"inputed",
"column",
".",
":",
"param",
"column",
"|",
"<int",
">",
"state",
"|",
"<bool",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L555-L570 | train | Updates the column values for the inputed column. |
bitesofcode/projexui | projexui/widgets/xorbtreewidget/xorbtreewidget.py | XOrbTreeWidget.addEntryText | def addEntryText(self):
"""
Returns the text to be used for the add new record item.
:return <str>
"""
if self.tableType():
name = self.tableType().schema().displayName().lower()
return 'add new {0}...'.format(name)
return 'ad... | python | def addEntryText(self):
"""
Returns the text to be used for the add new record item.
:return <str>
"""
if self.tableType():
name = self.tableType().schema().displayName().lower()
return 'add new {0}...'.format(name)
return 'ad... | [
"def",
"addEntryText",
"(",
"self",
")",
":",
"if",
"self",
".",
"tableType",
"(",
")",
":",
"name",
"=",
"self",
".",
"tableType",
"(",
")",
".",
"schema",
"(",
")",
".",
"displayName",
"(",
")",
".",
"lower",
"(",
")",
"return",
"'add new {0}...'",... | Returns the text to be used for the add new record item.
:return <str> | [
"Returns",
"the",
"text",
"to",
"be",
"used",
"for",
"the",
"add",
"new",
"record",
"item",
".",
":",
"return",
"<str",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L583-L592 | train | Returns the text to be used for the add new record item. |
bitesofcode/projexui | projexui/widgets/xorbtreewidget/xorbtreewidget.py | XOrbTreeWidget.assignOrderNames | def assignOrderNames(self):
"""
Assigns the order names for this tree based on the name of the
columns.
"""
try:
schema = self.tableType().schema()
except AttributeError:
return
for colname in self.columns():
... | python | def assignOrderNames(self):
"""
Assigns the order names for this tree based on the name of the
columns.
"""
try:
schema = self.tableType().schema()
except AttributeError:
return
for colname in self.columns():
... | [
"def",
"assignOrderNames",
"(",
"self",
")",
":",
"try",
":",
"schema",
"=",
"self",
".",
"tableType",
"(",
")",
".",
"schema",
"(",
")",
"except",
"AttributeError",
":",
"return",
"for",
"colname",
"in",
"self",
".",
"columns",
"(",
")",
":",
"column"... | Assigns the order names for this tree based on the name of the
columns. | [
"Assigns",
"the",
"order",
"names",
"for",
"this",
"tree",
"based",
"on",
"the",
"name",
"of",
"the",
"columns",
"."
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L601-L614 | train | Assigns the order names for this tree based on the name of the columns. |
bitesofcode/projexui | projexui/widgets/xorbtreewidget/xorbtreewidget.py | XOrbTreeWidget.autoExpand | def autoExpand(self, level=None):
"""
Returns whether or not to expand for the inputed level.
:param level | <int> || None
:return <bool>
"""
return self._autoExpand.get(level, self._autoExpand.get(None, False)) | python | def autoExpand(self, level=None):
"""
Returns whether or not to expand for the inputed level.
:param level | <int> || None
:return <bool>
"""
return self._autoExpand.get(level, self._autoExpand.get(None, False)) | [
"def",
"autoExpand",
"(",
"self",
",",
"level",
"=",
"None",
")",
":",
"return",
"self",
".",
"_autoExpand",
".",
"get",
"(",
"level",
",",
"self",
".",
"_autoExpand",
".",
"get",
"(",
"None",
",",
"False",
")",
")"
] | Returns whether or not to expand for the inputed level.
:param level | <int> || None
:return <bool> | [
"Returns",
"whether",
"or",
"not",
"to",
"expand",
"for",
"the",
"inputed",
"level",
".",
":",
"param",
"level",
"|",
"<int",
">",
"||",
"None",
":",
"return",
"<bool",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L616-L624 | train | Returns whether or not to expand for the inputed level. |
bitesofcode/projexui | projexui/widgets/xorbtreewidget/xorbtreewidget.py | XOrbTreeWidget.clearAll | def clearAll(self):
"""
Clears the tree and record information.
"""
# clear the tree information
self.clear()
# clear table information
self._tableTypeName = ''
self._tableType = None
# clear the records informati... | python | def clearAll(self):
"""
Clears the tree and record information.
"""
# clear the tree information
self.clear()
# clear table information
self._tableTypeName = ''
self._tableType = None
# clear the records informati... | [
"def",
"clearAll",
"(",
"self",
")",
":",
"# clear the tree information\r",
"self",
".",
"clear",
"(",
")",
"# clear table information\r",
"self",
".",
"_tableTypeName",
"=",
"''",
"self",
".",
"_tableType",
"=",
"None",
"# clear the records information\r",
"self",
... | Clears the tree and record information. | [
"Clears",
"the",
"tree",
"and",
"record",
"information",
"."
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L634-L657 | train | Clear the tree and record information. |
bitesofcode/projexui | projexui/widgets/xorbtreewidget/xorbtreewidget.py | XOrbTreeWidget.checkedRecords | def checkedRecords(self, column=0, parent=None, recurse=True):
"""
Returns a list of the records from this tree that have been checked
by the user.
:return [<orb.Table>, ..]
"""
output = []
for item in self.checkedItems(column, parent, recurs... | python | def checkedRecords(self, column=0, parent=None, recurse=True):
"""
Returns a list of the records from this tree that have been checked
by the user.
:return [<orb.Table>, ..]
"""
output = []
for item in self.checkedItems(column, parent, recurs... | [
"def",
"checkedRecords",
"(",
"self",
",",
"column",
"=",
"0",
",",
"parent",
"=",
"None",
",",
"recurse",
"=",
"True",
")",
":",
"output",
"=",
"[",
"]",
"for",
"item",
"in",
"self",
".",
"checkedItems",
"(",
"column",
",",
"parent",
",",
"recurse",... | Returns a list of the records from this tree that have been checked
by the user.
:return [<orb.Table>, ..] | [
"Returns",
"a",
"list",
"of",
"the",
"records",
"from",
"this",
"tree",
"that",
"have",
"been",
"checked",
"by",
"the",
"user",
".",
":",
"return",
"[",
"<orb",
".",
"Table",
">",
"..",
"]"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L668-L683 | train | Returns a list of the records that have been checked by the user. |
bitesofcode/projexui | projexui/widgets/xorbtreewidget/xorbtreewidget.py | XOrbTreeWidget.collectRecords | def collectRecords(self, parent=None):
"""
Collects all the record instances from the tree.
:return [<orb.Table>
"""
out = []
if not parent:
for i in range(self.topLevelItemCount()):
item = self.topLevelItem(i)
... | python | def collectRecords(self, parent=None):
"""
Collects all the record instances from the tree.
:return [<orb.Table>
"""
out = []
if not parent:
for i in range(self.topLevelItemCount()):
item = self.topLevelItem(i)
... | [
"def",
"collectRecords",
"(",
"self",
",",
"parent",
"=",
"None",
")",
":",
"out",
"=",
"[",
"]",
"if",
"not",
"parent",
":",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"topLevelItemCount",
"(",
")",
")",
":",
"item",
"=",
"self",
".",
"topLevelI... | Collects all the record instances from the tree.
:return [<orb.Table> | [
"Collects",
"all",
"the",
"record",
"instances",
"from",
"the",
"tree",
".",
":",
"return",
"[",
"<orb",
".",
"Table",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L693-L719 | train | Collect all the record instances from the tree. |
bitesofcode/projexui | projexui/widgets/xorbtreewidget/xorbtreewidget.py | XOrbTreeWidget.commit | def commit(self):
"""
Commits the changes for all the items in the tree.
:return <bool> | success
"""
remove_items = []
commit_items = []
# remove all the items
commit_state = XOrbRecordItem.State.Modified | XOrbRecordItem.S... | python | def commit(self):
"""
Commits the changes for all the items in the tree.
:return <bool> | success
"""
remove_items = []
commit_items = []
# remove all the items
commit_state = XOrbRecordItem.State.Modified | XOrbRecordItem.S... | [
"def",
"commit",
"(",
"self",
")",
":",
"remove_items",
"=",
"[",
"]",
"commit_items",
"=",
"[",
"]",
"# remove all the items\r",
"commit_state",
"=",
"XOrbRecordItem",
".",
"State",
".",
"Modified",
"|",
"XOrbRecordItem",
".",
"State",
".",
"New",
"remove_sta... | Commits the changes for all the items in the tree.
:return <bool> | success | [
"Commits",
"the",
"changes",
"for",
"all",
"the",
"items",
"in",
"the",
"tree",
".",
":",
"return",
"<bool",
">",
"|",
"success"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L756-L809 | train | Commits the changes for all the items in the tree. |
bitesofcode/projexui | projexui/widgets/xorbtreewidget/xorbtreewidget.py | XOrbTreeWidget.commitData | def commitData(self, widget):
"""
Commits the data from the widget to the model.
:param widget | <QWidget>
"""
self._editColumn = self.currentColumn()
self.itemChanged.connect(self._commitToSelected)
super(XOrbTreeWidget, self).commitData(wid... | python | def commitData(self, widget):
"""
Commits the data from the widget to the model.
:param widget | <QWidget>
"""
self._editColumn = self.currentColumn()
self.itemChanged.connect(self._commitToSelected)
super(XOrbTreeWidget, self).commitData(wid... | [
"def",
"commitData",
"(",
"self",
",",
"widget",
")",
":",
"self",
".",
"_editColumn",
"=",
"self",
".",
"currentColumn",
"(",
")",
"self",
".",
"itemChanged",
".",
"connect",
"(",
"self",
".",
"_commitToSelected",
")",
"super",
"(",
"XOrbTreeWidget",
",",... | Commits the data from the widget to the model.
:param widget | <QWidget> | [
"Commits",
"the",
"data",
"from",
"the",
"widget",
"to",
"the",
"model",
".",
":",
"param",
"widget",
"|",
"<QWidget",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L811-L821 | train | Commits the data from the widget to the model. |
bitesofcode/projexui | projexui/widgets/xorbtreewidget/xorbtreewidget.py | XOrbTreeWidget.contextMenuEvent | def contextMenuEvent(self, event):
"""
Handles the default menu options for the orb widget.
:param event | <QContextMenuEvent>
"""
if self.contextMenuPolicy() == Qt.DefaultContextMenu:
self.showMenu(event.pos())
else:
super(X... | python | def contextMenuEvent(self, event):
"""
Handles the default menu options for the orb widget.
:param event | <QContextMenuEvent>
"""
if self.contextMenuPolicy() == Qt.DefaultContextMenu:
self.showMenu(event.pos())
else:
super(X... | [
"def",
"contextMenuEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"self",
".",
"contextMenuPolicy",
"(",
")",
"==",
"Qt",
".",
"DefaultContextMenu",
":",
"self",
".",
"showMenu",
"(",
"event",
".",
"pos",
"(",
")",
")",
"else",
":",
"super",
"(",
... | Handles the default menu options for the orb widget.
:param event | <QContextMenuEvent> | [
"Handles",
"the",
"default",
"menu",
"options",
"for",
"the",
"orb",
"widget",
".",
":",
"param",
"event",
"|",
"<QContextMenuEvent",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L823-L832 | train | Handles the default context menu options for the orb tree widget. |
bitesofcode/projexui | projexui/widgets/xorbtreewidget/xorbtreewidget.py | XOrbTreeWidget.createRecordItem | def createRecordItem(self, record, parent=None):
"""
Creates the record item instance for the given record.
:param parent | <QTreeWidgetItem> || <QTreeWidget>
record | <orb.Table>
:return <QTreeWidgetItem>
"""
... | python | def createRecordItem(self, record, parent=None):
"""
Creates the record item instance for the given record.
:param parent | <QTreeWidgetItem> || <QTreeWidget>
record | <orb.Table>
:return <QTreeWidgetItem>
"""
... | [
"def",
"createRecordItem",
"(",
"self",
",",
"record",
",",
"parent",
"=",
"None",
")",
":",
"if",
"parent",
"is",
"None",
":",
"parent",
"=",
"self",
"return",
"self",
".",
"recordItemClass",
"(",
"record",
")",
"(",
"parent",
",",
"record",
")"
] | Creates the record item instance for the given record.
:param parent | <QTreeWidgetItem> || <QTreeWidget>
record | <orb.Table>
:return <QTreeWidgetItem> | [
"Creates",
"the",
"record",
"item",
"instance",
"for",
"the",
"given",
"record",
".",
":",
"param",
"parent",
"|",
"<QTreeWidgetItem",
">",
"||",
"<QTreeWidget",
">",
"record",
"|",
"<orb",
".",
"Table",
">",
":",
"return",
"<QTreeWidgetItem",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L834-L846 | train | Creates a record item instance for the given record. |
bitesofcode/projexui | projexui/widgets/xorbtreewidget/xorbtreewidget.py | XOrbTreeWidget.createRecordItems | def createRecordItems(self, records, parent=None):
"""
Creates the record item instance for the given record.
:param records | [<orb.Table>, ..]
parent | <QTreeWidgetItem> || <QTreeWidget>
:return <QTreeWidgetItem>
"... | python | def createRecordItems(self, records, parent=None):
"""
Creates the record item instance for the given record.
:param records | [<orb.Table>, ..]
parent | <QTreeWidgetItem> || <QTreeWidget>
:return <QTreeWidgetItem>
"... | [
"def",
"createRecordItems",
"(",
"self",
",",
"records",
",",
"parent",
"=",
"None",
")",
":",
"if",
"parent",
"is",
"None",
":",
"parent",
"=",
"self",
"blocked",
"=",
"self",
".",
"signalsBlocked",
"(",
")",
"self",
".",
"blockSignals",
"(",
"True",
... | Creates the record item instance for the given record.
:param records | [<orb.Table>, ..]
parent | <QTreeWidgetItem> || <QTreeWidget>
:return <QTreeWidgetItem> | [
"Creates",
"the",
"record",
"item",
"instance",
"for",
"the",
"given",
"record",
".",
":",
"param",
"records",
"|",
"[",
"<orb",
".",
"Table",
">",
"..",
"]",
"parent",
"|",
"<QTreeWidgetItem",
">",
"||",
"<QTreeWidget",
">",
":",
"return",
"<QTreeWidgetIt... | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L848-L868 | train | Creates the record items for the given records. |
bitesofcode/projexui | projexui/widgets/xorbtreewidget/xorbtreewidget.py | XOrbTreeWidget.createGroupItem | def createGroupItem(self, grp, records, nextLevels=None, parent=None):
"""
Creates the grouping item instance for the group with the given record
information.
:param grp | <variant>
record | [<orb.Table>, ..] || <dict>
... | python | def createGroupItem(self, grp, records, nextLevels=None, parent=None):
"""
Creates the grouping item instance for the group with the given record
information.
:param grp | <variant>
record | [<orb.Table>, ..] || <dict>
... | [
"def",
"createGroupItem",
"(",
"self",
",",
"grp",
",",
"records",
",",
"nextLevels",
"=",
"None",
",",
"parent",
"=",
"None",
")",
":",
"if",
"parent",
"is",
"None",
":",
"parent",
"=",
"self",
"item",
"=",
"self",
".",
"recordGroupClass",
"(",
"type"... | Creates the grouping item instance for the group with the given record
information.
:param grp | <variant>
record | [<orb.Table>, ..] || <dict>
parent | <QTreeWidgetItem> || <QTreeWidget>
:return <QTreeWi... | [
"Creates",
"the",
"grouping",
"item",
"instance",
"for",
"the",
"group",
"with",
"the",
"given",
"record",
"information",
".",
":",
"param",
"grp",
"|",
"<variant",
">",
"record",
"|",
"[",
"<orb",
".",
"Table",
">",
"..",
"]",
"||",
"<dict",
">",
"par... | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L870-L905 | train | Creates a new group item instance for the given group and records. |
bitesofcode/projexui | projexui/widgets/xorbtreewidget/xorbtreewidget.py | XOrbTreeWidget.currentRecord | def currentRecord(self):
"""
Returns the current record from the tree view.
:return <orb.Table> || None
"""
item = self.currentItem()
if isinstance(item, XOrbRecordItem):
return item.record()
return None | python | def currentRecord(self):
"""
Returns the current record from the tree view.
:return <orb.Table> || None
"""
item = self.currentItem()
if isinstance(item, XOrbRecordItem):
return item.record()
return None | [
"def",
"currentRecord",
"(",
"self",
")",
":",
"item",
"=",
"self",
".",
"currentItem",
"(",
")",
"if",
"isinstance",
"(",
"item",
",",
"XOrbRecordItem",
")",
":",
"return",
"item",
".",
"record",
"(",
")",
"return",
"None"
] | Returns the current record from the tree view.
:return <orb.Table> || None | [
"Returns",
"the",
"current",
"record",
"from",
"the",
"tree",
"view",
".",
":",
"return",
"<orb",
".",
"Table",
">",
"||",
"None"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L907-L916 | train | Returns the current record from the tree view. |
bitesofcode/projexui | projexui/widgets/xorbtreewidget/xorbtreewidget.py | XOrbTreeWidget.database | def database(self):
"""
Returns the database associated with this tree widget.
:return <orb.Database> || None
"""
if self._database:
return self._database
if self._recordSet is not None:
return self._recordSet.database()
... | python | def database(self):
"""
Returns the database associated with this tree widget.
:return <orb.Database> || None
"""
if self._database:
return self._database
if self._recordSet is not None:
return self._recordSet.database()
... | [
"def",
"database",
"(",
"self",
")",
":",
"if",
"self",
".",
"_database",
":",
"return",
"self",
".",
"_database",
"if",
"self",
".",
"_recordSet",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_recordSet",
".",
"database",
"(",
")",
"else",
":",
... | Returns the database associated with this tree widget.
:return <orb.Database> || None | [
"Returns",
"the",
"database",
"associated",
"with",
"this",
"tree",
"widget",
".",
":",
"return",
"<orb",
".",
"Database",
">",
"||",
"None"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L932-L943 | train | Returns the database associated with this tree widget. |
bitesofcode/projexui | projexui/widgets/xorbtreewidget/xorbtreewidget.py | XOrbTreeWidget.dragEnterEvent | def dragEnterEvent(self, event):
"""
Listens for query's being dragged and dropped onto this tree.
:param event | <QDragEnterEvent>
"""
data = event.mimeData()
if data.hasFormat('application/x-orb-table') and \
data.hasFormat('application/... | python | def dragEnterEvent(self, event):
"""
Listens for query's being dragged and dropped onto this tree.
:param event | <QDragEnterEvent>
"""
data = event.mimeData()
if data.hasFormat('application/x-orb-table') and \
data.hasFormat('application/... | [
"def",
"dragEnterEvent",
"(",
"self",
",",
"event",
")",
":",
"data",
"=",
"event",
".",
"mimeData",
"(",
")",
"if",
"data",
".",
"hasFormat",
"(",
"'application/x-orb-table'",
")",
"and",
"data",
".",
"hasFormat",
"(",
"'application/x-orb-query'",
")",
":",... | Listens for query's being dragged and dropped onto this tree.
:param event | <QDragEnterEvent> | [
"Listens",
"for",
"query",
"s",
"being",
"dragged",
"and",
"dropped",
"onto",
"this",
"tree",
".",
":",
"param",
"event",
"|",
"<QDragEnterEvent",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L952-L966 | train | Listens for query s being dragged and dropped onto this tree. |
bitesofcode/projexui | projexui/widgets/xorbtreewidget/xorbtreewidget.py | XOrbTreeWidget.dropEvent | def dropEvent(self, event):
"""
Listens for query's being dragged and dropped onto this tree.
:param event | <QDropEvent>
"""
# overload the current filtering options
data = event.mimeData()
if data.hasFormat('application/x-orb-table') and \
... | python | def dropEvent(self, event):
"""
Listens for query's being dragged and dropped onto this tree.
:param event | <QDropEvent>
"""
# overload the current filtering options
data = event.mimeData()
if data.hasFormat('application/x-orb-table') and \
... | [
"def",
"dropEvent",
"(",
"self",
",",
"event",
")",
":",
"# overload the current filtering options\r",
"data",
"=",
"event",
".",
"mimeData",
"(",
")",
"if",
"data",
".",
"hasFormat",
"(",
"'application/x-orb-table'",
")",
"and",
"data",
".",
"hasFormat",
"(",
... | Listens for query's being dragged and dropped onto this tree.
:param event | <QDropEvent> | [
"Listens",
"for",
"query",
"s",
"being",
"dragged",
"and",
"dropped",
"onto",
"this",
"tree",
".",
":",
"param",
"event",
"|",
"<QDropEvent",
">"
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L984-L1001 | train | Override this method to filter out the related objects. |
bitesofcode/projexui | projexui/widgets/xorbtreewidget/xorbtreewidget.py | XOrbTreeWidget.groupByHeaderIndex | def groupByHeaderIndex(self):
"""
Assigns the grouping to the current header index.
"""
index = self.headerMenuColumn()
columnTitle = self.columnOf(index)
tableType = self.tableType()
if not tableType:
return
column... | python | def groupByHeaderIndex(self):
"""
Assigns the grouping to the current header index.
"""
index = self.headerMenuColumn()
columnTitle = self.columnOf(index)
tableType = self.tableType()
if not tableType:
return
column... | [
"def",
"groupByHeaderIndex",
"(",
"self",
")",
":",
"index",
"=",
"self",
".",
"headerMenuColumn",
"(",
")",
"columnTitle",
"=",
"self",
".",
"columnOf",
"(",
"index",
")",
"tableType",
"=",
"self",
".",
"tableType",
"(",
")",
"if",
"not",
"tableType",
"... | Assigns the grouping to the current header index. | [
"Assigns",
"the",
"grouping",
"to",
"the",
"current",
"header",
"index",
"."
] | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L1012-L1028 | train | Assigns the grouping to the current header index. Returns True if the grouping is active False otherwise. |
bitesofcode/projexui | projexui/widgets/xorbtreewidget/xorbtreewidget.py | XOrbTreeWidget.hierarchyLookup | def hierarchyLookup(self, record):
"""
Looks up additional hierarchy information for the inputed record.
:param record | <orb.Table>
:return (<subclass of orb.Table> || None, <str> column)
"""
def _get_lookup(cls):
if cls in... | python | def hierarchyLookup(self, record):
"""
Looks up additional hierarchy information for the inputed record.
:param record | <orb.Table>
:return (<subclass of orb.Table> || None, <str> column)
"""
def _get_lookup(cls):
if cls in... | [
"def",
"hierarchyLookup",
"(",
"self",
",",
"record",
")",
":",
"def",
"_get_lookup",
"(",
"cls",
")",
":",
"if",
"cls",
"in",
"self",
".",
"_hierarchyLookup",
":",
"return",
"self",
".",
"_hierarchyLookup",
"[",
"cls",
"]",
"for",
"base",
"in",
"cls",
... | Looks up additional hierarchy information for the inputed record.
:param record | <orb.Table>
:return (<subclass of orb.Table> || None, <str> column) | [
"Looks",
"up",
"additional",
"hierarchy",
"information",
"for",
"the",
"inputed",
"record",
".",
":",
"param",
"record",
"|",
"<orb",
".",
"Table",
">",
":",
"return",
"(",
"<subclass",
"of",
"orb",
".",
"Table",
">",
"||",
"None",
"<str",
">",
"column",... | f18a73bec84df90b034ca69b9deea118dbedfc4d | https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbtreewidget.py#L1030-L1057 | train | Returns the first hierarchy entry for the inputed record. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.