repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 3
values | summary stringlengths 4 350 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
adobe-apiplatform/umapi-client.py | umapi_client/connection.py | Connection.execute_multiple | def execute_multiple(self, actions, immediate=True):
"""
Execute multiple Actions (each containing commands on a single object).
Normally, the actions are sent for execution immediately (possibly preceded
by earlier queued commands), but if you are going for maximum efficiency
yo... | python | def execute_multiple(self, actions, immediate=True):
"""
Execute multiple Actions (each containing commands on a single object).
Normally, the actions are sent for execution immediately (possibly preceded
by earlier queued commands), but if you are going for maximum efficiency
yo... | [
"def",
"execute_multiple",
"(",
"self",
",",
"actions",
",",
"immediate",
"=",
"True",
")",
":",
"# throttling part 1: split up each action into smaller actions, as needed",
"# optionally split large lists of groups in add/remove commands (if action supports it)",
"split_actions",
"=",... | Execute multiple Actions (each containing commands on a single object).
Normally, the actions are sent for execution immediately (possibly preceded
by earlier queued commands), but if you are going for maximum efficiency
you can set immeediate=False which will cause the connection to wait
... | [
"Execute",
"multiple",
"Actions",
"(",
"each",
"containing",
"commands",
"on",
"a",
"single",
"object",
")",
".",
"Normally",
"the",
"actions",
"are",
"sent",
"for",
"execution",
"immediately",
"(",
"possibly",
"preceded",
"by",
"earlier",
"queued",
"commands",
... | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/connection.py#L319-L384 | train | Execute multiple actions on a single object. |
adobe-apiplatform/umapi-client.py | umapi_client/connection.py | Connection._execute_batch | def _execute_batch(self, actions):
"""
Execute a single batch of Actions.
For each action that has a problem, we annotate the action with the
error information for that action, and we return the number of
successful actions in the batch.
:param actions: the list of Action... | python | def _execute_batch(self, actions):
"""
Execute a single batch of Actions.
For each action that has a problem, we annotate the action with the
error information for that action, and we return the number of
successful actions in the batch.
:param actions: the list of Action... | [
"def",
"_execute_batch",
"(",
"self",
",",
"actions",
")",
":",
"wire_form",
"=",
"[",
"a",
".",
"wire_dict",
"(",
")",
"for",
"a",
"in",
"actions",
"]",
"if",
"self",
".",
"test_mode",
":",
"result",
"=",
"self",
".",
"make_call",
"(",
"\"/action/%s?t... | Execute a single batch of Actions.
For each action that has a problem, we annotate the action with the
error information for that action, and we return the number of
successful actions in the batch.
:param actions: the list of Action objects to be executed
:return: count of succe... | [
"Execute",
"a",
"single",
"batch",
"of",
"Actions",
".",
"For",
"each",
"action",
"that",
"has",
"a",
"problem",
"we",
"annotate",
"the",
"action",
"with",
"the",
"error",
"information",
"for",
"that",
"action",
"and",
"we",
"return",
"the",
"number",
"of"... | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/connection.py#L386-L412 | train | Execute a batch of Actions. |
adobe-apiplatform/umapi-client.py | umapi_client/connection.py | Connection.make_call | def make_call(self, path, body=None, delete=False):
"""
Make a single UMAPI call with error handling and retry on temporary failure.
:param path: the string endpoint path for the call
:param body: (optional) list of dictionaries to be serialized into the request body
:return: the... | python | def make_call(self, path, body=None, delete=False):
"""
Make a single UMAPI call with error handling and retry on temporary failure.
:param path: the string endpoint path for the call
:param body: (optional) list of dictionaries to be serialized into the request body
:return: the... | [
"def",
"make_call",
"(",
"self",
",",
"path",
",",
"body",
"=",
"None",
",",
"delete",
"=",
"False",
")",
":",
"if",
"body",
":",
"request_body",
"=",
"json",
".",
"dumps",
"(",
"body",
")",
"def",
"call",
"(",
")",
":",
"return",
"self",
".",
"s... | Make a single UMAPI call with error handling and retry on temporary failure.
:param path: the string endpoint path for the call
:param body: (optional) list of dictionaries to be serialized into the request body
:return: the requests.result object (on 200 response), raise error otherwise | [
"Make",
"a",
"single",
"UMAPI",
"call",
"with",
"error",
"handling",
"and",
"retry",
"on",
"temporary",
"failure",
".",
":",
"param",
"path",
":",
"the",
"string",
"endpoint",
"path",
"for",
"the",
"call",
":",
"param",
"body",
":",
"(",
"optional",
")",... | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/connection.py#L414-L477 | train | Make a single UMAPI call with error handling and retry on temporary failure. |
adobe-apiplatform/umapi-client.py | umapi_client/legacy.py | paginate | def paginate(query, org_id, max_pages=maxsize, max_records=maxsize):
"""
Paginate through all results of a UMAPI query
:param query: a query method from a UMAPI instance (callable as a function)
:param org_id: the organization being queried
:param max_pages: the max number of pages to collect before... | python | def paginate(query, org_id, max_pages=maxsize, max_records=maxsize):
"""
Paginate through all results of a UMAPI query
:param query: a query method from a UMAPI instance (callable as a function)
:param org_id: the organization being queried
:param max_pages: the max number of pages to collect before... | [
"def",
"paginate",
"(",
"query",
",",
"org_id",
",",
"max_pages",
"=",
"maxsize",
",",
"max_records",
"=",
"maxsize",
")",
":",
"page_count",
"=",
"0",
"record_count",
"=",
"0",
"records",
"=",
"[",
"]",
"while",
"page_count",
"<",
"max_pages",
"and",
"r... | Paginate through all results of a UMAPI query
:param query: a query method from a UMAPI instance (callable as a function)
:param org_id: the organization being queried
:param max_pages: the max number of pages to collect before returning (default all)
:param max_records: the max number of records to col... | [
"Paginate",
"through",
"all",
"results",
"of",
"a",
"UMAPI",
"query",
":",
"param",
"query",
":",
"a",
"query",
"method",
"from",
"a",
"UMAPI",
"instance",
"(",
"callable",
"as",
"a",
"function",
")",
":",
"param",
"org_id",
":",
"the",
"organization",
"... | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/legacy.py#L186-L211 | train | Paginate through all results of a UMAPI query
|
adobe-apiplatform/umapi-client.py | umapi_client/legacy.py | make_call | def make_call(query, org_id, page):
"""
Make a single UMAPI call with error handling and server-controlled throttling.
(Adapted from sample code at https://www.adobe.io/products/usermanagement/docs/samples#retry)
:param query: a query method from a UMAPI instance (callable as a function)
:param org_... | python | def make_call(query, org_id, page):
"""
Make a single UMAPI call with error handling and server-controlled throttling.
(Adapted from sample code at https://www.adobe.io/products/usermanagement/docs/samples#retry)
:param query: a query method from a UMAPI instance (callable as a function)
:param org_... | [
"def",
"make_call",
"(",
"query",
",",
"org_id",
",",
"page",
")",
":",
"wait_time",
"=",
"0",
"num_attempts",
"=",
"0",
"while",
"num_attempts",
"<",
"retry_max_attempts",
":",
"if",
"wait_time",
">",
"0",
":",
"sleep",
"(",
"wait_time",
")",
"wait_time",... | Make a single UMAPI call with error handling and server-controlled throttling.
(Adapted from sample code at https://www.adobe.io/products/usermanagement/docs/samples#retry)
:param query: a query method from a UMAPI instance (callable as a function)
:param org_id: the organization being queried
:param pa... | [
"Make",
"a",
"single",
"UMAPI",
"call",
"with",
"error",
"handling",
"and",
"server",
"-",
"controlled",
"throttling",
".",
"(",
"Adapted",
"from",
"sample",
"code",
"at",
"https",
":",
"//",
"www",
".",
"adobe",
".",
"io",
"/",
"products",
"/",
"userman... | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/legacy.py#L214-L257 | train | Make a single UMAPI call with error handling and server - controlled throttling. |
adobe-apiplatform/umapi-client.py | umapi_client/legacy.py | Action.do | def do(self, **kwargs):
"""
Here for compatibility with legacy clients only - DO NOT USE!!!
This is sort of mix of "append" and "insert": it puts commands in the list,
with some half smarts about which commands go at the front or back.
If you add multiple commands to the back in ... | python | def do(self, **kwargs):
"""
Here for compatibility with legacy clients only - DO NOT USE!!!
This is sort of mix of "append" and "insert": it puts commands in the list,
with some half smarts about which commands go at the front or back.
If you add multiple commands to the back in ... | [
"def",
"do",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# add \"create\" / \"add\" / \"removeFrom\" first",
"for",
"k",
",",
"v",
"in",
"list",
"(",
"six",
".",
"iteritems",
"(",
"kwargs",
")",
")",
":",
"if",
"k",
".",
"startswith",
"(",
"\"create... | Here for compatibility with legacy clients only - DO NOT USE!!!
This is sort of mix of "append" and "insert": it puts commands in the list,
with some half smarts about which commands go at the front or back.
If you add multiple commands to the back in one call, they will get added sorted by comm... | [
"Here",
"for",
"compatibility",
"with",
"legacy",
"clients",
"only",
"-",
"DO",
"NOT",
"USE!!!",
"This",
"is",
"sort",
"of",
"mix",
"of",
"append",
"and",
"insert",
":",
"it",
"puts",
"commands",
"in",
"the",
"list",
"with",
"some",
"half",
"smarts",
"ab... | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/legacy.py#L62-L83 | train | This method is used to add commands to the list of available user - defined commands. |
adobe-apiplatform/umapi-client.py | umapi_client/api.py | Action.split | def split(self, max_commands):
"""
Split this action into an equivalent list of actions, each of which have at most max_commands commands.
:param max_commands: max number of commands allowed in any action
:return: the list of commands created from this one
"""
a_prior = A... | python | def split(self, max_commands):
"""
Split this action into an equivalent list of actions, each of which have at most max_commands commands.
:param max_commands: max number of commands allowed in any action
:return: the list of commands created from this one
"""
a_prior = A... | [
"def",
"split",
"(",
"self",
",",
"max_commands",
")",
":",
"a_prior",
"=",
"Action",
"(",
"*",
"*",
"self",
".",
"frame",
")",
"a_prior",
".",
"commands",
"=",
"list",
"(",
"self",
".",
"commands",
")",
"self",
".",
"split_actions",
"=",
"[",
"a_pri... | Split this action into an equivalent list of actions, each of which have at most max_commands commands.
:param max_commands: max number of commands allowed in any action
:return: the list of commands created from this one | [
"Split",
"this",
"action",
"into",
"an",
"equivalent",
"list",
"of",
"actions",
"each",
"of",
"which",
"have",
"at",
"most",
"max_commands",
"commands",
".",
":",
"param",
"max_commands",
":",
"max",
"number",
"of",
"commands",
"allowed",
"in",
"any",
"actio... | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L44-L58 | train | Split this action into an equivalent list of actions each of which have at most max_commands commands. |
adobe-apiplatform/umapi-client.py | umapi_client/api.py | Action.append | def append(self, **kwargs):
"""
Add commands at the end of the sequence.
Be careful: because this runs in Python 2.x, the order of the kwargs dict may not match
the order in which the args were specified. Thus, if you care about specific ordering,
you must make multiple calls t... | python | def append(self, **kwargs):
"""
Add commands at the end of the sequence.
Be careful: because this runs in Python 2.x, the order of the kwargs dict may not match
the order in which the args were specified. Thus, if you care about specific ordering,
you must make multiple calls t... | [
"def",
"append",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"k",
",",
"v",
"in",
"six",
".",
"iteritems",
"(",
"kwargs",
")",
":",
"self",
".",
"commands",
".",
"append",
"(",
"{",
"k",
":",
"v",
"}",
")",
"return",
"self"
] | Add commands at the end of the sequence.
Be careful: because this runs in Python 2.x, the order of the kwargs dict may not match
the order in which the args were specified. Thus, if you care about specific ordering,
you must make multiple calls to append in that order. Luckily, append returns... | [
"Add",
"commands",
"at",
"the",
"end",
"of",
"the",
"sequence",
"."
] | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L67-L81 | train | Add commands at the end of the sequence. |
adobe-apiplatform/umapi-client.py | umapi_client/api.py | Action.insert | def insert(self, **kwargs):
"""
Insert commands at the beginning of the sequence.
This is provided because certain commands
have to come first (such as user creation), but may be need to beadded
after other commands have already been specified.
Later calls to insert put ... | python | def insert(self, **kwargs):
"""
Insert commands at the beginning of the sequence.
This is provided because certain commands
have to come first (such as user creation), but may be need to beadded
after other commands have already been specified.
Later calls to insert put ... | [
"def",
"insert",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"k",
",",
"v",
"in",
"six",
".",
"iteritems",
"(",
"kwargs",
")",
":",
"self",
".",
"commands",
".",
"insert",
"(",
"0",
",",
"{",
"k",
":",
"v",
"}",
")",
"return",
"sel... | Insert commands at the beginning of the sequence.
This is provided because certain commands
have to come first (such as user creation), but may be need to beadded
after other commands have already been specified.
Later calls to insert put their commands before those in the earlier calls... | [
"Insert",
"commands",
"at",
"the",
"beginning",
"of",
"the",
"sequence",
"."
] | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L83-L100 | train | Insert commands at the beginning of the sequence. |
adobe-apiplatform/umapi-client.py | umapi_client/api.py | Action.report_command_error | def report_command_error(self, error_dict):
"""
Report a server error executing a command.
We keep track of the command's position in the command list,
and we add annotation of what the command was, to the error.
:param error_dict: The server's error dict for the error encounter... | python | def report_command_error(self, error_dict):
"""
Report a server error executing a command.
We keep track of the command's position in the command list,
and we add annotation of what the command was, to the error.
:param error_dict: The server's error dict for the error encounter... | [
"def",
"report_command_error",
"(",
"self",
",",
"error_dict",
")",
":",
"error",
"=",
"dict",
"(",
"error_dict",
")",
"error",
"[",
"\"command\"",
"]",
"=",
"self",
".",
"commands",
"[",
"error_dict",
"[",
"\"step\"",
"]",
"]",
"error",
"[",
"\"target\"",... | Report a server error executing a command.
We keep track of the command's position in the command list,
and we add annotation of what the command was, to the error.
:param error_dict: The server's error dict for the error encountered | [
"Report",
"a",
"server",
"error",
"executing",
"a",
"command",
"."
] | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L102-L115 | train | Report a server error executing a command. |
adobe-apiplatform/umapi-client.py | umapi_client/api.py | Action.execution_errors | def execution_errors(self):
"""
Return a list of commands that encountered execution errors, with the error.
Each dictionary entry gives the command dictionary and the error dictionary
:return: list of commands that gave errors, with their error information
"""
if self.s... | python | def execution_errors(self):
"""
Return a list of commands that encountered execution errors, with the error.
Each dictionary entry gives the command dictionary and the error dictionary
:return: list of commands that gave errors, with their error information
"""
if self.s... | [
"def",
"execution_errors",
"(",
"self",
")",
":",
"if",
"self",
".",
"split_actions",
":",
"# throttling split this action, get errors from the split",
"return",
"[",
"dict",
"(",
"e",
")",
"for",
"s",
"in",
"self",
".",
"split_actions",
"for",
"e",
"in",
"s",
... | Return a list of commands that encountered execution errors, with the error.
Each dictionary entry gives the command dictionary and the error dictionary
:return: list of commands that gave errors, with their error information | [
"Return",
"a",
"list",
"of",
"commands",
"that",
"encountered",
"execution",
"errors",
"with",
"the",
"error",
"."
] | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L117-L128 | train | Return a list of commands that encountered execution errors with the error. |
adobe-apiplatform/umapi-client.py | umapi_client/api.py | Action.maybe_split_groups | def maybe_split_groups(self, max_groups):
"""
Check if group lists in add/remove directives should be split and split them if needed
:param max_groups: Max group list size
:return: True if at least one command was split, False if none were split
"""
split_commands = []
... | python | def maybe_split_groups(self, max_groups):
"""
Check if group lists in add/remove directives should be split and split them if needed
:param max_groups: Max group list size
:return: True if at least one command was split, False if none were split
"""
split_commands = []
... | [
"def",
"maybe_split_groups",
"(",
"self",
",",
"max_groups",
")",
":",
"split_commands",
"=",
"[",
"]",
"# return True if we split at least once",
"maybe_split",
"=",
"False",
"valid_step_keys",
"=",
"[",
"'add'",
",",
"'addRoles'",
",",
"'remove'",
"]",
"for",
"c... | Check if group lists in add/remove directives should be split and split them if needed
:param max_groups: Max group list size
:return: True if at least one command was split, False if none were split | [
"Check",
"if",
"group",
"lists",
"in",
"add",
"/",
"remove",
"directives",
"should",
"be",
"split",
"and",
"split",
"them",
"if",
"needed",
":",
"param",
"max_groups",
":",
"Max",
"group",
"list",
"size",
":",
"return",
":",
"True",
"if",
"at",
"least",
... | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L130-L161 | train | Check if group lists in add or remove directives should be split and split them if needed. |
adobe-apiplatform/umapi-client.py | umapi_client/api.py | QueryMultiple.reload | def reload(self):
"""
Rerun the query (lazily).
The results will contain any values on the server side that have changed since the last run.
:return: None
"""
self._results = []
self._next_item_index = 0
self._next_page_index = 0
self._last_page_se... | python | def reload(self):
"""
Rerun the query (lazily).
The results will contain any values on the server side that have changed since the last run.
:return: None
"""
self._results = []
self._next_item_index = 0
self._next_page_index = 0
self._last_page_se... | [
"def",
"reload",
"(",
"self",
")",
":",
"self",
".",
"_results",
"=",
"[",
"]",
"self",
".",
"_next_item_index",
"=",
"0",
"self",
".",
"_next_page_index",
"=",
"0",
"self",
".",
"_last_page_seen",
"=",
"False"
] | Rerun the query (lazily).
The results will contain any values on the server side that have changed since the last run.
:return: None | [
"Rerun",
"the",
"query",
"(",
"lazily",
")",
".",
"The",
"results",
"will",
"contain",
"any",
"values",
"on",
"the",
"server",
"side",
"that",
"have",
"changed",
"since",
"the",
"last",
"run",
".",
":",
"return",
":",
"None"
] | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L187-L196 | train | Reload the results from the server side. |
adobe-apiplatform/umapi-client.py | umapi_client/api.py | QueryMultiple._next_page | def _next_page(self):
"""
Fetch the next page of the query.
"""
if self._last_page_seen:
raise StopIteration
new, self._last_page_seen = self.conn.query_multiple(self.object_type, self._next_page_index,
self... | python | def _next_page(self):
"""
Fetch the next page of the query.
"""
if self._last_page_seen:
raise StopIteration
new, self._last_page_seen = self.conn.query_multiple(self.object_type, self._next_page_index,
self... | [
"def",
"_next_page",
"(",
"self",
")",
":",
"if",
"self",
".",
"_last_page_seen",
":",
"raise",
"StopIteration",
"new",
",",
"self",
".",
"_last_page_seen",
"=",
"self",
".",
"conn",
".",
"query_multiple",
"(",
"self",
".",
"object_type",
",",
"self",
".",... | Fetch the next page of the query. | [
"Fetch",
"the",
"next",
"page",
"of",
"the",
"query",
"."
] | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L198-L210 | train | Fetch the next page of the query. |
adobe-apiplatform/umapi-client.py | umapi_client/api.py | QueryMultiple.all_results | def all_results(self):
"""
Eagerly fetch all the results.
This can be called after already doing some amount of iteration, and it will return
all the previously-iterated results as well as any results that weren't yet iterated.
:return: a list of all the results.
"""
... | python | def all_results(self):
"""
Eagerly fetch all the results.
This can be called after already doing some amount of iteration, and it will return
all the previously-iterated results as well as any results that weren't yet iterated.
:return: a list of all the results.
"""
... | [
"def",
"all_results",
"(",
"self",
")",
":",
"while",
"not",
"self",
".",
"_last_page_seen",
":",
"self",
".",
"_next_page",
"(",
")",
"self",
".",
"_next_item_index",
"=",
"len",
"(",
"self",
".",
"_results",
")",
"return",
"list",
"(",
"self",
".",
"... | Eagerly fetch all the results.
This can be called after already doing some amount of iteration, and it will return
all the previously-iterated results as well as any results that weren't yet iterated.
:return: a list of all the results. | [
"Eagerly",
"fetch",
"all",
"the",
"results",
".",
"This",
"can",
"be",
"called",
"after",
"already",
"doing",
"some",
"amount",
"of",
"iteration",
"and",
"it",
"will",
"return",
"all",
"the",
"previously",
"-",
"iterated",
"results",
"as",
"well",
"as",
"a... | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L241-L251 | train | Eagerly fetch all the results. |
adobe-apiplatform/umapi-client.py | umapi_client/api.py | QuerySingle._fetch_result | def _fetch_result(self):
"""
Fetch the queried object.
"""
self._result = self.conn.query_single(self.object_type, self.url_params, self.query_params) | python | def _fetch_result(self):
"""
Fetch the queried object.
"""
self._result = self.conn.query_single(self.object_type, self.url_params, self.query_params) | [
"def",
"_fetch_result",
"(",
"self",
")",
":",
"self",
".",
"_result",
"=",
"self",
".",
"conn",
".",
"query_single",
"(",
"self",
".",
"object_type",
",",
"self",
".",
"url_params",
",",
"self",
".",
"query_params",
")"
] | Fetch the queried object. | [
"Fetch",
"the",
"queried",
"object",
"."
] | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L282-L286 | train | Fetch the object from the server. |
adobe-apiplatform/umapi-client.py | umapi_client/functional.py | UserAction.create | def create(self, first_name=None, last_name=None, country=None, email=None,
on_conflict=IfAlreadyExistsOptions.ignoreIfAlreadyExists):
"""
Create the user on the Adobe back end.
See [Issue 32](https://github.com/adobe-apiplatform/umapi-client.py/issues/32): because
we retr... | python | def create(self, first_name=None, last_name=None, country=None, email=None,
on_conflict=IfAlreadyExistsOptions.ignoreIfAlreadyExists):
"""
Create the user on the Adobe back end.
See [Issue 32](https://github.com/adobe-apiplatform/umapi-client.py/issues/32): because
we retr... | [
"def",
"create",
"(",
"self",
",",
"first_name",
"=",
"None",
",",
"last_name",
"=",
"None",
",",
"country",
"=",
"None",
",",
"email",
"=",
"None",
",",
"on_conflict",
"=",
"IfAlreadyExistsOptions",
".",
"ignoreIfAlreadyExists",
")",
":",
"# first validate th... | Create the user on the Adobe back end.
See [Issue 32](https://github.com/adobe-apiplatform/umapi-client.py/issues/32): because
we retry create calls if they time out, the default conflict handling for creation is to ignore the
create call if the user already exists (possibly from an earlier call... | [
"Create",
"the",
"user",
"on",
"the",
"Adobe",
"back",
"end",
".",
"See",
"[",
"Issue",
"32",
"]",
"(",
"https",
":",
"//",
"github",
".",
"com",
"/",
"adobe",
"-",
"apiplatform",
"/",
"umapi",
"-",
"client",
".",
"py",
"/",
"issues",
"/",
"32",
... | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L116-L156 | train | Create a user on the Adobe back end. |
adobe-apiplatform/umapi-client.py | umapi_client/functional.py | UserAction.update | def update(self, email=None, username=None, first_name=None, last_name=None, country=None):
"""
Update values on an existing user. See the API docs for what kinds of update are possible.
:param email: new email for this user
:param username: new username for this user
:param fir... | python | def update(self, email=None, username=None, first_name=None, last_name=None, country=None):
"""
Update values on an existing user. See the API docs for what kinds of update are possible.
:param email: new email for this user
:param username: new username for this user
:param fir... | [
"def",
"update",
"(",
"self",
",",
"email",
"=",
"None",
",",
"username",
"=",
"None",
",",
"first_name",
"=",
"None",
",",
"last_name",
"=",
"None",
",",
"country",
"=",
"None",
")",
":",
"if",
"username",
"and",
"self",
".",
"id_type",
"!=",
"Ident... | Update values on an existing user. See the API docs for what kinds of update are possible.
:param email: new email for this user
:param username: new username for this user
:param first_name: new first name for this user
:param last_name: new last name for this user
:param count... | [
"Update",
"values",
"on",
"an",
"existing",
"user",
".",
"See",
"the",
"API",
"docs",
"for",
"what",
"kinds",
"of",
"update",
"are",
"possible",
".",
":",
"param",
"email",
":",
"new",
"email",
"for",
"this",
"user",
":",
"param",
"username",
":",
"new... | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L158-L180 | train | Update the user s attributes. |
adobe-apiplatform/umapi-client.py | umapi_client/functional.py | UserAction.add_to_groups | def add_to_groups(self, groups=None, all_groups=False, group_type=None):
"""
Add user to some (typically PLC) groups. Note that, if you add to no groups, the effect
is simply to do an "add to organization Everybody group", so we let that be done.
:param groups: list of group names the u... | python | def add_to_groups(self, groups=None, all_groups=False, group_type=None):
"""
Add user to some (typically PLC) groups. Note that, if you add to no groups, the effect
is simply to do an "add to organization Everybody group", so we let that be done.
:param groups: list of group names the u... | [
"def",
"add_to_groups",
"(",
"self",
",",
"groups",
"=",
"None",
",",
"all_groups",
"=",
"False",
",",
"group_type",
"=",
"None",
")",
":",
"if",
"all_groups",
":",
"if",
"groups",
"or",
"group_type",
":",
"raise",
"ArgumentError",
"(",
"\"When adding to all... | Add user to some (typically PLC) groups. Note that, if you add to no groups, the effect
is simply to do an "add to organization Everybody group", so we let that be done.
:param groups: list of group names the user should be added to
:param all_groups: a boolean meaning add to all (don't specify... | [
"Add",
"user",
"to",
"some",
"(",
"typically",
"PLC",
")",
"groups",
".",
"Note",
"that",
"if",
"you",
"add",
"to",
"no",
"groups",
"the",
"effect",
"is",
"simply",
"to",
"do",
"an",
"add",
"to",
"organization",
"Everybody",
"group",
"so",
"we",
"let",... | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L182-L205 | train | Add user to some groups. |
adobe-apiplatform/umapi-client.py | umapi_client/functional.py | UserAction.remove_from_groups | def remove_from_groups(self, groups=None, all_groups=False, group_type=None):
"""
Remove user from some PLC groups, or all of them.
:param groups: list of group names the user should be removed from
:param all_groups: a boolean meaning remove from all (don't specify groups or group_type ... | python | def remove_from_groups(self, groups=None, all_groups=False, group_type=None):
"""
Remove user from some PLC groups, or all of them.
:param groups: list of group names the user should be removed from
:param all_groups: a boolean meaning remove from all (don't specify groups or group_type ... | [
"def",
"remove_from_groups",
"(",
"self",
",",
"groups",
"=",
"None",
",",
"all_groups",
"=",
"False",
",",
"group_type",
"=",
"None",
")",
":",
"if",
"all_groups",
":",
"if",
"groups",
"or",
"group_type",
":",
"raise",
"ArgumentError",
"(",
"\"When removing... | Remove user from some PLC groups, or all of them.
:param groups: list of group names the user should be removed from
:param all_groups: a boolean meaning remove from all (don't specify groups or group_type in this case)
:param group_type: the type of group (defaults to "product")
:return... | [
"Remove",
"user",
"from",
"some",
"PLC",
"groups",
"or",
"all",
"of",
"them",
".",
":",
"param",
"groups",
":",
"list",
"of",
"group",
"names",
"the",
"user",
"should",
"be",
"removed",
"from",
":",
"param",
"all_groups",
":",
"a",
"boolean",
"meaning",
... | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L207-L229 | train | Removes a user from some PLC groups or all of them. |
adobe-apiplatform/umapi-client.py | umapi_client/functional.py | UserAction.add_role | def add_role(self, groups=None, role_type=RoleTypes.admin):
"""
Make user have a role (typically PLC admin) with respect to some PLC groups.
:param groups: list of group names the user should have this role for
:param role_type: the role (defaults to "admin")
:return: the User, s... | python | def add_role(self, groups=None, role_type=RoleTypes.admin):
"""
Make user have a role (typically PLC admin) with respect to some PLC groups.
:param groups: list of group names the user should have this role for
:param role_type: the role (defaults to "admin")
:return: the User, s... | [
"def",
"add_role",
"(",
"self",
",",
"groups",
"=",
"None",
",",
"role_type",
"=",
"RoleTypes",
".",
"admin",
")",
":",
"if",
"not",
"groups",
":",
"raise",
"ArgumentError",
"(",
"\"You must specify groups to which to add the role for this user\"",
")",
"if",
"rol... | Make user have a role (typically PLC admin) with respect to some PLC groups.
:param groups: list of group names the user should have this role for
:param role_type: the role (defaults to "admin")
:return: the User, so you can do User(...).add_role(...).add_to_groups(...) | [
"Make",
"user",
"have",
"a",
"role",
"(",
"typically",
"PLC",
"admin",
")",
"with",
"respect",
"to",
"some",
"PLC",
"groups",
".",
":",
"param",
"groups",
":",
"list",
"of",
"group",
"names",
"the",
"user",
"should",
"have",
"this",
"role",
"for",
":",... | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L231-L245 | train | Add a role to a user |
adobe-apiplatform/umapi-client.py | umapi_client/functional.py | UserAction.remove_role | def remove_role(self, groups=None, role_type=RoleTypes.admin):
"""
Remove user from a role (typically admin) of some groups.
:param groups: list of group names the user should NOT have this role for
:param role_type: the type of role (defaults to "admin")
:return: the User, so yo... | python | def remove_role(self, groups=None, role_type=RoleTypes.admin):
"""
Remove user from a role (typically admin) of some groups.
:param groups: list of group names the user should NOT have this role for
:param role_type: the type of role (defaults to "admin")
:return: the User, so yo... | [
"def",
"remove_role",
"(",
"self",
",",
"groups",
"=",
"None",
",",
"role_type",
"=",
"RoleTypes",
".",
"admin",
")",
":",
"if",
"not",
"groups",
":",
"raise",
"ArgumentError",
"(",
"\"You must specify groups from which to remove the role for this user\"",
")",
"if"... | Remove user from a role (typically admin) of some groups.
:param groups: list of group names the user should NOT have this role for
:param role_type: the type of role (defaults to "admin")
:return: the User, so you can do User(...).remove_role(...).remove_from_groups(...) | [
"Remove",
"user",
"from",
"a",
"role",
"(",
"typically",
"admin",
")",
"of",
"some",
"groups",
".",
":",
"param",
"groups",
":",
"list",
"of",
"group",
"names",
"the",
"user",
"should",
"NOT",
"have",
"this",
"role",
"for",
":",
"param",
"role_type",
"... | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L247-L261 | train | Removes a user from a role of some groups. |
adobe-apiplatform/umapi-client.py | umapi_client/functional.py | UserAction.remove_from_organization | def remove_from_organization(self, delete_account=False):
"""
Remove a user from the organization's list of visible users. Optionally also delete the account.
Deleting the account can only be done if the organization owns the account's domain.
:param delete_account: Whether to delete th... | python | def remove_from_organization(self, delete_account=False):
"""
Remove a user from the organization's list of visible users. Optionally also delete the account.
Deleting the account can only be done if the organization owns the account's domain.
:param delete_account: Whether to delete th... | [
"def",
"remove_from_organization",
"(",
"self",
",",
"delete_account",
"=",
"False",
")",
":",
"self",
".",
"append",
"(",
"removeFromOrg",
"=",
"{",
"\"deleteAccount\"",
":",
"True",
"if",
"delete_account",
"else",
"False",
"}",
")",
"return",
"None"
] | Remove a user from the organization's list of visible users. Optionally also delete the account.
Deleting the account can only be done if the organization owns the account's domain.
:param delete_account: Whether to delete the account after removing from the organization (default false)
:return... | [
"Remove",
"a",
"user",
"from",
"the",
"organization",
"s",
"list",
"of",
"visible",
"users",
".",
"Optionally",
"also",
"delete",
"the",
"account",
".",
"Deleting",
"the",
"account",
"can",
"only",
"be",
"done",
"if",
"the",
"organization",
"owns",
"the",
... | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L263-L271 | train | Removes a user from the organization s list of visible users. |
adobe-apiplatform/umapi-client.py | umapi_client/functional.py | UserAction.delete_account | def delete_account(self):
"""
Delete a user's account.
Deleting the user's account can only be done if the user's domain is controlled by the authorized organization,
and removing the account will also remove the user from all organizations with access to that domain.
:return: No... | python | def delete_account(self):
"""
Delete a user's account.
Deleting the user's account can only be done if the user's domain is controlled by the authorized organization,
and removing the account will also remove the user from all organizations with access to that domain.
:return: No... | [
"def",
"delete_account",
"(",
"self",
")",
":",
"if",
"self",
".",
"id_type",
"==",
"IdentityTypes",
".",
"adobeID",
":",
"raise",
"ArgumentError",
"(",
"\"You cannot delete an Adobe ID account.\"",
")",
"self",
".",
"append",
"(",
"removeFromDomain",
"=",
"{",
... | Delete a user's account.
Deleting the user's account can only be done if the user's domain is controlled by the authorized organization,
and removing the account will also remove the user from all organizations with access to that domain.
:return: None, because you cannot follow this command wit... | [
"Delete",
"a",
"user",
"s",
"account",
".",
"Deleting",
"the",
"user",
"s",
"account",
"can",
"only",
"be",
"done",
"if",
"the",
"user",
"s",
"domain",
"is",
"controlled",
"by",
"the",
"authorized",
"organization",
"and",
"removing",
"the",
"account",
"wil... | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L273-L283 | train | Deletes a user s account. |
adobe-apiplatform/umapi-client.py | umapi_client/functional.py | UserGroupAction._validate | def _validate(cls, group_name):
"""
Validates the group name
Input values must be strings (standard or unicode). Throws ArgumentError if any input is invalid
:param group_name: name of group
"""
if group_name and not cls._group_name_regex.match(group_name):
r... | python | def _validate(cls, group_name):
"""
Validates the group name
Input values must be strings (standard or unicode). Throws ArgumentError if any input is invalid
:param group_name: name of group
"""
if group_name and not cls._group_name_regex.match(group_name):
r... | [
"def",
"_validate",
"(",
"cls",
",",
"group_name",
")",
":",
"if",
"group_name",
"and",
"not",
"cls",
".",
"_group_name_regex",
".",
"match",
"(",
"group_name",
")",
":",
"raise",
"ArgumentError",
"(",
"\"'%s': Illegal group name\"",
"%",
"(",
"group_name",
",... | Validates the group name
Input values must be strings (standard or unicode). Throws ArgumentError if any input is invalid
:param group_name: name of group | [
"Validates",
"the",
"group",
"name",
"Input",
"values",
"must",
"be",
"strings",
"(",
"standard",
"or",
"unicode",
")",
".",
"Throws",
"ArgumentError",
"if",
"any",
"input",
"is",
"invalid",
":",
"param",
"group_name",
":",
"name",
"of",
"group"
] | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L329-L338 | train | Validates the group name
|
adobe-apiplatform/umapi-client.py | umapi_client/functional.py | UserGroupAction.add_to_products | def add_to_products(self, products=None, all_products=False):
"""
Add user group to some product license configuration groups (PLCs), or all of them.
:param products: list of product names the user should be added to
:param all_products: a boolean meaning add to all (don't specify produc... | python | def add_to_products(self, products=None, all_products=False):
"""
Add user group to some product license configuration groups (PLCs), or all of them.
:param products: list of product names the user should be added to
:param all_products: a boolean meaning add to all (don't specify produc... | [
"def",
"add_to_products",
"(",
"self",
",",
"products",
"=",
"None",
",",
"all_products",
"=",
"False",
")",
":",
"if",
"all_products",
":",
"if",
"products",
":",
"raise",
"ArgumentError",
"(",
"\"When adding to all products, do not specify specific products\"",
")",... | Add user group to some product license configuration groups (PLCs), or all of them.
:param products: list of product names the user should be added to
:param all_products: a boolean meaning add to all (don't specify products in this case)
:return: the Group, so you can do Group(...).add_to_produ... | [
"Add",
"user",
"group",
"to",
"some",
"product",
"license",
"configuration",
"groups",
"(",
"PLCs",
")",
"or",
"all",
"of",
"them",
".",
":",
"param",
"products",
":",
"list",
"of",
"product",
"names",
"the",
"user",
"should",
"be",
"added",
"to",
":",
... | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L350-L365 | train | Add a user group to some product license configuration groups or all of them. |
adobe-apiplatform/umapi-client.py | umapi_client/functional.py | UserGroupAction.remove_from_products | def remove_from_products(self, products=None, all_products=False):
"""
Remove user group from some product license configuration groups (PLCs), or all of them.
:param products: list of product names the user group should be removed from
:param all_products: a boolean meaning remove from ... | python | def remove_from_products(self, products=None, all_products=False):
"""
Remove user group from some product license configuration groups (PLCs), or all of them.
:param products: list of product names the user group should be removed from
:param all_products: a boolean meaning remove from ... | [
"def",
"remove_from_products",
"(",
"self",
",",
"products",
"=",
"None",
",",
"all_products",
"=",
"False",
")",
":",
"if",
"all_products",
":",
"if",
"products",
":",
"raise",
"ArgumentError",
"(",
"\"When removing from all products, do not specify specific products\"... | Remove user group from some product license configuration groups (PLCs), or all of them.
:param products: list of product names the user group should be removed from
:param all_products: a boolean meaning remove from all (don't specify products in this case)
:return: the Group, so you can do Gro... | [
"Remove",
"user",
"group",
"from",
"some",
"product",
"license",
"configuration",
"groups",
"(",
"PLCs",
")",
"or",
"all",
"of",
"them",
".",
":",
"param",
"products",
":",
"list",
"of",
"product",
"names",
"the",
"user",
"group",
"should",
"be",
"removed"... | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L367-L382 | train | Removes a user group from some product license configuration groups or all of them. |
adobe-apiplatform/umapi-client.py | umapi_client/functional.py | UserGroupAction.add_users | def add_users(self, users=None):
"""
Add users (specified by email address) to this user group.
In case of ambiguity (two users with same email address), the non-AdobeID user is preferred.
:param users: list of emails for users to add to the group.
:return: the Group, so you can ... | python | def add_users(self, users=None):
"""
Add users (specified by email address) to this user group.
In case of ambiguity (two users with same email address), the non-AdobeID user is preferred.
:param users: list of emails for users to add to the group.
:return: the Group, so you can ... | [
"def",
"add_users",
"(",
"self",
",",
"users",
"=",
"None",
")",
":",
"if",
"not",
"users",
":",
"raise",
"ArgumentError",
"(",
"\"You must specify emails for users to add to the user group\"",
")",
"ulist",
"=",
"{",
"\"user\"",
":",
"[",
"user",
"for",
"user",... | Add users (specified by email address) to this user group.
In case of ambiguity (two users with same email address), the non-AdobeID user is preferred.
:param users: list of emails for users to add to the group.
:return: the Group, so you can do Group(...).add_users(...).add_to_products(...) | [
"Add",
"users",
"(",
"specified",
"by",
"email",
"address",
")",
"to",
"this",
"user",
"group",
".",
"In",
"case",
"of",
"ambiguity",
"(",
"two",
"users",
"with",
"same",
"email",
"address",
")",
"the",
"non",
"-",
"AdobeID",
"user",
"is",
"preferred",
... | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L384-L394 | train | Adds users to the user group. |
adobe-apiplatform/umapi-client.py | umapi_client/functional.py | UserGroupAction.remove_users | def remove_users(self, users=None):
"""
Remove users (specified by email address) from this user group.
In case of ambiguity (two users with same email address), the non-AdobeID user is preferred.
:param users: list of emails for users to remove from the group.
:return: the Group... | python | def remove_users(self, users=None):
"""
Remove users (specified by email address) from this user group.
In case of ambiguity (two users with same email address), the non-AdobeID user is preferred.
:param users: list of emails for users to remove from the group.
:return: the Group... | [
"def",
"remove_users",
"(",
"self",
",",
"users",
"=",
"None",
")",
":",
"if",
"not",
"users",
":",
"raise",
"ArgumentError",
"(",
"\"You must specify emails for users to remove from the user group\"",
")",
"ulist",
"=",
"{",
"\"user\"",
":",
"[",
"user",
"for",
... | Remove users (specified by email address) from this user group.
In case of ambiguity (two users with same email address), the non-AdobeID user is preferred.
:param users: list of emails for users to remove from the group.
:return: the Group, so you can do Group(...).remove_users(...).add_to_prod... | [
"Remove",
"users",
"(",
"specified",
"by",
"email",
"address",
")",
"from",
"this",
"user",
"group",
".",
"In",
"case",
"of",
"ambiguity",
"(",
"two",
"users",
"with",
"same",
"email",
"address",
")",
"the",
"non",
"-",
"AdobeID",
"user",
"is",
"preferre... | 1c446d79643cc8615adaa23e12dce3ac5782cf76 | https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L396-L406 | train | Removes users from the user group. |
rm-hull/luma.emulator | luma/emulator/render.py | transformer.scale2x | def scale2x(self, surface):
"""
Scales using the AdvanceMAME Scale2X algorithm which does a
'jaggie-less' scale of bitmap graphics.
"""
assert(self._scale == 2)
return self._pygame.transform.scale2x(surface) | python | def scale2x(self, surface):
"""
Scales using the AdvanceMAME Scale2X algorithm which does a
'jaggie-less' scale of bitmap graphics.
"""
assert(self._scale == 2)
return self._pygame.transform.scale2x(surface) | [
"def",
"scale2x",
"(",
"self",
",",
"surface",
")",
":",
"assert",
"(",
"self",
".",
"_scale",
"==",
"2",
")",
"return",
"self",
".",
"_pygame",
".",
"transform",
".",
"scale2x",
"(",
"surface",
")"
] | Scales using the AdvanceMAME Scale2X algorithm which does a
'jaggie-less' scale of bitmap graphics. | [
"Scales",
"using",
"the",
"AdvanceMAME",
"Scale2X",
"algorithm",
"which",
"does",
"a",
"jaggie",
"-",
"less",
"scale",
"of",
"bitmap",
"graphics",
"."
] | ca3db028b33d17cda9247ea5189873ff0408d013 | https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/render.py#L31-L37 | train | Returns the scale of the image in x - plane. |
rm-hull/luma.emulator | luma/emulator/render.py | transformer.smoothscale | def smoothscale(self, surface):
"""
Smooth scaling using MMX or SSE extensions if available
"""
return self._pygame.transform.smoothscale(surface, self._output_size) | python | def smoothscale(self, surface):
"""
Smooth scaling using MMX or SSE extensions if available
"""
return self._pygame.transform.smoothscale(surface, self._output_size) | [
"def",
"smoothscale",
"(",
"self",
",",
"surface",
")",
":",
"return",
"self",
".",
"_pygame",
".",
"transform",
".",
"smoothscale",
"(",
"surface",
",",
"self",
".",
"_output_size",
")"
] | Smooth scaling using MMX or SSE extensions if available | [
"Smooth",
"scaling",
"using",
"MMX",
"or",
"SSE",
"extensions",
"if",
"available"
] | ca3db028b33d17cda9247ea5189873ff0408d013 | https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/render.py#L39-L43 | train | Smooth scaling using MMX or SSE extensions. |
rm-hull/luma.emulator | luma/emulator/render.py | transformer.identity | def identity(self, surface):
"""
Fast scale operation that does not sample the results
"""
return self._pygame.transform.scale(surface, self._output_size) | python | def identity(self, surface):
"""
Fast scale operation that does not sample the results
"""
return self._pygame.transform.scale(surface, self._output_size) | [
"def",
"identity",
"(",
"self",
",",
"surface",
")",
":",
"return",
"self",
".",
"_pygame",
".",
"transform",
".",
"scale",
"(",
"surface",
",",
"self",
".",
"_output_size",
")"
] | Fast scale operation that does not sample the results | [
"Fast",
"scale",
"operation",
"that",
"does",
"not",
"sample",
"the",
"results"
] | ca3db028b33d17cda9247ea5189873ff0408d013 | https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/render.py#L45-L49 | train | Return the identity of the current object. |
rm-hull/luma.emulator | luma/emulator/render.py | transformer.led_matrix | def led_matrix(self, surface):
"""
Transforms the input surface into an LED matrix (1 pixel = 1 LED)
"""
scale = self._led_on.get_width()
w, h = self._input_size
pix = self._pygame.PixelArray(surface)
img = self._pygame.Surface((w * scale, h * scale))
for... | python | def led_matrix(self, surface):
"""
Transforms the input surface into an LED matrix (1 pixel = 1 LED)
"""
scale = self._led_on.get_width()
w, h = self._input_size
pix = self._pygame.PixelArray(surface)
img = self._pygame.Surface((w * scale, h * scale))
for... | [
"def",
"led_matrix",
"(",
"self",
",",
"surface",
")",
":",
"scale",
"=",
"self",
".",
"_led_on",
".",
"get_width",
"(",
")",
"w",
",",
"h",
"=",
"self",
".",
"_input_size",
"pix",
"=",
"self",
".",
"_pygame",
".",
"PixelArray",
"(",
"surface",
")",
... | Transforms the input surface into an LED matrix (1 pixel = 1 LED) | [
"Transforms",
"the",
"input",
"surface",
"into",
"an",
"LED",
"matrix",
"(",
"1",
"pixel",
"=",
"1",
"LED",
")"
] | ca3db028b33d17cda9247ea5189873ff0408d013 | https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/render.py#L51-L65 | train | Transforms the input surface into an LED matrix. |
rm-hull/luma.emulator | luma/emulator/clut.py | rgb2short | def rgb2short(r, g, b):
"""
Converts RGB values to the nearest equivalent xterm-256 color.
"""
# Using list of snap points, convert RGB value to cube indexes
r, g, b = [len(tuple(s for s in snaps if s < x)) for x in (r, g, b)]
# Simple colorcube transform
return (r * 36) + (g * 6) + b + 16 | python | def rgb2short(r, g, b):
"""
Converts RGB values to the nearest equivalent xterm-256 color.
"""
# Using list of snap points, convert RGB value to cube indexes
r, g, b = [len(tuple(s for s in snaps if s < x)) for x in (r, g, b)]
# Simple colorcube transform
return (r * 36) + (g * 6) + b + 16 | [
"def",
"rgb2short",
"(",
"r",
",",
"g",
",",
"b",
")",
":",
"# Using list of snap points, convert RGB value to cube indexes",
"r",
",",
"g",
",",
"b",
"=",
"[",
"len",
"(",
"tuple",
"(",
"s",
"for",
"s",
"in",
"snaps",
"if",
"s",
"<",
"x",
")",
")",
... | Converts RGB values to the nearest equivalent xterm-256 color. | [
"Converts",
"RGB",
"values",
"to",
"the",
"nearest",
"equivalent",
"xterm",
"-",
"256",
"color",
"."
] | ca3db028b33d17cda9247ea5189873ff0408d013 | https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/clut.py#L14-L22 | train | Convert RGB values to nearest equivalent xterm - 256 color. |
rm-hull/luma.emulator | luma/emulator/device.py | emulator.to_surface | def to_surface(self, image, alpha=1.0):
"""
Converts a :py:mod:`PIL.Image` into a :class:`pygame.Surface`,
transforming it according to the ``transform`` and ``scale``
constructor arguments.
"""
assert(0.0 <= alpha <= 1.0)
if alpha < 1.0:
im = image.co... | python | def to_surface(self, image, alpha=1.0):
"""
Converts a :py:mod:`PIL.Image` into a :class:`pygame.Surface`,
transforming it according to the ``transform`` and ``scale``
constructor arguments.
"""
assert(0.0 <= alpha <= 1.0)
if alpha < 1.0:
im = image.co... | [
"def",
"to_surface",
"(",
"self",
",",
"image",
",",
"alpha",
"=",
"1.0",
")",
":",
"assert",
"(",
"0.0",
"<=",
"alpha",
"<=",
"1.0",
")",
"if",
"alpha",
"<",
"1.0",
":",
"im",
"=",
"image",
".",
"convert",
"(",
"\"RGBA\"",
")",
"black",
"=",
"Im... | Converts a :py:mod:`PIL.Image` into a :class:`pygame.Surface`,
transforming it according to the ``transform`` and ``scale``
constructor arguments. | [
"Converts",
"a",
":",
"py",
":",
"mod",
":",
"PIL",
".",
"Image",
"into",
"a",
":",
"class",
":",
"pygame",
".",
"Surface",
"transforming",
"it",
"according",
"to",
"the",
"transform",
"and",
"scale",
"constructor",
"arguments",
"."
] | ca3db028b33d17cda9247ea5189873ff0408d013 | https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L64-L84 | train | Converts a Pillow. Image into a pygame. Surface. |
rm-hull/luma.emulator | luma/emulator/device.py | capture.display | def display(self, image):
"""
Takes a :py:mod:`PIL.Image` and dumps it to a numbered PNG file.
"""
assert(image.size == self.size)
self._last_image = image
self._count += 1
filename = self._file_template.format(self._count)
image = self.preprocess(image)
... | python | def display(self, image):
"""
Takes a :py:mod:`PIL.Image` and dumps it to a numbered PNG file.
"""
assert(image.size == self.size)
self._last_image = image
self._count += 1
filename = self._file_template.format(self._count)
image = self.preprocess(image)
... | [
"def",
"display",
"(",
"self",
",",
"image",
")",
":",
"assert",
"(",
"image",
".",
"size",
"==",
"self",
".",
"size",
")",
"self",
".",
"_last_image",
"=",
"image",
"self",
".",
"_count",
"+=",
"1",
"filename",
"=",
"self",
".",
"_file_template",
".... | Takes a :py:mod:`PIL.Image` and dumps it to a numbered PNG file. | [
"Takes",
"a",
":",
"py",
":",
"mod",
":",
"PIL",
".",
"Image",
"and",
"dumps",
"it",
"to",
"a",
"numbered",
"PNG",
"file",
"."
] | ca3db028b33d17cda9247ea5189873ff0408d013 | https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L100-L112 | train | Takes a : py : mod : PIL. Image and dumps it to a numbered PNG file. |
rm-hull/luma.emulator | luma/emulator/device.py | gifanim.display | def display(self, image):
"""
Takes an image, scales it according to the nominated transform, and
stores it for later building into an animated GIF.
"""
assert(image.size == self.size)
self._last_image = image
image = self.preprocess(image)
surface = self... | python | def display(self, image):
"""
Takes an image, scales it according to the nominated transform, and
stores it for later building into an animated GIF.
"""
assert(image.size == self.size)
self._last_image = image
image = self.preprocess(image)
surface = self... | [
"def",
"display",
"(",
"self",
",",
"image",
")",
":",
"assert",
"(",
"image",
".",
"size",
"==",
"self",
".",
"size",
")",
"self",
".",
"_last_image",
"=",
"image",
"image",
"=",
"self",
".",
"preprocess",
"(",
"image",
")",
"surface",
"=",
"self",
... | Takes an image, scales it according to the nominated transform, and
stores it for later building into an animated GIF. | [
"Takes",
"an",
"image",
"scales",
"it",
"according",
"to",
"the",
"nominated",
"transform",
"and",
"stores",
"it",
"for",
"later",
"building",
"into",
"an",
"animated",
"GIF",
"."
] | ca3db028b33d17cda9247ea5189873ff0408d013 | https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L134-L152 | train | Displays an image in the current thread. |
rm-hull/luma.emulator | luma/emulator/device.py | pygame.display | def display(self, image):
"""
Takes a :py:mod:`PIL.Image` and renders it to a pygame display surface.
"""
assert(image.size == self.size)
self._last_image = image
image = self.preprocess(image)
self._clock.tick(self._fps)
self._pygame.event.pump()
... | python | def display(self, image):
"""
Takes a :py:mod:`PIL.Image` and renders it to a pygame display surface.
"""
assert(image.size == self.size)
self._last_image = image
image = self.preprocess(image)
self._clock.tick(self._fps)
self._pygame.event.pump()
... | [
"def",
"display",
"(",
"self",
",",
"image",
")",
":",
"assert",
"(",
"image",
".",
"size",
"==",
"self",
".",
"size",
")",
"self",
".",
"_last_image",
"=",
"image",
"image",
"=",
"self",
".",
"preprocess",
"(",
"image",
")",
"self",
".",
"_clock",
... | Takes a :py:mod:`PIL.Image` and renders it to a pygame display surface. | [
"Takes",
"a",
":",
"py",
":",
"mod",
":",
"PIL",
".",
"Image",
"and",
"renders",
"it",
"to",
"a",
"pygame",
"display",
"surface",
"."
] | ca3db028b33d17cda9247ea5189873ff0408d013 | https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L193-L212 | train | Displays the image to the pygame display surface. |
rm-hull/luma.emulator | luma/emulator/device.py | asciiart._char_density | def _char_density(self, c, font=ImageFont.load_default()):
"""
Count the number of black pixels in a rendered character.
"""
image = Image.new('1', font.getsize(c), color=255)
draw = ImageDraw.Draw(image)
draw.text((0, 0), c, fill="white", font=font)
return collec... | python | def _char_density(self, c, font=ImageFont.load_default()):
"""
Count the number of black pixels in a rendered character.
"""
image = Image.new('1', font.getsize(c), color=255)
draw = ImageDraw.Draw(image)
draw.text((0, 0), c, fill="white", font=font)
return collec... | [
"def",
"_char_density",
"(",
"self",
",",
"c",
",",
"font",
"=",
"ImageFont",
".",
"load_default",
"(",
")",
")",
":",
"image",
"=",
"Image",
".",
"new",
"(",
"'1'",
",",
"font",
".",
"getsize",
"(",
"c",
")",
",",
"color",
"=",
"255",
")",
"draw... | Count the number of black pixels in a rendered character. | [
"Count",
"the",
"number",
"of",
"black",
"pixels",
"in",
"a",
"rendered",
"character",
"."
] | ca3db028b33d17cda9247ea5189873ff0408d013 | https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L253-L260 | train | Count the number of black pixels in a rendered character. |
rm-hull/luma.emulator | luma/emulator/device.py | asciiart._generate_art | def _generate_art(self, image, width, height):
"""
Return an iterator that produces the ascii art.
"""
# Characters aren't square, so scale the output by the aspect ratio of a charater
height = int(height * self._char_width / float(self._char_height))
image = image.resize... | python | def _generate_art(self, image, width, height):
"""
Return an iterator that produces the ascii art.
"""
# Characters aren't square, so scale the output by the aspect ratio of a charater
height = int(height * self._char_width / float(self._char_height))
image = image.resize... | [
"def",
"_generate_art",
"(",
"self",
",",
"image",
",",
"width",
",",
"height",
")",
":",
"# Characters aren't square, so scale the output by the aspect ratio of a charater",
"height",
"=",
"int",
"(",
"height",
"*",
"self",
".",
"_char_width",
"/",
"float",
"(",
"s... | Return an iterator that produces the ascii art. | [
"Return",
"an",
"iterator",
"that",
"produces",
"the",
"ascii",
"art",
"."
] | ca3db028b33d17cda9247ea5189873ff0408d013 | https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L262-L273 | train | Generate an ascii art. |
rm-hull/luma.emulator | luma/emulator/device.py | asciiart.display | def display(self, image):
"""
Takes a :py:mod:`PIL.Image` and renders it to the current terminal as
ASCII-art.
"""
assert(image.size == self.size)
self._last_image = image
surface = self.to_surface(self.preprocess(image), alpha=self._contrast)
rawbytes = ... | python | def display(self, image):
"""
Takes a :py:mod:`PIL.Image` and renders it to the current terminal as
ASCII-art.
"""
assert(image.size == self.size)
self._last_image = image
surface = self.to_surface(self.preprocess(image), alpha=self._contrast)
rawbytes = ... | [
"def",
"display",
"(",
"self",
",",
"image",
")",
":",
"assert",
"(",
"image",
".",
"size",
"==",
"self",
".",
"size",
")",
"self",
".",
"_last_image",
"=",
"image",
"surface",
"=",
"self",
".",
"to_surface",
"(",
"self",
".",
"preprocess",
"(",
"ima... | Takes a :py:mod:`PIL.Image` and renders it to the current terminal as
ASCII-art. | [
"Takes",
"a",
":",
"py",
":",
"mod",
":",
"PIL",
".",
"Image",
"and",
"renders",
"it",
"to",
"the",
"current",
"terminal",
"as",
"ASCII",
"-",
"art",
"."
] | ca3db028b33d17cda9247ea5189873ff0408d013 | https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L275-L300 | train | Displays an image as ASCII - art. |
rm-hull/luma.emulator | luma/emulator/device.py | asciiblock._generate_art | def _generate_art(self, image, width, height):
"""
Return an iterator that produces the ascii art.
"""
image = image.resize((width, height), Image.ANTIALIAS).convert("RGB")
pixels = list(image.getdata())
for y in range(0, height - 1, 2):
for x in range(width)... | python | def _generate_art(self, image, width, height):
"""
Return an iterator that produces the ascii art.
"""
image = image.resize((width, height), Image.ANTIALIAS).convert("RGB")
pixels = list(image.getdata())
for y in range(0, height - 1, 2):
for x in range(width)... | [
"def",
"_generate_art",
"(",
"self",
",",
"image",
",",
"width",
",",
"height",
")",
":",
"image",
"=",
"image",
".",
"resize",
"(",
"(",
"width",
",",
"height",
")",
",",
"Image",
".",
"ANTIALIAS",
")",
".",
"convert",
"(",
"\"RGB\"",
")",
"pixels",... | Return an iterator that produces the ascii art. | [
"Return",
"an",
"iterator",
"that",
"produces",
"the",
"ascii",
"art",
"."
] | ca3db028b33d17cda9247ea5189873ff0408d013 | https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L341-L353 | train | Generate an ascii art. |
rm-hull/luma.emulator | luma/emulator/device.py | asciiblock._CSI | def _CSI(self, cmd):
"""
Control sequence introducer
"""
sys.stdout.write('\x1b[')
sys.stdout.write(cmd) | python | def _CSI(self, cmd):
"""
Control sequence introducer
"""
sys.stdout.write('\x1b[')
sys.stdout.write(cmd) | [
"def",
"_CSI",
"(",
"self",
",",
"cmd",
")",
":",
"sys",
".",
"stdout",
".",
"write",
"(",
"'\\x1b['",
")",
"sys",
".",
"stdout",
".",
"write",
"(",
"cmd",
")"
] | Control sequence introducer | [
"Control",
"sequence",
"introducer"
] | ca3db028b33d17cda9247ea5189873ff0408d013 | https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L355-L360 | train | Print the CSI command. |
rm-hull/luma.emulator | luma/emulator/device.py | asciiblock.display | def display(self, image):
"""
Takes a :py:mod:`PIL.Image` and renders it to the current terminal as
ASCII-blocks.
"""
assert(image.size == self.size)
self._last_image = image
surface = self.to_surface(self.preprocess(image), alpha=self._contrast)
rawbytes... | python | def display(self, image):
"""
Takes a :py:mod:`PIL.Image` and renders it to the current terminal as
ASCII-blocks.
"""
assert(image.size == self.size)
self._last_image = image
surface = self.to_surface(self.preprocess(image), alpha=self._contrast)
rawbytes... | [
"def",
"display",
"(",
"self",
",",
"image",
")",
":",
"assert",
"(",
"image",
".",
"size",
"==",
"self",
".",
"size",
")",
"self",
".",
"_last_image",
"=",
"image",
"surface",
"=",
"self",
".",
"to_surface",
"(",
"self",
".",
"preprocess",
"(",
"ima... | Takes a :py:mod:`PIL.Image` and renders it to the current terminal as
ASCII-blocks. | [
"Takes",
"a",
":",
"py",
":",
"mod",
":",
"PIL",
".",
"Image",
"and",
"renders",
"it",
"to",
"the",
"current",
"terminal",
"as",
"ASCII",
"-",
"blocks",
"."
] | ca3db028b33d17cda9247ea5189873ff0408d013 | https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L362-L384 | train | Displays the image as an ASCII - block. |
Auzzy/1846-routes | routes1846/find_best_routes.py | chunk_sequence | def chunk_sequence(sequence, chunk_length):
"""Yield successive n-sized chunks from l."""
for index in range(0, len(sequence), chunk_length):
yield sequence[index:index + chunk_length] | python | def chunk_sequence(sequence, chunk_length):
"""Yield successive n-sized chunks from l."""
for index in range(0, len(sequence), chunk_length):
yield sequence[index:index + chunk_length] | [
"def",
"chunk_sequence",
"(",
"sequence",
",",
"chunk_length",
")",
":",
"for",
"index",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"sequence",
")",
",",
"chunk_length",
")",
":",
"yield",
"sequence",
"[",
"index",
":",
"index",
"+",
"chunk_length",
"]"
] | Yield successive n-sized chunks from l. | [
"Yield",
"successive",
"n",
"-",
"sized",
"chunks",
"from",
"l",
"."
] | 60c90928e184cbcc09c9fef46c2df07f5f14c2c2 | https://github.com/Auzzy/1846-routes/blob/60c90928e184cbcc09c9fef46c2df07f5f14c2c2/routes1846/find_best_routes.py#L72-L75 | train | Yield successive n - sized chunks from l. |
Auzzy/1846-routes | routes1846/find_best_routes.py | _filter_invalid_routes | def _filter_invalid_routes(routes, board, railroad):
"""
Given a collection of routes, returns a new set containing only valid routes. Invalid routes removed:
- contain less than 2 cities, or
- go through Chicago using an impassable exit
- only contain Chicago as a station, but don't use the correct... | python | def _filter_invalid_routes(routes, board, railroad):
"""
Given a collection of routes, returns a new set containing only valid routes. Invalid routes removed:
- contain less than 2 cities, or
- go through Chicago using an impassable exit
- only contain Chicago as a station, but don't use the correct... | [
"def",
"_filter_invalid_routes",
"(",
"routes",
",",
"board",
",",
"railroad",
")",
":",
"chicago_space",
"=",
"board",
".",
"get_space",
"(",
"CHICAGO_CELL",
")",
"chicago_neighbor_cells",
"=",
"[",
"cell",
"for",
"cell",
"in",
"CHICAGO_CELL",
".",
"neighbors",... | Given a collection of routes, returns a new set containing only valid routes. Invalid routes removed:
- contain less than 2 cities, or
- go through Chicago using an impassable exit
- only contain Chicago as a station, but don't use the correct exit path
This fltering after the fact keeps the path findi... | [
"Given",
"a",
"collection",
"of",
"routes",
"returns",
"a",
"new",
"set",
"containing",
"only",
"valid",
"routes",
".",
"Invalid",
"routes",
"removed",
":",
"-",
"contain",
"less",
"than",
"2",
"cities",
"or",
"-",
"go",
"through",
"Chicago",
"using",
"an"... | 60c90928e184cbcc09c9fef46c2df07f5f14c2c2 | https://github.com/Auzzy/1846-routes/blob/60c90928e184cbcc09c9fef46c2df07f5f14c2c2/routes1846/find_best_routes.py#L171-L224 | train | Given a collection of routes returns a new set containing only valid routes. |
MacHu-GWU/loggerFactory-project | loggerFactory/logfilter.py | find | def find(path,
level=None,
message=None,
time_lower=None, time_upper=None,
case_sensitive=False): # pragma: no cover
"""
Filter log message.
**中文文档**
根据level名称, message中的关键字, 和log的时间的区间, 筛选出相关的日志
"""
if level:
level = level.upper() # level name has... | python | def find(path,
level=None,
message=None,
time_lower=None, time_upper=None,
case_sensitive=False): # pragma: no cover
"""
Filter log message.
**中文文档**
根据level名称, message中的关键字, 和log的时间的区间, 筛选出相关的日志
"""
if level:
level = level.upper() # level name has... | [
"def",
"find",
"(",
"path",
",",
"level",
"=",
"None",
",",
"message",
"=",
"None",
",",
"time_lower",
"=",
"None",
",",
"time_upper",
"=",
"None",
",",
"case_sensitive",
"=",
"False",
")",
":",
"# pragma: no cover",
"if",
"level",
":",
"level",
"=",
"... | Filter log message.
**中文文档**
根据level名称, message中的关键字, 和log的时间的区间, 筛选出相关的日志 | [
"Filter",
"log",
"message",
"."
] | 4de19e275e01dc583b1af9ceeacef0c6084cd6e0 | https://github.com/MacHu-GWU/loggerFactory-project/blob/4de19e275e01dc583b1af9ceeacef0c6084cd6e0/loggerFactory/logfilter.py#L49-L101 | train | Find a log file. |
MacHu-GWU/loggerFactory-project | loggerFactory/logger.py | get_logger_by_name | def get_logger_by_name(name=None, rand_name=False, charset=Charset.HEX):
"""
Get a logger by name.
:param name: None / str, logger name.
:param rand_name: if True, ``name`` will be ignored, a random name will be used.
"""
if rand_name:
name = rand_str(charset)
logger = logging.getLo... | python | def get_logger_by_name(name=None, rand_name=False, charset=Charset.HEX):
"""
Get a logger by name.
:param name: None / str, logger name.
:param rand_name: if True, ``name`` will be ignored, a random name will be used.
"""
if rand_name:
name = rand_str(charset)
logger = logging.getLo... | [
"def",
"get_logger_by_name",
"(",
"name",
"=",
"None",
",",
"rand_name",
"=",
"False",
",",
"charset",
"=",
"Charset",
".",
"HEX",
")",
":",
"if",
"rand_name",
":",
"name",
"=",
"rand_str",
"(",
"charset",
")",
"logger",
"=",
"logging",
".",
"getLogger",... | Get a logger by name.
:param name: None / str, logger name.
:param rand_name: if True, ``name`` will be ignored, a random name will be used. | [
"Get",
"a",
"logger",
"by",
"name",
"."
] | 4de19e275e01dc583b1af9ceeacef0c6084cd6e0 | https://github.com/MacHu-GWU/loggerFactory-project/blob/4de19e275e01dc583b1af9ceeacef0c6084cd6e0/loggerFactory/logger.py#L17-L27 | train | Get a logger by name. |
MacHu-GWU/loggerFactory-project | loggerFactory/logger.py | BaseLogger.debug | def debug(self, msg, indent=0, **kwargs):
"""invoke ``self.logger.debug``"""
return self.logger.debug(self._indent(msg, indent), **kwargs) | python | def debug(self, msg, indent=0, **kwargs):
"""invoke ``self.logger.debug``"""
return self.logger.debug(self._indent(msg, indent), **kwargs) | [
"def",
"debug",
"(",
"self",
",",
"msg",
",",
"indent",
"=",
"0",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"logger",
".",
"debug",
"(",
"self",
".",
"_indent",
"(",
"msg",
",",
"indent",
")",
",",
"*",
"*",
"kwargs",
")"
] | invoke ``self.logger.debug`` | [
"invoke",
"self",
".",
"logger",
".",
"debug"
] | 4de19e275e01dc583b1af9ceeacef0c6084cd6e0 | https://github.com/MacHu-GWU/loggerFactory-project/blob/4de19e275e01dc583b1af9ceeacef0c6084cd6e0/loggerFactory/logger.py#L59-L61 | train | invoke self. logger. debug |
MacHu-GWU/loggerFactory-project | loggerFactory/logger.py | BaseLogger.info | def info(self, msg, indent=0, **kwargs):
"""invoke ``self.info.debug``"""
return self.logger.info(self._indent(msg, indent), **kwargs) | python | def info(self, msg, indent=0, **kwargs):
"""invoke ``self.info.debug``"""
return self.logger.info(self._indent(msg, indent), **kwargs) | [
"def",
"info",
"(",
"self",
",",
"msg",
",",
"indent",
"=",
"0",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"logger",
".",
"info",
"(",
"self",
".",
"_indent",
"(",
"msg",
",",
"indent",
")",
",",
"*",
"*",
"kwargs",
")"
] | invoke ``self.info.debug`` | [
"invoke",
"self",
".",
"info",
".",
"debug"
] | 4de19e275e01dc583b1af9ceeacef0c6084cd6e0 | https://github.com/MacHu-GWU/loggerFactory-project/blob/4de19e275e01dc583b1af9ceeacef0c6084cd6e0/loggerFactory/logger.py#L63-L65 | train | invoke self. info. debug |
MacHu-GWU/loggerFactory-project | loggerFactory/logger.py | BaseLogger.warning | def warning(self, msg, indent=0, **kwargs):
"""invoke ``self.logger.warning``"""
return self.logger.warning(self._indent(msg, indent), **kwargs) | python | def warning(self, msg, indent=0, **kwargs):
"""invoke ``self.logger.warning``"""
return self.logger.warning(self._indent(msg, indent), **kwargs) | [
"def",
"warning",
"(",
"self",
",",
"msg",
",",
"indent",
"=",
"0",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"logger",
".",
"warning",
"(",
"self",
".",
"_indent",
"(",
"msg",
",",
"indent",
")",
",",
"*",
"*",
"kwargs",
")"
] | invoke ``self.logger.warning`` | [
"invoke",
"self",
".",
"logger",
".",
"warning"
] | 4de19e275e01dc583b1af9ceeacef0c6084cd6e0 | https://github.com/MacHu-GWU/loggerFactory-project/blob/4de19e275e01dc583b1af9ceeacef0c6084cd6e0/loggerFactory/logger.py#L67-L69 | train | invoke self. logger. warning |
MacHu-GWU/loggerFactory-project | loggerFactory/logger.py | BaseLogger.error | def error(self, msg, indent=0, **kwargs):
"""invoke ``self.logger.error``"""
return self.logger.error(self._indent(msg, indent), **kwargs) | python | def error(self, msg, indent=0, **kwargs):
"""invoke ``self.logger.error``"""
return self.logger.error(self._indent(msg, indent), **kwargs) | [
"def",
"error",
"(",
"self",
",",
"msg",
",",
"indent",
"=",
"0",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"logger",
".",
"error",
"(",
"self",
".",
"_indent",
"(",
"msg",
",",
"indent",
")",
",",
"*",
"*",
"kwargs",
")"
] | invoke ``self.logger.error`` | [
"invoke",
"self",
".",
"logger",
".",
"error"
] | 4de19e275e01dc583b1af9ceeacef0c6084cd6e0 | https://github.com/MacHu-GWU/loggerFactory-project/blob/4de19e275e01dc583b1af9ceeacef0c6084cd6e0/loggerFactory/logger.py#L71-L73 | train | invoke self. logger. error |
MacHu-GWU/loggerFactory-project | loggerFactory/logger.py | BaseLogger.critical | def critical(self, msg, indent=0, **kwargs):
"""invoke ``self.logger.critical``"""
return self.logger.critical(self._indent(msg, indent), **kwargs) | python | def critical(self, msg, indent=0, **kwargs):
"""invoke ``self.logger.critical``"""
return self.logger.critical(self._indent(msg, indent), **kwargs) | [
"def",
"critical",
"(",
"self",
",",
"msg",
",",
"indent",
"=",
"0",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"logger",
".",
"critical",
"(",
"self",
".",
"_indent",
"(",
"msg",
",",
"indent",
")",
",",
"*",
"*",
"kwargs",
")"
] | invoke ``self.logger.critical`` | [
"invoke",
"self",
".",
"logger",
".",
"critical"
] | 4de19e275e01dc583b1af9ceeacef0c6084cd6e0 | https://github.com/MacHu-GWU/loggerFactory-project/blob/4de19e275e01dc583b1af9ceeacef0c6084cd6e0/loggerFactory/logger.py#L75-L77 | train | invoke self. logger. critical |
MacHu-GWU/loggerFactory-project | loggerFactory/logger.py | BaseLogger.show | def show(self, msg, indent=0, style="", **kwargs):
"""
Print message to console, indent format may apply.
"""
if self.enable_verbose:
new_msg = self.MessageTemplate.with_style.format(
indent=self.tab * indent,
style=style,
msg=m... | python | def show(self, msg, indent=0, style="", **kwargs):
"""
Print message to console, indent format may apply.
"""
if self.enable_verbose:
new_msg = self.MessageTemplate.with_style.format(
indent=self.tab * indent,
style=style,
msg=m... | [
"def",
"show",
"(",
"self",
",",
"msg",
",",
"indent",
"=",
"0",
",",
"style",
"=",
"\"\"",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"enable_verbose",
":",
"new_msg",
"=",
"self",
".",
"MessageTemplate",
".",
"with_style",
".",
"format",... | Print message to console, indent format may apply. | [
"Print",
"message",
"to",
"console",
"indent",
"format",
"may",
"apply",
"."
] | 4de19e275e01dc583b1af9ceeacef0c6084cd6e0 | https://github.com/MacHu-GWU/loggerFactory-project/blob/4de19e275e01dc583b1af9ceeacef0c6084cd6e0/loggerFactory/logger.py#L79-L89 | train | Print a message to console indent format may apply. |
MacHu-GWU/loggerFactory-project | loggerFactory/logger.py | BaseLogger.remove_all_handler | def remove_all_handler(self):
"""
Unlink the file handler association.
"""
for handler in self.logger.handlers[:]:
self.logger.removeHandler(handler)
self._handler_cache.append(handler) | python | def remove_all_handler(self):
"""
Unlink the file handler association.
"""
for handler in self.logger.handlers[:]:
self.logger.removeHandler(handler)
self._handler_cache.append(handler) | [
"def",
"remove_all_handler",
"(",
"self",
")",
":",
"for",
"handler",
"in",
"self",
".",
"logger",
".",
"handlers",
"[",
":",
"]",
":",
"self",
".",
"logger",
".",
"removeHandler",
"(",
"handler",
")",
"self",
".",
"_handler_cache",
".",
"append",
"(",
... | Unlink the file handler association. | [
"Unlink",
"the",
"file",
"handler",
"association",
"."
] | 4de19e275e01dc583b1af9ceeacef0c6084cd6e0 | https://github.com/MacHu-GWU/loggerFactory-project/blob/4de19e275e01dc583b1af9ceeacef0c6084cd6e0/loggerFactory/logger.py#L111-L117 | train | Remove all file handlers associated with this logger. |
MacHu-GWU/loggerFactory-project | loggerFactory/logger.py | BaseLogger.recover_all_handler | def recover_all_handler(self):
"""
Relink the file handler association you just removed.
"""
for handler in self._handler_cache:
self.logger.addHandler(handler)
self._handler_cache = list() | python | def recover_all_handler(self):
"""
Relink the file handler association you just removed.
"""
for handler in self._handler_cache:
self.logger.addHandler(handler)
self._handler_cache = list() | [
"def",
"recover_all_handler",
"(",
"self",
")",
":",
"for",
"handler",
"in",
"self",
".",
"_handler_cache",
":",
"self",
".",
"logger",
".",
"addHandler",
"(",
"handler",
")",
"self",
".",
"_handler_cache",
"=",
"list",
"(",
")"
] | Relink the file handler association you just removed. | [
"Relink",
"the",
"file",
"handler",
"association",
"you",
"just",
"removed",
"."
] | 4de19e275e01dc583b1af9ceeacef0c6084cd6e0 | https://github.com/MacHu-GWU/loggerFactory-project/blob/4de19e275e01dc583b1af9ceeacef0c6084cd6e0/loggerFactory/logger.py#L119-L125 | train | Re - add all file handlers that have been removed from the logger. |
IceflowRE/unidown | unidown/plugin/link_item.py | LinkItem.from_protobuf | def from_protobuf(cls, proto: LinkItemProto) -> LinkItem:
"""
Constructor from protobuf.
:param proto: protobuf structure
:type proto: ~unidown.plugin.protobuf.link_item_pb2.LinkItemProto
:return: the LinkItem
:rtype: ~unidown.plugin.link_item.LinkItem
:raises Va... | python | def from_protobuf(cls, proto: LinkItemProto) -> LinkItem:
"""
Constructor from protobuf.
:param proto: protobuf structure
:type proto: ~unidown.plugin.protobuf.link_item_pb2.LinkItemProto
:return: the LinkItem
:rtype: ~unidown.plugin.link_item.LinkItem
:raises Va... | [
"def",
"from_protobuf",
"(",
"cls",
",",
"proto",
":",
"LinkItemProto",
")",
"->",
"LinkItem",
":",
"if",
"proto",
".",
"name",
"==",
"''",
":",
"raise",
"ValueError",
"(",
"\"name of LinkItem does not exist or is empty inside the protobuf.\"",
")",
"return",
"cls",... | Constructor from protobuf.
:param proto: protobuf structure
:type proto: ~unidown.plugin.protobuf.link_item_pb2.LinkItemProto
:return: the LinkItem
:rtype: ~unidown.plugin.link_item.LinkItem
:raises ValueError: name of LinkItem does not exist inside the protobuf or is empty | [
"Constructor",
"from",
"protobuf",
"."
] | 2a6f82ab780bb825668bfc55b67c11c4f72ec05c | https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/link_item.py#L37-L49 | train | Constructor from protobuf. |
IceflowRE/unidown | unidown/plugin/link_item.py | LinkItem.to_protobuf | def to_protobuf(self) -> LinkItemProto:
"""
Create protobuf item.
:return: protobuf structure
:rtype: ~unidown.plugin.protobuf.link_item_pb2.LinkItemProto
"""
result = LinkItemProto()
result.name = self._name
result.time.CopyFrom(datetime_to_timestamp(sel... | python | def to_protobuf(self) -> LinkItemProto:
"""
Create protobuf item.
:return: protobuf structure
:rtype: ~unidown.plugin.protobuf.link_item_pb2.LinkItemProto
"""
result = LinkItemProto()
result.name = self._name
result.time.CopyFrom(datetime_to_timestamp(sel... | [
"def",
"to_protobuf",
"(",
"self",
")",
"->",
"LinkItemProto",
":",
"result",
"=",
"LinkItemProto",
"(",
")",
"result",
".",
"name",
"=",
"self",
".",
"_name",
"result",
".",
"time",
".",
"CopyFrom",
"(",
"datetime_to_timestamp",
"(",
"self",
".",
"_time",... | Create protobuf item.
:return: protobuf structure
:rtype: ~unidown.plugin.protobuf.link_item_pb2.LinkItemProto | [
"Create",
"protobuf",
"item",
"."
] | 2a6f82ab780bb825668bfc55b67c11c4f72ec05c | https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/link_item.py#L70-L80 | train | Create protobuf item. |
HiPERCAM/hcam_widgets | hcam_widgets/logs.py | Logger.update | def update(self, fname):
"""
Adds a handler to save to a file. Includes debug stuff.
"""
ltfh = FileHandler(fname)
self._log.addHandler(ltfh) | python | def update(self, fname):
"""
Adds a handler to save to a file. Includes debug stuff.
"""
ltfh = FileHandler(fname)
self._log.addHandler(ltfh) | [
"def",
"update",
"(",
"self",
",",
"fname",
")",
":",
"ltfh",
"=",
"FileHandler",
"(",
"fname",
")",
"self",
".",
"_log",
".",
"addHandler",
"(",
"ltfh",
")"
] | Adds a handler to save to a file. Includes debug stuff. | [
"Adds",
"a",
"handler",
"to",
"save",
"to",
"a",
"file",
".",
"Includes",
"debug",
"stuff",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/logs.py#L117-L122 | train | Adds a handler to save to a file. Includes debug stuff. |
IceflowRE/unidown | unidown/tools.py | delete_dir_rec | def delete_dir_rec(path: Path):
"""
Delete a folder recursive.
:param path: folder to deleted
:type path: ~pathlib.Path
"""
if not path.exists() or not path.is_dir():
return
for sub in path.iterdir():
if sub.is_dir():
delete_dir_rec(sub)
else:
... | python | def delete_dir_rec(path: Path):
"""
Delete a folder recursive.
:param path: folder to deleted
:type path: ~pathlib.Path
"""
if not path.exists() or not path.is_dir():
return
for sub in path.iterdir():
if sub.is_dir():
delete_dir_rec(sub)
else:
... | [
"def",
"delete_dir_rec",
"(",
"path",
":",
"Path",
")",
":",
"if",
"not",
"path",
".",
"exists",
"(",
")",
"or",
"not",
"path",
".",
"is_dir",
"(",
")",
":",
"return",
"for",
"sub",
"in",
"path",
".",
"iterdir",
"(",
")",
":",
"if",
"sub",
".",
... | Delete a folder recursive.
:param path: folder to deleted
:type path: ~pathlib.Path | [
"Delete",
"a",
"folder",
"recursive",
"."
] | 2a6f82ab780bb825668bfc55b67c11c4f72ec05c | https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/tools.py#L13-L27 | train | Delete a folder recursively. |
IceflowRE/unidown | unidown/tools.py | create_dir_rec | def create_dir_rec(path: Path):
"""
Create a folder recursive.
:param path: path
:type path: ~pathlib.Path
"""
if not path.exists():
Path.mkdir(path, parents=True, exist_ok=True) | python | def create_dir_rec(path: Path):
"""
Create a folder recursive.
:param path: path
:type path: ~pathlib.Path
"""
if not path.exists():
Path.mkdir(path, parents=True, exist_ok=True) | [
"def",
"create_dir_rec",
"(",
"path",
":",
"Path",
")",
":",
"if",
"not",
"path",
".",
"exists",
"(",
")",
":",
"Path",
".",
"mkdir",
"(",
"path",
",",
"parents",
"=",
"True",
",",
"exist_ok",
"=",
"True",
")"
] | Create a folder recursive.
:param path: path
:type path: ~pathlib.Path | [
"Create",
"a",
"folder",
"recursive",
"."
] | 2a6f82ab780bb825668bfc55b67c11c4f72ec05c | https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/tools.py#L30-L38 | train | Create a folder recursively. |
IceflowRE/unidown | unidown/tools.py | datetime_to_timestamp | def datetime_to_timestamp(time: datetime) -> Timestamp:
"""
Convert datetime to protobuf.timestamp.
:param time: time
:type time: ~datetime.datetime
:return: protobuf.timestamp
:rtype: ~google.protobuf.timestamp_pb2.Timestamp
"""
protime = Timestamp()
protime.FromDatetime(time)
... | python | def datetime_to_timestamp(time: datetime) -> Timestamp:
"""
Convert datetime to protobuf.timestamp.
:param time: time
:type time: ~datetime.datetime
:return: protobuf.timestamp
:rtype: ~google.protobuf.timestamp_pb2.Timestamp
"""
protime = Timestamp()
protime.FromDatetime(time)
... | [
"def",
"datetime_to_timestamp",
"(",
"time",
":",
"datetime",
")",
"->",
"Timestamp",
":",
"protime",
"=",
"Timestamp",
"(",
")",
"protime",
".",
"FromDatetime",
"(",
"time",
")",
"return",
"protime"
] | Convert datetime to protobuf.timestamp.
:param time: time
:type time: ~datetime.datetime
:return: protobuf.timestamp
:rtype: ~google.protobuf.timestamp_pb2.Timestamp | [
"Convert",
"datetime",
"to",
"protobuf",
".",
"timestamp",
"."
] | 2a6f82ab780bb825668bfc55b67c11c4f72ec05c | https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/tools.py#L41-L52 | train | Convert datetime to protobuf. timestamp. Timestamp |
IceflowRE/unidown | unidown/tools.py | print_plugin_list | def print_plugin_list(plugins: Dict[str, pkg_resources.EntryPoint]):
"""
Prints all registered plugins and checks if they can be loaded or not.
:param plugins: plugins
:type plugins: Dict[str, ~pkg_resources.EntryPoint]
"""
for trigger, entry_point in plugins.items():
try:
p... | python | def print_plugin_list(plugins: Dict[str, pkg_resources.EntryPoint]):
"""
Prints all registered plugins and checks if they can be loaded or not.
:param plugins: plugins
:type plugins: Dict[str, ~pkg_resources.EntryPoint]
"""
for trigger, entry_point in plugins.items():
try:
p... | [
"def",
"print_plugin_list",
"(",
"plugins",
":",
"Dict",
"[",
"str",
",",
"pkg_resources",
".",
"EntryPoint",
"]",
")",
":",
"for",
"trigger",
",",
"entry_point",
"in",
"plugins",
".",
"items",
"(",
")",
":",
"try",
":",
"plugin_class",
"=",
"entry_point",... | Prints all registered plugins and checks if they can be loaded or not.
:param plugins: plugins
:type plugins: Dict[str, ~pkg_resources.EntryPoint] | [
"Prints",
"all",
"registered",
"plugins",
"and",
"checks",
"if",
"they",
"can",
"be",
"loaded",
"or",
"not",
"."
] | 2a6f82ab780bb825668bfc55b67c11c4f72ec05c | https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/tools.py#L55-L73 | train | Prints all registered plugins and checks if they can be loaded or not. |
HiPERCAM/hcam_widgets | hcam_widgets/misc.py | overlap | def overlap(xl1, yl1, nx1, ny1, xl2, yl2, nx2, ny2):
"""
Determines whether two windows overlap
"""
return (xl2 < xl1+nx1 and xl2+nx2 > xl1 and
yl2 < yl1+ny1 and yl2+ny2 > yl1) | python | def overlap(xl1, yl1, nx1, ny1, xl2, yl2, nx2, ny2):
"""
Determines whether two windows overlap
"""
return (xl2 < xl1+nx1 and xl2+nx2 > xl1 and
yl2 < yl1+ny1 and yl2+ny2 > yl1) | [
"def",
"overlap",
"(",
"xl1",
",",
"yl1",
",",
"nx1",
",",
"ny1",
",",
"xl2",
",",
"yl2",
",",
"nx2",
",",
"ny2",
")",
":",
"return",
"(",
"xl2",
"<",
"xl1",
"+",
"nx1",
"and",
"xl2",
"+",
"nx2",
">",
"xl1",
"and",
"yl2",
"<",
"yl1",
"+",
"... | Determines whether two windows overlap | [
"Determines",
"whether",
"two",
"windows",
"overlap"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/misc.py#L140-L145 | train | Determines whether two windows overlap. |
HiPERCAM/hcam_widgets | hcam_widgets/misc.py | saveJSON | def saveJSON(g, data, backup=False):
"""
Saves the current setup to disk.
g : hcam_drivers.globals.Container
Container with globals
data : dict
The current setup in JSON compatible dictionary format.
backup : bool
If we are saving a backup on close, don't prompt for filename
"""
... | python | def saveJSON(g, data, backup=False):
"""
Saves the current setup to disk.
g : hcam_drivers.globals.Container
Container with globals
data : dict
The current setup in JSON compatible dictionary format.
backup : bool
If we are saving a backup on close, don't prompt for filename
"""
... | [
"def",
"saveJSON",
"(",
"g",
",",
"data",
",",
"backup",
"=",
"False",
")",
":",
"if",
"not",
"backup",
":",
"fname",
"=",
"filedialog",
".",
"asksaveasfilename",
"(",
"defaultextension",
"=",
"'.json'",
",",
"filetypes",
"=",
"[",
"(",
"'json files'",
"... | Saves the current setup to disk.
g : hcam_drivers.globals.Container
Container with globals
data : dict
The current setup in JSON compatible dictionary format.
backup : bool
If we are saving a backup on close, don't prompt for filename | [
"Saves",
"the",
"current",
"setup",
"to",
"disk",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/misc.py#L195-L227 | train | Saves the current setup in JSON compatible dictionary format to disk. |
HiPERCAM/hcam_widgets | hcam_widgets/misc.py | postJSON | def postJSON(g, data):
"""
Posts the current setup to the camera and data servers.
g : hcam_drivers.globals.Container
Container with globals
data : dict
The current setup in JSON compatible dictionary format.
"""
g.clog.debug('Entering postJSON')
# encode data as json
json_dat... | python | def postJSON(g, data):
"""
Posts the current setup to the camera and data servers.
g : hcam_drivers.globals.Container
Container with globals
data : dict
The current setup in JSON compatible dictionary format.
"""
g.clog.debug('Entering postJSON')
# encode data as json
json_dat... | [
"def",
"postJSON",
"(",
"g",
",",
"data",
")",
":",
"g",
".",
"clog",
".",
"debug",
"(",
"'Entering postJSON'",
")",
"# encode data as json",
"json_data",
"=",
"json",
".",
"dumps",
"(",
"data",
")",
".",
"encode",
"(",
"'utf-8'",
")",
"# Send the xml to t... | Posts the current setup to the camera and data servers.
g : hcam_drivers.globals.Container
Container with globals
data : dict
The current setup in JSON compatible dictionary format. | [
"Posts",
"the",
"current",
"setup",
"to",
"the",
"camera",
"and",
"data",
"servers",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/misc.py#L230-L280 | train | Post the current setup to the camera and data servers. |
HiPERCAM/hcam_widgets | hcam_widgets/misc.py | createJSON | def createJSON(g, full=True):
"""
Create JSON compatible dictionary from current settings
Parameters
----------
g : hcam_drivers.globals.Container
Container with globals
"""
data = dict()
if 'gps_attached' not in g.cpars:
data['gps_attached'] = 1
else:
data['gps... | python | def createJSON(g, full=True):
"""
Create JSON compatible dictionary from current settings
Parameters
----------
g : hcam_drivers.globals.Container
Container with globals
"""
data = dict()
if 'gps_attached' not in g.cpars:
data['gps_attached'] = 1
else:
data['gps... | [
"def",
"createJSON",
"(",
"g",
",",
"full",
"=",
"True",
")",
":",
"data",
"=",
"dict",
"(",
")",
"if",
"'gps_attached'",
"not",
"in",
"g",
".",
"cpars",
":",
"data",
"[",
"'gps_attached'",
"]",
"=",
"1",
"else",
":",
"data",
"[",
"'gps_attached'",
... | Create JSON compatible dictionary from current settings
Parameters
----------
g : hcam_drivers.globals.Container
Container with globals | [
"Create",
"JSON",
"compatible",
"dictionary",
"from",
"current",
"settings"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/misc.py#L283-L311 | train | Create JSON compatible dictionary from current settings |
HiPERCAM/hcam_widgets | hcam_widgets/misc.py | insertFITSHDU | def insertFITSHDU(g):
"""
Uploads a table of TCS data to the servers, which is appended onto a run.
Arguments
---------
g : hcam_drivers.globals.Container
the Container object of application globals
"""
if not g.cpars['hcam_server_on']:
g.clog.warn('insertFITSHDU: servers ar... | python | def insertFITSHDU(g):
"""
Uploads a table of TCS data to the servers, which is appended onto a run.
Arguments
---------
g : hcam_drivers.globals.Container
the Container object of application globals
"""
if not g.cpars['hcam_server_on']:
g.clog.warn('insertFITSHDU: servers ar... | [
"def",
"insertFITSHDU",
"(",
"g",
")",
":",
"if",
"not",
"g",
".",
"cpars",
"[",
"'hcam_server_on'",
"]",
":",
"g",
".",
"clog",
".",
"warn",
"(",
"'insertFITSHDU: servers are not active'",
")",
"return",
"False",
"run_number",
"=",
"getRunNumber",
"(",
"g",... | Uploads a table of TCS data to the servers, which is appended onto a run.
Arguments
---------
g : hcam_drivers.globals.Container
the Container object of application globals | [
"Uploads",
"a",
"table",
"of",
"TCS",
"data",
"to",
"the",
"servers",
"which",
"is",
"appended",
"onto",
"a",
"run",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/misc.py#L395-L430 | train | Uploads a table of TCS data to the server and returns True if successful False otherwise |
HiPERCAM/hcam_widgets | hcam_widgets/misc.py | execCommand | def execCommand(g, command, timeout=10):
"""
Executes a command by sending it to the rack server
Arguments:
g : hcam_drivers.globals.Container
the Container object of application globals
command : (string)
the command (see below)
Possible commands are:
start : s... | python | def execCommand(g, command, timeout=10):
"""
Executes a command by sending it to the rack server
Arguments:
g : hcam_drivers.globals.Container
the Container object of application globals
command : (string)
the command (see below)
Possible commands are:
start : s... | [
"def",
"execCommand",
"(",
"g",
",",
"command",
",",
"timeout",
"=",
"10",
")",
":",
"if",
"not",
"g",
".",
"cpars",
"[",
"'hcam_server_on'",
"]",
":",
"g",
".",
"clog",
".",
"warn",
"(",
"'execCommand: servers are not active'",
")",
"return",
"False",
"... | Executes a command by sending it to the rack server
Arguments:
g : hcam_drivers.globals.Container
the Container object of application globals
command : (string)
the command (see below)
Possible commands are:
start : starts a run
stop : stops a run
abort ... | [
"Executes",
"a",
"command",
"by",
"sending",
"it",
"to",
"the",
"rack",
"server"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/misc.py#L433-L478 | train | Executes a command on the NGC controller and returns True if the command was successful False otherwise |
HiPERCAM/hcam_widgets | hcam_widgets/misc.py | isRunActive | def isRunActive(g):
"""
Polls the data server to see if a run is active
"""
if g.cpars['hcam_server_on']:
url = g.cpars['hipercam_server'] + 'summary'
response = urllib.request.urlopen(url, timeout=2)
rs = ReadServer(response.read(), status_msg=True)
if not rs.ok:
... | python | def isRunActive(g):
"""
Polls the data server to see if a run is active
"""
if g.cpars['hcam_server_on']:
url = g.cpars['hipercam_server'] + 'summary'
response = urllib.request.urlopen(url, timeout=2)
rs = ReadServer(response.read(), status_msg=True)
if not rs.ok:
... | [
"def",
"isRunActive",
"(",
"g",
")",
":",
"if",
"g",
".",
"cpars",
"[",
"'hcam_server_on'",
"]",
":",
"url",
"=",
"g",
".",
"cpars",
"[",
"'hipercam_server'",
"]",
"+",
"'summary'",
"response",
"=",
"urllib",
".",
"request",
".",
"urlopen",
"(",
"url",... | Polls the data server to see if a run is active | [
"Polls",
"the",
"data",
"server",
"to",
"see",
"if",
"a",
"run",
"is",
"active"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/misc.py#L481-L498 | train | Checks if a run is active |
HiPERCAM/hcam_widgets | hcam_widgets/misc.py | getFrameNumber | def getFrameNumber(g):
"""
Polls the data server to find the current frame number.
Throws an exceotion if it cannot determine it.
"""
if not g.cpars['hcam_server_on']:
raise DriverError('getRunNumber error: servers are not active')
url = g.cpars['hipercam_server'] + 'status/DET.FRAM2.NO... | python | def getFrameNumber(g):
"""
Polls the data server to find the current frame number.
Throws an exceotion if it cannot determine it.
"""
if not g.cpars['hcam_server_on']:
raise DriverError('getRunNumber error: servers are not active')
url = g.cpars['hipercam_server'] + 'status/DET.FRAM2.NO... | [
"def",
"getFrameNumber",
"(",
"g",
")",
":",
"if",
"not",
"g",
".",
"cpars",
"[",
"'hcam_server_on'",
"]",
":",
"raise",
"DriverError",
"(",
"'getRunNumber error: servers are not active'",
")",
"url",
"=",
"g",
".",
"cpars",
"[",
"'hipercam_server'",
"]",
"+",... | Polls the data server to find the current frame number.
Throws an exceotion if it cannot determine it. | [
"Polls",
"the",
"data",
"server",
"to",
"find",
"the",
"current",
"frame",
"number",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/misc.py#L535-L554 | train | Polls the data server to find the current frame number. |
HiPERCAM/hcam_widgets | hcam_widgets/misc.py | getRunNumber | def getRunNumber(g):
"""
Polls the data server to find the current run number. Throws
exceptions if it can't determine it.
"""
if not g.cpars['hcam_server_on']:
raise DriverError('getRunNumber error: servers are not active')
url = g.cpars['hipercam_server'] + 'summary'
response = url... | python | def getRunNumber(g):
"""
Polls the data server to find the current run number. Throws
exceptions if it can't determine it.
"""
if not g.cpars['hcam_server_on']:
raise DriverError('getRunNumber error: servers are not active')
url = g.cpars['hipercam_server'] + 'summary'
response = url... | [
"def",
"getRunNumber",
"(",
"g",
")",
":",
"if",
"not",
"g",
".",
"cpars",
"[",
"'hcam_server_on'",
"]",
":",
"raise",
"DriverError",
"(",
"'getRunNumber error: servers are not active'",
")",
"url",
"=",
"g",
".",
"cpars",
"[",
"'hipercam_server'",
"]",
"+",
... | Polls the data server to find the current run number. Throws
exceptions if it can't determine it. | [
"Polls",
"the",
"data",
"server",
"to",
"find",
"the",
"current",
"run",
"number",
".",
"Throws",
"exceptions",
"if",
"it",
"can",
"t",
"determine",
"it",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/misc.py#L557-L570 | train | Polls the data server to find the current run number. Throws
exceptions if it can t determine it. |
HiPERCAM/hcam_widgets | hcam_widgets/misc.py | checkSimbad | def checkSimbad(g, target, maxobj=5, timeout=5):
"""
Sends off a request to Simbad to check whether a target is recognised.
Returns with a list of results, or raises an exception if it times out
"""
url = 'http://simbad.u-strasbg.fr/simbad/sim-script'
q = 'set limit ' + str(maxobj) + \
'... | python | def checkSimbad(g, target, maxobj=5, timeout=5):
"""
Sends off a request to Simbad to check whether a target is recognised.
Returns with a list of results, or raises an exception if it times out
"""
url = 'http://simbad.u-strasbg.fr/simbad/sim-script'
q = 'set limit ' + str(maxobj) + \
'... | [
"def",
"checkSimbad",
"(",
"g",
",",
"target",
",",
"maxobj",
"=",
"5",
",",
"timeout",
"=",
"5",
")",
":",
"url",
"=",
"'http://simbad.u-strasbg.fr/simbad/sim-script'",
"q",
"=",
"'set limit '",
"+",
"str",
"(",
"maxobj",
")",
"+",
"'\\nformat object form1 \"... | Sends off a request to Simbad to check whether a target is recognised.
Returns with a list of results, or raises an exception if it times out | [
"Sends",
"off",
"a",
"request",
"to",
"Simbad",
"to",
"check",
"whether",
"a",
"target",
"is",
"recognised",
".",
"Returns",
"with",
"a",
"list",
"of",
"results",
"or",
"raises",
"an",
"exception",
"if",
"it",
"times",
"out"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/misc.py#L573-L603 | train | Sends a request to Simbad to check whether a target is recognised. Returns with a list of results or raises an exception if it times out. |
HiPERCAM/hcam_widgets | hcam_widgets/misc.py | FifoThread.run | def run(self):
"""
Version of run that traps Exceptions and stores
them in the fifo
"""
try:
threading.Thread.run(self)
except Exception:
t, v, tb = sys.exc_info()
error = traceback.format_exception_only(t, v)[0][:-1]
tback ... | python | def run(self):
"""
Version of run that traps Exceptions and stores
them in the fifo
"""
try:
threading.Thread.run(self)
except Exception:
t, v, tb = sys.exc_info()
error = traceback.format_exception_only(t, v)[0][:-1]
tback ... | [
"def",
"run",
"(",
"self",
")",
":",
"try",
":",
"threading",
".",
"Thread",
".",
"run",
"(",
"self",
")",
"except",
"Exception",
":",
"t",
",",
"v",
",",
"tb",
"=",
"sys",
".",
"exc_info",
"(",
")",
"error",
"=",
"traceback",
".",
"format_exceptio... | Version of run that traps Exceptions and stores
them in the fifo | [
"Version",
"of",
"run",
"that",
"traps",
"Exceptions",
"and",
"stores",
"them",
"in",
"the",
"fifo"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/misc.py#L618-L630 | train | Runs the thread and stores the tracebacks and the exception in the fifo. |
MacHu-GWU/loggerFactory-project | loggerFactory/rand_str.py | rand_str | def rand_str(charset, length=32):
"""
Generate random string.
"""
return "".join([random.choice(charset) for _ in range(length)]) | python | def rand_str(charset, length=32):
"""
Generate random string.
"""
return "".join([random.choice(charset) for _ in range(length)]) | [
"def",
"rand_str",
"(",
"charset",
",",
"length",
"=",
"32",
")",
":",
"return",
"\"\"",
".",
"join",
"(",
"[",
"random",
".",
"choice",
"(",
"charset",
")",
"for",
"_",
"in",
"range",
"(",
"length",
")",
"]",
")"
] | Generate random string. | [
"Generate",
"random",
"string",
"."
] | 4de19e275e01dc583b1af9ceeacef0c6084cd6e0 | https://github.com/MacHu-GWU/loggerFactory-project/blob/4de19e275e01dc583b1af9ceeacef0c6084cd6e0/loggerFactory/rand_str.py#L16-L20 | train | Generate random string. |
HiPERCAM/hcam_widgets | hcam_widgets/tkutils.py | get_root | def get_root(w):
"""
Simple method to access root for a widget
"""
next_level = w
while next_level.master:
next_level = next_level.master
return next_level | python | def get_root(w):
"""
Simple method to access root for a widget
"""
next_level = w
while next_level.master:
next_level = next_level.master
return next_level | [
"def",
"get_root",
"(",
"w",
")",
":",
"next_level",
"=",
"w",
"while",
"next_level",
".",
"master",
":",
"next_level",
"=",
"next_level",
".",
"master",
"return",
"next_level"
] | Simple method to access root for a widget | [
"Simple",
"method",
"to",
"access",
"root",
"for",
"a",
"widget"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/tkutils.py#L18-L25 | train | Simple method to access root for a widget |
HiPERCAM/hcam_widgets | hcam_widgets/tkutils.py | addStyle | def addStyle(w):
"""
Styles the GUI: global fonts and colours.
Parameters
----------
w : tkinter.tk
widget element to style
"""
# access global container in root widget
root = get_root(w)
g = root.globals
fsize = g.cpars['font_size']
family = g.cpars['font_family']
... | python | def addStyle(w):
"""
Styles the GUI: global fonts and colours.
Parameters
----------
w : tkinter.tk
widget element to style
"""
# access global container in root widget
root = get_root(w)
g = root.globals
fsize = g.cpars['font_size']
family = g.cpars['font_family']
... | [
"def",
"addStyle",
"(",
"w",
")",
":",
"# access global container in root widget",
"root",
"=",
"get_root",
"(",
"w",
")",
"g",
"=",
"root",
".",
"globals",
"fsize",
"=",
"g",
".",
"cpars",
"[",
"'font_size'",
"]",
"family",
"=",
"g",
".",
"cpars",
"[",
... | Styles the GUI: global fonts and colours.
Parameters
----------
w : tkinter.tk
widget element to style | [
"Styles",
"the",
"GUI",
":",
"global",
"fonts",
"and",
"colours",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/tkutils.py#L28-L65 | train | Adds the styles of the GUI element w to the global fonts and colours. |
IceflowRE/unidown | unidown/core/manager.py | init | def init(main_dir: Path, logfile_path: Path, log_level: str):
"""
Initialize the _downloader. TODO.
:param main_dir: main directory
:type main_dir: ~pathlib.Path
:param logfile_path: logfile path
:type logfile_path: ~pathlib.Path
:param log_level: logging level
:type log_level: str
... | python | def init(main_dir: Path, logfile_path: Path, log_level: str):
"""
Initialize the _downloader. TODO.
:param main_dir: main directory
:type main_dir: ~pathlib.Path
:param logfile_path: logfile path
:type logfile_path: ~pathlib.Path
:param log_level: logging level
:type log_level: str
... | [
"def",
"init",
"(",
"main_dir",
":",
"Path",
",",
"logfile_path",
":",
"Path",
",",
"log_level",
":",
"str",
")",
":",
"dynamic_data",
".",
"reset",
"(",
")",
"dynamic_data",
".",
"init_dirs",
"(",
"main_dir",
",",
"logfile_path",
")",
"dynamic_data",
".",... | Initialize the _downloader. TODO.
:param main_dir: main directory
:type main_dir: ~pathlib.Path
:param logfile_path: logfile path
:type logfile_path: ~pathlib.Path
:param log_level: logging level
:type log_level: str | [
"Initialize",
"the",
"_downloader",
".",
"TODO",
"."
] | 2a6f82ab780bb825668bfc55b67c11c4f72ec05c | https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/core/manager.py#L17-L56 | train | Initialize the _downloader. |
IceflowRE/unidown | unidown/core/manager.py | download_from_plugin | def download_from_plugin(plugin: APlugin):
"""
Download routine.
1. get newest update time
2. load savestate
3. compare last update time with savestate time
4. get download links
5. compare with savestate
6. download new/updated data
7. check downloads
8. update savestate
9.... | python | def download_from_plugin(plugin: APlugin):
"""
Download routine.
1. get newest update time
2. load savestate
3. compare last update time with savestate time
4. get download links
5. compare with savestate
6. download new/updated data
7. check downloads
8. update savestate
9.... | [
"def",
"download_from_plugin",
"(",
"plugin",
":",
"APlugin",
")",
":",
"# get last update date",
"plugin",
".",
"log",
".",
"info",
"(",
"'Get last update'",
")",
"plugin",
".",
"update_last_update",
"(",
")",
"# load old save state",
"save_state",
"=",
"plugin",
... | Download routine.
1. get newest update time
2. load savestate
3. compare last update time with savestate time
4. get download links
5. compare with savestate
6. download new/updated data
7. check downloads
8. update savestate
9. write new savestate
:param plugin: plugin
:ty... | [
"Download",
"routine",
"."
] | 2a6f82ab780bb825668bfc55b67c11c4f72ec05c | https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/core/manager.py#L66-L111 | train | Download and check if all data is downloaded and if so update the site with the latest update time. |
IceflowRE/unidown | unidown/core/manager.py | run | def run(plugin_name: str, options: List[str] = None) -> PluginState:
"""
Run a plugin so use the download routine and clean up after.
:param plugin_name: name of plugin
:type plugin_name: str
:param options: parameters which will be send to the plugin initialization
:type options: List[str]
... | python | def run(plugin_name: str, options: List[str] = None) -> PluginState:
"""
Run a plugin so use the download routine and clean up after.
:param plugin_name: name of plugin
:type plugin_name: str
:param options: parameters which will be send to the plugin initialization
:type options: List[str]
... | [
"def",
"run",
"(",
"plugin_name",
":",
"str",
",",
"options",
":",
"List",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"PluginState",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"[",
"]",
"if",
"plugin_name",
"not",
"in",
"dynamic_data",
".... | Run a plugin so use the download routine and clean up after.
:param plugin_name: name of plugin
:type plugin_name: str
:param options: parameters which will be send to the plugin initialization
:type options: List[str]
:return: success
:rtype: ~unidown.plugin.plugin_state.PluginState | [
"Run",
"a",
"plugin",
"so",
"use",
"the",
"download",
"routine",
"and",
"clean",
"up",
"after",
"."
] | 2a6f82ab780bb825668bfc55b67c11c4f72ec05c | https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/core/manager.py#L114-L160 | train | Runs a plugin so use the download routine and clean up after. |
IceflowRE/unidown | unidown/core/manager.py | check_update | def check_update():
"""
Check for app updates and print/log them.
"""
logging.info('Check for app updates.')
try:
update = updater.check_for_app_updates()
except Exception:
logging.exception('Check for updates failed.')
return
if update:
print("!!! UPDATE AVAI... | python | def check_update():
"""
Check for app updates and print/log them.
"""
logging.info('Check for app updates.')
try:
update = updater.check_for_app_updates()
except Exception:
logging.exception('Check for updates failed.')
return
if update:
print("!!! UPDATE AVAI... | [
"def",
"check_update",
"(",
")",
":",
"logging",
".",
"info",
"(",
"'Check for app updates.'",
")",
"try",
":",
"update",
"=",
"updater",
".",
"check_for_app_updates",
"(",
")",
"except",
"Exception",
":",
"logging",
".",
"exception",
"(",
"'Check for updates fa... | Check for app updates and print/log them. | [
"Check",
"for",
"app",
"updates",
"and",
"print",
"/",
"log",
"them",
"."
] | 2a6f82ab780bb825668bfc55b67c11c4f72ec05c | https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/core/manager.py#L163-L178 | train | Check for app updates and print them if they are available. |
IceflowRE/unidown | unidown/core/updater.py | get_newest_app_version | def get_newest_app_version() -> Version:
"""
Download the version tag from remote.
:return: version from remote
:rtype: ~packaging.version.Version
"""
with urllib3.PoolManager(cert_reqs='CERT_REQUIRED', ca_certs=certifi.where()) as p_man:
pypi_json = p_man.urlopen('GET', static_data.PYP... | python | def get_newest_app_version() -> Version:
"""
Download the version tag from remote.
:return: version from remote
:rtype: ~packaging.version.Version
"""
with urllib3.PoolManager(cert_reqs='CERT_REQUIRED', ca_certs=certifi.where()) as p_man:
pypi_json = p_man.urlopen('GET', static_data.PYP... | [
"def",
"get_newest_app_version",
"(",
")",
"->",
"Version",
":",
"with",
"urllib3",
".",
"PoolManager",
"(",
"cert_reqs",
"=",
"'CERT_REQUIRED'",
",",
"ca_certs",
"=",
"certifi",
".",
"where",
"(",
")",
")",
"as",
"p_man",
":",
"pypi_json",
"=",
"p_man",
"... | Download the version tag from remote.
:return: version from remote
:rtype: ~packaging.version.Version | [
"Download",
"the",
"version",
"tag",
"from",
"remote",
"."
] | 2a6f82ab780bb825668bfc55b67c11c4f72ec05c | https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/core/updater.py#L13-L28 | train | Download the version tag from remote and return the newest version. |
HiPERCAM/hcam_widgets | hcam_widgets/hcam.py | InstPars.setupNodding | def setupNodding(self):
"""
Setup Nodding for GTC
"""
g = get_root(self).globals
if not self.nod():
# re-enable clear mode box if not drift
if not self.isDrift():
self.clear.enable()
# clear existing nod pattern
se... | python | def setupNodding(self):
"""
Setup Nodding for GTC
"""
g = get_root(self).globals
if not self.nod():
# re-enable clear mode box if not drift
if not self.isDrift():
self.clear.enable()
# clear existing nod pattern
se... | [
"def",
"setupNodding",
"(",
"self",
")",
":",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"if",
"not",
"self",
".",
"nod",
"(",
")",
":",
"# re-enable clear mode box if not drift",
"if",
"not",
"self",
".",
"isDrift",
"(",
")",
":",
"self",
... | Setup Nodding for GTC | [
"Setup",
"Nodding",
"for",
"GTC"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L286-L357 | train | Setup Nodding for GTC and return the current nodding entry. |
HiPERCAM/hcam_widgets | hcam_widgets/hcam.py | InstPars.dumpJSON | def dumpJSON(self):
"""
Encodes current parameters to JSON compatible dictionary
"""
numexp = self.number.get()
expTime, _, _, _, _ = self.timing()
if numexp == 0:
numexp = -1
data = dict(
numexp=self.number.value(),
app=self.a... | python | def dumpJSON(self):
"""
Encodes current parameters to JSON compatible dictionary
"""
numexp = self.number.get()
expTime, _, _, _, _ = self.timing()
if numexp == 0:
numexp = -1
data = dict(
numexp=self.number.value(),
app=self.a... | [
"def",
"dumpJSON",
"(",
"self",
")",
":",
"numexp",
"=",
"self",
".",
"number",
".",
"get",
"(",
")",
"expTime",
",",
"_",
",",
"_",
",",
"_",
",",
"_",
"=",
"self",
".",
"timing",
"(",
")",
"if",
"numexp",
"==",
"0",
":",
"numexp",
"=",
"-",... | Encodes current parameters to JSON compatible dictionary | [
"Encodes",
"current",
"parameters",
"to",
"JSON",
"compatible",
"dictionary"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L404-L464 | train | Dump current parameters to JSON compatible dictionary. |
HiPERCAM/hcam_widgets | hcam_widgets/hcam.py | InstPars.loadJSON | def loadJSON(self, json_string):
"""
Loads in an application saved in JSON format.
"""
g = get_root(self).globals
data = json.loads(json_string)['appdata']
# first set the parameters which change regardless of mode
# number of exposures
numexp = data.get('... | python | def loadJSON(self, json_string):
"""
Loads in an application saved in JSON format.
"""
g = get_root(self).globals
data = json.loads(json_string)['appdata']
# first set the parameters which change regardless of mode
# number of exposures
numexp = data.get('... | [
"def",
"loadJSON",
"(",
"self",
",",
"json_string",
")",
":",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"data",
"=",
"json",
".",
"loads",
"(",
"json_string",
")",
"[",
"'appdata'",
"]",
"# first set the parameters which change regardless of mode",... | Loads in an application saved in JSON format. | [
"Loads",
"in",
"an",
"application",
"saved",
"in",
"JSON",
"format",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L466-L571 | train | Load the current state from a JSON string. |
HiPERCAM/hcam_widgets | hcam_widgets/hcam.py | InstPars.check | def check(self, *args):
"""
Callback to check validity of instrument parameters.
Performs the following tasks:
- spots and flags overlapping windows or null window parameters
- flags windows with invalid dimensions given the binning parameter
- sets the corre... | python | def check(self, *args):
"""
Callback to check validity of instrument parameters.
Performs the following tasks:
- spots and flags overlapping windows or null window parameters
- flags windows with invalid dimensions given the binning parameter
- sets the corre... | [
"def",
"check",
"(",
"self",
",",
"*",
"args",
")",
":",
"status",
"=",
"True",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"# clear errors on binning (may be set later if FF)",
"xbinw",
",",
"ybinw",
"=",
"self",
".",
"wframe",
".",
"xbin",
",... | Callback to check validity of instrument parameters.
Performs the following tasks:
- spots and flags overlapping windows or null window parameters
- flags windows with invalid dimensions given the binning parameter
- sets the correct number of enabled windows
- d... | [
"Callback",
"to",
"check",
"validity",
"of",
"instrument",
"parameters",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L573-L717 | train | Checks validity of the instrument parameters. |
HiPERCAM/hcam_widgets | hcam_widgets/hcam.py | InstPars.freeze | def freeze(self):
"""
Freeze all settings so they cannot be altered
"""
self.app.disable()
self.clear.disable()
self.nod.disable()
self.led.disable()
self.dummy.disable()
self.readSpeed.disable()
self.expose.disable()
self.number.di... | python | def freeze(self):
"""
Freeze all settings so they cannot be altered
"""
self.app.disable()
self.clear.disable()
self.nod.disable()
self.led.disable()
self.dummy.disable()
self.readSpeed.disable()
self.expose.disable()
self.number.di... | [
"def",
"freeze",
"(",
"self",
")",
":",
"self",
".",
"app",
".",
"disable",
"(",
")",
"self",
".",
"clear",
".",
"disable",
"(",
")",
"self",
".",
"nod",
".",
"disable",
"(",
")",
"self",
".",
"led",
".",
"disable",
"(",
")",
"self",
".",
"dumm... | Freeze all settings so they cannot be altered | [
"Freeze",
"all",
"settings",
"so",
"they",
"cannot",
"be",
"altered"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L719-L733 | train | Freeze all settings so they cannot be altered |
HiPERCAM/hcam_widgets | hcam_widgets/hcam.py | InstPars.unfreeze | def unfreeze(self):
"""
Reverse of freeze
"""
self.app.enable()
self.clear.enable()
self.nod.enable()
self.led.enable()
self.dummy.enable()
self.readSpeed.enable()
self.expose.enable()
self.number.enable()
self.wframe.enable... | python | def unfreeze(self):
"""
Reverse of freeze
"""
self.app.enable()
self.clear.enable()
self.nod.enable()
self.led.enable()
self.dummy.enable()
self.readSpeed.enable()
self.expose.enable()
self.number.enable()
self.wframe.enable... | [
"def",
"unfreeze",
"(",
"self",
")",
":",
"self",
".",
"app",
".",
"enable",
"(",
")",
"self",
".",
"clear",
".",
"enable",
"(",
")",
"self",
".",
"nod",
".",
"enable",
"(",
")",
"self",
".",
"led",
".",
"enable",
"(",
")",
"self",
".",
"dummy"... | Reverse of freeze | [
"Reverse",
"of",
"freeze"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L735-L749 | train | Unfreeze the current object. |
HiPERCAM/hcam_widgets | hcam_widgets/hcam.py | InstPars.getRtplotWins | def getRtplotWins(self):
""""
Returns a string suitable to sending off to rtplot when
it asks for window parameters. Returns null string '' if
the windows are not OK. This operates on the basis of
trying to send something back, even if it might not be
OK as a window setup... | python | def getRtplotWins(self):
""""
Returns a string suitable to sending off to rtplot when
it asks for window parameters. Returns null string '' if
the windows are not OK. This operates on the basis of
trying to send something back, even if it might not be
OK as a window setup... | [
"def",
"getRtplotWins",
"(",
"self",
")",
":",
"try",
":",
"if",
"self",
".",
"isFF",
"(",
")",
":",
"return",
"'fullframe\\r\\n'",
"elif",
"self",
".",
"isDrift",
"(",
")",
":",
"xbin",
"=",
"self",
".",
"wframe",
".",
"xbin",
".",
"value",
"(",
"... | Returns a string suitable to sending off to rtplot when
it asks for window parameters. Returns null string '' if
the windows are not OK. This operates on the basis of
trying to send something back, even if it might not be
OK as a window setup. Note that we have to take care
here ... | [
"Returns",
"a",
"string",
"suitable",
"to",
"sending",
"off",
"to",
"rtplot",
"when",
"it",
"asks",
"for",
"window",
"parameters",
".",
"Returns",
"null",
"string",
"if",
"the",
"windows",
"are",
"not",
"OK",
".",
"This",
"operates",
"on",
"the",
"basis",
... | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L751-L797 | train | Returns a string suitable to send off to rtplot when the current window parameters are OK. Returns null string if the current window parameters are not OK. |
HiPERCAM/hcam_widgets | hcam_widgets/hcam.py | InstPars.timing | def timing(self):
"""
Estimates timing information for the current setup. You should
run a check on the instrument parameters before calling this.
Returns: (expTime, deadTime, cycleTime, dutyCycle)
expTime : exposure time per frame (seconds)
deadTime : dead time per ... | python | def timing(self):
"""
Estimates timing information for the current setup. You should
run a check on the instrument parameters before calling this.
Returns: (expTime, deadTime, cycleTime, dutyCycle)
expTime : exposure time per frame (seconds)
deadTime : dead time per ... | [
"def",
"timing",
"(",
"self",
")",
":",
"# drift mode y/n?",
"isDriftMode",
"=",
"self",
".",
"isDrift",
"(",
")",
"# FF y/n?",
"isFF",
"=",
"self",
".",
"isFF",
"(",
")",
"# Set the readout speed",
"readSpeed",
"=",
"self",
".",
"readSpeed",
"(",
")",
"if... | Estimates timing information for the current setup. You should
run a check on the instrument parameters before calling this.
Returns: (expTime, deadTime, cycleTime, dutyCycle)
expTime : exposure time per frame (seconds)
deadTime : dead time per frame (seconds)
cycleTime : sa... | [
"Estimates",
"timing",
"information",
"for",
"the",
"current",
"setup",
".",
"You",
"should",
"run",
"a",
"check",
"on",
"the",
"instrument",
"parameters",
"before",
"calling",
"this",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L799-L1009 | train | Return a tuple of the current set of timing information for the current set of instrument parameters. |
HiPERCAM/hcam_widgets | hcam_widgets/hcam.py | RunPars.loadJSON | def loadJSON(self, json_string):
"""
Sets the values of the run parameters given an JSON string
"""
g = get_root(self).globals
user = json.loads(json_string)['user']
def setField(widget, field):
val = user.get(field)
if val is not None:
... | python | def loadJSON(self, json_string):
"""
Sets the values of the run parameters given an JSON string
"""
g = get_root(self).globals
user = json.loads(json_string)['user']
def setField(widget, field):
val = user.get(field)
if val is not None:
... | [
"def",
"loadJSON",
"(",
"self",
",",
"json_string",
")",
":",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"user",
"=",
"json",
".",
"loads",
"(",
"json_string",
")",
"[",
"'user'",
"]",
"def",
"setField",
"(",
"widget",
",",
"field",
")",... | Sets the values of the run parameters given an JSON string | [
"Sets",
"the",
"values",
"of",
"the",
"run",
"parameters",
"given",
"an",
"JSON",
"string"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L1075-L1094 | train | Sets the values of the run parameters given a JSON string |
HiPERCAM/hcam_widgets | hcam_widgets/hcam.py | RunPars.dumpJSON | def dumpJSON(self):
"""
Encodes current parameters to JSON compatible dictionary
"""
g = get_root(self).globals
dtype = g.observe.rtype()
if dtype == 'bias':
target = 'BIAS'
elif dtype == 'flat':
target = 'FLAT'
elif dtype == 'dark'... | python | def dumpJSON(self):
"""
Encodes current parameters to JSON compatible dictionary
"""
g = get_root(self).globals
dtype = g.observe.rtype()
if dtype == 'bias':
target = 'BIAS'
elif dtype == 'flat':
target = 'FLAT'
elif dtype == 'dark'... | [
"def",
"dumpJSON",
"(",
"self",
")",
":",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"dtype",
"=",
"g",
".",
"observe",
".",
"rtype",
"(",
")",
"if",
"dtype",
"==",
"'bias'",
":",
"target",
"=",
"'BIAS'",
"elif",
"dtype",
"==",
"'flat'... | Encodes current parameters to JSON compatible dictionary | [
"Encodes",
"current",
"parameters",
"to",
"JSON",
"compatible",
"dictionary"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L1096-L1120 | train | Dumps current parameters to JSON compatible dictionary. |
HiPERCAM/hcam_widgets | hcam_widgets/hcam.py | RunPars.check | def check(self, *args):
"""
Checks the validity of the run parameters. Returns
flag (True = OK), and a message which indicates the
nature of the problem if the flag is False.
"""
ok = True
msg = ''
g = get_root(self).globals
dtype = g.observe.rtyp... | python | def check(self, *args):
"""
Checks the validity of the run parameters. Returns
flag (True = OK), and a message which indicates the
nature of the problem if the flag is False.
"""
ok = True
msg = ''
g = get_root(self).globals
dtype = g.observe.rtyp... | [
"def",
"check",
"(",
"self",
",",
"*",
"args",
")",
":",
"ok",
"=",
"True",
"msg",
"=",
"''",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"dtype",
"=",
"g",
".",
"observe",
".",
"rtype",
"(",
")",
"expert",
"=",
"g",
".",
"cpars",
... | Checks the validity of the run parameters. Returns
flag (True = OK), and a message which indicates the
nature of the problem if the flag is False. | [
"Checks",
"the",
"validity",
"of",
"the",
"run",
"parameters",
".",
"Returns",
"flag",
"(",
"True",
"=",
"OK",
")",
"and",
"a",
"message",
"which",
"indicates",
"the",
"nature",
"of",
"the",
"problem",
"if",
"the",
"flag",
"is",
"False",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L1122-L1181 | train | Checks the validity of the run parameters. Returns True if the flag is False otherwise. |
HiPERCAM/hcam_widgets | hcam_widgets/hcam.py | RunPars.freeze | def freeze(self):
"""
Freeze all settings so that they can't be altered
"""
self.target.disable()
self.filter.configure(state='disable')
self.prog_ob.configure(state='disable')
self.pi.configure(state='disable')
self.observers.configure(state='disable')
... | python | def freeze(self):
"""
Freeze all settings so that they can't be altered
"""
self.target.disable()
self.filter.configure(state='disable')
self.prog_ob.configure(state='disable')
self.pi.configure(state='disable')
self.observers.configure(state='disable')
... | [
"def",
"freeze",
"(",
"self",
")",
":",
"self",
".",
"target",
".",
"disable",
"(",
")",
"self",
".",
"filter",
".",
"configure",
"(",
"state",
"=",
"'disable'",
")",
"self",
".",
"prog_ob",
".",
"configure",
"(",
"state",
"=",
"'disable'",
")",
"sel... | Freeze all settings so that they can't be altered | [
"Freeze",
"all",
"settings",
"so",
"that",
"they",
"can",
"t",
"be",
"altered"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L1195-L1204 | train | Freeze all settings so that they can t be altered |
HiPERCAM/hcam_widgets | hcam_widgets/hcam.py | RunPars.unfreeze | def unfreeze(self):
"""
Unfreeze all settings so that they can be altered
"""
g = get_root(self).globals
self.filter.configure(state='normal')
dtype = g.observe.rtype()
if dtype == 'data caution' or dtype == 'data' or dtype == 'technical':
self.prog_ob... | python | def unfreeze(self):
"""
Unfreeze all settings so that they can be altered
"""
g = get_root(self).globals
self.filter.configure(state='normal')
dtype = g.observe.rtype()
if dtype == 'data caution' or dtype == 'data' or dtype == 'technical':
self.prog_ob... | [
"def",
"unfreeze",
"(",
"self",
")",
":",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"self",
".",
"filter",
".",
"configure",
"(",
"state",
"=",
"'normal'",
")",
"dtype",
"=",
"g",
".",
"observe",
".",
"rtype",
"(",
")",
"if",
"dtype",... | Unfreeze all settings so that they can be altered | [
"Unfreeze",
"all",
"settings",
"so",
"that",
"they",
"can",
"be",
"altered"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L1206-L1218 | train | Unfreeze all settings so that they can be altered |
HiPERCAM/hcam_widgets | hcam_widgets/hcam.py | CountsFrame.checkUpdate | def checkUpdate(self, *args):
"""
Updates values after first checking instrument parameters are OK.
This is not integrated within update to prevent ifinite recursion
since update gets called from ipars.
"""
g = get_root(self).globals
if not self.check():
... | python | def checkUpdate(self, *args):
"""
Updates values after first checking instrument parameters are OK.
This is not integrated within update to prevent ifinite recursion
since update gets called from ipars.
"""
g = get_root(self).globals
if not self.check():
... | [
"def",
"checkUpdate",
"(",
"self",
",",
"*",
"args",
")",
":",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"if",
"not",
"self",
".",
"check",
"(",
")",
":",
"g",
".",
"clog",
".",
"warn",
"(",
"'Current observing parameters are not valid.'",
... | Updates values after first checking instrument parameters are OK.
This is not integrated within update to prevent ifinite recursion
since update gets called from ipars. | [
"Updates",
"values",
"after",
"first",
"checking",
"instrument",
"parameters",
"are",
"OK",
".",
"This",
"is",
"not",
"integrated",
"within",
"update",
"to",
"prevent",
"ifinite",
"recursion",
"since",
"update",
"gets",
"called",
"from",
"ipars",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L1314-L1327 | train | Checks if the current observing parameters are OK. |
HiPERCAM/hcam_widgets | hcam_widgets/hcam.py | CountsFrame.check | def check(self):
"""
Checks values
"""
status = True
g = get_root(self).globals
if self.mag.ok():
self.mag.config(bg=g.COL['main'])
else:
self.mag.config(bg=g.COL['warn'])
status = False
if self.airmass.ok():
... | python | def check(self):
"""
Checks values
"""
status = True
g = get_root(self).globals
if self.mag.ok():
self.mag.config(bg=g.COL['main'])
else:
self.mag.config(bg=g.COL['warn'])
status = False
if self.airmass.ok():
... | [
"def",
"check",
"(",
"self",
")",
":",
"status",
"=",
"True",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"if",
"self",
".",
"mag",
".",
"ok",
"(",
")",
":",
"self",
".",
"mag",
".",
"config",
"(",
"bg",
"=",
"g",
".",
"COL",
"[",... | Checks values | [
"Checks",
"values"
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L1329-L1353 | train | Checks if the current instance of the assessment is OK. |
HiPERCAM/hcam_widgets | hcam_widgets/hcam.py | CountsFrame.update | def update(self, *args):
"""
Updates values. You should run a check on the instrument and
target parameters before calling this.
"""
g = get_root(self).globals
expTime, deadTime, cycleTime, dutyCycle, frameRate = g.ipars.timing()
total, peak, peakSat, peakWarn, s... | python | def update(self, *args):
"""
Updates values. You should run a check on the instrument and
target parameters before calling this.
"""
g = get_root(self).globals
expTime, deadTime, cycleTime, dutyCycle, frameRate = g.ipars.timing()
total, peak, peakSat, peakWarn, s... | [
"def",
"update",
"(",
"self",
",",
"*",
"args",
")",
":",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"expTime",
",",
"deadTime",
",",
"cycleTime",
",",
"dutyCycle",
",",
"frameRate",
"=",
"g",
".",
"ipars",
".",
"timing",
"(",
")",
"to... | Updates values. You should run a check on the instrument and
target parameters before calling this. | [
"Updates",
"values",
".",
"You",
"should",
"run",
"a",
"check",
"on",
"the",
"instrument",
"and",
"target",
"parameters",
"before",
"calling",
"this",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L1355-L1407 | train | Updates the values of the cadence and exposure objects for the current instance of the base class. |
HiPERCAM/hcam_widgets | hcam_widgets/hcam.py | CountsFrame.counts | def counts(self, expTime, cycleTime, ap_scale=1.6, ndiv=5):
"""
Computes counts per pixel, total counts, sky counts
etc given current magnitude, seeing etc. You should
run a check on the instrument parameters before calling
this.
expTime : exposure time per frame (seco... | python | def counts(self, expTime, cycleTime, ap_scale=1.6, ndiv=5):
"""
Computes counts per pixel, total counts, sky counts
etc given current magnitude, seeing etc. You should
run a check on the instrument parameters before calling
this.
expTime : exposure time per frame (seco... | [
"def",
"counts",
"(",
"self",
",",
"expTime",
",",
"cycleTime",
",",
"ap_scale",
"=",
"1.6",
",",
"ndiv",
"=",
"5",
")",
":",
"# code directly translated from Java equivalent.",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"# Set the readout speed",
... | Computes counts per pixel, total counts, sky counts
etc given current magnitude, seeing etc. You should
run a check on the instrument parameters before calling
this.
expTime : exposure time per frame (seconds)
cycleTime : sampling, cadence (seconds)
ap_scale : apertur... | [
"Computes",
"counts",
"per",
"pixel",
"total",
"counts",
"sky",
"counts",
"etc",
"given",
"current",
"magnitude",
"seeing",
"etc",
".",
"You",
"should",
"run",
"a",
"check",
"on",
"the",
"instrument",
"parameters",
"before",
"calling",
"this",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L1409-L1515 | train | Compute the counts per pixel total counts sky counts and signal to noise per exposure and aperture radius. |
HiPERCAM/hcam_widgets | hcam_widgets/hcam.py | Start.disable | def disable(self):
"""
Disable the button, if in non-expert mode.
"""
w.ActButton.disable(self)
g = get_root(self).globals
if self._expert:
self.config(bg=g.COL['start'])
else:
self.config(bg=g.COL['startD']) | python | def disable(self):
"""
Disable the button, if in non-expert mode.
"""
w.ActButton.disable(self)
g = get_root(self).globals
if self._expert:
self.config(bg=g.COL['start'])
else:
self.config(bg=g.COL['startD']) | [
"def",
"disable",
"(",
"self",
")",
":",
"w",
".",
"ActButton",
".",
"disable",
"(",
"self",
")",
"g",
"=",
"get_root",
"(",
"self",
")",
".",
"globals",
"if",
"self",
".",
"_expert",
":",
"self",
".",
"config",
"(",
"bg",
"=",
"g",
".",
"COL",
... | Disable the button, if in non-expert mode. | [
"Disable",
"the",
"button",
"if",
"in",
"non",
"-",
"expert",
"mode",
"."
] | 7219f0d96dd3a8ebe3139c7f542a72c02d02fce8 | https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L1592-L1601 | train | Disable the button if in non - expert mode. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.