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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
54,400 | helium/helium-python | helium/session.py | Session.delete | def delete(self, url, callback, json=None):
"""Delete a URL.
Args:
url(string): URL for the request
callback(func): The response callback function
Keyword Args:
json(dict): JSON body for the request
Returns:
The result of the callbac... | python | def delete(self, url, callback, json=None):
"""Delete a URL.
Args:
url(string): URL for the request
callback(func): The response callback function
Keyword Args:
json(dict): JSON body for the request
Returns:
The result of the callbac... | [
"def",
"delete",
"(",
"self",
",",
"url",
",",
"callback",
",",
"json",
"=",
"None",
")",
":",
"return",
"self",
".",
"adapter",
".",
"delete",
"(",
"url",
",",
"callback",
",",
"json",
"=",
"json",
")"
] | Delete a URL.
Args:
url(string): URL for the request
callback(func): The response callback function
Keyword Args:
json(dict): JSON body for the request
Returns:
The result of the callback handling the resopnse from the
execut... | [
"Delete",
"a",
"URL",
"."
] | db73480b143da4fc48e95c4414bd69c576a3a390 | https://github.com/helium/helium-python/blob/db73480b143da4fc48e95c4414bd69c576a3a390/helium/session.py#L241-L260 |
54,401 | helium/helium-python | helium/session.py | Session.live | def live(self, url, resource_class, resource_args, params=None):
"""Get a live endpoint.
Args:
url(string): URL for the request
resource_class(class): The class to use for entries coming
from the live endpoint.
resource_args(dict): Additional argum... | python | def live(self, url, resource_class, resource_args, params=None):
"""Get a live endpoint.
Args:
url(string): URL for the request
resource_class(class): The class to use for entries coming
from the live endpoint.
resource_args(dict): Additional argum... | [
"def",
"live",
"(",
"self",
",",
"url",
",",
"resource_class",
",",
"resource_args",
",",
"params",
"=",
"None",
")",
":",
"return",
"self",
".",
"adapter",
".",
"live",
"(",
"self",
",",
"url",
",",
"resource_class",
",",
"resource_args",
",",
"params",... | Get a live endpoint.
Args:
url(string): URL for the request
resource_class(class): The class to use for entries coming
from the live endpoint.
resource_args(dict): Additional arguments to pass to the
`resource_class` constructor
Ke... | [
"Get",
"a",
"live",
"endpoint",
"."
] | db73480b143da4fc48e95c4414bd69c576a3a390 | https://github.com/helium/helium-python/blob/db73480b143da4fc48e95c4414bd69c576a3a390/helium/session.py#L265-L291 |
54,402 | PedalPi/PluginsManager | pluginsmanager/observer/autosaver/banks_files.py | BanksFiles.load | def load(self, system_effect):
"""
Return a list if banks presents in data_path
:param SystemEffect system_effect: SystemEffect used in pedalboards
:return list[Bank]: List with Banks persisted in
:attr:`~pluginsmanager.observer.autosaver.banks_files.BanksFiles.data_path... | python | def load(self, system_effect):
"""
Return a list if banks presents in data_path
:param SystemEffect system_effect: SystemEffect used in pedalboards
:return list[Bank]: List with Banks persisted in
:attr:`~pluginsmanager.observer.autosaver.banks_files.BanksFiles.data_path... | [
"def",
"load",
"(",
"self",
",",
"system_effect",
")",
":",
"persistence",
"=",
"PersistenceDecoder",
"(",
"system_effect",
")",
"banks",
"=",
"[",
"]",
"for",
"file",
"in",
"glob",
"(",
"str",
"(",
"self",
".",
"data_path",
")",
"+",
"\"/*.json\"",
")",... | Return a list if banks presents in data_path
:param SystemEffect system_effect: SystemEffect used in pedalboards
:return list[Bank]: List with Banks persisted in
:attr:`~pluginsmanager.observer.autosaver.banks_files.BanksFiles.data_path` | [
"Return",
"a",
"list",
"if",
"banks",
"presents",
"in",
"data_path"
] | 2dcc9f6a79b48e9c9be82efffd855352fa15c5c7 | https://github.com/PedalPi/PluginsManager/blob/2dcc9f6a79b48e9c9be82efffd855352fa15c5c7/pluginsmanager/observer/autosaver/banks_files.py#L30-L47 |
54,403 | PedalPi/PluginsManager | pluginsmanager/observer/autosaver/banks_files.py | BanksFiles.save_bank | def save_bank(self, bank):
"""
Save the bank in your file
:param Bank bank: Bank that will be persisted
"""
path = self._bank_path(bank)
Persistence.save(path, bank.json) | python | def save_bank(self, bank):
"""
Save the bank in your file
:param Bank bank: Bank that will be persisted
"""
path = self._bank_path(bank)
Persistence.save(path, bank.json) | [
"def",
"save_bank",
"(",
"self",
",",
"bank",
")",
":",
"path",
"=",
"self",
".",
"_bank_path",
"(",
"bank",
")",
"Persistence",
".",
"save",
"(",
"path",
",",
"bank",
".",
"json",
")"
] | Save the bank in your file
:param Bank bank: Bank that will be persisted | [
"Save",
"the",
"bank",
"in",
"your",
"file"
] | 2dcc9f6a79b48e9c9be82efffd855352fa15c5c7 | https://github.com/PedalPi/PluginsManager/blob/2dcc9f6a79b48e9c9be82efffd855352fa15c5c7/pluginsmanager/observer/autosaver/banks_files.py#L53-L60 |
54,404 | PedalPi/PluginsManager | pluginsmanager/observer/autosaver/banks_files.py | BanksFiles.delete_bank | def delete_bank(self, bank):
"""
Delete the bank's file
:param Bank bank: Bank that will be removed
"""
path = self._bank_path(bank)
Persistence.delete(path) | python | def delete_bank(self, bank):
"""
Delete the bank's file
:param Bank bank: Bank that will be removed
"""
path = self._bank_path(bank)
Persistence.delete(path) | [
"def",
"delete_bank",
"(",
"self",
",",
"bank",
")",
":",
"path",
"=",
"self",
".",
"_bank_path",
"(",
"bank",
")",
"Persistence",
".",
"delete",
"(",
"path",
")"
] | Delete the bank's file
:param Bank bank: Bank that will be removed | [
"Delete",
"the",
"bank",
"s",
"file"
] | 2dcc9f6a79b48e9c9be82efffd855352fa15c5c7 | https://github.com/PedalPi/PluginsManager/blob/2dcc9f6a79b48e9c9be82efffd855352fa15c5c7/pluginsmanager/observer/autosaver/banks_files.py#L62-L69 |
54,405 | PedalPi/PluginsManager | pluginsmanager/observer/autosaver/banks_files.py | BanksFiles.delete_all_banks | def delete_all_banks(self):
"""
Delete all banks files.
Util for manual save, because isn't possible know which banks
were removed
"""
for file in glob(str(self.data_path) + "/*.json"):
Persistence.delete(file) | python | def delete_all_banks(self):
"""
Delete all banks files.
Util for manual save, because isn't possible know which banks
were removed
"""
for file in glob(str(self.data_path) + "/*.json"):
Persistence.delete(file) | [
"def",
"delete_all_banks",
"(",
"self",
")",
":",
"for",
"file",
"in",
"glob",
"(",
"str",
"(",
"self",
".",
"data_path",
")",
"+",
"\"/*.json\"",
")",
":",
"Persistence",
".",
"delete",
"(",
"file",
")"
] | Delete all banks files.
Util for manual save, because isn't possible know which banks
were removed | [
"Delete",
"all",
"banks",
"files",
"."
] | 2dcc9f6a79b48e9c9be82efffd855352fa15c5c7 | https://github.com/PedalPi/PluginsManager/blob/2dcc9f6a79b48e9c9be82efffd855352fa15c5c7/pluginsmanager/observer/autosaver/banks_files.py#L71-L79 |
54,406 | PedalPi/PluginsManager | pluginsmanager/jack/jack_interface.py | JackInterfaces.audio_interfaces | def audio_interfaces():
"""
Extracts audio interfaces data
:return list[AudioInterface]: Audio interfaces data
"""
p = pyaudio.PyAudio()
interfaces = []
for i in range(p.get_device_count()):
data = p.get_device_info_by_index(i)
if 'hw' no... | python | def audio_interfaces():
"""
Extracts audio interfaces data
:return list[AudioInterface]: Audio interfaces data
"""
p = pyaudio.PyAudio()
interfaces = []
for i in range(p.get_device_count()):
data = p.get_device_info_by_index(i)
if 'hw' no... | [
"def",
"audio_interfaces",
"(",
")",
":",
"p",
"=",
"pyaudio",
".",
"PyAudio",
"(",
")",
"interfaces",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"p",
".",
"get_device_count",
"(",
")",
")",
":",
"data",
"=",
"p",
".",
"get_device_info_by_index",
... | Extracts audio interfaces data
:return list[AudioInterface]: Audio interfaces data | [
"Extracts",
"audio",
"interfaces",
"data"
] | 2dcc9f6a79b48e9c9be82efffd855352fa15c5c7 | https://github.com/PedalPi/PluginsManager/blob/2dcc9f6a79b48e9c9be82efffd855352fa15c5c7/pluginsmanager/jack/jack_interface.py#L31-L47 |
54,407 | videntity/django-djmongo | djmongo/aggregations/views.py | run_aggregation_by_slug | def run_aggregation_by_slug(request, slug):
"""Run Aggregation By Slug"""
sa = get_object_or_404(Aggregation, slug=slug)
sa.execute_now = True
sa.save()
messages.success(request, _("Saved aggregation executed."))
return HttpResponseRedirect(
reverse(
'djmongo_browse_saved_agg... | python | def run_aggregation_by_slug(request, slug):
"""Run Aggregation By Slug"""
sa = get_object_or_404(Aggregation, slug=slug)
sa.execute_now = True
sa.save()
messages.success(request, _("Saved aggregation executed."))
return HttpResponseRedirect(
reverse(
'djmongo_browse_saved_agg... | [
"def",
"run_aggregation_by_slug",
"(",
"request",
",",
"slug",
")",
":",
"sa",
"=",
"get_object_or_404",
"(",
"Aggregation",
",",
"slug",
"=",
"slug",
")",
"sa",
".",
"execute_now",
"=",
"True",
"sa",
".",
"save",
"(",
")",
"messages",
".",
"success",
"(... | Run Aggregation By Slug | [
"Run",
"Aggregation",
"By",
"Slug"
] | 7534e0981a2bc12634cf3f1ed03353623dc57565 | https://github.com/videntity/django-djmongo/blob/7534e0981a2bc12634cf3f1ed03353623dc57565/djmongo/aggregations/views.py#L53-L64 |
54,408 | videntity/django-djmongo | djmongo/aggregations/views.py | delete_saved_aggregation_by_slug | def delete_saved_aggregation_by_slug(request, slug):
"""Delete Saved Aggregation By Slug"""
ss = get_object_or_404(Aggregation, slug=slug)
ss.delete()
messages.success(request, _("Saved aggregation deleted."))
return HttpResponseRedirect(
reverse(
'djmongo_browse_saved_aggregatio... | python | def delete_saved_aggregation_by_slug(request, slug):
"""Delete Saved Aggregation By Slug"""
ss = get_object_or_404(Aggregation, slug=slug)
ss.delete()
messages.success(request, _("Saved aggregation deleted."))
return HttpResponseRedirect(
reverse(
'djmongo_browse_saved_aggregatio... | [
"def",
"delete_saved_aggregation_by_slug",
"(",
"request",
",",
"slug",
")",
":",
"ss",
"=",
"get_object_or_404",
"(",
"Aggregation",
",",
"slug",
"=",
"slug",
")",
"ss",
".",
"delete",
"(",
")",
"messages",
".",
"success",
"(",
"request",
",",
"_",
"(",
... | Delete Saved Aggregation By Slug | [
"Delete",
"Saved",
"Aggregation",
"By",
"Slug"
] | 7534e0981a2bc12634cf3f1ed03353623dc57565 | https://github.com/videntity/django-djmongo/blob/7534e0981a2bc12634cf3f1ed03353623dc57565/djmongo/aggregations/views.py#L67-L77 |
54,409 | mushkevych/scheduler | synergy/db/dao/unit_of_work_dao.py | UnitOfWorkDao.update | def update(self, instance):
""" method finds unit_of_work record and change its status"""
assert isinstance(instance, UnitOfWork)
if instance.db_id:
query = {'_id': ObjectId(instance.db_id)}
else:
query = {unit_of_work.PROCESS_NAME: instance.process_name,
... | python | def update(self, instance):
""" method finds unit_of_work record and change its status"""
assert isinstance(instance, UnitOfWork)
if instance.db_id:
query = {'_id': ObjectId(instance.db_id)}
else:
query = {unit_of_work.PROCESS_NAME: instance.process_name,
... | [
"def",
"update",
"(",
"self",
",",
"instance",
")",
":",
"assert",
"isinstance",
"(",
"instance",
",",
"UnitOfWork",
")",
"if",
"instance",
".",
"db_id",
":",
"query",
"=",
"{",
"'_id'",
":",
"ObjectId",
"(",
"instance",
".",
"db_id",
")",
"}",
"else",... | method finds unit_of_work record and change its status | [
"method",
"finds",
"unit_of_work",
"record",
"and",
"change",
"its",
"status"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/db/dao/unit_of_work_dao.py#L112-L123 |
54,410 | mushkevych/scheduler | synergy/db/dao/unit_of_work_dao.py | UnitOfWorkDao.run_query | def run_query(self, query):
""" method runs the query and returns a list of filtered UnitOfWork records """
cursor = self.ds.filter(COLLECTION_UNIT_OF_WORK, query)
return [UnitOfWork.from_json(document) for document in cursor] | python | def run_query(self, query):
""" method runs the query and returns a list of filtered UnitOfWork records """
cursor = self.ds.filter(COLLECTION_UNIT_OF_WORK, query)
return [UnitOfWork.from_json(document) for document in cursor] | [
"def",
"run_query",
"(",
"self",
",",
"query",
")",
":",
"cursor",
"=",
"self",
".",
"ds",
".",
"filter",
"(",
"COLLECTION_UNIT_OF_WORK",
",",
"query",
")",
"return",
"[",
"UnitOfWork",
".",
"from_json",
"(",
"document",
")",
"for",
"document",
"in",
"cu... | method runs the query and returns a list of filtered UnitOfWork records | [
"method",
"runs",
"the",
"query",
"and",
"returns",
"a",
"list",
"of",
"filtered",
"UnitOfWork",
"records"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/db/dao/unit_of_work_dao.py#L147-L150 |
54,411 | mushkevych/scheduler | synergy/db/dao/unit_of_work_dao.py | UnitOfWorkDao.recover_from_duplicatekeyerror | def recover_from_duplicatekeyerror(self, e):
""" method tries to recover from DuplicateKeyError """
if isinstance(e, DuplicateKeyError):
try:
return self.get_by_params(e.process_name, e.timeperiod, e.start_id, e.end_id)
except LookupError as e:
sel... | python | def recover_from_duplicatekeyerror(self, e):
""" method tries to recover from DuplicateKeyError """
if isinstance(e, DuplicateKeyError):
try:
return self.get_by_params(e.process_name, e.timeperiod, e.start_id, e.end_id)
except LookupError as e:
sel... | [
"def",
"recover_from_duplicatekeyerror",
"(",
"self",
",",
"e",
")",
":",
"if",
"isinstance",
"(",
"e",
",",
"DuplicateKeyError",
")",
":",
"try",
":",
"return",
"self",
".",
"get_by_params",
"(",
"e",
".",
"process_name",
",",
"e",
".",
"timeperiod",
",",... | method tries to recover from DuplicateKeyError | [
"method",
"tries",
"to",
"recover",
"from",
"DuplicateKeyError"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/db/dao/unit_of_work_dao.py#L152-L161 |
54,412 | mushkevych/scheduler | synergy/system/decorator.py | with_reconnect | def with_reconnect(func):
"""
Handle when AutoReconnect is raised from pymongo. This is the standard error
raised for everything from "host disconnected" to "couldn't connect to host"
and more.
The sleep handles the edge case when the state of a replica set changes, and
the cursor raises AutoRe... | python | def with_reconnect(func):
"""
Handle when AutoReconnect is raised from pymongo. This is the standard error
raised for everything from "host disconnected" to "couldn't connect to host"
and more.
The sleep handles the edge case when the state of a replica set changes, and
the cursor raises AutoRe... | [
"def",
"with_reconnect",
"(",
"func",
")",
":",
"from",
"pymongo",
".",
"errors",
"import",
"AutoReconnect",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"def",
"_reconnector",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"_",
"in",... | Handle when AutoReconnect is raised from pymongo. This is the standard error
raised for everything from "host disconnected" to "couldn't connect to host"
and more.
The sleep handles the edge case when the state of a replica set changes, and
the cursor raises AutoReconnect because the master may have ch... | [
"Handle",
"when",
"AutoReconnect",
"is",
"raised",
"from",
"pymongo",
".",
"This",
"is",
"the",
"standard",
"error",
"raised",
"for",
"everything",
"from",
"host",
"disconnected",
"to",
"couldn",
"t",
"connect",
"to",
"host",
"and",
"more",
"."
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/system/decorator.py#L32-L55 |
54,413 | mushkevych/scheduler | synergy/system/log_recording_handler.py | LogRecordingHandler.attach | def attach(self):
""" method clears existing log_recorder entries for given parent_object_id,
creates a new one and attaches this handler to the logger
from this moment every log record will be recorded in the DB """
log_recording = LogRecording(parent_object_id=self.parent_objec... | python | def attach(self):
""" method clears existing log_recorder entries for given parent_object_id,
creates a new one and attaches this handler to the logger
from this moment every log record will be recorded in the DB """
log_recording = LogRecording(parent_object_id=self.parent_objec... | [
"def",
"attach",
"(",
"self",
")",
":",
"log_recording",
"=",
"LogRecording",
"(",
"parent_object_id",
"=",
"self",
".",
"parent_object_id",
",",
"created_at",
"=",
"datetime",
".",
"utcnow",
"(",
")",
")",
"self",
".",
"log_recording_dao",
".",
"remove",
"(... | method clears existing log_recorder entries for given parent_object_id,
creates a new one and attaches this handler to the logger
from this moment every log record will be recorded in the DB | [
"method",
"clears",
"existing",
"log_recorder",
"entries",
"for",
"given",
"parent_object_id",
"creates",
"a",
"new",
"one",
"and",
"attaches",
"this",
"handler",
"to",
"the",
"logger",
"from",
"this",
"moment",
"every",
"log",
"record",
"will",
"be",
"recorded"... | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/system/log_recording_handler.py#L17-L28 |
54,414 | lipisha/lipisha-python-sdk | lipisha/lipisha.py | Lipisha._make_api_call | def _make_api_call(self, api_method, **kwargs):
'''Fire API Call for named method.
'''
api_url = '/'.join((self.api_base_url, api_method))
parameters = dict()
parameters.update(self.default_parameters)
parameters.update(kwargs)
post_params = urlencode(parameters).... | python | def _make_api_call(self, api_method, **kwargs):
'''Fire API Call for named method.
'''
api_url = '/'.join((self.api_base_url, api_method))
parameters = dict()
parameters.update(self.default_parameters)
parameters.update(kwargs)
post_params = urlencode(parameters).... | [
"def",
"_make_api_call",
"(",
"self",
",",
"api_method",
",",
"*",
"*",
"kwargs",
")",
":",
"api_url",
"=",
"'/'",
".",
"join",
"(",
"(",
"self",
".",
"api_base_url",
",",
"api_method",
")",
")",
"parameters",
"=",
"dict",
"(",
")",
"parameters",
".",
... | Fire API Call for named method. | [
"Fire",
"API",
"Call",
"for",
"named",
"method",
"."
] | 125e4f9b035da28bf0002f2354b91f14e664d6c2 | https://github.com/lipisha/lipisha-python-sdk/blob/125e4f9b035da28bf0002f2354b91f14e664d6c2/lipisha/lipisha.py#L99-L108 |
54,415 | gregmuellegger/django-reset | django_reset/management/sql.py | sql_reset | def sql_reset(app, style, connection):
"Returns a list of the DROP TABLE SQL, then the CREATE TABLE SQL, for the given module."
return sql_delete(app, style, connection) + sql_all(app, style, connection) | python | def sql_reset(app, style, connection):
"Returns a list of the DROP TABLE SQL, then the CREATE TABLE SQL, for the given module."
return sql_delete(app, style, connection) + sql_all(app, style, connection) | [
"def",
"sql_reset",
"(",
"app",
",",
"style",
",",
"connection",
")",
":",
"return",
"sql_delete",
"(",
"app",
",",
"style",
",",
"connection",
")",
"+",
"sql_all",
"(",
"app",
",",
"style",
",",
"connection",
")"
] | Returns a list of the DROP TABLE SQL, then the CREATE TABLE SQL, for the given module. | [
"Returns",
"a",
"list",
"of",
"the",
"DROP",
"TABLE",
"SQL",
"then",
"the",
"CREATE",
"TABLE",
"SQL",
"for",
"the",
"given",
"module",
"."
] | e8bbc9286849a16adcc664ef3c0943be75af90a8 | https://github.com/gregmuellegger/django-reset/blob/e8bbc9286849a16adcc664ef3c0943be75af90a8/django_reset/management/sql.py#L3-L5 |
54,416 | lipisha/lipisha-python-sdk | examples/pyramid/views.py | process_lipisha_payment | def process_lipisha_payment(request):
"""Handle payment received and respond with a dictionary"""
log.debug(request.POST)
schema = LipishaInitiateSchema
api_type = request.POST.get('api_type')
if api_type == TYPE_ACKNOWLEDGE:
schema = LipishaAcknowledgeSchema
form = Form(request, schema(... | python | def process_lipisha_payment(request):
"""Handle payment received and respond with a dictionary"""
log.debug(request.POST)
schema = LipishaInitiateSchema
api_type = request.POST.get('api_type')
if api_type == TYPE_ACKNOWLEDGE:
schema = LipishaAcknowledgeSchema
form = Form(request, schema(... | [
"def",
"process_lipisha_payment",
"(",
"request",
")",
":",
"log",
".",
"debug",
"(",
"request",
".",
"POST",
")",
"schema",
"=",
"LipishaInitiateSchema",
"api_type",
"=",
"request",
".",
"POST",
".",
"get",
"(",
"'api_type'",
")",
"if",
"api_type",
"==",
... | Handle payment received and respond with a dictionary | [
"Handle",
"payment",
"received",
"and",
"respond",
"with",
"a",
"dictionary"
] | 125e4f9b035da28bf0002f2354b91f14e664d6c2 | https://github.com/lipisha/lipisha-python-sdk/blob/125e4f9b035da28bf0002f2354b91f14e664d6c2/examples/pyramid/views.py#L79-L120 |
54,417 | videntity/django-djmongo | djmongo/console/utils.py | create_mongo_db | def create_mongo_db(database_name, collection_name, initial_document):
"""Create a new database and collection by inserting one document."""
response_dict = {}
try:
mongodb_client_url = getattr(settings, 'MONGODB_CLIENT',
'mongodb://localhost:27017/')
mc = Mo... | python | def create_mongo_db(database_name, collection_name, initial_document):
"""Create a new database and collection by inserting one document."""
response_dict = {}
try:
mongodb_client_url = getattr(settings, 'MONGODB_CLIENT',
'mongodb://localhost:27017/')
mc = Mo... | [
"def",
"create_mongo_db",
"(",
"database_name",
",",
"collection_name",
",",
"initial_document",
")",
":",
"response_dict",
"=",
"{",
"}",
"try",
":",
"mongodb_client_url",
"=",
"getattr",
"(",
"settings",
",",
"'MONGODB_CLIENT'",
",",
"'mongodb://localhost:27017/'",
... | Create a new database and collection by inserting one document. | [
"Create",
"a",
"new",
"database",
"and",
"collection",
"by",
"inserting",
"one",
"document",
"."
] | 7534e0981a2bc12634cf3f1ed03353623dc57565 | https://github.com/videntity/django-djmongo/blob/7534e0981a2bc12634cf3f1ed03353623dc57565/djmongo/console/utils.py#L89-L108 |
54,418 | videntity/django-djmongo | djmongo/console/utils.py | show_dbs | def show_dbs():
"""return a list of all dbs and related collections.
Return an empty list on error.
"""
l = []
mc = client_connector()
if not mc:
# The client couldn't connect
return ()
dbs = mc.database_names()
for d in dbs:
dbc = mc[d]
collections = db... | python | def show_dbs():
"""return a list of all dbs and related collections.
Return an empty list on error.
"""
l = []
mc = client_connector()
if not mc:
# The client couldn't connect
return ()
dbs = mc.database_names()
for d in dbs:
dbc = mc[d]
collections = db... | [
"def",
"show_dbs",
"(",
")",
":",
"l",
"=",
"[",
"]",
"mc",
"=",
"client_connector",
"(",
")",
"if",
"not",
"mc",
":",
"# The client couldn't connect",
"return",
"(",
")",
"dbs",
"=",
"mc",
".",
"database_names",
"(",
")",
"for",
"d",
"in",
"dbs",
":... | return a list of all dbs and related collections.
Return an empty list on error. | [
"return",
"a",
"list",
"of",
"all",
"dbs",
"and",
"related",
"collections",
".",
"Return",
"an",
"empty",
"list",
"on",
"error",
"."
] | 7534e0981a2bc12634cf3f1ed03353623dc57565 | https://github.com/videntity/django-djmongo/blob/7534e0981a2bc12634cf3f1ed03353623dc57565/djmongo/console/utils.py#L111-L128 |
54,419 | mushkevych/scheduler | synergy/mq/flopsy.py | PublishersPool.put | def put(self, publisher):
""" releases the Publisher instance for reuse"""
if publisher.name not in self.pools:
self.pools[publisher.name] = _Pool(logger=self.logger, name=publisher.name)
self.pools[publisher.name].put(publisher) | python | def put(self, publisher):
""" releases the Publisher instance for reuse"""
if publisher.name not in self.pools:
self.pools[publisher.name] = _Pool(logger=self.logger, name=publisher.name)
self.pools[publisher.name].put(publisher) | [
"def",
"put",
"(",
"self",
",",
"publisher",
")",
":",
"if",
"publisher",
".",
"name",
"not",
"in",
"self",
".",
"pools",
":",
"self",
".",
"pools",
"[",
"publisher",
".",
"name",
"]",
"=",
"_Pool",
"(",
"logger",
"=",
"self",
".",
"logger",
",",
... | releases the Publisher instance for reuse | [
"releases",
"the",
"Publisher",
"instance",
"for",
"reuse"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/mq/flopsy.py#L245-L249 |
54,420 | mushkevych/scheduler | synergy/mq/flopsy.py | PublishersPool.reset_all | def reset_all(self, suppress_logging=False):
""" iterates thru the list of established connections and resets them by disconnecting and reconnecting """
pool_names = list(self.pools)
for name in pool_names:
self.reset(name, suppress_logging) | python | def reset_all(self, suppress_logging=False):
""" iterates thru the list of established connections and resets them by disconnecting and reconnecting """
pool_names = list(self.pools)
for name in pool_names:
self.reset(name, suppress_logging) | [
"def",
"reset_all",
"(",
"self",
",",
"suppress_logging",
"=",
"False",
")",
":",
"pool_names",
"=",
"list",
"(",
"self",
".",
"pools",
")",
"for",
"name",
"in",
"pool_names",
":",
"self",
".",
"reset",
"(",
"name",
",",
"suppress_logging",
")"
] | iterates thru the list of established connections and resets them by disconnecting and reconnecting | [
"iterates",
"thru",
"the",
"list",
"of",
"established",
"connections",
"and",
"resets",
"them",
"by",
"disconnecting",
"and",
"reconnecting"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/mq/flopsy.py#L251-L255 |
54,421 | mushkevych/scheduler | synergy/mq/flopsy.py | PublishersPool.reset | def reset(self, name, suppress_logging=False):
""" resets established connection by disconnecting and reconnecting """
self._close(name, suppress_logging)
self.get(name)
self.logger.info('Reset Flopsy Pool for {0}'.format(name)) | python | def reset(self, name, suppress_logging=False):
""" resets established connection by disconnecting and reconnecting """
self._close(name, suppress_logging)
self.get(name)
self.logger.info('Reset Flopsy Pool for {0}'.format(name)) | [
"def",
"reset",
"(",
"self",
",",
"name",
",",
"suppress_logging",
"=",
"False",
")",
":",
"self",
".",
"_close",
"(",
"name",
",",
"suppress_logging",
")",
"self",
".",
"get",
"(",
"name",
")",
"self",
".",
"logger",
".",
"info",
"(",
"'Reset Flopsy P... | resets established connection by disconnecting and reconnecting | [
"resets",
"established",
"connection",
"by",
"disconnecting",
"and",
"reconnecting"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/mq/flopsy.py#L257-L261 |
54,422 | mushkevych/scheduler | synergy/mq/flopsy.py | PublishersPool._close | def _close(self, name, suppress_logging):
""" closes one particular pool and all its amqp amqp connections """
try:
pool_names = list(self.pools)
if name in pool_names:
self.pools[name].close()
del self.pools[name]
except Exception as e:
... | python | def _close(self, name, suppress_logging):
""" closes one particular pool and all its amqp amqp connections """
try:
pool_names = list(self.pools)
if name in pool_names:
self.pools[name].close()
del self.pools[name]
except Exception as e:
... | [
"def",
"_close",
"(",
"self",
",",
"name",
",",
"suppress_logging",
")",
":",
"try",
":",
"pool_names",
"=",
"list",
"(",
"self",
".",
"pools",
")",
"if",
"name",
"in",
"pool_names",
":",
"self",
".",
"pools",
"[",
"name",
"]",
".",
"close",
"(",
"... | closes one particular pool and all its amqp amqp connections | [
"closes",
"one",
"particular",
"pool",
"and",
"all",
"its",
"amqp",
"amqp",
"connections"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/mq/flopsy.py#L263-L272 |
54,423 | mushkevych/scheduler | synergy/mq/flopsy.py | PublishersPool.close | def close(self, suppress_logging=False):
""" iterates thru all publisher pools and closes them """
pool_names = list(self.pools)
for name in pool_names:
self._close(name, suppress_logging) | python | def close(self, suppress_logging=False):
""" iterates thru all publisher pools and closes them """
pool_names = list(self.pools)
for name in pool_names:
self._close(name, suppress_logging) | [
"def",
"close",
"(",
"self",
",",
"suppress_logging",
"=",
"False",
")",
":",
"pool_names",
"=",
"list",
"(",
"self",
".",
"pools",
")",
"for",
"name",
"in",
"pool_names",
":",
"self",
".",
"_close",
"(",
"name",
",",
"suppress_logging",
")"
] | iterates thru all publisher pools and closes them | [
"iterates",
"thru",
"all",
"publisher",
"pools",
"and",
"closes",
"them"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/mq/flopsy.py#L274-L278 |
54,424 | mushkevych/scheduler | synergy/mx/supervisor_action_handler.py | SupervisorActionHandler.entries | def entries(self):
""" reading box configuration entries for all boxes managed by Synergy Supervisor """
list_of_rows = []
try:
list_of_rows = self.bc_dao.get_all()
except LookupError as e:
self.logger.error('MX Exception {0}'.format(e), exc_info=True)
ret... | python | def entries(self):
""" reading box configuration entries for all boxes managed by Synergy Supervisor """
list_of_rows = []
try:
list_of_rows = self.bc_dao.get_all()
except LookupError as e:
self.logger.error('MX Exception {0}'.format(e), exc_info=True)
ret... | [
"def",
"entries",
"(",
"self",
")",
":",
"list_of_rows",
"=",
"[",
"]",
"try",
":",
"list_of_rows",
"=",
"self",
".",
"bc_dao",
".",
"get_all",
"(",
")",
"except",
"LookupError",
"as",
"e",
":",
"self",
".",
"logger",
".",
"error",
"(",
"'MX Exception ... | reading box configuration entries for all boxes managed by Synergy Supervisor | [
"reading",
"box",
"configuration",
"entries",
"for",
"all",
"boxes",
"managed",
"by",
"Synergy",
"Supervisor"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/mx/supervisor_action_handler.py#L45-L52 |
54,425 | mushkevych/scheduler | db/dao/site_dao.py | SiteDao.update | def update(self, collection_name, instance):
""" method finds Site Statistics record and update it DB representation """
assert isinstance(instance, SiteStatistics)
if instance.db_id:
query = {'_id': ObjectId(instance.db_id)}
else:
query = {DOMAIN_NAME: instance.d... | python | def update(self, collection_name, instance):
""" method finds Site Statistics record and update it DB representation """
assert isinstance(instance, SiteStatistics)
if instance.db_id:
query = {'_id': ObjectId(instance.db_id)}
else:
query = {DOMAIN_NAME: instance.d... | [
"def",
"update",
"(",
"self",
",",
"collection_name",
",",
"instance",
")",
":",
"assert",
"isinstance",
"(",
"instance",
",",
"SiteStatistics",
")",
"if",
"instance",
".",
"db_id",
":",
"query",
"=",
"{",
"'_id'",
":",
"ObjectId",
"(",
"instance",
".",
... | method finds Site Statistics record and update it DB representation | [
"method",
"finds",
"Site",
"Statistics",
"record",
"and",
"update",
"it",
"DB",
"representation"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/db/dao/site_dao.py#L31-L40 |
54,426 | mushkevych/scheduler | db/dao/site_dao.py | SiteDao.insert | def insert(self, collection_name, instance):
""" inserts a unit of work into MongoDB. """
assert isinstance(instance, SiteStatistics)
collection = self.ds.connection(collection_name)
return collection.insert_one(instance.document).inserted_id | python | def insert(self, collection_name, instance):
""" inserts a unit of work into MongoDB. """
assert isinstance(instance, SiteStatistics)
collection = self.ds.connection(collection_name)
return collection.insert_one(instance.document).inserted_id | [
"def",
"insert",
"(",
"self",
",",
"collection_name",
",",
"instance",
")",
":",
"assert",
"isinstance",
"(",
"instance",
",",
"SiteStatistics",
")",
"collection",
"=",
"self",
".",
"ds",
".",
"connection",
"(",
"collection_name",
")",
"return",
"collection",
... | inserts a unit of work into MongoDB. | [
"inserts",
"a",
"unit",
"of",
"work",
"into",
"MongoDB",
"."
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/db/dao/site_dao.py#L43-L47 |
54,427 | mushkevych/scheduler | synergy/db/dao/job_dao.py | JobDao.run_query | def run_query(self, collection_name, query):
""" method runs query on a specified collection and return a list of filtered Job records """
cursor = self.ds.filter(collection_name, query)
return [Job.from_json(document) for document in cursor] | python | def run_query(self, collection_name, query):
""" method runs query on a specified collection and return a list of filtered Job records """
cursor = self.ds.filter(collection_name, query)
return [Job.from_json(document) for document in cursor] | [
"def",
"run_query",
"(",
"self",
",",
"collection_name",
",",
"query",
")",
":",
"cursor",
"=",
"self",
".",
"ds",
".",
"filter",
"(",
"collection_name",
",",
"query",
")",
"return",
"[",
"Job",
".",
"from_json",
"(",
"document",
")",
"for",
"document",
... | method runs query on a specified collection and return a list of filtered Job records | [
"method",
"runs",
"query",
"on",
"a",
"specified",
"collection",
"and",
"return",
"a",
"list",
"of",
"filtered",
"Job",
"records"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/db/dao/job_dao.py#L94-L97 |
54,428 | epio/mantrid | mantrid/cli.py | MantridCli.action_list | def action_list(self):
"Lists all hosts on the LB"
format = "%-35s %-25s %-8s"
print format % ("HOST", "ACTION", "SUBDOMS")
for host, details in sorted(self.client.get_all().items()):
if details[0] in ("proxy", "mirror"):
action = "%s<%s>" % (
... | python | def action_list(self):
"Lists all hosts on the LB"
format = "%-35s %-25s %-8s"
print format % ("HOST", "ACTION", "SUBDOMS")
for host, details in sorted(self.client.get_all().items()):
if details[0] in ("proxy", "mirror"):
action = "%s<%s>" % (
... | [
"def",
"action_list",
"(",
"self",
")",
":",
"format",
"=",
"\"%-35s %-25s %-8s\"",
"print",
"format",
"%",
"(",
"\"HOST\"",
",",
"\"ACTION\"",
",",
"\"SUBDOMS\"",
")",
"for",
"host",
",",
"details",
"in",
"sorted",
"(",
"self",
".",
"client",
".",
"get_al... | Lists all hosts on the LB | [
"Lists",
"all",
"hosts",
"on",
"the",
"LB"
] | 1c699f1a4b33888b533c19cb6d025173f2160576 | https://github.com/epio/mantrid/blob/1c699f1a4b33888b533c19cb6d025173f2160576/mantrid/cli.py#L44-L74 |
54,429 | epio/mantrid | mantrid/cli.py | MantridCli.action_set | def action_set(self, hostname=None, action=None, subdoms=None, *args):
"Adds a hostname to the LB, or alters an existing one"
usage = "set <hostname> <action> <subdoms> [option=value, ...]"
if hostname is None:
sys.stderr.write("You must supply a hostname.\n")
sys.stderr.... | python | def action_set(self, hostname=None, action=None, subdoms=None, *args):
"Adds a hostname to the LB, or alters an existing one"
usage = "set <hostname> <action> <subdoms> [option=value, ...]"
if hostname is None:
sys.stderr.write("You must supply a hostname.\n")
sys.stderr.... | [
"def",
"action_set",
"(",
"self",
",",
"hostname",
"=",
"None",
",",
"action",
"=",
"None",
",",
"subdoms",
"=",
"None",
",",
"*",
"args",
")",
":",
"usage",
"=",
"\"set <hostname> <action> <subdoms> [option=value, ...]\"",
"if",
"hostname",
"is",
"None",
":",... | Adds a hostname to the LB, or alters an existing one | [
"Adds",
"a",
"hostname",
"to",
"the",
"LB",
"or",
"alters",
"an",
"existing",
"one"
] | 1c699f1a4b33888b533c19cb6d025173f2160576 | https://github.com/epio/mantrid/blob/1c699f1a4b33888b533c19cb6d025173f2160576/mantrid/cli.py#L76-L124 |
54,430 | mushkevych/scheduler | synergy/mx/dashboard_handler.py | ManagedStatements.retrieve_records | def retrieve_records(self, timeperiod, include_running,
include_processed, include_noop, include_failed, include_disabled):
""" method looks for suitable job records in all Job collections and returns them as a dict"""
resp = dict()
resp.update(self._search_by_level(COLL... | python | def retrieve_records(self, timeperiod, include_running,
include_processed, include_noop, include_failed, include_disabled):
""" method looks for suitable job records in all Job collections and returns them as a dict"""
resp = dict()
resp.update(self._search_by_level(COLL... | [
"def",
"retrieve_records",
"(",
"self",
",",
"timeperiod",
",",
"include_running",
",",
"include_processed",
",",
"include_noop",
",",
"include_failed",
",",
"include_disabled",
")",
":",
"resp",
"=",
"dict",
"(",
")",
"resp",
".",
"update",
"(",
"self",
".",
... | method looks for suitable job records in all Job collections and returns them as a dict | [
"method",
"looks",
"for",
"suitable",
"job",
"records",
"in",
"all",
"Job",
"collections",
"and",
"returns",
"them",
"as",
"a",
"dict"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/mx/dashboard_handler.py#L65-L81 |
54,431 | mushkevych/scheduler | synergy/mx/dashboard_handler.py | FreerunStatements.retrieve_records | def retrieve_records(self, timeperiod, include_running,
include_processed, include_noop, include_failed, include_disabled):
""" method looks for suitable UOW records and returns them as a dict"""
resp = dict()
try:
query = unit_of_work_dao.QUERY_GET_FREERUN_S... | python | def retrieve_records(self, timeperiod, include_running,
include_processed, include_noop, include_failed, include_disabled):
""" method looks for suitable UOW records and returns them as a dict"""
resp = dict()
try:
query = unit_of_work_dao.QUERY_GET_FREERUN_S... | [
"def",
"retrieve_records",
"(",
"self",
",",
"timeperiod",
",",
"include_running",
",",
"include_processed",
",",
"include_noop",
",",
"include_failed",
",",
"include_disabled",
")",
":",
"resp",
"=",
"dict",
"(",
")",
"try",
":",
"query",
"=",
"unit_of_work_dao... | method looks for suitable UOW records and returns them as a dict | [
"method",
"looks",
"for",
"suitable",
"UOW",
"records",
"and",
"returns",
"them",
"as",
"a",
"dict"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/mx/dashboard_handler.py#L116-L140 |
54,432 | ajenti/jadi | jadi/jadi.py | service | def service(cls):
'''
Marks the decorated class as a singleton ``service``.
Injects following classmethods:
.. py:method:: .get(context)
Returns a singleton instance of the class for given ``context``
:param context: context to look in
:type context: :class:`C... | python | def service(cls):
'''
Marks the decorated class as a singleton ``service``.
Injects following classmethods:
.. py:method:: .get(context)
Returns a singleton instance of the class for given ``context``
:param context: context to look in
:type context: :class:`C... | [
"def",
"service",
"(",
"cls",
")",
":",
"if",
"not",
"cls",
":",
"return",
"None",
"# Inject methods",
"def",
"get",
"(",
"cls",
",",
"context",
")",
":",
"return",
"context",
".",
"get_service",
"(",
"cls",
")",
"cls",
".",
"get",
"=",
"get",
".",
... | Marks the decorated class as a singleton ``service``.
Injects following classmethods:
.. py:method:: .get(context)
Returns a singleton instance of the class for given ``context``
:param context: context to look in
:type context: :class:`Context`
:returns: ... | [
"Marks",
"the",
"decorated",
"class",
"as",
"a",
"singleton",
"service",
"."
] | db76e1c5330672d282f03787fedcd702c04b007f | https://github.com/ajenti/jadi/blob/db76e1c5330672d282f03787fedcd702c04b007f/jadi/jadi.py#L47-L72 |
54,433 | ajenti/jadi | jadi/jadi.py | interface | def interface(cls):
'''
Marks the decorated class as an abstract interface.
Injects following classmethods:
.. py:method:: .all(context)
Returns a list of instances of each component in the ``context`` implementing this ``@interface``
:param context: context to look in
... | python | def interface(cls):
'''
Marks the decorated class as an abstract interface.
Injects following classmethods:
.. py:method:: .all(context)
Returns a list of instances of each component in the ``context`` implementing this ``@interface``
:param context: context to look in
... | [
"def",
"interface",
"(",
"cls",
")",
":",
"if",
"not",
"cls",
":",
"return",
"None",
"cls",
".",
"implementations",
"=",
"[",
"]",
"# Inject methods",
"def",
"_all",
"(",
"cls",
",",
"context",
",",
"ignore_exceptions",
"=",
"False",
")",
":",
"return",
... | Marks the decorated class as an abstract interface.
Injects following classmethods:
.. py:method:: .all(context)
Returns a list of instances of each component in the ``context`` implementing this ``@interface``
:param context: context to look in
:type context: :class... | [
"Marks",
"the",
"decorated",
"class",
"as",
"an",
"abstract",
"interface",
"."
] | db76e1c5330672d282f03787fedcd702c04b007f | https://github.com/ajenti/jadi/blob/db76e1c5330672d282f03787fedcd702c04b007f/jadi/jadi.py#L86-L138 |
54,434 | ajenti/jadi | jadi/jadi.py | component | def component(iface):
'''
Marks the decorated class as a component implementing the given ``iface``
:param iface: the interface to implement
:type iface: :func:`interface`
'''
def decorator(cls):
if not cls:
return None
# Run custom verificator if any
if ha... | python | def component(iface):
'''
Marks the decorated class as a component implementing the given ``iface``
:param iface: the interface to implement
:type iface: :func:`interface`
'''
def decorator(cls):
if not cls:
return None
# Run custom verificator if any
if ha... | [
"def",
"component",
"(",
"iface",
")",
":",
"def",
"decorator",
"(",
"cls",
")",
":",
"if",
"not",
"cls",
":",
"return",
"None",
"# Run custom verificator if any",
"if",
"hasattr",
"(",
"cls",
",",
"'__verify__'",
")",
":",
"if",
"not",
"cls",
".",
"__ve... | Marks the decorated class as a component implementing the given ``iface``
:param iface: the interface to implement
:type iface: :func:`interface` | [
"Marks",
"the",
"decorated",
"class",
"as",
"a",
"component",
"implementing",
"the",
"given",
"iface"
] | db76e1c5330672d282f03787fedcd702c04b007f | https://github.com/ajenti/jadi/blob/db76e1c5330672d282f03787fedcd702c04b007f/jadi/jadi.py#L141-L175 |
54,435 | PedalPi/PluginsManager | pluginsmanager/observer/mod_host/mod_host.py | ModHost.start | def start(self):
"""
Invokes the mod-host process.
mod-host requires JACK to be running.
mod-host does not startup JACK automatically, so you need to start it before running mod-host.
.. note::
This function is experimental. There is no guarantee that the process w... | python | def start(self):
"""
Invokes the mod-host process.
mod-host requires JACK to be running.
mod-host does not startup JACK automatically, so you need to start it before running mod-host.
.. note::
This function is experimental. There is no guarantee that the process w... | [
"def",
"start",
"(",
"self",
")",
":",
"if",
"self",
".",
"address",
"!=",
"'localhost'",
":",
"raise",
"ModHostError",
"(",
"'The host configured in the constructor isn'",
"'t \"localhost\". '",
"'It is not possible to start a process on another device.'",
")",
"try",
":",... | Invokes the mod-host process.
mod-host requires JACK to be running.
mod-host does not startup JACK automatically, so you need to start it before running mod-host.
.. note::
This function is experimental. There is no guarantee that the process will actually be initiated. | [
"Invokes",
"the",
"mod",
"-",
"host",
"process",
"."
] | 2dcc9f6a79b48e9c9be82efffd855352fa15c5c7 | https://github.com/PedalPi/PluginsManager/blob/2dcc9f6a79b48e9c9be82efffd855352fa15c5c7/pluginsmanager/observer/mod_host/mod_host.py#L98-L124 |
54,436 | PedalPi/PluginsManager | pluginsmanager/observer/mod_host/mod_host.py | ModHost.close | def close(self):
"""
Remove the audio plugins loaded and closes connection with mod-host.
.. note::
If the mod-host process has been created with :meth:`~pluginsmanager.observer.mod_host.ModHost.start()`
method, it will be finished.
"""
if self.host is N... | python | def close(self):
"""
Remove the audio plugins loaded and closes connection with mod-host.
.. note::
If the mod-host process has been created with :meth:`~pluginsmanager.observer.mod_host.ModHost.start()`
method, it will be finished.
"""
if self.host is N... | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"host",
"is",
"None",
":",
"raise",
"ModHostError",
"(",
"'There is no established connection with mod-host. '",
"'Did you call the `connect()` method?'",
")",
"super",
"(",
"ModHost",
",",
"self",
")",
".",
... | Remove the audio plugins loaded and closes connection with mod-host.
.. note::
If the mod-host process has been created with :meth:`~pluginsmanager.observer.mod_host.ModHost.start()`
method, it will be finished. | [
"Remove",
"the",
"audio",
"plugins",
"loaded",
"and",
"closes",
"connection",
"with",
"mod",
"-",
"host",
"."
] | 2dcc9f6a79b48e9c9be82efffd855352fa15c5c7 | https://github.com/PedalPi/PluginsManager/blob/2dcc9f6a79b48e9c9be82efffd855352fa15c5c7/pluginsmanager/observer/mod_host/mod_host.py#L149-L167 |
54,437 | mushkevych/scheduler | synergy/db/manager/db_manager.py | synch_db | def synch_db():
""" function reads managed_process and updates context entries appropriately """
logger = get_logger(PROCESS_SCHEDULER)
managed_process_dao = ManagedProcessDao(logger)
try:
process_entries = managed_process_dao.get_all()
except LookupError:
logger.error('Synergy DB i... | python | def synch_db():
""" function reads managed_process and updates context entries appropriately """
logger = get_logger(PROCESS_SCHEDULER)
managed_process_dao = ManagedProcessDao(logger)
try:
process_entries = managed_process_dao.get_all()
except LookupError:
logger.error('Synergy DB i... | [
"def",
"synch_db",
"(",
")",
":",
"logger",
"=",
"get_logger",
"(",
"PROCESS_SCHEDULER",
")",
"managed_process_dao",
"=",
"ManagedProcessDao",
"(",
"logger",
")",
"try",
":",
"process_entries",
"=",
"managed_process_dao",
".",
"get_all",
"(",
")",
"except",
"Loo... | function reads managed_process and updates context entries appropriately | [
"function",
"reads",
"managed_process",
"and",
"updates",
"context",
"entries",
"appropriately"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/db/manager/db_manager.py#L18-L41 |
54,438 | mushkevych/scheduler | synergy/db/manager/db_manager.py | update_db | def update_db():
""" writes to managed_process table records from the context.process_context """
logger = get_logger(PROCESS_SCHEDULER)
managed_process_dao = ManagedProcessDao(logger)
managed_process_dao.clear()
for process_name, process_entry in context.process_context.items():
if not isi... | python | def update_db():
""" writes to managed_process table records from the context.process_context """
logger = get_logger(PROCESS_SCHEDULER)
managed_process_dao = ManagedProcessDao(logger)
managed_process_dao.clear()
for process_name, process_entry in context.process_context.items():
if not isi... | [
"def",
"update_db",
"(",
")",
":",
"logger",
"=",
"get_logger",
"(",
"PROCESS_SCHEDULER",
")",
"managed_process_dao",
"=",
"ManagedProcessDao",
"(",
"logger",
")",
"managed_process_dao",
".",
"clear",
"(",
")",
"for",
"process_name",
",",
"process_entry",
"in",
... | writes to managed_process table records from the context.process_context | [
"writes",
"to",
"managed_process",
"table",
"records",
"from",
"the",
"context",
".",
"process_context"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/db/manager/db_manager.py#L44-L55 |
54,439 | PedalPi/PluginsManager | pluginsmanager/observer/observable_list.py | ObservableList.move | def move(self, item, new_position):
"""
Moves a item list to new position
Calls observer ``self.observer(UpdateType.DELETED, item, index)``
and observer ``self.observer(UpdateType.CREATED, item, index)``
if ``val != self[index]``
:param item: Item that will be moved to ... | python | def move(self, item, new_position):
"""
Moves a item list to new position
Calls observer ``self.observer(UpdateType.DELETED, item, index)``
and observer ``self.observer(UpdateType.CREATED, item, index)``
if ``val != self[index]``
:param item: Item that will be moved to ... | [
"def",
"move",
"(",
"self",
",",
"item",
",",
"new_position",
")",
":",
"if",
"item",
"==",
"self",
"[",
"new_position",
"]",
":",
"return",
"self",
".",
"remove",
"(",
"item",
")",
"self",
".",
"insert",
"(",
"new_position",
",",
"item",
")"
] | Moves a item list to new position
Calls observer ``self.observer(UpdateType.DELETED, item, index)``
and observer ``self.observer(UpdateType.CREATED, item, index)``
if ``val != self[index]``
:param item: Item that will be moved to new_position
:param new_position: Item's new pos... | [
"Moves",
"a",
"item",
"list",
"to",
"new",
"position"
] | 2dcc9f6a79b48e9c9be82efffd855352fa15c5c7 | https://github.com/PedalPi/PluginsManager/blob/2dcc9f6a79b48e9c9be82efffd855352fa15c5c7/pluginsmanager/observer/observable_list.py#L149-L164 |
54,440 | sseemayer/hug_middleware_cors | hug_middleware_cors.py | CORSMiddleware.match_route | def match_route(self, reqpath):
'''match a request with parameter to it's corresponding route'''
route_dicts = [routes for _, routes in self.api.http.routes.items()][0]
routes = [route for route, _ in route_dicts.items()]
#no prameters in path
if reqpath in routes:
re... | python | def match_route(self, reqpath):
'''match a request with parameter to it's corresponding route'''
route_dicts = [routes for _, routes in self.api.http.routes.items()][0]
routes = [route for route, _ in route_dicts.items()]
#no prameters in path
if reqpath in routes:
re... | [
"def",
"match_route",
"(",
"self",
",",
"reqpath",
")",
":",
"route_dicts",
"=",
"[",
"routes",
"for",
"_",
",",
"routes",
"in",
"self",
".",
"api",
".",
"http",
".",
"routes",
".",
"items",
"(",
")",
"]",
"[",
"0",
"]",
"routes",
"=",
"[",
"rout... | match a request with parameter to it's corresponding route | [
"match",
"a",
"request",
"with",
"parameter",
"to",
"it",
"s",
"corresponding",
"route"
] | b832b18c1400c32fa5373c955fd65e9ca0d250e5 | https://github.com/sseemayer/hug_middleware_cors/blob/b832b18c1400c32fa5373c955fd65e9ca0d250e5/hug_middleware_cors.py#L18-L29 |
54,441 | mushkevych/scheduler | synergy/scheduler/abstract_state_machine.py | AbstractStateMachine._log_message | def _log_message(self, level, process_name, timeperiod, msg):
""" method performs logging into log file and Timetable's tree node"""
self.timetable.add_log_entry(process_name, timeperiod, msg)
self.logger.log(level, msg) | python | def _log_message(self, level, process_name, timeperiod, msg):
""" method performs logging into log file and Timetable's tree node"""
self.timetable.add_log_entry(process_name, timeperiod, msg)
self.logger.log(level, msg) | [
"def",
"_log_message",
"(",
"self",
",",
"level",
",",
"process_name",
",",
"timeperiod",
",",
"msg",
")",
":",
"self",
".",
"timetable",
".",
"add_log_entry",
"(",
"process_name",
",",
"timeperiod",
",",
"msg",
")",
"self",
".",
"logger",
".",
"log",
"(... | method performs logging into log file and Timetable's tree node | [
"method",
"performs",
"logging",
"into",
"log",
"file",
"and",
"Timetable",
"s",
"tree",
"node"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/abstract_state_machine.py#L39-L42 |
54,442 | mushkevych/scheduler | synergy/scheduler/abstract_state_machine.py | AbstractStateMachine._process_noop_timeperiod | def _process_noop_timeperiod(self, job_record):
""" method is valid for processes having time_grouping != 1.
should a job record fall in-between grouped time milestones,
its state should be set to STATE_NOOP without any processing """
job_record.state = job.STATE_NOOP
sel... | python | def _process_noop_timeperiod(self, job_record):
""" method is valid for processes having time_grouping != 1.
should a job record fall in-between grouped time milestones,
its state should be set to STATE_NOOP without any processing """
job_record.state = job.STATE_NOOP
sel... | [
"def",
"_process_noop_timeperiod",
"(",
"self",
",",
"job_record",
")",
":",
"job_record",
".",
"state",
"=",
"job",
".",
"STATE_NOOP",
"self",
".",
"job_dao",
".",
"update",
"(",
"job_record",
")",
"time_grouping",
"=",
"context",
".",
"process_context",
"[",... | method is valid for processes having time_grouping != 1.
should a job record fall in-between grouped time milestones,
its state should be set to STATE_NOOP without any processing | [
"method",
"is",
"valid",
"for",
"processes",
"having",
"time_grouping",
"!",
"=",
"1",
".",
"should",
"a",
"job",
"record",
"fall",
"in",
"-",
"between",
"grouped",
"time",
"milestones",
"its",
"state",
"should",
"be",
"set",
"to",
"STATE_NOOP",
"without",
... | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/abstract_state_machine.py#L183-L193 |
54,443 | mushkevych/scheduler | synergy/scheduler/abstract_state_machine.py | AbstractStateMachine._process_state_final_run | def _process_state_final_run(self, job_record):
"""method takes care of processing job records in STATE_FINAL_RUN state"""
uow = self.uow_dao.get_one(job_record.related_unit_of_work)
if uow.is_processed:
self.update_job(job_record, uow, job.STATE_PROCESSED)
elif uow.is_noop:
... | python | def _process_state_final_run(self, job_record):
"""method takes care of processing job records in STATE_FINAL_RUN state"""
uow = self.uow_dao.get_one(job_record.related_unit_of_work)
if uow.is_processed:
self.update_job(job_record, uow, job.STATE_PROCESSED)
elif uow.is_noop:
... | [
"def",
"_process_state_final_run",
"(",
"self",
",",
"job_record",
")",
":",
"uow",
"=",
"self",
".",
"uow_dao",
".",
"get_one",
"(",
"job_record",
".",
"related_unit_of_work",
")",
"if",
"uow",
".",
"is_processed",
":",
"self",
".",
"update_job",
"(",
"job_... | method takes care of processing job records in STATE_FINAL_RUN state | [
"method",
"takes",
"care",
"of",
"processing",
"job",
"records",
"in",
"STATE_FINAL_RUN",
"state"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/abstract_state_machine.py#L203-L223 |
54,444 | mushkevych/scheduler | synergy/scheduler/abstract_state_machine.py | AbstractStateMachine._process_terminal_state | def _process_terminal_state(self, job_record):
""" method logs a warning message notifying that the job is no longer govern by this state machine """
msg = 'Job {0} for {1}@{2} is in the terminal state {3}, ' \
'and is no further govern by the State Machine {4}' \
.format(job... | python | def _process_terminal_state(self, job_record):
""" method logs a warning message notifying that the job is no longer govern by this state machine """
msg = 'Job {0} for {1}@{2} is in the terminal state {3}, ' \
'and is no further govern by the State Machine {4}' \
.format(job... | [
"def",
"_process_terminal_state",
"(",
"self",
",",
"job_record",
")",
":",
"msg",
"=",
"'Job {0} for {1}@{2} is in the terminal state {3}, '",
"'and is no further govern by the State Machine {4}'",
".",
"format",
"(",
"job_record",
".",
"db_id",
",",
"job_record",
".",
"pr... | method logs a warning message notifying that the job is no longer govern by this state machine | [
"method",
"logs",
"a",
"warning",
"message",
"notifying",
"that",
"the",
"job",
"is",
"no",
"longer",
"govern",
"by",
"this",
"state",
"machine"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/abstract_state_machine.py#L225-L230 |
54,445 | mushkevych/scheduler | synergy/scheduler/abstract_state_machine.py | AbstractStateMachine.update_job | def update_job(self, job_record, uow, new_state):
""" method updates job record with a new unit_of_work and new state"""
original_job_state = job_record.state
job_record.state = new_state
job_record.related_unit_of_work = uow.db_id
self.job_dao.update(job_record)
msg = '... | python | def update_job(self, job_record, uow, new_state):
""" method updates job record with a new unit_of_work and new state"""
original_job_state = job_record.state
job_record.state = new_state
job_record.related_unit_of_work = uow.db_id
self.job_dao.update(job_record)
msg = '... | [
"def",
"update_job",
"(",
"self",
",",
"job_record",
",",
"uow",
",",
"new_state",
")",
":",
"original_job_state",
"=",
"job_record",
".",
"state",
"job_record",
".",
"state",
"=",
"new_state",
"job_record",
".",
"related_unit_of_work",
"=",
"uow",
".",
"db_id... | method updates job record with a new unit_of_work and new state | [
"method",
"updates",
"job",
"record",
"with",
"a",
"new",
"unit_of_work",
"and",
"new",
"state"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/abstract_state_machine.py#L373-L382 |
54,446 | mushkevych/scheduler | synergy/workers/bash_driver.py | BashDriver._mq_callback | def _mq_callback(self, message):
""" reads JSON request from the mq message and delivers it for processing """
while threading.active_count() > settings.settings['bash_runnable_count'] + self.initial_thread_count:
time.sleep(0.1)
t = BashRunnable(self.logger, message, self.consumer,... | python | def _mq_callback(self, message):
""" reads JSON request from the mq message and delivers it for processing """
while threading.active_count() > settings.settings['bash_runnable_count'] + self.initial_thread_count:
time.sleep(0.1)
t = BashRunnable(self.logger, message, self.consumer,... | [
"def",
"_mq_callback",
"(",
"self",
",",
"message",
")",
":",
"while",
"threading",
".",
"active_count",
"(",
")",
">",
"settings",
".",
"settings",
"[",
"'bash_runnable_count'",
"]",
"+",
"self",
".",
"initial_thread_count",
":",
"time",
".",
"sleep",
"(",
... | reads JSON request from the mq message and delivers it for processing | [
"reads",
"JSON",
"request",
"from",
"the",
"mq",
"message",
"and",
"delivers",
"it",
"for",
"processing"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/workers/bash_driver.py#L114-L121 |
54,447 | epio/mantrid | mantrid/loadbalancer.py | Balancer.load | def load(self):
"Loads the state from the state file"
try:
if os.path.getsize(self.state_file) <= 1:
raise IOError("File is empty.")
with open(self.state_file) as fh:
state = json.load(fh)
assert isinstance(state, dict)
... | python | def load(self):
"Loads the state from the state file"
try:
if os.path.getsize(self.state_file) <= 1:
raise IOError("File is empty.")
with open(self.state_file) as fh:
state = json.load(fh)
assert isinstance(state, dict)
... | [
"def",
"load",
"(",
"self",
")",
":",
"try",
":",
"if",
"os",
".",
"path",
".",
"getsize",
"(",
"self",
".",
"state_file",
")",
"<=",
"1",
":",
"raise",
"IOError",
"(",
"\"File is empty.\"",
")",
"with",
"open",
"(",
"self",
".",
"state_file",
")",
... | Loads the state from the state file | [
"Loads",
"the",
"state",
"from",
"the",
"state",
"file"
] | 1c699f1a4b33888b533c19cb6d025173f2160576 | https://github.com/epio/mantrid/blob/1c699f1a4b33888b533c19cb6d025173f2160576/mantrid/loadbalancer.py#L100-L115 |
54,448 | epio/mantrid | mantrid/loadbalancer.py | Balancer.save | def save(self):
"Saves the state to the state file"
with open(self.state_file, "w") as fh:
json.dump({
"hosts": self.hosts,
"stats": self.stats,
}, fh) | python | def save(self):
"Saves the state to the state file"
with open(self.state_file, "w") as fh:
json.dump({
"hosts": self.hosts,
"stats": self.stats,
}, fh) | [
"def",
"save",
"(",
"self",
")",
":",
"with",
"open",
"(",
"self",
".",
"state_file",
",",
"\"w\"",
")",
"as",
"fh",
":",
"json",
".",
"dump",
"(",
"{",
"\"hosts\"",
":",
"self",
".",
"hosts",
",",
"\"stats\"",
":",
"self",
".",
"stats",
",",
"}"... | Saves the state to the state file | [
"Saves",
"the",
"state",
"to",
"the",
"state",
"file"
] | 1c699f1a4b33888b533c19cb6d025173f2160576 | https://github.com/epio/mantrid/blob/1c699f1a4b33888b533c19cb6d025173f2160576/mantrid/loadbalancer.py#L117-L123 |
54,449 | epio/mantrid | mantrid/loadbalancer.py | Balancer.save_loop | def save_loop(self):
"""
Saves the state if it has changed.
"""
last_hash = hash(repr(self.hosts))
while self.running:
eventlet.sleep(self.save_interval)
next_hash = hash(repr(self.hosts))
if next_hash != last_hash:
self.save()
... | python | def save_loop(self):
"""
Saves the state if it has changed.
"""
last_hash = hash(repr(self.hosts))
while self.running:
eventlet.sleep(self.save_interval)
next_hash = hash(repr(self.hosts))
if next_hash != last_hash:
self.save()
... | [
"def",
"save_loop",
"(",
"self",
")",
":",
"last_hash",
"=",
"hash",
"(",
"repr",
"(",
"self",
".",
"hosts",
")",
")",
"while",
"self",
".",
"running",
":",
"eventlet",
".",
"sleep",
"(",
"self",
".",
"save_interval",
")",
"next_hash",
"=",
"hash",
"... | Saves the state if it has changed. | [
"Saves",
"the",
"state",
"if",
"it",
"has",
"changed",
"."
] | 1c699f1a4b33888b533c19cb6d025173f2160576 | https://github.com/epio/mantrid/blob/1c699f1a4b33888b533c19cb6d025173f2160576/mantrid/loadbalancer.py#L195-L205 |
54,450 | epio/mantrid | mantrid/loadbalancer.py | Balancer.management_loop | def management_loop(self, address, family):
"""
Accepts management requests.
"""
try:
sock = eventlet.listen(address, family)
except socket.error, e:
logging.critical("Cannot listen on (%s, %s): %s" % (address, family, e))
return
# Slee... | python | def management_loop(self, address, family):
"""
Accepts management requests.
"""
try:
sock = eventlet.listen(address, family)
except socket.error, e:
logging.critical("Cannot listen on (%s, %s): %s" % (address, family, e))
return
# Slee... | [
"def",
"management_loop",
"(",
"self",
",",
"address",
",",
"family",
")",
":",
"try",
":",
"sock",
"=",
"eventlet",
".",
"listen",
"(",
"address",
",",
"family",
")",
"except",
"socket",
".",
"error",
",",
"e",
":",
"logging",
".",
"critical",
"(",
... | Accepts management requests. | [
"Accepts",
"management",
"requests",
"."
] | 1c699f1a4b33888b533c19cb6d025173f2160576 | https://github.com/epio/mantrid/blob/1c699f1a4b33888b533c19cb6d025173f2160576/mantrid/loadbalancer.py#L207-L229 |
54,451 | epio/mantrid | mantrid/loadbalancer.py | Balancer.listen_loop | def listen_loop(self, address, family, internal=False):
"""
Accepts incoming connections.
"""
try:
sock = eventlet.listen(address, family)
except socket.error, e:
if e.errno == errno.EADDRINUSE:
logging.critical("Cannot listen on (%s, %s): ... | python | def listen_loop(self, address, family, internal=False):
"""
Accepts incoming connections.
"""
try:
sock = eventlet.listen(address, family)
except socket.error, e:
if e.errno == errno.EADDRINUSE:
logging.critical("Cannot listen on (%s, %s): ... | [
"def",
"listen_loop",
"(",
"self",
",",
"address",
",",
"family",
",",
"internal",
"=",
"False",
")",
":",
"try",
":",
"sock",
"=",
"eventlet",
".",
"listen",
"(",
"address",
",",
"family",
")",
"except",
"socket",
".",
"error",
",",
"e",
":",
"if",
... | Accepts incoming connections. | [
"Accepts",
"incoming",
"connections",
"."
] | 1c699f1a4b33888b533c19cb6d025173f2160576 | https://github.com/epio/mantrid/blob/1c699f1a4b33888b533c19cb6d025173f2160576/mantrid/loadbalancer.py#L233-L259 |
54,452 | epio/mantrid | mantrid/loadbalancer.py | Balancer.handle | def handle(self, sock, address, internal=False):
"""
Handles an incoming HTTP connection.
"""
try:
sock = StatsSocket(sock)
rfile = sock.makefile('rb', 4096)
# Read the first line
first = rfile.readline().strip("\r\n")
words = f... | python | def handle(self, sock, address, internal=False):
"""
Handles an incoming HTTP connection.
"""
try:
sock = StatsSocket(sock)
rfile = sock.makefile('rb', 4096)
# Read the first line
first = rfile.readline().strip("\r\n")
words = f... | [
"def",
"handle",
"(",
"self",
",",
"sock",
",",
"address",
",",
"internal",
"=",
"False",
")",
":",
"try",
":",
"sock",
"=",
"StatsSocket",
"(",
"sock",
")",
"rfile",
"=",
"sock",
".",
"makefile",
"(",
"'rb'",
",",
"4096",
")",
"# Read the first line",... | Handles an incoming HTTP connection. | [
"Handles",
"an",
"incoming",
"HTTP",
"connection",
"."
] | 1c699f1a4b33888b533c19cb6d025173f2160576 | https://github.com/epio/mantrid/blob/1c699f1a4b33888b533c19cb6d025173f2160576/mantrid/loadbalancer.py#L282-L350 |
54,453 | mushkevych/scheduler | synergy/scheduler/synergy_scheduler.py | Scheduler._load_managed_entries | def _load_managed_entries(self):
""" loads scheduler managed entries. no start-up procedures are performed """
for process_name, process_entry in context.process_context.items():
if isinstance(process_entry, ManagedProcessEntry):
function = self.fire_managed_worker
... | python | def _load_managed_entries(self):
""" loads scheduler managed entries. no start-up procedures are performed """
for process_name, process_entry in context.process_context.items():
if isinstance(process_entry, ManagedProcessEntry):
function = self.fire_managed_worker
... | [
"def",
"_load_managed_entries",
"(",
"self",
")",
":",
"for",
"process_name",
",",
"process_entry",
"in",
"context",
".",
"process_context",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"process_entry",
",",
"ManagedProcessEntry",
")",
":",
"function",
... | loads scheduler managed entries. no start-up procedures are performed | [
"loads",
"scheduler",
"managed",
"entries",
".",
"no",
"start",
"-",
"up",
"procedures",
"are",
"performed"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/synergy_scheduler.py#L88-L102 |
54,454 | mushkevych/scheduler | synergy/scheduler/synergy_scheduler.py | Scheduler._load_freerun_entries | def _load_freerun_entries(self):
""" reads scheduler managed entries and starts their timers to trigger events """
freerun_entries = self.freerun_process_dao.get_all()
for freerun_entry in freerun_entries:
try:
self._register_process_entry(freerun_entry, self.fire_fre... | python | def _load_freerun_entries(self):
""" reads scheduler managed entries and starts their timers to trigger events """
freerun_entries = self.freerun_process_dao.get_all()
for freerun_entry in freerun_entries:
try:
self._register_process_entry(freerun_entry, self.fire_fre... | [
"def",
"_load_freerun_entries",
"(",
"self",
")",
":",
"freerun_entries",
"=",
"self",
".",
"freerun_process_dao",
".",
"get_all",
"(",
")",
"for",
"freerun_entry",
"in",
"freerun_entries",
":",
"try",
":",
"self",
".",
"_register_process_entry",
"(",
"freerun_ent... | reads scheduler managed entries and starts their timers to trigger events | [
"reads",
"scheduler",
"managed",
"entries",
"and",
"starts",
"their",
"timers",
"to",
"trigger",
"events"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/synergy_scheduler.py#L104-L112 |
54,455 | mushkevych/scheduler | synergy/scheduler/synergy_scheduler.py | Scheduler.start | def start(self, *_):
""" reads managed process entries and starts timer instances; starts dependant threads """
self.logger.info('Starting Scheduler...')
db_manager.synch_db()
self._load_managed_entries()
try:
self._load_freerun_entries()
except LookupError a... | python | def start(self, *_):
""" reads managed process entries and starts timer instances; starts dependant threads """
self.logger.info('Starting Scheduler...')
db_manager.synch_db()
self._load_managed_entries()
try:
self._load_freerun_entries()
except LookupError a... | [
"def",
"start",
"(",
"self",
",",
"*",
"_",
")",
":",
"self",
".",
"logger",
".",
"info",
"(",
"'Starting Scheduler...'",
")",
"db_manager",
".",
"synch_db",
"(",
")",
"self",
".",
"_load_managed_entries",
"(",
")",
"try",
":",
"self",
".",
"_load_freeru... | reads managed process entries and starts timer instances; starts dependant threads | [
"reads",
"managed",
"process",
"entries",
"and",
"starts",
"timer",
"instances",
";",
"starts",
"dependant",
"threads"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/synergy_scheduler.py#L115-L135 |
54,456 | mushkevych/scheduler | synergy/scheduler/synergy_scheduler.py | Scheduler.fire_managed_worker | def fire_managed_worker(self, thread_handler_header):
""" requests next valid job for given process and manages its state """
def _fire_worker(process_entry, prev_job_record):
assert isinstance(process_entry, ManagedProcessEntry)
job_record = self.timetable.get_next_job_record(p... | python | def fire_managed_worker(self, thread_handler_header):
""" requests next valid job for given process and manages its state """
def _fire_worker(process_entry, prev_job_record):
assert isinstance(process_entry, ManagedProcessEntry)
job_record = self.timetable.get_next_job_record(p... | [
"def",
"fire_managed_worker",
"(",
"self",
",",
"thread_handler_header",
")",
":",
"def",
"_fire_worker",
"(",
"process_entry",
",",
"prev_job_record",
")",
":",
"assert",
"isinstance",
"(",
"process_entry",
",",
"ManagedProcessEntry",
")",
"job_record",
"=",
"self"... | requests next valid job for given process and manages its state | [
"requests",
"next",
"valid",
"job",
"for",
"given",
"process",
"and",
"manages",
"its",
"state"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/synergy_scheduler.py#L143-L191 |
54,457 | mushkevych/scheduler | synergy/scheduler/synergy_scheduler.py | Scheduler.fire_freerun_worker | def fire_freerun_worker(self, thread_handler_header):
""" fires free-run worker with no dependencies to track """
try:
assert isinstance(thread_handler_header, ThreadHandlerHeader)
self.logger.info('{0} {{'.format(thread_handler_header.key))
state_machine = self.time... | python | def fire_freerun_worker(self, thread_handler_header):
""" fires free-run worker with no dependencies to track """
try:
assert isinstance(thread_handler_header, ThreadHandlerHeader)
self.logger.info('{0} {{'.format(thread_handler_header.key))
state_machine = self.time... | [
"def",
"fire_freerun_worker",
"(",
"self",
",",
"thread_handler_header",
")",
":",
"try",
":",
"assert",
"isinstance",
"(",
"thread_handler_header",
",",
"ThreadHandlerHeader",
")",
"self",
".",
"logger",
".",
"info",
"(",
"'{0} {{'",
".",
"format",
"(",
"thread... | fires free-run worker with no dependencies to track | [
"fires",
"free",
"-",
"run",
"worker",
"with",
"no",
"dependencies",
"to",
"track"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/synergy_scheduler.py#L194-L206 |
54,458 | helium/helium-python | helium/timeseries.py | DataPoint.sensor_id | def sensor_id(self):
"""The id of the sensor of this data point.
Returns:
The id of the sensor that generated this datapoint. Will
throw an AttributeError if no sensor id was found in the
underlyign data.
"""
if hasattr(self, '_sensor_id'):
... | python | def sensor_id(self):
"""The id of the sensor of this data point.
Returns:
The id of the sensor that generated this datapoint. Will
throw an AttributeError if no sensor id was found in the
underlyign data.
"""
if hasattr(self, '_sensor_id'):
... | [
"def",
"sensor_id",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'_sensor_id'",
")",
":",
"return",
"self",
".",
"_sensor_id",
"relationships",
"=",
"self",
".",
"_json_data",
".",
"get",
"(",
"'relationships'",
")",
"sensor_id",
"=",
"relati... | The id of the sensor of this data point.
Returns:
The id of the sensor that generated this datapoint. Will
throw an AttributeError if no sensor id was found in the
underlyign data. | [
"The",
"id",
"of",
"the",
"sensor",
"of",
"this",
"data",
"point",
"."
] | db73480b143da4fc48e95c4414bd69c576a3a390 | https://github.com/helium/helium-python/blob/db73480b143da4fc48e95c4414bd69c576a3a390/helium/timeseries.py#L51-L66 |
54,459 | helium/helium-python | helium/timeseries.py | Timeseries.create | def create(self, port, value, timestamp=None):
"""Post a new reading to a timeseries.
A reading is comprised of a `port`, a `value` and a timestamp.
A port is like a tag for the given reading and gives an
indication of the meaning of the value.
The value of the reading can be ... | python | def create(self, port, value, timestamp=None):
"""Post a new reading to a timeseries.
A reading is comprised of a `port`, a `value` and a timestamp.
A port is like a tag for the given reading and gives an
indication of the meaning of the value.
The value of the reading can be ... | [
"def",
"create",
"(",
"self",
",",
"port",
",",
"value",
",",
"timestamp",
"=",
"None",
")",
":",
"session",
"=",
"self",
".",
"_session",
"datapoint_class",
"=",
"self",
".",
"_datapoint_class",
"attributes",
"=",
"{",
"'port'",
":",
"port",
",",
"'valu... | Post a new reading to a timeseries.
A reading is comprised of a `port`, a `value` and a timestamp.
A port is like a tag for the given reading and gives an
indication of the meaning of the value.
The value of the reading can be any valid json value.
The timestamp is considered... | [
"Post",
"a",
"new",
"reading",
"to",
"a",
"timeseries",
"."
] | db73480b143da4fc48e95c4414bd69c576a3a390 | https://github.com/helium/helium-python/blob/db73480b143da4fc48e95c4414bd69c576a3a390/helium/timeseries.py#L228-L269 |
54,460 | helium/helium-python | helium/timeseries.py | Timeseries.live | def live(self):
"""Get a live stream of timeseries readings.
This returns an Iterable over a live stream of readings. Note
that the result will need to be closed since the system can
not tell when you'll be done with it.
You can either call ``close`` on the endpoint when you're... | python | def live(self):
"""Get a live stream of timeseries readings.
This returns an Iterable over a live stream of readings. Note
that the result will need to be closed since the system can
not tell when you'll be done with it.
You can either call ``close`` on the endpoint when you're... | [
"def",
"live",
"(",
"self",
")",
":",
"session",
"=",
"self",
".",
"_session",
"url",
"=",
"\"{}/live\"",
".",
"format",
"(",
"self",
".",
"_base_url",
")",
"supported_params",
"=",
"frozenset",
"(",
"[",
"'filter[port]'",
"]",
")",
"params",
"=",
"{",
... | Get a live stream of timeseries readings.
This returns an Iterable over a live stream of readings. Note
that the result will need to be closed since the system can
not tell when you'll be done with it.
You can either call ``close`` on the endpoint when you're or
use the context... | [
"Get",
"a",
"live",
"stream",
"of",
"timeseries",
"readings",
"."
] | db73480b143da4fc48e95c4414bd69c576a3a390 | https://github.com/helium/helium-python/blob/db73480b143da4fc48e95c4414bd69c576a3a390/helium/timeseries.py#L271-L302 |
54,461 | mushkevych/scheduler | synergy/scheduler/timetable.py | Timetable._register_dependencies | def _register_dependencies(self):
""" register dependencies between trees"""
for tree_name, context_entry in context.timetable_context.items():
tree = self.trees[tree_name]
assert isinstance(tree, MultiLevelTree)
for dependent_on in context_entry.dependent_on:
... | python | def _register_dependencies(self):
""" register dependencies between trees"""
for tree_name, context_entry in context.timetable_context.items():
tree = self.trees[tree_name]
assert isinstance(tree, MultiLevelTree)
for dependent_on in context_entry.dependent_on:
... | [
"def",
"_register_dependencies",
"(",
"self",
")",
":",
"for",
"tree_name",
",",
"context_entry",
"in",
"context",
".",
"timetable_context",
".",
"items",
"(",
")",
":",
"tree",
"=",
"self",
".",
"trees",
"[",
"tree_name",
"]",
"assert",
"isinstance",
"(",
... | register dependencies between trees | [
"register",
"dependencies",
"between",
"trees"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/timetable.py#L64-L72 |
54,462 | mushkevych/scheduler | synergy/scheduler/timetable.py | Timetable._find_dependant_trees | def _find_dependant_trees(self, tree_obj):
""" returns list of trees that are dependent_on given tree_obj """
dependant_trees = []
for tree_name, tree in self.trees.items():
if tree_obj in tree.dependent_on:
dependant_trees.append(tree)
return dependant_trees | python | def _find_dependant_trees(self, tree_obj):
""" returns list of trees that are dependent_on given tree_obj """
dependant_trees = []
for tree_name, tree in self.trees.items():
if tree_obj in tree.dependent_on:
dependant_trees.append(tree)
return dependant_trees | [
"def",
"_find_dependant_trees",
"(",
"self",
",",
"tree_obj",
")",
":",
"dependant_trees",
"=",
"[",
"]",
"for",
"tree_name",
",",
"tree",
"in",
"self",
".",
"trees",
".",
"items",
"(",
")",
":",
"if",
"tree_obj",
"in",
"tree",
".",
"dependent_on",
":",
... | returns list of trees that are dependent_on given tree_obj | [
"returns",
"list",
"of",
"trees",
"that",
"are",
"dependent_on",
"given",
"tree_obj"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/timetable.py#L75-L81 |
54,463 | mushkevych/scheduler | synergy/scheduler/timetable.py | Timetable.reprocess_tree_node | def reprocess_tree_node(self, tree_node, tx_context=None):
""" method reprocesses the node and all its dependants and parent nodes """
if not tx_context:
# create transaction context if one was not provided
# format: {process_name: {timeperiod: AbstractTreeNode} }
tx_... | python | def reprocess_tree_node(self, tree_node, tx_context=None):
""" method reprocesses the node and all its dependants and parent nodes """
if not tx_context:
# create transaction context if one was not provided
# format: {process_name: {timeperiod: AbstractTreeNode} }
tx_... | [
"def",
"reprocess_tree_node",
"(",
"self",
",",
"tree_node",
",",
"tx_context",
"=",
"None",
")",
":",
"if",
"not",
"tx_context",
":",
"# create transaction context if one was not provided",
"# format: {process_name: {timeperiod: AbstractTreeNode} }",
"tx_context",
"=",
"coll... | method reprocesses the node and all its dependants and parent nodes | [
"method",
"reprocesses",
"the",
"node",
"and",
"all",
"its",
"dependants",
"and",
"parent",
"nodes"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/timetable.py#L93-L122 |
54,464 | mushkevych/scheduler | synergy/scheduler/timetable.py | Timetable.skip_tree_node | def skip_tree_node(self, tree_node, tx_context=None):
""" method skips the node and all its dependants and child nodes """
if not tx_context:
# create transaction context if one was not provided
# format: {process_name: {timeperiod: AbstractTreeNode} }
tx_context = co... | python | def skip_tree_node(self, tree_node, tx_context=None):
""" method skips the node and all its dependants and child nodes """
if not tx_context:
# create transaction context if one was not provided
# format: {process_name: {timeperiod: AbstractTreeNode} }
tx_context = co... | [
"def",
"skip_tree_node",
"(",
"self",
",",
"tree_node",
",",
"tx_context",
"=",
"None",
")",
":",
"if",
"not",
"tx_context",
":",
"# create transaction context if one was not provided",
"# format: {process_name: {timeperiod: AbstractTreeNode} }",
"tx_context",
"=",
"collectio... | method skips the node and all its dependants and child nodes | [
"method",
"skips",
"the",
"node",
"and",
"all",
"its",
"dependants",
"and",
"child",
"nodes"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/timetable.py#L125-L152 |
54,465 | mushkevych/scheduler | synergy/scheduler/timetable.py | Timetable.assign_job_record | def assign_job_record(self, tree_node):
""" - looks for an existing job record in the DB, and if not found
- creates a job record in STATE_EMBRYO and bind it to the given tree node """
try:
job_record = self.job_dao.get_one(tree_node.process_name, tree_node.timeperiod)
ex... | python | def assign_job_record(self, tree_node):
""" - looks for an existing job record in the DB, and if not found
- creates a job record in STATE_EMBRYO and bind it to the given tree node """
try:
job_record = self.job_dao.get_one(tree_node.process_name, tree_node.timeperiod)
ex... | [
"def",
"assign_job_record",
"(",
"self",
",",
"tree_node",
")",
":",
"try",
":",
"job_record",
"=",
"self",
".",
"job_dao",
".",
"get_one",
"(",
"tree_node",
".",
"process_name",
",",
"tree_node",
".",
"timeperiod",
")",
"except",
"LookupError",
":",
"state_... | - looks for an existing job record in the DB, and if not found
- creates a job record in STATE_EMBRYO and bind it to the given tree node | [
"-",
"looks",
"for",
"an",
"existing",
"job",
"record",
"in",
"the",
"DB",
"and",
"if",
"not",
"found",
"-",
"creates",
"a",
"job",
"record",
"in",
"STATE_EMBRYO",
"and",
"bind",
"it",
"to",
"the",
"given",
"tree",
"node"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/timetable.py#L155-L164 |
54,466 | mushkevych/scheduler | synergy/scheduler/timetable.py | Timetable.get_tree | def get_tree(self, process_name):
""" return tree that is managing time-periods for given process"""
for tree_name, tree in self.trees.items():
if process_name in tree:
return tree | python | def get_tree(self, process_name):
""" return tree that is managing time-periods for given process"""
for tree_name, tree in self.trees.items():
if process_name in tree:
return tree | [
"def",
"get_tree",
"(",
"self",
",",
"process_name",
")",
":",
"for",
"tree_name",
",",
"tree",
"in",
"self",
".",
"trees",
".",
"items",
"(",
")",
":",
"if",
"process_name",
"in",
"tree",
":",
"return",
"tree"
] | return tree that is managing time-periods for given process | [
"return",
"tree",
"that",
"is",
"managing",
"time",
"-",
"periods",
"for",
"given",
"process"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/timetable.py#L168-L172 |
54,467 | mushkevych/scheduler | synergy/scheduler/timetable.py | Timetable._build_tree_by_level | def _build_tree_by_level(self, time_qualifier, collection_name, since):
""" method iterated thru all documents in all job collections and builds a tree of known system state"""
invalid_tree_records = dict()
invalid_tq_records = dict()
try:
job_records = self.job_dao.get_all(... | python | def _build_tree_by_level(self, time_qualifier, collection_name, since):
""" method iterated thru all documents in all job collections and builds a tree of known system state"""
invalid_tree_records = dict()
invalid_tq_records = dict()
try:
job_records = self.job_dao.get_all(... | [
"def",
"_build_tree_by_level",
"(",
"self",
",",
"time_qualifier",
",",
"collection_name",
",",
"since",
")",
":",
"invalid_tree_records",
"=",
"dict",
"(",
")",
"invalid_tq_records",
"=",
"dict",
"(",
")",
"try",
":",
"job_records",
"=",
"self",
".",
"job_dao... | method iterated thru all documents in all job collections and builds a tree of known system state | [
"method",
"iterated",
"thru",
"all",
"documents",
"in",
"all",
"job",
"collections",
"and",
"builds",
"a",
"tree",
"of",
"known",
"system",
"state"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/timetable.py#L175-L204 |
54,468 | mushkevych/scheduler | synergy/scheduler/timetable.py | Timetable.load_tree | def load_tree(self):
""" method iterates thru all objects older than synergy_start_timeperiod parameter in job collections
and loads them into this timetable"""
timeperiod = settings.settings['synergy_start_timeperiod']
yearly_timeperiod = time_helper.cast_to_time_qualifier(QUALIFIER_YEA... | python | def load_tree(self):
""" method iterates thru all objects older than synergy_start_timeperiod parameter in job collections
and loads them into this timetable"""
timeperiod = settings.settings['synergy_start_timeperiod']
yearly_timeperiod = time_helper.cast_to_time_qualifier(QUALIFIER_YEA... | [
"def",
"load_tree",
"(",
"self",
")",
":",
"timeperiod",
"=",
"settings",
".",
"settings",
"[",
"'synergy_start_timeperiod'",
"]",
"yearly_timeperiod",
"=",
"time_helper",
".",
"cast_to_time_qualifier",
"(",
"QUALIFIER_YEARLY",
",",
"timeperiod",
")",
"monthly_timeper... | method iterates thru all objects older than synergy_start_timeperiod parameter in job collections
and loads them into this timetable | [
"method",
"iterates",
"thru",
"all",
"objects",
"older",
"than",
"synergy_start_timeperiod",
"parameter",
"in",
"job",
"collections",
"and",
"loads",
"them",
"into",
"this",
"timetable"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/timetable.py#L207-L219 |
54,469 | mushkevych/scheduler | synergy/scheduler/timetable.py | Timetable.skip_if_needed | def skip_if_needed(self, job_record):
""" method is called from abstract_state_machine.manage_job to notify about job's failed processing
if should_skip_node returns True - the node's job_record is transferred to STATE_SKIPPED """
tree = self.get_tree(job_record.process_name)
node = ... | python | def skip_if_needed(self, job_record):
""" method is called from abstract_state_machine.manage_job to notify about job's failed processing
if should_skip_node returns True - the node's job_record is transferred to STATE_SKIPPED """
tree = self.get_tree(job_record.process_name)
node = ... | [
"def",
"skip_if_needed",
"(",
"self",
",",
"job_record",
")",
":",
"tree",
"=",
"self",
".",
"get_tree",
"(",
"job_record",
".",
"process_name",
")",
"node",
"=",
"tree",
".",
"get_node",
"(",
"job_record",
".",
"process_name",
",",
"job_record",
".",
"tim... | method is called from abstract_state_machine.manage_job to notify about job's failed processing
if should_skip_node returns True - the node's job_record is transferred to STATE_SKIPPED | [
"method",
"is",
"called",
"from",
"abstract_state_machine",
".",
"manage_job",
"to",
"notify",
"about",
"job",
"s",
"failed",
"processing",
"if",
"should_skip_node",
"returns",
"True",
"-",
"the",
"node",
"s",
"job_record",
"is",
"transferred",
"to",
"STATE_SKIPPE... | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/timetable.py#L243-L249 |
54,470 | mushkevych/scheduler | synergy/scheduler/timetable.py | Timetable.add_log_entry | def add_log_entry(self, process_name, timeperiod, msg):
""" adds a non-persistent log entry to the tree node """
tree = self.get_tree(process_name)
node = tree.get_node(process_name, timeperiod)
node.add_log_entry([datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S'), msg]) | python | def add_log_entry(self, process_name, timeperiod, msg):
""" adds a non-persistent log entry to the tree node """
tree = self.get_tree(process_name)
node = tree.get_node(process_name, timeperiod)
node.add_log_entry([datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S'), msg]) | [
"def",
"add_log_entry",
"(",
"self",
",",
"process_name",
",",
"timeperiod",
",",
"msg",
")",
":",
"tree",
"=",
"self",
".",
"get_tree",
"(",
"process_name",
")",
"node",
"=",
"tree",
".",
"get_node",
"(",
"process_name",
",",
"timeperiod",
")",
"node",
... | adds a non-persistent log entry to the tree node | [
"adds",
"a",
"non",
"-",
"persistent",
"log",
"entry",
"to",
"the",
"tree",
"node"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/timetable.py#L270-L274 |
54,471 | PedalPi/PluginsManager | pluginsmanager/observer/autosaver/autosaver.py | Autosaver.save | def save(self, banks_manager):
"""
Save all data from a banks_manager
:param BanksManager banks_manager: BanksManager that your banks data will be persisted
"""
self.banks_files.delete_all_banks()
self.banks_files.save(banks_manager)
self.index_file.save(banks_ma... | python | def save(self, banks_manager):
"""
Save all data from a banks_manager
:param BanksManager banks_manager: BanksManager that your banks data will be persisted
"""
self.banks_files.delete_all_banks()
self.banks_files.save(banks_manager)
self.index_file.save(banks_ma... | [
"def",
"save",
"(",
"self",
",",
"banks_manager",
")",
":",
"self",
".",
"banks_files",
".",
"delete_all_banks",
"(",
")",
"self",
".",
"banks_files",
".",
"save",
"(",
"banks_manager",
")",
"self",
".",
"index_file",
".",
"save",
"(",
"banks_manager",
")"... | Save all data from a banks_manager
:param BanksManager banks_manager: BanksManager that your banks data will be persisted | [
"Save",
"all",
"data",
"from",
"a",
"banks_manager"
] | 2dcc9f6a79b48e9c9be82efffd855352fa15c5c7 | https://github.com/PedalPi/PluginsManager/blob/2dcc9f6a79b48e9c9be82efffd855352fa15c5c7/pluginsmanager/observer/autosaver/autosaver.py#L104-L112 |
54,472 | flatironinstitute/mlprocessors | mlprocessors/core.py | Processor.apply | def apply(cls, self, *args, **kwargs):
"""
Applies kwargs arguments to the instance passed as the first
argument to the call.
For defined INPUTS, OUTPUTS and PARAMETERS the method extracts
a corresponding value from kwargs and sets it as an instance attribute.
For exampl... | python | def apply(cls, self, *args, **kwargs):
"""
Applies kwargs arguments to the instance passed as the first
argument to the call.
For defined INPUTS, OUTPUTS and PARAMETERS the method extracts
a corresponding value from kwargs and sets it as an instance attribute.
For exampl... | [
"def",
"apply",
"(",
"cls",
",",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"key",
"in",
"kwargs",
":",
"if",
"key",
"in",
"[",
"x",
".",
"name",
"for",
"x",
"in",
"cls",
".",
"INPUTS",
"]",
":",
"setattr",
"(",
"self... | Applies kwargs arguments to the instance passed as the first
argument to the call.
For defined INPUTS, OUTPUTS and PARAMETERS the method extracts
a corresponding value from kwargs and sets it as an instance attribute.
For example, if the processor has a 'foo' parameter declared and
... | [
"Applies",
"kwargs",
"arguments",
"to",
"the",
"instance",
"passed",
"as",
"the",
"first",
"argument",
"to",
"the",
"call",
"."
] | 28d55542bbd02b9ddfe429db260f0be58f3820d3 | https://github.com/flatironinstitute/mlprocessors/blob/28d55542bbd02b9ddfe429db260f0be58f3820d3/mlprocessors/core.py#L257-L274 |
54,473 | flatironinstitute/mlprocessors | mlprocessors/core.py | Processor.spec | def spec(self):
"""
Generate spec for the processor as a Python dictionary.
A spec is a standard way to describe a MountainLab processor in a way
that is easy to process, yet still understandable by humans.
This method generates a Python dictionary that complies with a spec
... | python | def spec(self):
"""
Generate spec for the processor as a Python dictionary.
A spec is a standard way to describe a MountainLab processor in a way
that is easy to process, yet still understandable by humans.
This method generates a Python dictionary that complies with a spec
... | [
"def",
"spec",
"(",
"self",
")",
":",
"pspec",
"=",
"{",
"}",
"pspec",
"[",
"'name'",
"]",
"=",
"self",
".",
"NAME",
"pspec",
"[",
"'version'",
"]",
"=",
"self",
".",
"VERSION",
"pspec",
"[",
"'description'",
"]",
"=",
"self",
".",
"DESCRIPTION",
"... | Generate spec for the processor as a Python dictionary.
A spec is a standard way to describe a MountainLab processor in a way
that is easy to process, yet still understandable by humans.
This method generates a Python dictionary that complies with a spec
definition. | [
"Generate",
"spec",
"for",
"the",
"processor",
"as",
"a",
"Python",
"dictionary",
"."
] | 28d55542bbd02b9ddfe429db260f0be58f3820d3 | https://github.com/flatironinstitute/mlprocessors/blob/28d55542bbd02b9ddfe429db260f0be58f3820d3/mlprocessors/core.py#L302-L326 |
54,474 | flatironinstitute/mlprocessors | mlprocessors/core.py | Processor.invoke | def invoke(proc, args=None, *, _instance = None, **kwargs):
"""
Executes the processor passing given arguments.
:param args: a list of parameters in --key=value format.
"""
if args is None:
args=[]
for kwargname in kwargs:
args.append('--'+kwargna... | python | def invoke(proc, args=None, *, _instance = None, **kwargs):
"""
Executes the processor passing given arguments.
:param args: a list of parameters in --key=value format.
"""
if args is None:
args=[]
for kwargname in kwargs:
args.append('--'+kwargna... | [
"def",
"invoke",
"(",
"proc",
",",
"args",
"=",
"None",
",",
"*",
",",
"_instance",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"args",
"is",
"None",
":",
"args",
"=",
"[",
"]",
"for",
"kwargname",
"in",
"kwargs",
":",
"args",
".",
"a... | Executes the processor passing given arguments.
:param args: a list of parameters in --key=value format. | [
"Executes",
"the",
"processor",
"passing",
"given",
"arguments",
"."
] | 28d55542bbd02b9ddfe429db260f0be58f3820d3 | https://github.com/flatironinstitute/mlprocessors/blob/28d55542bbd02b9ddfe429db260f0be58f3820d3/mlprocessors/core.py#L386-L458 |
54,475 | PedalPi/PluginsManager | pluginsmanager/model/pedalboard.py | Pedalboard.index | def index(self):
"""
Returns the first occurrence of the pedalboard in your bank
"""
if self.bank is None:
raise IndexError('Pedalboard not contains a bank')
return self.bank.pedalboards.index(self) | python | def index(self):
"""
Returns the first occurrence of the pedalboard in your bank
"""
if self.bank is None:
raise IndexError('Pedalboard not contains a bank')
return self.bank.pedalboards.index(self) | [
"def",
"index",
"(",
"self",
")",
":",
"if",
"self",
".",
"bank",
"is",
"None",
":",
"raise",
"IndexError",
"(",
"'Pedalboard not contains a bank'",
")",
"return",
"self",
".",
"bank",
".",
"pedalboards",
".",
"index",
"(",
"self",
")"
] | Returns the first occurrence of the pedalboard in your bank | [
"Returns",
"the",
"first",
"occurrence",
"of",
"the",
"pedalboard",
"in",
"your",
"bank"
] | 2dcc9f6a79b48e9c9be82efffd855352fa15c5c7 | https://github.com/PedalPi/PluginsManager/blob/2dcc9f6a79b48e9c9be82efffd855352fa15c5c7/pluginsmanager/model/pedalboard.py#L184-L191 |
54,476 | epio/mantrid | mantrid/client.py | MantridClient._request | def _request(self, path, method, body=None):
"Base request function"
h = httplib2.Http()
resp, content = h.request(
self.base_url + path,
method,
body = json.dumps(body),
)
if resp['status'] == "200":
return json.loads(content)
... | python | def _request(self, path, method, body=None):
"Base request function"
h = httplib2.Http()
resp, content = h.request(
self.base_url + path,
method,
body = json.dumps(body),
)
if resp['status'] == "200":
return json.loads(content)
... | [
"def",
"_request",
"(",
"self",
",",
"path",
",",
"method",
",",
"body",
"=",
"None",
")",
":",
"h",
"=",
"httplib2",
".",
"Http",
"(",
")",
"resp",
",",
"content",
"=",
"h",
".",
"request",
"(",
"self",
".",
"base_url",
"+",
"path",
",",
"method... | Base request function | [
"Base",
"request",
"function"
] | 1c699f1a4b33888b533c19cb6d025173f2160576 | https://github.com/epio/mantrid/blob/1c699f1a4b33888b533c19cb6d025173f2160576/mantrid/client.py#L17-L33 |
54,477 | mushkevych/scheduler | synergy/system/process_helper.py | get_process_pid | def get_process_pid(process_name):
""" check for process' pid file and returns pid from there """
try:
pid_filename = get_pid_filename(process_name)
with open(pid_filename, mode='r') as pid_file:
pid = int(pid_file.read().strip())
except IOError:
pid = None
return pid | python | def get_process_pid(process_name):
""" check for process' pid file and returns pid from there """
try:
pid_filename = get_pid_filename(process_name)
with open(pid_filename, mode='r') as pid_file:
pid = int(pid_file.read().strip())
except IOError:
pid = None
return pid | [
"def",
"get_process_pid",
"(",
"process_name",
")",
":",
"try",
":",
"pid_filename",
"=",
"get_pid_filename",
"(",
"process_name",
")",
"with",
"open",
"(",
"pid_filename",
",",
"mode",
"=",
"'r'",
")",
"as",
"pid_file",
":",
"pid",
"=",
"int",
"(",
"pid_f... | check for process' pid file and returns pid from there | [
"check",
"for",
"process",
"pid",
"file",
"and",
"returns",
"pid",
"from",
"there"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/system/process_helper.py#L14-L22 |
54,478 | mushkevych/scheduler | synergy/system/repeat_timer.py | RepeatTimer.cancel | def cancel(self):
""" stops the timer. call_back function is not called """
self.event.clear()
if self.__timer is not None:
self.__timer.cancel() | python | def cancel(self):
""" stops the timer. call_back function is not called """
self.event.clear()
if self.__timer is not None:
self.__timer.cancel() | [
"def",
"cancel",
"(",
"self",
")",
":",
"self",
".",
"event",
".",
"clear",
"(",
")",
"if",
"self",
".",
"__timer",
"is",
"not",
"None",
":",
"self",
".",
"__timer",
".",
"cancel",
"(",
")"
] | stops the timer. call_back function is not called | [
"stops",
"the",
"timer",
".",
"call_back",
"function",
"is",
"not",
"called"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/system/repeat_timer.py#L48-L52 |
54,479 | mushkevych/scheduler | synergy/system/repeat_timer.py | RepeatTimer.trigger | def trigger(self):
""" calls the call_back function. interrupts the timer to start a new countdown """
self.call_back(*self.args, **self.kwargs)
if self.__timer is not None:
self.__timer.cancel() | python | def trigger(self):
""" calls the call_back function. interrupts the timer to start a new countdown """
self.call_back(*self.args, **self.kwargs)
if self.__timer is not None:
self.__timer.cancel() | [
"def",
"trigger",
"(",
"self",
")",
":",
"self",
".",
"call_back",
"(",
"*",
"self",
".",
"args",
",",
"*",
"*",
"self",
".",
"kwargs",
")",
"if",
"self",
".",
"__timer",
"is",
"not",
"None",
":",
"self",
".",
"__timer",
".",
"cancel",
"(",
")"
] | calls the call_back function. interrupts the timer to start a new countdown | [
"calls",
"the",
"call_back",
"function",
".",
"interrupts",
"the",
"timer",
"to",
"start",
"a",
"new",
"countdown"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/system/repeat_timer.py#L54-L58 |
54,480 | mushkevych/scheduler | synergy/system/time_helper.py | cast_to_time_qualifier | def cast_to_time_qualifier(time_qualifier, timeperiod):
""" method casts given timeperiod accordingly to time qualifier.
For example, will cast session time format of 20100101193412 to 2010010119 with QUALIFIER_HOURLY """
if time_qualifier == QUALIFIER_HOURLY:
date_format = SYNERGY_HOURLY_PATTERN
... | python | def cast_to_time_qualifier(time_qualifier, timeperiod):
""" method casts given timeperiod accordingly to time qualifier.
For example, will cast session time format of 20100101193412 to 2010010119 with QUALIFIER_HOURLY """
if time_qualifier == QUALIFIER_HOURLY:
date_format = SYNERGY_HOURLY_PATTERN
... | [
"def",
"cast_to_time_qualifier",
"(",
"time_qualifier",
",",
"timeperiod",
")",
":",
"if",
"time_qualifier",
"==",
"QUALIFIER_HOURLY",
":",
"date_format",
"=",
"SYNERGY_HOURLY_PATTERN",
"elif",
"time_qualifier",
"==",
"QUALIFIER_DAILY",
":",
"date_format",
"=",
"SYNERGY... | method casts given timeperiod accordingly to time qualifier.
For example, will cast session time format of 20100101193412 to 2010010119 with QUALIFIER_HOURLY | [
"method",
"casts",
"given",
"timeperiod",
"accordingly",
"to",
"time",
"qualifier",
".",
"For",
"example",
"will",
"cast",
"session",
"time",
"format",
"of",
"20100101193412",
"to",
"2010010119",
"with",
"QUALIFIER_HOURLY"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/system/time_helper.py#L138-L155 |
54,481 | mushkevych/scheduler | synergy/system/time_helper.py | datetime_to_synergy | def datetime_to_synergy(time_qualifier, dt):
""" method parses datetime and returns Synergy Date"""
if time_qualifier == QUALIFIER_HOURLY:
date_format = SYNERGY_HOURLY_PATTERN
elif time_qualifier == QUALIFIER_DAILY:
date_format = SYNERGY_DAILY_PATTERN
elif time_qualifier == QUALIFIER_MON... | python | def datetime_to_synergy(time_qualifier, dt):
""" method parses datetime and returns Synergy Date"""
if time_qualifier == QUALIFIER_HOURLY:
date_format = SYNERGY_HOURLY_PATTERN
elif time_qualifier == QUALIFIER_DAILY:
date_format = SYNERGY_DAILY_PATTERN
elif time_qualifier == QUALIFIER_MON... | [
"def",
"datetime_to_synergy",
"(",
"time_qualifier",
",",
"dt",
")",
":",
"if",
"time_qualifier",
"==",
"QUALIFIER_HOURLY",
":",
"date_format",
"=",
"SYNERGY_HOURLY_PATTERN",
"elif",
"time_qualifier",
"==",
"QUALIFIER_DAILY",
":",
"date_format",
"=",
"SYNERGY_DAILY_PATT... | method parses datetime and returns Synergy Date | [
"method",
"parses",
"datetime",
"and",
"returns",
"Synergy",
"Date"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/system/time_helper.py#L158-L172 |
54,482 | mushkevych/scheduler | synergy/system/time_helper.py | synergy_to_datetime | def synergy_to_datetime(time_qualifier, timeperiod):
""" method receives timeperiod in Synergy format YYYYMMDDHH and convert it to UTC _naive_ datetime"""
if time_qualifier == QUALIFIER_HOURLY:
date_format = SYNERGY_HOURLY_PATTERN
elif time_qualifier == QUALIFIER_DAILY:
date_format = SYNERGY... | python | def synergy_to_datetime(time_qualifier, timeperiod):
""" method receives timeperiod in Synergy format YYYYMMDDHH and convert it to UTC _naive_ datetime"""
if time_qualifier == QUALIFIER_HOURLY:
date_format = SYNERGY_HOURLY_PATTERN
elif time_qualifier == QUALIFIER_DAILY:
date_format = SYNERGY... | [
"def",
"synergy_to_datetime",
"(",
"time_qualifier",
",",
"timeperiod",
")",
":",
"if",
"time_qualifier",
"==",
"QUALIFIER_HOURLY",
":",
"date_format",
"=",
"SYNERGY_HOURLY_PATTERN",
"elif",
"time_qualifier",
"==",
"QUALIFIER_DAILY",
":",
"date_format",
"=",
"SYNERGY_DA... | method receives timeperiod in Synergy format YYYYMMDDHH and convert it to UTC _naive_ datetime | [
"method",
"receives",
"timeperiod",
"in",
"Synergy",
"format",
"YYYYMMDDHH",
"and",
"convert",
"it",
"to",
"UTC",
"_naive_",
"datetime"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/system/time_helper.py#L175-L189 |
54,483 | mushkevych/scheduler | synergy/system/time_helper.py | session_to_epoch | def session_to_epoch(timestamp):
""" converts Synergy Timestamp for session to UTC zone seconds since epoch """
utc_timetuple = datetime.strptime(timestamp, SYNERGY_SESSION_PATTERN).replace(tzinfo=None).utctimetuple()
return calendar.timegm(utc_timetuple) | python | def session_to_epoch(timestamp):
""" converts Synergy Timestamp for session to UTC zone seconds since epoch """
utc_timetuple = datetime.strptime(timestamp, SYNERGY_SESSION_PATTERN).replace(tzinfo=None).utctimetuple()
return calendar.timegm(utc_timetuple) | [
"def",
"session_to_epoch",
"(",
"timestamp",
")",
":",
"utc_timetuple",
"=",
"datetime",
".",
"strptime",
"(",
"timestamp",
",",
"SYNERGY_SESSION_PATTERN",
")",
".",
"replace",
"(",
"tzinfo",
"=",
"None",
")",
".",
"utctimetuple",
"(",
")",
"return",
"calendar... | converts Synergy Timestamp for session to UTC zone seconds since epoch | [
"converts",
"Synergy",
"Timestamp",
"for",
"session",
"to",
"UTC",
"zone",
"seconds",
"since",
"epoch"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/system/time_helper.py#L192-L195 |
54,484 | PedalPi/PluginsManager | pluginsmanager/observer/mod_host/host.py | Host.add | def add(self, effect):
"""
Add an LV2 plugin encapsulated as a jack client
:param Lv2Effect effect: Effect that will be loaded as LV2 plugin encapsulated
"""
effect.instance = self.instance_index
self.instance_index += 1
self.connection.send(ProtocolParser.add(e... | python | def add(self, effect):
"""
Add an LV2 plugin encapsulated as a jack client
:param Lv2Effect effect: Effect that will be loaded as LV2 plugin encapsulated
"""
effect.instance = self.instance_index
self.instance_index += 1
self.connection.send(ProtocolParser.add(e... | [
"def",
"add",
"(",
"self",
",",
"effect",
")",
":",
"effect",
".",
"instance",
"=",
"self",
".",
"instance_index",
"self",
".",
"instance_index",
"+=",
"1",
"self",
".",
"connection",
".",
"send",
"(",
"ProtocolParser",
".",
"add",
"(",
"effect",
")",
... | Add an LV2 plugin encapsulated as a jack client
:param Lv2Effect effect: Effect that will be loaded as LV2 plugin encapsulated | [
"Add",
"an",
"LV2",
"plugin",
"encapsulated",
"as",
"a",
"jack",
"client"
] | 2dcc9f6a79b48e9c9be82efffd855352fa15c5c7 | https://github.com/PedalPi/PluginsManager/blob/2dcc9f6a79b48e9c9be82efffd855352fa15c5c7/pluginsmanager/observer/mod_host/host.py#L46-L55 |
54,485 | PedalPi/PluginsManager | pluginsmanager/observer/mod_host/host.py | Host.close | def close(self):
"""
Quit the connection with mod-host
"""
if self.connection is not None:
self.connection.close()
if self.connection_fd is not None:
self.connection_fd.close() | python | def close(self):
"""
Quit the connection with mod-host
"""
if self.connection is not None:
self.connection.close()
if self.connection_fd is not None:
self.connection_fd.close() | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"connection",
"is",
"not",
"None",
":",
"self",
".",
"connection",
".",
"close",
"(",
")",
"if",
"self",
".",
"connection_fd",
"is",
"not",
"None",
":",
"self",
".",
"connection_fd",
".",
"clo... | Quit the connection with mod-host | [
"Quit",
"the",
"connection",
"with",
"mod",
"-",
"host"
] | 2dcc9f6a79b48e9c9be82efffd855352fa15c5c7 | https://github.com/PedalPi/PluginsManager/blob/2dcc9f6a79b48e9c9be82efffd855352fa15c5c7/pluginsmanager/observer/mod_host/host.py#L105-L112 |
54,486 | mushkevych/scheduler | synergy/scheduler/state_machine_recomputing.py | StateMachineRecomputing.update_scope_of_processing | def update_scope_of_processing(self, process_name, uow, start_timeperiod, end_timeperiod):
"""method reads collection and refine slice upper bound for processing"""
source_collection_name = uow.source
last_object_id = self.ds.lowest_primary_key(source_collection_name, start_timeperiod, end_timep... | python | def update_scope_of_processing(self, process_name, uow, start_timeperiod, end_timeperiod):
"""method reads collection and refine slice upper bound for processing"""
source_collection_name = uow.source
last_object_id = self.ds.lowest_primary_key(source_collection_name, start_timeperiod, end_timep... | [
"def",
"update_scope_of_processing",
"(",
"self",
",",
"process_name",
",",
"uow",
",",
"start_timeperiod",
",",
"end_timeperiod",
")",
":",
"source_collection_name",
"=",
"uow",
".",
"source",
"last_object_id",
"=",
"self",
".",
"ds",
".",
"lowest_primary_key",
"... | method reads collection and refine slice upper bound for processing | [
"method",
"reads",
"collection",
"and",
"refine",
"slice",
"upper",
"bound",
"for",
"processing"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/state_machine_recomputing.py#L40-L49 |
54,487 | mushkevych/scheduler | synergy/scheduler/state_machine_recomputing.py | StateMachineRecomputing._compute_and_transfer_to_final_run | def _compute_and_transfer_to_final_run(self, process_name, start_timeperiod, end_timeperiod, job_record):
""" method computes new unit_of_work and transfers the job to STATE_FINAL_RUN
it also shares _fuzzy_ DuplicateKeyError logic from _compute_and_transfer_to_progress method"""
source_collectio... | python | def _compute_and_transfer_to_final_run(self, process_name, start_timeperiod, end_timeperiod, job_record):
""" method computes new unit_of_work and transfers the job to STATE_FINAL_RUN
it also shares _fuzzy_ DuplicateKeyError logic from _compute_and_transfer_to_progress method"""
source_collectio... | [
"def",
"_compute_and_transfer_to_final_run",
"(",
"self",
",",
"process_name",
",",
"start_timeperiod",
",",
"end_timeperiod",
",",
"job_record",
")",
":",
"source_collection_name",
"=",
"context",
".",
"process_context",
"[",
"process_name",
"]",
".",
"source",
"star... | method computes new unit_of_work and transfers the job to STATE_FINAL_RUN
it also shares _fuzzy_ DuplicateKeyError logic from _compute_and_transfer_to_progress method | [
"method",
"computes",
"new",
"unit_of_work",
"and",
"transfers",
"the",
"job",
"to",
"STATE_FINAL_RUN",
"it",
"also",
"shares",
"_fuzzy_",
"DuplicateKeyError",
"logic",
"from",
"_compute_and_transfer_to_progress",
"method"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/state_machine_recomputing.py#L65-L75 |
54,488 | mushkevych/scheduler | synergy/system/timeperiod_dict.py | TimeperiodDict._translate_timeperiod | def _translate_timeperiod(self, timeperiod):
""" method translates given timeperiod to the grouped timeperiod """
if self.time_grouping == 1:
# no translation is performed for identity grouping
return timeperiod
# step 1: tokenize timeperiod into: (year, month, day, hour... | python | def _translate_timeperiod(self, timeperiod):
""" method translates given timeperiod to the grouped timeperiod """
if self.time_grouping == 1:
# no translation is performed for identity grouping
return timeperiod
# step 1: tokenize timeperiod into: (year, month, day, hour... | [
"def",
"_translate_timeperiod",
"(",
"self",
",",
"timeperiod",
")",
":",
"if",
"self",
".",
"time_grouping",
"==",
"1",
":",
"# no translation is performed for identity grouping",
"return",
"timeperiod",
"# step 1: tokenize timeperiod into: (year, month, day, hour)",
"# for in... | method translates given timeperiod to the grouped timeperiod | [
"method",
"translates",
"given",
"timeperiod",
"to",
"the",
"grouped",
"timeperiod"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/system/timeperiod_dict.py#L79-L101 |
54,489 | videntity/django-djmongo | djmongo/mongoutils.py | query_mongo_sort_decend | def query_mongo_sort_decend(
database_name,
collection_name,
query={},
skip=0,
limit=getattr(
settings,
'MONGO_LIMIT',
200),
return_keys=(),
sortkey=None):
"""return a response_dict with a list of search results in decending
... | python | def query_mongo_sort_decend(
database_name,
collection_name,
query={},
skip=0,
limit=getattr(
settings,
'MONGO_LIMIT',
200),
return_keys=(),
sortkey=None):
"""return a response_dict with a list of search results in decending
... | [
"def",
"query_mongo_sort_decend",
"(",
"database_name",
",",
"collection_name",
",",
"query",
"=",
"{",
"}",
",",
"skip",
"=",
"0",
",",
"limit",
"=",
"getattr",
"(",
"settings",
",",
"'MONGO_LIMIT'",
",",
"200",
")",
",",
"return_keys",
"=",
"(",
")",
"... | return a response_dict with a list of search results in decending
order based on a sort key | [
"return",
"a",
"response_dict",
"with",
"a",
"list",
"of",
"search",
"results",
"in",
"decending",
"order",
"based",
"on",
"a",
"sort",
"key"
] | 7534e0981a2bc12634cf3f1ed03353623dc57565 | https://github.com/videntity/django-djmongo/blob/7534e0981a2bc12634cf3f1ed03353623dc57565/djmongo/mongoutils.py#L138-L193 |
54,490 | videntity/django-djmongo | djmongo/mongoutils.py | delete_mongo | def delete_mongo(database_name, collection_name,
query={}, just_one=False):
"""delete from mongo helper"""
l = []
response_dict = {}
try:
mongodb_client_url = getattr(settings, 'MONGODB_CLIENT',
'mongodb://localhost:27017/')
mc = Mo... | python | def delete_mongo(database_name, collection_name,
query={}, just_one=False):
"""delete from mongo helper"""
l = []
response_dict = {}
try:
mongodb_client_url = getattr(settings, 'MONGODB_CLIENT',
'mongodb://localhost:27017/')
mc = Mo... | [
"def",
"delete_mongo",
"(",
"database_name",
",",
"collection_name",
",",
"query",
"=",
"{",
"}",
",",
"just_one",
"=",
"False",
")",
":",
"l",
"=",
"[",
"]",
"response_dict",
"=",
"{",
"}",
"try",
":",
"mongodb_client_url",
"=",
"getattr",
"(",
"setting... | delete from mongo helper | [
"delete",
"from",
"mongo",
"helper"
] | 7534e0981a2bc12634cf3f1ed03353623dc57565 | https://github.com/videntity/django-djmongo/blob/7534e0981a2bc12634cf3f1ed03353623dc57565/djmongo/mongoutils.py#L196-L223 |
54,491 | videntity/django-djmongo | djmongo/mongoutils.py | write_mongo | def write_mongo(document, database_name,
collection_name, update=False):
"""Write a document to the collection. Return a response_dict containing
the written record. Method functions as both insert or update based on update
parameter"""
l = []
response_dict = {}
try:
mon... | python | def write_mongo(document, database_name,
collection_name, update=False):
"""Write a document to the collection. Return a response_dict containing
the written record. Method functions as both insert or update based on update
parameter"""
l = []
response_dict = {}
try:
mon... | [
"def",
"write_mongo",
"(",
"document",
",",
"database_name",
",",
"collection_name",
",",
"update",
"=",
"False",
")",
":",
"l",
"=",
"[",
"]",
"response_dict",
"=",
"{",
"}",
"try",
":",
"mongodb_client_url",
"=",
"getattr",
"(",
"settings",
",",
"'MONGOD... | Write a document to the collection. Return a response_dict containing
the written record. Method functions as both insert or update based on update
parameter | [
"Write",
"a",
"document",
"to",
"the",
"collection",
".",
"Return",
"a",
"response_dict",
"containing",
"the",
"written",
"record",
".",
"Method",
"functions",
"as",
"both",
"insert",
"or",
"update",
"based",
"on",
"update",
"parameter"
] | 7534e0981a2bc12634cf3f1ed03353623dc57565 | https://github.com/videntity/django-djmongo/blob/7534e0981a2bc12634cf3f1ed03353623dc57565/djmongo/mongoutils.py#L226-L335 |
54,492 | videntity/django-djmongo | djmongo/mongoutils.py | raw_query_mongo_db | def raw_query_mongo_db(kwargs, database_name, collection_name):
# for key in kwargs:
# print "arg: %s: %s" % (key, kwargs[key])
"""return a result list or an empty list"""
l = []
response_dict = {}
try:
mongodb_client_url = getattr(settings, 'MONGODB_CLIENT',
... | python | def raw_query_mongo_db(kwargs, database_name, collection_name):
# for key in kwargs:
# print "arg: %s: %s" % (key, kwargs[key])
"""return a result list or an empty list"""
l = []
response_dict = {}
try:
mongodb_client_url = getattr(settings, 'MONGODB_CLIENT',
... | [
"def",
"raw_query_mongo_db",
"(",
"kwargs",
",",
"database_name",
",",
"collection_name",
")",
":",
"# for key in kwargs:",
"# print \"arg: %s: %s\" % (key, kwargs[key])",
"l",
"=",
"[",
"]",
"response_dict",
"=",
"{",
"}",
"try",
":",
"mongodb_client_url",
"=",
"g... | return a result list or an empty list | [
"return",
"a",
"result",
"list",
"or",
"an",
"empty",
"list"
] | 7534e0981a2bc12634cf3f1ed03353623dc57565 | https://github.com/videntity/django-djmongo/blob/7534e0981a2bc12634cf3f1ed03353623dc57565/djmongo/mongoutils.py#L491-L518 |
54,493 | videntity/django-djmongo | djmongo/mongoutils.py | cast_number_strings_to_integers | def cast_number_strings_to_integers(d):
"""d is a dict"""
for k, v in d.items():
# print type(v)
if determine_if_str_or_unicode(v):
if v.isdigit():
d[k] = int(v)
return d | python | def cast_number_strings_to_integers(d):
"""d is a dict"""
for k, v in d.items():
# print type(v)
if determine_if_str_or_unicode(v):
if v.isdigit():
d[k] = int(v)
return d | [
"def",
"cast_number_strings_to_integers",
"(",
"d",
")",
":",
"for",
"k",
",",
"v",
"in",
"d",
".",
"items",
"(",
")",
":",
"# print type(v)",
"if",
"determine_if_str_or_unicode",
"(",
"v",
")",
":",
"if",
"v",
".",
"isdigit",
"(",
")",
":",
"d",
"[",
... | d is a dict | [
"d",
"is",
"a",
"dict"
] | 7534e0981a2bc12634cf3f1ed03353623dc57565 | https://github.com/videntity/django-djmongo/blob/7534e0981a2bc12634cf3f1ed03353623dc57565/djmongo/mongoutils.py#L521-L528 |
54,494 | mushkevych/scheduler | synergy/mx/tree_node_details.py | TreeNodeDetails.get_details | def get_details(cls, node, as_model=False):
"""method returns either RestJob instance or corresponding document, depending on the as_model argument """
rest_job = RestJob(
process_name=node.process_name,
timeperiod=node.timeperiod,
time_qualifier=node.time_qualifier,
... | python | def get_details(cls, node, as_model=False):
"""method returns either RestJob instance or corresponding document, depending on the as_model argument """
rest_job = RestJob(
process_name=node.process_name,
timeperiod=node.timeperiod,
time_qualifier=node.time_qualifier,
... | [
"def",
"get_details",
"(",
"cls",
",",
"node",
",",
"as_model",
"=",
"False",
")",
":",
"rest_job",
"=",
"RestJob",
"(",
"process_name",
"=",
"node",
".",
"process_name",
",",
"timeperiod",
"=",
"node",
".",
"timeperiod",
",",
"time_qualifier",
"=",
"node"... | method returns either RestJob instance or corresponding document, depending on the as_model argument | [
"method",
"returns",
"either",
"RestJob",
"instance",
"or",
"corresponding",
"document",
"depending",
"on",
"the",
"as_model",
"argument"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/mx/tree_node_details.py#L21-L35 |
54,495 | PedalPi/PluginsManager | pluginsmanager/util/mod_pedalboard_converter.py | ModPedalboardConverter.discover_system_effect | def discover_system_effect(self, pedalboard_info):
"""
Generate the system effect based in pedalboard_info
:param dict pedalboard_info: For obtain this, see
:meth:`~pluginsmanager.util.mod_pedalboard_converter.ModPedalboardConvert.get_pedalboard_info()`
:return SystemEffect:... | python | def discover_system_effect(self, pedalboard_info):
"""
Generate the system effect based in pedalboard_info
:param dict pedalboard_info: For obtain this, see
:meth:`~pluginsmanager.util.mod_pedalboard_converter.ModPedalboardConvert.get_pedalboard_info()`
:return SystemEffect:... | [
"def",
"discover_system_effect",
"(",
"self",
",",
"pedalboard_info",
")",
":",
"# MOD swap ins and outs!!!",
"hardware",
"=",
"pedalboard_info",
"[",
"'hardware'",
"]",
"total_audio_outs",
"=",
"hardware",
"[",
"'audio_ins'",
"]",
"total_audio_ins",
"=",
"hardware",
... | Generate the system effect based in pedalboard_info
:param dict pedalboard_info: For obtain this, see
:meth:`~pluginsmanager.util.mod_pedalboard_converter.ModPedalboardConvert.get_pedalboard_info()`
:return SystemEffect: SystemEffect generated based in pedalboard_info | [
"Generate",
"the",
"system",
"effect",
"based",
"in",
"pedalboard_info"
] | 2dcc9f6a79b48e9c9be82efffd855352fa15c5c7 | https://github.com/PedalPi/PluginsManager/blob/2dcc9f6a79b48e9c9be82efffd855352fa15c5c7/pluginsmanager/util/mod_pedalboard_converter.py#L164-L190 |
54,496 | mushkevych/scheduler | synergy/scheduler/state_machine_freerun.py | StateMachineFreerun._log_message | def _log_message(self, level, freerun_entry, msg):
""" method performs logging into log file and the freerun_entry """
self.logger.log(level, msg)
assert isinstance(freerun_entry, FreerunProcessEntry)
event_log = freerun_entry.event_log
if len(event_log) > MAX_NUMBER_OF_EVENTS:
... | python | def _log_message(self, level, freerun_entry, msg):
""" method performs logging into log file and the freerun_entry """
self.logger.log(level, msg)
assert isinstance(freerun_entry, FreerunProcessEntry)
event_log = freerun_entry.event_log
if len(event_log) > MAX_NUMBER_OF_EVENTS:
... | [
"def",
"_log_message",
"(",
"self",
",",
"level",
",",
"freerun_entry",
",",
"msg",
")",
":",
"self",
".",
"logger",
".",
"log",
"(",
"level",
",",
"msg",
")",
"assert",
"isinstance",
"(",
"freerun_entry",
",",
"FreerunProcessEntry",
")",
"event_log",
"=",... | method performs logging into log file and the freerun_entry | [
"method",
"performs",
"logging",
"into",
"log",
"file",
"and",
"the",
"freerun_entry"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/state_machine_freerun.py#L31-L40 |
54,497 | mushkevych/scheduler | synergy/scheduler/state_machine_freerun.py | StateMachineFreerun._process_terminal_state | def _process_terminal_state(self, freerun_entry, uow, flow_request=None):
""" method that takes care of processing unit_of_work records in
STATE_PROCESSED, STATE_NOOP, STATE_INVALID, STATE_CANCELED states"""
msg = 'UOW for {0} found in state {1}.'.format(freerun_entry.schedulable_name, uow.s... | python | def _process_terminal_state(self, freerun_entry, uow, flow_request=None):
""" method that takes care of processing unit_of_work records in
STATE_PROCESSED, STATE_NOOP, STATE_INVALID, STATE_CANCELED states"""
msg = 'UOW for {0} found in state {1}.'.format(freerun_entry.schedulable_name, uow.s... | [
"def",
"_process_terminal_state",
"(",
"self",
",",
"freerun_entry",
",",
"uow",
",",
"flow_request",
"=",
"None",
")",
":",
"msg",
"=",
"'UOW for {0} found in state {1}.'",
".",
"format",
"(",
"freerun_entry",
".",
"schedulable_name",
",",
"uow",
".",
"state",
... | method that takes care of processing unit_of_work records in
STATE_PROCESSED, STATE_NOOP, STATE_INVALID, STATE_CANCELED states | [
"method",
"that",
"takes",
"care",
"of",
"processing",
"unit_of_work",
"records",
"in",
"STATE_PROCESSED",
"STATE_NOOP",
"STATE_INVALID",
"STATE_CANCELED",
"states"
] | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/state_machine_freerun.py#L142-L147 |
54,498 | mushkevych/scheduler | synergy/scheduler/state_machine_freerun.py | StateMachineFreerun.manage_schedulable | def manage_schedulable(self, freerun_entry, flow_request=None):
""" method main duty - is to _avoid_ publishing another unit_of_work, if previous was not yet processed
In case the Scheduler sees that the unit_of_work is pending,
it will issue new WorkerMqRequest for the same UOW """
... | python | def manage_schedulable(self, freerun_entry, flow_request=None):
""" method main duty - is to _avoid_ publishing another unit_of_work, if previous was not yet processed
In case the Scheduler sees that the unit_of_work is pending,
it will issue new WorkerMqRequest for the same UOW """
... | [
"def",
"manage_schedulable",
"(",
"self",
",",
"freerun_entry",
",",
"flow_request",
"=",
"None",
")",
":",
"assert",
"isinstance",
"(",
"freerun_entry",
",",
"FreerunProcessEntry",
")",
"uow",
"=",
"None",
"if",
"freerun_entry",
".",
"related_unit_of_work",
":",
... | method main duty - is to _avoid_ publishing another unit_of_work, if previous was not yet processed
In case the Scheduler sees that the unit_of_work is pending,
it will issue new WorkerMqRequest for the same UOW | [
"method",
"main",
"duty",
"-",
"is",
"to",
"_avoid_",
"publishing",
"another",
"unit_of_work",
"if",
"previous",
"was",
"not",
"yet",
"processed",
"In",
"case",
"the",
"Scheduler",
"sees",
"that",
"the",
"unit_of_work",
"is",
"pending",
"it",
"will",
"issue",
... | 6740331360f49083c208085fb5a60ce80ebf418b | https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/state_machine_freerun.py#L149-L176 |
54,499 | videntity/django-djmongo | djmongo/search/xls_utils.py | tupleize | def tupleize(
rows,
alphabetize_columns=getattr(
settings,
'ALPHABETIZE_COLUMNS',
False)):
"""Also alphabetizes columns and returns a tuple of tuples"""
# define a blank list as our return object
l = []
for r in rows:
row = []
row = list(r.val... | python | def tupleize(
rows,
alphabetize_columns=getattr(
settings,
'ALPHABETIZE_COLUMNS',
False)):
"""Also alphabetizes columns and returns a tuple of tuples"""
# define a blank list as our return object
l = []
for r in rows:
row = []
row = list(r.val... | [
"def",
"tupleize",
"(",
"rows",
",",
"alphabetize_columns",
"=",
"getattr",
"(",
"settings",
",",
"'ALPHABETIZE_COLUMNS'",
",",
"False",
")",
")",
":",
"# define a blank list as our return object\r",
"l",
"=",
"[",
"]",
"for",
"r",
"in",
"rows",
":",
"row",
"=... | Also alphabetizes columns and returns a tuple of tuples | [
"Also",
"alphabetizes",
"columns",
"and",
"returns",
"a",
"tuple",
"of",
"tuples"
] | 7534e0981a2bc12634cf3f1ed03353623dc57565 | https://github.com/videntity/django-djmongo/blob/7534e0981a2bc12634cf3f1ed03353623dc57565/djmongo/search/xls_utils.py#L54-L75 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.