repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
bhmm/bhmm
bhmm/util/statistics.py
confidence_interval_arr
def confidence_interval_arr(data, conf=0.95): r""" Computes element-wise confidence intervals from a sample of ndarrays Given a sample of arbitrarily shaped ndarrays, computes element-wise confidence intervals Parameters ---------- data : ndarray (K, (shape)) ndarray of ndarrays, the first...
python
def confidence_interval_arr(data, conf=0.95): r""" Computes element-wise confidence intervals from a sample of ndarrays Given a sample of arbitrarily shaped ndarrays, computes element-wise confidence intervals Parameters ---------- data : ndarray (K, (shape)) ndarray of ndarrays, the first...
[ "def", "confidence_interval_arr", "(", "data", ",", "conf", "=", "0.95", ")", ":", "if", "conf", "<", "0", "or", "conf", ">", "1", ":", "raise", "ValueError", "(", "'Not a meaningful confidence level: '", "+", "str", "(", "conf", ")", ")", "# list or 1D-arra...
r""" Computes element-wise confidence intervals from a sample of ndarrays Given a sample of arbitrarily shaped ndarrays, computes element-wise confidence intervals Parameters ---------- data : ndarray (K, (shape)) ndarray of ndarrays, the first index is a sample index, the remaining indexes ar...
[ "r", "Computes", "element", "-", "wise", "confidence", "intervals", "from", "a", "sample", "of", "ndarrays" ]
train
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/util/statistics.py#L108-L151
adobe-apiplatform/umapi-client.py
umapi_client/connection.py
Connection.status
def status(self, remote=False): """ Return the connection status, both locally and remotely. The local connection status is a dictionary that gives: * the count of multiple queries sent to the server. * the count of single queries sent to the server. * the count of actio...
python
def status(self, remote=False): """ Return the connection status, both locally and remotely. The local connection status is a dictionary that gives: * the count of multiple queries sent to the server. * the count of single queries sent to the server. * the count of actio...
[ "def", "status", "(", "self", ",", "remote", "=", "False", ")", ":", "if", "remote", ":", "components", "=", "urlparse", ".", "urlparse", "(", "self", ".", "endpoint", ")", "try", ":", "result", "=", "self", ".", "session", ".", "get", "(", "componen...
Return the connection status, both locally and remotely. The local connection status is a dictionary that gives: * the count of multiple queries sent to the server. * the count of single queries sent to the server. * the count of actions sent to the server. * the count of action...
[ "Return", "the", "connection", "status", "both", "locally", "and", "remotely", "." ]
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/connection.py#L164-L201
adobe-apiplatform/umapi-client.py
umapi_client/connection.py
Connection.query_single
def query_single(self, object_type, url_params, query_params=None): # type: (str, list, dict) -> dict """ Query for a single object. :param object_type: string query type (e.g., "users" or "groups") :param url_params: required list of strings to provide as additional URL componen...
python
def query_single(self, object_type, url_params, query_params=None): # type: (str, list, dict) -> dict """ Query for a single object. :param object_type: string query type (e.g., "users" or "groups") :param url_params: required list of strings to provide as additional URL componen...
[ "def", "query_single", "(", "self", ",", "object_type", ",", "url_params", ",", "query_params", "=", "None", ")", ":", "# type: (str, list, dict) -> dict", "# Server API convention (v2) is that the pluralized object type goes into the endpoint", "# but the object type is the key in t...
Query for a single object. :param object_type: string query type (e.g., "users" or "groups") :param url_params: required list of strings to provide as additional URL components :param query_params: optional dictionary of query options :return: the found object (a dictionary), which is em...
[ "Query", "for", "a", "single", "object", ".", ":", "param", "object_type", ":", "string", "query", "type", "(", "e", ".", "g", ".", "users", "or", "groups", ")", ":", "param", "url_params", ":", "required", "list", "of", "strings", "to", "provide", "as...
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/connection.py#L203-L235
adobe-apiplatform/umapi-client.py
umapi_client/connection.py
Connection.query_multiple
def query_multiple(self, object_type, page=0, url_params=None, query_params=None): # type: (str, int, list, dict) -> tuple """ Query for a page of objects. Defaults to the (0-based) first page. Sadly, the sort order is undetermined. :param object_type: string constant query type...
python
def query_multiple(self, object_type, page=0, url_params=None, query_params=None): # type: (str, int, list, dict) -> tuple """ Query for a page of objects. Defaults to the (0-based) first page. Sadly, the sort order is undetermined. :param object_type: string constant query type...
[ "def", "query_multiple", "(", "self", ",", "object_type", ",", "page", "=", "0", ",", "url_params", "=", "None", ",", "query_params", "=", "None", ")", ":", "# type: (str, int, list, dict) -> tuple", "# As of 2017-10-01, we are moving to to different URLs for user and user-...
Query for a page of objects. Defaults to the (0-based) first page. Sadly, the sort order is undetermined. :param object_type: string constant query type: either "user" or "group") :param page: numeric page (0-based) of results to get (up to 200 in a page) :param url_params: optional lis...
[ "Query", "for", "a", "page", "of", "objects", ".", "Defaults", "to", "the", "(", "0", "-", "based", ")", "first", "page", ".", "Sadly", "the", "sort", "order", "is", "undetermined", ".", ":", "param", "object_type", ":", "string", "constant", "query", ...
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/connection.py#L237-L291
adobe-apiplatform/umapi-client.py
umapi_client/connection.py
Connection.execute_single
def execute_single(self, action, immediate=False): """ Execute a single action (containing commands on a single object). Normally, since actions are batched so as to be most efficient about execution, but if you want this command sent immediately (and all prior queued commands se...
python
def execute_single(self, action, immediate=False): """ Execute a single action (containing commands on a single object). Normally, since actions are batched so as to be most efficient about execution, but if you want this command sent immediately (and all prior queued commands se...
[ "def", "execute_single", "(", "self", ",", "action", ",", "immediate", "=", "False", ")", ":", "return", "self", ".", "execute_multiple", "(", "[", "action", "]", ",", "immediate", "=", "immediate", ")" ]
Execute a single action (containing commands on a single object). Normally, since actions are batched so as to be most efficient about execution, but if you want this command sent immediately (and all prior queued commands sent earlier in this command's batch), specify a True value for the immed...
[ "Execute", "a", "single", "action", "(", "containing", "commands", "on", "a", "single", "object", ")", ".", "Normally", "since", "actions", "are", "batched", "so", "as", "to", "be", "most", "efficient", "about", "execution", "but", "if", "you", "want", "th...
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/connection.py#L293-L310
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", ...
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/connection.py#L319-L384
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"...
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/connection.py#L386-L412
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", ")",...
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/connection.py#L414-L477
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", "...
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/legacy.py#L186-L211
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...
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/legacy.py#L214-L257
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...
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/legacy.py#L62-L83
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...
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L44-L58
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", "." ]
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L67-L81
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", "." ]
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L83-L100
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", "." ]
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L102-L115
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", "." ]
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L117-L128
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", ...
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L130-L161
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" ]
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L187-L196
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", "." ]
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L198-L210
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...
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L241-L251
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", "." ]
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/api.py#L282-L286
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", ...
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L116-L156
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...
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L158-L180
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",...
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L182-L205
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", ...
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L207-L229
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", ":",...
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L231-L245
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", "...
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L247-L261
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", ...
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L263-L271
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...
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L273-L283
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" ]
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L329-L338
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", ":", ...
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L350-L365
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"...
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L367-L382
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", ...
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L384-L394
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...
train
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L396-L406
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", "." ]
train
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/render.py#L31-L37
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" ]
train
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/render.py#L39-L43
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" ]
train
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/render.py#L45-L49
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", ")" ]
train
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/render.py#L51-L65
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", "." ]
train
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/clut.py#L14-L22
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", "." ]
train
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L64-L84
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", "." ]
train
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L100-L112
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", "." ]
train
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L134-L152
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", "." ]
train
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L193-L212
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", "." ]
train
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L253-L260
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", "." ]
train
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L262-L273
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", "." ]
train
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L275-L300
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", "." ]
train
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L341-L353
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" ]
train
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L355-L360
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", "." ]
train
https://github.com/rm-hull/luma.emulator/blob/ca3db028b33d17cda9247ea5189873ff0408d013/luma/emulator/device.py#L362-L384
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", "." ]
train
https://github.com/Auzzy/1846-routes/blob/60c90928e184cbcc09c9fef46c2df07f5f14c2c2/routes1846/find_best_routes.py#L72-L75
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"...
train
https://github.com/Auzzy/1846-routes/blob/60c90928e184cbcc09c9fef46c2df07f5f14c2c2/routes1846/find_best_routes.py#L171-L224
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", "." ]
train
https://github.com/MacHu-GWU/loggerFactory-project/blob/4de19e275e01dc583b1af9ceeacef0c6084cd6e0/loggerFactory/logfilter.py#L49-L101
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", "." ]
train
https://github.com/MacHu-GWU/loggerFactory-project/blob/4de19e275e01dc583b1af9ceeacef0c6084cd6e0/loggerFactory/logger.py#L17-L27
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" ]
train
https://github.com/MacHu-GWU/loggerFactory-project/blob/4de19e275e01dc583b1af9ceeacef0c6084cd6e0/loggerFactory/logger.py#L59-L61
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" ]
train
https://github.com/MacHu-GWU/loggerFactory-project/blob/4de19e275e01dc583b1af9ceeacef0c6084cd6e0/loggerFactory/logger.py#L63-L65
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" ]
train
https://github.com/MacHu-GWU/loggerFactory-project/blob/4de19e275e01dc583b1af9ceeacef0c6084cd6e0/loggerFactory/logger.py#L67-L69
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" ]
train
https://github.com/MacHu-GWU/loggerFactory-project/blob/4de19e275e01dc583b1af9ceeacef0c6084cd6e0/loggerFactory/logger.py#L71-L73
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" ]
train
https://github.com/MacHu-GWU/loggerFactory-project/blob/4de19e275e01dc583b1af9ceeacef0c6084cd6e0/loggerFactory/logger.py#L75-L77
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", "." ]
train
https://github.com/MacHu-GWU/loggerFactory-project/blob/4de19e275e01dc583b1af9ceeacef0c6084cd6e0/loggerFactory/logger.py#L79-L89
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", "." ]
train
https://github.com/MacHu-GWU/loggerFactory-project/blob/4de19e275e01dc583b1af9ceeacef0c6084cd6e0/loggerFactory/logger.py#L111-L117
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", "." ]
train
https://github.com/MacHu-GWU/loggerFactory-project/blob/4de19e275e01dc583b1af9ceeacef0c6084cd6e0/loggerFactory/logger.py#L119-L125
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", "." ]
train
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/link_item.py#L37-L49
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", "." ]
train
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/link_item.py#L70-L80
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", "." ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/logs.py#L117-L122
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", "." ]
train
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/tools.py#L13-L27
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", "." ]
train
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/tools.py#L30-L38
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", "." ]
train
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/tools.py#L41-L52
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", "." ]
train
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/tools.py#L55-L73
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" ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/misc.py#L140-L145
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", "." ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/misc.py#L195-L227
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", "." ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/misc.py#L230-L280
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" ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/misc.py#L283-L311
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", "." ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/misc.py#L395-L430
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" ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/misc.py#L433-L478
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" ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/misc.py#L481-L498
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", "." ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/misc.py#L535-L554
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", "." ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/misc.py#L557-L570
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" ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/misc.py#L573-L603
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" ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/misc.py#L618-L630
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", "." ]
train
https://github.com/MacHu-GWU/loggerFactory-project/blob/4de19e275e01dc583b1af9ceeacef0c6084cd6e0/loggerFactory/rand_str.py#L16-L20
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" ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/tkutils.py#L18-L25
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", "." ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/tkutils.py#L28-L65
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", "." ]
train
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/core/manager.py#L17-L56
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", "." ]
train
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/core/manager.py#L66-L111
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", "." ]
train
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/core/manager.py#L114-L160
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", "." ]
train
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/core/manager.py#L163-L178
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", "." ]
train
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/core/updater.py#L13-L28
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" ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L286-L357
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" ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L404-L464
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", "." ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L466-L571
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", "." ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L573-L717
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" ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L719-L733
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" ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L735-L749
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", ...
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L751-L797
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", "." ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L799-L1009
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" ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L1075-L1094
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" ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L1096-L1120
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", "." ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L1122-L1181
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" ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L1195-L1204
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" ]
train
https://github.com/HiPERCAM/hcam_widgets/blob/7219f0d96dd3a8ebe3139c7f542a72c02d02fce8/hcam_widgets/hcam.py#L1206-L1218