id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
17,700 | bids-standard/pybids | bids/analysis/hrf.py | _hrf_kernel | def _hrf_kernel(hrf_model, tr, oversampling=50, fir_delays=None):
""" Given the specification of the hemodynamic model and time parameters,
return the list of matching kernels
Parameters
----------
hrf_model : string or None,
identifier of the hrf model
tr : float
the repetitio... | python | def _hrf_kernel(hrf_model, tr, oversampling=50, fir_delays=None):
""" Given the specification of the hemodynamic model and time parameters,
return the list of matching kernels
Parameters
----------
hrf_model : string or None,
identifier of the hrf model
tr : float
the repetitio... | [
"def",
"_hrf_kernel",
"(",
"hrf_model",
",",
"tr",
",",
"oversampling",
"=",
"50",
",",
"fir_delays",
"=",
"None",
")",
":",
"acceptable_hrfs",
"=",
"[",
"'spm'",
",",
"'spm + derivative'",
",",
"'spm + derivative + dispersion'",
",",
"'fir'",
",",
"'glover'",
... | Given the specification of the hemodynamic model and time parameters,
return the list of matching kernels
Parameters
----------
hrf_model : string or None,
identifier of the hrf model
tr : float
the repetition time in seconds
oversampling : int, optional
temporal overs... | [
"Given",
"the",
"specification",
"of",
"the",
"hemodynamic",
"model",
"and",
"time",
"parameters",
"return",
"the",
"list",
"of",
"matching",
"kernels"
] | 30d924ce770622bda0e390d613a8da42a2a20c32 | https://github.com/bids-standard/pybids/blob/30d924ce770622bda0e390d613a8da42a2a20c32/bids/analysis/hrf.py#L378-L432 |
17,701 | bids-standard/pybids | bids/analysis/hrf.py | compute_regressor | def compute_regressor(exp_condition, hrf_model, frame_times, con_id='cond',
oversampling=50, fir_delays=None, min_onset=-24):
""" This is the main function to convolve regressors with hrf model
Parameters
----------
exp_condition : array-like of shape (3, n_events)
yields ... | python | def compute_regressor(exp_condition, hrf_model, frame_times, con_id='cond',
oversampling=50, fir_delays=None, min_onset=-24):
""" This is the main function to convolve regressors with hrf model
Parameters
----------
exp_condition : array-like of shape (3, n_events)
yields ... | [
"def",
"compute_regressor",
"(",
"exp_condition",
",",
"hrf_model",
",",
"frame_times",
",",
"con_id",
"=",
"'cond'",
",",
"oversampling",
"=",
"50",
",",
"fir_delays",
"=",
"None",
",",
"min_onset",
"=",
"-",
"24",
")",
":",
"# this is the average tr in this se... | This is the main function to convolve regressors with hrf model
Parameters
----------
exp_condition : array-like of shape (3, n_events)
yields description of events for this condition as a
(onsets, durations, amplitudes) triplet
hrf_model : {'spm', 'spm + derivative', 'spm + derivative... | [
"This",
"is",
"the",
"main",
"function",
"to",
"convolve",
"regressors",
"with",
"hrf",
"model"
] | 30d924ce770622bda0e390d613a8da42a2a20c32 | https://github.com/bids-standard/pybids/blob/30d924ce770622bda0e390d613a8da42a2a20c32/bids/analysis/hrf.py#L435-L516 |
17,702 | bids-standard/pybids | bids/utils.py | matches_entities | def matches_entities(obj, entities, strict=False):
''' Checks whether an object's entities match the input. '''
if strict and set(obj.entities.keys()) != set(entities.keys()):
return False
comm_ents = list(set(obj.entities.keys()) & set(entities.keys()))
for k in comm_ents:
current = ob... | python | def matches_entities(obj, entities, strict=False):
''' Checks whether an object's entities match the input. '''
if strict and set(obj.entities.keys()) != set(entities.keys()):
return False
comm_ents = list(set(obj.entities.keys()) & set(entities.keys()))
for k in comm_ents:
current = ob... | [
"def",
"matches_entities",
"(",
"obj",
",",
"entities",
",",
"strict",
"=",
"False",
")",
":",
"if",
"strict",
"and",
"set",
"(",
"obj",
".",
"entities",
".",
"keys",
"(",
")",
")",
"!=",
"set",
"(",
"entities",
".",
"keys",
"(",
")",
")",
":",
"... | Checks whether an object's entities match the input. | [
"Checks",
"whether",
"an",
"object",
"s",
"entities",
"match",
"the",
"input",
"."
] | 30d924ce770622bda0e390d613a8da42a2a20c32 | https://github.com/bids-standard/pybids/blob/30d924ce770622bda0e390d613a8da42a2a20c32/bids/utils.py#L12-L26 |
17,703 | bids-standard/pybids | bids/utils.py | check_path_matches_patterns | def check_path_matches_patterns(path, patterns):
''' Check if the path matches at least one of the provided patterns. '''
path = os.path.abspath(path)
for patt in patterns:
if isinstance(patt, six.string_types):
if path == patt:
return True
elif patt.search(path):... | python | def check_path_matches_patterns(path, patterns):
''' Check if the path matches at least one of the provided patterns. '''
path = os.path.abspath(path)
for patt in patterns:
if isinstance(patt, six.string_types):
if path == patt:
return True
elif patt.search(path):... | [
"def",
"check_path_matches_patterns",
"(",
"path",
",",
"patterns",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"path",
")",
"for",
"patt",
"in",
"patterns",
":",
"if",
"isinstance",
"(",
"patt",
",",
"six",
".",
"string_types",
")",
... | Check if the path matches at least one of the provided patterns. | [
"Check",
"if",
"the",
"path",
"matches",
"at",
"least",
"one",
"of",
"the",
"provided",
"patterns",
"."
] | 30d924ce770622bda0e390d613a8da42a2a20c32 | https://github.com/bids-standard/pybids/blob/30d924ce770622bda0e390d613a8da42a2a20c32/bids/utils.py#L91-L100 |
17,704 | bids-standard/pybids | bids/layout/core.py | Entity.count | def count(self, files=False):
""" Returns a count of unique values or files.
Args:
files (bool): When True, counts all files mapped to the Entity.
When False, counts all unique values.
Returns: an int.
"""
return len(self.files) if files else len(self... | python | def count(self, files=False):
""" Returns a count of unique values or files.
Args:
files (bool): When True, counts all files mapped to the Entity.
When False, counts all unique values.
Returns: an int.
"""
return len(self.files) if files else len(self... | [
"def",
"count",
"(",
"self",
",",
"files",
"=",
"False",
")",
":",
"return",
"len",
"(",
"self",
".",
"files",
")",
"if",
"files",
"else",
"len",
"(",
"self",
".",
"unique",
"(",
")",
")"
] | Returns a count of unique values or files.
Args:
files (bool): When True, counts all files mapped to the Entity.
When False, counts all unique values.
Returns: an int. | [
"Returns",
"a",
"count",
"of",
"unique",
"values",
"or",
"files",
"."
] | 30d924ce770622bda0e390d613a8da42a2a20c32 | https://github.com/bids-standard/pybids/blob/30d924ce770622bda0e390d613a8da42a2a20c32/bids/layout/core.py#L147-L155 |
17,705 | bids-standard/pybids | bids/reports/parsing.py | general_acquisition_info | def general_acquisition_info(metadata):
"""
General sentence on data acquisition. Should be first sentence in MRI data
acquisition section.
Parameters
----------
metadata : :obj:`dict`
The metadata for the dataset.
Returns
-------
out_str : :obj:`str`
Output string ... | python | def general_acquisition_info(metadata):
"""
General sentence on data acquisition. Should be first sentence in MRI data
acquisition section.
Parameters
----------
metadata : :obj:`dict`
The metadata for the dataset.
Returns
-------
out_str : :obj:`str`
Output string ... | [
"def",
"general_acquisition_info",
"(",
"metadata",
")",
":",
"out_str",
"=",
"(",
"'MR data were acquired using a {tesla}-Tesla {manu} {model} '",
"'MRI scanner.'",
")",
"out_str",
"=",
"out_str",
".",
"format",
"(",
"tesla",
"=",
"metadata",
".",
"get",
"(",
"'Magne... | General sentence on data acquisition. Should be first sentence in MRI data
acquisition section.
Parameters
----------
metadata : :obj:`dict`
The metadata for the dataset.
Returns
-------
out_str : :obj:`str`
Output string with scanner information. | [
"General",
"sentence",
"on",
"data",
"acquisition",
".",
"Should",
"be",
"first",
"sentence",
"in",
"MRI",
"data",
"acquisition",
"section",
"."
] | 30d924ce770622bda0e390d613a8da42a2a20c32 | https://github.com/bids-standard/pybids/blob/30d924ce770622bda0e390d613a8da42a2a20c32/bids/reports/parsing.py#L22-L44 |
17,706 | bids-standard/pybids | bids/reports/parsing.py | parse_niftis | def parse_niftis(layout, niftis, subj, config, **kwargs):
"""
Loop through niftis in a BIDSLayout and generate the appropriate description
type for each scan. Compile all of the descriptions into a list.
Parameters
----------
layout : :obj:`bids.layout.BIDSLayout`
Layout object for a BI... | python | def parse_niftis(layout, niftis, subj, config, **kwargs):
"""
Loop through niftis in a BIDSLayout and generate the appropriate description
type for each scan. Compile all of the descriptions into a list.
Parameters
----------
layout : :obj:`bids.layout.BIDSLayout`
Layout object for a BI... | [
"def",
"parse_niftis",
"(",
"layout",
",",
"niftis",
",",
"subj",
",",
"config",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"kwargs",
".",
"items",
"(",
")",
"if",
"v",
"is",
"not",
"None",... | Loop through niftis in a BIDSLayout and generate the appropriate description
type for each scan. Compile all of the descriptions into a list.
Parameters
----------
layout : :obj:`bids.layout.BIDSLayout`
Layout object for a BIDS dataset.
niftis : :obj:`list` or :obj:`grabbit.core.File`
... | [
"Loop",
"through",
"niftis",
"in",
"a",
"BIDSLayout",
"and",
"generate",
"the",
"appropriate",
"description",
"type",
"for",
"each",
"scan",
".",
"Compile",
"all",
"of",
"the",
"descriptions",
"into",
"a",
"list",
"."
] | 30d924ce770622bda0e390d613a8da42a2a20c32 | https://github.com/bids-standard/pybids/blob/30d924ce770622bda0e390d613a8da42a2a20c32/bids/reports/parsing.py#L407-L479 |
17,707 | Microsoft/ApplicationInsights-Python | applicationinsights/TelemetryClient.py | TelemetryClient.track_exception | def track_exception(self, type=None, value=None, tb=None, properties=None, measurements=None):
""" Send information about a single exception that occurred in the application.
Args:
type (Type). the type of the exception that was thrown.\n
value (:class:`Exception`). the exceptio... | python | def track_exception(self, type=None, value=None, tb=None, properties=None, measurements=None):
""" Send information about a single exception that occurred in the application.
Args:
type (Type). the type of the exception that was thrown.\n
value (:class:`Exception`). the exceptio... | [
"def",
"track_exception",
"(",
"self",
",",
"type",
"=",
"None",
",",
"value",
"=",
"None",
",",
"tb",
"=",
"None",
",",
"properties",
"=",
"None",
",",
"measurements",
"=",
"None",
")",
":",
"if",
"not",
"type",
"or",
"not",
"value",
"or",
"not",
... | Send information about a single exception that occurred in the application.
Args:
type (Type). the type of the exception that was thrown.\n
value (:class:`Exception`). the exception that the client wants to send.\n
tb (:class:`Traceback`). the traceback information as return... | [
"Send",
"information",
"about",
"a",
"single",
"exception",
"that",
"occurred",
"in",
"the",
"application",
"."
] | 8452ab7126f9bb6964637d4aa1258c2af17563d6 | https://github.com/Microsoft/ApplicationInsights-Python/blob/8452ab7126f9bb6964637d4aa1258c2af17563d6/applicationinsights/TelemetryClient.py#L82-L126 |
17,708 | Microsoft/ApplicationInsights-Python | applicationinsights/TelemetryClient.py | TelemetryClient.track_event | def track_event(self, name, properties=None, measurements=None):
""" Send information about a single event that has occurred in the context of the application.
Args:
name (str). the data to associate to this event.\n
properties (dict). the set of custom properties the client wan... | python | def track_event(self, name, properties=None, measurements=None):
""" Send information about a single event that has occurred in the context of the application.
Args:
name (str). the data to associate to this event.\n
properties (dict). the set of custom properties the client wan... | [
"def",
"track_event",
"(",
"self",
",",
"name",
",",
"properties",
"=",
"None",
",",
"measurements",
"=",
"None",
")",
":",
"data",
"=",
"channel",
".",
"contracts",
".",
"EventData",
"(",
")",
"data",
".",
"name",
"=",
"name",
"or",
"NULL_CONSTANT_STRIN... | Send information about a single event that has occurred in the context of the application.
Args:
name (str). the data to associate to this event.\n
properties (dict). the set of custom properties the client wants attached to this data item. (defaults to: None)\n
measurements... | [
"Send",
"information",
"about",
"a",
"single",
"event",
"that",
"has",
"occurred",
"in",
"the",
"context",
"of",
"the",
"application",
"."
] | 8452ab7126f9bb6964637d4aa1258c2af17563d6 | https://github.com/Microsoft/ApplicationInsights-Python/blob/8452ab7126f9bb6964637d4aa1258c2af17563d6/applicationinsights/TelemetryClient.py#L128-L143 |
17,709 | Microsoft/ApplicationInsights-Python | applicationinsights/TelemetryClient.py | TelemetryClient.track_metric | def track_metric(self, name, value, type=None, count=None, min=None, max=None, std_dev=None, properties=None):
"""Send information about a single metric data point that was captured for the application.
Args:
name (str). the name of the metric that was captured.\n
value (float).... | python | def track_metric(self, name, value, type=None, count=None, min=None, max=None, std_dev=None, properties=None):
"""Send information about a single metric data point that was captured for the application.
Args:
name (str). the name of the metric that was captured.\n
value (float).... | [
"def",
"track_metric",
"(",
"self",
",",
"name",
",",
"value",
",",
"type",
"=",
"None",
",",
"count",
"=",
"None",
",",
"min",
"=",
"None",
",",
"max",
"=",
"None",
",",
"std_dev",
"=",
"None",
",",
"properties",
"=",
"None",
")",
":",
"dataPoint"... | Send information about a single metric data point that was captured for the application.
Args:
name (str). the name of the metric that was captured.\n
value (float). the value of the metric that was captured.\n
type (:class:`channel.contracts.DataPointType`). the type of the... | [
"Send",
"information",
"about",
"a",
"single",
"metric",
"data",
"point",
"that",
"was",
"captured",
"for",
"the",
"application",
"."
] | 8452ab7126f9bb6964637d4aa1258c2af17563d6 | https://github.com/Microsoft/ApplicationInsights-Python/blob/8452ab7126f9bb6964637d4aa1258c2af17563d6/applicationinsights/TelemetryClient.py#L145-L172 |
17,710 | Microsoft/ApplicationInsights-Python | applicationinsights/TelemetryClient.py | TelemetryClient.track_trace | def track_trace(self, name, properties=None, severity=None):
"""Sends a single trace statement.
Args:
name (str). the trace statement.\n
properties (dict). the set of custom properties the client wants attached to this data item. (defaults to: None)\n
severity (str).... | python | def track_trace(self, name, properties=None, severity=None):
"""Sends a single trace statement.
Args:
name (str). the trace statement.\n
properties (dict). the set of custom properties the client wants attached to this data item. (defaults to: None)\n
severity (str).... | [
"def",
"track_trace",
"(",
"self",
",",
"name",
",",
"properties",
"=",
"None",
",",
"severity",
"=",
"None",
")",
":",
"data",
"=",
"channel",
".",
"contracts",
".",
"MessageData",
"(",
")",
"data",
".",
"message",
"=",
"name",
"or",
"NULL_CONSTANT_STRI... | Sends a single trace statement.
Args:
name (str). the trace statement.\n
properties (dict). the set of custom properties the client wants attached to this data item. (defaults to: None)\n
severity (str). the severity level of this trace, one of DEBUG, INFO, WARNING, ERROR, C... | [
"Sends",
"a",
"single",
"trace",
"statement",
"."
] | 8452ab7126f9bb6964637d4aa1258c2af17563d6 | https://github.com/Microsoft/ApplicationInsights-Python/blob/8452ab7126f9bb6964637d4aa1258c2af17563d6/applicationinsights/TelemetryClient.py#L175-L190 |
17,711 | Microsoft/ApplicationInsights-Python | applicationinsights/TelemetryClient.py | TelemetryClient.track_request | def track_request(self, name, url, success, start_time=None, duration=None, response_code=None, http_method=None, properties=None, measurements=None, request_id=None):
"""Sends a single request that was captured for the application.
Args:
name (str). the name for this request. All requests ... | python | def track_request(self, name, url, success, start_time=None, duration=None, response_code=None, http_method=None, properties=None, measurements=None, request_id=None):
"""Sends a single request that was captured for the application.
Args:
name (str). the name for this request. All requests ... | [
"def",
"track_request",
"(",
"self",
",",
"name",
",",
"url",
",",
"success",
",",
"start_time",
"=",
"None",
",",
"duration",
"=",
"None",
",",
"response_code",
"=",
"None",
",",
"http_method",
"=",
"None",
",",
"properties",
"=",
"None",
",",
"measurem... | Sends a single request that was captured for the application.
Args:
name (str). the name for this request. All requests with the same name will be grouped together.\n
url (str). the actual URL for this request (to show in individual request instances).\n
success (bool). true... | [
"Sends",
"a",
"single",
"request",
"that",
"was",
"captured",
"for",
"the",
"application",
"."
] | 8452ab7126f9bb6964637d4aa1258c2af17563d6 | https://github.com/Microsoft/ApplicationInsights-Python/blob/8452ab7126f9bb6964637d4aa1258c2af17563d6/applicationinsights/TelemetryClient.py#L193-L222 |
17,712 | Microsoft/ApplicationInsights-Python | applicationinsights/TelemetryClient.py | TelemetryClient.track_dependency | def track_dependency(self, name, data, type=None, target=None, duration=None, success=None, result_code=None, properties=None, measurements=None, dependency_id=None):
"""Sends a single dependency telemetry that was captured for the application.
Args:
name (str). the name of the command init... | python | def track_dependency(self, name, data, type=None, target=None, duration=None, success=None, result_code=None, properties=None, measurements=None, dependency_id=None):
"""Sends a single dependency telemetry that was captured for the application.
Args:
name (str). the name of the command init... | [
"def",
"track_dependency",
"(",
"self",
",",
"name",
",",
"data",
",",
"type",
"=",
"None",
",",
"target",
"=",
"None",
",",
"duration",
"=",
"None",
",",
"success",
"=",
"None",
",",
"result_code",
"=",
"None",
",",
"properties",
"=",
"None",
",",
"... | Sends a single dependency telemetry that was captured for the application.
Args:
name (str). the name of the command initiated with this dependency call. Low cardinality value. Examples are stored procedure name and URL path template.\n
data (str). the command initiated by this dependen... | [
"Sends",
"a",
"single",
"dependency",
"telemetry",
"that",
"was",
"captured",
"for",
"the",
"application",
"."
] | 8452ab7126f9bb6964637d4aa1258c2af17563d6 | https://github.com/Microsoft/ApplicationInsights-Python/blob/8452ab7126f9bb6964637d4aa1258c2af17563d6/applicationinsights/TelemetryClient.py#L224-L253 |
17,713 | Microsoft/ApplicationInsights-Python | applicationinsights/django/common.py | dummy_client | def dummy_client(reason):
"""Creates a dummy channel so even if we're not logging telemetry, we can still send
along the real object to things that depend on it to exist"""
sender = applicationinsights.channel.NullSender()
queue = applicationinsights.channel.SynchronousQueue(sender)
channel = appli... | python | def dummy_client(reason):
"""Creates a dummy channel so even if we're not logging telemetry, we can still send
along the real object to things that depend on it to exist"""
sender = applicationinsights.channel.NullSender()
queue = applicationinsights.channel.SynchronousQueue(sender)
channel = appli... | [
"def",
"dummy_client",
"(",
"reason",
")",
":",
"sender",
"=",
"applicationinsights",
".",
"channel",
".",
"NullSender",
"(",
")",
"queue",
"=",
"applicationinsights",
".",
"channel",
".",
"SynchronousQueue",
"(",
"sender",
")",
"channel",
"=",
"applicationinsig... | Creates a dummy channel so even if we're not logging telemetry, we can still send
along the real object to things that depend on it to exist | [
"Creates",
"a",
"dummy",
"channel",
"so",
"even",
"if",
"we",
"re",
"not",
"logging",
"telemetry",
"we",
"can",
"still",
"send",
"along",
"the",
"real",
"object",
"to",
"things",
"that",
"depend",
"on",
"it",
"to",
"exist"
] | 8452ab7126f9bb6964637d4aa1258c2af17563d6 | https://github.com/Microsoft/ApplicationInsights-Python/blob/8452ab7126f9bb6964637d4aa1258c2af17563d6/applicationinsights/django/common.py#L75-L82 |
17,714 | Microsoft/ApplicationInsights-Python | applicationinsights/exceptions/enable.py | enable | def enable(instrumentation_key, *args, **kwargs):
"""Enables the automatic collection of unhandled exceptions. Captured exceptions will be sent to the Application
Insights service before being re-thrown. Multiple calls to this function with different instrumentation keys result
in multiple instances being s... | python | def enable(instrumentation_key, *args, **kwargs):
"""Enables the automatic collection of unhandled exceptions. Captured exceptions will be sent to the Application
Insights service before being re-thrown. Multiple calls to this function with different instrumentation keys result
in multiple instances being s... | [
"def",
"enable",
"(",
"instrumentation_key",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"instrumentation_key",
":",
"raise",
"Exception",
"(",
"'Instrumentation key was required but not provided'",
")",
"global",
"original_excepthook",
"global",... | Enables the automatic collection of unhandled exceptions. Captured exceptions will be sent to the Application
Insights service before being re-thrown. Multiple calls to this function with different instrumentation keys result
in multiple instances being submitted, one for each key.
.. code:: python
... | [
"Enables",
"the",
"automatic",
"collection",
"of",
"unhandled",
"exceptions",
".",
"Captured",
"exceptions",
"will",
"be",
"sent",
"to",
"the",
"Application",
"Insights",
"service",
"before",
"being",
"re",
"-",
"thrown",
".",
"Multiple",
"calls",
"to",
"this",
... | 8452ab7126f9bb6964637d4aa1258c2af17563d6 | https://github.com/Microsoft/ApplicationInsights-Python/blob/8452ab7126f9bb6964637d4aa1258c2af17563d6/applicationinsights/exceptions/enable.py#L8-L35 |
17,715 | Microsoft/ApplicationInsights-Python | applicationinsights/flask/ext.py | AppInsights.init_app | def init_app(self, app):
"""
Initializes the extension for the provided Flask application.
Args:
app (flask.Flask). the Flask application for which to initialize the extension.
"""
self._key = app.config.get(CONF_KEY) or getenv(CONF_KEY)
if not self._key:
... | python | def init_app(self, app):
"""
Initializes the extension for the provided Flask application.
Args:
app (flask.Flask). the Flask application for which to initialize the extension.
"""
self._key = app.config.get(CONF_KEY) or getenv(CONF_KEY)
if not self._key:
... | [
"def",
"init_app",
"(",
"self",
",",
"app",
")",
":",
"self",
".",
"_key",
"=",
"app",
".",
"config",
".",
"get",
"(",
"CONF_KEY",
")",
"or",
"getenv",
"(",
"CONF_KEY",
")",
"if",
"not",
"self",
".",
"_key",
":",
"return",
"self",
".",
"_endpoint_u... | Initializes the extension for the provided Flask application.
Args:
app (flask.Flask). the Flask application for which to initialize the extension. | [
"Initializes",
"the",
"extension",
"for",
"the",
"provided",
"Flask",
"application",
"."
] | 8452ab7126f9bb6964637d4aa1258c2af17563d6 | https://github.com/Microsoft/ApplicationInsights-Python/blob/8452ab7126f9bb6964637d4aa1258c2af17563d6/applicationinsights/flask/ext.py#L87-L107 |
17,716 | Microsoft/ApplicationInsights-Python | applicationinsights/flask/ext.py | AppInsights._init_request_logging | def _init_request_logging(self, app):
"""
Sets up request logging unless ``APPINSIGHTS_DISABLE_REQUEST_LOGGING``
is set in the Flask config.
Args:
app (flask.Flask). the Flask application for which to initialize the extension.
"""
enabled = not app.config.get... | python | def _init_request_logging(self, app):
"""
Sets up request logging unless ``APPINSIGHTS_DISABLE_REQUEST_LOGGING``
is set in the Flask config.
Args:
app (flask.Flask). the Flask application for which to initialize the extension.
"""
enabled = not app.config.get... | [
"def",
"_init_request_logging",
"(",
"self",
",",
"app",
")",
":",
"enabled",
"=",
"not",
"app",
".",
"config",
".",
"get",
"(",
"CONF_DISABLE_REQUEST_LOGGING",
",",
"False",
")",
"if",
"not",
"enabled",
":",
"return",
"self",
".",
"_requests_middleware",
"=... | Sets up request logging unless ``APPINSIGHTS_DISABLE_REQUEST_LOGGING``
is set in the Flask config.
Args:
app (flask.Flask). the Flask application for which to initialize the extension. | [
"Sets",
"up",
"request",
"logging",
"unless",
"APPINSIGHTS_DISABLE_REQUEST_LOGGING",
"is",
"set",
"in",
"the",
"Flask",
"config",
"."
] | 8452ab7126f9bb6964637d4aa1258c2af17563d6 | https://github.com/Microsoft/ApplicationInsights-Python/blob/8452ab7126f9bb6964637d4aa1258c2af17563d6/applicationinsights/flask/ext.py#L119-L135 |
17,717 | Microsoft/ApplicationInsights-Python | applicationinsights/flask/ext.py | AppInsights._init_trace_logging | def _init_trace_logging(self, app):
"""
Sets up trace logging unless ``APPINSIGHTS_DISABLE_TRACE_LOGGING`` is
set in the Flask config.
Args:
app (flask.Flask). the Flask application for which to initialize the extension.
"""
enabled = not app.config.get(CONF_... | python | def _init_trace_logging(self, app):
"""
Sets up trace logging unless ``APPINSIGHTS_DISABLE_TRACE_LOGGING`` is
set in the Flask config.
Args:
app (flask.Flask). the Flask application for which to initialize the extension.
"""
enabled = not app.config.get(CONF_... | [
"def",
"_init_trace_logging",
"(",
"self",
",",
"app",
")",
":",
"enabled",
"=",
"not",
"app",
".",
"config",
".",
"get",
"(",
"CONF_DISABLE_TRACE_LOGGING",
",",
"False",
")",
"if",
"not",
"enabled",
":",
"return",
"self",
".",
"_trace_log_handler",
"=",
"... | Sets up trace logging unless ``APPINSIGHTS_DISABLE_TRACE_LOGGING`` is
set in the Flask config.
Args:
app (flask.Flask). the Flask application for which to initialize the extension. | [
"Sets",
"up",
"trace",
"logging",
"unless",
"APPINSIGHTS_DISABLE_TRACE_LOGGING",
"is",
"set",
"in",
"the",
"Flask",
"config",
"."
] | 8452ab7126f9bb6964637d4aa1258c2af17563d6 | https://github.com/Microsoft/ApplicationInsights-Python/blob/8452ab7126f9bb6964637d4aa1258c2af17563d6/applicationinsights/flask/ext.py#L137-L153 |
17,718 | Microsoft/ApplicationInsights-Python | applicationinsights/flask/ext.py | AppInsights._init_exception_logging | def _init_exception_logging(self, app):
"""
Sets up exception logging unless ``APPINSIGHTS_DISABLE_EXCEPTION_LOGGING``
is set in the Flask config.
Args:
app (flask.Flask). the Flask application for which to initialize the extension.
"""
enabled = not app.conf... | python | def _init_exception_logging(self, app):
"""
Sets up exception logging unless ``APPINSIGHTS_DISABLE_EXCEPTION_LOGGING``
is set in the Flask config.
Args:
app (flask.Flask). the Flask application for which to initialize the extension.
"""
enabled = not app.conf... | [
"def",
"_init_exception_logging",
"(",
"self",
",",
"app",
")",
":",
"enabled",
"=",
"not",
"app",
".",
"config",
".",
"get",
"(",
"CONF_DISABLE_EXCEPTION_LOGGING",
",",
"False",
")",
"if",
"not",
"enabled",
":",
"return",
"exception_telemetry_client",
"=",
"T... | Sets up exception logging unless ``APPINSIGHTS_DISABLE_EXCEPTION_LOGGING``
is set in the Flask config.
Args:
app (flask.Flask). the Flask application for which to initialize the extension. | [
"Sets",
"up",
"exception",
"logging",
"unless",
"APPINSIGHTS_DISABLE_EXCEPTION_LOGGING",
"is",
"set",
"in",
"the",
"Flask",
"config",
"."
] | 8452ab7126f9bb6964637d4aa1258c2af17563d6 | https://github.com/Microsoft/ApplicationInsights-Python/blob/8452ab7126f9bb6964637d4aa1258c2af17563d6/applicationinsights/flask/ext.py#L155-L183 |
17,719 | Microsoft/ApplicationInsights-Python | applicationinsights/flask/ext.py | AppInsights.flush | def flush(self):
"""Flushes the queued up telemetry to the service.
"""
if self._requests_middleware:
self._requests_middleware.flush()
if self._trace_log_handler:
self._trace_log_handler.flush()
if self._exception_telemetry_client:
self._exc... | python | def flush(self):
"""Flushes the queued up telemetry to the service.
"""
if self._requests_middleware:
self._requests_middleware.flush()
if self._trace_log_handler:
self._trace_log_handler.flush()
if self._exception_telemetry_client:
self._exc... | [
"def",
"flush",
"(",
"self",
")",
":",
"if",
"self",
".",
"_requests_middleware",
":",
"self",
".",
"_requests_middleware",
".",
"flush",
"(",
")",
"if",
"self",
".",
"_trace_log_handler",
":",
"self",
".",
"_trace_log_handler",
".",
"flush",
"(",
")",
"if... | Flushes the queued up telemetry to the service. | [
"Flushes",
"the",
"queued",
"up",
"telemetry",
"to",
"the",
"service",
"."
] | 8452ab7126f9bb6964637d4aa1258c2af17563d6 | https://github.com/Microsoft/ApplicationInsights-Python/blob/8452ab7126f9bb6964637d4aa1258c2af17563d6/applicationinsights/flask/ext.py#L185-L195 |
17,720 | Microsoft/ApplicationInsights-Python | applicationinsights/channel/QueueBase.py | QueueBase.get | def get(self):
"""Gets a single item from the queue and returns it. If the queue is empty, this method will return None.
Returns:
:class:`contracts.Envelope`. a telemetry envelope object or None if the queue is empty.
"""
try:
item = self._queue.get_nowait()
... | python | def get(self):
"""Gets a single item from the queue and returns it. If the queue is empty, this method will return None.
Returns:
:class:`contracts.Envelope`. a telemetry envelope object or None if the queue is empty.
"""
try:
item = self._queue.get_nowait()
... | [
"def",
"get",
"(",
"self",
")",
":",
"try",
":",
"item",
"=",
"self",
".",
"_queue",
".",
"get_nowait",
"(",
")",
"except",
"(",
"Empty",
",",
"PersistEmpty",
")",
":",
"return",
"None",
"if",
"self",
".",
"_persistence_path",
":",
"self",
".",
"_que... | Gets a single item from the queue and returns it. If the queue is empty, this method will return None.
Returns:
:class:`contracts.Envelope`. a telemetry envelope object or None if the queue is empty. | [
"Gets",
"a",
"single",
"item",
"from",
"the",
"queue",
"and",
"returns",
"it",
".",
"If",
"the",
"queue",
"is",
"empty",
"this",
"method",
"will",
"return",
"None",
"."
] | 8452ab7126f9bb6964637d4aa1258c2af17563d6 | https://github.com/Microsoft/ApplicationInsights-Python/blob/8452ab7126f9bb6964637d4aa1258c2af17563d6/applicationinsights/channel/QueueBase.py#L92-L106 |
17,721 | Microsoft/ApplicationInsights-Python | applicationinsights/logging/LoggingHandler.py | enable | def enable(instrumentation_key, *args, **kwargs):
"""Enables the Application Insights logging handler for the root logger for the supplied instrumentation key.
Multiple calls to this function with different instrumentation keys result in multiple handler instances.
.. code:: python
import logging
... | python | def enable(instrumentation_key, *args, **kwargs):
"""Enables the Application Insights logging handler for the root logger for the supplied instrumentation key.
Multiple calls to this function with different instrumentation keys result in multiple handler instances.
.. code:: python
import logging
... | [
"def",
"enable",
"(",
"instrumentation_key",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"instrumentation_key",
":",
"raise",
"Exception",
"(",
"'Instrumentation key was required but not provided'",
")",
"if",
"instrumentation_key",
"in",
"enab... | Enables the Application Insights logging handler for the root logger for the supplied instrumentation key.
Multiple calls to this function with different instrumentation keys result in multiple handler instances.
.. code:: python
import logging
from applicationinsights.logging import enable
... | [
"Enables",
"the",
"Application",
"Insights",
"logging",
"handler",
"for",
"the",
"root",
"logger",
"for",
"the",
"supplied",
"instrumentation",
"key",
".",
"Multiple",
"calls",
"to",
"this",
"function",
"with",
"different",
"instrumentation",
"keys",
"result",
"in... | 8452ab7126f9bb6964637d4aa1258c2af17563d6 | https://github.com/Microsoft/ApplicationInsights-Python/blob/8452ab7126f9bb6964637d4aa1258c2af17563d6/applicationinsights/logging/LoggingHandler.py#L10-L61 |
17,722 | Microsoft/ApplicationInsights-Python | applicationinsights/channel/AsynchronousSender.py | AsynchronousSender.start | def start(self):
"""Starts a new sender thread if none is not already there
"""
with self._lock_send_remaining_time:
if self._send_remaining_time <= 0.0:
local_send_interval = self._send_interval
if self._send_interval < 0.1:
local_... | python | def start(self):
"""Starts a new sender thread if none is not already there
"""
with self._lock_send_remaining_time:
if self._send_remaining_time <= 0.0:
local_send_interval = self._send_interval
if self._send_interval < 0.1:
local_... | [
"def",
"start",
"(",
"self",
")",
":",
"with",
"self",
".",
"_lock_send_remaining_time",
":",
"if",
"self",
".",
"_send_remaining_time",
"<=",
"0.0",
":",
"local_send_interval",
"=",
"self",
".",
"_send_interval",
"if",
"self",
".",
"_send_interval",
"<",
"0.1... | Starts a new sender thread if none is not already there | [
"Starts",
"a",
"new",
"sender",
"thread",
"if",
"none",
"is",
"not",
"already",
"there"
] | 8452ab7126f9bb6964637d4aa1258c2af17563d6 | https://github.com/Microsoft/ApplicationInsights-Python/blob/8452ab7126f9bb6964637d4aa1258c2af17563d6/applicationinsights/channel/AsynchronousSender.py#L76-L89 |
17,723 | Microsoft/ApplicationInsights-Python | applicationinsights/channel/TelemetryContext.py | device_initialize | def device_initialize(self):
""" The device initializer used to assign special properties to all device context objects"""
existing_device_initialize(self)
self.type = 'Other'
self.id = platform.node()
self.os_version = platform.version()
self.locale = locale.getdefaultlocale()[0] | python | def device_initialize(self):
""" The device initializer used to assign special properties to all device context objects"""
existing_device_initialize(self)
self.type = 'Other'
self.id = platform.node()
self.os_version = platform.version()
self.locale = locale.getdefaultlocale()[0] | [
"def",
"device_initialize",
"(",
"self",
")",
":",
"existing_device_initialize",
"(",
"self",
")",
"self",
".",
"type",
"=",
"'Other'",
"self",
".",
"id",
"=",
"platform",
".",
"node",
"(",
")",
"self",
".",
"os_version",
"=",
"platform",
".",
"version",
... | The device initializer used to assign special properties to all device context objects | [
"The",
"device",
"initializer",
"used",
"to",
"assign",
"special",
"properties",
"to",
"all",
"device",
"context",
"objects"
] | 8452ab7126f9bb6964637d4aa1258c2af17563d6 | https://github.com/Microsoft/ApplicationInsights-Python/blob/8452ab7126f9bb6964637d4aa1258c2af17563d6/applicationinsights/channel/TelemetryContext.py#L8-L14 |
17,724 | hyperledger/indy-crypto | wrappers/python/indy_crypto/bls.py | Bls.sign | def sign(message: bytes, sign_key: SignKey) -> Signature:
"""
Signs the message and returns signature.
:param: message - Message to sign
:param: sign_key - Sign key
:return: Signature
"""
logger = logging.getLogger(__name__)
logger.debug("Bls::sign: >>> ... | python | def sign(message: bytes, sign_key: SignKey) -> Signature:
"""
Signs the message and returns signature.
:param: message - Message to sign
:param: sign_key - Sign key
:return: Signature
"""
logger = logging.getLogger(__name__)
logger.debug("Bls::sign: >>> ... | [
"def",
"sign",
"(",
"message",
":",
"bytes",
",",
"sign_key",
":",
"SignKey",
")",
"->",
"Signature",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"logger",
".",
"debug",
"(",
"\"Bls::sign: >>> message: %r, sign_key: %r\"",
",",
"mess... | Signs the message and returns signature.
:param: message - Message to sign
:param: sign_key - Sign key
:return: Signature | [
"Signs",
"the",
"message",
"and",
"returns",
"signature",
"."
] | 1675e29a2a5949b44899553d3d128335cf7a61b3 | https://github.com/hyperledger/indy-crypto/blob/1675e29a2a5949b44899553d3d128335cf7a61b3/wrappers/python/indy_crypto/bls.py#L229-L250 |
17,725 | hyperledger/indy-crypto | wrappers/python/indy_crypto/bls.py | Bls.verify | def verify(signature: Signature, message: bytes, ver_key: VerKey, gen: Generator) -> bool:
"""
Verifies the message signature and returns true - if signature valid or false otherwise.
:param: signature - Signature to verify
:param: message - Message to verify
:param: ver_key - V... | python | def verify(signature: Signature, message: bytes, ver_key: VerKey, gen: Generator) -> bool:
"""
Verifies the message signature and returns true - if signature valid or false otherwise.
:param: signature - Signature to verify
:param: message - Message to verify
:param: ver_key - V... | [
"def",
"verify",
"(",
"signature",
":",
"Signature",
",",
"message",
":",
"bytes",
",",
"ver_key",
":",
"VerKey",
",",
"gen",
":",
"Generator",
")",
"->",
"bool",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"logger",
".",
"de... | Verifies the message signature and returns true - if signature valid or false otherwise.
:param: signature - Signature to verify
:param: message - Message to verify
:param: ver_key - Verification key
:param: gen - Generator point
:return: true if signature valid | [
"Verifies",
"the",
"message",
"signature",
"and",
"returns",
"true",
"-",
"if",
"signature",
"valid",
"or",
"false",
"otherwise",
"."
] | 1675e29a2a5949b44899553d3d128335cf7a61b3 | https://github.com/hyperledger/indy-crypto/blob/1675e29a2a5949b44899553d3d128335cf7a61b3/wrappers/python/indy_crypto/bls.py#L253-L278 |
17,726 | hyperledger/indy-crypto | wrappers/python/indy_crypto/bls.py | Bls.verify_pop | def verify_pop(pop: ProofOfPossession, ver_key: VerKey, gen: Generator) -> bool:
"""
Verifies the proof of possession and returns true - if signature valid or false otherwise.
:param: pop - Proof of possession
:param: ver_key - Verification key
:param: gen - Generator point
... | python | def verify_pop(pop: ProofOfPossession, ver_key: VerKey, gen: Generator) -> bool:
"""
Verifies the proof of possession and returns true - if signature valid or false otherwise.
:param: pop - Proof of possession
:param: ver_key - Verification key
:param: gen - Generator point
... | [
"def",
"verify_pop",
"(",
"pop",
":",
"ProofOfPossession",
",",
"ver_key",
":",
"VerKey",
",",
"gen",
":",
"Generator",
")",
"->",
"bool",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"logger",
".",
"debug",
"(",
"\"Bls::verify_po... | Verifies the proof of possession and returns true - if signature valid or false otherwise.
:param: pop - Proof of possession
:param: ver_key - Verification key
:param: gen - Generator point
:return: true if signature valid | [
"Verifies",
"the",
"proof",
"of",
"possession",
"and",
"returns",
"true",
"-",
"if",
"signature",
"valid",
"or",
"false",
"otherwise",
"."
] | 1675e29a2a5949b44899553d3d128335cf7a61b3 | https://github.com/hyperledger/indy-crypto/blob/1675e29a2a5949b44899553d3d128335cf7a61b3/wrappers/python/indy_crypto/bls.py#L281-L306 |
17,727 | hyperledger/indy-crypto | wrappers/python/indy_crypto/bls.py | Bls.verify_multi_sig | def verify_multi_sig(multi_sig: MultiSignature, message: bytes, ver_keys: [VerKey], gen: Generator) -> bool:
"""
Verifies the message multi signature and returns true - if signature valid or false otherwise.
:param: multi_sig - Multi signature to verify
:param: message - Message to veri... | python | def verify_multi_sig(multi_sig: MultiSignature, message: bytes, ver_keys: [VerKey], gen: Generator) -> bool:
"""
Verifies the message multi signature and returns true - if signature valid or false otherwise.
:param: multi_sig - Multi signature to verify
:param: message - Message to veri... | [
"def",
"verify_multi_sig",
"(",
"multi_sig",
":",
"MultiSignature",
",",
"message",
":",
"bytes",
",",
"ver_keys",
":",
"[",
"VerKey",
"]",
",",
"gen",
":",
"Generator",
")",
"->",
"bool",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
... | Verifies the message multi signature and returns true - if signature valid or false otherwise.
:param: multi_sig - Multi signature to verify
:param: message - Message to verify
:param: ver_keys - List of verification keys
:param: gen - Generator point
:return: true if multi sign... | [
"Verifies",
"the",
"message",
"multi",
"signature",
"and",
"returns",
"true",
"-",
"if",
"signature",
"valid",
"or",
"false",
"otherwise",
"."
] | 1675e29a2a5949b44899553d3d128335cf7a61b3 | https://github.com/hyperledger/indy-crypto/blob/1675e29a2a5949b44899553d3d128335cf7a61b3/wrappers/python/indy_crypto/bls.py#L309-L340 |
17,728 | nephila/djangocms-blog | djangocms_blog/admin.py | PostAdmin.get_urls | def get_urls(self):
"""
Customize the modeladmin urls
"""
urls = [
url(r'^publish/([0-9]+)/$', self.admin_site.admin_view(self.publish_post),
name='djangocms_blog_publish_article'),
]
urls.extend(super(PostAdmin, self).get_urls())
retur... | python | def get_urls(self):
"""
Customize the modeladmin urls
"""
urls = [
url(r'^publish/([0-9]+)/$', self.admin_site.admin_view(self.publish_post),
name='djangocms_blog_publish_article'),
]
urls.extend(super(PostAdmin, self).get_urls())
retur... | [
"def",
"get_urls",
"(",
"self",
")",
":",
"urls",
"=",
"[",
"url",
"(",
"r'^publish/([0-9]+)/$'",
",",
"self",
".",
"admin_site",
".",
"admin_view",
"(",
"self",
".",
"publish_post",
")",
",",
"name",
"=",
"'djangocms_blog_publish_article'",
")",
",",
"]",
... | Customize the modeladmin urls | [
"Customize",
"the",
"modeladmin",
"urls"
] | 3fdfbd4ba48947df0ee4c6d42e3a1c812b6dd95d | https://github.com/nephila/djangocms-blog/blob/3fdfbd4ba48947df0ee4c6d42e3a1c812b6dd95d/djangocms_blog/admin.py#L224-L233 |
17,729 | nephila/djangocms-blog | djangocms_blog/admin.py | PostAdmin.publish_post | def publish_post(self, request, pk):
"""
Admin view to publish a single post
:param request: request
:param pk: primary key of the post to publish
:return: Redirect to the post itself (if found) or fallback urls
"""
language = get_language_from_request(request, c... | python | def publish_post(self, request, pk):
"""
Admin view to publish a single post
:param request: request
:param pk: primary key of the post to publish
:return: Redirect to the post itself (if found) or fallback urls
"""
language = get_language_from_request(request, c... | [
"def",
"publish_post",
"(",
"self",
",",
"request",
",",
"pk",
")",
":",
"language",
"=",
"get_language_from_request",
"(",
"request",
",",
"check_path",
"=",
"True",
")",
"try",
":",
"post",
"=",
"Post",
".",
"objects",
".",
"get",
"(",
"pk",
"=",
"in... | Admin view to publish a single post
:param request: request
:param pk: primary key of the post to publish
:return: Redirect to the post itself (if found) or fallback urls | [
"Admin",
"view",
"to",
"publish",
"a",
"single",
"post"
] | 3fdfbd4ba48947df0ee4c6d42e3a1c812b6dd95d | https://github.com/nephila/djangocms-blog/blob/3fdfbd4ba48947df0ee4c6d42e3a1c812b6dd95d/djangocms_blog/admin.py#L247-L265 |
17,730 | nephila/djangocms-blog | djangocms_blog/admin.py | PostAdmin.has_restricted_sites | def has_restricted_sites(self, request):
"""
Whether the current user has permission on one site only
:param request: current request
:return: boolean: user has permission on only one site
"""
sites = self.get_restricted_sites(request)
return sites and sites.coun... | python | def has_restricted_sites(self, request):
"""
Whether the current user has permission on one site only
:param request: current request
:return: boolean: user has permission on only one site
"""
sites = self.get_restricted_sites(request)
return sites and sites.coun... | [
"def",
"has_restricted_sites",
"(",
"self",
",",
"request",
")",
":",
"sites",
"=",
"self",
".",
"get_restricted_sites",
"(",
"request",
")",
"return",
"sites",
"and",
"sites",
".",
"count",
"(",
")",
"==",
"1"
] | Whether the current user has permission on one site only
:param request: current request
:return: boolean: user has permission on only one site | [
"Whether",
"the",
"current",
"user",
"has",
"permission",
"on",
"one",
"site",
"only"
] | 3fdfbd4ba48947df0ee4c6d42e3a1c812b6dd95d | https://github.com/nephila/djangocms-blog/blob/3fdfbd4ba48947df0ee4c6d42e3a1c812b6dd95d/djangocms_blog/admin.py#L267-L275 |
17,731 | nephila/djangocms-blog | djangocms_blog/admin.py | PostAdmin.get_restricted_sites | def get_restricted_sites(self, request):
"""
The sites on which the user has permission on.
To return the permissions, the method check for the ``get_sites``
method on the user instance (e.g.: ``return request.user.get_sites()``)
which must return the queryset of enabled sites.
... | python | def get_restricted_sites(self, request):
"""
The sites on which the user has permission on.
To return the permissions, the method check for the ``get_sites``
method on the user instance (e.g.: ``return request.user.get_sites()``)
which must return the queryset of enabled sites.
... | [
"def",
"get_restricted_sites",
"(",
"self",
",",
"request",
")",
":",
"try",
":",
"return",
"request",
".",
"user",
".",
"get_sites",
"(",
")",
"except",
"AttributeError",
":",
"# pragma: no cover",
"return",
"Site",
".",
"objects",
".",
"none",
"(",
")"
] | The sites on which the user has permission on.
To return the permissions, the method check for the ``get_sites``
method on the user instance (e.g.: ``return request.user.get_sites()``)
which must return the queryset of enabled sites.
If the attribute does not exists, the user is conside... | [
"The",
"sites",
"on",
"which",
"the",
"user",
"has",
"permission",
"on",
"."
] | 3fdfbd4ba48947df0ee4c6d42e3a1c812b6dd95d | https://github.com/nephila/djangocms-blog/blob/3fdfbd4ba48947df0ee4c6d42e3a1c812b6dd95d/djangocms_blog/admin.py#L277-L293 |
17,732 | nephila/djangocms-blog | djangocms_blog/admin.py | PostAdmin.get_fieldsets | def get_fieldsets(self, request, obj=None):
"""
Customize the fieldsets according to the app settings
:param request: request
:param obj: post
:return: fieldsets configuration
"""
app_config_default = self._app_config_select(request, obj)
if app_config_de... | python | def get_fieldsets(self, request, obj=None):
"""
Customize the fieldsets according to the app settings
:param request: request
:param obj: post
:return: fieldsets configuration
"""
app_config_default = self._app_config_select(request, obj)
if app_config_de... | [
"def",
"get_fieldsets",
"(",
"self",
",",
"request",
",",
"obj",
"=",
"None",
")",
":",
"app_config_default",
"=",
"self",
".",
"_app_config_select",
"(",
"request",
",",
"obj",
")",
"if",
"app_config_default",
"is",
"None",
"and",
"request",
".",
"method",
... | Customize the fieldsets according to the app settings
:param request: request
:param obj: post
:return: fieldsets configuration | [
"Customize",
"the",
"fieldsets",
"according",
"to",
"the",
"app",
"settings"
] | 3fdfbd4ba48947df0ee4c6d42e3a1c812b6dd95d | https://github.com/nephila/djangocms-blog/blob/3fdfbd4ba48947df0ee4c6d42e3a1c812b6dd95d/djangocms_blog/admin.py#L302-L342 |
17,733 | nephila/djangocms-blog | djangocms_blog/admin.py | BlogConfigAdmin.save_model | def save_model(self, request, obj, form, change):
"""
Clear menu cache when changing menu structure
"""
if 'config.menu_structure' in form.changed_data:
from menus.menu_pool import menu_pool
menu_pool.clear(all=True)
return super(BlogConfigAdmin, self).sav... | python | def save_model(self, request, obj, form, change):
"""
Clear menu cache when changing menu structure
"""
if 'config.menu_structure' in form.changed_data:
from menus.menu_pool import menu_pool
menu_pool.clear(all=True)
return super(BlogConfigAdmin, self).sav... | [
"def",
"save_model",
"(",
"self",
",",
"request",
",",
"obj",
",",
"form",
",",
"change",
")",
":",
"if",
"'config.menu_structure'",
"in",
"form",
".",
"changed_data",
":",
"from",
"menus",
".",
"menu_pool",
"import",
"menu_pool",
"menu_pool",
".",
"clear",
... | Clear menu cache when changing menu structure | [
"Clear",
"menu",
"cache",
"when",
"changing",
"menu",
"structure"
] | 3fdfbd4ba48947df0ee4c6d42e3a1c812b6dd95d | https://github.com/nephila/djangocms-blog/blob/3fdfbd4ba48947df0ee4c6d42e3a1c812b6dd95d/djangocms_blog/admin.py#L453-L460 |
17,734 | nephila/djangocms-blog | djangocms_blog/cms_wizards.py | PostWizardForm.clean_slug | def clean_slug(self):
"""
Generate a valid slug, in case the given one is taken
"""
source = self.cleaned_data.get('slug', '')
lang_choice = self.language_code
if not source:
source = slugify(self.cleaned_data.get('title', ''))
qs = Post._default_manag... | python | def clean_slug(self):
"""
Generate a valid slug, in case the given one is taken
"""
source = self.cleaned_data.get('slug', '')
lang_choice = self.language_code
if not source:
source = slugify(self.cleaned_data.get('title', ''))
qs = Post._default_manag... | [
"def",
"clean_slug",
"(",
"self",
")",
":",
"source",
"=",
"self",
".",
"cleaned_data",
".",
"get",
"(",
"'slug'",
",",
"''",
")",
"lang_choice",
"=",
"self",
".",
"language_code",
"if",
"not",
"source",
":",
"source",
"=",
"slugify",
"(",
"self",
".",... | Generate a valid slug, in case the given one is taken | [
"Generate",
"a",
"valid",
"slug",
"in",
"case",
"the",
"given",
"one",
"is",
"taken"
] | 3fdfbd4ba48947df0ee4c6d42e3a1c812b6dd95d | https://github.com/nephila/djangocms-blog/blob/3fdfbd4ba48947df0ee4c6d42e3a1c812b6dd95d/djangocms_blog/cms_wizards.py#L55-L70 |
17,735 | nephila/djangocms-blog | djangocms_blog/managers.py | TaggedFilterItem.tagged | def tagged(self, other_model=None, queryset=None):
"""
Restituisce una queryset di elementi del model taggati,
o con gli stessi tag di un model o un queryset
"""
tags = self._taglist(other_model, queryset)
return self.get_queryset().filter(tags__in=tags).distinct() | python | def tagged(self, other_model=None, queryset=None):
"""
Restituisce una queryset di elementi del model taggati,
o con gli stessi tag di un model o un queryset
"""
tags = self._taglist(other_model, queryset)
return self.get_queryset().filter(tags__in=tags).distinct() | [
"def",
"tagged",
"(",
"self",
",",
"other_model",
"=",
"None",
",",
"queryset",
"=",
"None",
")",
":",
"tags",
"=",
"self",
".",
"_taglist",
"(",
"other_model",
",",
"queryset",
")",
"return",
"self",
".",
"get_queryset",
"(",
")",
".",
"filter",
"(",
... | Restituisce una queryset di elementi del model taggati,
o con gli stessi tag di un model o un queryset | [
"Restituisce",
"una",
"queryset",
"di",
"elementi",
"del",
"model",
"taggati",
"o",
"con",
"gli",
"stessi",
"tag",
"di",
"un",
"model",
"o",
"un",
"queryset"
] | 3fdfbd4ba48947df0ee4c6d42e3a1c812b6dd95d | https://github.com/nephila/djangocms-blog/blob/3fdfbd4ba48947df0ee4c6d42e3a1c812b6dd95d/djangocms_blog/managers.py#L16-L22 |
17,736 | nephila/djangocms-blog | djangocms_blog/managers.py | TaggedFilterItem._taglist | def _taglist(self, other_model=None, queryset=None):
"""
Restituisce una lista di id di tag comuni al model corrente e al model
o queryset passati come argomento
"""
from taggit.models import TaggedItem
filter = None
if queryset is not None:
filter = s... | python | def _taglist(self, other_model=None, queryset=None):
"""
Restituisce una lista di id di tag comuni al model corrente e al model
o queryset passati come argomento
"""
from taggit.models import TaggedItem
filter = None
if queryset is not None:
filter = s... | [
"def",
"_taglist",
"(",
"self",
",",
"other_model",
"=",
"None",
",",
"queryset",
"=",
"None",
")",
":",
"from",
"taggit",
".",
"models",
"import",
"TaggedItem",
"filter",
"=",
"None",
"if",
"queryset",
"is",
"not",
"None",
":",
"filter",
"=",
"set",
"... | Restituisce una lista di id di tag comuni al model corrente e al model
o queryset passati come argomento | [
"Restituisce",
"una",
"lista",
"di",
"id",
"di",
"tag",
"comuni",
"al",
"model",
"corrente",
"e",
"al",
"model",
"o",
"queryset",
"passati",
"come",
"argomento"
] | 3fdfbd4ba48947df0ee4c6d42e3a1c812b6dd95d | https://github.com/nephila/djangocms-blog/blob/3fdfbd4ba48947df0ee4c6d42e3a1c812b6dd95d/djangocms_blog/managers.py#L24-L45 |
17,737 | nephila/djangocms-blog | djangocms_blog/managers.py | TaggedFilterItem.tag_list | def tag_list(self, other_model=None, queryset=None):
"""
Restituisce un queryset di tag comuni al model corrente e
al model o queryset passati come argomento
"""
from taggit.models import Tag
return Tag.objects.filter(id__in=self._taglist(other_model, queryset)) | python | def tag_list(self, other_model=None, queryset=None):
"""
Restituisce un queryset di tag comuni al model corrente e
al model o queryset passati come argomento
"""
from taggit.models import Tag
return Tag.objects.filter(id__in=self._taglist(other_model, queryset)) | [
"def",
"tag_list",
"(",
"self",
",",
"other_model",
"=",
"None",
",",
"queryset",
"=",
"None",
")",
":",
"from",
"taggit",
".",
"models",
"import",
"Tag",
"return",
"Tag",
".",
"objects",
".",
"filter",
"(",
"id__in",
"=",
"self",
".",
"_taglist",
"(",... | Restituisce un queryset di tag comuni al model corrente e
al model o queryset passati come argomento | [
"Restituisce",
"un",
"queryset",
"di",
"tag",
"comuni",
"al",
"model",
"corrente",
"e",
"al",
"model",
"o",
"queryset",
"passati",
"come",
"argomento"
] | 3fdfbd4ba48947df0ee4c6d42e3a1c812b6dd95d | https://github.com/nephila/djangocms-blog/blob/3fdfbd4ba48947df0ee4c6d42e3a1c812b6dd95d/djangocms_blog/managers.py#L47-L53 |
17,738 | nephila/djangocms-blog | djangocms_blog/liveblog/consumers.py | liveblog_connect | def liveblog_connect(message, apphook, lang, post):
"""
Connect users to the group of the given post according to the given language
Return with an error message if a post cannot be found
:param message: channel connect message
:param apphook: apphook config namespace
:param lang: language
... | python | def liveblog_connect(message, apphook, lang, post):
"""
Connect users to the group of the given post according to the given language
Return with an error message if a post cannot be found
:param message: channel connect message
:param apphook: apphook config namespace
:param lang: language
... | [
"def",
"liveblog_connect",
"(",
"message",
",",
"apphook",
",",
"lang",
",",
"post",
")",
":",
"try",
":",
"post",
"=",
"Post",
".",
"objects",
".",
"namespace",
"(",
"apphook",
")",
".",
"language",
"(",
"lang",
")",
".",
"active_translations",
"(",
"... | Connect users to the group of the given post according to the given language
Return with an error message if a post cannot be found
:param message: channel connect message
:param apphook: apphook config namespace
:param lang: language
:param post: post slug | [
"Connect",
"users",
"to",
"the",
"group",
"of",
"the",
"given",
"post",
"according",
"to",
"the",
"given",
"language"
] | 3fdfbd4ba48947df0ee4c6d42e3a1c812b6dd95d | https://github.com/nephila/djangocms-blog/blob/3fdfbd4ba48947df0ee4c6d42e3a1c812b6dd95d/djangocms_blog/liveblog/consumers.py#L11-L30 |
17,739 | nephila/djangocms-blog | djangocms_blog/liveblog/consumers.py | liveblog_disconnect | def liveblog_disconnect(message, apphook, lang, post):
"""
Disconnect users to the group of the given post according to the given language
Return with an error message if a post cannot be found
:param message: channel connect message
:param apphook: apphook config namespace
:param lang: langua... | python | def liveblog_disconnect(message, apphook, lang, post):
"""
Disconnect users to the group of the given post according to the given language
Return with an error message if a post cannot be found
:param message: channel connect message
:param apphook: apphook config namespace
:param lang: langua... | [
"def",
"liveblog_disconnect",
"(",
"message",
",",
"apphook",
",",
"lang",
",",
"post",
")",
":",
"try",
":",
"post",
"=",
"Post",
".",
"objects",
".",
"namespace",
"(",
"apphook",
")",
".",
"language",
"(",
"lang",
")",
".",
"active_translations",
"(",
... | Disconnect users to the group of the given post according to the given language
Return with an error message if a post cannot be found
:param message: channel connect message
:param apphook: apphook config namespace
:param lang: language
:param post: post slug | [
"Disconnect",
"users",
"to",
"the",
"group",
"of",
"the",
"given",
"post",
"according",
"to",
"the",
"given",
"language"
] | 3fdfbd4ba48947df0ee4c6d42e3a1c812b6dd95d | https://github.com/nephila/djangocms-blog/blob/3fdfbd4ba48947df0ee4c6d42e3a1c812b6dd95d/djangocms_blog/liveblog/consumers.py#L33-L51 |
17,740 | tchellomello/python-amcrest | src/amcrest/video.py | Video.video_in_option | def video_in_option(self, param, profile='Day'):
"""
Return video input option.
Params:
param - parameter, such as 'DayNightColor'
profile - 'Day', 'Night' or 'Normal'
"""
if profile == 'Day':
field = param
else:
field = '{... | python | def video_in_option(self, param, profile='Day'):
"""
Return video input option.
Params:
param - parameter, such as 'DayNightColor'
profile - 'Day', 'Night' or 'Normal'
"""
if profile == 'Day':
field = param
else:
field = '{... | [
"def",
"video_in_option",
"(",
"self",
",",
"param",
",",
"profile",
"=",
"'Day'",
")",
":",
"if",
"profile",
"==",
"'Day'",
":",
"field",
"=",
"param",
"else",
":",
"field",
"=",
"'{}Options.{}'",
".",
"format",
"(",
"profile",
",",
"param",
")",
"ret... | Return video input option.
Params:
param - parameter, such as 'DayNightColor'
profile - 'Day', 'Night' or 'Normal' | [
"Return",
"video",
"input",
"option",
"."
] | ed842139e234de2eaf6ee8fb480214711cde1249 | https://github.com/tchellomello/python-amcrest/blob/ed842139e234de2eaf6ee8fb480214711cde1249/src/amcrest/video.py#L132-L146 |
17,741 | tchellomello/python-amcrest | src/amcrest/http.py | Http._generate_token | def _generate_token(self):
"""Create authentation to use with requests."""
session = self.get_session()
url = self.__base_url('magicBox.cgi?action=getMachineName')
try:
# try old basic method
auth = requests.auth.HTTPBasicAuth(self._user, self._password)
... | python | def _generate_token(self):
"""Create authentation to use with requests."""
session = self.get_session()
url = self.__base_url('magicBox.cgi?action=getMachineName')
try:
# try old basic method
auth = requests.auth.HTTPBasicAuth(self._user, self._password)
... | [
"def",
"_generate_token",
"(",
"self",
")",
":",
"session",
"=",
"self",
".",
"get_session",
"(",
")",
"url",
"=",
"self",
".",
"__base_url",
"(",
"'magicBox.cgi?action=getMachineName'",
")",
"try",
":",
"# try old basic method",
"auth",
"=",
"requests",
".",
... | Create authentation to use with requests. | [
"Create",
"authentation",
"to",
"use",
"with",
"requests",
"."
] | ed842139e234de2eaf6ee8fb480214711cde1249 | https://github.com/tchellomello/python-amcrest/blob/ed842139e234de2eaf6ee8fb480214711cde1249/src/amcrest/http.py#L73-L99 |
17,742 | tchellomello/python-amcrest | src/amcrest/http.py | Http._set_name | def _set_name(self):
"""Set device name."""
try:
self._name = pretty(self.machine_name)
self._serial = self.serial_number
except AttributeError:
self._name = None
self._serial = None | python | def _set_name(self):
"""Set device name."""
try:
self._name = pretty(self.machine_name)
self._serial = self.serial_number
except AttributeError:
self._name = None
self._serial = None | [
"def",
"_set_name",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"_name",
"=",
"pretty",
"(",
"self",
".",
"machine_name",
")",
"self",
".",
"_serial",
"=",
"self",
".",
"serial_number",
"except",
"AttributeError",
":",
"self",
".",
"_name",
"=",
"N... | Set device name. | [
"Set",
"device",
"name",
"."
] | ed842139e234de2eaf6ee8fb480214711cde1249 | https://github.com/tchellomello/python-amcrest/blob/ed842139e234de2eaf6ee8fb480214711cde1249/src/amcrest/http.py#L101-L108 |
17,743 | tchellomello/python-amcrest | src/amcrest/utils.py | to_unit | def to_unit(value, unit='B'):
"""Convert bytes to give unit."""
byte_array = ['B', 'KB', 'MB', 'GB', 'TB']
if not isinstance(value, (int, float)):
value = float(value)
if unit in byte_array:
result = value / 1024**byte_array.index(unit)
return round(result, PRECISION), unit
... | python | def to_unit(value, unit='B'):
"""Convert bytes to give unit."""
byte_array = ['B', 'KB', 'MB', 'GB', 'TB']
if not isinstance(value, (int, float)):
value = float(value)
if unit in byte_array:
result = value / 1024**byte_array.index(unit)
return round(result, PRECISION), unit
... | [
"def",
"to_unit",
"(",
"value",
",",
"unit",
"=",
"'B'",
")",
":",
"byte_array",
"=",
"[",
"'B'",
",",
"'KB'",
",",
"'MB'",
",",
"'GB'",
",",
"'TB'",
"]",
"if",
"not",
"isinstance",
"(",
"value",
",",
"(",
"int",
",",
"float",
")",
")",
":",
"v... | Convert bytes to give unit. | [
"Convert",
"bytes",
"to",
"give",
"unit",
"."
] | ed842139e234de2eaf6ee8fb480214711cde1249 | https://github.com/tchellomello/python-amcrest/blob/ed842139e234de2eaf6ee8fb480214711cde1249/src/amcrest/utils.py#L57-L68 |
17,744 | tchellomello/python-amcrest | src/amcrest/special.py | Special.realtime_stream | def realtime_stream(self, channel=1, typeno=0, path_file=None):
"""
If the stream is redirect to a file, use mplayer tool to
visualize the video record
camera.realtime_stream(path_file="/home/user/Desktop/myvideo)
$ mplayer /home/user/Desktop/myvideo
"""
ret = se... | python | def realtime_stream(self, channel=1, typeno=0, path_file=None):
"""
If the stream is redirect to a file, use mplayer tool to
visualize the video record
camera.realtime_stream(path_file="/home/user/Desktop/myvideo)
$ mplayer /home/user/Desktop/myvideo
"""
ret = se... | [
"def",
"realtime_stream",
"(",
"self",
",",
"channel",
"=",
"1",
",",
"typeno",
"=",
"0",
",",
"path_file",
"=",
"None",
")",
":",
"ret",
"=",
"self",
".",
"command",
"(",
"'realmonitor.cgi?action=getStream&channel={0}&subtype={1}'",
".",
"format",
"(",
"chann... | If the stream is redirect to a file, use mplayer tool to
visualize the video record
camera.realtime_stream(path_file="/home/user/Desktop/myvideo)
$ mplayer /home/user/Desktop/myvideo | [
"If",
"the",
"stream",
"is",
"redirect",
"to",
"a",
"file",
"use",
"mplayer",
"tool",
"to",
"visualize",
"the",
"video",
"record"
] | ed842139e234de2eaf6ee8fb480214711cde1249 | https://github.com/tchellomello/python-amcrest/blob/ed842139e234de2eaf6ee8fb480214711cde1249/src/amcrest/special.py#L20-L37 |
17,745 | tchellomello/python-amcrest | src/amcrest/special.py | Special.rtsp_url | def rtsp_url(self, channelno=None, typeno=None):
"""
Return RTSP streaming url
Params:
channelno: integer, the video channel index which starts from 1,
default 1 if not specified.
typeno: the stream type, default 0 if not specified. It can be
... | python | def rtsp_url(self, channelno=None, typeno=None):
"""
Return RTSP streaming url
Params:
channelno: integer, the video channel index which starts from 1,
default 1 if not specified.
typeno: the stream type, default 0 if not specified. It can be
... | [
"def",
"rtsp_url",
"(",
"self",
",",
"channelno",
"=",
"None",
",",
"typeno",
"=",
"None",
")",
":",
"if",
"channelno",
"is",
"None",
":",
"channelno",
"=",
"1",
"if",
"typeno",
"is",
"None",
":",
"typeno",
"=",
"0",
"cmd",
"=",
"'cam/realmonitor?chann... | Return RTSP streaming url
Params:
channelno: integer, the video channel index which starts from 1,
default 1 if not specified.
typeno: the stream type, default 0 if not specified. It can be
the following value:
0-Main Stre... | [
"Return",
"RTSP",
"streaming",
"url"
] | ed842139e234de2eaf6ee8fb480214711cde1249 | https://github.com/tchellomello/python-amcrest/blob/ed842139e234de2eaf6ee8fb480214711cde1249/src/amcrest/special.py#L39-L69 |
17,746 | tchellomello/python-amcrest | src/amcrest/special.py | Special.mjpeg_url | def mjpeg_url(self, channelno=None, typeno=None):
"""
Return MJPEG streaming url
Params:
channelno: integer, the video channel index which starts from 1,
default 1 if not specified.
typeno: the stream type, default 0 if not specified. It can be
... | python | def mjpeg_url(self, channelno=None, typeno=None):
"""
Return MJPEG streaming url
Params:
channelno: integer, the video channel index which starts from 1,
default 1 if not specified.
typeno: the stream type, default 0 if not specified. It can be
... | [
"def",
"mjpeg_url",
"(",
"self",
",",
"channelno",
"=",
"None",
",",
"typeno",
"=",
"None",
")",
":",
"if",
"channelno",
"is",
"None",
":",
"channelno",
"=",
"0",
"if",
"typeno",
"is",
"None",
":",
"typeno",
"=",
"1",
"cmd",
"=",
"\"mjpg/video.cgi?chan... | Return MJPEG streaming url
Params:
channelno: integer, the video channel index which starts from 1,
default 1 if not specified.
typeno: the stream type, default 0 if not specified. It can be
the following value:
0-Main Str... | [
"Return",
"MJPEG",
"streaming",
"url"
] | ed842139e234de2eaf6ee8fb480214711cde1249 | https://github.com/tchellomello/python-amcrest/blob/ed842139e234de2eaf6ee8fb480214711cde1249/src/amcrest/special.py#L95-L118 |
17,747 | tchellomello/python-amcrest | src/amcrest/network.py | Network.scan_devices | def scan_devices(self, subnet, timeout=None):
"""
Scan cameras in a range of ips
Params:
subnet - subnet, i.e: 192.168.1.0/24
if mask not used, assuming mask 24
timeout_sec - timeout in sec
Returns:
"""
# Maximum range from mask
... | python | def scan_devices(self, subnet, timeout=None):
"""
Scan cameras in a range of ips
Params:
subnet - subnet, i.e: 192.168.1.0/24
if mask not used, assuming mask 24
timeout_sec - timeout in sec
Returns:
"""
# Maximum range from mask
... | [
"def",
"scan_devices",
"(",
"self",
",",
"subnet",
",",
"timeout",
"=",
"None",
")",
":",
"# Maximum range from mask",
"# Format is mask: max_range",
"max_range",
"=",
"{",
"16",
":",
"256",
",",
"24",
":",
"256",
",",
"25",
":",
"128",
",",
"27",
":",
"... | Scan cameras in a range of ips
Params:
subnet - subnet, i.e: 192.168.1.0/24
if mask not used, assuming mask 24
timeout_sec - timeout in sec
Returns: | [
"Scan",
"cameras",
"in",
"a",
"range",
"of",
"ips"
] | ed842139e234de2eaf6ee8fb480214711cde1249 | https://github.com/tchellomello/python-amcrest/blob/ed842139e234de2eaf6ee8fb480214711cde1249/src/amcrest/network.py#L41-L109 |
17,748 | peerplays-network/python-peerplays | peerplays/peerplays.py | PeerPlays.disallow | def disallow(
self, foreign, permission="active", account=None, threshold=None, **kwargs
):
""" Remove additional access to an account by some other public
key or account.
:param str foreign: The foreign account that will obtain access
:param str permission: (opt... | python | def disallow(
self, foreign, permission="active", account=None, threshold=None, **kwargs
):
""" Remove additional access to an account by some other public
key or account.
:param str foreign: The foreign account that will obtain access
:param str permission: (opt... | [
"def",
"disallow",
"(",
"self",
",",
"foreign",
",",
"permission",
"=",
"\"active\"",
",",
"account",
"=",
"None",
",",
"threshold",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"account",
":",
"if",
"\"default_account\"",
"in",
"self",
... | Remove additional access to an account by some other public
key or account.
:param str foreign: The foreign account that will obtain access
:param str permission: (optional) The actual permission to
modify (defaults to ``active``)
:param str account: (opt... | [
"Remove",
"additional",
"access",
"to",
"an",
"account",
"by",
"some",
"other",
"public",
"key",
"or",
"account",
"."
] | 188f04238e7e21d5f73e9b01099eea44289ef6b7 | https://github.com/peerplays-network/python-peerplays/blob/188f04238e7e21d5f73e9b01099eea44289ef6b7/peerplays/peerplays.py#L439-L520 |
17,749 | peerplays-network/python-peerplays | peerplays/peerplays.py | PeerPlays.approvewitness | def approvewitness(self, witnesses, account=None, **kwargs):
""" Approve a witness
:param list witnesses: list of Witness name or id
:param str account: (optional) the account to allow access
to (defaults to ``default_account``)
"""
if not account:
... | python | def approvewitness(self, witnesses, account=None, **kwargs):
""" Approve a witness
:param list witnesses: list of Witness name or id
:param str account: (optional) the account to allow access
to (defaults to ``default_account``)
"""
if not account:
... | [
"def",
"approvewitness",
"(",
"self",
",",
"witnesses",
",",
"account",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"account",
":",
"if",
"\"default_account\"",
"in",
"self",
".",
"config",
":",
"account",
"=",
"self",
".",
"config",
"... | Approve a witness
:param list witnesses: list of Witness name or id
:param str account: (optional) the account to allow access
to (defaults to ``default_account``) | [
"Approve",
"a",
"witness"
] | 188f04238e7e21d5f73e9b01099eea44289ef6b7 | https://github.com/peerplays-network/python-peerplays/blob/188f04238e7e21d5f73e9b01099eea44289ef6b7/peerplays/peerplays.py#L556-L592 |
17,750 | peerplays-network/python-peerplays | peerplays/peerplays.py | PeerPlays.approvecommittee | def approvecommittee(self, committees, account=None, **kwargs):
""" Approve a committee
:param list committees: list of committee member name or id
:param str account: (optional) the account to allow access
to (defaults to ``default_account``)
"""
if not ... | python | def approvecommittee(self, committees, account=None, **kwargs):
""" Approve a committee
:param list committees: list of committee member name or id
:param str account: (optional) the account to allow access
to (defaults to ``default_account``)
"""
if not ... | [
"def",
"approvecommittee",
"(",
"self",
",",
"committees",
",",
"account",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"account",
":",
"if",
"\"default_account\"",
"in",
"self",
".",
"config",
":",
"account",
"=",
"self",
".",
"config",
... | Approve a committee
:param list committees: list of committee member name or id
:param str account: (optional) the account to allow access
to (defaults to ``default_account``) | [
"Approve",
"a",
"committee"
] | 188f04238e7e21d5f73e9b01099eea44289ef6b7 | https://github.com/peerplays-network/python-peerplays/blob/188f04238e7e21d5f73e9b01099eea44289ef6b7/peerplays/peerplays.py#L633-L669 |
17,751 | peerplays-network/python-peerplays | peerplays/peerplays.py | PeerPlays.betting_market_rules_create | def betting_market_rules_create(self, names, descriptions, account=None, **kwargs):
""" Create betting market rules
:param list names: Internationalized names, e.g. ``[['de', 'Foo'],
['en', 'bar']]``
:param list descriptions: Internationalized descriptions, e.g.
... | python | def betting_market_rules_create(self, names, descriptions, account=None, **kwargs):
""" Create betting market rules
:param list names: Internationalized names, e.g. ``[['de', 'Foo'],
['en', 'bar']]``
:param list descriptions: Internationalized descriptions, e.g.
... | [
"def",
"betting_market_rules_create",
"(",
"self",
",",
"names",
",",
"descriptions",
",",
"account",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"assert",
"isinstance",
"(",
"names",
",",
"list",
")",
"assert",
"isinstance",
"(",
"descriptions",
",",
... | Create betting market rules
:param list names: Internationalized names, e.g. ``[['de', 'Foo'],
['en', 'bar']]``
:param list descriptions: Internationalized descriptions, e.g.
``[['de', 'Foo'], ['en', 'bar']]``
:param str account: (optional) the accoun... | [
"Create",
"betting",
"market",
"rules"
] | 188f04238e7e21d5f73e9b01099eea44289ef6b7 | https://github.com/peerplays-network/python-peerplays/blob/188f04238e7e21d5f73e9b01099eea44289ef6b7/peerplays/peerplays.py#L1149-L1176 |
17,752 | peerplays-network/python-peerplays | peerplays/peerplays.py | PeerPlays.betting_market_rules_update | def betting_market_rules_update(
self, rules_id, names, descriptions, account=None, **kwargs
):
""" Update betting market rules
:param str rules_id: Id of the betting market rules to update
:param list names: Internationalized names, e.g. ``[['de', 'Foo'],
['... | python | def betting_market_rules_update(
self, rules_id, names, descriptions, account=None, **kwargs
):
""" Update betting market rules
:param str rules_id: Id of the betting market rules to update
:param list names: Internationalized names, e.g. ``[['de', 'Foo'],
['... | [
"def",
"betting_market_rules_update",
"(",
"self",
",",
"rules_id",
",",
"names",
",",
"descriptions",
",",
"account",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"assert",
"isinstance",
"(",
"names",
",",
"list",
")",
"assert",
"isinstance",
"(",
"des... | Update betting market rules
:param str rules_id: Id of the betting market rules to update
:param list names: Internationalized names, e.g. ``[['de', 'Foo'],
['en', 'bar']]``
:param list descriptions: Internationalized descriptions, e.g.
``[['de', 'Foo... | [
"Update",
"betting",
"market",
"rules"
] | 188f04238e7e21d5f73e9b01099eea44289ef6b7 | https://github.com/peerplays-network/python-peerplays/blob/188f04238e7e21d5f73e9b01099eea44289ef6b7/peerplays/peerplays.py#L1178-L1210 |
17,753 | peerplays-network/python-peerplays | peerplays/peerplays.py | PeerPlays.bet_place | def bet_place(
self,
betting_market_id,
amount_to_bet,
backer_multiplier,
back_or_lay,
account=None,
**kwargs
):
""" Place a bet
:param str betting_market_id: The identifier for the market to bet
in
:param peerp... | python | def bet_place(
self,
betting_market_id,
amount_to_bet,
backer_multiplier,
back_or_lay,
account=None,
**kwargs
):
""" Place a bet
:param str betting_market_id: The identifier for the market to bet
in
:param peerp... | [
"def",
"bet_place",
"(",
"self",
",",
"betting_market_id",
",",
"amount_to_bet",
",",
"backer_multiplier",
",",
"back_or_lay",
",",
"account",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
".",
"import",
"GRAPHENE_BETTING_ODDS_PRECISION",
"assert",
"is... | Place a bet
:param str betting_market_id: The identifier for the market to bet
in
:param peerplays.amount.Amount amount_to_bet: Amount to bet with
:param int backer_multiplier: Multipler for backer
:param str back_or_lay: "back" or "lay" the bet
... | [
"Place",
"a",
"bet"
] | 188f04238e7e21d5f73e9b01099eea44289ef6b7 | https://github.com/peerplays-network/python-peerplays/blob/188f04238e7e21d5f73e9b01099eea44289ef6b7/peerplays/peerplays.py#L1488-L1531 |
17,754 | peerplays-network/python-peerplays | peerplays/peerplays.py | PeerPlays.bet_cancel | def bet_cancel(self, bet_to_cancel, account=None, **kwargs):
""" Cancel a bet
:param str bet_to_cancel: The identifier that identifies the bet to
cancel
:param str account: (optional) the account that owns the bet
(defaults to ``default_account``)
... | python | def bet_cancel(self, bet_to_cancel, account=None, **kwargs):
""" Cancel a bet
:param str bet_to_cancel: The identifier that identifies the bet to
cancel
:param str account: (optional) the account that owns the bet
(defaults to ``default_account``)
... | [
"def",
"bet_cancel",
"(",
"self",
",",
"bet_to_cancel",
",",
"account",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"account",
":",
"if",
"\"default_account\"",
"in",
"self",
".",
"config",
":",
"account",
"=",
"self",
".",
"config",
"... | Cancel a bet
:param str bet_to_cancel: The identifier that identifies the bet to
cancel
:param str account: (optional) the account that owns the bet
(defaults to ``default_account``) | [
"Cancel",
"a",
"bet"
] | 188f04238e7e21d5f73e9b01099eea44289ef6b7 | https://github.com/peerplays-network/python-peerplays/blob/188f04238e7e21d5f73e9b01099eea44289ef6b7/peerplays/peerplays.py#L1533-L1556 |
17,755 | peerplays-network/python-peerplays | peerplays/cli/decorators.py | verbose | def verbose(f):
""" Add verbose flags and add logging handlers
"""
@click.pass_context
def new_func(ctx, *args, **kwargs):
global log
verbosity = ["critical", "error", "warn", "info", "debug"][
int(min(ctx.obj.get("verbose", 0), 4))
]
log.setLevel(getattr(log... | python | def verbose(f):
""" Add verbose flags and add logging handlers
"""
@click.pass_context
def new_func(ctx, *args, **kwargs):
global log
verbosity = ["critical", "error", "warn", "info", "debug"][
int(min(ctx.obj.get("verbose", 0), 4))
]
log.setLevel(getattr(log... | [
"def",
"verbose",
"(",
"f",
")",
":",
"@",
"click",
".",
"pass_context",
"def",
"new_func",
"(",
"ctx",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"global",
"log",
"verbosity",
"=",
"[",
"\"critical\"",
",",
"\"error\"",
",",
"\"warn\"",
",... | Add verbose flags and add logging handlers | [
"Add",
"verbose",
"flags",
"and",
"add",
"logging",
"handlers"
] | 188f04238e7e21d5f73e9b01099eea44289ef6b7 | https://github.com/peerplays-network/python-peerplays/blob/188f04238e7e21d5f73e9b01099eea44289ef6b7/peerplays/cli/decorators.py#L13-L51 |
17,756 | peerplays-network/python-peerplays | peerplays/cli/decorators.py | offline | def offline(f):
""" This decorator allows you to access ``ctx.peerplays`` which is
an instance of PeerPlays with ``offline=True``.
"""
@click.pass_context
@verbose
def new_func(ctx, *args, **kwargs):
ctx.obj["offline"] = True
ctx.peerplays = PeerPlays(**ctx.obj)
ctx.... | python | def offline(f):
""" This decorator allows you to access ``ctx.peerplays`` which is
an instance of PeerPlays with ``offline=True``.
"""
@click.pass_context
@verbose
def new_func(ctx, *args, **kwargs):
ctx.obj["offline"] = True
ctx.peerplays = PeerPlays(**ctx.obj)
ctx.... | [
"def",
"offline",
"(",
"f",
")",
":",
"@",
"click",
".",
"pass_context",
"@",
"verbose",
"def",
"new_func",
"(",
"ctx",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
".",
"obj",
"[",
"\"offline\"",
"]",
"=",
"True",
"ctx",
".",
"pee... | This decorator allows you to access ``ctx.peerplays`` which is
an instance of PeerPlays with ``offline=True``. | [
"This",
"decorator",
"allows",
"you",
"to",
"access",
"ctx",
".",
"peerplays",
"which",
"is",
"an",
"instance",
"of",
"PeerPlays",
"with",
"offline",
"=",
"True",
"."
] | 188f04238e7e21d5f73e9b01099eea44289ef6b7 | https://github.com/peerplays-network/python-peerplays/blob/188f04238e7e21d5f73e9b01099eea44289ef6b7/peerplays/cli/decorators.py#L54-L68 |
17,757 | peerplays-network/python-peerplays | peerplays/cli/decorators.py | configfile | def configfile(f):
""" This decorator will parse a configuration file in YAML format
and store the dictionary in ``ctx.blockchain.config``
"""
@click.pass_context
def new_func(ctx, *args, **kwargs):
ctx.config = yaml.load(open(ctx.obj["configfile"]))
return ctx.invoke(f, *args, ... | python | def configfile(f):
""" This decorator will parse a configuration file in YAML format
and store the dictionary in ``ctx.blockchain.config``
"""
@click.pass_context
def new_func(ctx, *args, **kwargs):
ctx.config = yaml.load(open(ctx.obj["configfile"]))
return ctx.invoke(f, *args, ... | [
"def",
"configfile",
"(",
"f",
")",
":",
"@",
"click",
".",
"pass_context",
"def",
"new_func",
"(",
"ctx",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
".",
"config",
"=",
"yaml",
".",
"load",
"(",
"open",
"(",
"ctx",
".",
"obj",
... | This decorator will parse a configuration file in YAML format
and store the dictionary in ``ctx.blockchain.config`` | [
"This",
"decorator",
"will",
"parse",
"a",
"configuration",
"file",
"in",
"YAML",
"format",
"and",
"store",
"the",
"dictionary",
"in",
"ctx",
".",
"blockchain",
".",
"config"
] | 188f04238e7e21d5f73e9b01099eea44289ef6b7 | https://github.com/peerplays-network/python-peerplays/blob/188f04238e7e21d5f73e9b01099eea44289ef6b7/peerplays/cli/decorators.py#L154-L164 |
17,758 | peerplays-network/python-peerplays | peerplaysapi/websocket.py | PeerPlaysWebsocket.on_message | def on_message(self, ws, reply, *args):
""" This method is called by the websocket connection on every
message that is received. If we receive a ``notice``, we
hand over post-processing and signalling of events to
``process_notice``.
"""
log.debug("Received me... | python | def on_message(self, ws, reply, *args):
""" This method is called by the websocket connection on every
message that is received. If we receive a ``notice``, we
hand over post-processing and signalling of events to
``process_notice``.
"""
log.debug("Received me... | [
"def",
"on_message",
"(",
"self",
",",
"ws",
",",
"reply",
",",
"*",
"args",
")",
":",
"log",
".",
"debug",
"(",
"\"Received message: %s\"",
"%",
"str",
"(",
"reply",
")",
")",
"data",
"=",
"{",
"}",
"try",
":",
"data",
"=",
"json",
".",
"loads",
... | This method is called by the websocket connection on every
message that is received. If we receive a ``notice``, we
hand over post-processing and signalling of events to
``process_notice``. | [
"This",
"method",
"is",
"called",
"by",
"the",
"websocket",
"connection",
"on",
"every",
"message",
"that",
"is",
"received",
".",
"If",
"we",
"receive",
"a",
"notice",
"we",
"hand",
"over",
"post",
"-",
"processing",
"and",
"signalling",
"of",
"events",
"... | 188f04238e7e21d5f73e9b01099eea44289ef6b7 | https://github.com/peerplays-network/python-peerplays/blob/188f04238e7e21d5f73e9b01099eea44289ef6b7/peerplaysapi/websocket.py#L216-L263 |
17,759 | peerplays-network/python-peerplays | peerplaysapi/websocket.py | PeerPlaysWebsocket.on_close | def on_close(self, ws):
""" Called when websocket connection is closed
"""
log.debug("Closing WebSocket connection with {}".format(self.url))
if self.keepalive and self.keepalive.is_alive():
self.keepalive.do_run = False
self.keepalive.join() | python | def on_close(self, ws):
""" Called when websocket connection is closed
"""
log.debug("Closing WebSocket connection with {}".format(self.url))
if self.keepalive and self.keepalive.is_alive():
self.keepalive.do_run = False
self.keepalive.join() | [
"def",
"on_close",
"(",
"self",
",",
"ws",
")",
":",
"log",
".",
"debug",
"(",
"\"Closing WebSocket connection with {}\"",
".",
"format",
"(",
"self",
".",
"url",
")",
")",
"if",
"self",
".",
"keepalive",
"and",
"self",
".",
"keepalive",
".",
"is_alive",
... | Called when websocket connection is closed | [
"Called",
"when",
"websocket",
"connection",
"is",
"closed"
] | 188f04238e7e21d5f73e9b01099eea44289ef6b7 | https://github.com/peerplays-network/python-peerplays/blob/188f04238e7e21d5f73e9b01099eea44289ef6b7/peerplaysapi/websocket.py#L270-L276 |
17,760 | peerplays-network/python-peerplays | peerplaysapi/websocket.py | PeerPlaysWebsocket.run_forever | def run_forever(self):
""" This method is used to run the websocket app continuously.
It will execute callbacks as defined and try to stay
connected with the provided APIs
"""
cnt = 0
while True:
cnt += 1
self.url = next(self.urls)
... | python | def run_forever(self):
""" This method is used to run the websocket app continuously.
It will execute callbacks as defined and try to stay
connected with the provided APIs
"""
cnt = 0
while True:
cnt += 1
self.url = next(self.urls)
... | [
"def",
"run_forever",
"(",
"self",
")",
":",
"cnt",
"=",
"0",
"while",
"True",
":",
"cnt",
"+=",
"1",
"self",
".",
"url",
"=",
"next",
"(",
"self",
".",
"urls",
")",
"log",
".",
"debug",
"(",
"\"Trying to connect to node %s\"",
"%",
"self",
".",
"url... | This method is used to run the websocket app continuously.
It will execute callbacks as defined and try to stay
connected with the provided APIs | [
"This",
"method",
"is",
"used",
"to",
"run",
"the",
"websocket",
"app",
"continuously",
".",
"It",
"will",
"execute",
"callbacks",
"as",
"defined",
"and",
"try",
"to",
"stay",
"connected",
"with",
"the",
"provided",
"APIs"
] | 188f04238e7e21d5f73e9b01099eea44289ef6b7 | https://github.com/peerplays-network/python-peerplays/blob/188f04238e7e21d5f73e9b01099eea44289ef6b7/peerplaysapi/websocket.py#L278-L317 |
17,761 | Zsailer/pandas_flavor | pandas_flavor/register.py | register_dataframe_method | def register_dataframe_method(method):
"""Register a function as a method attached to the Pandas DataFrame.
Example
-------
.. code-block:: python
@register_dataframe_method
def print_column(df, col):
'''Print the dataframe column given'''
print(df[col])
""... | python | def register_dataframe_method(method):
"""Register a function as a method attached to the Pandas DataFrame.
Example
-------
.. code-block:: python
@register_dataframe_method
def print_column(df, col):
'''Print the dataframe column given'''
print(df[col])
""... | [
"def",
"register_dataframe_method",
"(",
"method",
")",
":",
"def",
"inner",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"class",
"AccessorMethod",
"(",
"object",
")",
":",
"def",
"__init__",
"(",
"self",
",",
"pandas_obj",
")",
":",
"self",
"... | Register a function as a method attached to the Pandas DataFrame.
Example
-------
.. code-block:: python
@register_dataframe_method
def print_column(df, col):
'''Print the dataframe column given'''
print(df[col]) | [
"Register",
"a",
"function",
"as",
"a",
"method",
"attached",
"to",
"the",
"Pandas",
"DataFrame",
"."
] | 1953aeee09424300d69a11dd2ffd3460a806fb65 | https://github.com/Zsailer/pandas_flavor/blob/1953aeee09424300d69a11dd2ffd3460a806fb65/pandas_flavor/register.py#L6-L35 |
17,762 | Zsailer/pandas_flavor | pandas_flavor/register.py | register_series_method | def register_series_method(method):
"""Register a function as a method attached to the Pandas Series.
"""
def inner(*args, **kwargs):
class AccessorMethod(object):
__doc__ = method.__doc__
def __init__(self, pandas_obj):
self._obj = pandas_obj
@... | python | def register_series_method(method):
"""Register a function as a method attached to the Pandas Series.
"""
def inner(*args, **kwargs):
class AccessorMethod(object):
__doc__ = method.__doc__
def __init__(self, pandas_obj):
self._obj = pandas_obj
@... | [
"def",
"register_series_method",
"(",
"method",
")",
":",
"def",
"inner",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"class",
"AccessorMethod",
"(",
"object",
")",
":",
"__doc__",
"=",
"method",
".",
"__doc__",
"def",
"__init__",
"(",
"self",
... | Register a function as a method attached to the Pandas Series. | [
"Register",
"a",
"function",
"as",
"a",
"method",
"attached",
"to",
"the",
"Pandas",
"Series",
"."
] | 1953aeee09424300d69a11dd2ffd3460a806fb65 | https://github.com/Zsailer/pandas_flavor/blob/1953aeee09424300d69a11dd2ffd3460a806fb65/pandas_flavor/register.py#L38-L57 |
17,763 | pinax/pinax-invitations | pinax/invitations/models.py | InvitationStat.add_invites_to_user | def add_invites_to_user(cls, user, amount):
"""
Add the specified number of invites to current allocated total.
"""
stat, _ = InvitationStat.objects.get_or_create(user=user)
if stat.invites_allocated != -1:
stat.invites_allocated += amount
stat.save() | python | def add_invites_to_user(cls, user, amount):
"""
Add the specified number of invites to current allocated total.
"""
stat, _ = InvitationStat.objects.get_or_create(user=user)
if stat.invites_allocated != -1:
stat.invites_allocated += amount
stat.save() | [
"def",
"add_invites_to_user",
"(",
"cls",
",",
"user",
",",
"amount",
")",
":",
"stat",
",",
"_",
"=",
"InvitationStat",
".",
"objects",
".",
"get_or_create",
"(",
"user",
"=",
"user",
")",
"if",
"stat",
".",
"invites_allocated",
"!=",
"-",
"1",
":",
"... | Add the specified number of invites to current allocated total. | [
"Add",
"the",
"specified",
"number",
"of",
"invites",
"to",
"current",
"allocated",
"total",
"."
] | 6c6e863da179a1c620074efe5b5728cd1e6eff1b | https://github.com/pinax/pinax-invitations/blob/6c6e863da179a1c620074efe5b5728cd1e6eff1b/pinax/invitations/models.py#L111-L118 |
17,764 | pinax/pinax-invitations | pinax/invitations/models.py | InvitationStat.add_invites | def add_invites(cls, amount):
"""
Add invites for all users.
"""
for user in get_user_model().objects.all():
cls.add_invites_to_user(user, amount) | python | def add_invites(cls, amount):
"""
Add invites for all users.
"""
for user in get_user_model().objects.all():
cls.add_invites_to_user(user, amount) | [
"def",
"add_invites",
"(",
"cls",
",",
"amount",
")",
":",
"for",
"user",
"in",
"get_user_model",
"(",
")",
".",
"objects",
".",
"all",
"(",
")",
":",
"cls",
".",
"add_invites_to_user",
"(",
"user",
",",
"amount",
")"
] | Add invites for all users. | [
"Add",
"invites",
"for",
"all",
"users",
"."
] | 6c6e863da179a1c620074efe5b5728cd1e6eff1b | https://github.com/pinax/pinax-invitations/blob/6c6e863da179a1c620074efe5b5728cd1e6eff1b/pinax/invitations/models.py#L121-L126 |
17,765 | pinax/pinax-invitations | pinax/invitations/models.py | InvitationStat.topoff_user | def topoff_user(cls, user, amount):
"""
Ensure user has a minimum number of invites.
"""
stat, _ = cls.objects.get_or_create(user=user)
remaining = stat.invites_remaining()
if remaining != -1 and remaining < amount:
stat.invites_allocated += (amount - remainin... | python | def topoff_user(cls, user, amount):
"""
Ensure user has a minimum number of invites.
"""
stat, _ = cls.objects.get_or_create(user=user)
remaining = stat.invites_remaining()
if remaining != -1 and remaining < amount:
stat.invites_allocated += (amount - remainin... | [
"def",
"topoff_user",
"(",
"cls",
",",
"user",
",",
"amount",
")",
":",
"stat",
",",
"_",
"=",
"cls",
".",
"objects",
".",
"get_or_create",
"(",
"user",
"=",
"user",
")",
"remaining",
"=",
"stat",
".",
"invites_remaining",
"(",
")",
"if",
"remaining",
... | Ensure user has a minimum number of invites. | [
"Ensure",
"user",
"has",
"a",
"minimum",
"number",
"of",
"invites",
"."
] | 6c6e863da179a1c620074efe5b5728cd1e6eff1b | https://github.com/pinax/pinax-invitations/blob/6c6e863da179a1c620074efe5b5728cd1e6eff1b/pinax/invitations/models.py#L129-L137 |
17,766 | pinax/pinax-invitations | pinax/invitations/models.py | InvitationStat.topoff | def topoff(cls, amount):
"""
Ensure all users have a minimum number of invites.
"""
for user in get_user_model().objects.all():
cls.topoff_user(user, amount) | python | def topoff(cls, amount):
"""
Ensure all users have a minimum number of invites.
"""
for user in get_user_model().objects.all():
cls.topoff_user(user, amount) | [
"def",
"topoff",
"(",
"cls",
",",
"amount",
")",
":",
"for",
"user",
"in",
"get_user_model",
"(",
")",
".",
"objects",
".",
"all",
"(",
")",
":",
"cls",
".",
"topoff_user",
"(",
"user",
",",
"amount",
")"
] | Ensure all users have a minimum number of invites. | [
"Ensure",
"all",
"users",
"have",
"a",
"minimum",
"number",
"of",
"invites",
"."
] | 6c6e863da179a1c620074efe5b5728cd1e6eff1b | https://github.com/pinax/pinax-invitations/blob/6c6e863da179a1c620074efe5b5728cd1e6eff1b/pinax/invitations/models.py#L140-L145 |
17,767 | skelsec/minidump | minidump/minidumpreader.py | MinidumpBufferedReader.align | def align(self, alignment = None):
"""
Repositions the current reader to match architecture alignment
"""
if alignment is None:
if self.reader.sysinfo.ProcessorArchitecture == PROCESSOR_ARCHITECTURE.AMD64:
alignment = 8
else:
alignment = 4
offset = self.current_position % alignment
if offset =... | python | def align(self, alignment = None):
"""
Repositions the current reader to match architecture alignment
"""
if alignment is None:
if self.reader.sysinfo.ProcessorArchitecture == PROCESSOR_ARCHITECTURE.AMD64:
alignment = 8
else:
alignment = 4
offset = self.current_position % alignment
if offset =... | [
"def",
"align",
"(",
"self",
",",
"alignment",
"=",
"None",
")",
":",
"if",
"alignment",
"is",
"None",
":",
"if",
"self",
".",
"reader",
".",
"sysinfo",
".",
"ProcessorArchitecture",
"==",
"PROCESSOR_ARCHITECTURE",
".",
"AMD64",
":",
"alignment",
"=",
"8",... | Repositions the current reader to match architecture alignment | [
"Repositions",
"the",
"current",
"reader",
"to",
"match",
"architecture",
"alignment"
] | 0c4dcabe6f11d7a403440919ffa9e3c9889c5212 | https://github.com/skelsec/minidump/blob/0c4dcabe6f11d7a403440919ffa9e3c9889c5212/minidump/minidumpreader.py#L87-L101 |
17,768 | skelsec/minidump | minidump/minidumpreader.py | MinidumpBufferedReader.peek | def peek(self, length):
"""
Returns up to length bytes from the current memory segment
"""
t = self.current_position + length
if not self.current_segment.inrange(t):
raise Exception('Would read over segment boundaries!')
return self.current_segment.data[self.current_position - self.current_segment.start_... | python | def peek(self, length):
"""
Returns up to length bytes from the current memory segment
"""
t = self.current_position + length
if not self.current_segment.inrange(t):
raise Exception('Would read over segment boundaries!')
return self.current_segment.data[self.current_position - self.current_segment.start_... | [
"def",
"peek",
"(",
"self",
",",
"length",
")",
":",
"t",
"=",
"self",
".",
"current_position",
"+",
"length",
"if",
"not",
"self",
".",
"current_segment",
".",
"inrange",
"(",
"t",
")",
":",
"raise",
"Exception",
"(",
"'Would read over segment boundaries!'"... | Returns up to length bytes from the current memory segment | [
"Returns",
"up",
"to",
"length",
"bytes",
"from",
"the",
"current",
"memory",
"segment"
] | 0c4dcabe6f11d7a403440919ffa9e3c9889c5212 | https://github.com/skelsec/minidump/blob/0c4dcabe6f11d7a403440919ffa9e3c9889c5212/minidump/minidumpreader.py#L109-L116 |
17,769 | skelsec/minidump | minidump/minidumpreader.py | MinidumpBufferedReader.read | def read(self, size = -1):
"""
Returns data bytes of size size from the current segment. If size is -1 it returns all the remaining data bytes from memory segment
"""
if size < -1:
raise Exception('You shouldnt be doing this')
if size == -1:
t = self.current_segment.remaining_len(self.current_position)
... | python | def read(self, size = -1):
"""
Returns data bytes of size size from the current segment. If size is -1 it returns all the remaining data bytes from memory segment
"""
if size < -1:
raise Exception('You shouldnt be doing this')
if size == -1:
t = self.current_segment.remaining_len(self.current_position)
... | [
"def",
"read",
"(",
"self",
",",
"size",
"=",
"-",
"1",
")",
":",
"if",
"size",
"<",
"-",
"1",
":",
"raise",
"Exception",
"(",
"'You shouldnt be doing this'",
")",
"if",
"size",
"==",
"-",
"1",
":",
"t",
"=",
"self",
".",
"current_segment",
".",
"r... | Returns data bytes of size size from the current segment. If size is -1 it returns all the remaining data bytes from memory segment | [
"Returns",
"data",
"bytes",
"of",
"size",
"size",
"from",
"the",
"current",
"segment",
".",
"If",
"size",
"is",
"-",
"1",
"it",
"returns",
"all",
"the",
"remaining",
"data",
"bytes",
"from",
"memory",
"segment"
] | 0c4dcabe6f11d7a403440919ffa9e3c9889c5212 | https://github.com/skelsec/minidump/blob/0c4dcabe6f11d7a403440919ffa9e3c9889c5212/minidump/minidumpreader.py#L118-L139 |
17,770 | skelsec/minidump | minidump/minidumpreader.py | MinidumpBufferedReader.read_int | def read_int(self):
"""
Reads an integer. The size depends on the architecture.
Reads a 4 byte small-endian singed int on 32 bit arch
Reads an 8 byte small-endian singed int on 64 bit arch
"""
if self.reader.sysinfo.ProcessorArchitecture == PROCESSOR_ARCHITECTURE.AMD64:
return int.from_bytes(self.read(8... | python | def read_int(self):
"""
Reads an integer. The size depends on the architecture.
Reads a 4 byte small-endian singed int on 32 bit arch
Reads an 8 byte small-endian singed int on 64 bit arch
"""
if self.reader.sysinfo.ProcessorArchitecture == PROCESSOR_ARCHITECTURE.AMD64:
return int.from_bytes(self.read(8... | [
"def",
"read_int",
"(",
"self",
")",
":",
"if",
"self",
".",
"reader",
".",
"sysinfo",
".",
"ProcessorArchitecture",
"==",
"PROCESSOR_ARCHITECTURE",
".",
"AMD64",
":",
"return",
"int",
".",
"from_bytes",
"(",
"self",
".",
"read",
"(",
"8",
")",
",",
"byt... | Reads an integer. The size depends on the architecture.
Reads a 4 byte small-endian singed int on 32 bit arch
Reads an 8 byte small-endian singed int on 64 bit arch | [
"Reads",
"an",
"integer",
".",
"The",
"size",
"depends",
"on",
"the",
"architecture",
".",
"Reads",
"a",
"4",
"byte",
"small",
"-",
"endian",
"singed",
"int",
"on",
"32",
"bit",
"arch",
"Reads",
"an",
"8",
"byte",
"small",
"-",
"endian",
"singed",
"int... | 0c4dcabe6f11d7a403440919ffa9e3c9889c5212 | https://github.com/skelsec/minidump/blob/0c4dcabe6f11d7a403440919ffa9e3c9889c5212/minidump/minidumpreader.py#L141-L150 |
17,771 | skelsec/minidump | minidump/minidumpreader.py | MinidumpBufferedReader.read_uint | def read_uint(self):
"""
Reads an integer. The size depends on the architecture.
Reads a 4 byte small-endian unsinged int on 32 bit arch
Reads an 8 byte small-endian unsinged int on 64 bit arch
"""
if self.reader.sysinfo.ProcessorArchitecture == PROCESSOR_ARCHITECTURE.AMD64:
return int.from_bytes(self.r... | python | def read_uint(self):
"""
Reads an integer. The size depends on the architecture.
Reads a 4 byte small-endian unsinged int on 32 bit arch
Reads an 8 byte small-endian unsinged int on 64 bit arch
"""
if self.reader.sysinfo.ProcessorArchitecture == PROCESSOR_ARCHITECTURE.AMD64:
return int.from_bytes(self.r... | [
"def",
"read_uint",
"(",
"self",
")",
":",
"if",
"self",
".",
"reader",
".",
"sysinfo",
".",
"ProcessorArchitecture",
"==",
"PROCESSOR_ARCHITECTURE",
".",
"AMD64",
":",
"return",
"int",
".",
"from_bytes",
"(",
"self",
".",
"read",
"(",
"8",
")",
",",
"by... | Reads an integer. The size depends on the architecture.
Reads a 4 byte small-endian unsinged int on 32 bit arch
Reads an 8 byte small-endian unsinged int on 64 bit arch | [
"Reads",
"an",
"integer",
".",
"The",
"size",
"depends",
"on",
"the",
"architecture",
".",
"Reads",
"a",
"4",
"byte",
"small",
"-",
"endian",
"unsinged",
"int",
"on",
"32",
"bit",
"arch",
"Reads",
"an",
"8",
"byte",
"small",
"-",
"endian",
"unsinged",
... | 0c4dcabe6f11d7a403440919ffa9e3c9889c5212 | https://github.com/skelsec/minidump/blob/0c4dcabe6f11d7a403440919ffa9e3c9889c5212/minidump/minidumpreader.py#L152-L161 |
17,772 | skelsec/minidump | minidump/minidumpreader.py | MinidumpBufferedReader.find | def find(self, pattern):
"""
Searches for a pattern in the current memory segment
"""
pos = self.current_segment.data.find(pattern)
if pos == -1:
return -1
return pos + self.current_position | python | def find(self, pattern):
"""
Searches for a pattern in the current memory segment
"""
pos = self.current_segment.data.find(pattern)
if pos == -1:
return -1
return pos + self.current_position | [
"def",
"find",
"(",
"self",
",",
"pattern",
")",
":",
"pos",
"=",
"self",
".",
"current_segment",
".",
"data",
".",
"find",
"(",
"pattern",
")",
"if",
"pos",
"==",
"-",
"1",
":",
"return",
"-",
"1",
"return",
"pos",
"+",
"self",
".",
"current_posit... | Searches for a pattern in the current memory segment | [
"Searches",
"for",
"a",
"pattern",
"in",
"the",
"current",
"memory",
"segment"
] | 0c4dcabe6f11d7a403440919ffa9e3c9889c5212 | https://github.com/skelsec/minidump/blob/0c4dcabe6f11d7a403440919ffa9e3c9889c5212/minidump/minidumpreader.py#L163-L170 |
17,773 | skelsec/minidump | minidump/minidumpreader.py | MinidumpBufferedReader.find_all | def find_all(self, pattern):
"""
Searches for all occurrences of a pattern in the current memory segment, returns all occurrences as a list
"""
pos = []
last_found = -1
while True:
last_found = self.current_segment.data.find(pattern, last_found + 1)
if last_found == -1:
break
pos.append(last_fo... | python | def find_all(self, pattern):
"""
Searches for all occurrences of a pattern in the current memory segment, returns all occurrences as a list
"""
pos = []
last_found = -1
while True:
last_found = self.current_segment.data.find(pattern, last_found + 1)
if last_found == -1:
break
pos.append(last_fo... | [
"def",
"find_all",
"(",
"self",
",",
"pattern",
")",
":",
"pos",
"=",
"[",
"]",
"last_found",
"=",
"-",
"1",
"while",
"True",
":",
"last_found",
"=",
"self",
".",
"current_segment",
".",
"data",
".",
"find",
"(",
"pattern",
",",
"last_found",
"+",
"1... | Searches for all occurrences of a pattern in the current memory segment, returns all occurrences as a list | [
"Searches",
"for",
"all",
"occurrences",
"of",
"a",
"pattern",
"in",
"the",
"current",
"memory",
"segment",
"returns",
"all",
"occurrences",
"as",
"a",
"list"
] | 0c4dcabe6f11d7a403440919ffa9e3c9889c5212 | https://github.com/skelsec/minidump/blob/0c4dcabe6f11d7a403440919ffa9e3c9889c5212/minidump/minidumpreader.py#L172-L184 |
17,774 | skelsec/minidump | minidump/minidumpreader.py | MinidumpBufferedReader.find_global | def find_global(self, pattern):
"""
Searches for the pattern in the whole process memory space and returns the first occurrence.
This is exhaustive!
"""
pos_s = self.reader.search(pattern)
if len(pos_s) == 0:
return -1
return pos_s[0] | python | def find_global(self, pattern):
"""
Searches for the pattern in the whole process memory space and returns the first occurrence.
This is exhaustive!
"""
pos_s = self.reader.search(pattern)
if len(pos_s) == 0:
return -1
return pos_s[0] | [
"def",
"find_global",
"(",
"self",
",",
"pattern",
")",
":",
"pos_s",
"=",
"self",
".",
"reader",
".",
"search",
"(",
"pattern",
")",
"if",
"len",
"(",
"pos_s",
")",
"==",
"0",
":",
"return",
"-",
"1",
"return",
"pos_s",
"[",
"0",
"]"
] | Searches for the pattern in the whole process memory space and returns the first occurrence.
This is exhaustive! | [
"Searches",
"for",
"the",
"pattern",
"in",
"the",
"whole",
"process",
"memory",
"space",
"and",
"returns",
"the",
"first",
"occurrence",
".",
"This",
"is",
"exhaustive!"
] | 0c4dcabe6f11d7a403440919ffa9e3c9889c5212 | https://github.com/skelsec/minidump/blob/0c4dcabe6f11d7a403440919ffa9e3c9889c5212/minidump/minidumpreader.py#L186-L195 |
17,775 | skelsec/minidump | minidump/utils/privileges.py | report_privilege_information | def report_privilege_information():
"Report all privilege information assigned to the current process."
privileges = get_privilege_information()
print("found {0} privileges".format(privileges.count))
tuple(map(print, privileges)) | python | def report_privilege_information():
"Report all privilege information assigned to the current process."
privileges = get_privilege_information()
print("found {0} privileges".format(privileges.count))
tuple(map(print, privileges)) | [
"def",
"report_privilege_information",
"(",
")",
":",
"privileges",
"=",
"get_privilege_information",
"(",
")",
"print",
"(",
"\"found {0} privileges\"",
".",
"format",
"(",
"privileges",
".",
"count",
")",
")",
"tuple",
"(",
"map",
"(",
"print",
",",
"privilege... | Report all privilege information assigned to the current process. | [
"Report",
"all",
"privilege",
"information",
"assigned",
"to",
"the",
"current",
"process",
"."
] | 0c4dcabe6f11d7a403440919ffa9e3c9889c5212 | https://github.com/skelsec/minidump/blob/0c4dcabe6f11d7a403440919ffa9e3c9889c5212/minidump/utils/privileges.py#L171-L175 |
17,776 | rajasimon/beatserver | beatserver/server.py | BeatServer.handle | async def handle(self):
"""
Listens on all the provided channels and handles the messages.
"""
# For each channel, launch its own listening coroutine
listeners = []
for key, value in self.beat_config.items():
listeners.append(asyncio.ensure_future(
... | python | async def handle(self):
"""
Listens on all the provided channels and handles the messages.
"""
# For each channel, launch its own listening coroutine
listeners = []
for key, value in self.beat_config.items():
listeners.append(asyncio.ensure_future(
... | [
"async",
"def",
"handle",
"(",
"self",
")",
":",
"# For each channel, launch its own listening coroutine",
"listeners",
"=",
"[",
"]",
"for",
"key",
",",
"value",
"in",
"self",
".",
"beat_config",
".",
"items",
"(",
")",
":",
"listeners",
".",
"append",
"(",
... | Listens on all the provided channels and handles the messages. | [
"Listens",
"on",
"all",
"the",
"provided",
"channels",
"and",
"handles",
"the",
"messages",
"."
] | 8c653c46cdcf98398ca9d0bc6d3e47e5d621bb6a | https://github.com/rajasimon/beatserver/blob/8c653c46cdcf98398ca9d0bc6d3e47e5d621bb6a/beatserver/server.py#L16-L37 |
17,777 | rajasimon/beatserver | beatserver/server.py | BeatServer.emitters | async def emitters(self, key, value):
"""
Single-channel emitter
"""
while True:
await asyncio.sleep(value['schedule'].total_seconds())
await self.channel_layer.send(key, {
"type": value['type'],
"message": value['message']
... | python | async def emitters(self, key, value):
"""
Single-channel emitter
"""
while True:
await asyncio.sleep(value['schedule'].total_seconds())
await self.channel_layer.send(key, {
"type": value['type'],
"message": value['message']
... | [
"async",
"def",
"emitters",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"while",
"True",
":",
"await",
"asyncio",
".",
"sleep",
"(",
"value",
"[",
"'schedule'",
"]",
".",
"total_seconds",
"(",
")",
")",
"await",
"self",
".",
"channel_layer",
".",
... | Single-channel emitter | [
"Single",
"-",
"channel",
"emitter"
] | 8c653c46cdcf98398ca9d0bc6d3e47e5d621bb6a | https://github.com/rajasimon/beatserver/blob/8c653c46cdcf98398ca9d0bc6d3e47e5d621bb6a/beatserver/server.py#L40-L50 |
17,778 | rajasimon/beatserver | beatserver/server.py | BeatServer.listener | async def listener(self, channel):
"""
Single-channel listener
"""
while True:
message = await self.channel_layer.receive(channel)
if not message.get("type", None):
raise ValueError("Worker received message with no type.")
# Make a scop... | python | async def listener(self, channel):
"""
Single-channel listener
"""
while True:
message = await self.channel_layer.receive(channel)
if not message.get("type", None):
raise ValueError("Worker received message with no type.")
# Make a scop... | [
"async",
"def",
"listener",
"(",
"self",
",",
"channel",
")",
":",
"while",
"True",
":",
"message",
"=",
"await",
"self",
".",
"channel_layer",
".",
"receive",
"(",
"channel",
")",
"if",
"not",
"message",
".",
"get",
"(",
"\"type\"",
",",
"None",
")",
... | Single-channel listener | [
"Single",
"-",
"channel",
"listener"
] | 8c653c46cdcf98398ca9d0bc6d3e47e5d621bb6a | https://github.com/rajasimon/beatserver/blob/8c653c46cdcf98398ca9d0bc6d3e47e5d621bb6a/beatserver/server.py#L54-L66 |
17,779 | pinax/pinax-ratings | pinax/ratings/templatetags/pinax_ratings_tags.py | rating_count | def rating_count(obj):
"""
Total amount of users who have submitted a positive rating for this object.
Usage:
{% rating_count obj %}
"""
count = Rating.objects.filter(
object_id=obj.pk,
content_type=ContentType.objects.get_for_model(obj),
).exclude(rating=0).count()
... | python | def rating_count(obj):
"""
Total amount of users who have submitted a positive rating for this object.
Usage:
{% rating_count obj %}
"""
count = Rating.objects.filter(
object_id=obj.pk,
content_type=ContentType.objects.get_for_model(obj),
).exclude(rating=0).count()
... | [
"def",
"rating_count",
"(",
"obj",
")",
":",
"count",
"=",
"Rating",
".",
"objects",
".",
"filter",
"(",
"object_id",
"=",
"obj",
".",
"pk",
",",
"content_type",
"=",
"ContentType",
".",
"objects",
".",
"get_for_model",
"(",
"obj",
")",
",",
")",
".",
... | Total amount of users who have submitted a positive rating for this object.
Usage:
{% rating_count obj %} | [
"Total",
"amount",
"of",
"users",
"who",
"have",
"submitted",
"a",
"positive",
"rating",
"for",
"this",
"object",
"."
] | eca388fea1ccd09ba844ac29a7489e41b64267f5 | https://github.com/pinax/pinax-ratings/blob/eca388fea1ccd09ba844ac29a7489e41b64267f5/pinax/ratings/templatetags/pinax_ratings_tags.py#L115-L126 |
17,780 | adafruit/Adafruit_Python_LED_Backpack | Adafruit_LED_Backpack/BicolorMatrix8x8.py | BicolorMatrix8x8.set_pixel | def set_pixel(self, x, y, value):
"""Set pixel at position x, y to the given value. X and Y should be values
of 0 to 8. Value should be OFF, GREEN, RED, or YELLOW.
"""
if x < 0 or x > 7 or y < 0 or y > 7:
# Ignore out of bounds pixels.
return
# Set green... | python | def set_pixel(self, x, y, value):
"""Set pixel at position x, y to the given value. X and Y should be values
of 0 to 8. Value should be OFF, GREEN, RED, or YELLOW.
"""
if x < 0 or x > 7 or y < 0 or y > 7:
# Ignore out of bounds pixels.
return
# Set green... | [
"def",
"set_pixel",
"(",
"self",
",",
"x",
",",
"y",
",",
"value",
")",
":",
"if",
"x",
"<",
"0",
"or",
"x",
">",
"7",
"or",
"y",
"<",
"0",
"or",
"y",
">",
"7",
":",
"# Ignore out of bounds pixels.",
"return",
"# Set green LED based on 1st bit in value."... | Set pixel at position x, y to the given value. X and Y should be values
of 0 to 8. Value should be OFF, GREEN, RED, or YELLOW. | [
"Set",
"pixel",
"at",
"position",
"x",
"y",
"to",
"the",
"given",
"value",
".",
"X",
"and",
"Y",
"should",
"be",
"values",
"of",
"0",
"to",
"8",
".",
"Value",
"should",
"be",
"OFF",
"GREEN",
"RED",
"or",
"YELLOW",
"."
] | 7356b4dd8b4bb162d60987878c2cb752fdd017d5 | https://github.com/adafruit/Adafruit_Python_LED_Backpack/blob/7356b4dd8b4bb162d60987878c2cb752fdd017d5/Adafruit_LED_Backpack/BicolorMatrix8x8.py#L41-L51 |
17,781 | adafruit/Adafruit_Python_LED_Backpack | Adafruit_LED_Backpack/BicolorBargraph24.py | BicolorBargraph24.set_bar | def set_bar(self, bar, value):
"""Set bar to desired color. Bar should be a value of 0 to 23, and value
should be OFF, GREEN, RED, or YELLOW.
"""
if bar < 0 or bar > 23:
# Ignore out of bounds bars.
return
# Compute cathode and anode value.
c = (b... | python | def set_bar(self, bar, value):
"""Set bar to desired color. Bar should be a value of 0 to 23, and value
should be OFF, GREEN, RED, or YELLOW.
"""
if bar < 0 or bar > 23:
# Ignore out of bounds bars.
return
# Compute cathode and anode value.
c = (b... | [
"def",
"set_bar",
"(",
"self",
",",
"bar",
",",
"value",
")",
":",
"if",
"bar",
"<",
"0",
"or",
"bar",
">",
"23",
":",
"# Ignore out of bounds bars.",
"return",
"# Compute cathode and anode value.",
"c",
"=",
"(",
"bar",
"if",
"bar",
"<",
"12",
"else",
"... | Set bar to desired color. Bar should be a value of 0 to 23, and value
should be OFF, GREEN, RED, or YELLOW. | [
"Set",
"bar",
"to",
"desired",
"color",
".",
"Bar",
"should",
"be",
"a",
"value",
"of",
"0",
"to",
"23",
"and",
"value",
"should",
"be",
"OFF",
"GREEN",
"RED",
"or",
"YELLOW",
"."
] | 7356b4dd8b4bb162d60987878c2cb752fdd017d5 | https://github.com/adafruit/Adafruit_Python_LED_Backpack/blob/7356b4dd8b4bb162d60987878c2cb752fdd017d5/Adafruit_LED_Backpack/BicolorBargraph24.py#L44-L59 |
17,782 | adafruit/Adafruit_Python_LED_Backpack | Adafruit_LED_Backpack/Matrix8x8.py | Matrix8x8.animate | def animate(self, images, delay=.25):
"""Displays each of the input images in order, pausing for "delay"
seconds after each image.
Keyword arguments:
image -- An iterable collection of Image objects.
delay -- How many seconds to wait after displaying an image before
... | python | def animate(self, images, delay=.25):
"""Displays each of the input images in order, pausing for "delay"
seconds after each image.
Keyword arguments:
image -- An iterable collection of Image objects.
delay -- How many seconds to wait after displaying an image before
... | [
"def",
"animate",
"(",
"self",
",",
"images",
",",
"delay",
"=",
".25",
")",
":",
"for",
"image",
"in",
"images",
":",
"# Draw the image on the display buffer.",
"self",
".",
"set_image",
"(",
"image",
")",
"# Draw the buffer to the display hardware.",
"self",
"."... | Displays each of the input images in order, pausing for "delay"
seconds after each image.
Keyword arguments:
image -- An iterable collection of Image objects.
delay -- How many seconds to wait after displaying an image before
displaying the next one. (Default = .25) | [
"Displays",
"each",
"of",
"the",
"input",
"images",
"in",
"order",
"pausing",
"for",
"delay",
"seconds",
"after",
"each",
"image",
"."
] | 7356b4dd8b4bb162d60987878c2cb752fdd017d5 | https://github.com/adafruit/Adafruit_Python_LED_Backpack/blob/7356b4dd8b4bb162d60987878c2cb752fdd017d5/Adafruit_LED_Backpack/Matrix8x8.py#L160-L175 |
17,783 | adafruit/Adafruit_Python_LED_Backpack | Adafruit_LED_Backpack/Matrix8x16.py | Matrix8x16.set_pixel | def set_pixel(self, x, y, value):
"""Set pixel at position x, y to the given value. X and Y should be values
of 0 to 7 and 0 to 15, resp. Value should be 0 for off and non-zero for on.
"""
if x < 0 or x > 7 or y < 0 or y > 15:
# Ignore out of bounds pixels.
retu... | python | def set_pixel(self, x, y, value):
"""Set pixel at position x, y to the given value. X and Y should be values
of 0 to 7 and 0 to 15, resp. Value should be 0 for off and non-zero for on.
"""
if x < 0 or x > 7 or y < 0 or y > 15:
# Ignore out of bounds pixels.
retu... | [
"def",
"set_pixel",
"(",
"self",
",",
"x",
",",
"y",
",",
"value",
")",
":",
"if",
"x",
"<",
"0",
"or",
"x",
">",
"7",
"or",
"y",
"<",
"0",
"or",
"y",
">",
"15",
":",
"# Ignore out of bounds pixels.",
"return",
"self",
".",
"set_led",
"(",
"(",
... | Set pixel at position x, y to the given value. X and Y should be values
of 0 to 7 and 0 to 15, resp. Value should be 0 for off and non-zero for on. | [
"Set",
"pixel",
"at",
"position",
"x",
"y",
"to",
"the",
"given",
"value",
".",
"X",
"and",
"Y",
"should",
"be",
"values",
"of",
"0",
"to",
"7",
"and",
"0",
"to",
"15",
"resp",
".",
"Value",
"should",
"be",
"0",
"for",
"off",
"and",
"non",
"-",
... | 7356b4dd8b4bb162d60987878c2cb752fdd017d5 | https://github.com/adafruit/Adafruit_Python_LED_Backpack/blob/7356b4dd8b4bb162d60987878c2cb752fdd017d5/Adafruit_LED_Backpack/Matrix8x16.py#L35-L42 |
17,784 | adafruit/Adafruit_Python_LED_Backpack | Adafruit_LED_Backpack/Matrix8x16.py | Matrix8x16.set_image | def set_image(self, image):
"""Set display buffer to Python Image Library image. Image will be converted
to 1 bit color and non-zero color values will light the LEDs.
"""
imwidth, imheight = image.size
if imwidth != 8 or imheight != 16:
raise ValueError('Image must b... | python | def set_image(self, image):
"""Set display buffer to Python Image Library image. Image will be converted
to 1 bit color and non-zero color values will light the LEDs.
"""
imwidth, imheight = image.size
if imwidth != 8 or imheight != 16:
raise ValueError('Image must b... | [
"def",
"set_image",
"(",
"self",
",",
"image",
")",
":",
"imwidth",
",",
"imheight",
"=",
"image",
".",
"size",
"if",
"imwidth",
"!=",
"8",
"or",
"imheight",
"!=",
"16",
":",
"raise",
"ValueError",
"(",
"'Image must be an 8x16 pixels in size.'",
")",
"# Conv... | Set display buffer to Python Image Library image. Image will be converted
to 1 bit color and non-zero color values will light the LEDs. | [
"Set",
"display",
"buffer",
"to",
"Python",
"Image",
"Library",
"image",
".",
"Image",
"will",
"be",
"converted",
"to",
"1",
"bit",
"color",
"and",
"non",
"-",
"zero",
"color",
"values",
"will",
"light",
"the",
"LEDs",
"."
] | 7356b4dd8b4bb162d60987878c2cb752fdd017d5 | https://github.com/adafruit/Adafruit_Python_LED_Backpack/blob/7356b4dd8b4bb162d60987878c2cb752fdd017d5/Adafruit_LED_Backpack/Matrix8x16.py#L44-L61 |
17,785 | adafruit/Adafruit_Python_LED_Backpack | Adafruit_LED_Backpack/Matrix8x16.py | Matrix8x16.horizontal_scroll | def horizontal_scroll(self, image, padding=True):
"""Returns a list of images which appear to scroll from left to right
across the input image when displayed on the LED matrix in order.
The input image is not limited to being 8x16. If the input image is
larger than this, then all column... | python | def horizontal_scroll(self, image, padding=True):
"""Returns a list of images which appear to scroll from left to right
across the input image when displayed on the LED matrix in order.
The input image is not limited to being 8x16. If the input image is
larger than this, then all column... | [
"def",
"horizontal_scroll",
"(",
"self",
",",
"image",
",",
"padding",
"=",
"True",
")",
":",
"image_list",
"=",
"list",
"(",
")",
"width",
"=",
"image",
".",
"size",
"[",
"0",
"]",
"# Scroll into the blank image.",
"if",
"padding",
":",
"for",
"x",
"in"... | Returns a list of images which appear to scroll from left to right
across the input image when displayed on the LED matrix in order.
The input image is not limited to being 8x16. If the input image is
larger than this, then all columns will be scrolled through but only
the top 16 rows o... | [
"Returns",
"a",
"list",
"of",
"images",
"which",
"appear",
"to",
"scroll",
"from",
"left",
"to",
"right",
"across",
"the",
"input",
"image",
"when",
"displayed",
"on",
"the",
"LED",
"matrix",
"in",
"order",
"."
] | 7356b4dd8b4bb162d60987878c2cb752fdd017d5 | https://github.com/adafruit/Adafruit_Python_LED_Backpack/blob/7356b4dd8b4bb162d60987878c2cb752fdd017d5/Adafruit_LED_Backpack/Matrix8x16.py#L67-L112 |
17,786 | adafruit/Adafruit_Python_LED_Backpack | Adafruit_LED_Backpack/Matrix8x16.py | Matrix8x16.vertical_scroll | def vertical_scroll(self, image, padding=True):
"""Returns a list of images which appear to scroll from top to bottom
down the input image when displayed on the LED matrix in order.
The input image is not limited to being 8x16. If the input image is
largerthan this, then all rows will b... | python | def vertical_scroll(self, image, padding=True):
"""Returns a list of images which appear to scroll from top to bottom
down the input image when displayed on the LED matrix in order.
The input image is not limited to being 8x16. If the input image is
largerthan this, then all rows will b... | [
"def",
"vertical_scroll",
"(",
"self",
",",
"image",
",",
"padding",
"=",
"True",
")",
":",
"image_list",
"=",
"list",
"(",
")",
"height",
"=",
"image",
".",
"size",
"[",
"1",
"]",
"# Scroll into the blank image.",
"if",
"padding",
":",
"for",
"y",
"in",... | Returns a list of images which appear to scroll from top to bottom
down the input image when displayed on the LED matrix in order.
The input image is not limited to being 8x16. If the input image is
largerthan this, then all rows will be scrolled through but only the
left-most 8 columns... | [
"Returns",
"a",
"list",
"of",
"images",
"which",
"appear",
"to",
"scroll",
"from",
"top",
"to",
"bottom",
"down",
"the",
"input",
"image",
"when",
"displayed",
"on",
"the",
"LED",
"matrix",
"in",
"order",
"."
] | 7356b4dd8b4bb162d60987878c2cb752fdd017d5 | https://github.com/adafruit/Adafruit_Python_LED_Backpack/blob/7356b4dd8b4bb162d60987878c2cb752fdd017d5/Adafruit_LED_Backpack/Matrix8x16.py#L114-L158 |
17,787 | adafruit/Adafruit_Python_LED_Backpack | Adafruit_LED_Backpack/AlphaNum4.py | AlphaNum4.print_number_str | def print_number_str(self, value, justify_right=True):
"""Print a 4 character long string of numeric values to the display. This
function is similar to print_str but will interpret periods not as
characters but as decimal points associated with the previous character.
"""
# Calcu... | python | def print_number_str(self, value, justify_right=True):
"""Print a 4 character long string of numeric values to the display. This
function is similar to print_str but will interpret periods not as
characters but as decimal points associated with the previous character.
"""
# Calcu... | [
"def",
"print_number_str",
"(",
"self",
",",
"value",
",",
"justify_right",
"=",
"True",
")",
":",
"# Calculate length of value without decimals.",
"length",
"=",
"len",
"(",
"value",
".",
"translate",
"(",
"None",
",",
"'.'",
")",
")",
"# Error if value without d... | Print a 4 character long string of numeric values to the display. This
function is similar to print_str but will interpret periods not as
characters but as decimal points associated with the previous character. | [
"Print",
"a",
"4",
"character",
"long",
"string",
"of",
"numeric",
"values",
"to",
"the",
"display",
".",
"This",
"function",
"is",
"similar",
"to",
"print_str",
"but",
"will",
"interpret",
"periods",
"not",
"as",
"characters",
"but",
"as",
"decimal",
"point... | 7356b4dd8b4bb162d60987878c2cb752fdd017d5 | https://github.com/adafruit/Adafruit_Python_LED_Backpack/blob/7356b4dd8b4bb162d60987878c2cb752fdd017d5/Adafruit_LED_Backpack/AlphaNum4.py#L177-L197 |
17,788 | adafruit/Adafruit_Python_LED_Backpack | Adafruit_LED_Backpack/AlphaNum4.py | AlphaNum4.print_float | def print_float(self, value, decimal_digits=2, justify_right=True):
"""Print a numeric value to the display. If value is negative
it will be printed with a leading minus sign. Decimal digits is the
desired number of digits after the decimal point.
"""
format_string = '{{0:0.{0}... | python | def print_float(self, value, decimal_digits=2, justify_right=True):
"""Print a numeric value to the display. If value is negative
it will be printed with a leading minus sign. Decimal digits is the
desired number of digits after the decimal point.
"""
format_string = '{{0:0.{0}... | [
"def",
"print_float",
"(",
"self",
",",
"value",
",",
"decimal_digits",
"=",
"2",
",",
"justify_right",
"=",
"True",
")",
":",
"format_string",
"=",
"'{{0:0.{0}F}}'",
".",
"format",
"(",
"decimal_digits",
")",
"self",
".",
"print_number_str",
"(",
"format_stri... | Print a numeric value to the display. If value is negative
it will be printed with a leading minus sign. Decimal digits is the
desired number of digits after the decimal point. | [
"Print",
"a",
"numeric",
"value",
"to",
"the",
"display",
".",
"If",
"value",
"is",
"negative",
"it",
"will",
"be",
"printed",
"with",
"a",
"leading",
"minus",
"sign",
".",
"Decimal",
"digits",
"is",
"the",
"desired",
"number",
"of",
"digits",
"after",
"... | 7356b4dd8b4bb162d60987878c2cb752fdd017d5 | https://github.com/adafruit/Adafruit_Python_LED_Backpack/blob/7356b4dd8b4bb162d60987878c2cb752fdd017d5/Adafruit_LED_Backpack/AlphaNum4.py#L199-L205 |
17,789 | adafruit/Adafruit_Python_LED_Backpack | Adafruit_LED_Backpack/SevenSegment.py | SevenSegment.set_left_colon | def set_left_colon(self, show_colon):
"""Turn the left colon on with show color True, or off with show colon
False. Only the large 1.2" 7-segment display has a left colon.
"""
if show_colon:
self.buffer[4] |= 0x04
self.buffer[4] |= 0x08
else:
... | python | def set_left_colon(self, show_colon):
"""Turn the left colon on with show color True, or off with show colon
False. Only the large 1.2" 7-segment display has a left colon.
"""
if show_colon:
self.buffer[4] |= 0x04
self.buffer[4] |= 0x08
else:
... | [
"def",
"set_left_colon",
"(",
"self",
",",
"show_colon",
")",
":",
"if",
"show_colon",
":",
"self",
".",
"buffer",
"[",
"4",
"]",
"|=",
"0x04",
"self",
".",
"buffer",
"[",
"4",
"]",
"|=",
"0x08",
"else",
":",
"self",
".",
"buffer",
"[",
"4",
"]",
... | Turn the left colon on with show color True, or off with show colon
False. Only the large 1.2" 7-segment display has a left colon. | [
"Turn",
"the",
"left",
"colon",
"on",
"with",
"show",
"color",
"True",
"or",
"off",
"with",
"show",
"colon",
"False",
".",
"Only",
"the",
"large",
"1",
".",
"2",
"7",
"-",
"segment",
"display",
"has",
"a",
"left",
"colon",
"."
] | 7356b4dd8b4bb162d60987878c2cb752fdd017d5 | https://github.com/adafruit/Adafruit_Python_LED_Backpack/blob/7356b4dd8b4bb162d60987878c2cb752fdd017d5/Adafruit_LED_Backpack/SevenSegment.py#L145-L154 |
17,790 | adafruit/Adafruit_Python_LED_Backpack | Adafruit_LED_Backpack/SevenSegment.py | SevenSegment.print_number_str | def print_number_str(self, value, justify_right=True):
"""Print a 4 character long string of numeric values to the display.
Characters in the string should be any supported character by set_digit,
or a decimal point. Decimal point characters will be associated with
the previous characte... | python | def print_number_str(self, value, justify_right=True):
"""Print a 4 character long string of numeric values to the display.
Characters in the string should be any supported character by set_digit,
or a decimal point. Decimal point characters will be associated with
the previous characte... | [
"def",
"print_number_str",
"(",
"self",
",",
"value",
",",
"justify_right",
"=",
"True",
")",
":",
"# Calculate length of value without decimals.",
"length",
"=",
"sum",
"(",
"map",
"(",
"lambda",
"x",
":",
"1",
"if",
"x",
"!=",
"'.'",
"else",
"0",
",",
"v... | Print a 4 character long string of numeric values to the display.
Characters in the string should be any supported character by set_digit,
or a decimal point. Decimal point characters will be associated with
the previous character. | [
"Print",
"a",
"4",
"character",
"long",
"string",
"of",
"numeric",
"values",
"to",
"the",
"display",
".",
"Characters",
"in",
"the",
"string",
"should",
"be",
"any",
"supported",
"character",
"by",
"set_digit",
"or",
"a",
"decimal",
"point",
".",
"Decimal",
... | 7356b4dd8b4bb162d60987878c2cb752fdd017d5 | https://github.com/adafruit/Adafruit_Python_LED_Backpack/blob/7356b4dd8b4bb162d60987878c2cb752fdd017d5/Adafruit_LED_Backpack/SevenSegment.py#L167-L188 |
17,791 | adafruit/Adafruit_Python_LED_Backpack | Adafruit_LED_Backpack/HT16K33.py | HT16K33.begin | def begin(self):
"""Initialize driver with LEDs enabled and all turned off."""
# Turn on the oscillator.
self._device.writeList(HT16K33_SYSTEM_SETUP | HT16K33_OSCILLATOR, [])
# Turn display on with no blinking.
self.set_blink(HT16K33_BLINK_OFF)
# Set display to full brigh... | python | def begin(self):
"""Initialize driver with LEDs enabled and all turned off."""
# Turn on the oscillator.
self._device.writeList(HT16K33_SYSTEM_SETUP | HT16K33_OSCILLATOR, [])
# Turn display on with no blinking.
self.set_blink(HT16K33_BLINK_OFF)
# Set display to full brigh... | [
"def",
"begin",
"(",
"self",
")",
":",
"# Turn on the oscillator.",
"self",
".",
"_device",
".",
"writeList",
"(",
"HT16K33_SYSTEM_SETUP",
"|",
"HT16K33_OSCILLATOR",
",",
"[",
"]",
")",
"# Turn display on with no blinking.",
"self",
".",
"set_blink",
"(",
"HT16K33_B... | Initialize driver with LEDs enabled and all turned off. | [
"Initialize",
"driver",
"with",
"LEDs",
"enabled",
"and",
"all",
"turned",
"off",
"."
] | 7356b4dd8b4bb162d60987878c2cb752fdd017d5 | https://github.com/adafruit/Adafruit_Python_LED_Backpack/blob/7356b4dd8b4bb162d60987878c2cb752fdd017d5/Adafruit_LED_Backpack/HT16K33.py#L50-L57 |
17,792 | adafruit/Adafruit_Python_LED_Backpack | Adafruit_LED_Backpack/HT16K33.py | HT16K33.write_display | def write_display(self):
"""Write display buffer to display hardware."""
for i, value in enumerate(self.buffer):
self._device.write8(i, value) | python | def write_display(self):
"""Write display buffer to display hardware."""
for i, value in enumerate(self.buffer):
self._device.write8(i, value) | [
"def",
"write_display",
"(",
"self",
")",
":",
"for",
"i",
",",
"value",
"in",
"enumerate",
"(",
"self",
".",
"buffer",
")",
":",
"self",
".",
"_device",
".",
"write8",
"(",
"i",
",",
"value",
")"
] | Write display buffer to display hardware. | [
"Write",
"display",
"buffer",
"to",
"display",
"hardware",
"."
] | 7356b4dd8b4bb162d60987878c2cb752fdd017d5 | https://github.com/adafruit/Adafruit_Python_LED_Backpack/blob/7356b4dd8b4bb162d60987878c2cb752fdd017d5/Adafruit_LED_Backpack/HT16K33.py#L93-L96 |
17,793 | adafruit/Adafruit_Python_LED_Backpack | Adafruit_LED_Backpack/HT16K33.py | HT16K33.clear | def clear(self):
"""Clear contents of display buffer."""
for i, value in enumerate(self.buffer):
self.buffer[i] = 0 | python | def clear(self):
"""Clear contents of display buffer."""
for i, value in enumerate(self.buffer):
self.buffer[i] = 0 | [
"def",
"clear",
"(",
"self",
")",
":",
"for",
"i",
",",
"value",
"in",
"enumerate",
"(",
"self",
".",
"buffer",
")",
":",
"self",
".",
"buffer",
"[",
"i",
"]",
"=",
"0"
] | Clear contents of display buffer. | [
"Clear",
"contents",
"of",
"display",
"buffer",
"."
] | 7356b4dd8b4bb162d60987878c2cb752fdd017d5 | https://github.com/adafruit/Adafruit_Python_LED_Backpack/blob/7356b4dd8b4bb162d60987878c2cb752fdd017d5/Adafruit_LED_Backpack/HT16K33.py#L98-L101 |
17,794 | swisscom/cleanerversion | versions/admin.py | VersionedAdmin.get_readonly_fields | def get_readonly_fields(self, request, obj=None):
"""
This is required a subclass of VersionedAdmin has readonly_fields
ours won't be undone
"""
if obj:
return list(self.readonly_fields) + ['id', 'identity',
'is_current... | python | def get_readonly_fields(self, request, obj=None):
"""
This is required a subclass of VersionedAdmin has readonly_fields
ours won't be undone
"""
if obj:
return list(self.readonly_fields) + ['id', 'identity',
'is_current... | [
"def",
"get_readonly_fields",
"(",
"self",
",",
"request",
",",
"obj",
"=",
"None",
")",
":",
"if",
"obj",
":",
"return",
"list",
"(",
"self",
".",
"readonly_fields",
")",
"+",
"[",
"'id'",
",",
"'identity'",
",",
"'is_current'",
"]",
"return",
"self",
... | This is required a subclass of VersionedAdmin has readonly_fields
ours won't be undone | [
"This",
"is",
"required",
"a",
"subclass",
"of",
"VersionedAdmin",
"has",
"readonly_fields",
"ours",
"won",
"t",
"be",
"undone"
] | becadbab5d7b474a0e9a596b99e97682402d2f2c | https://github.com/swisscom/cleanerversion/blob/becadbab5d7b474a0e9a596b99e97682402d2f2c/versions/admin.py#L144-L152 |
17,795 | swisscom/cleanerversion | versions/admin.py | VersionedAdmin.get_list_display | def get_list_display(self, request):
"""
This method determines which fields go in the changelist
"""
# Force cast to list as super get_list_display could return a tuple
list_display = list(
super(VersionedAdmin, self).get_list_display(request))
# Preprend t... | python | def get_list_display(self, request):
"""
This method determines which fields go in the changelist
"""
# Force cast to list as super get_list_display could return a tuple
list_display = list(
super(VersionedAdmin, self).get_list_display(request))
# Preprend t... | [
"def",
"get_list_display",
"(",
"self",
",",
"request",
")",
":",
"# Force cast to list as super get_list_display could return a tuple",
"list_display",
"=",
"list",
"(",
"super",
"(",
"VersionedAdmin",
",",
"self",
")",
".",
"get_list_display",
"(",
"request",
")",
"... | This method determines which fields go in the changelist | [
"This",
"method",
"determines",
"which",
"fields",
"go",
"in",
"the",
"changelist"
] | becadbab5d7b474a0e9a596b99e97682402d2f2c | https://github.com/swisscom/cleanerversion/blob/becadbab5d7b474a0e9a596b99e97682402d2f2c/versions/admin.py#L157-L176 |
17,796 | swisscom/cleanerversion | versions/admin.py | VersionedAdmin.get_list_filter | def get_list_filter(self, request):
"""
Adds versionable custom filtering ability to changelist
"""
list_filter = super(VersionedAdmin, self).get_list_filter(request)
return list(list_filter) + [('version_start_date', DateTimeFilter),
IsCurrent... | python | def get_list_filter(self, request):
"""
Adds versionable custom filtering ability to changelist
"""
list_filter = super(VersionedAdmin, self).get_list_filter(request)
return list(list_filter) + [('version_start_date', DateTimeFilter),
IsCurrent... | [
"def",
"get_list_filter",
"(",
"self",
",",
"request",
")",
":",
"list_filter",
"=",
"super",
"(",
"VersionedAdmin",
",",
"self",
")",
".",
"get_list_filter",
"(",
"request",
")",
"return",
"list",
"(",
"list_filter",
")",
"+",
"[",
"(",
"'version_start_date... | Adds versionable custom filtering ability to changelist | [
"Adds",
"versionable",
"custom",
"filtering",
"ability",
"to",
"changelist"
] | becadbab5d7b474a0e9a596b99e97682402d2f2c | https://github.com/swisscom/cleanerversion/blob/becadbab5d7b474a0e9a596b99e97682402d2f2c/versions/admin.py#L178-L184 |
17,797 | swisscom/cleanerversion | versions/admin.py | VersionedAdmin.restore | def restore(self, request, *args, **kwargs):
"""
View for restoring object from change view
"""
paths = request.path_info.split('/')
object_id_index = paths.index("restore") - 2
object_id = paths[object_id_index]
obj = super(VersionedAdmin, self).get_object(reque... | python | def restore(self, request, *args, **kwargs):
"""
View for restoring object from change view
"""
paths = request.path_info.split('/')
object_id_index = paths.index("restore") - 2
object_id = paths[object_id_index]
obj = super(VersionedAdmin, self).get_object(reque... | [
"def",
"restore",
"(",
"self",
",",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"paths",
"=",
"request",
".",
"path_info",
".",
"split",
"(",
"'/'",
")",
"object_id_index",
"=",
"paths",
".",
"index",
"(",
"\"restore\"",
")",
"-",... | View for restoring object from change view | [
"View",
"for",
"restoring",
"object",
"from",
"change",
"view"
] | becadbab5d7b474a0e9a596b99e97682402d2f2c | https://github.com/swisscom/cleanerversion/blob/becadbab5d7b474a0e9a596b99e97682402d2f2c/versions/admin.py#L186-L209 |
17,798 | swisscom/cleanerversion | versions/admin.py | VersionedAdmin.will_not_clone | def will_not_clone(self, request, *args, **kwargs):
"""
Add save but not clone capability in the changeview
"""
paths = request.path_info.split('/')
index_of_object_id = paths.index("will_not_clone") - 1
object_id = paths[index_of_object_id]
self.change_view(reque... | python | def will_not_clone(self, request, *args, **kwargs):
"""
Add save but not clone capability in the changeview
"""
paths = request.path_info.split('/')
index_of_object_id = paths.index("will_not_clone") - 1
object_id = paths[index_of_object_id]
self.change_view(reque... | [
"def",
"will_not_clone",
"(",
"self",
",",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"paths",
"=",
"request",
".",
"path_info",
".",
"split",
"(",
"'/'",
")",
"index_of_object_id",
"=",
"paths",
".",
"index",
"(",
"\"will_not_clone\... | Add save but not clone capability in the changeview | [
"Add",
"save",
"but",
"not",
"clone",
"capability",
"in",
"the",
"changeview"
] | becadbab5d7b474a0e9a596b99e97682402d2f2c | https://github.com/swisscom/cleanerversion/blob/becadbab5d7b474a0e9a596b99e97682402d2f2c/versions/admin.py#L211-L224 |
17,799 | swisscom/cleanerversion | versions/admin.py | VersionedAdmin.exclude | def exclude(self):
"""
Custom descriptor for exclude since there is no get_exclude method to
be overridden
"""
exclude = self.VERSIONED_EXCLUDE
if super(VersionedAdmin, self).exclude is not None:
# Force cast to list as super exclude could return a tuple
... | python | def exclude(self):
"""
Custom descriptor for exclude since there is no get_exclude method to
be overridden
"""
exclude = self.VERSIONED_EXCLUDE
if super(VersionedAdmin, self).exclude is not None:
# Force cast to list as super exclude could return a tuple
... | [
"def",
"exclude",
"(",
"self",
")",
":",
"exclude",
"=",
"self",
".",
"VERSIONED_EXCLUDE",
"if",
"super",
"(",
"VersionedAdmin",
",",
"self",
")",
".",
"exclude",
"is",
"not",
"None",
":",
"# Force cast to list as super exclude could return a tuple",
"exclude",
"=... | Custom descriptor for exclude since there is no get_exclude method to
be overridden | [
"Custom",
"descriptor",
"for",
"exclude",
"since",
"there",
"is",
"no",
"get_exclude",
"method",
"to",
"be",
"overridden"
] | becadbab5d7b474a0e9a596b99e97682402d2f2c | https://github.com/swisscom/cleanerversion/blob/becadbab5d7b474a0e9a596b99e97682402d2f2c/versions/admin.py#L227-L238 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.