partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | SparkRunner.execute | Executes Blurr BTS with the given records. old_state_rdd can be provided to load an older
state from a previous run.
:param identity_records: RDD of the form Tuple[Identity, List[TimeAndRecord]]
:param old_state_rdd: A previous streaming BTS state RDD as Tuple[Identity, Streaming BTS
... | blurr/runner/spark_runner.py | def execute(self, identity_records: 'RDD', old_state_rdd: Optional['RDD'] = None) -> 'RDD':
"""
Executes Blurr BTS with the given records. old_state_rdd can be provided to load an older
state from a previous run.
:param identity_records: RDD of the form Tuple[Identity, List[TimeAndRecor... | def execute(self, identity_records: 'RDD', old_state_rdd: Optional['RDD'] = None) -> 'RDD':
"""
Executes Blurr BTS with the given records. old_state_rdd can be provided to load an older
state from a previous run.
:param identity_records: RDD of the form Tuple[Identity, List[TimeAndRecor... | [
"Executes",
"Blurr",
"BTS",
"with",
"the",
"given",
"records",
".",
"old_state_rdd",
"can",
"be",
"provided",
"to",
"load",
"an",
"older",
"state",
"from",
"a",
"previous",
"run",
"."
] | productml/blurr | python | https://github.com/productml/blurr/blob/1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa/blurr/runner/spark_runner.py#L80-L93 | [
"def",
"execute",
"(",
"self",
",",
"identity_records",
":",
"'RDD'",
",",
"old_state_rdd",
":",
"Optional",
"[",
"'RDD'",
"]",
"=",
"None",
")",
"->",
"'RDD'",
":",
"identity_records_with_state",
"=",
"identity_records",
"if",
"old_state_rdd",
":",
"identity_re... | 1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa |
train | SparkRunner.get_record_rdd_from_json_files | Reads the data from the given json_files path and converts them into the `Record`s format for
processing. `data_processor` is used to process the per event data in those files to convert
them into `Record`.
:param json_files: List of json file paths. Regular Spark path wildcards are accepted.
... | blurr/runner/spark_runner.py | def get_record_rdd_from_json_files(self,
json_files: List[str],
data_processor: DataProcessor = SimpleJsonDataProcessor(),
spark_session: Optional['SparkSession'] = None) -> 'RDD':
"""
Re... | def get_record_rdd_from_json_files(self,
json_files: List[str],
data_processor: DataProcessor = SimpleJsonDataProcessor(),
spark_session: Optional['SparkSession'] = None) -> 'RDD':
"""
Re... | [
"Reads",
"the",
"data",
"from",
"the",
"given",
"json_files",
"path",
"and",
"converts",
"them",
"into",
"the",
"Record",
"s",
"format",
"for",
"processing",
".",
"data_processor",
"is",
"used",
"to",
"process",
"the",
"per",
"event",
"data",
"in",
"those",
... | productml/blurr | python | https://github.com/productml/blurr/blob/1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa/blurr/runner/spark_runner.py#L95-L115 | [
"def",
"get_record_rdd_from_json_files",
"(",
"self",
",",
"json_files",
":",
"List",
"[",
"str",
"]",
",",
"data_processor",
":",
"DataProcessor",
"=",
"SimpleJsonDataProcessor",
"(",
")",
",",
"spark_session",
":",
"Optional",
"[",
"'SparkSession'",
"]",
"=",
... | 1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa |
train | SparkRunner.get_record_rdd_from_rdd | Converts a RDD of raw events into the `Record`s format for processing. `data_processor` is
used to process the per row data to convert them into `Record`.
:param rdd: RDD containing the raw events.
:param data_processor: `DataProcessor` to process each row in the given `rdd`.
:return: R... | blurr/runner/spark_runner.py | def get_record_rdd_from_rdd(
self,
rdd: 'RDD',
data_processor: DataProcessor = SimpleDictionaryDataProcessor(),
) -> 'RDD':
"""
Converts a RDD of raw events into the `Record`s format for processing. `data_processor` is
used to process the per row data to c... | def get_record_rdd_from_rdd(
self,
rdd: 'RDD',
data_processor: DataProcessor = SimpleDictionaryDataProcessor(),
) -> 'RDD':
"""
Converts a RDD of raw events into the `Record`s format for processing. `data_processor` is
used to process the per row data to c... | [
"Converts",
"a",
"RDD",
"of",
"raw",
"events",
"into",
"the",
"Record",
"s",
"format",
"for",
"processing",
".",
"data_processor",
"is",
"used",
"to",
"process",
"the",
"per",
"row",
"data",
"to",
"convert",
"them",
"into",
"Record",
"."
] | productml/blurr | python | https://github.com/productml/blurr/blob/1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa/blurr/runner/spark_runner.py#L117-L132 | [
"def",
"get_record_rdd_from_rdd",
"(",
"self",
",",
"rdd",
":",
"'RDD'",
",",
"data_processor",
":",
"DataProcessor",
"=",
"SimpleDictionaryDataProcessor",
"(",
")",
",",
")",
"->",
"'RDD'",
":",
"return",
"rdd",
".",
"mapPartitions",
"(",
"lambda",
"x",
":",
... | 1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa |
train | SparkRunner.write_output_file | Basic helper function to persist data to disk.
If window BTS was provided then the window BTS output to written in csv format, otherwise,
the streaming BTS output is written in JSON format to the `path` provided
:param path: Path where the output should be written.
:param per_identity_... | blurr/runner/spark_runner.py | def write_output_file(self,
path: str,
per_identity_data: 'RDD',
spark_session: Optional['SparkSession'] = None) -> None:
"""
Basic helper function to persist data to disk.
If window BTS was provided then the window B... | def write_output_file(self,
path: str,
per_identity_data: 'RDD',
spark_session: Optional['SparkSession'] = None) -> None:
"""
Basic helper function to persist data to disk.
If window BTS was provided then the window B... | [
"Basic",
"helper",
"function",
"to",
"persist",
"data",
"to",
"disk",
"."
] | productml/blurr | python | https://github.com/productml/blurr/blob/1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa/blurr/runner/spark_runner.py#L134-L158 | [
"def",
"write_output_file",
"(",
"self",
",",
"path",
":",
"str",
",",
"per_identity_data",
":",
"'RDD'",
",",
"spark_session",
":",
"Optional",
"[",
"'SparkSession'",
"]",
"=",
"None",
")",
"->",
"None",
":",
"_spark_session_",
"=",
"get_spark_session",
"(",
... | 1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa |
train | SparkRunner.print_output | Basic helper function to write data to stdout. If window BTS was provided then the window
BTS output is written, otherwise, the streaming BTS output is written to stdout.
WARNING - For large datasets this will be extremely slow.
:param per_identity_data: Output of the `execute()` call. | blurr/runner/spark_runner.py | def print_output(self, per_identity_data: 'RDD') -> None:
"""
Basic helper function to write data to stdout. If window BTS was provided then the window
BTS output is written, otherwise, the streaming BTS output is written to stdout.
WARNING - For large datasets this will be extremely sl... | def print_output(self, per_identity_data: 'RDD') -> None:
"""
Basic helper function to write data to stdout. If window BTS was provided then the window
BTS output is written, otherwise, the streaming BTS output is written to stdout.
WARNING - For large datasets this will be extremely sl... | [
"Basic",
"helper",
"function",
"to",
"write",
"data",
"to",
"stdout",
".",
"If",
"window",
"BTS",
"was",
"provided",
"then",
"the",
"window",
"BTS",
"output",
"is",
"written",
"otherwise",
"the",
"streaming",
"BTS",
"output",
"is",
"written",
"to",
"stdout",... | productml/blurr | python | https://github.com/productml/blurr/blob/1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa/blurr/runner/spark_runner.py#L160-L177 | [
"def",
"print_output",
"(",
"self",
",",
"per_identity_data",
":",
"'RDD'",
")",
"->",
"None",
":",
"if",
"not",
"self",
".",
"_window_bts",
":",
"data",
"=",
"per_identity_data",
".",
"flatMap",
"(",
"lambda",
"x",
":",
"[",
"json",
".",
"dumps",
"(",
... | 1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa |
train | find_executable | As distutils.spawn.find_executable, but on Windows, look up
every extension declared in PATHEXT instead of just `.exe` | dockerpycreds/utils.py | def find_executable(executable, path=None):
"""
As distutils.spawn.find_executable, but on Windows, look up
every extension declared in PATHEXT instead of just `.exe`
"""
if sys.platform != 'win32':
return distutils.spawn.find_executable(executable, path)
if path is None:
path =... | def find_executable(executable, path=None):
"""
As distutils.spawn.find_executable, but on Windows, look up
every extension declared in PATHEXT instead of just `.exe`
"""
if sys.platform != 'win32':
return distutils.spawn.find_executable(executable, path)
if path is None:
path =... | [
"As",
"distutils",
".",
"spawn",
".",
"find_executable",
"but",
"on",
"Windows",
"look",
"up",
"every",
"extension",
"declared",
"in",
"PATHEXT",
"instead",
"of",
"just",
".",
"exe"
] | shin-/dockerpy-creds | python | https://github.com/shin-/dockerpy-creds/blob/9c0b66d2e445a838e1518f2c3273df7ddc7ec0d4/dockerpycreds/utils.py#L6-L29 | [
"def",
"find_executable",
"(",
"executable",
",",
"path",
"=",
"None",
")",
":",
"if",
"sys",
".",
"platform",
"!=",
"'win32'",
":",
"return",
"distutils",
".",
"spawn",
".",
"find_executable",
"(",
"executable",
",",
"path",
")",
"if",
"path",
"is",
"No... | 9c0b66d2e445a838e1518f2c3273df7ddc7ec0d4 |
train | create_environment_dict | Create and return a copy of os.environ with the specified overrides | dockerpycreds/utils.py | def create_environment_dict(overrides):
"""
Create and return a copy of os.environ with the specified overrides
"""
result = os.environ.copy()
result.update(overrides or {})
return result | def create_environment_dict(overrides):
"""
Create and return a copy of os.environ with the specified overrides
"""
result = os.environ.copy()
result.update(overrides or {})
return result | [
"Create",
"and",
"return",
"a",
"copy",
"of",
"os",
".",
"environ",
"with",
"the",
"specified",
"overrides"
] | shin-/dockerpy-creds | python | https://github.com/shin-/dockerpy-creds/blob/9c0b66d2e445a838e1518f2c3273df7ddc7ec0d4/dockerpycreds/utils.py#L32-L38 | [
"def",
"create_environment_dict",
"(",
"overrides",
")",
":",
"result",
"=",
"os",
".",
"environ",
".",
"copy",
"(",
")",
"result",
".",
"update",
"(",
"overrides",
"or",
"{",
"}",
")",
"return",
"result"
] | 9c0b66d2e445a838e1518f2c3273df7ddc7ec0d4 |
train | Store.get | Retrieve credentials for `server`. If no credentials are found,
a `StoreError` will be raised. | dockerpycreds/store.py | def get(self, server):
""" Retrieve credentials for `server`. If no credentials are found,
a `StoreError` will be raised.
"""
if not isinstance(server, six.binary_type):
server = server.encode('utf-8')
data = self._execute('get', server)
result = json.load... | def get(self, server):
""" Retrieve credentials for `server`. If no credentials are found,
a `StoreError` will be raised.
"""
if not isinstance(server, six.binary_type):
server = server.encode('utf-8')
data = self._execute('get', server)
result = json.load... | [
"Retrieve",
"credentials",
"for",
"server",
".",
"If",
"no",
"credentials",
"are",
"found",
"a",
"StoreError",
"will",
"be",
"raised",
"."
] | shin-/dockerpy-creds | python | https://github.com/shin-/dockerpy-creds/blob/9c0b66d2e445a838e1518f2c3273df7ddc7ec0d4/dockerpycreds/store.py#L29-L47 | [
"def",
"get",
"(",
"self",
",",
"server",
")",
":",
"if",
"not",
"isinstance",
"(",
"server",
",",
"six",
".",
"binary_type",
")",
":",
"server",
"=",
"server",
".",
"encode",
"(",
"'utf-8'",
")",
"data",
"=",
"self",
".",
"_execute",
"(",
"'get'",
... | 9c0b66d2e445a838e1518f2c3273df7ddc7ec0d4 |
train | Store.store | Store credentials for `server`. Raises a `StoreError` if an error
occurs. | dockerpycreds/store.py | def store(self, server, username, secret):
""" Store credentials for `server`. Raises a `StoreError` if an error
occurs.
"""
data_input = json.dumps({
'ServerURL': server,
'Username': username,
'Secret': secret
}).encode('utf-8')
re... | def store(self, server, username, secret):
""" Store credentials for `server`. Raises a `StoreError` if an error
occurs.
"""
data_input = json.dumps({
'ServerURL': server,
'Username': username,
'Secret': secret
}).encode('utf-8')
re... | [
"Store",
"credentials",
"for",
"server",
".",
"Raises",
"a",
"StoreError",
"if",
"an",
"error",
"occurs",
"."
] | shin-/dockerpy-creds | python | https://github.com/shin-/dockerpy-creds/blob/9c0b66d2e445a838e1518f2c3273df7ddc7ec0d4/dockerpycreds/store.py#L49-L58 | [
"def",
"store",
"(",
"self",
",",
"server",
",",
"username",
",",
"secret",
")",
":",
"data_input",
"=",
"json",
".",
"dumps",
"(",
"{",
"'ServerURL'",
":",
"server",
",",
"'Username'",
":",
"username",
",",
"'Secret'",
":",
"secret",
"}",
")",
".",
... | 9c0b66d2e445a838e1518f2c3273df7ddc7ec0d4 |
train | Store.erase | Erase credentials for `server`. Raises a `StoreError` if an error
occurs. | dockerpycreds/store.py | def erase(self, server):
""" Erase credentials for `server`. Raises a `StoreError` if an error
occurs.
"""
if not isinstance(server, six.binary_type):
server = server.encode('utf-8')
self._execute('erase', server) | def erase(self, server):
""" Erase credentials for `server`. Raises a `StoreError` if an error
occurs.
"""
if not isinstance(server, six.binary_type):
server = server.encode('utf-8')
self._execute('erase', server) | [
"Erase",
"credentials",
"for",
"server",
".",
"Raises",
"a",
"StoreError",
"if",
"an",
"error",
"occurs",
"."
] | shin-/dockerpy-creds | python | https://github.com/shin-/dockerpy-creds/blob/9c0b66d2e445a838e1518f2c3273df7ddc7ec0d4/dockerpycreds/store.py#L60-L66 | [
"def",
"erase",
"(",
"self",
",",
"server",
")",
":",
"if",
"not",
"isinstance",
"(",
"server",
",",
"six",
".",
"binary_type",
")",
":",
"server",
"=",
"server",
".",
"encode",
"(",
"'utf-8'",
")",
"self",
".",
"_execute",
"(",
"'erase'",
",",
"serv... | 9c0b66d2e445a838e1518f2c3273df7ddc7ec0d4 |
train | StreamingTransformerSchema.get_identity | Evaluates and returns the identity as specified in the schema.
:param record: Record which is used to determine the identity.
:return: The evaluated identity
:raises: IdentityError if identity cannot be determined. | blurr/core/transformer_streaming.py | def get_identity(self, record: Record) -> str:
"""
Evaluates and returns the identity as specified in the schema.
:param record: Record which is used to determine the identity.
:return: The evaluated identity
:raises: IdentityError if identity cannot be determined.
"""
... | def get_identity(self, record: Record) -> str:
"""
Evaluates and returns the identity as specified in the schema.
:param record: Record which is used to determine the identity.
:return: The evaluated identity
:raises: IdentityError if identity cannot be determined.
"""
... | [
"Evaluates",
"and",
"returns",
"the",
"identity",
"as",
"specified",
"in",
"the",
"schema",
".",
":",
"param",
"record",
":",
"Record",
"which",
"is",
"used",
"to",
"determine",
"the",
"identity",
".",
":",
"return",
":",
"The",
"evaluated",
"identity",
":... | productml/blurr | python | https://github.com/productml/blurr/blob/1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa/blurr/core/transformer_streaming.py#L29-L43 | [
"def",
"get_identity",
"(",
"self",
",",
"record",
":",
"Record",
")",
"->",
"str",
":",
"context",
"=",
"self",
".",
"schema_context",
".",
"context",
"context",
".",
"add_record",
"(",
"record",
")",
"identity",
"=",
"self",
".",
"identity",
".",
"eval... | 1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa |
train | StreamingTransformer.run_evaluate | Evaluates and updates data in the StreamingTransformer.
:param record: The 'source' record used for the update.
:raises: IdentityError if identity is different from the one used during
initialization. | blurr/core/transformer_streaming.py | def run_evaluate(self, record: Record):
"""
Evaluates and updates data in the StreamingTransformer.
:param record: The 'source' record used for the update.
:raises: IdentityError if identity is different from the one used during
initialization.
"""
record_identity... | def run_evaluate(self, record: Record):
"""
Evaluates and updates data in the StreamingTransformer.
:param record: The 'source' record used for the update.
:raises: IdentityError if identity is different from the one used during
initialization.
"""
record_identity... | [
"Evaluates",
"and",
"updates",
"data",
"in",
"the",
"StreamingTransformer",
".",
":",
"param",
"record",
":",
"The",
"source",
"record",
"used",
"for",
"the",
"update",
".",
":",
"raises",
":",
"IdentityError",
"if",
"identity",
"is",
"different",
"from",
"t... | productml/blurr | python | https://github.com/productml/blurr/blob/1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa/blurr/core/transformer_streaming.py#L65-L88 | [
"def",
"run_evaluate",
"(",
"self",
",",
"record",
":",
"Record",
")",
":",
"record_identity",
"=",
"self",
".",
"_schema",
".",
"get_identity",
"(",
"record",
")",
"if",
"self",
".",
"_identity",
"!=",
"record_identity",
":",
"raise",
"IdentityError",
"(",
... | 1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa |
train | AggregateSchema.extend_schema_spec | Injects the identity field | blurr/core/aggregate.py | def extend_schema_spec(self) -> None:
""" Injects the identity field """
super().extend_schema_spec()
identity_field = {
'Name': '_identity',
'Type': BtsType.STRING,
'Value': 'identity',
ATTRIBUTE_INTERNAL: True
}
if self.ATTRIBUT... | def extend_schema_spec(self) -> None:
""" Injects the identity field """
super().extend_schema_spec()
identity_field = {
'Name': '_identity',
'Type': BtsType.STRING,
'Value': 'identity',
ATTRIBUTE_INTERNAL: True
}
if self.ATTRIBUT... | [
"Injects",
"the",
"identity",
"field"
] | productml/blurr | python | https://github.com/productml/blurr/blob/1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa/blurr/core/aggregate.py#L38-L51 | [
"def",
"extend_schema_spec",
"(",
"self",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"extend_schema_spec",
"(",
")",
"identity_field",
"=",
"{",
"'Name'",
":",
"'_identity'",
",",
"'Type'",
":",
"BtsType",
".",
"STRING",
",",
"'Value'",
":",
"'identit... | 1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa |
train | Aggregate._persist | Persists the current data group | blurr/core/aggregate.py | def _persist(self) -> None:
"""
Persists the current data group
"""
if self._store:
self._store.save(self._key, self._snapshot) | def _persist(self) -> None:
"""
Persists the current data group
"""
if self._store:
self._store.save(self._key, self._snapshot) | [
"Persists",
"the",
"current",
"data",
"group"
] | productml/blurr | python | https://github.com/productml/blurr/blob/1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa/blurr/core/aggregate.py#L97-L102 | [
"def",
"_persist",
"(",
"self",
")",
"->",
"None",
":",
"if",
"self",
".",
"_store",
":",
"self",
".",
"_store",
".",
"save",
"(",
"self",
".",
"_key",
",",
"self",
".",
"_snapshot",
")"
] | 1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa |
train | SchemaLoader.add_schema_spec | Add a schema dictionary to the schema loader. The given schema is stored
against fully_qualified_parent_name + ITEM_SEPARATOR('.') + schema.name.
:param spec: Schema specification.
:param fully_qualified_parent_name: Full qualified name of the parent.
If None is passed then the schema is... | blurr/core/schema_loader.py | def add_schema_spec(self, spec: Dict[str, Any],
fully_qualified_parent_name: str = None) -> Optional[str]:
"""
Add a schema dictionary to the schema loader. The given schema is stored
against fully_qualified_parent_name + ITEM_SEPARATOR('.') + schema.name.
:param ... | def add_schema_spec(self, spec: Dict[str, Any],
fully_qualified_parent_name: str = None) -> Optional[str]:
"""
Add a schema dictionary to the schema loader. The given schema is stored
against fully_qualified_parent_name + ITEM_SEPARATOR('.') + schema.name.
:param ... | [
"Add",
"a",
"schema",
"dictionary",
"to",
"the",
"schema",
"loader",
".",
"The",
"given",
"schema",
"is",
"stored",
"against",
"fully_qualified_parent_name",
"+",
"ITEM_SEPARATOR",
"(",
".",
")",
"+",
"schema",
".",
"name",
".",
":",
"param",
"spec",
":",
... | productml/blurr | python | https://github.com/productml/blurr/blob/1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa/blurr/core/schema_loader.py#L22-L58 | [
"def",
"add_schema_spec",
"(",
"self",
",",
"spec",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
",",
"fully_qualified_parent_name",
":",
"str",
"=",
"None",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"if",
"not",
"isinstance",
"(",
"spec",
",",
"dict",... | 1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa |
train | SchemaLoader.add_errors | Adds errors to the error store for the schema | blurr/core/schema_loader.py | def add_errors(self, *errors: Union[BaseSchemaError, SchemaErrorCollection]) -> None:
""" Adds errors to the error store for the schema """
for error in errors:
self._error_cache.add(error) | def add_errors(self, *errors: Union[BaseSchemaError, SchemaErrorCollection]) -> None:
""" Adds errors to the error store for the schema """
for error in errors:
self._error_cache.add(error) | [
"Adds",
"errors",
"to",
"the",
"error",
"store",
"for",
"the",
"schema"
] | productml/blurr | python | https://github.com/productml/blurr/blob/1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa/blurr/core/schema_loader.py#L60-L63 | [
"def",
"add_errors",
"(",
"self",
",",
"*",
"errors",
":",
"Union",
"[",
"BaseSchemaError",
",",
"SchemaErrorCollection",
"]",
")",
"->",
"None",
":",
"for",
"error",
"in",
"errors",
":",
"self",
".",
"_error_cache",
".",
"add",
"(",
"error",
")"
] | 1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa |
train | SchemaLoader.get_schema_object | Used to generate a schema object from the given fully_qualified_name.
:param fully_qualified_name: The fully qualified name of the object needed.
:return: An initialized schema object | blurr/core/schema_loader.py | def get_schema_object(self, fully_qualified_name: str) -> 'BaseSchema':
"""
Used to generate a schema object from the given fully_qualified_name.
:param fully_qualified_name: The fully qualified name of the object needed.
:return: An initialized schema object
"""
if full... | def get_schema_object(self, fully_qualified_name: str) -> 'BaseSchema':
"""
Used to generate a schema object from the given fully_qualified_name.
:param fully_qualified_name: The fully qualified name of the object needed.
:return: An initialized schema object
"""
if full... | [
"Used",
"to",
"generate",
"a",
"schema",
"object",
"from",
"the",
"given",
"fully_qualified_name",
".",
":",
"param",
"fully_qualified_name",
":",
"The",
"fully",
"qualified",
"name",
"of",
"the",
"object",
"needed",
".",
":",
"return",
":",
"An",
"initialized... | productml/blurr | python | https://github.com/productml/blurr/blob/1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa/blurr/core/schema_loader.py#L80-L100 | [
"def",
"get_schema_object",
"(",
"self",
",",
"fully_qualified_name",
":",
"str",
")",
"->",
"'BaseSchema'",
":",
"if",
"fully_qualified_name",
"not",
"in",
"self",
".",
"_schema_cache",
":",
"spec",
"=",
"self",
".",
"get_schema_spec",
"(",
"fully_qualified_name"... | 1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa |
train | SchemaLoader.get_store | Used to generate a store object from the given fully_qualified_name.
:param fully_qualified_name: The fully qualified name of the store object needed.
:return: An initialized store object | blurr/core/schema_loader.py | def get_store(self, fully_qualified_name: str) -> Optional['Store']:
"""
Used to generate a store object from the given fully_qualified_name.
:param fully_qualified_name: The fully qualified name of the store object needed.
:return: An initialized store object
"""
if ful... | def get_store(self, fully_qualified_name: str) -> Optional['Store']:
"""
Used to generate a store object from the given fully_qualified_name.
:param fully_qualified_name: The fully qualified name of the store object needed.
:return: An initialized store object
"""
if ful... | [
"Used",
"to",
"generate",
"a",
"store",
"object",
"from",
"the",
"given",
"fully_qualified_name",
".",
":",
"param",
"fully_qualified_name",
":",
"The",
"fully",
"qualified",
"name",
"of",
"the",
"store",
"object",
"needed",
".",
":",
"return",
":",
"An",
"i... | productml/blurr | python | https://github.com/productml/blurr/blob/1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa/blurr/core/schema_loader.py#L102-L122 | [
"def",
"get_store",
"(",
"self",
",",
"fully_qualified_name",
":",
"str",
")",
"->",
"Optional",
"[",
"'Store'",
"]",
":",
"if",
"fully_qualified_name",
"not",
"in",
"self",
".",
"_store_cache",
":",
"schema",
"=",
"self",
".",
"get_schema_object",
"(",
"ful... | 1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa |
train | SchemaLoader.get_nested_schema_object | Used to generate a schema object from the given fully_qualified_parent_name
and the nested_item_name.
:param fully_qualified_parent_name: The fully qualified name of the parent.
:param nested_item_name: The nested item name.
:return: An initialized schema object of the nested item. | blurr/core/schema_loader.py | def get_nested_schema_object(self, fully_qualified_parent_name: str,
nested_item_name: str) -> Optional['BaseSchema']:
"""
Used to generate a schema object from the given fully_qualified_parent_name
and the nested_item_name.
:param fully_qualified_parent_... | def get_nested_schema_object(self, fully_qualified_parent_name: str,
nested_item_name: str) -> Optional['BaseSchema']:
"""
Used to generate a schema object from the given fully_qualified_parent_name
and the nested_item_name.
:param fully_qualified_parent_... | [
"Used",
"to",
"generate",
"a",
"schema",
"object",
"from",
"the",
"given",
"fully_qualified_parent_name",
"and",
"the",
"nested_item_name",
".",
":",
"param",
"fully_qualified_parent_name",
":",
"The",
"fully",
"qualified",
"name",
"of",
"the",
"parent",
".",
":",... | productml/blurr | python | https://github.com/productml/blurr/blob/1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa/blurr/core/schema_loader.py#L130-L140 | [
"def",
"get_nested_schema_object",
"(",
"self",
",",
"fully_qualified_parent_name",
":",
"str",
",",
"nested_item_name",
":",
"str",
")",
"->",
"Optional",
"[",
"'BaseSchema'",
"]",
":",
"return",
"self",
".",
"get_schema_object",
"(",
"self",
".",
"get_fully_qual... | 1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa |
train | SchemaLoader.get_fully_qualified_name | Returns the fully qualified name by combining the fully_qualified_parent_name
and nested_item_name.
:param fully_qualified_parent_name: The fully qualified name of the parent.
:param nested_item_name: The nested item name.
:return: The fully qualified name of the nested item. | blurr/core/schema_loader.py | def get_fully_qualified_name(fully_qualified_parent_name: str, nested_item_name: str) -> str:
"""
Returns the fully qualified name by combining the fully_qualified_parent_name
and nested_item_name.
:param fully_qualified_parent_name: The fully qualified name of the parent.
:param... | def get_fully_qualified_name(fully_qualified_parent_name: str, nested_item_name: str) -> str:
"""
Returns the fully qualified name by combining the fully_qualified_parent_name
and nested_item_name.
:param fully_qualified_parent_name: The fully qualified name of the parent.
:param... | [
"Returns",
"the",
"fully",
"qualified",
"name",
"by",
"combining",
"the",
"fully_qualified_parent_name",
"and",
"nested_item_name",
".",
":",
"param",
"fully_qualified_parent_name",
":",
"The",
"fully",
"qualified",
"name",
"of",
"the",
"parent",
".",
":",
"param",
... | productml/blurr | python | https://github.com/productml/blurr/blob/1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa/blurr/core/schema_loader.py#L143-L151 | [
"def",
"get_fully_qualified_name",
"(",
"fully_qualified_parent_name",
":",
"str",
",",
"nested_item_name",
":",
"str",
")",
"->",
"str",
":",
"return",
"fully_qualified_parent_name",
"+",
"SchemaLoader",
".",
"ITEM_SEPARATOR",
"+",
"nested_item_name"
] | 1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa |
train | SchemaLoader.get_schema_spec | Used to retrieve the specifications of the schema from the given
fully_qualified_name of schema.
:param fully_qualified_name: The fully qualified name of the schema needed.
:return: Schema dictionary. | blurr/core/schema_loader.py | def get_schema_spec(self, fully_qualified_name: str) -> Dict[str, Any]:
"""
Used to retrieve the specifications of the schema from the given
fully_qualified_name of schema.
:param fully_qualified_name: The fully qualified name of the schema needed.
:return: Schema dictionary.
... | def get_schema_spec(self, fully_qualified_name: str) -> Dict[str, Any]:
"""
Used to retrieve the specifications of the schema from the given
fully_qualified_name of schema.
:param fully_qualified_name: The fully qualified name of the schema needed.
:return: Schema dictionary.
... | [
"Used",
"to",
"retrieve",
"the",
"specifications",
"of",
"the",
"schema",
"from",
"the",
"given",
"fully_qualified_name",
"of",
"schema",
".",
":",
"param",
"fully_qualified_name",
":",
"The",
"fully",
"qualified",
"name",
"of",
"the",
"schema",
"needed",
".",
... | productml/blurr | python | https://github.com/productml/blurr/blob/1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa/blurr/core/schema_loader.py#L153-L164 | [
"def",
"get_schema_spec",
"(",
"self",
",",
"fully_qualified_name",
":",
"str",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"if",
"fully_qualified_name",
"not",
"in",
"self",
".",
"_spec_cache",
":",
"self",
".",
"add_errors",
"(",
"SpecNotFoundErro... | 1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa |
train | SchemaLoader.get_schema_specs_of_type | Returns a list of fully qualified names and schema dictionary tuples for
the schema types provided.
:param schema_types: Schema types.
:return: List of fully qualified names and schema dictionary tuples. | blurr/core/schema_loader.py | def get_schema_specs_of_type(self, *schema_types: Type) -> Dict[str, Dict[str, Any]]:
"""
Returns a list of fully qualified names and schema dictionary tuples for
the schema types provided.
:param schema_types: Schema types.
:return: List of fully qualified names and schema dicti... | def get_schema_specs_of_type(self, *schema_types: Type) -> Dict[str, Dict[str, Any]]:
"""
Returns a list of fully qualified names and schema dictionary tuples for
the schema types provided.
:param schema_types: Schema types.
:return: List of fully qualified names and schema dicti... | [
"Returns",
"a",
"list",
"of",
"fully",
"qualified",
"names",
"and",
"schema",
"dictionary",
"tuples",
"for",
"the",
"schema",
"types",
"provided",
".",
":",
"param",
"schema_types",
":",
"Schema",
"types",
".",
":",
"return",
":",
"List",
"of",
"fully",
"q... | productml/blurr | python | https://github.com/productml/blurr/blob/1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa/blurr/core/schema_loader.py#L175-L187 | [
"def",
"get_schema_specs_of_type",
"(",
"self",
",",
"*",
"schema_types",
":",
"Type",
")",
"->",
"Dict",
"[",
"str",
",",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
":",
"return",
"{",
"fq_name",
":",
"schema",
"for",
"fq_name",
",",
"schema",
"in",
... | 1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa |
train | EvaluationContext.global_add | Adds a key and value to the global dictionary | blurr/core/evaluation.py | def global_add(self, key: str, value: Any) -> None:
"""
Adds a key and value to the global dictionary
"""
self.global_context[key] = value | def global_add(self, key: str, value: Any) -> None:
"""
Adds a key and value to the global dictionary
"""
self.global_context[key] = value | [
"Adds",
"a",
"key",
"and",
"value",
"to",
"the",
"global",
"dictionary"
] | productml/blurr | python | https://github.com/productml/blurr/blob/1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa/blurr/core/evaluation.py#L68-L72 | [
"def",
"global_add",
"(",
"self",
",",
"key",
":",
"str",
",",
"value",
":",
"Any",
")",
"->",
"None",
":",
"self",
".",
"global_context",
"[",
"key",
"]",
"=",
"value"
] | 1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa |
train | EvaluationContext.merge | Merges the provided evaluation context to the current evaluation context.
:param evaluation_context: Evaluation context to merge. | blurr/core/evaluation.py | def merge(self, evaluation_context: 'EvaluationContext') -> None:
"""
Merges the provided evaluation context to the current evaluation context.
:param evaluation_context: Evaluation context to merge.
"""
self.global_context.merge(evaluation_context.global_context)
self.lo... | def merge(self, evaluation_context: 'EvaluationContext') -> None:
"""
Merges the provided evaluation context to the current evaluation context.
:param evaluation_context: Evaluation context to merge.
"""
self.global_context.merge(evaluation_context.global_context)
self.lo... | [
"Merges",
"the",
"provided",
"evaluation",
"context",
"to",
"the",
"current",
"evaluation",
"context",
".",
":",
"param",
"evaluation_context",
":",
"Evaluation",
"context",
"to",
"merge",
"."
] | productml/blurr | python | https://github.com/productml/blurr/blob/1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa/blurr/core/evaluation.py#L91-L97 | [
"def",
"merge",
"(",
"self",
",",
"evaluation_context",
":",
"'EvaluationContext'",
")",
"->",
"None",
":",
"self",
".",
"global_context",
".",
"merge",
"(",
"evaluation_context",
".",
"global_context",
")",
"self",
".",
"local_context",
".",
"merge",
"(",
"ev... | 1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa |
train | Expression.evaluate | Evaluates the expression with the context provided. If the execution
results in failure, an ExpressionEvaluationException encapsulating the
underlying exception is raised.
:param evaluation_context: Global and local context dictionary to be passed for evaluation | blurr/core/evaluation.py | def evaluate(self, evaluation_context: EvaluationContext) -> Any:
"""
Evaluates the expression with the context provided. If the execution
results in failure, an ExpressionEvaluationException encapsulating the
underlying exception is raised.
:param evaluation_context: Global and... | def evaluate(self, evaluation_context: EvaluationContext) -> Any:
"""
Evaluates the expression with the context provided. If the execution
results in failure, an ExpressionEvaluationException encapsulating the
underlying exception is raised.
:param evaluation_context: Global and... | [
"Evaluates",
"the",
"expression",
"with",
"the",
"context",
"provided",
".",
"If",
"the",
"execution",
"results",
"in",
"failure",
"an",
"ExpressionEvaluationException",
"encapsulating",
"the",
"underlying",
"exception",
"is",
"raised",
".",
":",
"param",
"evaluatio... | productml/blurr | python | https://github.com/productml/blurr/blob/1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa/blurr/core/evaluation.py#L120-L149 | [
"def",
"evaluate",
"(",
"self",
",",
"evaluation_context",
":",
"EvaluationContext",
")",
"->",
"Any",
":",
"try",
":",
"if",
"self",
".",
"type",
"==",
"ExpressionType",
".",
"EVAL",
":",
"return",
"eval",
"(",
"self",
".",
"code_object",
",",
"evaluation... | 1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa |
train | _copy_files | Copy all the files in source directory to target.
Ignores subdirectories. | pymagicc/core.py | def _copy_files(source, target):
"""
Copy all the files in source directory to target.
Ignores subdirectories.
"""
source_files = listdir(source)
if not exists(target):
makedirs(target)
for filename in source_files:
full_filename = join(source, filename)
if isfile(fu... | def _copy_files(source, target):
"""
Copy all the files in source directory to target.
Ignores subdirectories.
"""
source_files = listdir(source)
if not exists(target):
makedirs(target)
for filename in source_files:
full_filename = join(source, filename)
if isfile(fu... | [
"Copy",
"all",
"the",
"files",
"in",
"source",
"directory",
"to",
"target",
"."
] | openclimatedata/pymagicc | python | https://github.com/openclimatedata/pymagicc/blob/d896014832cf458d1e95e5878fd6d5961f3e2e05/pymagicc/core.py#L35-L47 | [
"def",
"_copy_files",
"(",
"source",
",",
"target",
")",
":",
"source_files",
"=",
"listdir",
"(",
"source",
")",
"if",
"not",
"exists",
"(",
"target",
")",
":",
"makedirs",
"(",
"target",
")",
"for",
"filename",
"in",
"source_files",
":",
"full_filename",... | d896014832cf458d1e95e5878fd6d5961f3e2e05 |
train | MAGICCBase.create_copy | Initialises a temporary directory structure and copy of MAGICC
configuration files and binary. | pymagicc/core.py | def create_copy(self):
"""
Initialises a temporary directory structure and copy of MAGICC
configuration files and binary.
"""
if self.executable is None or not isfile(self.executable):
raise FileNotFoundError(
"Could not find MAGICC{} executable: {}".f... | def create_copy(self):
"""
Initialises a temporary directory structure and copy of MAGICC
configuration files and binary.
"""
if self.executable is None or not isfile(self.executable):
raise FileNotFoundError(
"Could not find MAGICC{} executable: {}".f... | [
"Initialises",
"a",
"temporary",
"directory",
"structure",
"and",
"copy",
"of",
"MAGICC",
"configuration",
"files",
"and",
"binary",
"."
] | openclimatedata/pymagicc | python | https://github.com/openclimatedata/pymagicc/blob/d896014832cf458d1e95e5878fd6d5961f3e2e05/pymagicc/core.py#L105-L148 | [
"def",
"create_copy",
"(",
"self",
")",
":",
"if",
"self",
".",
"executable",
"is",
"None",
"or",
"not",
"isfile",
"(",
"self",
".",
"executable",
")",
":",
"raise",
"FileNotFoundError",
"(",
"\"Could not find MAGICC{} executable: {}\"",
".",
"format",
"(",
"s... | d896014832cf458d1e95e5878fd6d5961f3e2e05 |
train | MAGICCBase.run | Run MAGICC and parse the output.
As a reminder, putting ``out_parameters=1`` will cause MAGICC to write out its
parameters into ``out/PARAMETERS.OUT`` and they will then be read into
``output.metadata["parameters"]`` where ``output`` is the returned object.
Parameters
---------... | pymagicc/core.py | def run(self, scenario=None, only=None, **kwargs):
"""
Run MAGICC and parse the output.
As a reminder, putting ``out_parameters=1`` will cause MAGICC to write out its
parameters into ``out/PARAMETERS.OUT`` and they will then be read into
``output.metadata["parameters"]`` where `... | def run(self, scenario=None, only=None, **kwargs):
"""
Run MAGICC and parse the output.
As a reminder, putting ``out_parameters=1`` will cause MAGICC to write out its
parameters into ``out/PARAMETERS.OUT`` and they will then be read into
``output.metadata["parameters"]`` where `... | [
"Run",
"MAGICC",
"and",
"parse",
"the",
"output",
"."
] | openclimatedata/pymagicc | python | https://github.com/openclimatedata/pymagicc/blob/d896014832cf458d1e95e5878fd6d5961f3e2e05/pymagicc/core.py#L170-L274 | [
"def",
"run",
"(",
"self",
",",
"scenario",
"=",
"None",
",",
"only",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"exists",
"(",
"self",
".",
"root_dir",
")",
":",
"raise",
"FileNotFoundError",
"(",
"self",
".",
"root_dir",
")",
"i... | d896014832cf458d1e95e5878fd6d5961f3e2e05 |
train | MAGICCBase.check_config | Check that our MAGICC ``.CFG`` files are set to safely work with PYMAGICC
For further detail about why this is required, please see :ref:`MAGICC flags`.
Raises
------
ValueError
If we are not certain that the config written by PYMAGICC will overwrite
all other c... | pymagicc/core.py | def check_config(self):
"""Check that our MAGICC ``.CFG`` files are set to safely work with PYMAGICC
For further detail about why this is required, please see :ref:`MAGICC flags`.
Raises
------
ValueError
If we are not certain that the config written by PYMAGICC wil... | def check_config(self):
"""Check that our MAGICC ``.CFG`` files are set to safely work with PYMAGICC
For further detail about why this is required, please see :ref:`MAGICC flags`.
Raises
------
ValueError
If we are not certain that the config written by PYMAGICC wil... | [
"Check",
"that",
"our",
"MAGICC",
".",
"CFG",
"files",
"are",
"set",
"to",
"safely",
"work",
"with",
"PYMAGICC"
] | openclimatedata/pymagicc | python | https://github.com/openclimatedata/pymagicc/blob/d896014832cf458d1e95e5878fd6d5961f3e2e05/pymagicc/core.py#L293-L331 | [
"def",
"check_config",
"(",
"self",
")",
":",
"cfg_error_msg",
"=",
"(",
"\"PYMAGICC is not the only tuning model that will be used by \"",
"\"`MAGCFG_USER.CFG`: your run is likely to fail/do odd things\"",
")",
"emisscen_error_msg",
"=",
"(",
"\"You have more than one `FILE_EMISSCEN_X... | d896014832cf458d1e95e5878fd6d5961f3e2e05 |
train | MAGICCBase.write | Write an input file to disk
Parameters
----------
mdata : :obj:`pymagicc.io.MAGICCData`
A MAGICCData instance with the data to write
name : str
The name of the file to write. The file will be written to the MAGICC
instance's run directory i.e. ``self... | pymagicc/core.py | def write(self, mdata, name):
"""Write an input file to disk
Parameters
----------
mdata : :obj:`pymagicc.io.MAGICCData`
A MAGICCData instance with the data to write
name : str
The name of the file to write. The file will be written to the MAGICC
... | def write(self, mdata, name):
"""Write an input file to disk
Parameters
----------
mdata : :obj:`pymagicc.io.MAGICCData`
A MAGICCData instance with the data to write
name : str
The name of the file to write. The file will be written to the MAGICC
... | [
"Write",
"an",
"input",
"file",
"to",
"disk"
] | openclimatedata/pymagicc | python | https://github.com/openclimatedata/pymagicc/blob/d896014832cf458d1e95e5878fd6d5961f3e2e05/pymagicc/core.py#L333-L345 | [
"def",
"write",
"(",
"self",
",",
"mdata",
",",
"name",
")",
":",
"mdata",
".",
"write",
"(",
"join",
"(",
"self",
".",
"run_dir",
",",
"name",
")",
",",
"self",
".",
"version",
")"
] | d896014832cf458d1e95e5878fd6d5961f3e2e05 |
train | MAGICCBase.read_parameters | Read a parameters.out file
Returns
-------
dict
A dictionary containing all the configuration used by MAGICC | pymagicc/core.py | def read_parameters(self):
"""
Read a parameters.out file
Returns
-------
dict
A dictionary containing all the configuration used by MAGICC
"""
param_fname = join(self.out_dir, "PARAMETERS.OUT")
if not exists(param_fname):
raise F... | def read_parameters(self):
"""
Read a parameters.out file
Returns
-------
dict
A dictionary containing all the configuration used by MAGICC
"""
param_fname = join(self.out_dir, "PARAMETERS.OUT")
if not exists(param_fname):
raise F... | [
"Read",
"a",
"parameters",
".",
"out",
"file"
] | openclimatedata/pymagicc | python | https://github.com/openclimatedata/pymagicc/blob/d896014832cf458d1e95e5878fd6d5961f3e2e05/pymagicc/core.py#L347-L369 | [
"def",
"read_parameters",
"(",
"self",
")",
":",
"param_fname",
"=",
"join",
"(",
"self",
".",
"out_dir",
",",
"\"PARAMETERS.OUT\"",
")",
"if",
"not",
"exists",
"(",
"param_fname",
")",
":",
"raise",
"FileNotFoundError",
"(",
"\"No PARAMETERS.OUT found\"",
")",
... | d896014832cf458d1e95e5878fd6d5961f3e2e05 |
train | MAGICCBase.remove_temp_copy | Removes a temporary copy of the MAGICC version shipped with Pymagicc. | pymagicc/core.py | def remove_temp_copy(self):
"""
Removes a temporary copy of the MAGICC version shipped with Pymagicc.
"""
if self.is_temp and self.root_dir is not None:
shutil.rmtree(self.root_dir)
self.root_dir = None | def remove_temp_copy(self):
"""
Removes a temporary copy of the MAGICC version shipped with Pymagicc.
"""
if self.is_temp and self.root_dir is not None:
shutil.rmtree(self.root_dir)
self.root_dir = None | [
"Removes",
"a",
"temporary",
"copy",
"of",
"the",
"MAGICC",
"version",
"shipped",
"with",
"Pymagicc",
"."
] | openclimatedata/pymagicc | python | https://github.com/openclimatedata/pymagicc/blob/d896014832cf458d1e95e5878fd6d5961f3e2e05/pymagicc/core.py#L371-L377 | [
"def",
"remove_temp_copy",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_temp",
"and",
"self",
".",
"root_dir",
"is",
"not",
"None",
":",
"shutil",
".",
"rmtree",
"(",
"self",
".",
"root_dir",
")",
"self",
".",
"root_dir",
"=",
"None"
] | d896014832cf458d1e95e5878fd6d5961f3e2e05 |
train | MAGICCBase.set_config | Create a configuration file for MAGICC.
Writes a fortran namelist in run_dir.
Parameters
----------
filename : str
Name of configuration file to write
top_level_key : str
Name of namelist to be written in the
configuration file
kwar... | pymagicc/core.py | def set_config(
self, filename="MAGTUNE_PYMAGICC.CFG", top_level_key="nml_allcfgs", **kwargs
):
"""
Create a configuration file for MAGICC.
Writes a fortran namelist in run_dir.
Parameters
----------
filename : str
Name of configuration file to w... | def set_config(
self, filename="MAGTUNE_PYMAGICC.CFG", top_level_key="nml_allcfgs", **kwargs
):
"""
Create a configuration file for MAGICC.
Writes a fortran namelist in run_dir.
Parameters
----------
filename : str
Name of configuration file to w... | [
"Create",
"a",
"configuration",
"file",
"for",
"MAGICC",
"."
] | openclimatedata/pymagicc | python | https://github.com/openclimatedata/pymagicc/blob/d896014832cf458d1e95e5878fd6d5961f3e2e05/pymagicc/core.py#L379-L411 | [
"def",
"set_config",
"(",
"self",
",",
"filename",
"=",
"\"MAGTUNE_PYMAGICC.CFG\"",
",",
"top_level_key",
"=",
"\"nml_allcfgs\"",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"self",
".",
"_format_config",
"(",
"kwargs",
")",
"fname",
"=",
"join",
"(",
... | d896014832cf458d1e95e5878fd6d5961f3e2e05 |
train | MAGICCBase.update_config | Updates a configuration file for MAGICC
Updates the contents of a fortran namelist in the run directory,
creating a new namelist if none exists.
Parameters
----------
filename : str
Name of configuration file to write
top_level_key : str
Name of... | pymagicc/core.py | def update_config(
self, filename="MAGTUNE_PYMAGICC.CFG", top_level_key="nml_allcfgs", **kwargs
):
"""Updates a configuration file for MAGICC
Updates the contents of a fortran namelist in the run directory,
creating a new namelist if none exists.
Parameters
--------... | def update_config(
self, filename="MAGTUNE_PYMAGICC.CFG", top_level_key="nml_allcfgs", **kwargs
):
"""Updates a configuration file for MAGICC
Updates the contents of a fortran namelist in the run directory,
creating a new namelist if none exists.
Parameters
--------... | [
"Updates",
"a",
"configuration",
"file",
"for",
"MAGICC"
] | openclimatedata/pymagicc | python | https://github.com/openclimatedata/pymagicc/blob/d896014832cf458d1e95e5878fd6d5961f3e2e05/pymagicc/core.py#L413-L450 | [
"def",
"update_config",
"(",
"self",
",",
"filename",
"=",
"\"MAGTUNE_PYMAGICC.CFG\"",
",",
"top_level_key",
"=",
"\"nml_allcfgs\"",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"self",
".",
"_format_config",
"(",
"kwargs",
")",
"fname",
"=",
"join",
"(... | d896014832cf458d1e95e5878fd6d5961f3e2e05 |
train | MAGICCBase.set_zero_config | Set config such that radiative forcing and temperature output will be zero
This method is intended as a convenience only, it does not handle everything in
an obvious way. Adjusting the parameter settings still requires great care and
may behave unepexctedly. | pymagicc/core.py | def set_zero_config(self):
"""Set config such that radiative forcing and temperature output will be zero
This method is intended as a convenience only, it does not handle everything in
an obvious way. Adjusting the parameter settings still requires great care and
may behave unepexctedly... | def set_zero_config(self):
"""Set config such that radiative forcing and temperature output will be zero
This method is intended as a convenience only, it does not handle everything in
an obvious way. Adjusting the parameter settings still requires great care and
may behave unepexctedly... | [
"Set",
"config",
"such",
"that",
"radiative",
"forcing",
"and",
"temperature",
"output",
"will",
"be",
"zero"
] | openclimatedata/pymagicc | python | https://github.com/openclimatedata/pymagicc/blob/d896014832cf458d1e95e5878fd6d5961f3e2e05/pymagicc/core.py#L452-L574 | [
"def",
"set_zero_config",
"(",
"self",
")",
":",
"# zero_emissions is imported from scenarios module",
"zero_emissions",
".",
"write",
"(",
"join",
"(",
"self",
".",
"run_dir",
",",
"self",
".",
"_scen_file_name",
")",
",",
"self",
".",
"version",
")",
"time",
"... | d896014832cf458d1e95e5878fd6d5961f3e2e05 |
train | MAGICCBase.set_years | Set the start and end dates of the simulations.
Parameters
----------
startyear : int
Start year of the simulation
endyear : int
End year of the simulation
Returns
-------
dict
The contents of the namelist | pymagicc/core.py | def set_years(self, startyear=1765, endyear=2100):
"""
Set the start and end dates of the simulations.
Parameters
----------
startyear : int
Start year of the simulation
endyear : int
End year of the simulation
Returns
-------
... | def set_years(self, startyear=1765, endyear=2100):
"""
Set the start and end dates of the simulations.
Parameters
----------
startyear : int
Start year of the simulation
endyear : int
End year of the simulation
Returns
-------
... | [
"Set",
"the",
"start",
"and",
"end",
"dates",
"of",
"the",
"simulations",
"."
] | openclimatedata/pymagicc | python | https://github.com/openclimatedata/pymagicc/blob/d896014832cf458d1e95e5878fd6d5961f3e2e05/pymagicc/core.py#L606-L630 | [
"def",
"set_years",
"(",
"self",
",",
"startyear",
"=",
"1765",
",",
"endyear",
"=",
"2100",
")",
":",
"# TODO: test altering stepsperyear, I think 1, 2 and 24 should all work",
"return",
"self",
".",
"set_config",
"(",
"\"MAGCFG_NMLYEARS.CFG\"",
",",
"\"nml_years\"",
"... | d896014832cf458d1e95e5878fd6d5961f3e2e05 |
train | MAGICCBase.set_output_variables | Set the output configuration, minimising output as much as possible
There are a number of configuration parameters which control which variables
are written to file and in which format. Limiting the variables that are
written to file can greatly speed up the running of MAGICC. By default,
... | pymagicc/core.py | def set_output_variables(self, write_ascii=True, write_binary=False, **kwargs):
"""Set the output configuration, minimising output as much as possible
There are a number of configuration parameters which control which variables
are written to file and in which format. Limiting the variables tha... | def set_output_variables(self, write_ascii=True, write_binary=False, **kwargs):
"""Set the output configuration, minimising output as much as possible
There are a number of configuration parameters which control which variables
are written to file and in which format. Limiting the variables tha... | [
"Set",
"the",
"output",
"configuration",
"minimising",
"output",
"as",
"much",
"as",
"possible"
] | openclimatedata/pymagicc | python | https://github.com/openclimatedata/pymagicc/blob/d896014832cf458d1e95e5878fd6d5961f3e2e05/pymagicc/core.py#L632-L735 | [
"def",
"set_output_variables",
"(",
"self",
",",
"write_ascii",
"=",
"True",
",",
"write_binary",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"assert",
"(",
"write_ascii",
"or",
"write_binary",
")",
",",
"\"write_binary and/or write_ascii must be configured\"",... | d896014832cf458d1e95e5878fd6d5961f3e2e05 |
train | MAGICCBase.diagnose_tcr_ecs | Diagnose TCR and ECS
The transient climate response (TCR), is the global-mean temperature response
at time at which atmopsheric |CO2| concentrations double in a scenario where
atmospheric |CO2| concentrations are increased at 1% per year from
pre-industrial levels.
The equilibr... | pymagicc/core.py | def diagnose_tcr_ecs(self, **kwargs):
"""Diagnose TCR and ECS
The transient climate response (TCR), is the global-mean temperature response
at time at which atmopsheric |CO2| concentrations double in a scenario where
atmospheric |CO2| concentrations are increased at 1% per year from
... | def diagnose_tcr_ecs(self, **kwargs):
"""Diagnose TCR and ECS
The transient climate response (TCR), is the global-mean temperature response
at time at which atmopsheric |CO2| concentrations double in a scenario where
atmospheric |CO2| concentrations are increased at 1% per year from
... | [
"Diagnose",
"TCR",
"and",
"ECS"
] | openclimatedata/pymagicc | python | https://github.com/openclimatedata/pymagicc/blob/d896014832cf458d1e95e5878fd6d5961f3e2e05/pymagicc/core.py#L740-L783 | [
"def",
"diagnose_tcr_ecs",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"version",
"==",
"7",
":",
"raise",
"NotImplementedError",
"(",
"\"MAGICC7 cannot yet diagnose ECS and TCR\"",
")",
"self",
".",
"_diagnose_tcr_ecs_config_setup",
"(",
"*... | d896014832cf458d1e95e5878fd6d5961f3e2e05 |
train | MAGICCBase.set_emission_scenario_setup | Set the emissions flags correctly.
Parameters
----------
scenario : :obj:`pymagicc.io.MAGICCData`
Scenario to run.
config_dict : dict
Dictionary with current input configurations which is to be validated and
updated where necessary.
Returns
... | pymagicc/core.py | def set_emission_scenario_setup(self, scenario, config_dict):
"""Set the emissions flags correctly.
Parameters
----------
scenario : :obj:`pymagicc.io.MAGICCData`
Scenario to run.
config_dict : dict
Dictionary with current input configurations which is t... | def set_emission_scenario_setup(self, scenario, config_dict):
"""Set the emissions flags correctly.
Parameters
----------
scenario : :obj:`pymagicc.io.MAGICCData`
Scenario to run.
config_dict : dict
Dictionary with current input configurations which is t... | [
"Set",
"the",
"emissions",
"flags",
"correctly",
"."
] | openclimatedata/pymagicc | python | https://github.com/openclimatedata/pymagicc/blob/d896014832cf458d1e95e5878fd6d5961f3e2e05/pymagicc/core.py#L903-L925 | [
"def",
"set_emission_scenario_setup",
"(",
"self",
",",
"scenario",
",",
"config_dict",
")",
":",
"self",
".",
"write",
"(",
"scenario",
",",
"self",
".",
"_scen_file_name",
")",
"# can be lazy in this line as fix backwards key handles errors for us",
"config_dict",
"[",
... | d896014832cf458d1e95e5878fd6d5961f3e2e05 |
train | Type.contains | Checks if a type is defined | blurr/core/type.py | def contains(value: Union[str, 'Type']) -> bool:
""" Checks if a type is defined """
if isinstance(value, str):
return any(value.lower() == i.value for i in Type)
return any(value == i for i in Type) | def contains(value: Union[str, 'Type']) -> bool:
""" Checks if a type is defined """
if isinstance(value, str):
return any(value.lower() == i.value for i in Type)
return any(value == i for i in Type) | [
"Checks",
"if",
"a",
"type",
"is",
"defined"
] | productml/blurr | python | https://github.com/productml/blurr/blob/1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa/blurr/core/type.py#L48-L53 | [
"def",
"contains",
"(",
"value",
":",
"Union",
"[",
"str",
",",
"'Type'",
"]",
")",
"->",
"bool",
":",
"if",
"isinstance",
"(",
"value",
",",
"str",
")",
":",
"return",
"any",
"(",
"value",
".",
"lower",
"(",
")",
"==",
"i",
".",
"value",
"for",
... | 1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa |
train | xml_replace | Read the content of an XML template file (XMLT), apply the given
`replacements` to its substitution markers, and write the result into
an XML file with the same name but ending with `xml` instead of `xmlt`.
First, we write an XMLT file, containing a regular HTML comment, a
readily defined element `e1`... | hydpy/exe/replacetools.py | def xml_replace(filename, **replacements):
"""Read the content of an XML template file (XMLT), apply the given
`replacements` to its substitution markers, and write the result into
an XML file with the same name but ending with `xml` instead of `xmlt`.
First, we write an XMLT file, containing a regula... | def xml_replace(filename, **replacements):
"""Read the content of an XML template file (XMLT), apply the given
`replacements` to its substitution markers, and write the result into
an XML file with the same name but ending with `xml` instead of `xmlt`.
First, we write an XMLT file, containing a regula... | [
"Read",
"the",
"content",
"of",
"an",
"XML",
"template",
"file",
"(",
"XMLT",
")",
"apply",
"the",
"given",
"replacements",
"to",
"its",
"substitution",
"markers",
"and",
"write",
"the",
"result",
"into",
"an",
"XML",
"file",
"with",
"the",
"same",
"name",... | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/replacetools.py#L9-L211 | [
"def",
"xml_replace",
"(",
"filename",
",",
"*",
"*",
"replacements",
")",
":",
"keywords",
"=",
"set",
"(",
"replacements",
".",
"keys",
"(",
")",
")",
"templatename",
"=",
"f'{filename}.xmlt'",
"targetname",
"=",
"f'{filename}.xml'",
"print",
"(",
"f'templat... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | IndexerProperty._calcidxs | Return the required indexes based on the given lambda function
and the |Timegrids| object handled by module |pub|. Raise a
|RuntimeError| if the latter is not available. | hydpy/core/indextools.py | def _calcidxs(func):
"""Return the required indexes based on the given lambda function
and the |Timegrids| object handled by module |pub|. Raise a
|RuntimeError| if the latter is not available.
"""
timegrids = hydpy.pub.get('timegrids')
if timegrids is None:
... | def _calcidxs(func):
"""Return the required indexes based on the given lambda function
and the |Timegrids| object handled by module |pub|. Raise a
|RuntimeError| if the latter is not available.
"""
timegrids = hydpy.pub.get('timegrids')
if timegrids is None:
... | [
"Return",
"the",
"required",
"indexes",
"based",
"on",
"the",
"given",
"lambda",
"function",
"and",
"the",
"|Timegrids|",
"object",
"handled",
"by",
"module",
"|pub|",
".",
"Raise",
"a",
"|RuntimeError|",
"if",
"the",
"latter",
"is",
"not",
"available",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/indextools.py#L132-L151 | [
"def",
"_calcidxs",
"(",
"func",
")",
":",
"timegrids",
"=",
"hydpy",
".",
"pub",
".",
"get",
"(",
"'timegrids'",
")",
"if",
"timegrids",
"is",
"None",
":",
"raise",
"RuntimeError",
"(",
"'An Indexer object has been asked for an %s array. Such an '",
"'array has ne... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Indexer.dayofyear | Day of the year index (the first of January = 0...).
For reasons of consistency between leap years and non-leap years,
assuming a daily time step, index 59 is always associated with the
29th of February. Hence, it is missing in non-leap years:
>>> from hydpy import pub
>>> fro... | hydpy/core/indextools.py | def dayofyear(self):
"""Day of the year index (the first of January = 0...).
For reasons of consistency between leap years and non-leap years,
assuming a daily time step, index 59 is always associated with the
29th of February. Hence, it is missing in non-leap years:
>>> from ... | def dayofyear(self):
"""Day of the year index (the first of January = 0...).
For reasons of consistency between leap years and non-leap years,
assuming a daily time step, index 59 is always associated with the
29th of February. Hence, it is missing in non-leap years:
>>> from ... | [
"Day",
"of",
"the",
"year",
"index",
"(",
"the",
"first",
"of",
"January",
"=",
"0",
"...",
")",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/indextools.py#L188-L207 | [
"def",
"dayofyear",
"(",
"self",
")",
":",
"def",
"_dayofyear",
"(",
"date",
")",
":",
"return",
"(",
"date",
".",
"dayofyear",
"-",
"1",
"+",
"(",
"(",
"date",
".",
"month",
">",
"2",
")",
"and",
"(",
"not",
"date",
".",
"leapyear",
")",
")",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Indexer.timeofyear | Time of the year index (first simulation step of each year = 0...).
The property |Indexer.timeofyear| is best explained through
comparing it with property |Indexer.dayofyear|:
Let us reconsider one of the examples of the documentation on
property |Indexer.dayofyear|:
>>> from ... | hydpy/core/indextools.py | def timeofyear(self):
"""Time of the year index (first simulation step of each year = 0...).
The property |Indexer.timeofyear| is best explained through
comparing it with property |Indexer.dayofyear|:
Let us reconsider one of the examples of the documentation on
property |Index... | def timeofyear(self):
"""Time of the year index (first simulation step of each year = 0...).
The property |Indexer.timeofyear| is best explained through
comparing it with property |Indexer.dayofyear|:
Let us reconsider one of the examples of the documentation on
property |Index... | [
"Time",
"of",
"the",
"year",
"index",
"(",
"first",
"simulation",
"step",
"of",
"each",
"year",
"=",
"0",
"...",
")",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/indextools.py#L210-L261 | [
"def",
"timeofyear",
"(",
"self",
")",
":",
"refgrid",
"=",
"timetools",
".",
"Timegrid",
"(",
"timetools",
".",
"Date",
"(",
"'2000.01.01'",
")",
",",
"timetools",
".",
"Date",
"(",
"'2001.01.01'",
")",
",",
"hydpy",
".",
"pub",
".",
"timegrids",
".",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | BaseProperty.set_doc | Assign the given docstring to the property instance and, if
possible, to the `__test__` dictionary of the module of its
owner class. | hydpy/core/propertytools.py | def set_doc(self, doc: str):
"""Assign the given docstring to the property instance and, if
possible, to the `__test__` dictionary of the module of its
owner class."""
self.__doc__ = doc
if hasattr(self, 'module'):
ref = f'{self.objtype.__name__}.{self.name}'
... | def set_doc(self, doc: str):
"""Assign the given docstring to the property instance and, if
possible, to the `__test__` dictionary of the module of its
owner class."""
self.__doc__ = doc
if hasattr(self, 'module'):
ref = f'{self.objtype.__name__}.{self.name}'
... | [
"Assign",
"the",
"given",
"docstring",
"to",
"the",
"property",
"instance",
"and",
"if",
"possible",
"to",
"the",
"__test__",
"dictionary",
"of",
"the",
"module",
"of",
"its",
"owner",
"class",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/propertytools.py#L139-L146 | [
"def",
"set_doc",
"(",
"self",
",",
"doc",
":",
"str",
")",
":",
"self",
".",
"__doc__",
"=",
"doc",
"if",
"hasattr",
"(",
"self",
",",
"'module'",
")",
":",
"ref",
"=",
"f'{self.objtype.__name__}.{self.name}'",
"self",
".",
"module",
".",
"__dict__",
"[... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | BaseProperty.getter_ | Add the given getter function and its docstring to the
property and return it. | hydpy/core/propertytools.py | def getter_(self, fget) -> 'BaseProperty':
"""Add the given getter function and its docstring to the
property and return it."""
self.fget = fget
self.set_doc(fget.__doc__)
return self | def getter_(self, fget) -> 'BaseProperty':
"""Add the given getter function and its docstring to the
property and return it."""
self.fget = fget
self.set_doc(fget.__doc__)
return self | [
"Add",
"the",
"given",
"getter",
"function",
"and",
"its",
"docstring",
"to",
"the",
"property",
"and",
"return",
"it",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/propertytools.py#L160-L165 | [
"def",
"getter_",
"(",
"self",
",",
"fget",
")",
"->",
"'BaseProperty'",
":",
"self",
".",
"fget",
"=",
"fget",
"self",
".",
"set_doc",
"(",
"fget",
".",
"__doc__",
")",
"return",
"self"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | ProtectedProperty.isready | Return |True| or |False| to indicate if the protected
property is ready for the given object. If the object is
unknow, |ProtectedProperty| returns |False|. | hydpy/core/propertytools.py | def isready(self, obj) -> bool:
"""Return |True| or |False| to indicate if the protected
property is ready for the given object. If the object is
unknow, |ProtectedProperty| returns |False|."""
return vars(obj).get(self.name, False) | def isready(self, obj) -> bool:
"""Return |True| or |False| to indicate if the protected
property is ready for the given object. If the object is
unknow, |ProtectedProperty| returns |False|."""
return vars(obj).get(self.name, False) | [
"Return",
"|True|",
"or",
"|False|",
"to",
"indicate",
"if",
"the",
"protected",
"property",
"is",
"ready",
"for",
"the",
"given",
"object",
".",
"If",
"the",
"object",
"is",
"unknow",
"|ProtectedProperty|",
"returns",
"|False|",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/propertytools.py#L276-L280 | [
"def",
"isready",
"(",
"self",
",",
"obj",
")",
"->",
"bool",
":",
"return",
"vars",
"(",
"obj",
")",
".",
"get",
"(",
"self",
".",
"name",
",",
"False",
")"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | ProtectedProperties.allready | Return |True| or |False| to indicate whether all protected
properties are ready or not. | hydpy/core/propertytools.py | def allready(self, obj) -> bool:
"""Return |True| or |False| to indicate whether all protected
properties are ready or not."""
for prop in self.__properties:
if not prop.isready(obj):
return False
return True | def allready(self, obj) -> bool:
"""Return |True| or |False| to indicate whether all protected
properties are ready or not."""
for prop in self.__properties:
if not prop.isready(obj):
return False
return True | [
"Return",
"|True|",
"or",
"|False|",
"to",
"indicate",
"whether",
"all",
"protected",
"properties",
"are",
"ready",
"or",
"not",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/propertytools.py#L324-L330 | [
"def",
"allready",
"(",
"self",
",",
"obj",
")",
"->",
"bool",
":",
"for",
"prop",
"in",
"self",
".",
"__properties",
":",
"if",
"not",
"prop",
".",
"isready",
"(",
"obj",
")",
":",
"return",
"False",
"return",
"True"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | DefaultProperty.call_fget | Return the predefined custom value when available, otherwise,
the value defined by the getter function. | hydpy/core/propertytools.py | def call_fget(self, obj) -> Any:
"""Return the predefined custom value when available, otherwise,
the value defined by the getter function."""
custom = vars(obj).get(self.name)
if custom is None:
return self.fget(obj)
return custom | def call_fget(self, obj) -> Any:
"""Return the predefined custom value when available, otherwise,
the value defined by the getter function."""
custom = vars(obj).get(self.name)
if custom is None:
return self.fget(obj)
return custom | [
"Return",
"the",
"predefined",
"custom",
"value",
"when",
"available",
"otherwise",
"the",
"value",
"defined",
"by",
"the",
"getter",
"function",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/propertytools.py#L528-L534 | [
"def",
"call_fget",
"(",
"self",
",",
"obj",
")",
"->",
"Any",
":",
"custom",
"=",
"vars",
"(",
"obj",
")",
".",
"get",
"(",
"self",
".",
"name",
")",
"if",
"custom",
"is",
"None",
":",
"return",
"self",
".",
"fget",
"(",
"obj",
")",
"return",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | DefaultProperty.call_fset | Store the given custom value and call the setter function. | hydpy/core/propertytools.py | def call_fset(self, obj, value) -> None:
"""Store the given custom value and call the setter function."""
vars(obj)[self.name] = self.fset(obj, value) | def call_fset(self, obj, value) -> None:
"""Store the given custom value and call the setter function."""
vars(obj)[self.name] = self.fset(obj, value) | [
"Store",
"the",
"given",
"custom",
"value",
"and",
"call",
"the",
"setter",
"function",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/propertytools.py#L536-L538 | [
"def",
"call_fset",
"(",
"self",
",",
"obj",
",",
"value",
")",
"->",
"None",
":",
"vars",
"(",
"obj",
")",
"[",
"self",
".",
"name",
"]",
"=",
"self",
".",
"fset",
"(",
"obj",
",",
"value",
")"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | DefaultProperty.call_fdel | Remove the predefined custom value and call the delete function. | hydpy/core/propertytools.py | def call_fdel(self, obj) -> None:
"""Remove the predefined custom value and call the delete function."""
self.fdel(obj)
try:
del vars(obj)[self.name]
except KeyError:
pass | def call_fdel(self, obj) -> None:
"""Remove the predefined custom value and call the delete function."""
self.fdel(obj)
try:
del vars(obj)[self.name]
except KeyError:
pass | [
"Remove",
"the",
"predefined",
"custom",
"value",
"and",
"call",
"the",
"delete",
"function",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/propertytools.py#L540-L546 | [
"def",
"call_fdel",
"(",
"self",
",",
"obj",
")",
"->",
"None",
":",
"self",
".",
"fdel",
"(",
"obj",
")",
"try",
":",
"del",
"vars",
"(",
"obj",
")",
"[",
"self",
".",
"name",
"]",
"except",
"KeyError",
":",
"pass"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | RelWZ.trim | Trim upper values in accordance with :math:`RelWB \\leq RelWZ`.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> nhru(3)
>>> lnk(ACKER)
>>> relwb.values = 0.5
>>> relwz(0.2, 0.5, 0.8)
>>> relwz
relwz(0.5, 0.5, 0.8) | hydpy/models/lland/lland_control.py | def trim(self, lower=None, upper=None):
"""Trim upper values in accordance with :math:`RelWB \\leq RelWZ`.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> nhru(3)
>>> lnk(ACKER)
>>> relwb.values = 0.5
>>> relwz(0.2, 0.5, 0.8)
>>> relwz
... | def trim(self, lower=None, upper=None):
"""Trim upper values in accordance with :math:`RelWB \\leq RelWZ`.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> nhru(3)
>>> lnk(ACKER)
>>> relwb.values = 0.5
>>> relwz(0.2, 0.5, 0.8)
>>> relwz
... | [
"Trim",
"upper",
"values",
"in",
"accordance",
"with",
":",
"math",
":",
"RelWB",
"\\\\",
"leq",
"RelWZ",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_control.py#L313-L327 | [
"def",
"trim",
"(",
"self",
",",
"lower",
"=",
"None",
",",
"upper",
"=",
"None",
")",
":",
"if",
"lower",
"is",
"None",
":",
"lower",
"=",
"getattr",
"(",
"self",
".",
"subpars",
".",
"relwb",
",",
"'value'",
",",
"None",
")",
"lland_parameters",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | RelWB.trim | Trim upper values in accordance with :math:`RelWB \\leq RelWZ`.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> nhru(3)
>>> lnk(ACKER)
>>> relwz.values = 0.5
>>> relwb(0.2, 0.5, 0.8)
>>> relwb
relwb(0.2, 0.5, 0.5) | hydpy/models/lland/lland_control.py | def trim(self, lower=None, upper=None):
"""Trim upper values in accordance with :math:`RelWB \\leq RelWZ`.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> nhru(3)
>>> lnk(ACKER)
>>> relwz.values = 0.5
>>> relwb(0.2, 0.5, 0.8)
>>> relwb
... | def trim(self, lower=None, upper=None):
"""Trim upper values in accordance with :math:`RelWB \\leq RelWZ`.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> nhru(3)
>>> lnk(ACKER)
>>> relwz.values = 0.5
>>> relwb(0.2, 0.5, 0.8)
>>> relwb
... | [
"Trim",
"upper",
"values",
"in",
"accordance",
"with",
":",
"math",
":",
"RelWB",
"\\\\",
"leq",
"RelWZ",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_control.py#L336-L350 | [
"def",
"trim",
"(",
"self",
",",
"lower",
"=",
"None",
",",
"upper",
"=",
"None",
")",
":",
"if",
"upper",
"is",
"None",
":",
"upper",
"=",
"getattr",
"(",
"self",
".",
"subpars",
".",
"relwz",
",",
"'value'",
",",
"None",
")",
"lland_parameters",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | EQB.trim | Trim upper values in accordance with :math:`EQI1 \\leq EQB`.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> eqi1.value = 2.0
>>> eqb(1.0)
>>> eqb
eqb(2.0)
>>> eqb(2.0)
>>> eqb
eqb(2.0)
>>> eqb(3.0)
>>> eqb
... | hydpy/models/lland/lland_control.py | def trim(self, lower=None, upper=None):
"""Trim upper values in accordance with :math:`EQI1 \\leq EQB`.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> eqi1.value = 2.0
>>> eqb(1.0)
>>> eqb
eqb(2.0)
>>> eqb(2.0)
>>> eqb
eq... | def trim(self, lower=None, upper=None):
"""Trim upper values in accordance with :math:`EQI1 \\leq EQB`.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> eqi1.value = 2.0
>>> eqb(1.0)
>>> eqb
eqb(2.0)
>>> eqb(2.0)
>>> eqb
eq... | [
"Trim",
"upper",
"values",
"in",
"accordance",
"with",
":",
"math",
":",
"EQI1",
"\\\\",
"leq",
"EQB",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_control.py#L661-L679 | [
"def",
"trim",
"(",
"self",
",",
"lower",
"=",
"None",
",",
"upper",
"=",
"None",
")",
":",
"if",
"lower",
"is",
"None",
":",
"lower",
"=",
"getattr",
"(",
"self",
".",
"subpars",
".",
"eqi1",
",",
"'value'",
",",
"None",
")",
"super",
"(",
")",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | EQI1.trim | Trim upper values in accordance with
:math:`EQI2 \\leq EQI1 \\leq EQB`.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> eqb.value = 3.0
>>> eqi2.value = 1.0
>>> eqi1(0.0)
>>> eqi1
eqi1(1.0)
>>> eqi1(1.0)
>>> eqi1
e... | hydpy/models/lland/lland_control.py | def trim(self, lower=None, upper=None):
"""Trim upper values in accordance with
:math:`EQI2 \\leq EQI1 \\leq EQB`.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> eqb.value = 3.0
>>> eqi2.value = 1.0
>>> eqi1(0.0)
>>> eqi1
eqi1(1.... | def trim(self, lower=None, upper=None):
"""Trim upper values in accordance with
:math:`EQI2 \\leq EQI1 \\leq EQB`.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> eqb.value = 3.0
>>> eqi2.value = 1.0
>>> eqi1(0.0)
>>> eqi1
eqi1(1.... | [
"Trim",
"upper",
"values",
"in",
"accordance",
"with",
":",
"math",
":",
"EQI2",
"\\\\",
"leq",
"EQI1",
"\\\\",
"leq",
"EQB",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/lland/lland_control.py#L689-L717 | [
"def",
"trim",
"(",
"self",
",",
"lower",
"=",
"None",
",",
"upper",
"=",
"None",
")",
":",
"if",
"lower",
"is",
"None",
":",
"lower",
"=",
"getattr",
"(",
"self",
".",
"subpars",
".",
"eqi2",
",",
"'value'",
",",
"None",
")",
"if",
"upper",
"is"... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | time_choices | Return digital time choices every half hour from 00:00 to 23:30. | openinghours/forms.py | def time_choices():
"""Return digital time choices every half hour from 00:00 to 23:30."""
hours = list(range(0, 24))
times = []
for h in hours:
hour = str(h).zfill(2)
times.append(hour+':00')
times.append(hour+':30')
return list(zip(times, times)) | def time_choices():
"""Return digital time choices every half hour from 00:00 to 23:30."""
hours = list(range(0, 24))
times = []
for h in hours:
hour = str(h).zfill(2)
times.append(hour+':00')
times.append(hour+':30')
return list(zip(times, times)) | [
"Return",
"digital",
"time",
"choices",
"every",
"half",
"hour",
"from",
"00",
":",
"00",
"to",
"23",
":",
"30",
"."
] | arteria/django-openinghours | python | https://github.com/arteria/django-openinghours/blob/6bad47509a14d65a3a5a08777455f4cc8b4961fa/openinghours/forms.py#L23-L31 | [
"def",
"time_choices",
"(",
")",
":",
"hours",
"=",
"list",
"(",
"range",
"(",
"0",
",",
"24",
")",
")",
"times",
"=",
"[",
"]",
"for",
"h",
"in",
"hours",
":",
"hour",
"=",
"str",
"(",
"h",
")",
".",
"zfill",
"(",
"2",
")",
"times",
".",
"... | 6bad47509a14d65a3a5a08777455f4cc8b4961fa |
train | _add_lines | Return autodoc commands for a basemodels docstring.
Note that `collection classes` (e.g. `Model`, `ControlParameters`,
`InputSequences` are placed on top of the respective section and the
`contained classes` (e.g. model methods, `ControlParameter` instances,
`InputSequence` instances at the bottom. Th... | hydpy/core/autodoctools.py | def _add_lines(specification, module):
"""Return autodoc commands for a basemodels docstring.
Note that `collection classes` (e.g. `Model`, `ControlParameters`,
`InputSequences` are placed on top of the respective section and the
`contained classes` (e.g. model methods, `ControlParameter` instances,
... | def _add_lines(specification, module):
"""Return autodoc commands for a basemodels docstring.
Note that `collection classes` (e.g. `Model`, `ControlParameters`,
`InputSequences` are placed on top of the respective section and the
`contained classes` (e.g. model methods, `ControlParameter` instances,
... | [
"Return",
"autodoc",
"commands",
"for",
"a",
"basemodels",
"docstring",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L79-L116 | [
"def",
"_add_lines",
"(",
"specification",
",",
"module",
")",
":",
"caption",
"=",
"_all_spec2capt",
".",
"get",
"(",
"specification",
",",
"'dummy'",
")",
"if",
"caption",
".",
"split",
"(",
")",
"[",
"-",
"1",
"]",
"in",
"(",
"'parameters'",
",",
"'... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | autodoc_basemodel | Add an exhaustive docstring to the given module of a basemodel.
Works onlye when all modules of the basemodel are named in the
standard way, e.g. `lland_model`, `lland_control`, `lland_inputs`. | hydpy/core/autodoctools.py | def autodoc_basemodel(module):
"""Add an exhaustive docstring to the given module of a basemodel.
Works onlye when all modules of the basemodel are named in the
standard way, e.g. `lland_model`, `lland_control`, `lland_inputs`.
"""
autodoc_tuple2doc(module)
namespace = module.__dict__
doc =... | def autodoc_basemodel(module):
"""Add an exhaustive docstring to the given module of a basemodel.
Works onlye when all modules of the basemodel are named in the
standard way, e.g. `lland_model`, `lland_control`, `lland_inputs`.
"""
autodoc_tuple2doc(module)
namespace = module.__dict__
doc =... | [
"Add",
"an",
"exhaustive",
"docstring",
"to",
"the",
"given",
"module",
"of",
"a",
"basemodel",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L128-L172 | [
"def",
"autodoc_basemodel",
"(",
"module",
")",
":",
"autodoc_tuple2doc",
"(",
"module",
")",
"namespace",
"=",
"module",
".",
"__dict__",
"doc",
"=",
"namespace",
".",
"get",
"(",
"'__doc__'",
")",
"if",
"doc",
"is",
"None",
":",
"doc",
"=",
"''",
"base... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | autodoc_applicationmodel | Improves the docstrings of application models when called
at the bottom of the respective module.
|autodoc_applicationmodel| requires, similar to
|autodoc_basemodel|, that both the application model and its
base model are defined in the conventional way. | hydpy/core/autodoctools.py | def autodoc_applicationmodel(module):
"""Improves the docstrings of application models when called
at the bottom of the respective module.
|autodoc_applicationmodel| requires, similar to
|autodoc_basemodel|, that both the application model and its
base model are defined in the conventional way.
... | def autodoc_applicationmodel(module):
"""Improves the docstrings of application models when called
at the bottom of the respective module.
|autodoc_applicationmodel| requires, similar to
|autodoc_basemodel|, that both the application model and its
base model are defined in the conventional way.
... | [
"Improves",
"the",
"docstrings",
"of",
"application",
"models",
"when",
"called",
"at",
"the",
"bottom",
"of",
"the",
"respective",
"module",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L175-L190 | [
"def",
"autodoc_applicationmodel",
"(",
"module",
")",
":",
"autodoc_tuple2doc",
"(",
"module",
")",
"name_applicationmodel",
"=",
"module",
".",
"__name__",
"name_basemodel",
"=",
"name_applicationmodel",
".",
"split",
"(",
"'_'",
")",
"[",
"0",
"]",
"module_base... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | prepare_mainsubstituter | Prepare and return a |Substituter| object for the main `__init__`
file of *HydPy*. | hydpy/core/autodoctools.py | def prepare_mainsubstituter():
"""Prepare and return a |Substituter| object for the main `__init__`
file of *HydPy*."""
substituter = Substituter()
for module in (builtins, numpy, datetime, unittest, doctest, inspect, io,
os, sys, time, collections, itertools, subprocess, scipy,
... | def prepare_mainsubstituter():
"""Prepare and return a |Substituter| object for the main `__init__`
file of *HydPy*."""
substituter = Substituter()
for module in (builtins, numpy, datetime, unittest, doctest, inspect, io,
os, sys, time, collections, itertools, subprocess, scipy,
... | [
"Prepare",
"and",
"return",
"a",
"|Substituter|",
"object",
"for",
"the",
"main",
"__init__",
"file",
"of",
"*",
"HydPy",
"*",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L657-L674 | [
"def",
"prepare_mainsubstituter",
"(",
")",
":",
"substituter",
"=",
"Substituter",
"(",
")",
"for",
"module",
"in",
"(",
"builtins",
",",
"numpy",
",",
"datetime",
",",
"unittest",
",",
"doctest",
",",
"inspect",
",",
"io",
",",
"os",
",",
"sys",
",",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | _number_of_line | Try to return the number of the first line of the definition of a
member of a module. | hydpy/core/autodoctools.py | def _number_of_line(member_tuple):
"""Try to return the number of the first line of the definition of a
member of a module."""
member = member_tuple[1]
try:
return member.__code__.co_firstlineno
except AttributeError:
pass
try:
return inspect.findsource(member)[1]
exc... | def _number_of_line(member_tuple):
"""Try to return the number of the first line of the definition of a
member of a module."""
member = member_tuple[1]
try:
return member.__code__.co_firstlineno
except AttributeError:
pass
try:
return inspect.findsource(member)[1]
exc... | [
"Try",
"to",
"return",
"the",
"number",
"of",
"the",
"first",
"line",
"of",
"the",
"definition",
"of",
"a",
"member",
"of",
"a",
"module",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L677-L694 | [
"def",
"_number_of_line",
"(",
"member_tuple",
")",
":",
"member",
"=",
"member_tuple",
"[",
"1",
"]",
"try",
":",
"return",
"member",
".",
"__code__",
".",
"co_firstlineno",
"except",
"AttributeError",
":",
"pass",
"try",
":",
"return",
"inspect",
".",
"fin... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | autodoc_module | Add a short summary of all implemented members to a modules docstring. | hydpy/core/autodoctools.py | def autodoc_module(module):
"""Add a short summary of all implemented members to a modules docstring.
"""
doc = getattr(module, '__doc__')
if doc is None:
doc = ''
members = []
for name, member in inspect.getmembers(module):
if ((not name.startswith('_')) and
(ins... | def autodoc_module(module):
"""Add a short summary of all implemented members to a modules docstring.
"""
doc = getattr(module, '__doc__')
if doc is None:
doc = ''
members = []
for name, member in inspect.getmembers(module):
if ((not name.startswith('_')) and
(ins... | [
"Add",
"a",
"short",
"summary",
"of",
"all",
"implemented",
"members",
"to",
"a",
"modules",
"docstring",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L697-L722 | [
"def",
"autodoc_module",
"(",
"module",
")",
":",
"doc",
"=",
"getattr",
"(",
"module",
",",
"'__doc__'",
")",
"if",
"doc",
"is",
"None",
":",
"doc",
"=",
"''",
"members",
"=",
"[",
"]",
"for",
"name",
",",
"member",
"in",
"inspect",
".",
"getmembers... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | autodoc_tuple2doc | Include tuples as `CLASSES` of `ControlParameters` and `RUN_METHODS`
of `Models` into the respective docstring. | hydpy/core/autodoctools.py | def autodoc_tuple2doc(module):
"""Include tuples as `CLASSES` of `ControlParameters` and `RUN_METHODS`
of `Models` into the respective docstring."""
modulename = module.__name__
for membername, member in inspect.getmembers(module):
for tuplename, descr in _name2descr.items():
tuple_ ... | def autodoc_tuple2doc(module):
"""Include tuples as `CLASSES` of `ControlParameters` and `RUN_METHODS`
of `Models` into the respective docstring."""
modulename = module.__name__
for membername, member in inspect.getmembers(module):
for tuplename, descr in _name2descr.items():
tuple_ ... | [
"Include",
"tuples",
"as",
"CLASSES",
"of",
"ControlParameters",
"and",
"RUN_METHODS",
"of",
"Models",
"into",
"the",
"respective",
"docstring",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L756-L780 | [
"def",
"autodoc_tuple2doc",
"(",
"module",
")",
":",
"modulename",
"=",
"module",
".",
"__name__",
"for",
"membername",
",",
"member",
"in",
"inspect",
".",
"getmembers",
"(",
"module",
")",
":",
"for",
"tuplename",
",",
"descr",
"in",
"_name2descr",
".",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Substituter.consider_member | Return |True| if the given member should be added to the
substitutions. If not return |False|.
Some examples based on the site-package |numpy|:
>>> from hydpy.core.autodoctools import Substituter
>>> import numpy
A constant like |nan| should be added:
>>> Substituter.... | hydpy/core/autodoctools.py | def consider_member(name_member, member, module, class_=None):
"""Return |True| if the given member should be added to the
substitutions. If not return |False|.
Some examples based on the site-package |numpy|:
>>> from hydpy.core.autodoctools import Substituter
>>> import numpy... | def consider_member(name_member, member, module, class_=None):
"""Return |True| if the given member should be added to the
substitutions. If not return |False|.
Some examples based on the site-package |numpy|:
>>> from hydpy.core.autodoctools import Substituter
>>> import numpy... | [
"Return",
"|True|",
"if",
"the",
"given",
"member",
"should",
"be",
"added",
"to",
"the",
"substitutions",
".",
"If",
"not",
"return",
"|False|",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L210-L284 | [
"def",
"consider_member",
"(",
"name_member",
",",
"member",
",",
"module",
",",
"class_",
"=",
"None",
")",
":",
"if",
"name_member",
".",
"startswith",
"(",
"'_'",
")",
":",
"return",
"False",
"if",
"inspect",
".",
"ismodule",
"(",
"member",
")",
":",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Substituter.get_role | Return the reStructuredText role `func`, `class`, or `const`
best describing the given member.
Some examples based on the site-package |numpy|. |numpy.clip|
is a function:
>>> from hydpy.core.autodoctools import Substituter
>>> import numpy
>>> Substituter.get_role(num... | hydpy/core/autodoctools.py | def get_role(member, cython=False):
"""Return the reStructuredText role `func`, `class`, or `const`
best describing the given member.
Some examples based on the site-package |numpy|. |numpy.clip|
is a function:
>>> from hydpy.core.autodoctools import Substituter
>>> im... | def get_role(member, cython=False):
"""Return the reStructuredText role `func`, `class`, or `const`
best describing the given member.
Some examples based on the site-package |numpy|. |numpy.clip|
is a function:
>>> from hydpy.core.autodoctools import Substituter
>>> im... | [
"Return",
"the",
"reStructuredText",
"role",
"func",
"class",
"or",
"const",
"best",
"describing",
"the",
"given",
"member",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L287-L336 | [
"def",
"get_role",
"(",
"member",
",",
"cython",
"=",
"False",
")",
":",
"if",
"inspect",
".",
"isroutine",
"(",
"member",
")",
"or",
"isinstance",
"(",
"member",
",",
"numpy",
".",
"ufunc",
")",
":",
"return",
"'func'",
"elif",
"inspect",
".",
"isclas... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Substituter.add_substitution | Add the given substitutions both as a `short2long` and a
`medium2long` mapping.
Assume `variable1` is defined in the hydpy module `module1` and the
short and medium descriptions are `var1` and `mod1.var1`:
>>> import types
>>> module1 = types.ModuleType('hydpy.module1')
... | hydpy/core/autodoctools.py | def add_substitution(self, short, medium, long, module):
"""Add the given substitutions both as a `short2long` and a
`medium2long` mapping.
Assume `variable1` is defined in the hydpy module `module1` and the
short and medium descriptions are `var1` and `mod1.var1`:
>>> import t... | def add_substitution(self, short, medium, long, module):
"""Add the given substitutions both as a `short2long` and a
`medium2long` mapping.
Assume `variable1` is defined in the hydpy module `module1` and the
short and medium descriptions are `var1` and `mod1.var1`:
>>> import t... | [
"Add",
"the",
"given",
"substitutions",
"both",
"as",
"a",
"short2long",
"and",
"a",
"medium2long",
"mapping",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L338-L431 | [
"def",
"add_substitution",
"(",
"self",
",",
"short",
",",
"medium",
",",
"long",
",",
"module",
")",
":",
"name",
"=",
"module",
".",
"__name__",
"if",
"'builtin'",
"in",
"name",
":",
"self",
".",
"_short2long",
"[",
"short",
"]",
"=",
"long",
".",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Substituter.add_module | Add the given module, its members, and their submembers.
The first examples are based on the site-package |numpy|: which
is passed to method |Substituter.add_module|:
>>> from hydpy.core.autodoctools import Substituter
>>> substituter = Substituter()
>>> import numpy
>>... | hydpy/core/autodoctools.py | def add_module(self, module, cython=False):
"""Add the given module, its members, and their submembers.
The first examples are based on the site-package |numpy|: which
is passed to method |Substituter.add_module|:
>>> from hydpy.core.autodoctools import Substituter
>>> substitu... | def add_module(self, module, cython=False):
"""Add the given module, its members, and their submembers.
The first examples are based on the site-package |numpy|: which
is passed to method |Substituter.add_module|:
>>> from hydpy.core.autodoctools import Substituter
>>> substitu... | [
"Add",
"the",
"given",
"module",
"its",
"members",
"and",
"their",
"submembers",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L433-L511 | [
"def",
"add_module",
"(",
"self",
",",
"module",
",",
"cython",
"=",
"False",
")",
":",
"name_module",
"=",
"module",
".",
"__name__",
".",
"split",
"(",
"'.'",
")",
"[",
"-",
"1",
"]",
"short",
"=",
"(",
"'|%s|'",
"%",
"name_module",
")",
"long",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Substituter.add_modules | Add the modules of the given package without their members. | hydpy/core/autodoctools.py | def add_modules(self, package):
"""Add the modules of the given package without their members."""
for name in os.listdir(package.__path__[0]):
if name.startswith('_'):
continue
name = name.split('.')[0]
short = '|%s|' % name
long = ':mod:`~... | def add_modules(self, package):
"""Add the modules of the given package without their members."""
for name in os.listdir(package.__path__[0]):
if name.startswith('_'):
continue
name = name.split('.')[0]
short = '|%s|' % name
long = ':mod:`~... | [
"Add",
"the",
"modules",
"of",
"the",
"given",
"package",
"without",
"their",
"members",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L513-L521 | [
"def",
"add_modules",
"(",
"self",
",",
"package",
")",
":",
"for",
"name",
"in",
"os",
".",
"listdir",
"(",
"package",
".",
"__path__",
"[",
"0",
"]",
")",
":",
"if",
"name",
".",
"startswith",
"(",
"'_'",
")",
":",
"continue",
"name",
"=",
"name"... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Substituter.update_masters | Update all `master` |Substituter| objects.
If a |Substituter| object is passed to the constructor of another
|Substituter| object, they become `master` and `slave`:
>>> from hydpy.core.autodoctools import Substituter
>>> sub1 = Substituter()
>>> from hydpy.core import devicetoo... | hydpy/core/autodoctools.py | def update_masters(self):
"""Update all `master` |Substituter| objects.
If a |Substituter| object is passed to the constructor of another
|Substituter| object, they become `master` and `slave`:
>>> from hydpy.core.autodoctools import Substituter
>>> sub1 = Substituter()
... | def update_masters(self):
"""Update all `master` |Substituter| objects.
If a |Substituter| object is passed to the constructor of another
|Substituter| object, they become `master` and `slave`:
>>> from hydpy.core.autodoctools import Substituter
>>> sub1 = Substituter()
... | [
"Update",
"all",
"master",
"|Substituter|",
"objects",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L523-L589 | [
"def",
"update_masters",
"(",
"self",
")",
":",
"if",
"self",
".",
"master",
"is",
"not",
"None",
":",
"self",
".",
"master",
".",
"_medium2long",
".",
"update",
"(",
"self",
".",
"_medium2long",
")",
"self",
".",
"master",
".",
"update_masters",
"(",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Substituter.update_slaves | Update all `slave` |Substituter| objects.
See method |Substituter.update_masters| for further information. | hydpy/core/autodoctools.py | def update_slaves(self):
"""Update all `slave` |Substituter| objects.
See method |Substituter.update_masters| for further information.
"""
for slave in self.slaves:
slave._medium2long.update(self._medium2long)
slave.update_slaves() | def update_slaves(self):
"""Update all `slave` |Substituter| objects.
See method |Substituter.update_masters| for further information.
"""
for slave in self.slaves:
slave._medium2long.update(self._medium2long)
slave.update_slaves() | [
"Update",
"all",
"slave",
"|Substituter|",
"objects",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L591-L598 | [
"def",
"update_slaves",
"(",
"self",
")",
":",
"for",
"slave",
"in",
"self",
".",
"slaves",
":",
"slave",
".",
"_medium2long",
".",
"update",
"(",
"self",
".",
"_medium2long",
")",
"slave",
".",
"update_slaves",
"(",
")"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Substituter.get_commands | Return a string containing multiple `reStructuredText`
replacements with the substitutions currently defined.
Some examples based on the subpackage |optiontools|:
>>> from hydpy.core.autodoctools import Substituter
>>> substituter = Substituter()
>>> from hydpy.core import opti... | hydpy/core/autodoctools.py | def get_commands(self, source=None):
"""Return a string containing multiple `reStructuredText`
replacements with the substitutions currently defined.
Some examples based on the subpackage |optiontools|:
>>> from hydpy.core.autodoctools import Substituter
>>> substituter = Subst... | def get_commands(self, source=None):
"""Return a string containing multiple `reStructuredText`
replacements with the substitutions currently defined.
Some examples based on the subpackage |optiontools|:
>>> from hydpy.core.autodoctools import Substituter
>>> substituter = Subst... | [
"Return",
"a",
"string",
"containing",
"multiple",
"reStructuredText",
"replacements",
"with",
"the",
"substitutions",
"currently",
"defined",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L600-L642 | [
"def",
"get_commands",
"(",
"self",
",",
"source",
"=",
"None",
")",
":",
"commands",
"=",
"[",
"]",
"for",
"key",
",",
"value",
"in",
"self",
":",
"if",
"(",
"source",
"is",
"None",
")",
"or",
"(",
"key",
"in",
"source",
")",
":",
"commands",
".... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | Substituter.find | Print all substitutions that include the given text string. | hydpy/core/autodoctools.py | def find(self, text):
"""Print all substitutions that include the given text string."""
for key, value in self:
if (text in key) or (text in value):
print(key, value) | def find(self, text):
"""Print all substitutions that include the given text string."""
for key, value in self:
if (text in key) or (text in value):
print(key, value) | [
"Print",
"all",
"substitutions",
"that",
"include",
"the",
"given",
"text",
"string",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L644-L648 | [
"def",
"find",
"(",
"self",
",",
"text",
")",
":",
"for",
"key",
",",
"value",
"in",
"self",
":",
"if",
"(",
"text",
"in",
"key",
")",
"or",
"(",
"text",
"in",
"value",
")",
":",
"print",
"(",
"key",
",",
"value",
")"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | print_progress | Add print commands time to the given function informing about
execution time.
To show how the |print_progress| decorator works, we need to modify the
functions used by |print_progress| to gain system time information
available in module |time|.
First, we mock the functions |time.strftime| and |ti... | hydpy/core/printtools.py | def print_progress(wrapped, _=None, args=None, kwargs=None):
"""Add print commands time to the given function informing about
execution time.
To show how the |print_progress| decorator works, we need to modify the
functions used by |print_progress| to gain system time information
available in modu... | def print_progress(wrapped, _=None, args=None, kwargs=None):
"""Add print commands time to the given function informing about
execution time.
To show how the |print_progress| decorator works, we need to modify the
functions used by |print_progress| to gain system time information
available in modu... | [
"Add",
"print",
"commands",
"time",
"to",
"the",
"given",
"function",
"informing",
"about",
"execution",
"time",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/printtools.py#L42-L136 | [
"def",
"print_progress",
"(",
"wrapped",
",",
"_",
"=",
"None",
",",
"args",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"global",
"_printprogress_indentation",
"_printprogress_indentation",
"+=",
"4",
"try",
":",
"if",
"hydpy",
".",
"pub",
".",
"op... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | progressbar | Print a simple progress bar while processing the given iterable.
Function |progressbar| does print the progress bar when option
`printprogress` is activted:
>>> from hydpy import pub
>>> pub.options.printprogress = True
You can pass an iterable object. Say you want to calculate the the sum
o... | hydpy/core/printtools.py | def progressbar(iterable, length=23):
"""Print a simple progress bar while processing the given iterable.
Function |progressbar| does print the progress bar when option
`printprogress` is activted:
>>> from hydpy import pub
>>> pub.options.printprogress = True
You can pass an iterable object.... | def progressbar(iterable, length=23):
"""Print a simple progress bar while processing the given iterable.
Function |progressbar| does print the progress bar when option
`printprogress` is activted:
>>> from hydpy import pub
>>> pub.options.printprogress = True
You can pass an iterable object.... | [
"Print",
"a",
"simple",
"progress",
"bar",
"while",
"processing",
"the",
"given",
"iterable",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/printtools.py#L139-L248 | [
"def",
"progressbar",
"(",
"iterable",
",",
"length",
"=",
"23",
")",
":",
"if",
"hydpy",
".",
"pub",
".",
"options",
".",
"printprogress",
"and",
"(",
"len",
"(",
"iterable",
")",
">",
"1",
")",
":",
"temp_name",
"=",
"os",
".",
"path",
".",
"join... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | start_server | Start the *HydPy* server using the given socket.
The folder with the given `projectname` must be available within the
current working directory. The XML configuration file must be placed
within the project folder unless `xmlfilename` is an absolute file path.
The XML configuration file must be valid c... | hydpy/exe/servertools.py | def start_server(socket, projectname, xmlfilename: str) -> None:
"""Start the *HydPy* server using the given socket.
The folder with the given `projectname` must be available within the
current working directory. The XML configuration file must be placed
within the project folder unless `xmlfilename` ... | def start_server(socket, projectname, xmlfilename: str) -> None:
"""Start the *HydPy* server using the given socket.
The folder with the given `projectname` must be available within the
current working directory. The XML configuration file must be placed
within the project folder unless `xmlfilename` ... | [
"Start",
"the",
"*",
"HydPy",
"*",
"server",
"using",
"the",
"given",
"socket",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1147-L1159 | [
"def",
"start_server",
"(",
"socket",
",",
"projectname",
",",
"xmlfilename",
":",
"str",
")",
"->",
"None",
":",
"state",
".",
"initialise",
"(",
"projectname",
",",
"xmlfilename",
")",
"server",
"=",
"http",
".",
"server",
".",
"HTTPServer",
"(",
"(",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | await_server | Block the current process until either the *HydPy* server is responding
on the given `port` or the given number of `seconds` elapsed.
>>> from hydpy import run_subprocess, TestIO
>>> with TestIO(): # doctest: +ELLIPSIS
... run_subprocess('hyd.py await_server 8080 0.1')
Invoking hyd.py with a... | hydpy/exe/servertools.py | def await_server(port, seconds):
"""Block the current process until either the *HydPy* server is responding
on the given `port` or the given number of `seconds` elapsed.
>>> from hydpy import run_subprocess, TestIO
>>> with TestIO(): # doctest: +ELLIPSIS
... run_subprocess('hyd.py await_serv... | def await_server(port, seconds):
"""Block the current process until either the *HydPy* server is responding
on the given `port` or the given number of `seconds` elapsed.
>>> from hydpy import run_subprocess, TestIO
>>> with TestIO(): # doctest: +ELLIPSIS
... run_subprocess('hyd.py await_serv... | [
"Block",
"the",
"current",
"process",
"until",
"either",
"the",
"*",
"HydPy",
"*",
"server",
"is",
"responding",
"on",
"the",
"given",
"port",
"or",
"the",
"given",
"number",
"of",
"seconds",
"elapsed",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1162-L1198 | [
"def",
"await_server",
"(",
"port",
",",
"seconds",
")",
":",
"now",
"=",
"time",
".",
"perf_counter",
"(",
")",
"end",
"=",
"now",
"+",
"float",
"(",
"seconds",
")",
"while",
"now",
"<=",
"end",
":",
"try",
":",
"urllib",
".",
"request",
".",
"url... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | ServerState.initialise | Initialise a *HydPy* project based on the given XML configuration
file agreeing with `HydPyConfigMultipleRuns.xsd`.
We use the `LahnH` project and its rather complex XML configuration
file `multiple_runs.xml` as an example (module |xmltools| provides
information on interpreting this fil... | hydpy/exe/servertools.py | def initialise(self, projectname: str, xmlfile: str) -> None:
"""Initialise a *HydPy* project based on the given XML configuration
file agreeing with `HydPyConfigMultipleRuns.xsd`.
We use the `LahnH` project and its rather complex XML configuration
file `multiple_runs.xml` as an example... | def initialise(self, projectname: str, xmlfile: str) -> None:
"""Initialise a *HydPy* project based on the given XML configuration
file agreeing with `HydPyConfigMultipleRuns.xsd`.
We use the `LahnH` project and its rather complex XML configuration
file `multiple_runs.xml` as an example... | [
"Initialise",
"a",
"*",
"HydPy",
"*",
"project",
"based",
"on",
"the",
"given",
"XML",
"configuration",
"file",
"agreeing",
"with",
"HydPyConfigMultipleRuns",
".",
"xsd",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L281-L382 | [
"def",
"initialise",
"(",
"self",
",",
"projectname",
":",
"str",
",",
"xmlfile",
":",
"str",
")",
"->",
"None",
":",
"write",
"=",
"commandtools",
".",
"print_textandtime",
"write",
"(",
"f'Start HydPy project `{projectname}`'",
")",
"hp",
"=",
"hydpytools",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | HydPyServer.POST_evaluate | Evaluate any valid Python expression with the *HydPy* server
process and get its result.
Method |HydPyServer.POST_evaluate| serves to test and debug, primarily.
The main documentation on module |servertools| explains its usage. | hydpy/exe/servertools.py | def POST_evaluate(self) -> None:
"""Evaluate any valid Python expression with the *HydPy* server
process and get its result.
Method |HydPyServer.POST_evaluate| serves to test and debug, primarily.
The main documentation on module |servertools| explains its usage.
"""
for... | def POST_evaluate(self) -> None:
"""Evaluate any valid Python expression with the *HydPy* server
process and get its result.
Method |HydPyServer.POST_evaluate| serves to test and debug, primarily.
The main documentation on module |servertools| explains its usage.
"""
for... | [
"Evaluate",
"any",
"valid",
"Python",
"expression",
"with",
"the",
"*",
"HydPy",
"*",
"server",
"process",
"and",
"get",
"its",
"result",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L918-L927 | [
"def",
"POST_evaluate",
"(",
"self",
")",
"->",
"None",
":",
"for",
"name",
",",
"value",
"in",
"self",
".",
"_inputs",
".",
"items",
"(",
")",
":",
"result",
"=",
"eval",
"(",
"value",
")",
"self",
".",
"_outputs",
"[",
"name",
"]",
"=",
"objectto... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | HydPyServer.GET_close_server | Stop and close the *HydPy* server. | hydpy/exe/servertools.py | def GET_close_server(self) -> None:
"""Stop and close the *HydPy* server."""
def _close_server():
self.server.shutdown()
self.server.server_close()
shutter = threading.Thread(target=_close_server)
shutter.deamon = True
shutter.start() | def GET_close_server(self) -> None:
"""Stop and close the *HydPy* server."""
def _close_server():
self.server.shutdown()
self.server.server_close()
shutter = threading.Thread(target=_close_server)
shutter.deamon = True
shutter.start() | [
"Stop",
"and",
"close",
"the",
"*",
"HydPy",
"*",
"server",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L933-L940 | [
"def",
"GET_close_server",
"(",
"self",
")",
"->",
"None",
":",
"def",
"_close_server",
"(",
")",
":",
"self",
".",
"server",
".",
"shutdown",
"(",
")",
"self",
".",
"server",
".",
"server_close",
"(",
")",
"shutter",
"=",
"threading",
".",
"Thread",
"... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | HydPyServer.GET_parameteritemtypes | Get the types of all current exchange items supposed to change
the values of |Parameter| objects. | hydpy/exe/servertools.py | def GET_parameteritemtypes(self) -> None:
"""Get the types of all current exchange items supposed to change
the values of |Parameter| objects."""
for item in state.parameteritems:
self._outputs[item.name] = self._get_itemtype(item) | def GET_parameteritemtypes(self) -> None:
"""Get the types of all current exchange items supposed to change
the values of |Parameter| objects."""
for item in state.parameteritems:
self._outputs[item.name] = self._get_itemtype(item) | [
"Get",
"the",
"types",
"of",
"all",
"current",
"exchange",
"items",
"supposed",
"to",
"change",
"the",
"values",
"of",
"|Parameter|",
"objects",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L953-L957 | [
"def",
"GET_parameteritemtypes",
"(",
"self",
")",
"->",
"None",
":",
"for",
"item",
"in",
"state",
".",
"parameteritems",
":",
"self",
".",
"_outputs",
"[",
"item",
".",
"name",
"]",
"=",
"self",
".",
"_get_itemtype",
"(",
"item",
")"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | HydPyServer.GET_conditionitemtypes | Get the types of all current exchange items supposed to change
the values of |StateSequence| or |LogSequence| objects. | hydpy/exe/servertools.py | def GET_conditionitemtypes(self) -> None:
"""Get the types of all current exchange items supposed to change
the values of |StateSequence| or |LogSequence| objects."""
for item in state.conditionitems:
self._outputs[item.name] = self._get_itemtype(item) | def GET_conditionitemtypes(self) -> None:
"""Get the types of all current exchange items supposed to change
the values of |StateSequence| or |LogSequence| objects."""
for item in state.conditionitems:
self._outputs[item.name] = self._get_itemtype(item) | [
"Get",
"the",
"types",
"of",
"all",
"current",
"exchange",
"items",
"supposed",
"to",
"change",
"the",
"values",
"of",
"|StateSequence|",
"or",
"|LogSequence|",
"objects",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L959-L963 | [
"def",
"GET_conditionitemtypes",
"(",
"self",
")",
"->",
"None",
":",
"for",
"item",
"in",
"state",
".",
"conditionitems",
":",
"self",
".",
"_outputs",
"[",
"item",
".",
"name",
"]",
"=",
"self",
".",
"_get_itemtype",
"(",
"item",
")"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | HydPyServer.GET_getitemtypes | Get the types of all current exchange items supposed to return
the values of |Parameter| or |Sequence| objects or the time series
of |IOSequence| objects. | hydpy/exe/servertools.py | def GET_getitemtypes(self) -> None:
"""Get the types of all current exchange items supposed to return
the values of |Parameter| or |Sequence| objects or the time series
of |IOSequence| objects."""
for item in state.getitems:
type_ = self._get_itemtype(item)
for na... | def GET_getitemtypes(self) -> None:
"""Get the types of all current exchange items supposed to return
the values of |Parameter| or |Sequence| objects or the time series
of |IOSequence| objects."""
for item in state.getitems:
type_ = self._get_itemtype(item)
for na... | [
"Get",
"the",
"types",
"of",
"all",
"current",
"exchange",
"items",
"supposed",
"to",
"return",
"the",
"values",
"of",
"|Parameter|",
"or",
"|Sequence|",
"objects",
"or",
"the",
"time",
"series",
"of",
"|IOSequence|",
"objects",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L965-L972 | [
"def",
"GET_getitemtypes",
"(",
"self",
")",
"->",
"None",
":",
"for",
"item",
"in",
"state",
".",
"getitems",
":",
"type_",
"=",
"self",
".",
"_get_itemtype",
"(",
"item",
")",
"for",
"name",
",",
"_",
"in",
"item",
".",
"yield_name2value",
"(",
")",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | HydPyServer.POST_timegrid | Change the current simulation |Timegrid|. | hydpy/exe/servertools.py | def POST_timegrid(self) -> None:
"""Change the current simulation |Timegrid|."""
init = hydpy.pub.timegrids.init
sim = hydpy.pub.timegrids.sim
sim.firstdate = self._inputs['firstdate']
sim.lastdate = self._inputs['lastdate']
state.idx1 = init[sim.firstdate]
state.... | def POST_timegrid(self) -> None:
"""Change the current simulation |Timegrid|."""
init = hydpy.pub.timegrids.init
sim = hydpy.pub.timegrids.sim
sim.firstdate = self._inputs['firstdate']
sim.lastdate = self._inputs['lastdate']
state.idx1 = init[sim.firstdate]
state.... | [
"Change",
"the",
"current",
"simulation",
"|Timegrid|",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L978-L985 | [
"def",
"POST_timegrid",
"(",
"self",
")",
"->",
"None",
":",
"init",
"=",
"hydpy",
".",
"pub",
".",
"timegrids",
".",
"init",
"sim",
"=",
"hydpy",
".",
"pub",
".",
"timegrids",
".",
"sim",
"sim",
".",
"firstdate",
"=",
"self",
".",
"_inputs",
"[",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | HydPyServer.GET_parameteritemvalues | Get the values of all |ChangeItem| objects handling |Parameter|
objects. | hydpy/exe/servertools.py | def GET_parameteritemvalues(self) -> None:
"""Get the values of all |ChangeItem| objects handling |Parameter|
objects."""
for item in state.parameteritems:
self._outputs[item.name] = item.value | def GET_parameteritemvalues(self) -> None:
"""Get the values of all |ChangeItem| objects handling |Parameter|
objects."""
for item in state.parameteritems:
self._outputs[item.name] = item.value | [
"Get",
"the",
"values",
"of",
"all",
"|ChangeItem|",
"objects",
"handling",
"|Parameter|",
"objects",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1003-L1007 | [
"def",
"GET_parameteritemvalues",
"(",
"self",
")",
"->",
"None",
":",
"for",
"item",
"in",
"state",
".",
"parameteritems",
":",
"self",
".",
"_outputs",
"[",
"item",
".",
"name",
"]",
"=",
"item",
".",
"value"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | HydPyServer.GET_conditionitemvalues | Get the values of all |ChangeItem| objects handling |StateSequence|
or |LogSequence| objects. | hydpy/exe/servertools.py | def GET_conditionitemvalues(self) -> None:
"""Get the values of all |ChangeItem| objects handling |StateSequence|
or |LogSequence| objects."""
for item in state.conditionitems:
self._outputs[item.name] = item.value | def GET_conditionitemvalues(self) -> None:
"""Get the values of all |ChangeItem| objects handling |StateSequence|
or |LogSequence| objects."""
for item in state.conditionitems:
self._outputs[item.name] = item.value | [
"Get",
"the",
"values",
"of",
"all",
"|ChangeItem|",
"objects",
"handling",
"|StateSequence|",
"or",
"|LogSequence|",
"objects",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1014-L1018 | [
"def",
"GET_conditionitemvalues",
"(",
"self",
")",
"->",
"None",
":",
"for",
"item",
"in",
"state",
".",
"conditionitems",
":",
"self",
".",
"_outputs",
"[",
"item",
".",
"name",
"]",
"=",
"item",
".",
"value"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | HydPyServer.GET_getitemvalues | Get the values of all |Variable| objects observed by the
current |GetItem| objects.
For |GetItem| objects observing time series,
|HydPyServer.GET_getitemvalues| returns only the values within
the current simulation period. | hydpy/exe/servertools.py | def GET_getitemvalues(self) -> None:
"""Get the values of all |Variable| objects observed by the
current |GetItem| objects.
For |GetItem| objects observing time series,
|HydPyServer.GET_getitemvalues| returns only the values within
the current simulation period.
"""
... | def GET_getitemvalues(self) -> None:
"""Get the values of all |Variable| objects observed by the
current |GetItem| objects.
For |GetItem| objects observing time series,
|HydPyServer.GET_getitemvalues| returns only the values within
the current simulation period.
"""
... | [
"Get",
"the",
"values",
"of",
"all",
"|Variable|",
"objects",
"observed",
"by",
"the",
"current",
"|GetItem|",
"objects",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1025-L1035 | [
"def",
"GET_getitemvalues",
"(",
"self",
")",
"->",
"None",
":",
"for",
"item",
"in",
"state",
".",
"getitems",
":",
"for",
"name",
",",
"value",
"in",
"item",
".",
"yield_name2value",
"(",
"state",
".",
"idx1",
",",
"state",
".",
"idx2",
")",
":",
"... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | HydPyServer.GET_load_conditionvalues | Assign the |StateSequence| or |LogSequence| object values available
for the current simulation start point to the current |HydPy| instance.
When the simulation start point is identical with the initialisation
time point and you did not save conditions for it beforehand, the
"original" i... | hydpy/exe/servertools.py | def GET_load_conditionvalues(self) -> None:
"""Assign the |StateSequence| or |LogSequence| object values available
for the current simulation start point to the current |HydPy| instance.
When the simulation start point is identical with the initialisation
time point and you did not save... | def GET_load_conditionvalues(self) -> None:
"""Assign the |StateSequence| or |LogSequence| object values available
for the current simulation start point to the current |HydPy| instance.
When the simulation start point is identical with the initialisation
time point and you did not save... | [
"Assign",
"the",
"|StateSequence|",
"or",
"|LogSequence|",
"object",
"values",
"available",
"for",
"the",
"current",
"simulation",
"start",
"point",
"to",
"the",
"current",
"|HydPy|",
"instance",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1037-L1056 | [
"def",
"GET_load_conditionvalues",
"(",
"self",
")",
"->",
"None",
":",
"try",
":",
"state",
".",
"hp",
".",
"conditions",
"=",
"state",
".",
"conditions",
"[",
"self",
".",
"_id",
"]",
"[",
"state",
".",
"idx1",
"]",
"except",
"KeyError",
":",
"if",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | HydPyServer.GET_save_conditionvalues | Save the |StateSequence| and |LogSequence| object values of the
current |HydPy| instance for the current simulation endpoint. | hydpy/exe/servertools.py | def GET_save_conditionvalues(self) -> None:
"""Save the |StateSequence| and |LogSequence| object values of the
current |HydPy| instance for the current simulation endpoint."""
state.conditions[self._id] = state.conditions.get(self._id, {})
state.conditions[self._id][state.idx2] = state.h... | def GET_save_conditionvalues(self) -> None:
"""Save the |StateSequence| and |LogSequence| object values of the
current |HydPy| instance for the current simulation endpoint."""
state.conditions[self._id] = state.conditions.get(self._id, {})
state.conditions[self._id][state.idx2] = state.h... | [
"Save",
"the",
"|StateSequence|",
"and",
"|LogSequence|",
"object",
"values",
"of",
"the",
"current",
"|HydPy|",
"instance",
"for",
"the",
"current",
"simulation",
"endpoint",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1058-L1062 | [
"def",
"GET_save_conditionvalues",
"(",
"self",
")",
"->",
"None",
":",
"state",
".",
"conditions",
"[",
"self",
".",
"_id",
"]",
"=",
"state",
".",
"conditions",
".",
"get",
"(",
"self",
".",
"_id",
",",
"{",
"}",
")",
"state",
".",
"conditions",
"[... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | HydPyServer.GET_save_parameteritemvalues | Save the values of those |ChangeItem| objects which are
handling |Parameter| objects. | hydpy/exe/servertools.py | def GET_save_parameteritemvalues(self) -> None:
"""Save the values of those |ChangeItem| objects which are
handling |Parameter| objects."""
for item in state.parameteritems:
state.parameteritemvalues[self._id][item.name] = item.value.copy() | def GET_save_parameteritemvalues(self) -> None:
"""Save the values of those |ChangeItem| objects which are
handling |Parameter| objects."""
for item in state.parameteritems:
state.parameteritemvalues[self._id][item.name] = item.value.copy() | [
"Save",
"the",
"values",
"of",
"those",
"|ChangeItem|",
"objects",
"which",
"are",
"handling",
"|Parameter|",
"objects",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1064-L1068 | [
"def",
"GET_save_parameteritemvalues",
"(",
"self",
")",
"->",
"None",
":",
"for",
"item",
"in",
"state",
".",
"parameteritems",
":",
"state",
".",
"parameteritemvalues",
"[",
"self",
".",
"_id",
"]",
"[",
"item",
".",
"name",
"]",
"=",
"item",
".",
"val... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | HydPyServer.GET_savedparameteritemvalues | Get the previously saved values of those |ChangeItem| objects
which are handling |Parameter| objects. | hydpy/exe/servertools.py | def GET_savedparameteritemvalues(self) -> None:
"""Get the previously saved values of those |ChangeItem| objects
which are handling |Parameter| objects."""
dict_ = state.parameteritemvalues.get(self._id)
if dict_ is None:
self.GET_parameteritemvalues()
else:
... | def GET_savedparameteritemvalues(self) -> None:
"""Get the previously saved values of those |ChangeItem| objects
which are handling |Parameter| objects."""
dict_ = state.parameteritemvalues.get(self._id)
if dict_ is None:
self.GET_parameteritemvalues()
else:
... | [
"Get",
"the",
"previously",
"saved",
"values",
"of",
"those",
"|ChangeItem|",
"objects",
"which",
"are",
"handling",
"|Parameter|",
"objects",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1070-L1078 | [
"def",
"GET_savedparameteritemvalues",
"(",
"self",
")",
"->",
"None",
":",
"dict_",
"=",
"state",
".",
"parameteritemvalues",
".",
"get",
"(",
"self",
".",
"_id",
")",
"if",
"dict_",
"is",
"None",
":",
"self",
".",
"GET_parameteritemvalues",
"(",
")",
"el... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | HydPyServer.GET_save_modifiedconditionitemvalues | ToDo: extend functionality and add tests | hydpy/exe/servertools.py | def GET_save_modifiedconditionitemvalues(self) -> None:
"""ToDo: extend functionality and add tests"""
for item in state.conditionitems:
state.modifiedconditionitemvalues[self._id][item.name] = \
list(item.device2target.values())[0].value | def GET_save_modifiedconditionitemvalues(self) -> None:
"""ToDo: extend functionality and add tests"""
for item in state.conditionitems:
state.modifiedconditionitemvalues[self._id][item.name] = \
list(item.device2target.values())[0].value | [
"ToDo",
":",
"extend",
"functionality",
"and",
"add",
"tests"
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1080-L1084 | [
"def",
"GET_save_modifiedconditionitemvalues",
"(",
"self",
")",
"->",
"None",
":",
"for",
"item",
"in",
"state",
".",
"conditionitems",
":",
"state",
".",
"modifiedconditionitemvalues",
"[",
"self",
".",
"_id",
"]",
"[",
"item",
".",
"name",
"]",
"=",
"list... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | HydPyServer.GET_savedmodifiedconditionitemvalues | ToDo: extend functionality and add tests | hydpy/exe/servertools.py | def GET_savedmodifiedconditionitemvalues(self) -> None:
"""ToDo: extend functionality and add tests"""
dict_ = state.modifiedconditionitemvalues.get(self._id)
if dict_ is None:
self.GET_conditionitemvalues()
else:
for name, value in dict_.items():
... | def GET_savedmodifiedconditionitemvalues(self) -> None:
"""ToDo: extend functionality and add tests"""
dict_ = state.modifiedconditionitemvalues.get(self._id)
if dict_ is None:
self.GET_conditionitemvalues()
else:
for name, value in dict_.items():
... | [
"ToDo",
":",
"extend",
"functionality",
"and",
"add",
"tests"
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1086-L1093 | [
"def",
"GET_savedmodifiedconditionitemvalues",
"(",
"self",
")",
"->",
"None",
":",
"dict_",
"=",
"state",
".",
"modifiedconditionitemvalues",
".",
"get",
"(",
"self",
".",
"_id",
")",
"if",
"dict_",
"is",
"None",
":",
"self",
".",
"GET_conditionitemvalues",
"... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | HydPyServer.GET_save_getitemvalues | Save the values of all current |GetItem| objects. | hydpy/exe/servertools.py | def GET_save_getitemvalues(self) -> None:
"""Save the values of all current |GetItem| objects."""
for item in state.getitems:
for name, value in item.yield_name2value(state.idx1, state.idx2):
state.getitemvalues[self._id][name] = value | def GET_save_getitemvalues(self) -> None:
"""Save the values of all current |GetItem| objects."""
for item in state.getitems:
for name, value in item.yield_name2value(state.idx1, state.idx2):
state.getitemvalues[self._id][name] = value | [
"Save",
"the",
"values",
"of",
"all",
"current",
"|GetItem|",
"objects",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1095-L1099 | [
"def",
"GET_save_getitemvalues",
"(",
"self",
")",
"->",
"None",
":",
"for",
"item",
"in",
"state",
".",
"getitems",
":",
"for",
"name",
",",
"value",
"in",
"item",
".",
"yield_name2value",
"(",
"state",
".",
"idx1",
",",
"state",
".",
"idx2",
")",
":"... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | HydPyServer.GET_savedgetitemvalues | Get the previously saved values of all |GetItem| objects. | hydpy/exe/servertools.py | def GET_savedgetitemvalues(self) -> None:
"""Get the previously saved values of all |GetItem| objects."""
dict_ = state.getitemvalues.get(self._id)
if dict_ is None:
self.GET_getitemvalues()
else:
for name, value in dict_.items():
self._outputs[nam... | def GET_savedgetitemvalues(self) -> None:
"""Get the previously saved values of all |GetItem| objects."""
dict_ = state.getitemvalues.get(self._id)
if dict_ is None:
self.GET_getitemvalues()
else:
for name, value in dict_.items():
self._outputs[nam... | [
"Get",
"the",
"previously",
"saved",
"values",
"of",
"all",
"|GetItem|",
"objects",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1101-L1108 | [
"def",
"GET_savedgetitemvalues",
"(",
"self",
")",
"->",
"None",
":",
"dict_",
"=",
"state",
".",
"getitemvalues",
".",
"get",
"(",
"self",
".",
"_id",
")",
"if",
"dict_",
"is",
"None",
":",
"self",
".",
"GET_getitemvalues",
"(",
")",
"else",
":",
"for... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | HydPyServer.GET_save_timegrid | Save the current simulation period. | hydpy/exe/servertools.py | def GET_save_timegrid(self) -> None:
"""Save the current simulation period."""
state.timegrids[self._id] = copy.deepcopy(hydpy.pub.timegrids.sim) | def GET_save_timegrid(self) -> None:
"""Save the current simulation period."""
state.timegrids[self._id] = copy.deepcopy(hydpy.pub.timegrids.sim) | [
"Save",
"the",
"current",
"simulation",
"period",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1110-L1112 | [
"def",
"GET_save_timegrid",
"(",
"self",
")",
"->",
"None",
":",
"state",
".",
"timegrids",
"[",
"self",
".",
"_id",
"]",
"=",
"copy",
".",
"deepcopy",
"(",
"hydpy",
".",
"pub",
".",
"timegrids",
".",
"sim",
")"
] | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | HydPyServer.GET_savedtimegrid | Get the previously saved simulation period. | hydpy/exe/servertools.py | def GET_savedtimegrid(self) -> None:
"""Get the previously saved simulation period."""
try:
self._write_timegrid(state.timegrids[self._id])
except KeyError:
self._write_timegrid(hydpy.pub.timegrids.init) | def GET_savedtimegrid(self) -> None:
"""Get the previously saved simulation period."""
try:
self._write_timegrid(state.timegrids[self._id])
except KeyError:
self._write_timegrid(hydpy.pub.timegrids.init) | [
"Get",
"the",
"previously",
"saved",
"simulation",
"period",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/exe/servertools.py#L1114-L1119 | [
"def",
"GET_savedtimegrid",
"(",
"self",
")",
"->",
"None",
":",
"try",
":",
"self",
".",
"_write_timegrid",
"(",
"state",
".",
"timegrids",
"[",
"self",
".",
"_id",
"]",
")",
"except",
"KeyError",
":",
"self",
".",
"_write_timegrid",
"(",
"hydpy",
".",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | trim | Trim the value(s) of a |Variable| instance.
Usually, users do not need to apply function |trim| directly.
Instead, some |Variable| subclasses implement their own `trim`
methods relying on function |trim|. Model developers should
implement individual `trim` methods for their |Parameter| or
|Sequenc... | hydpy/core/variabletools.py | def trim(self: 'Variable', lower=None, upper=None) -> None:
"""Trim the value(s) of a |Variable| instance.
Usually, users do not need to apply function |trim| directly.
Instead, some |Variable| subclasses implement their own `trim`
methods relying on function |trim|. Model developers should
implem... | def trim(self: 'Variable', lower=None, upper=None) -> None:
"""Trim the value(s) of a |Variable| instance.
Usually, users do not need to apply function |trim| directly.
Instead, some |Variable| subclasses implement their own `trim`
methods relying on function |trim|. Model developers should
implem... | [
"Trim",
"the",
"value",
"(",
"s",
")",
"of",
"a",
"|Variable|",
"instance",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/variabletools.py#L47-L376 | [
"def",
"trim",
"(",
"self",
":",
"'Variable'",
",",
"lower",
"=",
"None",
",",
"upper",
"=",
"None",
")",
"->",
"None",
":",
"if",
"hydpy",
".",
"pub",
".",
"options",
".",
"trimvariables",
":",
"if",
"lower",
"is",
"None",
":",
"lower",
"=",
"self... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | _get_tolerance | Return some "numerical accuracy" to be expected for the
given floating point value(s) (see method |trim|). | hydpy/core/variabletools.py | def _get_tolerance(values):
"""Return some "numerical accuracy" to be expected for the
given floating point value(s) (see method |trim|)."""
tolerance = numpy.abs(values*1e-15)
if hasattr(tolerance, '__setitem__'):
tolerance[numpy.isinf(tolerance)] = 0.
elif numpy.isinf(tolerance):
t... | def _get_tolerance(values):
"""Return some "numerical accuracy" to be expected for the
given floating point value(s) (see method |trim|)."""
tolerance = numpy.abs(values*1e-15)
if hasattr(tolerance, '__setitem__'):
tolerance[numpy.isinf(tolerance)] = 0.
elif numpy.isinf(tolerance):
t... | [
"Return",
"some",
"numerical",
"accuracy",
"to",
"be",
"expected",
"for",
"the",
"given",
"floating",
"point",
"value",
"(",
"s",
")",
"(",
"see",
"method",
"|trim|",
")",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/variabletools.py#L451-L459 | [
"def",
"_get_tolerance",
"(",
"values",
")",
":",
"tolerance",
"=",
"numpy",
".",
"abs",
"(",
"values",
"*",
"1e-15",
")",
"if",
"hasattr",
"(",
"tolerance",
",",
"'__setitem__'",
")",
":",
"tolerance",
"[",
"numpy",
".",
"isinf",
"(",
"tolerance",
")",
... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | _compare_variables_function_generator | Return a function usable as a comparison method for class |Variable|.
Pass the specific method (e.g. `__eq__`) and the corresponding
operator (e.g. `==`) as strings. Also pass either |numpy.all| or
|numpy.any| for aggregating multiple boolean values. | hydpy/core/variabletools.py | def _compare_variables_function_generator(
method_string, aggregation_func):
"""Return a function usable as a comparison method for class |Variable|.
Pass the specific method (e.g. `__eq__`) and the corresponding
operator (e.g. `==`) as strings. Also pass either |numpy.all| or
|numpy.any| for... | def _compare_variables_function_generator(
method_string, aggregation_func):
"""Return a function usable as a comparison method for class |Variable|.
Pass the specific method (e.g. `__eq__`) and the corresponding
operator (e.g. `==`) as strings. Also pass either |numpy.all| or
|numpy.any| for... | [
"Return",
"a",
"function",
"usable",
"as",
"a",
"comparison",
"method",
"for",
"class",
"|Variable|",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/variabletools.py#L470-L495 | [
"def",
"_compare_variables_function_generator",
"(",
"method_string",
",",
"aggregation_func",
")",
":",
"def",
"comparison_function",
"(",
"self",
",",
"other",
")",
":",
"\"\"\"Wrapper for comparison functions for class |Variable|.\"\"\"",
"if",
"self",
"is",
"other",
":"... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
train | to_repr | Return a valid string representation for the given |Variable|
object.
Function |to_repr| it thought for internal purposes only, more
specifically for defining string representations of subclasses
of class |Variable| like the following:
>>> from hydpy.core.variabletools import to_repr, Variable
... | hydpy/core/variabletools.py | def to_repr(self: Variable, values, brackets1d: Optional[bool] = False) \
-> str:
"""Return a valid string representation for the given |Variable|
object.
Function |to_repr| it thought for internal purposes only, more
specifically for defining string representations of subclasses
of class |... | def to_repr(self: Variable, values, brackets1d: Optional[bool] = False) \
-> str:
"""Return a valid string representation for the given |Variable|
object.
Function |to_repr| it thought for internal purposes only, more
specifically for defining string representations of subclasses
of class |... | [
"Return",
"a",
"valid",
"string",
"representation",
"for",
"the",
"given",
"|Variable|",
"object",
"."
] | hydpy-dev/hydpy | python | https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/variabletools.py#L1930-L1997 | [
"def",
"to_repr",
"(",
"self",
":",
"Variable",
",",
"values",
",",
"brackets1d",
":",
"Optional",
"[",
"bool",
"]",
"=",
"False",
")",
"->",
"str",
":",
"prefix",
"=",
"f'{self.name}('",
"if",
"isinstance",
"(",
"values",
",",
"str",
")",
":",
"string... | 1bc6a82cf30786521d86b36e27900c6717d3348d |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.