Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
EasyProcess.is_alive
(self)
poll process using :meth:`subprocess.Popen.poll` :rtype: bool
poll process using :meth:`subprocess.Popen.poll`
def is_alive(self): ''' poll process using :meth:`subprocess.Popen.poll` :rtype: bool ''' if self.popen: return self.popen.poll() is None else: return False
[ "def", "is_alive", "(", "self", ")", ":", "if", "self", ".", "popen", ":", "return", "self", ".", "popen", ".", "poll", "(", ")", "is", "None", "else", ":", "return", "False" ]
[ 235, 4 ]
[ 244, 24 ]
python
en
['en', 'error', 'th']
False
EasyProcess.wait
(self, timeout=None)
Wait for command to complete. Timeout: - discussion: http://stackoverflow.com/questions/1191374/subprocess-with-timeout - implementation: threading :rtype: self
Wait for command to complete.
def wait(self, timeout=None): """Wait for command to complete. Timeout: - discussion: http://stackoverflow.com/questions/1191374/subprocess-with-timeout - implementation: threading :rtype: self """ if timeout is not None: if not self._...
[ "def", "wait", "(", "self", ",", "timeout", "=", "None", ")", ":", "if", "timeout", "is", "not", "None", ":", "if", "not", "self", ".", "_thread", ":", "self", ".", "_thread", "=", "threading", ".", "Thread", "(", "target", "=", "self", ".", "_wait...
[ 246, 4 ]
[ 271, 19 ]
python
en
['en', 'en', 'en']
True
EasyProcess.stop
(self)
Kill process and wait for command to complete. same as: 1. :meth:`sendstop` 2. :meth:`wait` :rtype: self
Kill process and wait for command to complete.
def stop(self): """Kill process and wait for command to complete. same as: 1. :meth:`sendstop` 2. :meth:`wait` :rtype: self """ return self.sendstop().wait()
[ "def", "stop", "(", "self", ")", ":", "return", "self", ".", "sendstop", "(", ")", ".", "wait", "(", ")" ]
[ 325, 4 ]
[ 335, 37 ]
python
en
['en', 'en', 'en']
True
EasyProcess.sendstop
(self)
Kill process (:meth:`subprocess.Popen.terminate`). Do not wait for command to complete. :rtype: self
Kill process (:meth:`subprocess.Popen.terminate`). Do not wait for command to complete.
def sendstop(self): ''' Kill process (:meth:`subprocess.Popen.terminate`). Do not wait for command to complete. :rtype: self ''' if not self.is_started: raise EasyProcessError(self, 'process was not started!') log.debug('stopping process (pid=%s cmd=...
[ "def", "sendstop", "(", "self", ")", ":", "if", "not", "self", ".", "is_started", ":", "raise", "EasyProcessError", "(", "self", ",", "'process was not started!'", ")", "log", ".", "debug", "(", "'stopping process (pid=%s cmd=\"%s\")'", ",", "self", ".", "pid", ...
[ 337, 4 ]
[ 365, 19 ]
python
en
['en', 'error', 'th']
False
EasyProcess.sleep
(self, sec)
sleeping (same as :func:`time.sleep`) :rtype: self
sleeping (same as :func:`time.sleep`)
def sleep(self, sec): ''' sleeping (same as :func:`time.sleep`) :rtype: self ''' time.sleep(sec) return self
[ "def", "sleep", "(", "self", ",", "sec", ")", ":", "time", ".", "sleep", "(", "sec", ")", "return", "self" ]
[ 367, 4 ]
[ 375, 19 ]
python
en
['en', 'error', 'th']
False
EasyProcess.wrap
(self, func, delay=0)
returns a function which: 1. start process 2. call func, save result 3. stop process 4. returns result similar to :keyword:`with` statement :rtype:
returns a function which: 1. start process 2. call func, save result 3. stop process 4. returns result
def wrap(self, func, delay=0): ''' returns a function which: 1. start process 2. call func, save result 3. stop process 4. returns result similar to :keyword:`with` statement :rtype: ''' def wrapped(): self.start() ...
[ "def", "wrap", "(", "self", ",", "func", ",", "delay", "=", "0", ")", ":", "def", "wrapped", "(", ")", ":", "self", ".", "start", "(", ")", "if", "delay", ":", "self", ".", "sleep", "(", "delay", ")", "x", "=", "None", "try", ":", "x", "=", ...
[ 377, 4 ]
[ 403, 22 ]
python
en
['en', 'error', 'th']
False
EasyProcess.__enter__
(self)
used by the :keyword:`with` statement
used by the :keyword:`with` statement
def __enter__(self): '''used by the :keyword:`with` statement''' self.start() return self
[ "def", "__enter__", "(", "self", ")", ":", "self", ".", "start", "(", ")", "return", "self" ]
[ 405, 4 ]
[ 408, 19 ]
python
en
['en', 'en', 'en']
True
EasyProcess.__exit__
(self, *exc_info)
used by the :keyword:`with` statement
used by the :keyword:`with` statement
def __exit__(self, *exc_info): '''used by the :keyword:`with` statement''' self.stop()
[ "def", "__exit__", "(", "self", ",", "*", "exc_info", ")", ":", "self", ".", "stop", "(", ")" ]
[ 410, 4 ]
[ 412, 19 ]
python
en
['en', 'en', 'en']
True
get_tagname_or_hash
()
return tagname if exists else hash
return tagname if exists else hash
def get_tagname_or_hash(): """return tagname if exists else hash""" # get hash hash_cmd = ['git', 'rev-parse', '--short', 'HEAD'] hash_ = check_output(hash_cmd).decode('utf-8').strip() # get tagname tags_cmd = ['git', 'for-each-ref', '--points-at=HEAD', '--count=2', '--sort=-version:refname', '...
[ "def", "get_tagname_or_hash", "(", ")", ":", "# get hash", "hash_cmd", "=", "[", "'git'", ",", "'rev-parse'", ",", "'--short'", ",", "'HEAD'", "]", "hash_", "=", "check_output", "(", "hash_cmd", ")", ".", "decode", "(", "'utf-8'", ")", ".", "strip", "(", ...
[ 9, 0 ]
[ 23, 15 ]
python
en
['en', 'en', 'en']
True
SparkDFExecutionEngine.dataframe
(self)
If a batch has been loaded, returns a Spark Dataframe containing the data within the loaded batch
If a batch has been loaded, returns a Spark Dataframe containing the data within the loaded batch
def dataframe(self): """If a batch has been loaded, returns a Spark Dataframe containing the data within the loaded batch""" if not self.active_batch_data: raise ValueError( "Batch has not been loaded - please run load_batch() to load a batch." ) return s...
[ "def", "dataframe", "(", "self", ")", ":", "if", "not", "self", ".", "active_batch_data", ":", "raise", "ValueError", "(", "\"Batch has not been loaded - please run load_batch() to load a batch.\"", ")", "return", "self", ".", "active_batch_data", ".", "dataframe" ]
[ 180, 4 ]
[ 187, 47 ]
python
en
['en', 'en', 'en']
True
SparkDFExecutionEngine.guess_reader_method_from_path
(path)
Based on a given filepath, decides a reader method. Currently supports tsv, csv, and parquet. If none of these file extensions are used, returns BatchKwargsError stating that it is unable to determine the current path. Args: path - A given file path Returns: A dictionar...
Based on a given filepath, decides a reader method. Currently supports tsv, csv, and parquet. If none of these file extensions are used, returns BatchKwargsError stating that it is unable to determine the current path.
def guess_reader_method_from_path(path): """Based on a given filepath, decides a reader method. Currently supports tsv, csv, and parquet. If none of these file extensions are used, returns BatchKwargsError stating that it is unable to determine the current path. Args: path - A given...
[ "def", "guess_reader_method_from_path", "(", "path", ")", ":", "if", "path", ".", "endswith", "(", "\".csv\"", ")", "or", "path", ".", "endswith", "(", "\".tsv\"", ")", ":", "return", "\"csv\"", "elif", "path", ".", "endswith", "(", "\".parquet\"", ")", ":...
[ 265, 4 ]
[ 283, 9 ]
python
en
['en', 'en', 'en']
True
SparkDFExecutionEngine._get_reader_fn
(self, reader, reader_method=None, path=None)
Static helper for providing reader_fn Args: reader: the base spark reader to use; this should have had reader_options applied already reader_method: the name of the reader_method to use, if specified path (str): the path to use to guess reader_method if it was not specified ...
Static helper for providing reader_fn
def _get_reader_fn(self, reader, reader_method=None, path=None): """Static helper for providing reader_fn Args: reader: the base spark reader to use; this should have had reader_options applied already reader_method: the name of the reader_method to use, if specified ...
[ "def", "_get_reader_fn", "(", "self", ",", "reader", ",", "reader_method", "=", "None", ",", "path", "=", "None", ")", ":", "if", "reader_method", "is", "None", "and", "path", "is", "None", ":", "raise", "BatchKwargsError", "(", "\"Unable to determine spark re...
[ 285, 4 ]
[ 315, 13 ]
python
en
['en', 'no', 'en']
True
SparkDFExecutionEngine.get_compute_domain
( self, domain_kwargs: dict, domain_type: Union[str, MetricDomainTypes], accessor_keys: Optional[Iterable[str]] = None, )
Uses a given batch dictionary and domain kwargs (which include a row condition and a condition parser) to obtain and/or query a batch. Returns in the format of a Pandas Series if only a single column is desired, or otherwise a Data Frame. Args: domain_kwargs (dict) - A dictionary co...
Uses a given batch dictionary and domain kwargs (which include a row condition and a condition parser) to obtain and/or query a batch. Returns in the format of a Pandas Series if only a single column is desired, or otherwise a Data Frame.
def get_compute_domain( self, domain_kwargs: dict, domain_type: Union[str, MetricDomainTypes], accessor_keys: Optional[Iterable[str]] = None, ) -> Tuple["pyspark.sql.DataFrame", dict, dict]: """Uses a given batch dictionary and domain kwargs (which include a row condition and...
[ "def", "get_compute_domain", "(", "self", ",", "domain_kwargs", ":", "dict", ",", "domain_type", ":", "Union", "[", "str", ",", "MetricDomainTypes", "]", ",", "accessor_keys", ":", "Optional", "[", "Iterable", "[", "str", "]", "]", "=", "None", ",", ")", ...
[ 317, 4 ]
[ 471, 66 ]
python
en
['en', 'en', 'en']
True
SparkDFExecutionEngine.resolve_metric_bundle
( self, metric_fn_bundle: Iterable[Tuple[MetricConfiguration, Callable, dict]], )
For each metric name in the given metric_fn_bundle, finds the domain of the metric and calculates it using a metric function from the given provider class. Args: metric_fn_bundle - A batch containing MetricEdgeKeys and their corresponding functions metric...
For each metric name in the given metric_fn_bundle, finds the domain of the metric and calculates it using a metric function from the given provider class.
def resolve_metric_bundle( self, metric_fn_bundle: Iterable[Tuple[MetricConfiguration, Callable, dict]], ) -> dict: """For each metric name in the given metric_fn_bundle, finds the domain of the metric and calculates it using a metric function from the given provider class. ...
[ "def", "resolve_metric_bundle", "(", "self", ",", "metric_fn_bundle", ":", "Iterable", "[", "Tuple", "[", "MetricConfiguration", ",", "Callable", ",", "dict", "]", "]", ",", ")", "->", "dict", ":", "resolved_metrics", "=", "dict", "(", ")", "aggregates", ":"...
[ 512, 4 ]
[ 572, 31 ]
python
en
['en', 'en', 'en']
True
SparkDFExecutionEngine.head
(self, n=5)
Returns dataframe head. Default is 5
Returns dataframe head. Default is 5
def head(self, n=5): """Returns dataframe head. Default is 5""" return self.dataframe.limit(n).toPandas()
[ "def", "head", "(", "self", ",", "n", "=", "5", ")", ":", "return", "self", ".", "dataframe", ".", "limit", "(", "n", ")", ".", "toPandas", "(", ")" ]
[ 574, 4 ]
[ 576, 49 ]
python
en
['en', 'et', 'en']
True
SparkDFExecutionEngine._split_on_divided_integer
( df, column_name: str, divisor: int, batch_identifiers: dict )
Divide the values in the named column by `divisor`, and split on that
Divide the values in the named column by `divisor`, and split on that
def _split_on_divided_integer( df, column_name: str, divisor: int, batch_identifiers: dict ): """Divide the values in the named column by `divisor`, and split on that""" matching_divisor = batch_identifiers[column_name] res = ( df.withColumn( "div_temp", (...
[ "def", "_split_on_divided_integer", "(", "df", ",", "column_name", ":", "str", ",", "divisor", ":", "int", ",", "batch_identifiers", ":", "dict", ")", ":", "matching_divisor", "=", "batch_identifiers", "[", "column_name", "]", "res", "=", "(", "df", ".", "wi...
[ 606, 4 ]
[ 618, 18 ]
python
en
['en', 'en', 'en']
True
SparkDFExecutionEngine._split_on_mod_integer
(df, column_name: str, mod: int, batch_identifiers: dict)
Divide the values in the named column by `divisor`, and split on that
Divide the values in the named column by `divisor`, and split on that
def _split_on_mod_integer(df, column_name: str, mod: int, batch_identifiers: dict): """Divide the values in the named column by `divisor`, and split on that""" matching_mod_value = batch_identifiers[column_name] res = ( df.withColumn("mod_temp", (F.col(column_name) % mod).cast(Intege...
[ "def", "_split_on_mod_integer", "(", "df", ",", "column_name", ":", "str", ",", "mod", ":", "int", ",", "batch_identifiers", ":", "dict", ")", ":", "matching_mod_value", "=", "batch_identifiers", "[", "column_name", "]", "res", "=", "(", "df", ".", "withColu...
[ 621, 4 ]
[ 629, 18 ]
python
en
['en', 'en', 'en']
True
SparkDFExecutionEngine._split_on_multi_column_values
(df, column_names: list, batch_identifiers: dict)
Split on the joint values in the named columns
Split on the joint values in the named columns
def _split_on_multi_column_values(df, column_names: list, batch_identifiers: dict): """Split on the joint values in the named columns""" for column_name in column_names: value = batch_identifiers.get(column_name) if not value: raise ValueError( ...
[ "def", "_split_on_multi_column_values", "(", "df", ",", "column_names", ":", "list", ",", "batch_identifiers", ":", "dict", ")", ":", "for", "column_name", "in", "column_names", ":", "value", "=", "batch_identifiers", ".", "get", "(", "column_name", ")", "if", ...
[ 632, 4 ]
[ 643, 17 ]
python
en
['en', 'en', 'en']
True
SparkDFExecutionEngine._split_on_hashed_column
( df, column_name: str, hash_digits: int, batch_identifiers: dict, hash_function_name: str = "sha256", )
Split on the hashed value of the named column
Split on the hashed value of the named column
def _split_on_hashed_column( df, column_name: str, hash_digits: int, batch_identifiers: dict, hash_function_name: str = "sha256", ): """Split on the hashed value of the named column""" try: getattr(hashlib, hash_function_name) except (TypeE...
[ "def", "_split_on_hashed_column", "(", "df", ",", "column_name", ":", "str", ",", "hash_digits", ":", "int", ",", "batch_identifiers", ":", "dict", ",", "hash_function_name", ":", "str", "=", "\"sha256\"", ",", ")", ":", "try", ":", "getattr", "(", "hashlib"...
[ 646, 4 ]
[ 675, 18 ]
python
en
['en', 'en', 'en']
True
SparkDFExecutionEngine._sample_using_random
(df, p: float = 0.1, seed: int = 1)
Take a random sample of rows, retaining proportion p
Take a random sample of rows, retaining proportion p
def _sample_using_random(df, p: float = 0.1, seed: int = 1): """Take a random sample of rows, retaining proportion p""" res = ( df.withColumn("rand", F.rand(seed=seed)) .filter(F.col("rand") < p) .drop("rand") ) return res
[ "def", "_sample_using_random", "(", "df", ",", "p", ":", "float", "=", "0.1", ",", "seed", ":", "int", "=", "1", ")", ":", "res", "=", "(", "df", ".", "withColumn", "(", "\"rand\"", ",", "F", ".", "rand", "(", "seed", "=", "seed", ")", ")", "."...
[ 679, 4 ]
[ 686, 18 ]
python
en
['en', 'en', 'en']
True
SparkDFExecutionEngine._sample_using_mod
( df, column_name: str, mod: int, value: int, )
Take the mod of named column, and only keep rows that match the given value
Take the mod of named column, and only keep rows that match the given value
def _sample_using_mod( df, column_name: str, mod: int, value: int, ): """Take the mod of named column, and only keep rows that match the given value""" res = ( df.withColumn("mod_temp", (F.col(column_name) % mod).cast(IntegerType())) .filter(F....
[ "def", "_sample_using_mod", "(", "df", ",", "column_name", ":", "str", ",", "mod", ":", "int", ",", "value", ":", "int", ",", ")", ":", "res", "=", "(", "df", ".", "withColumn", "(", "\"mod_temp\"", ",", "(", "F", ".", "col", "(", "column_name", ")...
[ 689, 4 ]
[ 701, 18 ]
python
en
['en', 'en', 'en']
True
SparkDFExecutionEngine._sample_using_a_list
( df, column_name: str, value_list: list, )
Match the values in the named column against value_list, and only keep the matches
Match the values in the named column against value_list, and only keep the matches
def _sample_using_a_list( df, column_name: str, value_list: list, ): """Match the values in the named column against value_list, and only keep the matches""" return df.where(F.col(column_name).isin(value_list))
[ "def", "_sample_using_a_list", "(", "df", ",", "column_name", ":", "str", ",", "value_list", ":", "list", ",", ")", ":", "return", "df", ".", "where", "(", "F", ".", "col", "(", "column_name", ")", ".", "isin", "(", "value_list", ")", ")" ]
[ 704, 4 ]
[ 710, 60 ]
python
en
['en', 'en', 'en']
True
regex_opt_inner
(strings, open_paren)
Return a regex that matches any string in the sorted list of strings.
Return a regex that matches any string in the sorted list of strings.
def regex_opt_inner(strings, open_paren): """Return a regex that matches any string in the sorted list of strings.""" close_paren = open_paren and ')' or '' # print strings, repr(open_paren) if not strings: # print '-> nothing left' return '' first = strings[0] if len(strings) ==...
[ "def", "regex_opt_inner", "(", "strings", ",", "open_paren", ")", ":", "close_paren", "=", "open_paren", "and", "')'", "or", "''", "# print strings, repr(open_paren)", "if", "not", "strings", ":", "# print '-> nothing left'", "return", "''", "first", "=", "strings",...
[ 26, 0 ]
[ 79, 21 ]
python
en
['en', 'en', 'en']
True
regex_opt
(strings, prefix='', suffix='')
Return a compiled regex that matches any string in the given list. The strings to match must be literal strings, not regexes. They will be regex-escaped. *prefix* and *suffix* are pre- and appended to the final regex.
Return a compiled regex that matches any string in the given list.
def regex_opt(strings, prefix='', suffix=''): """Return a compiled regex that matches any string in the given list. The strings to match must be literal strings, not regexes. They will be regex-escaped. *prefix* and *suffix* are pre- and appended to the final regex. """ strings = sorted(strin...
[ "def", "regex_opt", "(", "strings", ",", "prefix", "=", "''", ",", "suffix", "=", "''", ")", ":", "strings", "=", "sorted", "(", "strings", ")", "return", "prefix", "+", "regex_opt_inner", "(", "strings", ",", "'('", ")", "+", "suffix" ]
[ 82, 0 ]
[ 91, 58 ]
python
en
['en', 'en', 'en']
True
datasource
(ctx)
Datasource operations
Datasource operations
def datasource(ctx): """Datasource operations""" directory: str = toolkit.parse_cli_config_file_location( config_file_location=ctx.obj.config_file_location ).get("directory") context: DataContext = toolkit.load_data_context_with_error_handling( directory=directory, from_cli_upgra...
[ "def", "datasource", "(", "ctx", ")", ":", "directory", ":", "str", "=", "toolkit", ".", "parse_cli_config_file_location", "(", "config_file_location", "=", "ctx", ".", "obj", ".", "config_file_location", ")", ".", "get", "(", "\"directory\"", ")", "context", ...
[ 45, 0 ]
[ 62, 57 ]
python
en
['en', 'en', 'en']
False
datasource_new
(ctx, name, jupyter)
Add a new Datasource to the data context.
Add a new Datasource to the data context.
def datasource_new(ctx, name, jupyter): """Add a new Datasource to the data context.""" context: DataContext = ctx.obj.data_context usage_event_end: str = ctx.obj.usage_event_end try: _datasource_new_flow( context, usage_event_end=usage_event_end, datasource_...
[ "def", "datasource_new", "(", "ctx", ",", "name", ",", "jupyter", ")", ":", "context", ":", "DataContext", "=", "ctx", ".", "obj", ".", "data_context", "usage_event_end", ":", "str", "=", "ctx", ".", "obj", ".", "usage_event_end", "try", ":", "_datasource_...
[ 74, 0 ]
[ 92, 14 ]
python
en
['en', 'en', 'en']
True
delete_datasource
(ctx, datasource)
Delete the datasource specified as an argument
Delete the datasource specified as an argument
def delete_datasource(ctx, datasource): """Delete the datasource specified as an argument""" context: DataContext = ctx.obj.data_context usage_event_end: str = ctx.obj.usage_event_end if not ctx.obj.assume_yes: toolkit.confirm_proceed_or_exit( confirm_prompt=f"""\nAre you sure you w...
[ "def", "delete_datasource", "(", "ctx", ",", "datasource", ")", ":", "context", ":", "DataContext", "=", "ctx", ".", "obj", ".", "data_context", "usage_event_end", ":", "str", "=", "ctx", ".", "obj", ".", "usage_event_end", "if", "not", "ctx", ".", "obj", ...
[ 98, 0 ]
[ 123, 19 ]
python
en
['en', 'en', 'en']
True
datasource_list
(ctx)
List known Datasources.
List known Datasources.
def datasource_list(ctx): """List known Datasources.""" context = ctx.obj.data_context usage_event_end: str = ctx.obj.usage_event_end try: datasources = context.list_datasources() cli_message(_build_datasource_intro_string(datasources)) for datasource in datasources: ...
[ "def", "datasource_list", "(", "ctx", ")", ":", "context", "=", "ctx", ".", "obj", ".", "data_context", "usage_event_end", ":", "str", "=", "ctx", ".", "obj", ".", "usage_event_end", "try", ":", "datasources", "=", "context", ".", "list_datasources", "(", ...
[ 128, 0 ]
[ 153, 14 ]
python
en
['en', 'en', 'en']
True
sanitize_yaml_and_save_datasource
( context: DataContext, datasource_yaml: str, overwrite_existing: bool = False )
A convenience function used in notebooks to help users save secrets.
A convenience function used in notebooks to help users save secrets.
def sanitize_yaml_and_save_datasource( context: DataContext, datasource_yaml: str, overwrite_existing: bool = False ) -> None: """A convenience function used in notebooks to help users save secrets.""" if not datasource_yaml: raise ValueError("Please verify the yaml and try again.") if not isins...
[ "def", "sanitize_yaml_and_save_datasource", "(", "context", ":", "DataContext", ",", "datasource_yaml", ":", "str", ",", "overwrite_existing", ":", "bool", "=", "False", ")", "->", "None", ":", "if", "not", "datasource_yaml", ":", "raise", "ValueError", "(", "\"...
[ 763, 0 ]
[ 787, 58 ]
python
en
['en', 'en', 'en']
True
check_if_datasource_name_exists
(context: DataContext, datasource_name: str)
Check if a Datasource name already exists in the on-disk version of the given DataContext and if so raise an error Args: context: DataContext to check for existing Datasource datasource_name: name of the proposed Datasource Returns: boolean True if datasource name exists in on-disk ...
Check if a Datasource name already exists in the on-disk version of the given DataContext and if so raise an error Args: context: DataContext to check for existing Datasource datasource_name: name of the proposed Datasource Returns: boolean True if datasource name exists in on-disk ...
def check_if_datasource_name_exists(context: DataContext, datasource_name: str) -> bool: """ Check if a Datasource name already exists in the on-disk version of the given DataContext and if so raise an error Args: context: DataContext to check for existing Datasource datasource_name: name of...
[ "def", "check_if_datasource_name_exists", "(", "context", ":", "DataContext", ",", "datasource_name", ":", "str", ")", "->", "bool", ":", "# TODO: 20210324 Anthony: Note reading the context from disk is a temporary fix to allow use in a notebook", "# after test_yaml_config(). test_yam...
[ 804, 0 ]
[ 819, 85 ]
python
en
['en', 'error', 'th']
False
BaseDatasourceNewYamlHelper.verify_libraries_installed
(self)
Used in the interactive CLI to help users install dependencies.
Used in the interactive CLI to help users install dependencies.
def verify_libraries_installed(self) -> bool: """Used in the interactive CLI to help users install dependencies.""" raise NotImplementedError
[ "def", "verify_libraries_installed", "(", "self", ")", "->", "bool", ":", "raise", "NotImplementedError" ]
[ 229, 4 ]
[ 231, 33 ]
python
en
['en', 'en', 'en']
True
BaseDatasourceNewYamlHelper.create_notebook
(self, context: DataContext)
Create a datasource_new notebook and save it to disk.
Create a datasource_new notebook and save it to disk.
def create_notebook(self, context: DataContext) -> str: """Create a datasource_new notebook and save it to disk.""" renderer = self.get_notebook_renderer(context) notebook_path = os.path.join( context.root_directory, context.GE_UNCOMMITTED_DIR, "datasource_new...
[ "def", "create_notebook", "(", "self", ",", "context", ":", "DataContext", ")", "->", "str", ":", "renderer", "=", "self", ".", "get_notebook_renderer", "(", "context", ")", "notebook_path", "=", "os", ".", "path", ".", "join", "(", "context", ".", "root_d...
[ 233, 4 ]
[ 242, 28 ]
python
en
['en', 'en', 'en']
True
BaseDatasourceNewYamlHelper.get_notebook_renderer
(self, context)
Get a renderer specifically constructed for the datasource type.
Get a renderer specifically constructed for the datasource type.
def get_notebook_renderer(self, context) -> DatasourceNewNotebookRenderer: """Get a renderer specifically constructed for the datasource type.""" raise NotImplementedError
[ "def", "get_notebook_renderer", "(", "self", ",", "context", ")", "->", "DatasourceNewNotebookRenderer", ":", "raise", "NotImplementedError" ]
[ 244, 4 ]
[ 246, 33 ]
python
en
['en', 'en', 'en']
True
BaseDatasourceNewYamlHelper.prompt
(self)
Optional prompt if more information is needed before making a notebook.
Optional prompt if more information is needed before making a notebook.
def prompt(self) -> None: """Optional prompt if more information is needed before making a notebook.""" pass
[ "def", "prompt", "(", "self", ")", "->", "None", ":", "pass" ]
[ 259, 4 ]
[ 261, 12 ]
python
en
['en', 'en', 'en']
True
BaseDatasourceNewYamlHelper.yaml_snippet
(self)
Override to create the yaml for the notebook.
Override to create the yaml for the notebook.
def yaml_snippet(self) -> str: """Override to create the yaml for the notebook.""" raise NotImplementedError
[ "def", "yaml_snippet", "(", "self", ")", "->", "str", ":", "raise", "NotImplementedError" ]
[ 263, 4 ]
[ 265, 33 ]
python
en
['en', 'en', 'en']
True
FilesYamlHelper.yaml_snippet
(self)
Note the InferredAssetFilesystemDataConnector was selected to get users to data assets with minimal configuration. Other DataConnectors are available.
Note the InferredAssetFilesystemDataConnector was selected to get users to data assets with minimal configuration. Other DataConnectors are available.
def yaml_snippet(self) -> str: """ Note the InferredAssetFilesystemDataConnector was selected to get users to data assets with minimal configuration. Other DataConnectors are available. """ return f'''f""" name: {{datasource_name}} class_name: Datasource execution_engine:...
[ "def", "yaml_snippet", "(", "self", ")", "->", "str", ":", "return", "f'''f\"\"\"\nname: {{datasource_name}}\nclass_name: Datasource\nexecution_engine:\n class_name: {self.class_name}\ndata_connectors:\n default_inferred_data_connector_name:\n class_name: InferredAssetFilesystemDataConnector\...
[ 292, 4 ]
[ 315, 6 ]
python
en
['en', 'error', 'th']
False
SQLCredentialYamlHelper._yaml_innards
(self)
Override if needed.
Override if needed.
def _yaml_innards(self) -> str: """Override if needed.""" return """ credentials: host: {host} port: '{port}' username: {username} password: {password} database: {database}"""
[ "def", "_yaml_innards", "(", "self", ")", "->", "str", ":", "return", "\"\"\"\n credentials:\n host: {host}\n port: '{port}'\n username: {username}\n password: {password}\n database: {database}\"\"\"" ]
[ 426, 4 ]
[ 434, 27 ]
python
en
['en', 'nl', 'en']
True
check_one_way_stream
(stream_maker, clogged_stream_maker)
Perform a number of generic tests on a custom one-way stream implementation. Args: stream_maker: An async (!) function which returns a connected (:class:`~trio.abc.SendStream`, :class:`~trio.abc.ReceiveStream`) pair. clogged_stream_maker: Either None, or an async function simila...
Perform a number of generic tests on a custom one-way stream implementation.
async def check_one_way_stream(stream_maker, clogged_stream_maker): """Perform a number of generic tests on a custom one-way stream implementation. Args: stream_maker: An async (!) function which returns a connected (:class:`~trio.abc.SendStream`, :class:`~trio.abc.ReceiveStream`) ...
[ "async", "def", "check_one_way_stream", "(", "stream_maker", ",", "clogged_stream_maker", ")", ":", "async", "with", "_ForceCloseBoth", "(", "await", "stream_maker", "(", ")", ")", "as", "(", "s", ",", "r", ")", ":", "assert", "isinstance", "(", "s", ",", ...
[ 36, 0 ]
[ 374, 59 ]
python
en
['en', 'en', 'en']
True
check_two_way_stream
(stream_maker, clogged_stream_maker)
Perform a number of generic tests on a custom two-way stream implementation. This is similar to :func:`check_one_way_stream`, except that the maker functions are expected to return objects implementing the :class:`~trio.abc.Stream` interface. This function tests a *superset* of what :func:`check_o...
Perform a number of generic tests on a custom two-way stream implementation.
async def check_two_way_stream(stream_maker, clogged_stream_maker): """Perform a number of generic tests on a custom two-way stream implementation. This is similar to :func:`check_one_way_stream`, except that the maker functions are expected to return objects implementing the :class:`~trio.abc.Stre...
[ "async", "def", "check_two_way_stream", "(", "stream_maker", ",", "clogged_stream_maker", ")", ":", "await", "check_one_way_stream", "(", "stream_maker", ",", "clogged_stream_maker", ")", "async", "def", "flipped_stream_maker", "(", ")", ":", "return", "reversed", "("...
[ 377, 0 ]
[ 445, 41 ]
python
en
['en', 'en', 'en']
True
check_half_closeable_stream
(stream_maker, clogged_stream_maker)
Perform a number of generic tests on a custom half-closeable stream implementation. This is similar to :func:`check_two_way_stream`, except that the maker functions are expected to return objects that implement the :class:`~trio.abc.HalfCloseableStream` interface. This function tests a *superset* ...
Perform a number of generic tests on a custom half-closeable stream implementation.
async def check_half_closeable_stream(stream_maker, clogged_stream_maker): """Perform a number of generic tests on a custom half-closeable stream implementation. This is similar to :func:`check_two_way_stream`, except that the maker functions are expected to return objects that implement the :class...
[ "async", "def", "check_half_closeable_stream", "(", "stream_maker", ",", "clogged_stream_maker", ")", ":", "await", "check_two_way_stream", "(", "stream_maker", ",", "clogged_stream_maker", ")", "async", "with", "_ForceCloseBoth", "(", "await", "stream_maker", "(", ")",...
[ 448, 0 ]
[ 510, 51 ]
python
en
['en', 'en', 'en']
True
free_calldef_t._get__cmp__call_items
(self)
implementation details
implementation details
def _get__cmp__call_items(self): """implementation details""" return []
[ "def", "_get__cmp__call_items", "(", "self", ")", ":", "return", "[", "]" ]
[ 43, 4 ]
[ 45, 17 ]
python
da
['eo', 'da', 'en']
False
free_calldef_t.function_type
(self)
returns function type. See :class:`type_t` hierarchy
returns function type. See :class:`type_t` hierarchy
def function_type(self): """returns function type. See :class:`type_t` hierarchy""" return cpptypes.free_function_type_t( return_type=self.return_type, arguments_types=[ arg.decl_type for arg in self.arguments])
[ "def", "function_type", "(", "self", ")", ":", "return", "cpptypes", ".", "free_function_type_t", "(", "return_type", "=", "self", ".", "return_type", ",", "arguments_types", "=", "[", "arg", ".", "decl_type", "for", "arg", "in", "self", ".", "arguments", "]...
[ 47, 4 ]
[ 52, 57 ]
python
en
['en', 'en', 'en']
True
free_calldef_t.guess_calling_convention
(self)
This function should be overriden in the derived classes and return more-or-less successfull guess about calling convention
This function should be overriden in the derived classes and return more-or-less successfull guess about calling convention
def guess_calling_convention(self): """This function should be overriden in the derived classes and return more-or-less successfull guess about calling convention""" return calldef_types.CALLING_CONVENTION_TYPES.UNKNOWN
[ "def", "guess_calling_convention", "(", "self", ")", ":", "return", "calldef_types", ".", "CALLING_CONVENTION_TYPES", ".", "UNKNOWN" ]
[ 61, 4 ]
[ 64, 61 ]
python
en
['en', 'en', 'en']
True
free_operator_t.class_types
(self)
list of class/class declaration types, extracted from the operator arguments
list of class/class declaration types, extracted from the operator arguments
def class_types(self): """list of class/class declaration types, extracted from the operator arguments""" if None is self.__class_types: self.__class_types = [] for type_ in self.argument_types: decl = None type_ = type_traits.remove_refer...
[ "def", "class_types", "(", "self", ")", ":", "if", "None", "is", "self", ".", "__class_types", ":", "self", ".", "__class_types", "=", "[", "]", "for", "type_", "in", "self", ".", "argument_types", ":", "decl", "=", "None", "type_", "=", "type_traits", ...
[ 94, 4 ]
[ 113, 33 ]
python
en
['en', 'en', 'en']
True
test_profiler_init_no_config
( cardinality_dataset, )
What does this test do and why? Confirms that profiler can initialize with no config.
What does this test do and why? Confirms that profiler can initialize with no config.
def test_profiler_init_no_config( cardinality_dataset, ): """ What does this test do and why? Confirms that profiler can initialize with no config. """ profiler = UserConfigurableProfiler(cardinality_dataset) assert profiler.primary_or_compound_key == [] assert profiler.ignored_columns =...
[ "def", "test_profiler_init_no_config", "(", "cardinality_dataset", ",", ")", ":", "profiler", "=", "UserConfigurableProfiler", "(", "cardinality_dataset", ")", "assert", "profiler", ".", "primary_or_compound_key", "==", "[", "]", "assert", "profiler", ".", "ignored_colu...
[ 77, 0 ]
[ 89, 47 ]
python
en
['en', 'error', 'th']
False
test_profiler_init_full_config_no_semantic_types
(cardinality_dataset)
What does this test do and why? Confirms that profiler initializes properly with a full config, without a semantic_types dict
What does this test do and why? Confirms that profiler initializes properly with a full config, without a semantic_types dict
def test_profiler_init_full_config_no_semantic_types(cardinality_dataset): """ What does this test do and why? Confirms that profiler initializes properly with a full config, without a semantic_types dict """ profiler = UserConfigurableProfiler( cardinality_dataset, primary_or_compo...
[ "def", "test_profiler_init_full_config_no_semantic_types", "(", "cardinality_dataset", ")", ":", "profiler", "=", "UserConfigurableProfiler", "(", "cardinality_dataset", ",", "primary_or_compound_key", "=", "[", "\"col_unique\"", "]", ",", "ignored_columns", "=", "[", "\"co...
[ 92, 0 ]
[ 114, 48 ]
python
en
['en', 'error', 'th']
False
test_init_with_semantic_types
(cardinality_dataset)
What does this test do and why? Confirms that profiler initializes properly with a full config and a semantic_types dict
What does this test do and why? Confirms that profiler initializes properly with a full config and a semantic_types dict
def test_init_with_semantic_types(cardinality_dataset): """ What does this test do and why? Confirms that profiler initializes properly with a full config and a semantic_types dict """ semantic_types = { "numeric": ["col_few", "col_many", "col_very_many"], "value_set": ["col_two", "...
[ "def", "test_init_with_semantic_types", "(", "cardinality_dataset", ")", ":", "semantic_types", "=", "{", "\"numeric\"", ":", "[", "\"col_few\"", ",", "\"col_many\"", ",", "\"col_very_many\"", "]", ",", "\"value_set\"", ":", "[", "\"col_two\"", ",", "\"col_very_few\""...
[ 117, 0 ]
[ 173, 5 ]
python
en
['en', 'error', 'th']
False
test__validate_config
(cardinality_dataset)
What does this test do and why? Tests the validate config function on the profiler
What does this test do and why? Tests the validate config function on the profiler
def test__validate_config(cardinality_dataset): """ What does this test do and why? Tests the validate config function on the profiler """ with pytest.raises(AssertionError) as e: UserConfigurableProfiler(cardinality_dataset, ignored_columns="col_name") assert e.typename == "AssertionEr...
[ "def", "test__validate_config", "(", "cardinality_dataset", ")", ":", "with", "pytest", ".", "raises", "(", "AssertionError", ")", "as", "e", ":", "UserConfigurableProfiler", "(", "cardinality_dataset", ",", "ignored_columns", "=", "\"col_name\"", ")", "assert", "e"...
[ 176, 0 ]
[ 188, 41 ]
python
en
['en', 'error', 'th']
False
test_value_set_threshold
(cardinality_dataset)
What does this test do and why? Tests the value_set_threshold logic on the profiler works as expected.
What does this test do and why? Tests the value_set_threshold logic on the profiler works as expected.
def test_value_set_threshold(cardinality_dataset): """ What does this test do and why? Tests the value_set_threshold logic on the profiler works as expected. """ # Test that when value_set_threshold is unset, it will default to "MANY" profiler = UserConfigurableProfiler(cardinality_dataset) ...
[ "def", "test_value_set_threshold", "(", "cardinality_dataset", ")", ":", "# Test that when value_set_threshold is unset, it will default to \"MANY\"", "profiler", "=", "UserConfigurableProfiler", "(", "cardinality_dataset", ")", "assert", "profiler", ".", "value_set_threshold", "==...
[ 191, 0 ]
[ 216, 5 ]
python
en
['en', 'error', 'th']
False
test__validate_semantic_types_dict
(cardinality_dataset)
What does this test do and why? Tests that _validate_semantic_types_dict function errors when not formatted correctly
What does this test do and why? Tests that _validate_semantic_types_dict function errors when not formatted correctly
def test__validate_semantic_types_dict(cardinality_dataset): """ What does this test do and why? Tests that _validate_semantic_types_dict function errors when not formatted correctly """ bad_semantic_types_dict_type = {"value_set": "col_few"} with pytest.raises(AssertionError) as e: Use...
[ "def", "test__validate_semantic_types_dict", "(", "cardinality_dataset", ")", ":", "bad_semantic_types_dict_type", "=", "{", "\"value_set\"", ":", "\"col_few\"", "}", "with", "pytest", ".", "raises", "(", "AssertionError", ")", "as", "e", ":", "UserConfigurableProfiler"...
[ 219, 0 ]
[ 256, 5 ]
python
en
['en', 'error', 'th']
False
test_build_suite_no_config
(titanic_dataset, possible_expectations_set)
What does this test do and why? Tests that the build_suite function works as expected with no config
What does this test do and why? Tests that the build_suite function works as expected with no config
def test_build_suite_no_config(titanic_dataset, possible_expectations_set): """ What does this test do and why? Tests that the build_suite function works as expected with no config """ profiler = UserConfigurableProfiler(titanic_dataset) suite = profiler.build_suite() expectations_from_suite...
[ "def", "test_build_suite_no_config", "(", "titanic_dataset", ",", "possible_expectations_set", ")", ":", "profiler", "=", "UserConfigurableProfiler", "(", "titanic_dataset", ")", "suite", "=", "profiler", ".", "build_suite", "(", ")", "expectations_from_suite", "=", "{"...
[ 259, 0 ]
[ 269, 40 ]
python
en
['en', 'error', 'th']
False
test_build_suite_with_config_and_no_semantic_types_dict
( titanic_dataset, possible_expectations_set )
What does this test do and why? Tests that the build_suite function works as expected with a config and without a semantic_types dict
What does this test do and why? Tests that the build_suite function works as expected with a config and without a semantic_types dict
def test_build_suite_with_config_and_no_semantic_types_dict( titanic_dataset, possible_expectations_set ): """ What does this test do and why? Tests that the build_suite function works as expected with a config and without a semantic_types dict """ profiler = UserConfigurableProfiler( ti...
[ "def", "test_build_suite_with_config_and_no_semantic_types_dict", "(", "titanic_dataset", ",", "possible_expectations_set", ")", ":", "profiler", "=", "UserConfigurableProfiler", "(", "titanic_dataset", ",", "ignored_columns", "=", "[", "\"Survived\"", ",", "\"Unnamed: 0\"", ...
[ 272, 0 ]
[ 297, 40 ]
python
en
['en', 'error', 'th']
False
test_build_suite_with_semantic_types_dict
( cardinality_dataset, possible_expectations_set, )
What does this test do and why? Tests that the build_suite function works as expected with a semantic_types dict
What does this test do and why? Tests that the build_suite function works as expected with a semantic_types dict
def test_build_suite_with_semantic_types_dict( cardinality_dataset, possible_expectations_set, ): """ What does this test do and why? Tests that the build_suite function works as expected with a semantic_types dict """ semantic_types = { "numeric": ["col_few", "col_many", "col_very_...
[ "def", "test_build_suite_with_semantic_types_dict", "(", "cardinality_dataset", ",", "possible_expectations_set", ",", ")", ":", "semantic_types", "=", "{", "\"numeric\"", ":", "[", "\"col_few\"", ",", "\"col_many\"", ",", "\"col_very_many\"", "]", ",", "\"value_set\"", ...
[ 300, 0 ]
[ 342, 59 ]
python
en
['en', 'error', 'th']
False
test_build_suite_when_suite_already_exists
(cardinality_dataset)
What does this test do and why? Confirms that creating a new suite on an existing profiler wipes the previous suite
What does this test do and why? Confirms that creating a new suite on an existing profiler wipes the previous suite
def test_build_suite_when_suite_already_exists(cardinality_dataset): """ What does this test do and why? Confirms that creating a new suite on an existing profiler wipes the previous suite """ profiler = UserConfigurableProfiler( cardinality_dataset, table_expectations_only=True, ...
[ "def", "test_build_suite_when_suite_already_exists", "(", "cardinality_dataset", ")", ":", "profiler", "=", "UserConfigurableProfiler", "(", "cardinality_dataset", ",", "table_expectations_only", "=", "True", ",", "excluded_expectations", "=", "[", "\"expect_table_row_count_to_...
[ 345, 0 ]
[ 365, 65 ]
python
en
['en', 'error', 'th']
False
test_primary_or_compound_key_not_found_in_columns
(cardinality_dataset)
What does this test do and why? Confirms that an error is raised if a primary_or_compound key is specified with a column not found in the dataset
What does this test do and why? Confirms that an error is raised if a primary_or_compound key is specified with a column not found in the dataset
def test_primary_or_compound_key_not_found_in_columns(cardinality_dataset): """ What does this test do and why? Confirms that an error is raised if a primary_or_compound key is specified with a column not found in the dataset """ # regular case, should pass working_profiler = UserConfigurablePro...
[ "def", "test_primary_or_compound_key_not_found_in_columns", "(", "cardinality_dataset", ")", ":", "# regular case, should pass", "working_profiler", "=", "UserConfigurableProfiler", "(", "cardinality_dataset", ",", "primary_or_compound_key", "=", "[", "\"col_unique\"", "]", ")", ...
[ 368, 0 ]
[ 396, 87 ]
python
en
['en', 'error', 'th']
False
test_config_with_not_null_only
(nulls_dataset, possible_expectations_set)
What does this test do and why? Confirms that the not_null_only key in config works as expected.
What does this test do and why? Confirms that the not_null_only key in config works as expected.
def test_config_with_not_null_only(nulls_dataset, possible_expectations_set): """ What does this test do and why? Confirms that the not_null_only key in config works as expected. """ excluded_expectations = [i for i in possible_expectations_set if "null" not in i] batch_df = nulls_dataset ...
[ "def", "test_config_with_not_null_only", "(", "nulls_dataset", ",", "possible_expectations_set", ")", ":", "excluded_expectations", "=", "[", "i", "for", "i", "in", "possible_expectations_set", "if", "\"null\"", "not", "in", "i", "]", "batch_df", "=", "nulls_dataset",...
[ 399, 0 ]
[ 433, 60 ]
python
en
['en', 'error', 'th']
False
test_profiled_dataset_passes_own_validation
( cardinality_dataset, titanic_data_context )
What does this test do and why? Confirms that a suite created on a dataset with no config will pass when validated against itself
What does this test do and why? Confirms that a suite created on a dataset with no config will pass when validated against itself
def test_profiled_dataset_passes_own_validation( cardinality_dataset, titanic_data_context ): """ What does this test do and why? Confirms that a suite created on a dataset with no config will pass when validated against itself """ context = titanic_data_context profiler = UserConfigurablePr...
[ "def", "test_profiled_dataset_passes_own_validation", "(", "cardinality_dataset", ",", "titanic_data_context", ")", ":", "context", "=", "titanic_data_context", "profiler", "=", "UserConfigurableProfiler", "(", "cardinality_dataset", ",", "ignored_columns", "=", "[", "\"col_n...
[ 452, 0 ]
[ 470, 29 ]
python
en
['en', 'error', 'th']
False
test_profiler_all_expectation_types
( titanic_data_context, possible_expectations_set )
What does this test do and why? Ensures that all available expectation types work as expected
What does this test do and why? Ensures that all available expectation types work as expected
def test_profiler_all_expectation_types( titanic_data_context, possible_expectations_set ): """ What does this test do and why? Ensures that all available expectation types work as expected """ context = titanic_data_context df = ge.read_csv( file_relative_path( __file__,...
[ "def", "test_profiler_all_expectation_types", "(", "titanic_data_context", ",", "possible_expectations_set", ")", ":", "context", "=", "titanic_data_context", "df", "=", "ge", ".", "read_csv", "(", "file_relative_path", "(", "__file__", ",", "\"../test_sets/taxi_yellow_trip...
[ 473, 0 ]
[ 551, 29 ]
python
en
['en', 'error', 'th']
False
regression_errors
(y, y_hat, smoothing_window=0.01, smooth=True)
Compute an array of absolute errors comparing predictions and expected output. If smooth is True, apply EWMA to the resulting array of errors. Args: y (ndarray): Ground truth. y_hat (ndarray): Predicted values. smoothing_window (float): Optional. Siz...
Compute an array of absolute errors comparing predictions and expected output.
def regression_errors(y, y_hat, smoothing_window=0.01, smooth=True): """Compute an array of absolute errors comparing predictions and expected output. If smooth is True, apply EWMA to the resulting array of errors. Args: y (ndarray): Ground truth. y_hat (ndarray): P...
[ "def", "regression_errors", "(", "y", ",", "y_hat", ",", "smoothing_window", "=", "0.01", ",", "smooth", "=", "True", ")", ":", "errors", "=", "np", ".", "abs", "(", "y", "-", "y_hat", ")", "[", ":", ",", "0", "]", "if", "not", "smooth", ":", "re...
[ 12, 0 ]
[ 40, 69 ]
python
en
['en', 'en', 'en']
True
_point_wise_error
(y, y_hat)
Compute point-wise error between predicted and expected values. The computed error is calculated as the difference between predicted and expected values with a rolling smoothing factor. Args: y (ndarray): Ground truth. y_hat (ndarray): Predicted values. Returns...
Compute point-wise error between predicted and expected values.
def _point_wise_error(y, y_hat): """Compute point-wise error between predicted and expected values. The computed error is calculated as the difference between predicted and expected values with a rolling smoothing factor. Args: y (ndarray): Ground truth. y_hat (ndarray): ...
[ "def", "_point_wise_error", "(", "y", ",", "y_hat", ")", ":", "return", "abs", "(", "y", "-", "y_hat", ")" ]
[ 43, 0 ]
[ 59, 25 ]
python
en
['en', 'en', 'en']
True
_area_error
(y, y_hat, score_window=10)
Compute area error between predicted and expected values. The computed error is calculated as the area difference between predicted and expected values with a smoothing factor. Args: y (ndarray): Ground truth. y_hat (ndarray): Predicted values. score_window ...
Compute area error between predicted and expected values.
def _area_error(y, y_hat, score_window=10): """Compute area error between predicted and expected values. The computed error is calculated as the area difference between predicted and expected values with a smoothing factor. Args: y (ndarray): Ground truth. y_hat (ndarray): ...
[ "def", "_area_error", "(", "y", ",", "y_hat", ",", "score_window", "=", "10", ")", ":", "smooth_y", "=", "pd", ".", "Series", "(", "y", ")", ".", "rolling", "(", "score_window", ",", "center", "=", "True", ",", "min_periods", "=", "score_window", "//",...
[ 62, 0 ]
[ 88, 17 ]
python
en
['en', 'en', 'en']
True
_dtw_error
(y, y_hat, score_window=10)
Compute dtw error between predicted and expected values. The computed error is calculated as the dynamic time warping distance between predicted and expected values with a smoothing factor. Args: y (ndarray): Ground truth. y_hat (ndarray): Predicted values. ...
Compute dtw error between predicted and expected values.
def _dtw_error(y, y_hat, score_window=10): """Compute dtw error between predicted and expected values. The computed error is calculated as the dynamic time warping distance between predicted and expected values with a smoothing factor. Args: y (ndarray): Ground truth. y_hat...
[ "def", "_dtw_error", "(", "y", ",", "y_hat", ",", "score_window", "=", "10", ")", ":", "length_dtw", "=", "(", "score_window", "//", "2", ")", "*", "2", "+", "1", "half_length_dtw", "=", "length_dtw", "//", "2", "# add padding", "y_pad", "=", "np", "."...
[ 91, 0 ]
[ 135, 17 ]
python
en
['en', 'en', 'en']
True
reconstruction_errors
(y, y_hat, step_size=1, score_window=10, smoothing_window=0.01, smooth=True, rec_error_type='point')
Compute an array of reconstruction errors. Compute the discrepancies between the expected and the predicted values according to the reconstruction error type. Args: y (ndarray): Ground truth. y_hat (ndarray): Predicted values. Each timestamp has multiple predictions...
Compute an array of reconstruction errors.
def reconstruction_errors(y, y_hat, step_size=1, score_window=10, smoothing_window=0.01, smooth=True, rec_error_type='point'): """Compute an array of reconstruction errors. Compute the discrepancies between the expected and the predicted values according to the reconstruction erro...
[ "def", "reconstruction_errors", "(", "y", ",", "y_hat", ",", "step_size", "=", "1", ",", "score_window", "=", "10", ",", "smoothing_window", "=", "0.01", ",", "smooth", "=", "True", ",", "rec_error_type", "=", "'point'", ")", ":", "if", "isinstance", "(", ...
[ 138, 0 ]
[ 217, 33 ]
python
en
['en', 'en', 'en']
True
mpjpe
(predicted, target)
Mean per-joint position error (i.e. mean Euclidean distance), often referred to as "Protocol #1" in many papers.
Mean per-joint position error (i.e. mean Euclidean distance), often referred to as "Protocol #1" in many papers.
def mpjpe(predicted, target): """ Mean per-joint position error (i.e. mean Euclidean distance), often referred to as "Protocol #1" in many papers. """ assert predicted.shape == target.shape #l2_error = torch.mean(torch.norm((predicted - target), dim=len(target.shape) - 1), -1).squeeze() #pri...
[ "def", "mpjpe", "(", "predicted", ",", "target", ")", ":", "assert", "predicted", ".", "shape", "==", "target", ".", "shape", "#l2_error = torch.mean(torch.norm((predicted - target), dim=len(target.shape) - 1), -1).squeeze()", "#print('each joint error:', torch.norm((predicted - ta...
[ 13, 0 ]
[ 24, 82 ]
python
en
['en', 'error', 'th']
False
mpjae
(predicted, target)
Mean per-joint angle error (3d bone vector angle error between gt and predicted one)
Mean per-joint angle error (3d bone vector angle error between gt and predicted one)
def mpjae(predicted, target): """ Mean per-joint angle error (3d bone vector angle error between gt and predicted one) """ assert predicted.shape == target.shape # [B,T, K] joint_error = torch.mean(torch.abs(predicted - target).cuda(), dim=0) # Calculate each joint angle print('each bone angle...
[ "def", "mpjae", "(", "predicted", ",", "target", ")", ":", "assert", "predicted", ".", "shape", "==", "target", ".", "shape", "# [B,T, K]", "joint_error", "=", "torch", ".", "mean", "(", "torch", ".", "abs", "(", "predicted", "-", "target", ")", ".", "...
[ 27, 0 ]
[ 34, 34 ]
python
en
['en', 'error', 'th']
False
mpjpe_smooth
(predicted, target, threshold, mi, L1)
Referred in triangulation 3d pose paper
Referred in triangulation 3d pose paper
def mpjpe_smooth(predicted, target, threshold, mi, L1): """ Referred in triangulation 3d pose paper """ assert predicted.shape == target.shape if L1: diff_norm = torch.abs((predicted - target), dim=len(target.shape) - 1) diff = diff_norm.clone() else: # MSE diff = (predi...
[ "def", "mpjpe_smooth", "(", "predicted", ",", "target", ",", "threshold", ",", "mi", ",", "L1", ")", ":", "assert", "predicted", ".", "shape", "==", "target", ".", "shape", "if", "L1", ":", "diff_norm", "=", "torch", ".", "abs", "(", "(", "predicted", ...
[ 40, 0 ]
[ 52, 15 ]
python
en
['en', 'error', 'th']
False
p_mpjpe
(predicted, target)
Pose error: MPJPE after rigid alignment (scale, rotation, and translation), often referred to as "Protocol #2" in many papers.
Pose error: MPJPE after rigid alignment (scale, rotation, and translation), often referred to as "Protocol #2" in many papers.
def p_mpjpe(predicted, target): """ Pose error: MPJPE after rigid alignment (scale, rotation, and translation), often referred to as "Protocol #2" in many papers. """ assert predicted.shape == target.shape # (3071, 17, 3) muX = np.mean(target, axis=1, keepdims=True) muY = np.mean(predicted,...
[ "def", "p_mpjpe", "(", "predicted", ",", "target", ")", ":", "assert", "predicted", ".", "shape", "==", "target", ".", "shape", "# (3071, 17, 3)", "muX", "=", "np", ".", "mean", "(", "target", ",", "axis", "=", "1", ",", "keepdims", "=", "True", ")", ...
[ 185, 0 ]
[ 231, 73 ]
python
en
['en', 'error', 'th']
False
n_mpjpe
(predicted, target)
Normalized MPJPE (scale only), adapted from: https://github.com/hrhodin/UnsupervisedGeometryAwareRepresentationLearning/blob/master/losses/poses.py
Normalized MPJPE (scale only), adapted from: https://github.com/hrhodin/UnsupervisedGeometryAwareRepresentationLearning/blob/master/losses/poses.py
def n_mpjpe(predicted, target): """ Normalized MPJPE (scale only), adapted from: https://github.com/hrhodin/UnsupervisedGeometryAwareRepresentationLearning/blob/master/losses/poses.py """ assert predicted.shape == target.shape # [1, 1703, 17, 3] norm_predicted = torch.mean(torch.sum(predicted *...
[ "def", "n_mpjpe", "(", "predicted", ",", "target", ")", ":", "assert", "predicted", ".", "shape", "==", "target", ".", "shape", "# [1, 1703, 17, 3]", "norm_predicted", "=", "torch", ".", "mean", "(", "torch", ".", "sum", "(", "predicted", "**", "2", ",", ...
[ 234, 0 ]
[ 244, 14 ]
python
en
['en', 'error', 'th']
False
mean_velocity_error
(predicted, target)
Mean per-joint velocity error (i.e. mean Euclidean distance of the 1st derivative)
Mean per-joint velocity error (i.e. mean Euclidean distance of the 1st derivative)
def mean_velocity_error(predicted, target): """ Mean per-joint velocity error (i.e. mean Euclidean distance of the 1st derivative) """ assert predicted.shape == target.shape velocity_predicted = np.diff(predicted, axis=0) velocity_target = np.diff(target, axis=0) return np.mean(np.linalg.nor...
[ "def", "mean_velocity_error", "(", "predicted", ",", "target", ")", ":", "assert", "predicted", ".", "shape", "==", "target", ".", "shape", "velocity_predicted", "=", "np", ".", "diff", "(", "predicted", ",", "axis", "=", "0", ")", "velocity_target", "=", ...
[ 247, 0 ]
[ 254, 100 ]
python
en
['en', 'error', 'th']
False
WindowGenerator.example
(self)
Get and cache an example batch of `inputs, labels` for plotting.
Get and cache an example batch of `inputs, labels` for plotting.
def example(self): """Get and cache an example batch of `inputs, labels` for plotting.""" result = getattr(self, '_example', None) if result is None: # No example batch was found, so get one from the `.train` dataset result = next(iter(self.train)) # And cache...
[ "def", "example", "(", "self", ")", ":", "result", "=", "getattr", "(", "self", ",", "'_example'", ",", "None", ")", "if", "result", "is", "None", ":", "# No example batch was found, so get one from the `.train` dataset", "result", "=", "next", "(", "iter", "(",...
[ 142, 4 ]
[ 150, 21 ]
python
en
['en', 'en', 'en']
True
datasource
()
Datasource operations
Datasource operations
def datasource(): """Datasource operations""" pass
[ "def", "datasource", "(", ")", ":", "pass" ]
[ 74, 0 ]
[ 76, 8 ]
python
en
['en', 'en', 'en']
False
datasource_new
(directory)
Add a new datasource to the data context.
Add a new datasource to the data context.
def datasource_new(directory): """Add a new datasource to the data context.""" context = toolkit.load_data_context_with_error_handling(directory) datasource_name, data_source_type = add_datasource(context) if datasource_name: cli_message( "A new datasource '{}' was added to your pro...
[ "def", "datasource_new", "(", "directory", ")", ":", "context", "=", "toolkit", ".", "load_data_context_with_error_handling", "(", "directory", ")", "datasource_name", ",", "data_source_type", "=", "add_datasource", "(", "context", ")", "if", "datasource_name", ":", ...
[ 86, 0 ]
[ 102, 19 ]
python
en
['en', 'en', 'en']
True
delete_datasource
(directory, datasource)
Delete the datasource specified as an argument
Delete the datasource specified as an argument
def delete_datasource(directory, datasource): """Delete the datasource specified as an argument""" context = toolkit.load_data_context_with_error_handling(directory) try: context.delete_datasource(datasource) except ValueError: cli_message( "<red>{}</red>".format( ...
[ "def", "delete_datasource", "(", "directory", ",", "datasource", ")", ":", "context", "=", "toolkit", ".", "load_data_context_with_error_handling", "(", "directory", ")", "try", ":", "context", ".", "delete_datasource", "(", "datasource", ")", "except", "ValueError"...
[ 113, 0 ]
[ 132, 19 ]
python
en
['en', 'en', 'en']
True
datasource_list
(directory)
List known datasources.
List known datasources.
def datasource_list(directory): """List known datasources.""" context = toolkit.load_data_context_with_error_handling(directory) datasources = context.list_datasources() datasource_count = len(datasources) if datasource_count == 0: list_intro_string = "No Datasources found" else: ...
[ "def", "datasource_list", "(", "directory", ")", ":", "context", "=", "toolkit", ".", "load_data_context_with_error_handling", "(", "directory", ")", "datasources", "=", "context", ".", "list_datasources", "(", ")", "datasource_count", "=", "len", "(", "datasources"...
[ 142, 0 ]
[ 160, 5 ]
python
en
['en', 'en', 'en']
True
datasource_profile
( datasource, batch_kwargs_generator_name, data_assets, profile_all_data_assets, directory, view, additional_batch_kwargs, assume_yes, )
Profile a datasource (Experimental) If the optional data_assets and profile_all_data_assets arguments are not specified, the profiler will check if the number of data assets in the datasource exceeds the internally defined limit. If it does, it will prompt the user to either specify the list of data a...
Profile a datasource (Experimental)
def datasource_profile( datasource, batch_kwargs_generator_name, data_assets, profile_all_data_assets, directory, view, additional_batch_kwargs, assume_yes, ): """ Profile a datasource (Experimental) If the optional data_assets and profile_all_data_assets arguments are not s...
[ "def", "datasource_profile", "(", "datasource", ",", "batch_kwargs_generator_name", ",", "data_assets", ",", "profile_all_data_assets", ",", "directory", ",", "view", ",", "additional_batch_kwargs", ",", "assume_yes", ",", ")", ":", "context", "=", "toolkit", ".", "...
[ 219, 0 ]
[ 296, 15 ]
python
en
['en', 'error', 'th']
False
add_datasource
(context, choose_one_data_asset=False)
Interactive flow for adding a datasource to an existing context. :param context: :param choose_one_data_asset: optional - if True, this signals the method that the intent is to let user choose just one data asset (e.g., a file) and there is no need to configure a batch kwargs gener...
Interactive flow for adding a datasource to an existing context.
def add_datasource(context, choose_one_data_asset=False): """ Interactive flow for adding a datasource to an existing context. :param context: :param choose_one_data_asset: optional - if True, this signals the method that the intent is to let user choose just one data asset (e.g., a file) a...
[ "def", "add_datasource", "(", "context", ",", "choose_one_data_asset", "=", "False", ")", ":", "msg_prompt_where_is_your_data", "=", "\"\"\"\nWhat data would you like Great Expectations to connect to?\n 1. Files on a filesystem (for processing with Pandas or Spark)\n 2. Relational data...
[ 299, 0 ]
[ 355, 44 ]
python
en
['en', 'error', 'th']
False
_should_hide_input
()
This is a workaround to help identify Windows and adjust the prompts accordingly since hidden prompts may freeze in certain Windows terminals
This is a workaround to help identify Windows and adjust the prompts accordingly since hidden prompts may freeze in certain Windows terminals
def _should_hide_input(): """ This is a workaround to help identify Windows and adjust the prompts accordingly since hidden prompts may freeze in certain Windows terminals """ if "windows" in platform.platform().lower(): return False return True
[ "def", "_should_hide_input", "(", ")", ":", "if", "\"windows\"", "in", "platform", ".", "platform", "(", ")", ".", "lower", "(", ")", ":", "return", "False", "return", "True" ]
[ 593, 0 ]
[ 600, 15 ]
python
en
['en', 'error', 'th']
False
get_batch_kwargs
( context, datasource_name=None, batch_kwargs_generator_name=None, data_asset_name=None, additional_batch_kwargs=None, )
This method manages the interaction with user necessary to obtain batch_kwargs for a batch of a data asset. In order to get batch_kwargs this method needs datasource_name, batch_kwargs_generator_name and data_asset_name to combine them into a fully-qualified data asset identifier(datasource_name/batch_kwa...
This method manages the interaction with user necessary to obtain batch_kwargs for a batch of a data asset.
def get_batch_kwargs( context, datasource_name=None, batch_kwargs_generator_name=None, data_asset_name=None, additional_batch_kwargs=None, ): """ This method manages the interaction with user necessary to obtain batch_kwargs for a batch of a data asset. In order to get batch_kwargs this...
[ "def", "get_batch_kwargs", "(", "context", ",", "datasource_name", "=", "None", ",", "batch_kwargs_generator_name", "=", "None", ",", "data_asset_name", "=", "None", ",", "additional_batch_kwargs", "=", "None", ",", ")", ":", "try", ":", "available_data_assets_dict"...
[ 961, 0 ]
[ 1049, 88 ]
python
en
['en', 'error', 'th']
False
profile_datasource
( context, datasource_name, batch_kwargs_generator_name=None, data_assets=None, profile_all_data_assets=False, max_data_assets=20, additional_batch_kwargs=None, open_docs=False, skip_prompt_flag=False, )
Profile a named datasource using the specified context
Profile a named datasource using the specified context
def profile_datasource( context, datasource_name, batch_kwargs_generator_name=None, data_assets=None, profile_all_data_assets=False, max_data_assets=20, additional_batch_kwargs=None, open_docs=False, skip_prompt_flag=False, ): """Profile a named datasource using the specified con...
[ "def", "profile_datasource", "(", "context", ",", "datasource_name", ",", "batch_kwargs_generator_name", "=", "None", ",", "data_assets", "=", "None", ",", "profile_all_data_assets", "=", "False", ",", "max_data_assets", "=", "20", ",", "additional_batch_kwargs", "=",...
[ 1438, 0 ]
[ 1616, 32 ]
python
en
['en', 'en', 'en']
True
_fn_matches
(fn, glob)
Return whether the supplied file name fn matches pattern filename.
Return whether the supplied file name fn matches pattern filename.
def _fn_matches(fn, glob): """Return whether the supplied file name fn matches pattern filename.""" if glob not in _pattern_cache: pattern = _pattern_cache[glob] = re.compile(fnmatch.translate(glob)) return pattern.match(fn) return _pattern_cache[glob].match(fn)
[ "def", "_fn_matches", "(", "fn", ",", "glob", ")", ":", "if", "glob", "not", "in", "_pattern_cache", ":", "pattern", "=", "_pattern_cache", "[", "glob", "]", "=", "re", ".", "compile", "(", "fnmatch", ".", "translate", "(", "glob", ")", ")", "return", ...
[ 30, 0 ]
[ 35, 41 ]
python
en
['en', 'en', 'en']
True
_load_lexers
(module_name)
Load a lexer (and all others in the module too).
Load a lexer (and all others in the module too).
def _load_lexers(module_name): """Load a lexer (and all others in the module too).""" mod = __import__(module_name, None, None, ['__all__']) for lexer_name in mod.__all__: cls = getattr(mod, lexer_name) _lexer_cache[cls.name] = cls
[ "def", "_load_lexers", "(", "module_name", ")", ":", "mod", "=", "__import__", "(", "module_name", ",", "None", ",", "None", ",", "[", "'__all__'", "]", ")", "for", "lexer_name", "in", "mod", ".", "__all__", ":", "cls", "=", "getattr", "(", "mod", ",",...
[ 38, 0 ]
[ 43, 36 ]
python
en
['en', 'en', 'en']
True
get_all_lexers
()
Return a generator of tuples in the form ``(name, aliases, filenames, mimetypes)`` of all know lexers.
Return a generator of tuples in the form ``(name, aliases, filenames, mimetypes)`` of all know lexers.
def get_all_lexers(): """Return a generator of tuples in the form ``(name, aliases, filenames, mimetypes)`` of all know lexers. """ for item in itervalues(LEXERS): yield item[1:] for lexer in find_plugin_lexers(): yield lexer.name, lexer.aliases, lexer.filenames, lexer.mimetypes
[ "def", "get_all_lexers", "(", ")", ":", "for", "item", "in", "itervalues", "(", "LEXERS", ")", ":", "yield", "item", "[", "1", ":", "]", "for", "lexer", "in", "find_plugin_lexers", "(", ")", ":", "yield", "lexer", ".", "name", ",", "lexer", ".", "ali...
[ 46, 0 ]
[ 53, 73 ]
python
en
['en', 'en', 'en']
True
find_lexer_class
(name)
Lookup a lexer class by name. Return None if not found.
Lookup a lexer class by name.
def find_lexer_class(name): """Lookup a lexer class by name. Return None if not found. """ if name in _lexer_cache: return _lexer_cache[name] # lookup builtin lexers for module_name, lname, aliases, _, _ in itervalues(LEXERS): if name == lname: _load_lexers(module_na...
[ "def", "find_lexer_class", "(", "name", ")", ":", "if", "name", "in", "_lexer_cache", ":", "return", "_lexer_cache", "[", "name", "]", "# lookup builtin lexers", "for", "module_name", ",", "lname", ",", "aliases", ",", "_", ",", "_", "in", "itervalues", "(",...
[ 56, 0 ]
[ 71, 22 ]
python
en
['en', 'en', 'en']
True
get_lexer_by_name
(_alias, **options)
Get a lexer by an alias. Raises ClassNotFound if not found.
Get a lexer by an alias.
def get_lexer_by_name(_alias, **options): """Get a lexer by an alias. Raises ClassNotFound if not found. """ if not _alias: raise ClassNotFound('no lexer for alias %r found' % _alias) # lookup builtin lexers for module_name, name, aliases, _, _ in itervalues(LEXERS): if _alias....
[ "def", "get_lexer_by_name", "(", "_alias", ",", "*", "*", "options", ")", ":", "if", "not", "_alias", ":", "raise", "ClassNotFound", "(", "'no lexer for alias %r found'", "%", "_alias", ")", "# lookup builtin lexers", "for", "module_name", ",", "name", ",", "ali...
[ 74, 0 ]
[ 92, 63 ]
python
en
['en', 'gd', 'en']
True
find_lexer_class_for_filename
(_fn, code=None)
Get a lexer for a filename. If multiple lexers match the filename pattern, use ``analyse_text()`` to figure out which one is more appropriate. Returns None if not found.
Get a lexer for a filename.
def find_lexer_class_for_filename(_fn, code=None): """Get a lexer for a filename. If multiple lexers match the filename pattern, use ``analyse_text()`` to figure out which one is more appropriate. Returns None if not found. """ matches = [] fn = basename(_fn) for modname, name, _, file...
[ "def", "find_lexer_class_for_filename", "(", "_fn", ",", "code", "=", "None", ")", ":", "matches", "=", "[", "]", "fn", "=", "basename", "(", "_fn", ")", "for", "modname", ",", "name", ",", "_", ",", "filenames", ",", "_", "in", "itervalues", "(", "L...
[ 95, 0 ]
[ 135, 29 ]
python
en
['en', 'pt', 'en']
True
get_lexer_for_filename
(_fn, code=None, **options)
Get a lexer for a filename. If multiple lexers match the filename pattern, use ``analyse_text()`` to figure out which one is more appropriate. Raises ClassNotFound if not found.
Get a lexer for a filename.
def get_lexer_for_filename(_fn, code=None, **options): """Get a lexer for a filename. If multiple lexers match the filename pattern, use ``analyse_text()`` to figure out which one is more appropriate. Raises ClassNotFound if not found. """ res = find_lexer_class_for_filename(_fn, code) if ...
[ "def", "get_lexer_for_filename", "(", "_fn", ",", "code", "=", "None", ",", "*", "*", "options", ")", ":", "res", "=", "find_lexer_class_for_filename", "(", "_fn", ",", "code", ")", "if", "not", "res", ":", "raise", "ClassNotFound", "(", "'no lexer for filen...
[ 138, 0 ]
[ 149, 25 ]
python
en
['en', 'pt', 'en']
True
get_lexer_for_mimetype
(_mime, **options)
Get a lexer for a mimetype. Raises ClassNotFound if not found.
Get a lexer for a mimetype.
def get_lexer_for_mimetype(_mime, **options): """Get a lexer for a mimetype. Raises ClassNotFound if not found. """ for modname, name, _, _, mimetypes in itervalues(LEXERS): if _mime in mimetypes: if name not in _lexer_cache: _load_lexers(modname) return ...
[ "def", "get_lexer_for_mimetype", "(", "_mime", ",", "*", "*", "options", ")", ":", "for", "modname", ",", "name", ",", "_", ",", "_", ",", "mimetypes", "in", "itervalues", "(", "LEXERS", ")", ":", "if", "_mime", "in", "mimetypes", ":", "if", "name", ...
[ 152, 0 ]
[ 165, 65 ]
python
en
['en', 'en', 'en']
True
_iter_lexerclasses
(plugins=True)
Return an iterator over all lexer classes.
Return an iterator over all lexer classes.
def _iter_lexerclasses(plugins=True): """Return an iterator over all lexer classes.""" for key in sorted(LEXERS): module_name, name = LEXERS[key][:2] if name not in _lexer_cache: _load_lexers(module_name) yield _lexer_cache[name] if plugins: for lexer in find_plug...
[ "def", "_iter_lexerclasses", "(", "plugins", "=", "True", ")", ":", "for", "key", "in", "sorted", "(", "LEXERS", ")", ":", "module_name", ",", "name", "=", "LEXERS", "[", "key", "]", "[", ":", "2", "]", "if", "name", "not", "in", "_lexer_cache", ":",...
[ 168, 0 ]
[ 177, 23 ]
python
en
['en', 'en', 'en']
True
guess_lexer_for_filename
(_fn, _text, **options)
Lookup all lexers that handle those filenames primary (``filenames``) or secondary (``alias_filenames``). Then run a text analysis for those lexers and choose the best result. usage:: >>> from pygments.lexers import guess_lexer_for_filename >>> guess_lexer_for_filename('hello.html', '...
Lookup all lexers that handle those filenames primary (``filenames``) or secondary (``alias_filenames``). Then run a text analysis for those lexers and choose the best result.
def guess_lexer_for_filename(_fn, _text, **options): """ Lookup all lexers that handle those filenames primary (``filenames``) or secondary (``alias_filenames``). Then run a text analysis for those lexers and choose the best result. usage:: >>> from pygments.lexers import guess_lexer_for_f...
[ "def", "guess_lexer_for_filename", "(", "_fn", ",", "_text", ",", "*", "*", "options", ")", ":", "fn", "=", "basename", "(", "_fn", ")", "primary", "=", "{", "}", "matching_lexers", "=", "set", "(", ")", "for", "lexer", "in", "_iter_lexerclasses", "(", ...
[ 180, 0 ]
[ 228, 35 ]
python
en
['en', 'error', 'th']
False
guess_lexer
(_text, **options)
Guess a lexer by strong distinctions in the text (eg, shebang).
Guess a lexer by strong distinctions in the text (eg, shebang).
def guess_lexer(_text, **options): """Guess a lexer by strong distinctions in the text (eg, shebang).""" # try to get a vim modeline first ft = get_filetype_from_buffer(_text) if ft is not None: try: return get_lexer_by_name(ft, **options) except ClassNotFound: ...
[ "def", "guess_lexer", "(", "_text", ",", "*", "*", "options", ")", ":", "# try to get a vim modeline first", "ft", "=", "get_filetype_from_buffer", "(", "_text", ")", "if", "ft", "is", "not", "None", ":", "try", ":", "return", "get_lexer_by_name", "(", "ft", ...
[ 231, 0 ]
[ 252, 35 ]
python
en
['en', 'en', 'en']
True
XvfbDisplay.__init__
(self, size=(1024, 768), color_depth=24, bgcolor='black', fbdir=None)
:param bgcolor: 'black' or 'white' :param fbdir: If non-null, the virtual screen is memory-mapped to a file in the given directory ('-fbdir' option)
:param bgcolor: 'black' or 'white' :param fbdir: If non-null, the virtual screen is memory-mapped to a file in the given directory ('-fbdir' option)
def __init__(self, size=(1024, 768), color_depth=24, bgcolor='black', fbdir=None): ''' :param bgcolor: 'black' or 'white' :param fbdir: If non-null, the virtual screen is memory-mapped to a file in the given directory ('-fbdir' option) ''' self.screen...
[ "def", "__init__", "(", "self", ",", "size", "=", "(", "1024", ",", "768", ")", ",", "color_depth", "=", "24", ",", "bgcolor", "=", "'black'", ",", "fbdir", "=", "None", ")", ":", "self", ".", "screen", "=", "0", "self", ".", "size", "=", "size",...
[ 14, 4 ]
[ 28, 38 ]
python
en
['en', 'error', 'th']
False
TIMESAT_stats
(dataarray, time_dim='time')
For a 1D array of values for a vegetation index - for which higher values tend to indicate more vegetation - determine several statistics: 1. Beginning of Season (BOS): The time index of the beginning of the growing season. (The downward inflection point before the maximum vegetation index value) ...
For a 1D array of values for a vegetation index - for which higher values tend to indicate more vegetation - determine several statistics: 1. Beginning of Season (BOS): The time index of the beginning of the growing season. (The downward inflection point before the maximum vegetation index value) ...
def TIMESAT_stats(dataarray, time_dim='time'): """ For a 1D array of values for a vegetation index - for which higher values tend to indicate more vegetation - determine several statistics: 1. Beginning of Season (BOS): The time index of the beginning of the growing season. (The downward inflec...
[ "def", "TIMESAT_stats", "(", "dataarray", ",", "time_dim", "=", "'time'", ")", ":", "assert", "time_dim", "in", "dataarray", ".", "dims", ",", "\"The parameter `time_dim` is \\\"{}\\\", \"", "\"but that dimension does not exist in the data.\"", ".", "format", "(", "time_d...
[ 24, 0 ]
[ 111, 16 ]
python
en
['en', 'error', 'th']
False
IRIPAllowDeny.__init__
(self, ir: 'IR', aconf: Config, rkey: str="ir.ipallowdeny", name: str="ir.ipallowdeny", kind: str="IRIPAllowDeny", parent: IRResource=None, action: str=None, **kwargs)
Initialize an IRIPAllowDeny. In addition to the usual IRFilter parameters, parent and action are required: parent is the IRResource in which the IRIPAllowDeny is defined; at present, this will be the Ambassador module. It's required because it's where errors should be posted. ...
Initialize an IRIPAllowDeny. In addition to the usual IRFilter parameters, parent and action are required:
def __init__(self, ir: 'IR', aconf: Config, rkey: str="ir.ipallowdeny", name: str="ir.ipallowdeny", kind: str="IRIPAllowDeny", parent: IRResource=None, action: str=None, **kwargs) -> None: """ Initializ...
[ "def", "__init__", "(", "self", ",", "ir", ":", "'IR'", ",", "aconf", ":", "Config", ",", "rkey", ":", "str", "=", "\"ir.ipallowdeny\"", ",", "name", ":", "str", "=", "\"ir.ipallowdeny\"", ",", "kind", ":", "str", "=", "\"IRIPAllowDeny\"", ",", "parent",...
[ 28, 4 ]
[ 52, 51 ]
python
en
['en', 'error', 'th']
False
IRIPAllowDeny.setup
(self, ir: 'IR', aconf: Config)
Set up an IRIPAllowDeny based on the action and principals passed into __init__.
Set up an IRIPAllowDeny based on the action and principals passed into __init__.
def setup(self, ir: 'IR', aconf: Config) -> bool: """ Set up an IRIPAllowDeny based on the action and principals passed into __init__. """ assert self.parent # These pops will crash if the action or principals are missing. That's # OK -- they're required element...
[ "def", "setup", "(", "self", ",", "ir", ":", "'IR'", ",", "aconf", ":", "Config", ")", "->", "bool", ":", "assert", "self", ".", "parent", "# These pops will crash if the action or principals are missing. That's", "# OK -- they're required elements.", "action", ":", "...
[ 54, 4 ]
[ 119, 24 ]
python
en
['en', 'error', 'th']
False
complex_flat_schema
()
This includes some descriptions.
This includes some descriptions.
def complex_flat_schema(): """This includes some descriptions.""" return { "$id": "https://example.com/address.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", "description": "An address", "type": "object", "properties": { "post-office-box":...
[ "def", "complex_flat_schema", "(", ")", ":", "return", "{", "\"$id\"", ":", "\"https://example.com/address.schema.json\"", ",", "\"$schema\"", ":", "\"http://json-schema.org/draft-07/schema#\"", ",", "\"description\"", ":", "\"An address\"", ",", "\"type\"", ":", "\"object\...
[ 22, 0 ]
[ 42, 5 ]
python
en
['en', 'en', 'en']
True
string_lengths_schema
()
This fixture has various combinations string lengths. https://json-schema.org/understanding-json-schema/reference/string.html#length
This fixture has various combinations string lengths. https://json-schema.org/understanding-json-schema/reference/string.html#length
def string_lengths_schema(): """ This fixture has various combinations string lengths. https://json-schema.org/understanding-json-schema/reference/string.html#length """ return { "$id": "https://example.com/address.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", ...
[ "def", "string_lengths_schema", "(", ")", ":", "return", "{", "\"$id\"", ":", "\"https://example.com/address.schema.json\"", ",", "\"$schema\"", ":", "\"http://json-schema.org/draft-07/schema#\"", ",", "\"type\"", ":", "\"object\"", ",", "\"properties\"", ":", "{", "\"com...
[ 95, 0 ]
[ 126, 5 ]
python
en
['en', 'error', 'th']
False
integer_ranges_schema
()
This fixture has various combinations of integer ranges. https://json-schema.org/understanding-json-schema/reference/numeric.html#range
This fixture has various combinations of integer ranges. https://json-schema.org/understanding-json-schema/reference/numeric.html#range
def integer_ranges_schema(): """ This fixture has various combinations of integer ranges. https://json-schema.org/understanding-json-schema/reference/numeric.html#range """ return { "$id": "https://example.com/address.schema.json", "$schema": "http://json-schema.org/draft-07/schema#"...
[ "def", "integer_ranges_schema", "(", ")", ":", "return", "{", "\"$id\"", ":", "\"https://example.com/address.schema.json\"", ",", "\"$schema\"", ":", "\"http://json-schema.org/draft-07/schema#\"", ",", "\"description\"", ":", "\"An address similar to http://microformats.org/wiki/h-...
[ 130, 0 ]
[ 165, 5 ]
python
en
['en', 'error', 'th']
False
number_ranges_schema
()
This fixture has various combinations of number ranges. https://json-schema.org/understanding-json-schema/reference/numeric.html#range
This fixture has various combinations of number ranges. https://json-schema.org/understanding-json-schema/reference/numeric.html#range
def number_ranges_schema(): """ This fixture has various combinations of number ranges. https://json-schema.org/understanding-json-schema/reference/numeric.html#range """ return { "$id": "https://example.com/address.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", ...
[ "def", "number_ranges_schema", "(", ")", ":", "return", "{", "\"$id\"", ":", "\"https://example.com/address.schema.json\"", ",", "\"$schema\"", ":", "\"http://json-schema.org/draft-07/schema#\"", ",", "\"description\"", ":", "\"An address similar to http://microformats.org/wiki/h-c...
[ 169, 0 ]
[ 204, 5 ]
python
en
['en', 'error', 'th']
False
null_fields_schema
()
This fixture has null fields. https://json-schema.org/understanding-json-schema/reference/null.html
This fixture has null fields. https://json-schema.org/understanding-json-schema/reference/null.html
def null_fields_schema(): """ This fixture has null fields. https://json-schema.org/understanding-json-schema/reference/null.html """ return { "$id": "https://example.com/null.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "prope...
[ "def", "null_fields_schema", "(", ")", ":", "return", "{", "\"$id\"", ":", "\"https://example.com/null.schema.json\"", ",", "\"$schema\"", ":", "\"http://json-schema.org/draft-07/schema#\"", ",", "\"type\"", ":", "\"object\"", ",", "\"properties\"", ":", "{", "\"null\"", ...
[ 208, 0 ]
[ 224, 5 ]
python
en
['en', 'error', 'th']
False
open_tcp_listeners
(port, *, host=None, backlog=None)
Create :class:`SocketListener` objects to listen for TCP connections. Args: port (int): The port to listen on. If you use 0 as your port, then the kernel will automatically pick an arbitrary open port. But be careful: if you use this feature when binding to multiple IP address...
Create :class:`SocketListener` objects to listen for TCP connections.
async def open_tcp_listeners(port, *, host=None, backlog=None): """Create :class:`SocketListener` objects to listen for TCP connections. Args: port (int): The port to listen on. If you use 0 as your port, then the kernel will automatically pick an arbitrary open port. But be careful...
[ "async", "def", "open_tcp_listeners", "(", "port", ",", "*", ",", "host", "=", "None", ",", "backlog", "=", "None", ")", ":", "# getaddrinfo sometimes allows port=None, sometimes not (depending on", "# whether host=None). And on some systems it treats \"\" as 0, others it", "# ...
[ 44, 0 ]
[ 142, 20 ]
python
en
['en', 'en', 'en']
True