repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
google/python-gflags
gflags/_helpers.py
define_both_methods
def define_both_methods(class_name, class_dict, old_name, new_name): # pylint: disable=invalid-name """Function to help CamelCase to PEP8 style class methods migration. For any class definition: 1. Assert it does not define both old and new methods, otherwise it does not work. 2. If it define...
python
def define_both_methods(class_name, class_dict, old_name, new_name): # pylint: disable=invalid-name """Function to help CamelCase to PEP8 style class methods migration. For any class definition: 1. Assert it does not define both old and new methods, otherwise it does not work. 2. If it define...
[ "def", "define_both_methods", "(", "class_name", ",", "class_dict", ",", "old_name", ",", "new_name", ")", ":", "assert", "old_name", "not", "in", "class_dict", "or", "new_name", "not", "in", "class_dict", ",", "(", "'Class \"{}\" cannot define both \"{}\" and \"{}\" ...
Function to help CamelCase to PEP8 style class methods migration. For any class definition: 1. Assert it does not define both old and new methods, otherwise it does not work. 2. If it defines the old method, create the same new method. 3. If it defines the new method, create the same old m...
[ "Function", "to", "help", "CamelCase", "to", "PEP8", "style", "class", "methods", "migration", "." ]
4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6
https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/_helpers.py#L405-L430
train
google/python-gflags
gflags/flagvalues.py
FlagValues._IsUnparsedFlagAccessAllowed
def _IsUnparsedFlagAccessAllowed(self, name): """Determine whether to allow unparsed flag access or not.""" if _UNPARSED_FLAG_ACCESS_ENV_NAME in os.environ: # We've been told explicitly what to do. allow_unparsed_flag_access = ( os.getenv(_UNPARSED_FLAG_ACCESS_ENV_NAME) == '1') elif se...
python
def _IsUnparsedFlagAccessAllowed(self, name): """Determine whether to allow unparsed flag access or not.""" if _UNPARSED_FLAG_ACCESS_ENV_NAME in os.environ: # We've been told explicitly what to do. allow_unparsed_flag_access = ( os.getenv(_UNPARSED_FLAG_ACCESS_ENV_NAME) == '1') elif se...
[ "def", "_IsUnparsedFlagAccessAllowed", "(", "self", ",", "name", ")", ":", "if", "_UNPARSED_FLAG_ACCESS_ENV_NAME", "in", "os", ".", "environ", ":", "allow_unparsed_flag_access", "=", "(", "os", ".", "getenv", "(", "_UNPARSED_FLAG_ACCESS_ENV_NAME", ")", "==", "'1'", ...
Determine whether to allow unparsed flag access or not.
[ "Determine", "whether", "to", "allow", "unparsed", "flag", "access", "or", "not", "." ]
4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6
https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/flagvalues.py#L490-L511
train
google/python-gflags
gflags/flagvalues.py
FlagValues._AssertValidators
def _AssertValidators(self, validators): """Assert if all validators in the list are satisfied. Asserts validators in the order they were created. Args: validators: Iterable(validators.Validator), validators to be verified Raises: AttributeError: if validators work with a non-existi...
python
def _AssertValidators(self, validators): """Assert if all validators in the list are satisfied. Asserts validators in the order they were created. Args: validators: Iterable(validators.Validator), validators to be verified Raises: AttributeError: if validators work with a non-existi...
[ "def", "_AssertValidators", "(", "self", ",", "validators", ")", ":", "for", "validator", "in", "sorted", "(", "validators", ",", "key", "=", "lambda", "validator", ":", "validator", ".", "insertion_index", ")", ":", "try", ":", "validator", ".", "verify", ...
Assert if all validators in the list are satisfied. Asserts validators in the order they were created. Args: validators: Iterable(validators.Validator), validators to be verified Raises: AttributeError: if validators work with a non-existing flag. IllegalFlagValueError: if validat...
[ "Assert", "if", "all", "validators", "in", "the", "list", "are", "satisfied", "." ]
4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6
https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/flagvalues.py#L561-L578
train
google/python-gflags
gflags/flagvalues.py
FlagValues._RemoveAllFlagAppearances
def _RemoveAllFlagAppearances(self, name): """Removes flag with name for all appearances. A flag can be registered with its long name and an optional short name. This method removes both of them. This is different than __delattr__. Args: name: Either flag's long name or short name. Raises: ...
python
def _RemoveAllFlagAppearances(self, name): """Removes flag with name for all appearances. A flag can be registered with its long name and an optional short name. This method removes both of them. This is different than __delattr__. Args: name: Either flag's long name or short name. Raises: ...
[ "def", "_RemoveAllFlagAppearances", "(", "self", ",", "name", ")", ":", "flag_dict", "=", "self", ".", "FlagDict", "(", ")", "if", "name", "not", "in", "flag_dict", ":", "raise", "exceptions", ".", "UnrecognizedFlagError", "(", "name", ")", "flag", "=", "f...
Removes flag with name for all appearances. A flag can be registered with its long name and an optional short name. This method removes both of them. This is different than __delattr__. Args: name: Either flag's long name or short name. Raises: UnrecognizedFlagError: When flag name is not...
[ "Removes", "flag", "with", "name", "for", "all", "appearances", "." ]
4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6
https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/flagvalues.py#L610-L631
train
google/python-gflags
gflags/flagvalues.py
FlagValues.GetHelp
def GetHelp(self, prefix='', include_special_flags=True): """Generates a help string for all known flags. Args: prefix: str, per-line output prefix. include_special_flags: bool, whether to include description of _SPECIAL_FLAGS, i.e. --flagfile and --undefok. Returns: str, formatt...
python
def GetHelp(self, prefix='', include_special_flags=True): """Generates a help string for all known flags. Args: prefix: str, per-line output prefix. include_special_flags: bool, whether to include description of _SPECIAL_FLAGS, i.e. --flagfile and --undefok. Returns: str, formatt...
[ "def", "GetHelp", "(", "self", ",", "prefix", "=", "''", ",", "include_special_flags", "=", "True", ")", ":", "helplist", "=", "[", "]", "flags_by_module", "=", "self", ".", "FlagsByModuleDict", "(", ")", "if", "flags_by_module", ":", "modules", "=", "sort...
Generates a help string for all known flags. Args: prefix: str, per-line output prefix. include_special_flags: bool, whether to include description of _SPECIAL_FLAGS, i.e. --flagfile and --undefok. Returns: str, formatted help message.
[ "Generates", "a", "help", "string", "for", "all", "known", "flags", "." ]
4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6
https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/flagvalues.py#L849-L886
train
google/python-gflags
gflags/flagvalues.py
FlagValues.__RenderOurModuleKeyFlags
def __RenderOurModuleKeyFlags(self, module, output_lines, prefix=''): """Generates a help string for the key flags of a given module. Args: module: A module object or a module name (a string). output_lines: A list of strings. The generated help message lines will be appended to this list. ...
python
def __RenderOurModuleKeyFlags(self, module, output_lines, prefix=''): """Generates a help string for the key flags of a given module. Args: module: A module object or a module name (a string). output_lines: A list of strings. The generated help message lines will be appended to this list. ...
[ "def", "__RenderOurModuleKeyFlags", "(", "self", ",", "module", ",", "output_lines", ",", "prefix", "=", "''", ")", ":", "key_flags", "=", "self", ".", "_GetKeyFlagsForModule", "(", "module", ")", "if", "key_flags", ":", "self", ".", "__RenderModuleFlags", "("...
Generates a help string for the key flags of a given module. Args: module: A module object or a module name (a string). output_lines: A list of strings. The generated help message lines will be appended to this list. prefix: A string that is prepended to each generated help line.
[ "Generates", "a", "help", "string", "for", "the", "key", "flags", "of", "a", "given", "module", "." ]
4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6
https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/flagvalues.py#L901-L912
train
google/python-gflags
gflags/flagvalues.py
FlagValues.ModuleHelp
def ModuleHelp(self, module): """Describe the key flags of a module. Args: module: A module object or a module name (a string). Returns: string describing the key flags of a module. """ helplist = [] self.__RenderOurModuleKeyFlags(module, helplist) return '\n'.join(helplist)
python
def ModuleHelp(self, module): """Describe the key flags of a module. Args: module: A module object or a module name (a string). Returns: string describing the key flags of a module. """ helplist = [] self.__RenderOurModuleKeyFlags(module, helplist) return '\n'.join(helplist)
[ "def", "ModuleHelp", "(", "self", ",", "module", ")", ":", "helplist", "=", "[", "]", "self", ".", "__RenderOurModuleKeyFlags", "(", "module", ",", "helplist", ")", "return", "'\\n'", ".", "join", "(", "helplist", ")" ]
Describe the key flags of a module. Args: module: A module object or a module name (a string). Returns: string describing the key flags of a module.
[ "Describe", "the", "key", "flags", "of", "a", "module", "." ]
4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6
https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/flagvalues.py#L914-L925
train
google/python-gflags
gflags/__init__.py
register_multi_flags_validator
def register_multi_flags_validator(flag_names, multi_flags_checker, message='Flags validation failed', flag_values=FLAGS): """Adds a constraint to multiple flags. The constraint is validated when flags are init...
python
def register_multi_flags_validator(flag_names, multi_flags_checker, message='Flags validation failed', flag_values=FLAGS): """Adds a constraint to multiple flags. The constraint is validated when flags are init...
[ "def", "register_multi_flags_validator", "(", "flag_names", ",", "multi_flags_checker", ",", "message", "=", "'Flags validation failed'", ",", "flag_values", "=", "FLAGS", ")", ":", "v", "=", "gflags_validators", ".", "MultiFlagsValidator", "(", "flag_names", ",", "mu...
Adds a constraint to multiple flags. The constraint is validated when flags are initially parsed, and after each change of the corresponding flag's value. Args: flag_names: [str], a list of the flag names to be checked. multi_flags_checker: callable, a function to validate the flag. input - dict...
[ "Adds", "a", "constraint", "to", "multiple", "flags", "." ]
4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6
https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/__init__.py#L187-L214
train
google/python-gflags
gflags/__init__.py
multi_flags_validator
def multi_flags_validator(flag_names, message='Flag validation failed', flag_values=FLAGS): """A function decorator for defining a multi-flag validator. Registers the decorated function as a validator for flag_names, e.g. @gflags.multi_flags_validator(['foo', ...
python
def multi_flags_validator(flag_names, message='Flag validation failed', flag_values=FLAGS): """A function decorator for defining a multi-flag validator. Registers the decorated function as a validator for flag_names, e.g. @gflags.multi_flags_validator(['foo', ...
[ "def", "multi_flags_validator", "(", "flag_names", ",", "message", "=", "'Flag validation failed'", ",", "flag_values", "=", "FLAGS", ")", ":", "def", "decorate", "(", "function", ")", ":", "register_multi_flags_validator", "(", "flag_names", ",", "function", ",", ...
A function decorator for defining a multi-flag validator. Registers the decorated function as a validator for flag_names, e.g. @gflags.multi_flags_validator(['foo', 'bar']) def _CheckFooBar(flags_dict): ... See register_multi_flags_validator() for the specification of checker function. Args: fla...
[ "A", "function", "decorator", "for", "defining", "a", "multi", "-", "flag", "validator", "." ]
4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6
https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/__init__.py#L217-L252
train
google/python-gflags
gflags/__init__.py
mark_flag_as_required
def mark_flag_as_required(flag_name, flag_values=FLAGS): """Ensures that flag is not None during program execution. Registers a flag validator, which will follow usual validator rules. Important note: validator will pass for any non-None value, such as False, 0 (zero), '' (empty string) and so on. It is rec...
python
def mark_flag_as_required(flag_name, flag_values=FLAGS): """Ensures that flag is not None during program execution. Registers a flag validator, which will follow usual validator rules. Important note: validator will pass for any non-None value, such as False, 0 (zero), '' (empty string) and so on. It is rec...
[ "def", "mark_flag_as_required", "(", "flag_name", ",", "flag_values", "=", "FLAGS", ")", ":", "if", "flag_values", "[", "flag_name", "]", ".", "default", "is", "not", "None", ":", "warnings", ".", "warn", "(", "'Flag %s has a non-None default value; therefore, '", ...
Ensures that flag is not None during program execution. Registers a flag validator, which will follow usual validator rules. Important note: validator will pass for any non-None value, such as False, 0 (zero), '' (empty string) and so on. It is recommended to call this method like this: if __name__ == '_...
[ "Ensures", "that", "flag", "is", "not", "None", "during", "program", "execution", "." ]
4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6
https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/__init__.py#L255-L288
train
google/python-gflags
gflags/__init__.py
mark_flags_as_mutual_exclusive
def mark_flags_as_mutual_exclusive(flag_names, required=False, flag_values=FLAGS): """Ensures that only one flag among flag_names is set. Args: flag_names: [str], a list of the flag names to be checked. required: Boolean, if set, exactly one of the flags must be set. ...
python
def mark_flags_as_mutual_exclusive(flag_names, required=False, flag_values=FLAGS): """Ensures that only one flag among flag_names is set. Args: flag_names: [str], a list of the flag names to be checked. required: Boolean, if set, exactly one of the flags must be set. ...
[ "def", "mark_flags_as_mutual_exclusive", "(", "flag_names", ",", "required", "=", "False", ",", "flag_values", "=", "FLAGS", ")", ":", "def", "validate_mutual_exclusion", "(", "flags_dict", ")", ":", "flag_count", "=", "sum", "(", "1", "for", "val", "in", "fla...
Ensures that only one flag among flag_names is set. Args: flag_names: [str], a list of the flag names to be checked. required: Boolean, if set, exactly one of the flags must be set. Otherwise, it is also valid for none of the flags to be set. flag_values: An optional FlagValues instance to valida...
[ "Ensures", "that", "only", "one", "flag", "among", "flag_names", "is", "set", "." ]
4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6
https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/__init__.py#L310-L330
train
google/python-gflags
gflags/__init__.py
DEFINE_enum
def DEFINE_enum( # pylint: disable=g-bad-name,redefined-builtin name, default, enum_values, help, flag_values=FLAGS, module_name=None, **args): """Registers a flag whose value can be any string from enum_values. Args: name: A string, the flag name. default: The default value of the flag. enum_...
python
def DEFINE_enum( # pylint: disable=g-bad-name,redefined-builtin name, default, enum_values, help, flag_values=FLAGS, module_name=None, **args): """Registers a flag whose value can be any string from enum_values. Args: name: A string, the flag name. default: The default value of the flag. enum_...
[ "def", "DEFINE_enum", "(", "name", ",", "default", ",", "enum_values", ",", "help", ",", "flag_values", "=", "FLAGS", ",", "module_name", "=", "None", ",", "**", "args", ")", ":", "DEFINE_flag", "(", "EnumFlag", "(", "name", ",", "default", ",", "help", ...
Registers a flag whose value can be any string from enum_values. Args: name: A string, the flag name. default: The default value of the flag. enum_values: A list of strings with the possible values for the flag. help: A help string. flag_values: FlagValues object with which the flag will be regis...
[ "Registers", "a", "flag", "whose", "value", "can", "be", "any", "string", "from", "enum_values", "." ]
4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6
https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/__init__.py#L639-L656
train
google/python-gflags
gflags/__init__.py
DEFINE_list
def DEFINE_list( # pylint: disable=g-bad-name,redefined-builtin name, default, help, flag_values=FLAGS, **args): """Registers a flag whose value is a comma-separated list of strings. The flag value is parsed with a CSV parser. Args: name: A string, the flag name. default: The default value of the f...
python
def DEFINE_list( # pylint: disable=g-bad-name,redefined-builtin name, default, help, flag_values=FLAGS, **args): """Registers a flag whose value is a comma-separated list of strings. The flag value is parsed with a CSV parser. Args: name: A string, the flag name. default: The default value of the f...
[ "def", "DEFINE_list", "(", "name", ",", "default", ",", "help", ",", "flag_values", "=", "FLAGS", ",", "**", "args", ")", ":", "parser", "=", "ListParser", "(", ")", "serializer", "=", "CsvListSerializer", "(", "','", ")", "DEFINE", "(", "parser", ",", ...
Registers a flag whose value is a comma-separated list of strings. The flag value is parsed with a CSV parser. Args: name: A string, the flag name. default: The default value of the flag. help: A help string. flag_values: FlagValues object with which the flag will be registered. **args: Dictio...
[ "Registers", "a", "flag", "whose", "value", "is", "a", "comma", "-", "separated", "list", "of", "strings", "." ]
4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6
https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/__init__.py#L659-L675
train
google/python-gflags
gflags/__init__.py
DEFINE_multi
def DEFINE_multi( # pylint: disable=g-bad-name,redefined-builtin parser, serializer, name, default, help, flag_values=FLAGS, module_name=None, **args): """Registers a generic MultiFlag that parses its args with a given parser. Auxiliary function. Normal users should NOT use it directly. Developers who...
python
def DEFINE_multi( # pylint: disable=g-bad-name,redefined-builtin parser, serializer, name, default, help, flag_values=FLAGS, module_name=None, **args): """Registers a generic MultiFlag that parses its args with a given parser. Auxiliary function. Normal users should NOT use it directly. Developers who...
[ "def", "DEFINE_multi", "(", "parser", ",", "serializer", ",", "name", ",", "default", ",", "help", ",", "flag_values", "=", "FLAGS", ",", "module_name", "=", "None", ",", "**", "args", ")", ":", "DEFINE_flag", "(", "MultiFlag", "(", "parser", ",", "seria...
Registers a generic MultiFlag that parses its args with a given parser. Auxiliary function. Normal users should NOT use it directly. Developers who need to create their own 'Parser' classes for options which can appear multiple times can call this module function to register their flags. Args: parser:...
[ "Registers", "a", "generic", "MultiFlag", "that", "parses", "its", "args", "with", "a", "given", "parser", "." ]
4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6
https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/__init__.py#L700-L724
train
google/python-gflags
gflags/__init__.py
DEFINE_multi_float
def DEFINE_multi_float( # pylint: disable=g-bad-name,redefined-builtin name, default, help, lower_bound=None, upper_bound=None, flag_values=FLAGS, **args): """Registers a flag whose value can be a list of arbitrary floats. Use the flag on the command line multiple times to place multiple float values in...
python
def DEFINE_multi_float( # pylint: disable=g-bad-name,redefined-builtin name, default, help, lower_bound=None, upper_bound=None, flag_values=FLAGS, **args): """Registers a flag whose value can be a list of arbitrary floats. Use the flag on the command line multiple times to place multiple float values in...
[ "def", "DEFINE_multi_float", "(", "name", ",", "default", ",", "help", ",", "lower_bound", "=", "None", ",", "upper_bound", "=", "None", ",", "flag_values", "=", "FLAGS", ",", "**", "args", ")", ":", "parser", "=", "FloatParser", "(", "lower_bound", ",", ...
Registers a flag whose value can be a list of arbitrary floats. Use the flag on the command line multiple times to place multiple float values into the list. The 'default' may be a single float (which will be converted into a single-element list) or a list of floats. Args: name: A string, the flag name...
[ "Registers", "a", "flag", "whose", "value", "can", "be", "a", "list", "of", "arbitrary", "floats", "." ]
4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6
https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/__init__.py#L775-L797
train
google/python-gflags
gflags/__init__.py
DEFINE_alias
def DEFINE_alias(name, original_name, flag_values=FLAGS, module_name=None): # pylint: disable=g-bad-name """Defines an alias flag for an existing one. Args: name: A string, name of the alias flag. original_name: A string, name of the original flag. flag_values: FlagValues object with which the flag wi...
python
def DEFINE_alias(name, original_name, flag_values=FLAGS, module_name=None): # pylint: disable=g-bad-name """Defines an alias flag for an existing one. Args: name: A string, name of the alias flag. original_name: A string, name of the original flag. flag_values: FlagValues object with which the flag wi...
[ "def", "DEFINE_alias", "(", "name", ",", "original_name", ",", "flag_values", "=", "FLAGS", ",", "module_name", "=", "None", ")", ":", "if", "original_name", "not", "in", "flag_values", ":", "raise", "UnrecognizedFlagError", "(", "original_name", ")", "flag", ...
Defines an alias flag for an existing one. Args: name: A string, name of the alias flag. original_name: A string, name of the original flag. flag_values: FlagValues object with which the flag will be registered. module_name: A string, the name of the module that defines this flag. Raises: gfla...
[ "Defines", "an", "alias", "flag", "for", "an", "existing", "one", "." ]
4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6
https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/__init__.py#L825-L865
train
google/python-gflags
gflags/exceptions.py
DuplicateFlagError.from_flag
def from_flag(cls, flagname, flag_values, other_flag_values=None): """Create a DuplicateFlagError by providing flag name and values. Args: flagname: Name of the flag being redefined. flag_values: FlagValues object containing the first definition of flagname. other_flag_values: If th...
python
def from_flag(cls, flagname, flag_values, other_flag_values=None): """Create a DuplicateFlagError by providing flag name and values. Args: flagname: Name of the flag being redefined. flag_values: FlagValues object containing the first definition of flagname. other_flag_values: If th...
[ "def", "from_flag", "(", "cls", ",", "flagname", ",", "flag_values", ",", "other_flag_values", "=", "None", ")", ":", "first_module", "=", "flag_values", ".", "FindModuleDefiningFlag", "(", "flagname", ",", "default", "=", "'<unknown>'", ")", "if", "other_flag_v...
Create a DuplicateFlagError by providing flag name and values. Args: flagname: Name of the flag being redefined. flag_values: FlagValues object containing the first definition of flagname. other_flag_values: If this argument is not None, it should be the FlagValues object wher...
[ "Create", "a", "DuplicateFlagError", "by", "providing", "flag", "name", "and", "values", "." ]
4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6
https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/exceptions.py#L71-L98
train
google/python-gflags
gflags/argument_parser.py
BooleanParser.convert
def convert(self, argument): """Converts the argument to a boolean; raise ValueError on errors.""" if isinstance(argument, str): if argument.lower() in ['true', 't', '1']: return True elif argument.lower() in ['false', 'f', '0']: return False bool_argument = bool(argument) i...
python
def convert(self, argument): """Converts the argument to a boolean; raise ValueError on errors.""" if isinstance(argument, str): if argument.lower() in ['true', 't', '1']: return True elif argument.lower() in ['false', 'f', '0']: return False bool_argument = bool(argument) i...
[ "def", "convert", "(", "self", ",", "argument", ")", ":", "if", "isinstance", "(", "argument", ",", "str", ")", ":", "if", "argument", ".", "lower", "(", ")", "in", "[", "'true'", ",", "'t'", ",", "'1'", "]", ":", "return", "True", "elif", "argumen...
Converts the argument to a boolean; raise ValueError on errors.
[ "Converts", "the", "argument", "to", "a", "boolean", ";", "raise", "ValueError", "on", "errors", "." ]
4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6
https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/argument_parser.py#L270-L284
train
google/python-gflags
gflags/argument_parser.py
EnumParser.parse
def parse(self, argument): """Determine validity of argument and return the correct element of enum. If self.enum_values is empty, then all arguments are valid and argument will be returned. Otherwise, if argument matches an element in enum, then the first matching element will be returned. A...
python
def parse(self, argument): """Determine validity of argument and return the correct element of enum. If self.enum_values is empty, then all arguments are valid and argument will be returned. Otherwise, if argument matches an element in enum, then the first matching element will be returned. A...
[ "def", "parse", "(", "self", ",", "argument", ")", ":", "if", "not", "self", ".", "enum_values", ":", "return", "argument", "elif", "self", ".", "case_sensitive", ":", "if", "argument", "not", "in", "self", ".", "enum_values", ":", "raise", "ValueError", ...
Determine validity of argument and return the correct element of enum. If self.enum_values is empty, then all arguments are valid and argument will be returned. Otherwise, if argument matches an element in enum, then the first matching element will be returned. Args: argument: The supplied ...
[ "Determine", "validity", "of", "argument", "and", "return", "the", "correct", "element", "of", "enum", "." ]
4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6
https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/argument_parser.py#L311-L345
train
google/python-gflags
gflags/argument_parser.py
CsvListSerializer.serialize
def serialize(self, value): """Serialize a list as a string, if possible, or as a unicode string.""" if six.PY2: # In Python2 csv.writer doesn't accept unicode, so we convert to UTF-8. output = io.BytesIO() csv.writer(output).writerow([unicode(x).encode('utf-8') for x in value]) serializ...
python
def serialize(self, value): """Serialize a list as a string, if possible, or as a unicode string.""" if six.PY2: # In Python2 csv.writer doesn't accept unicode, so we convert to UTF-8. output = io.BytesIO() csv.writer(output).writerow([unicode(x).encode('utf-8') for x in value]) serializ...
[ "def", "serialize", "(", "self", ",", "value", ")", ":", "if", "six", ".", "PY2", ":", "output", "=", "io", ".", "BytesIO", "(", ")", "csv", ".", "writer", "(", "output", ")", ".", "writerow", "(", "[", "unicode", "(", "x", ")", ".", "encode", ...
Serialize a list as a string, if possible, or as a unicode string.
[ "Serialize", "a", "list", "as", "a", "string", "if", "possible", "or", "as", "a", "unicode", "string", "." ]
4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6
https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/argument_parser.py#L365-L380
train
shichao-an/soundmeter
soundmeter/meter.py
Meter.record
def record(self): """ Record PyAudio stream into StringIO output This coroutine keeps stream open; the stream is closed in stop() """ while True: frames = [] self.stream.start_stream() for i in range(self.num_frames): data = s...
python
def record(self): """ Record PyAudio stream into StringIO output This coroutine keeps stream open; the stream is closed in stop() """ while True: frames = [] self.stream.start_stream() for i in range(self.num_frames): data = s...
[ "def", "record", "(", "self", ")", ":", "while", "True", ":", "frames", "=", "[", "]", "self", ".", "stream", ".", "start_stream", "(", ")", "for", "i", "in", "range", "(", "self", ".", "num_frames", ")", ":", "data", "=", "self", ".", "stream", ...
Record PyAudio stream into StringIO output This coroutine keeps stream open; the stream is closed in stop()
[ "Record", "PyAudio", "stream", "into", "StringIO", "output" ]
89222cd45e6ac24da32a1197d6b4be891d63267d
https://github.com/shichao-an/soundmeter/blob/89222cd45e6ac24da32a1197d6b4be891d63267d/soundmeter/meter.py#L84-L104
train
shichao-an/soundmeter
soundmeter/meter.py
Meter.stop
def stop(self): """Stop the stream and terminate PyAudio""" self.prestop() if not self._graceful: self._graceful = True self.stream.stop_stream() self.audio.terminate() msg = 'Stopped' self.verbose_info(msg, log=False) # Log 'Stopped' anyway ...
python
def stop(self): """Stop the stream and terminate PyAudio""" self.prestop() if not self._graceful: self._graceful = True self.stream.stop_stream() self.audio.terminate() msg = 'Stopped' self.verbose_info(msg, log=False) # Log 'Stopped' anyway ...
[ "def", "stop", "(", "self", ")", ":", "self", ".", "prestop", "(", ")", "if", "not", "self", ".", "_graceful", ":", "self", ".", "_graceful", "=", "True", "self", ".", "stream", ".", "stop_stream", "(", ")", "self", ".", "audio", ".", "terminate", ...
Stop the stream and terminate PyAudio
[ "Stop", "the", "stream", "and", "terminate", "PyAudio" ]
89222cd45e6ac24da32a1197d6b4be891d63267d
https://github.com/shichao-an/soundmeter/blob/89222cd45e6ac24da32a1197d6b4be891d63267d/soundmeter/meter.py#L161-L179
train
shichao-an/soundmeter
soundmeter/meter.py
Meter.get_threshold
def get_threshold(self): """Get and validate raw RMS value from threshold""" if self.threshold.startswith('+'): if self.threshold[1:].isdigit(): self._threshold = int(self.threshold[1:]) self._upper = True elif self.threshold.startswith('-'): ...
python
def get_threshold(self): """Get and validate raw RMS value from threshold""" if self.threshold.startswith('+'): if self.threshold[1:].isdigit(): self._threshold = int(self.threshold[1:]) self._upper = True elif self.threshold.startswith('-'): ...
[ "def", "get_threshold", "(", "self", ")", ":", "if", "self", ".", "threshold", ".", "startswith", "(", "'+'", ")", ":", "if", "self", ".", "threshold", "[", "1", ":", "]", ".", "isdigit", "(", ")", ":", "self", ".", "_threshold", "=", "int", "(", ...
Get and validate raw RMS value from threshold
[ "Get", "and", "validate", "raw", "RMS", "value", "from", "threshold" ]
89222cd45e6ac24da32a1197d6b4be891d63267d
https://github.com/shichao-an/soundmeter/blob/89222cd45e6ac24da32a1197d6b4be891d63267d/soundmeter/meter.py#L181-L197
train
shichao-an/soundmeter
soundmeter/meter.py
Meter.collect_rms
def collect_rms(self, rms): """Collect and calculate min, max and average RMS values""" if self._data: self._data['min'] = min(rms, self._data['min']) self._data['max'] = max(rms, self._data['max']) self._data['avg'] = float(rms + self._data['avg']) / 2 else: ...
python
def collect_rms(self, rms): """Collect and calculate min, max and average RMS values""" if self._data: self._data['min'] = min(rms, self._data['min']) self._data['max'] = max(rms, self._data['max']) self._data['avg'] = float(rms + self._data['avg']) / 2 else: ...
[ "def", "collect_rms", "(", "self", ",", "rms", ")", ":", "if", "self", ".", "_data", ":", "self", ".", "_data", "[", "'min'", "]", "=", "min", "(", "rms", ",", "self", ".", "_data", "[", "'min'", "]", ")", "self", ".", "_data", "[", "'max'", "]...
Collect and calculate min, max and average RMS values
[ "Collect", "and", "calculate", "min", "max", "and", "average", "RMS", "values" ]
89222cd45e6ac24da32a1197d6b4be891d63267d
https://github.com/shichao-an/soundmeter/blob/89222cd45e6ac24da32a1197d6b4be891d63267d/soundmeter/meter.py#L258-L267
train
chainside/btcpy
btcpy/structs/transaction.py
TimeBasedSequence.from_timedelta
def from_timedelta(cls, timedelta): """expects a datetime.timedelta object""" from math import ceil units = ceil(timedelta.total_seconds() / cls.time_unit) return cls.create(units)
python
def from_timedelta(cls, timedelta): """expects a datetime.timedelta object""" from math import ceil units = ceil(timedelta.total_seconds() / cls.time_unit) return cls.create(units)
[ "def", "from_timedelta", "(", "cls", ",", "timedelta", ")", ":", "from", "math", "import", "ceil", "units", "=", "ceil", "(", "timedelta", ".", "total_seconds", "(", ")", "/", "cls", ".", "time_unit", ")", "return", "cls", ".", "create", "(", "units", ...
expects a datetime.timedelta object
[ "expects", "a", "datetime", ".", "timedelta", "object" ]
8e75c630dacf0f997ed0e0e8739bed428a95d7b1
https://github.com/chainside/btcpy/blob/8e75c630dacf0f997ed0e0e8739bed428a95d7b1/btcpy/structs/transaction.py#L126-L130
train
chainside/btcpy
btcpy/lib/base58.py
b58decode_check
def b58decode_check(v: str) -> bytes: '''Decode and verify the checksum of a Base58 encoded string''' result = b58decode(v) result, check = result[:-4], result[-4:] digest = sha256(sha256(result).digest()).digest() if check != digest[:4]: raise ValueError("Invalid checksum") return re...
python
def b58decode_check(v: str) -> bytes: '''Decode and verify the checksum of a Base58 encoded string''' result = b58decode(v) result, check = result[:-4], result[-4:] digest = sha256(sha256(result).digest()).digest() if check != digest[:4]: raise ValueError("Invalid checksum") return re...
[ "def", "b58decode_check", "(", "v", ":", "str", ")", "->", "bytes", ":", "result", "=", "b58decode", "(", "v", ")", "result", ",", "check", "=", "result", "[", ":", "-", "4", "]", ",", "result", "[", "-", "4", ":", "]", "digest", "=", "sha256", ...
Decode and verify the checksum of a Base58 encoded string
[ "Decode", "and", "verify", "the", "checksum", "of", "a", "Base58", "encoded", "string" ]
8e75c630dacf0f997ed0e0e8739bed428a95d7b1
https://github.com/chainside/btcpy/blob/8e75c630dacf0f997ed0e0e8739bed428a95d7b1/btcpy/lib/base58.py#L64-L74
train
chainside/btcpy
btcpy/lib/bech32.py
bech32_decode
def bech32_decode(bech): """Validate a Bech32 string, and determine HRP and data.""" if ((any(ord(x) < 33 or ord(x) > 126 for x in bech)) or (bech.lower() != bech and bech.upper() != bech)): return None, None bech = bech.lower() pos = bech.rfind('1') if pos < 1 or pos + 7 > len(b...
python
def bech32_decode(bech): """Validate a Bech32 string, and determine HRP and data.""" if ((any(ord(x) < 33 or ord(x) > 126 for x in bech)) or (bech.lower() != bech and bech.upper() != bech)): return None, None bech = bech.lower() pos = bech.rfind('1') if pos < 1 or pos + 7 > len(b...
[ "def", "bech32_decode", "(", "bech", ")", ":", "if", "(", "(", "any", "(", "ord", "(", "x", ")", "<", "33", "or", "ord", "(", "x", ")", ">", "126", "for", "x", "in", "bech", ")", ")", "or", "(", "bech", ".", "lower", "(", ")", "!=", "bech",...
Validate a Bech32 string, and determine HRP and data.
[ "Validate", "a", "Bech32", "string", "and", "determine", "HRP", "and", "data", "." ]
8e75c630dacf0f997ed0e0e8739bed428a95d7b1
https://github.com/chainside/btcpy/blob/8e75c630dacf0f997ed0e0e8739bed428a95d7b1/btcpy/lib/bech32.py#L62-L77
train
yourlabs/django-session-security
session_security/middleware.py
SessionSecurityMiddleware.process_request
def process_request(self, request): """ Update last activity time or logout. """ if django.VERSION < (1, 10): is_authenticated = request.user.is_authenticated() else: is_authenticated = request.user.is_authenticated if not is_authenticated: r...
python
def process_request(self, request): """ Update last activity time or logout. """ if django.VERSION < (1, 10): is_authenticated = request.user.is_authenticated() else: is_authenticated = request.user.is_authenticated if not is_authenticated: r...
[ "def", "process_request", "(", "self", ",", "request", ")", ":", "if", "django", ".", "VERSION", "<", "(", "1", ",", "10", ")", ":", "is_authenticated", "=", "request", ".", "user", ".", "is_authenticated", "(", ")", "else", ":", "is_authenticated", "=",...
Update last activity time or logout.
[ "Update", "last", "activity", "time", "or", "logout", "." ]
5845c55f1c4b8cef8362302d64b396fc705e1a10
https://github.com/yourlabs/django-session-security/blob/5845c55f1c4b8cef8362302d64b396fc705e1a10/session_security/middleware.py#L56-L80
train
yourlabs/django-session-security
session_security/utils.py
get_last_activity
def get_last_activity(session): """ Get the last activity datetime string from the session and return the python datetime object. """ try: return datetime.strptime(session['_session_security'], '%Y-%m-%dT%H:%M:%S.%f') except AttributeError: #######################...
python
def get_last_activity(session): """ Get the last activity datetime string from the session and return the python datetime object. """ try: return datetime.strptime(session['_session_security'], '%Y-%m-%dT%H:%M:%S.%f') except AttributeError: #######################...
[ "def", "get_last_activity", "(", "session", ")", ":", "try", ":", "return", "datetime", ".", "strptime", "(", "session", "[", "'_session_security'", "]", ",", "'%Y-%m-%dT%H:%M:%S.%f'", ")", "except", "AttributeError", ":", "return", "datetime", ".", "now", "(", ...
Get the last activity datetime string from the session and return the python datetime object.
[ "Get", "the", "last", "activity", "datetime", "string", "from", "the", "session", "and", "return", "the", "python", "datetime", "object", "." ]
5845c55f1c4b8cef8362302d64b396fc705e1a10
https://github.com/yourlabs/django-session-security/blob/5845c55f1c4b8cef8362302d64b396fc705e1a10/session_security/utils.py#L11-L38
train
pythongssapi/python-gssapi
gssapi/creds.py
Credentials.name
def name(self): """Get the name associated with these credentials""" return self.inquire(name=True, lifetime=False, usage=False, mechs=False).name
python
def name(self): """Get the name associated with these credentials""" return self.inquire(name=True, lifetime=False, usage=False, mechs=False).name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "inquire", "(", "name", "=", "True", ",", "lifetime", "=", "False", ",", "usage", "=", "False", ",", "mechs", "=", "False", ")", ".", "name" ]
Get the name associated with these credentials
[ "Get", "the", "name", "associated", "with", "these", "credentials" ]
b6efe72aa35a4c1fe21b397e15fcb41611e365ce
https://github.com/pythongssapi/python-gssapi/blob/b6efe72aa35a4c1fe21b397e15fcb41611e365ce/gssapi/creds.py#L70-L73
train
pythongssapi/python-gssapi
gssapi/creds.py
Credentials.acquire
def acquire(cls, name=None, lifetime=None, mechs=None, usage='both', store=None): """Acquire GSSAPI credentials This method acquires credentials. If the `store` argument is used, the credentials will be acquired from the given credential store (if supported). Otherwise...
python
def acquire(cls, name=None, lifetime=None, mechs=None, usage='both', store=None): """Acquire GSSAPI credentials This method acquires credentials. If the `store` argument is used, the credentials will be acquired from the given credential store (if supported). Otherwise...
[ "def", "acquire", "(", "cls", ",", "name", "=", "None", ",", "lifetime", "=", "None", ",", "mechs", "=", "None", ",", "usage", "=", "'both'", ",", "store", "=", "None", ")", ":", "if", "store", "is", "None", ":", "res", "=", "rcreds", ".", "acqui...
Acquire GSSAPI credentials This method acquires credentials. If the `store` argument is used, the credentials will be acquired from the given credential store (if supported). Otherwise, the credentials are acquired from the default store. The credential store information is a...
[ "Acquire", "GSSAPI", "credentials" ]
b6efe72aa35a4c1fe21b397e15fcb41611e365ce
https://github.com/pythongssapi/python-gssapi/blob/b6efe72aa35a4c1fe21b397e15fcb41611e365ce/gssapi/creds.py#L94-L151
train
pythongssapi/python-gssapi
gssapi/creds.py
Credentials.store
def store(self, store=None, usage='both', mech=None, overwrite=False, set_default=False): """Store these credentials into the given store This method stores the current credentials into the specified credentials store. If the default store is used, support for :rfc:`5588`...
python
def store(self, store=None, usage='both', mech=None, overwrite=False, set_default=False): """Store these credentials into the given store This method stores the current credentials into the specified credentials store. If the default store is used, support for :rfc:`5588`...
[ "def", "store", "(", "self", ",", "store", "=", "None", ",", "usage", "=", "'both'", ",", "mech", "=", "None", ",", "overwrite", "=", "False", ",", "set_default", "=", "False", ")", ":", "if", "store", "is", "None", ":", "if", "rcred_rfc5588", "is", ...
Store these credentials into the given store This method stores the current credentials into the specified credentials store. If the default store is used, support for :rfc:`5588` is required. Otherwise, support for the credentials store extension is required. :requires-ext:`...
[ "Store", "these", "credentials", "into", "the", "given", "store" ]
b6efe72aa35a4c1fe21b397e15fcb41611e365ce
https://github.com/pythongssapi/python-gssapi/blob/b6efe72aa35a4c1fe21b397e15fcb41611e365ce/gssapi/creds.py#L153-L203
train
pythongssapi/python-gssapi
gssapi/creds.py
Credentials.impersonate
def impersonate(self, name=None, lifetime=None, mechs=None, usage='initiate'): """Impersonate a name using the current credentials This method acquires credentials by impersonating another name using the current credentials. :requires-ext:`s4u` Args: ...
python
def impersonate(self, name=None, lifetime=None, mechs=None, usage='initiate'): """Impersonate a name using the current credentials This method acquires credentials by impersonating another name using the current credentials. :requires-ext:`s4u` Args: ...
[ "def", "impersonate", "(", "self", ",", "name", "=", "None", ",", "lifetime", "=", "None", ",", "mechs", "=", "None", ",", "usage", "=", "'initiate'", ")", ":", "if", "rcred_s4u", "is", "None", ":", "raise", "NotImplementedError", "(", "\"Your GSSAPI imple...
Impersonate a name using the current credentials This method acquires credentials by impersonating another name using the current credentials. :requires-ext:`s4u` Args: name (Name): the name to impersonate lifetime (int): the desired lifetime of the new credent...
[ "Impersonate", "a", "name", "using", "the", "current", "credentials" ]
b6efe72aa35a4c1fe21b397e15fcb41611e365ce
https://github.com/pythongssapi/python-gssapi/blob/b6efe72aa35a4c1fe21b397e15fcb41611e365ce/gssapi/creds.py#L205-L236
train
pythongssapi/python-gssapi
gssapi/creds.py
Credentials.inquire
def inquire(self, name=True, lifetime=True, usage=True, mechs=True): """Inspect these credentials for information This method inspects these credentials for information about them. Args: name (bool): get the name associated with the credentials lifetime (bool): get the ...
python
def inquire(self, name=True, lifetime=True, usage=True, mechs=True): """Inspect these credentials for information This method inspects these credentials for information about them. Args: name (bool): get the name associated with the credentials lifetime (bool): get the ...
[ "def", "inquire", "(", "self", ",", "name", "=", "True", ",", "lifetime", "=", "True", ",", "usage", "=", "True", ",", "mechs", "=", "True", ")", ":", "res", "=", "rcreds", ".", "inquire_cred", "(", "self", ",", "name", ",", "lifetime", ",", "usage...
Inspect these credentials for information This method inspects these credentials for information about them. Args: name (bool): get the name associated with the credentials lifetime (bool): get the remaining lifetime for the credentials usage (bool): get the usage f...
[ "Inspect", "these", "credentials", "for", "information" ]
b6efe72aa35a4c1fe21b397e15fcb41611e365ce
https://github.com/pythongssapi/python-gssapi/blob/b6efe72aa35a4c1fe21b397e15fcb41611e365ce/gssapi/creds.py#L238-L267
train
pythongssapi/python-gssapi
gssapi/creds.py
Credentials.inquire_by_mech
def inquire_by_mech(self, mech, name=True, init_lifetime=True, accept_lifetime=True, usage=True): """Inspect these credentials for per-mechanism information This method inspects these credentials for per-mechanism information about them. Args: mech (...
python
def inquire_by_mech(self, mech, name=True, init_lifetime=True, accept_lifetime=True, usage=True): """Inspect these credentials for per-mechanism information This method inspects these credentials for per-mechanism information about them. Args: mech (...
[ "def", "inquire_by_mech", "(", "self", ",", "mech", ",", "name", "=", "True", ",", "init_lifetime", "=", "True", ",", "accept_lifetime", "=", "True", ",", "usage", "=", "True", ")", ":", "res", "=", "rcreds", ".", "inquire_cred_by_mech", "(", "self", ","...
Inspect these credentials for per-mechanism information This method inspects these credentials for per-mechanism information about them. Args: mech (OID): the mechanism for which to retrive the information name (bool): get the name associated with the credentials ...
[ "Inspect", "these", "credentials", "for", "per", "-", "mechanism", "information" ]
b6efe72aa35a4c1fe21b397e15fcb41611e365ce
https://github.com/pythongssapi/python-gssapi/blob/b6efe72aa35a4c1fe21b397e15fcb41611e365ce/gssapi/creds.py#L269-L301
train
pythongssapi/python-gssapi
gssapi/creds.py
Credentials.add
def add(self, name, mech, usage='both', init_lifetime=None, accept_lifetime=None, impersonator=None, store=None): """Acquire more credentials to add to the current set This method works like :meth:`acquire`, except that it adds the acquired credentials for a single mecha...
python
def add(self, name, mech, usage='both', init_lifetime=None, accept_lifetime=None, impersonator=None, store=None): """Acquire more credentials to add to the current set This method works like :meth:`acquire`, except that it adds the acquired credentials for a single mecha...
[ "def", "add", "(", "self", ",", "name", ",", "mech", ",", "usage", "=", "'both'", ",", "init_lifetime", "=", "None", ",", "accept_lifetime", "=", "None", ",", "impersonator", "=", "None", ",", "store", "=", "None", ")", ":", "if", "store", "is", "not...
Acquire more credentials to add to the current set This method works like :meth:`acquire`, except that it adds the acquired credentials for a single mechanism to a copy of the current set, instead of creating a new set for multiple mechanisms. Unlike :meth:`acquire`, you cannot pass Non...
[ "Acquire", "more", "credentials", "to", "add", "to", "the", "current", "set" ]
b6efe72aa35a4c1fe21b397e15fcb41611e365ce
https://github.com/pythongssapi/python-gssapi/blob/b6efe72aa35a4c1fe21b397e15fcb41611e365ce/gssapi/creds.py#L303-L386
train
pythongssapi/python-gssapi
gssapi/names.py
Name.display_as
def display_as(self, name_type): """ Display this name as the given name type. This method attempts to display the current :class:`Name` using the syntax of the given :class:`NameType`, if possible. Warning: In MIT krb5 versions below 1.13.3, this method can segfau...
python
def display_as(self, name_type): """ Display this name as the given name type. This method attempts to display the current :class:`Name` using the syntax of the given :class:`NameType`, if possible. Warning: In MIT krb5 versions below 1.13.3, this method can segfau...
[ "def", "display_as", "(", "self", ",", "name_type", ")", ":", "if", "rname_rfc6680", "is", "None", ":", "raise", "NotImplementedError", "(", "\"Your GSSAPI implementation does not \"", "\"support RFC 6680 (the GSSAPI naming \"", "\"extensions)\"", ")", "return", "rname_rfc6...
Display this name as the given name type. This method attempts to display the current :class:`Name` using the syntax of the given :class:`NameType`, if possible. Warning: In MIT krb5 versions below 1.13.3, this method can segfault if the name was not *originally* creat...
[ "Display", "this", "name", "as", "the", "given", "name", "type", "." ]
b6efe72aa35a4c1fe21b397e15fcb41611e365ce
https://github.com/pythongssapi/python-gssapi/blob/b6efe72aa35a4c1fe21b397e15fcb41611e365ce/gssapi/names.py#L125-L165
train
pythongssapi/python-gssapi
gssapi/names.py
Name.export
def export(self, composite=False): """Export this name as a token. This method exports the name into a byte string which can then be imported by using the `token` argument of the constructor. Args: composite (bool): whether or not use to a composite token -- ...
python
def export(self, composite=False): """Export this name as a token. This method exports the name into a byte string which can then be imported by using the `token` argument of the constructor. Args: composite (bool): whether or not use to a composite token -- ...
[ "def", "export", "(", "self", ",", "composite", "=", "False", ")", ":", "if", "composite", ":", "if", "rname_rfc6680", "is", "None", ":", "raise", "NotImplementedError", "(", "\"Your GSSAPI implementation does \"", "\"not support RFC 6680 (the GSSAPI \"", "\"naming exte...
Export this name as a token. This method exports the name into a byte string which can then be imported by using the `token` argument of the constructor. Args: composite (bool): whether or not use to a composite token -- :requires-ext:`rfc6680` Returns: ...
[ "Export", "this", "name", "as", "a", "token", "." ]
b6efe72aa35a4c1fe21b397e15fcb41611e365ce
https://github.com/pythongssapi/python-gssapi/blob/b6efe72aa35a4c1fe21b397e15fcb41611e365ce/gssapi/names.py#L188-L215
train
pythongssapi/python-gssapi
gssapi/names.py
Name._inquire
def _inquire(self, **kwargs): """Inspect this name for information. This method inspects the name for information. If no keyword arguments are passed, all available information is returned. Otherwise, only the keyword arguments that are passed and set to `True` are returned. ...
python
def _inquire(self, **kwargs): """Inspect this name for information. This method inspects the name for information. If no keyword arguments are passed, all available information is returned. Otherwise, only the keyword arguments that are passed and set to `True` are returned. ...
[ "def", "_inquire", "(", "self", ",", "**", "kwargs", ")", ":", "if", "rname_rfc6680", "is", "None", ":", "raise", "NotImplementedError", "(", "\"Your GSSAPI implementation does not \"", "\"support RFC 6680 (the GSSAPI naming \"", "\"extensions)\"", ")", "if", "not", "kw...
Inspect this name for information. This method inspects the name for information. If no keyword arguments are passed, all available information is returned. Otherwise, only the keyword arguments that are passed and set to `True` are returned. Args: mech_name (bool...
[ "Inspect", "this", "name", "for", "information", "." ]
b6efe72aa35a4c1fe21b397e15fcb41611e365ce
https://github.com/pythongssapi/python-gssapi/blob/b6efe72aa35a4c1fe21b397e15fcb41611e365ce/gssapi/names.py#L243-L279
train
pythongssapi/python-gssapi
gssapi/mechs.py
Mechanism.from_sasl_name
def from_sasl_name(cls, name=None): """ Create a Mechanism from its SASL name Args: name (str): SASL name of the desired mechanism Returns: Mechanism: the desired mechanism Raises: GSSError :requires-ext:`rfc5801` """ ...
python
def from_sasl_name(cls, name=None): """ Create a Mechanism from its SASL name Args: name (str): SASL name of the desired mechanism Returns: Mechanism: the desired mechanism Raises: GSSError :requires-ext:`rfc5801` """ ...
[ "def", "from_sasl_name", "(", "cls", ",", "name", "=", "None", ")", ":", "if", "rfc5801", "is", "None", ":", "raise", "NotImplementedError", "(", "\"Your GSSAPI implementation does not \"", "\"have support for RFC 5801\"", ")", "if", "isinstance", "(", "name", ",", ...
Create a Mechanism from its SASL name Args: name (str): SASL name of the desired mechanism Returns: Mechanism: the desired mechanism Raises: GSSError :requires-ext:`rfc5801`
[ "Create", "a", "Mechanism", "from", "its", "SASL", "name" ]
b6efe72aa35a4c1fe21b397e15fcb41611e365ce
https://github.com/pythongssapi/python-gssapi/blob/b6efe72aa35a4c1fe21b397e15fcb41611e365ce/gssapi/mechs.py#L141-L164
train
pythongssapi/python-gssapi
gssapi/_utils.py
import_gssapi_extension
def import_gssapi_extension(name): """Import a GSSAPI extension module This method imports a GSSAPI extension module based on the name of the extension (not including the 'ext_' prefix). If the extension is not available, the method retuns None. Args: name (str): the name of the exten...
python
def import_gssapi_extension(name): """Import a GSSAPI extension module This method imports a GSSAPI extension module based on the name of the extension (not including the 'ext_' prefix). If the extension is not available, the method retuns None. Args: name (str): the name of the exten...
[ "def", "import_gssapi_extension", "(", "name", ")", ":", "try", ":", "path", "=", "'gssapi.raw.ext_{0}'", ".", "format", "(", "name", ")", "__import__", "(", "path", ")", "return", "sys", ".", "modules", "[", "path", "]", "except", "ImportError", ":", "ret...
Import a GSSAPI extension module This method imports a GSSAPI extension module based on the name of the extension (not including the 'ext_' prefix). If the extension is not available, the method retuns None. Args: name (str): the name of the extension Returns: module: Either ...
[ "Import", "a", "GSSAPI", "extension", "module" ]
b6efe72aa35a4c1fe21b397e15fcb41611e365ce
https://github.com/pythongssapi/python-gssapi/blob/b6efe72aa35a4c1fe21b397e15fcb41611e365ce/gssapi/_utils.py#L10-L30
train
pythongssapi/python-gssapi
gssapi/_utils.py
inquire_property
def inquire_property(name, doc=None): """Creates a property based on an inquire result This method creates a property that calls the :python:`_inquire` method, and return the value of the requested information. Args: name (str): the name of the 'inquire' result information Returns: ...
python
def inquire_property(name, doc=None): """Creates a property based on an inquire result This method creates a property that calls the :python:`_inquire` method, and return the value of the requested information. Args: name (str): the name of the 'inquire' result information Returns: ...
[ "def", "inquire_property", "(", "name", ",", "doc", "=", "None", ")", ":", "def", "inquire_property", "(", "self", ")", ":", "if", "not", "self", ".", "_started", ":", "msg", "=", "(", "\"Cannot read {0} from a security context whose \"", "\"establishment has not ...
Creates a property based on an inquire result This method creates a property that calls the :python:`_inquire` method, and return the value of the requested information. Args: name (str): the name of the 'inquire' result information Returns: property: the created property
[ "Creates", "a", "property", "based", "on", "an", "inquire", "result" ]
b6efe72aa35a4c1fe21b397e15fcb41611e365ce
https://github.com/pythongssapi/python-gssapi/blob/b6efe72aa35a4c1fe21b397e15fcb41611e365ce/gssapi/_utils.py#L46-L68
train
pythongssapi/python-gssapi
gssapi/_utils.py
_encode_dict
def _encode_dict(d): """Encodes any relevant strings in a dict""" def enc(x): if isinstance(x, six.text_type): return x.encode(_ENCODING) else: return x return dict((enc(k), enc(v)) for k, v in six.iteritems(d))
python
def _encode_dict(d): """Encodes any relevant strings in a dict""" def enc(x): if isinstance(x, six.text_type): return x.encode(_ENCODING) else: return x return dict((enc(k), enc(v)) for k, v in six.iteritems(d))
[ "def", "_encode_dict", "(", "d", ")", ":", "def", "enc", "(", "x", ")", ":", "if", "isinstance", "(", "x", ",", "six", ".", "text_type", ")", ":", "return", "x", ".", "encode", "(", "_ENCODING", ")", "else", ":", "return", "x", "return", "dict", ...
Encodes any relevant strings in a dict
[ "Encodes", "any", "relevant", "strings", "in", "a", "dict" ]
b6efe72aa35a4c1fe21b397e15fcb41611e365ce
https://github.com/pythongssapi/python-gssapi/blob/b6efe72aa35a4c1fe21b397e15fcb41611e365ce/gssapi/_utils.py#L101-L109
train
pythongssapi/python-gssapi
gssapi/_utils.py
catch_and_return_token
def catch_and_return_token(func, self, *args, **kwargs): """Optionally defer exceptions and return a token instead When `__DEFER_STEP_ERRORS__` is set on the implementing class or instance, methods wrapped with this wrapper will catch and save their :python:`GSSError` exceptions and instead return ...
python
def catch_and_return_token(func, self, *args, **kwargs): """Optionally defer exceptions and return a token instead When `__DEFER_STEP_ERRORS__` is set on the implementing class or instance, methods wrapped with this wrapper will catch and save their :python:`GSSError` exceptions and instead return ...
[ "def", "catch_and_return_token", "(", "func", ",", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "try", ":", "return", "func", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", "except", "GSSError", "as", "e", ":", "if", "e", ".",...
Optionally defer exceptions and return a token instead When `__DEFER_STEP_ERRORS__` is set on the implementing class or instance, methods wrapped with this wrapper will catch and save their :python:`GSSError` exceptions and instead return the result token attached to the exception. The exception c...
[ "Optionally", "defer", "exceptions", "and", "return", "a", "token", "instead" ]
b6efe72aa35a4c1fe21b397e15fcb41611e365ce
https://github.com/pythongssapi/python-gssapi/blob/b6efe72aa35a4c1fe21b397e15fcb41611e365ce/gssapi/_utils.py#L114-L139
train
pythongssapi/python-gssapi
gssapi/_utils.py
check_last_err
def check_last_err(func, self, *args, **kwargs): """Check and raise deferred errors before running the function This method checks :python:`_last_err` before running the wrapped function. If present and not None, the exception will be raised with its original traceback. """ if self._last_err ...
python
def check_last_err(func, self, *args, **kwargs): """Check and raise deferred errors before running the function This method checks :python:`_last_err` before running the wrapped function. If present and not None, the exception will be raised with its original traceback. """ if self._last_err ...
[ "def", "check_last_err", "(", "func", ",", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "if", "self", ".", "_last_err", "is", "not", "None", ":", "try", ":", "if", "six", ".", "PY2", ":", "six", ".", "reraise", "(", "type", "(", "self...
Check and raise deferred errors before running the function This method checks :python:`_last_err` before running the wrapped function. If present and not None, the exception will be raised with its original traceback.
[ "Check", "and", "raise", "deferred", "errors", "before", "running", "the", "function" ]
b6efe72aa35a4c1fe21b397e15fcb41611e365ce
https://github.com/pythongssapi/python-gssapi/blob/b6efe72aa35a4c1fe21b397e15fcb41611e365ce/gssapi/_utils.py#L143-L177
train
theislab/scvelo
scvelo/plotting/velocity_graph.py
velocity_graph
def velocity_graph(adata, basis=None, vkey='velocity', which_graph='velocity', n_neighbors=10, alpha=.8, perc=90, edge_width=.2, edge_color='grey', color=None, use_raw=None, layer=None, color_map=None, colorbar=True, palette=None, size=None, sort_order=True, groups=None, ...
python
def velocity_graph(adata, basis=None, vkey='velocity', which_graph='velocity', n_neighbors=10, alpha=.8, perc=90, edge_width=.2, edge_color='grey', color=None, use_raw=None, layer=None, color_map=None, colorbar=True, palette=None, size=None, sort_order=True, groups=None, ...
[ "def", "velocity_graph", "(", "adata", ",", "basis", "=", "None", ",", "vkey", "=", "'velocity'", ",", "which_graph", "=", "'velocity'", ",", "n_neighbors", "=", "10", ",", "alpha", "=", ".8", ",", "perc", "=", "90", ",", "edge_width", "=", ".2", ",", ...
\ Plot of the velocity graph. Arguments --------- adata: :class:`~anndata.AnnData` Annotated data matrix. vkey: `str` or `None` (default: `None`) Key for annotations of observations/cells or variables/genes. which_graph: `'velocity'` or `'neighbors'` (default: `'velocity'`) ...
[ "\\", "Plot", "of", "the", "velocity", "graph", "." ]
c7a96d70edfe705e86bf364434a9527d4fd8df11
https://github.com/theislab/scvelo/blob/c7a96d70edfe705e86bf364434a9527d4fd8df11/scvelo/plotting/velocity_graph.py#L13-L63
train
theislab/scvelo
scvelo/preprocessing/utils.py
cleanup
def cleanup(data, clean='layers', keep=None, copy=False): """Deletes attributes not needed. Arguments --------- data: :class:`~anndata.AnnData` Annotated data matrix. clean: `str` or list of `str` (default: `layers`) Which attributes to consider for freeing memory. keep: `str` o...
python
def cleanup(data, clean='layers', keep=None, copy=False): """Deletes attributes not needed. Arguments --------- data: :class:`~anndata.AnnData` Annotated data matrix. clean: `str` or list of `str` (default: `layers`) Which attributes to consider for freeing memory. keep: `str` o...
[ "def", "cleanup", "(", "data", ",", "clean", "=", "'layers'", ",", "keep", "=", "None", ",", "copy", "=", "False", ")", ":", "adata", "=", "data", ".", "copy", "(", ")", "if", "copy", "else", "data", "keep", "=", "list", "(", "[", "keep", "]", ...
Deletes attributes not needed. Arguments --------- data: :class:`~anndata.AnnData` Annotated data matrix. clean: `str` or list of `str` (default: `layers`) Which attributes to consider for freeing memory. keep: `str` or list of `str` (default: None) Which attributes to keep....
[ "Deletes", "attributes", "not", "needed", "." ]
c7a96d70edfe705e86bf364434a9527d4fd8df11
https://github.com/theislab/scvelo/blob/c7a96d70edfe705e86bf364434a9527d4fd8df11/scvelo/preprocessing/utils.py#L30-L63
train
theislab/scvelo
scvelo/preprocessing/utils.py
filter_genes
def filter_genes(data, min_counts=None, min_cells=None, max_counts=None, max_cells=None, min_counts_u=None, min_cells_u=None, max_counts_u=None, max_cells_u=None, min_shared_counts=None, min_shared_cells=None, copy=False): """Filter genes based on number of cells or counts. Ke...
python
def filter_genes(data, min_counts=None, min_cells=None, max_counts=None, max_cells=None, min_counts_u=None, min_cells_u=None, max_counts_u=None, max_cells_u=None, min_shared_counts=None, min_shared_cells=None, copy=False): """Filter genes based on number of cells or counts. Ke...
[ "def", "filter_genes", "(", "data", ",", "min_counts", "=", "None", ",", "min_cells", "=", "None", ",", "max_counts", "=", "None", ",", "max_cells", "=", "None", ",", "min_counts_u", "=", "None", ",", "min_cells_u", "=", "None", ",", "max_counts_u", "=", ...
Filter genes based on number of cells or counts. Keep genes that have at least `min_counts` counts or are expressed in at least `min_cells` cells or have at most `max_counts` counts or are expressed in at most `max_cells` cells. Only provide one of the optional parameters `min_counts`, `min_cells`, ...
[ "Filter", "genes", "based", "on", "number", "of", "cells", "or", "counts", ".", "Keep", "genes", "that", "have", "at", "least", "min_counts", "counts", "or", "are", "expressed", "in", "at", "least", "min_cells", "cells", "or", "have", "at", "most", "max_co...
c7a96d70edfe705e86bf364434a9527d4fd8df11
https://github.com/theislab/scvelo/blob/c7a96d70edfe705e86bf364434a9527d4fd8df11/scvelo/preprocessing/utils.py#L99-L185
train
theislab/scvelo
scvelo/preprocessing/utils.py
filter_genes_dispersion
def filter_genes_dispersion(data, flavor='seurat', min_disp=None, max_disp=None, min_mean=None, max_mean=None, n_bins=20, n_top_genes=None, log=True, copy=False): """Extract highly variable genes. The normalized dispersion is obtained by scaling with the mean and standard deviati...
python
def filter_genes_dispersion(data, flavor='seurat', min_disp=None, max_disp=None, min_mean=None, max_mean=None, n_bins=20, n_top_genes=None, log=True, copy=False): """Extract highly variable genes. The normalized dispersion is obtained by scaling with the mean and standard deviati...
[ "def", "filter_genes_dispersion", "(", "data", ",", "flavor", "=", "'seurat'", ",", "min_disp", "=", "None", ",", "max_disp", "=", "None", ",", "min_mean", "=", "None", ",", "max_mean", "=", "None", ",", "n_bins", "=", "20", ",", "n_top_genes", "=", "Non...
Extract highly variable genes. The normalized dispersion is obtained by scaling with the mean and standard deviation of the dispersions for genes falling into a given bin for mean expression of genes. This means that for each bin of mean expression, highly variable genes are selected. Parameters ...
[ "Extract", "highly", "variable", "genes", ".", "The", "normalized", "dispersion", "is", "obtained", "by", "scaling", "with", "the", "mean", "and", "standard", "deviation", "of", "the", "dispersions", "for", "genes", "falling", "into", "a", "given", "bin", "for...
c7a96d70edfe705e86bf364434a9527d4fd8df11
https://github.com/theislab/scvelo/blob/c7a96d70edfe705e86bf364434a9527d4fd8df11/scvelo/preprocessing/utils.py#L188-L251
train
theislab/scvelo
scvelo/preprocessing/utils.py
normalize_per_cell
def normalize_per_cell(data, counts_per_cell_after=None, counts_per_cell=None, key_n_counts=None, max_proportion_per_cell=None, use_initial_size=True, layers=['spliced', 'unspliced'], enforce=False, copy=False): """Normalize each cell by total counts over all genes. ...
python
def normalize_per_cell(data, counts_per_cell_after=None, counts_per_cell=None, key_n_counts=None, max_proportion_per_cell=None, use_initial_size=True, layers=['spliced', 'unspliced'], enforce=False, copy=False): """Normalize each cell by total counts over all genes. ...
[ "def", "normalize_per_cell", "(", "data", ",", "counts_per_cell_after", "=", "None", ",", "counts_per_cell", "=", "None", ",", "key_n_counts", "=", "None", ",", "max_proportion_per_cell", "=", "None", ",", "use_initial_size", "=", "True", ",", "layers", "=", "["...
Normalize each cell by total counts over all genes. Parameters ---------- data : :class:`~anndata.AnnData`, `np.ndarray`, `sp.sparse` The (annotated) data matrix of shape `n_obs` × `n_vars`. Rows correspond to cells and columns to genes. counts_per_cell_after : `float` or `None`, option...
[ "Normalize", "each", "cell", "by", "total", "counts", "over", "all", "genes", "." ]
c7a96d70edfe705e86bf364434a9527d4fd8df11
https://github.com/theislab/scvelo/blob/c7a96d70edfe705e86bf364434a9527d4fd8df11/scvelo/preprocessing/utils.py#L266-L325
train
theislab/scvelo
scvelo/preprocessing/utils.py
filter_and_normalize
def filter_and_normalize(data, min_counts=None, min_counts_u=None, min_cells=None, min_cells_u=None, min_shared_counts=None, min_shared_cells=None, n_top_genes=None, flavor='seurat', log=True, copy=False): """Filtering, normalization and log transform Expects n...
python
def filter_and_normalize(data, min_counts=None, min_counts_u=None, min_cells=None, min_cells_u=None, min_shared_counts=None, min_shared_cells=None, n_top_genes=None, flavor='seurat', log=True, copy=False): """Filtering, normalization and log transform Expects n...
[ "def", "filter_and_normalize", "(", "data", ",", "min_counts", "=", "None", ",", "min_counts_u", "=", "None", ",", "min_cells", "=", "None", ",", "min_cells_u", "=", "None", ",", "min_shared_counts", "=", "None", ",", "min_shared_cells", "=", "None", ",", "n...
Filtering, normalization and log transform Expects non-logarithmized data. If using logarithmized data, pass `log=False`. Runs the following steps .. code:: python scv.pp.filter_genes(adata) scv.pp.normalize_per_cell(adata) if n_top_genes is not None: scv.pp.filter_ge...
[ "Filtering", "normalization", "and", "log", "transform" ]
c7a96d70edfe705e86bf364434a9527d4fd8df11
https://github.com/theislab/scvelo/blob/c7a96d70edfe705e86bf364434a9527d4fd8df11/scvelo/preprocessing/utils.py#L347-L414
train
theislab/scvelo
scvelo/datasets.py
toy_data
def toy_data(n_obs): """ Randomly samples from the Dentate Gyrus dataset. Arguments --------- n_obs: `int` Size of the sampled dataset Returns ------- Returns `adata` object """ """Random samples from Dentate Gyrus. """ adata = dentategyrus() indices = np.r...
python
def toy_data(n_obs): """ Randomly samples from the Dentate Gyrus dataset. Arguments --------- n_obs: `int` Size of the sampled dataset Returns ------- Returns `adata` object """ """Random samples from Dentate Gyrus. """ adata = dentategyrus() indices = np.r...
[ "def", "toy_data", "(", "n_obs", ")", ":", "adata", "=", "dentategyrus", "(", ")", "indices", "=", "np", ".", "random", ".", "choice", "(", "adata", ".", "n_obs", ",", "n_obs", ")", "adata", "=", "adata", "[", "indices", "]", "adata", ".", "obs_names...
Randomly samples from the Dentate Gyrus dataset. Arguments --------- n_obs: `int` Size of the sampled dataset Returns ------- Returns `adata` object
[ "Randomly", "samples", "from", "the", "Dentate", "Gyrus", "dataset", "." ]
c7a96d70edfe705e86bf364434a9527d4fd8df11
https://github.com/theislab/scvelo/blob/c7a96d70edfe705e86bf364434a9527d4fd8df11/scvelo/datasets.py#L10-L31
train
theislab/scvelo
scvelo/datasets.py
forebrain
def forebrain(): """Developing human forebrain. Forebrain tissue of a week 10 embryo, focusing on the glutamatergic neuronal lineage. Returns ------- Returns `adata` object """ filename = 'data/ForebrainGlut/hgForebrainGlut.loom' url = 'http://pklab.med.harvard.edu/velocyto/hgForebrainG...
python
def forebrain(): """Developing human forebrain. Forebrain tissue of a week 10 embryo, focusing on the glutamatergic neuronal lineage. Returns ------- Returns `adata` object """ filename = 'data/ForebrainGlut/hgForebrainGlut.loom' url = 'http://pklab.med.harvard.edu/velocyto/hgForebrainG...
[ "def", "forebrain", "(", ")", ":", "filename", "=", "'data/ForebrainGlut/hgForebrainGlut.loom'", "url", "=", "'http://pklab.med.harvard.edu/velocyto/hgForebrainGlut/hgForebrainGlut.loom'", "adata", "=", "read", "(", "filename", ",", "backup_url", "=", "url", ",", "cleanup",...
Developing human forebrain. Forebrain tissue of a week 10 embryo, focusing on the glutamatergic neuronal lineage. Returns ------- Returns `adata` object
[ "Developing", "human", "forebrain", ".", "Forebrain", "tissue", "of", "a", "week", "10", "embryo", "focusing", "on", "the", "glutamatergic", "neuronal", "lineage", "." ]
c7a96d70edfe705e86bf364434a9527d4fd8df11
https://github.com/theislab/scvelo/blob/c7a96d70edfe705e86bf364434a9527d4fd8df11/scvelo/datasets.py#L68-L80
train
theislab/scvelo
scvelo/settings.py
set_rcParams_scvelo
def set_rcParams_scvelo(fontsize=8, color_map=None, frameon=None): """Set matplotlib.rcParams to scvelo defaults.""" # dpi options (mpl default: 100, 100) rcParams['figure.dpi'] = 100 rcParams['savefig.dpi'] = 150 # figure (mpl default: 0.125, 0.96, 0.15, 0.91) rcParams['figure.figsize'] = (7,...
python
def set_rcParams_scvelo(fontsize=8, color_map=None, frameon=None): """Set matplotlib.rcParams to scvelo defaults.""" # dpi options (mpl default: 100, 100) rcParams['figure.dpi'] = 100 rcParams['savefig.dpi'] = 150 # figure (mpl default: 0.125, 0.96, 0.15, 0.91) rcParams['figure.figsize'] = (7,...
[ "def", "set_rcParams_scvelo", "(", "fontsize", "=", "8", ",", "color_map", "=", "None", ",", "frameon", "=", "None", ")", ":", "rcParams", "[", "'figure.dpi'", "]", "=", "100", "rcParams", "[", "'savefig.dpi'", "]", "=", "150", "rcParams", "[", "'figure.fi...
Set matplotlib.rcParams to scvelo defaults.
[ "Set", "matplotlib", ".", "rcParams", "to", "scvelo", "defaults", "." ]
c7a96d70edfe705e86bf364434a9527d4fd8df11
https://github.com/theislab/scvelo/blob/c7a96d70edfe705e86bf364434a9527d4fd8df11/scvelo/settings.py#L84-L147
train
theislab/scvelo
scvelo/read_load.py
merge
def merge(adata, ldata, copy=True): """Merges two annotated data matrices. Arguments --------- adata: :class:`~anndata.AnnData` Annotated data matrix (reference data set). ldata: :class:`~anndata.AnnData` Annotated data matrix (to be merged into adata). Returns ------- ...
python
def merge(adata, ldata, copy=True): """Merges two annotated data matrices. Arguments --------- adata: :class:`~anndata.AnnData` Annotated data matrix (reference data set). ldata: :class:`~anndata.AnnData` Annotated data matrix (to be merged into adata). Returns ------- ...
[ "def", "merge", "(", "adata", ",", "ldata", ",", "copy", "=", "True", ")", ":", "if", "'spliced'", "in", "ldata", ".", "layers", ".", "keys", "(", ")", "and", "'initial_size_spliced'", "not", "in", "ldata", ".", "obs", ".", "keys", "(", ")", ":", "...
Merges two annotated data matrices. Arguments --------- adata: :class:`~anndata.AnnData` Annotated data matrix (reference data set). ldata: :class:`~anndata.AnnData` Annotated data matrix (to be merged into adata). Returns ------- Returns a :class:`~anndata.AnnData` object
[ "Merges", "two", "annotated", "data", "matrices", "." ]
c7a96d70edfe705e86bf364434a9527d4fd8df11
https://github.com/theislab/scvelo/blob/c7a96d70edfe705e86bf364434a9527d4fd8df11/scvelo/read_load.py#L102-L158
train
theislab/scvelo
scvelo/tools/velocity_graph.py
velocity_graph
def velocity_graph(data, vkey='velocity', xkey='Ms', tkey=None, basis=None, n_neighbors=None, n_recurse_neighbors=None, random_neighbors_at_max=None, sqrt_transform=False, approx=False, copy=False): """Computes velocity graph based on cosine similarities. The cosine similarities are computed...
python
def velocity_graph(data, vkey='velocity', xkey='Ms', tkey=None, basis=None, n_neighbors=None, n_recurse_neighbors=None, random_neighbors_at_max=None, sqrt_transform=False, approx=False, copy=False): """Computes velocity graph based on cosine similarities. The cosine similarities are computed...
[ "def", "velocity_graph", "(", "data", ",", "vkey", "=", "'velocity'", ",", "xkey", "=", "'Ms'", ",", "tkey", "=", "None", ",", "basis", "=", "None", ",", "n_neighbors", "=", "None", ",", "n_recurse_neighbors", "=", "None", ",", "random_neighbors_at_max", "...
Computes velocity graph based on cosine similarities. The cosine similarities are computed between velocities and potential cell state transitions. Arguments --------- data: :class:`~anndata.AnnData` Annotated data matrix. vkey: `str` (default: `'velocity'`) Name of velocity estima...
[ "Computes", "velocity", "graph", "based", "on", "cosine", "similarities", "." ]
c7a96d70edfe705e86bf364434a9527d4fd8df11
https://github.com/theislab/scvelo/blob/c7a96d70edfe705e86bf364434a9527d4fd8df11/scvelo/tools/velocity_graph.py#L120-L168
train
theislab/scvelo
scvelo/tools/optimization.py
optimize_NxN
def optimize_NxN(x, y, fit_offset=False, perc=None): """Just to compare with closed-form solution """ if perc is not None: if not fit_offset and isinstance(perc, (list, tuple)): perc = perc[1] weights = get_weight(x, y, perc).astype(bool) if issparse(weights): weights = weights.A ...
python
def optimize_NxN(x, y, fit_offset=False, perc=None): """Just to compare with closed-form solution """ if perc is not None: if not fit_offset and isinstance(perc, (list, tuple)): perc = perc[1] weights = get_weight(x, y, perc).astype(bool) if issparse(weights): weights = weights.A ...
[ "def", "optimize_NxN", "(", "x", ",", "y", ",", "fit_offset", "=", "False", ",", "perc", "=", "None", ")", ":", "if", "perc", "is", "not", "None", ":", "if", "not", "fit_offset", "and", "isinstance", "(", "perc", ",", "(", "list", ",", "tuple", ")"...
Just to compare with closed-form solution
[ "Just", "to", "compare", "with", "closed", "-", "form", "solution" ]
c7a96d70edfe705e86bf364434a9527d4fd8df11
https://github.com/theislab/scvelo/blob/c7a96d70edfe705e86bf364434a9527d4fd8df11/scvelo/tools/optimization.py#L55-L80
train
theislab/scvelo
scvelo/tools/velocity_confidence.py
velocity_confidence
def velocity_confidence(data, vkey='velocity', copy=False): """Computes confidences of velocities. Arguments --------- data: :class:`~anndata.AnnData` Annotated data matrix. vkey: `str` (default: `'velocity'`) Name of velocity estimates to be used. copy: `bool` (default: `False`...
python
def velocity_confidence(data, vkey='velocity', copy=False): """Computes confidences of velocities. Arguments --------- data: :class:`~anndata.AnnData` Annotated data matrix. vkey: `str` (default: `'velocity'`) Name of velocity estimates to be used. copy: `bool` (default: `False`...
[ "def", "velocity_confidence", "(", "data", ",", "vkey", "=", "'velocity'", ",", "copy", "=", "False", ")", ":", "adata", "=", "data", ".", "copy", "(", ")", "if", "copy", "else", "data", "if", "vkey", "not", "in", "adata", ".", "layers", ".", "keys",...
Computes confidences of velocities. Arguments --------- data: :class:`~anndata.AnnData` Annotated data matrix. vkey: `str` (default: `'velocity'`) Name of velocity estimates to be used. copy: `bool` (default: `False`) Return a copy instead of writing to adata. Returns ...
[ "Computes", "confidences", "of", "velocities", "." ]
c7a96d70edfe705e86bf364434a9527d4fd8df11
https://github.com/theislab/scvelo/blob/c7a96d70edfe705e86bf364434a9527d4fd8df11/scvelo/tools/velocity_confidence.py#L10-L56
train
theislab/scvelo
scvelo/tools/velocity_confidence.py
velocity_confidence_transition
def velocity_confidence_transition(data, vkey='velocity', scale=10, copy=False): """Computes confidences of velocity transitions. Arguments --------- data: :class:`~anndata.AnnData` Annotated data matrix. vkey: `str` (default: `'velocity'`) Name of velocity estimates to be used. ...
python
def velocity_confidence_transition(data, vkey='velocity', scale=10, copy=False): """Computes confidences of velocity transitions. Arguments --------- data: :class:`~anndata.AnnData` Annotated data matrix. vkey: `str` (default: `'velocity'`) Name of velocity estimates to be used. ...
[ "def", "velocity_confidence_transition", "(", "data", ",", "vkey", "=", "'velocity'", ",", "scale", "=", "10", ",", "copy", "=", "False", ")", ":", "adata", "=", "data", ".", "copy", "(", ")", "if", "copy", "else", "data", "if", "vkey", "not", "in", ...
Computes confidences of velocity transitions. Arguments --------- data: :class:`~anndata.AnnData` Annotated data matrix. vkey: `str` (default: `'velocity'`) Name of velocity estimates to be used. scale: `float` (default: 10) Scale parameter of gaussian kernel. copy: `boo...
[ "Computes", "confidences", "of", "velocity", "transitions", "." ]
c7a96d70edfe705e86bf364434a9527d4fd8df11
https://github.com/theislab/scvelo/blob/c7a96d70edfe705e86bf364434a9527d4fd8df11/scvelo/tools/velocity_confidence.py#L59-L96
train
theislab/scvelo
scvelo/tools/terminal_states.py
cell_fate
def cell_fate(data, groupby='clusters', disconnected_groups=None, self_transitions=False, n_neighbors=None, copy=False): """Computes individual cell endpoints Arguments --------- data: :class:`~anndata.AnnData` Annotated data matrix. groupby: `str` (default: `'clusters'`) Key to whi...
python
def cell_fate(data, groupby='clusters', disconnected_groups=None, self_transitions=False, n_neighbors=None, copy=False): """Computes individual cell endpoints Arguments --------- data: :class:`~anndata.AnnData` Annotated data matrix. groupby: `str` (default: `'clusters'`) Key to whi...
[ "def", "cell_fate", "(", "data", ",", "groupby", "=", "'clusters'", ",", "disconnected_groups", "=", "None", ",", "self_transitions", "=", "False", ",", "n_neighbors", "=", "None", ",", "copy", "=", "False", ")", ":", "adata", "=", "data", ".", "copy", "...
Computes individual cell endpoints Arguments --------- data: :class:`~anndata.AnnData` Annotated data matrix. groupby: `str` (default: `'clusters'`) Key to which to assign the fates. disconnected_groups: list of `str` (default: `None`) Which groups to treat as disconnected f...
[ "Computes", "individual", "cell", "endpoints" ]
c7a96d70edfe705e86bf364434a9527d4fd8df11
https://github.com/theislab/scvelo/blob/c7a96d70edfe705e86bf364434a9527d4fd8df11/scvelo/tools/terminal_states.py#L12-L64
train
theislab/scvelo
scvelo/preprocessing/moments.py
moments
def moments(data, n_neighbors=30, n_pcs=30, mode='connectivities', method='umap', metric='euclidean', use_rep=None, recurse_neighbors=False, renormalize=False, copy=False): """Computes moments for velocity estimation. Arguments --------- data: :class:`~anndata.AnnData` Annotated dat...
python
def moments(data, n_neighbors=30, n_pcs=30, mode='connectivities', method='umap', metric='euclidean', use_rep=None, recurse_neighbors=False, renormalize=False, copy=False): """Computes moments for velocity estimation. Arguments --------- data: :class:`~anndata.AnnData` Annotated dat...
[ "def", "moments", "(", "data", ",", "n_neighbors", "=", "30", ",", "n_pcs", "=", "30", ",", "mode", "=", "'connectivities'", ",", "method", "=", "'umap'", ",", "metric", "=", "'euclidean'", ",", "use_rep", "=", "None", ",", "recurse_neighbors", "=", "Fal...
Computes moments for velocity estimation. Arguments --------- data: :class:`~anndata.AnnData` Annotated data matrix. n_neighbors: `int` (default: 30) Number of neighbors to use. n_pcs: `int` (default: 30) Number of principal components to use. mode: `'connectivities'` or...
[ "Computes", "moments", "for", "velocity", "estimation", "." ]
c7a96d70edfe705e86bf364434a9527d4fd8df11
https://github.com/theislab/scvelo/blob/c7a96d70edfe705e86bf364434a9527d4fd8df11/scvelo/preprocessing/moments.py#L10-L61
train
theislab/scvelo
scvelo/tools/transition_matrix.py
transition_matrix
def transition_matrix(adata, vkey='velocity', basis=None, backward=False, self_transitions=True, scale=10, perc=None, use_negative_cosines=False, weight_diffusion=0, scale_diffusion=1, weight_indirect_neighbors=None, n_neighbors=None, vgraph=None): """Computes transition ...
python
def transition_matrix(adata, vkey='velocity', basis=None, backward=False, self_transitions=True, scale=10, perc=None, use_negative_cosines=False, weight_diffusion=0, scale_diffusion=1, weight_indirect_neighbors=None, n_neighbors=None, vgraph=None): """Computes transition ...
[ "def", "transition_matrix", "(", "adata", ",", "vkey", "=", "'velocity'", ",", "basis", "=", "None", ",", "backward", "=", "False", ",", "self_transitions", "=", "True", ",", "scale", "=", "10", ",", "perc", "=", "None", ",", "use_negative_cosines", "=", ...
Computes transition probabilities from velocity graph Arguments --------- adata: :class:`~anndata.AnnData` Annotated data matrix. vkey: `str` (default: `'velocity'`) Name of velocity estimates to be used. basis: `str` or `None` (default: `None`) Restrict transition to embedd...
[ "Computes", "transition", "probabilities", "from", "velocity", "graph" ]
c7a96d70edfe705e86bf364434a9527d4fd8df11
https://github.com/theislab/scvelo/blob/c7a96d70edfe705e86bf364434a9527d4fd8df11/scvelo/tools/transition_matrix.py#L9-L87
train
rochars/trade
trade/context.py
Context.apply
def apply(self): """Apply the rules of the context to its occurrences. This method executes all the functions defined in self.tasks in the order they are listed. Every function that acts as a context task receives the Context object itself as its only argument. The con...
python
def apply(self): """Apply the rules of the context to its occurrences. This method executes all the functions defined in self.tasks in the order they are listed. Every function that acts as a context task receives the Context object itself as its only argument. The con...
[ "def", "apply", "(", "self", ")", ":", "raw_operations", "=", "copy", ".", "deepcopy", "(", "self", ".", "occurrences", ")", "for", "task", "in", "self", ".", "tasks", ":", "task", "(", "self", ")", "self", ".", "occurrences", "=", "raw_operations" ]
Apply the rules of the context to its occurrences. This method executes all the functions defined in self.tasks in the order they are listed. Every function that acts as a context task receives the Context object itself as its only argument. The contextualized occurrences are ...
[ "Apply", "the", "rules", "of", "the", "context", "to", "its", "occurrences", "." ]
3b8d386e1394923919b7dc7a30dc93441558d5bc
https://github.com/rochars/trade/blob/3b8d386e1394923919b7dc7a30dc93441558d5bc/trade/context.py#L70-L87
train
rochars/trade
trade/occurrence.py
average_price
def average_price(quantity_1, price_1, quantity_2, price_2): """Calculates the average price between two asset states.""" return (quantity_1 * price_1 + quantity_2 * price_2) / \ (quantity_1 + quantity_2)
python
def average_price(quantity_1, price_1, quantity_2, price_2): """Calculates the average price between two asset states.""" return (quantity_1 * price_1 + quantity_2 * price_2) / \ (quantity_1 + quantity_2)
[ "def", "average_price", "(", "quantity_1", ",", "price_1", ",", "quantity_2", ",", "price_2", ")", ":", "return", "(", "quantity_1", "*", "price_1", "+", "quantity_2", "*", "price_2", ")", "/", "(", "quantity_1", "+", "quantity_2", ")" ]
Calculates the average price between two asset states.
[ "Calculates", "the", "average", "price", "between", "two", "asset", "states", "." ]
3b8d386e1394923919b7dc7a30dc93441558d5bc
https://github.com/rochars/trade/blob/3b8d386e1394923919b7dc7a30dc93441558d5bc/trade/occurrence.py#L134-L137
train
rochars/trade
trade/occurrence.py
Occurrence.update_holder
def update_holder(self, holder): """Udpate the Holder state according to the occurrence. This implementation is a example of how a Occurrence object can update the Holder state; this method should be overriden by classes that inherit from the Occurrence class. This sample imple...
python
def update_holder(self, holder): """Udpate the Holder state according to the occurrence. This implementation is a example of how a Occurrence object can update the Holder state; this method should be overriden by classes that inherit from the Occurrence class. This sample imple...
[ "def", "update_holder", "(", "self", ",", "holder", ")", ":", "subject_symbol", "=", "self", ".", "subject", ".", "symbol", "if", "subject_symbol", "in", "holder", ".", "state", ":", "if", "not", "holder", ".", "state", "[", "subject_symbol", "]", "[", "...
Udpate the Holder state according to the occurrence. This implementation is a example of how a Occurrence object can update the Holder state; this method should be overriden by classes that inherit from the Occurrence class. This sample implementation simply update the quantity and the...
[ "Udpate", "the", "Holder", "state", "according", "to", "the", "occurrence", "." ]
3b8d386e1394923919b7dc7a30dc93441558d5bc
https://github.com/rochars/trade/blob/3b8d386e1394923919b7dc7a30dc93441558d5bc/trade/occurrence.py#L44-L132
train
casacore/python-casacore
casacore/fitting/fitting.py
fitserver.fitter
def fitter(self, n=0, ftype="real", colfac=1.0e-8, lmfac=1.0e-3): """Create a sub-fitter. The created sub-fitter can be used in the same way as a fitter default fitter. This function returns an identification, which has to be used in the `fid` argument of subsequent calls. The call can ...
python
def fitter(self, n=0, ftype="real", colfac=1.0e-8, lmfac=1.0e-3): """Create a sub-fitter. The created sub-fitter can be used in the same way as a fitter default fitter. This function returns an identification, which has to be used in the `fid` argument of subsequent calls. The call can ...
[ "def", "fitter", "(", "self", ",", "n", "=", "0", ",", "ftype", "=", "\"real\"", ",", "colfac", "=", "1.0e-8", ",", "lmfac", "=", "1.0e-3", ")", ":", "fid", "=", "self", ".", "_fitproxy", ".", "getid", "(", ")", "ftype", "=", "self", ".", "_getty...
Create a sub-fitter. The created sub-fitter can be used in the same way as a fitter default fitter. This function returns an identification, which has to be used in the `fid` argument of subsequent calls. The call can specify the standard constructor arguments (`n`, `type`, `colfac`, ...
[ "Create", "a", "sub", "-", "fitter", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/fitting/fitting.py#L46-L74
train
casacore/python-casacore
casacore/fitting/fitting.py
fitserver.done
def done(self, fid=0): """Terminates the fitserver.""" self._checkid(fid) self._fitids[fid] = {} self._fitproxy.done(fid)
python
def done(self, fid=0): """Terminates the fitserver.""" self._checkid(fid) self._fitids[fid] = {} self._fitproxy.done(fid)
[ "def", "done", "(", "self", ",", "fid", "=", "0", ")", ":", "self", ".", "_checkid", "(", "fid", ")", "self", ".", "_fitids", "[", "fid", "]", "=", "{", "}", "self", ".", "_fitproxy", ".", "done", "(", "fid", ")" ]
Terminates the fitserver.
[ "Terminates", "the", "fitserver", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/fitting/fitting.py#L183-L187
train
casacore/python-casacore
casacore/fitting/fitting.py
fitserver.reset
def reset(self, fid=0): """Reset the object's resources to its initialized state. :param fid: the id of a sub-fitter """ self._checkid(fid) self._fitids[fid]["solved"] = False self._fitids[fid]["haserr"] = False if not self._fitids[fid]["looped"]: ret...
python
def reset(self, fid=0): """Reset the object's resources to its initialized state. :param fid: the id of a sub-fitter """ self._checkid(fid) self._fitids[fid]["solved"] = False self._fitids[fid]["haserr"] = False if not self._fitids[fid]["looped"]: ret...
[ "def", "reset", "(", "self", ",", "fid", "=", "0", ")", ":", "self", ".", "_checkid", "(", "fid", ")", "self", ".", "_fitids", "[", "fid", "]", "[", "\"solved\"", "]", "=", "False", "self", ".", "_fitids", "[", "fid", "]", "[", "\"haserr\"", "]",...
Reset the object's resources to its initialized state. :param fid: the id of a sub-fitter
[ "Reset", "the", "object", "s", "resources", "to", "its", "initialized", "state", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/fitting/fitting.py#L189-L201
train
casacore/python-casacore
casacore/fitting/fitting.py
fitserver.addconstraint
def addconstraint(self, x, y=0, fnct=None, fid=0): """Add constraint.""" self._checkid(fid) i = 0 if "constraint" in self._fitids[fid]: i = len(self._fitids[fid]["constraint"]) else: self._fitids[fid]["constraint"] = {} # dict key needs to be strin...
python
def addconstraint(self, x, y=0, fnct=None, fid=0): """Add constraint.""" self._checkid(fid) i = 0 if "constraint" in self._fitids[fid]: i = len(self._fitids[fid]["constraint"]) else: self._fitids[fid]["constraint"] = {} # dict key needs to be strin...
[ "def", "addconstraint", "(", "self", ",", "x", ",", "y", "=", "0", ",", "fnct", "=", "None", ",", "fid", "=", "0", ")", ":", "self", ".", "_checkid", "(", "fid", ")", "i", "=", "0", "if", "\"constraint\"", "in", "self", ".", "_fitids", "[", "fi...
Add constraint.
[ "Add", "constraint", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/fitting/fitting.py#L216-L234
train
casacore/python-casacore
casacore/fitting/fitting.py
fitserver.fitspoly
def fitspoly(self, n, x, y, sd=None, wt=1.0, fid=0): """Create normal equations from the specified condition equations, and solve the resulting normal equations. It is in essence a combination. The method expects that the properties of the fitter to be used have been initialized or set ...
python
def fitspoly(self, n, x, y, sd=None, wt=1.0, fid=0): """Create normal equations from the specified condition equations, and solve the resulting normal equations. It is in essence a combination. The method expects that the properties of the fitter to be used have been initialized or set ...
[ "def", "fitspoly", "(", "self", ",", "n", ",", "x", ",", "y", ",", "sd", "=", "None", ",", "wt", "=", "1.0", ",", "fid", "=", "0", ")", ":", "a", "=", "max", "(", "abs", "(", "max", "(", "x", ")", ")", ",", "abs", "(", "min", "(", "x", ...
Create normal equations from the specified condition equations, and solve the resulting normal equations. It is in essence a combination. The method expects that the properties of the fitter to be used have been initialized or set (like the number of simultaneous solutions m the type; f...
[ "Create", "normal", "equations", "from", "the", "specified", "condition", "equations", "and", "solve", "the", "resulting", "normal", "equations", ".", "It", "is", "in", "essence", "a", "combination", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/fitting/fitting.py#L240-L279
train
casacore/python-casacore
casacore/fitting/fitting.py
fitserver.functional
def functional(self, fnct, x, y, sd=None, wt=1.0, mxit=50, fid=0): """Make a non-linear least squares solution. This will make a non-linear least squares solution for the points through the ordinates at the abscissa values, using the specified `fnct`. Details can be found in the :meth:`...
python
def functional(self, fnct, x, y, sd=None, wt=1.0, mxit=50, fid=0): """Make a non-linear least squares solution. This will make a non-linear least squares solution for the points through the ordinates at the abscissa values, using the specified `fnct`. Details can be found in the :meth:`...
[ "def", "functional", "(", "self", ",", "fnct", ",", "x", ",", "y", ",", "sd", "=", "None", ",", "wt", "=", "1.0", ",", "mxit", "=", "50", ",", "fid", "=", "0", ")", ":", "self", ".", "_fit", "(", "fitfunc", "=", "\"functional\"", ",", "fnct", ...
Make a non-linear least squares solution. This will make a non-linear least squares solution for the points through the ordinates at the abscissa values, using the specified `fnct`. Details can be found in the :meth:`linear` description. :param fnct: the functional to fit :para...
[ "Make", "a", "non", "-", "linear", "least", "squares", "solution", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/fitting/fitting.py#L333-L351
train
casacore/python-casacore
casacore/fitting/fitting.py
fitserver.linear
def linear(self, fnct, x, y, sd=None, wt=1.0, fid=0): """Make a linear least squares solution. Makes a linear least squares solution for the points through the ordinates at the x values, using the specified fnct. The x can be of any dimension, depending on the number of arguments needed...
python
def linear(self, fnct, x, y, sd=None, wt=1.0, fid=0): """Make a linear least squares solution. Makes a linear least squares solution for the points through the ordinates at the x values, using the specified fnct. The x can be of any dimension, depending on the number of arguments needed...
[ "def", "linear", "(", "self", ",", "fnct", ",", "x", ",", "y", ",", "sd", "=", "None", ",", "wt", "=", "1.0", ",", "fid", "=", "0", ")", ":", "self", ".", "_fit", "(", "fitfunc", "=", "\"linear\"", ",", "fnct", "=", "fnct", ",", "x", "=", "...
Make a linear least squares solution. Makes a linear least squares solution for the points through the ordinates at the x values, using the specified fnct. The x can be of any dimension, depending on the number of arguments needed in the functional evaluation. The values should be given...
[ "Make", "a", "linear", "least", "squares", "solution", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/fitting/fitting.py#L355-L375
train
casacore/python-casacore
casacore/fitting/fitting.py
fitserver.constraint
def constraint(self, n=-1, fid=0): """Obtain the set of orthogonal equations that make the solution of the rank deficient normal equations possible. :param fid: the id of the sub-fitter (numerical) """ c = self._getval("constr", fid) if n < 0 or n > self.deficiency(fid)...
python
def constraint(self, n=-1, fid=0): """Obtain the set of orthogonal equations that make the solution of the rank deficient normal equations possible. :param fid: the id of the sub-fitter (numerical) """ c = self._getval("constr", fid) if n < 0 or n > self.deficiency(fid)...
[ "def", "constraint", "(", "self", ",", "n", "=", "-", "1", ",", "fid", "=", "0", ")", ":", "c", "=", "self", ".", "_getval", "(", "\"constr\"", ",", "fid", ")", "if", "n", "<", "0", "or", "n", ">", "self", ".", "deficiency", "(", "fid", ")", ...
Obtain the set of orthogonal equations that make the solution of the rank deficient normal equations possible. :param fid: the id of the sub-fitter (numerical)
[ "Obtain", "the", "set", "of", "orthogonal", "equations", "that", "make", "the", "solution", "of", "the", "rank", "deficient", "normal", "equations", "possible", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/fitting/fitting.py#L457-L468
train
casacore/python-casacore
casacore/fitting/fitting.py
fitserver.fitted
def fitted(self, fid=0): """Test if enough Levenberg-Marquardt loops have been done. It returns True if no improvement possible. :param fid: the id of the sub-fitter (numerical) """ self._checkid(fid) return not (self._fitids[fid]["fit"] > 0 or self....
python
def fitted(self, fid=0): """Test if enough Levenberg-Marquardt loops have been done. It returns True if no improvement possible. :param fid: the id of the sub-fitter (numerical) """ self._checkid(fid) return not (self._fitids[fid]["fit"] > 0 or self....
[ "def", "fitted", "(", "self", ",", "fid", "=", "0", ")", ":", "self", ".", "_checkid", "(", "fid", ")", "return", "not", "(", "self", ".", "_fitids", "[", "fid", "]", "[", "\"fit\"", "]", ">", "0", "or", "self", ".", "_fitids", "[", "fid", "]",...
Test if enough Levenberg-Marquardt loops have been done. It returns True if no improvement possible. :param fid: the id of the sub-fitter (numerical)
[ "Test", "if", "enough", "Levenberg", "-", "Marquardt", "loops", "have", "been", "done", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/fitting/fitting.py#L470-L479
train
casacore/python-casacore
casacore/measures/__init__.py
measures.set_data_path
def set_data_path(self, pth): """Set the location of the measures data directory. :param pth: The absolute path to the measures data directory. """ if os.path.exists(pth): if not os.path.exists(os.path.join(pth, 'data', 'geodetic')): raise IOError("The given ...
python
def set_data_path(self, pth): """Set the location of the measures data directory. :param pth: The absolute path to the measures data directory. """ if os.path.exists(pth): if not os.path.exists(os.path.join(pth, 'data', 'geodetic')): raise IOError("The given ...
[ "def", "set_data_path", "(", "self", ",", "pth", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "pth", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "join", "(", "pth", ",", "'data'", ",", "'geode...
Set the location of the measures data directory. :param pth: The absolute path to the measures data directory.
[ "Set", "the", "location", "of", "the", "measures", "data", "directory", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/measures/__init__.py#L91-L100
train
casacore/python-casacore
casacore/measures/__init__.py
measures.asbaseline
def asbaseline(self, pos): """Convert a position measure into a baseline measure. No actual baseline is calculated, since operations can be done on positions, with subtractions to obtain baselines at a later stage. :param pos: a position measure :returns: a baseline measure ...
python
def asbaseline(self, pos): """Convert a position measure into a baseline measure. No actual baseline is calculated, since operations can be done on positions, with subtractions to obtain baselines at a later stage. :param pos: a position measure :returns: a baseline measure ...
[ "def", "asbaseline", "(", "self", ",", "pos", ")", ":", "if", "not", "is_measure", "(", "pos", ")", "or", "pos", "[", "'type'", "]", "not", "in", "[", "'position'", ",", "'baseline'", "]", ":", "raise", "TypeError", "(", "'Argument is not a position/baseli...
Convert a position measure into a baseline measure. No actual baseline is calculated, since operations can be done on positions, with subtractions to obtain baselines at a later stage. :param pos: a position measure :returns: a baseline measure
[ "Convert", "a", "position", "measure", "into", "a", "baseline", "measure", ".", "No", "actual", "baseline", "is", "calculated", "since", "operations", "can", "be", "done", "on", "positions", "with", "subtractions", "to", "obtain", "baselines", "at", "a", "late...
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/measures/__init__.py#L599-L614
train
casacore/python-casacore
casacore/measures/__init__.py
measures.getvalue
def getvalue(self, v): """ Return a list of quantities making up the measures' value. :param v: a measure """ if not is_measure(v): raise TypeError('Incorrect input type for getvalue()') import re rx = re.compile("m\d+") out = [] keys ...
python
def getvalue(self, v): """ Return a list of quantities making up the measures' value. :param v: a measure """ if not is_measure(v): raise TypeError('Incorrect input type for getvalue()') import re rx = re.compile("m\d+") out = [] keys ...
[ "def", "getvalue", "(", "self", ",", "v", ")", ":", "if", "not", "is_measure", "(", "v", ")", ":", "raise", "TypeError", "(", "'Incorrect input type for getvalue()'", ")", "import", "re", "rx", "=", "re", ".", "compile", "(", "\"m\\d+\"", ")", "out", "="...
Return a list of quantities making up the measures' value. :param v: a measure
[ "Return", "a", "list", "of", "quantities", "making", "up", "the", "measures", "value", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/measures/__init__.py#L618-L634
train
casacore/python-casacore
casacore/measures/__init__.py
measures.doframe
def doframe(self, v): """This method will set the measure specified as part of a frame. If conversion from one type to another is necessary (with the measure function), the following frames should be set if one of the reference types involved in the conversion is as in the following lis...
python
def doframe(self, v): """This method will set the measure specified as part of a frame. If conversion from one type to another is necessary (with the measure function), the following frames should be set if one of the reference types involved in the conversion is as in the following lis...
[ "def", "doframe", "(", "self", ",", "v", ")", ":", "if", "not", "is_measure", "(", "v", ")", ":", "raise", "TypeError", "(", "'Argument is not a measure'", ")", "if", "(", "v", "[", "\"type\"", "]", "==", "\"frequency\"", "and", "v", "[", "\"refer\"", ...
This method will set the measure specified as part of a frame. If conversion from one type to another is necessary (with the measure function), the following frames should be set if one of the reference types involved in the conversion is as in the following lists: **Epoch** ...
[ "This", "method", "will", "set", "the", "measure", "specified", "as", "part", "of", "a", "frame", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/measures/__init__.py#L673-L756
train
casacore/python-casacore
casacore/tables/msutil.py
addImagingColumns
def addImagingColumns(msname, ack=True): """ Add the columns to an MS needed for the casa imager. It adds the columns MODEL_DATA, CORRECTED_DATA, and IMAGING_WEIGHT. It also sets the CHANNEL_SELECTION keyword needed for the older casa imagers. A column is not added if already existing. """ ...
python
def addImagingColumns(msname, ack=True): """ Add the columns to an MS needed for the casa imager. It adds the columns MODEL_DATA, CORRECTED_DATA, and IMAGING_WEIGHT. It also sets the CHANNEL_SELECTION keyword needed for the older casa imagers. A column is not added if already existing. """ ...
[ "def", "addImagingColumns", "(", "msname", ",", "ack", "=", "True", ")", ":", "import", "numpy", "as", "np", "t", "=", "table", "(", "msname", ",", "readonly", "=", "False", ",", "ack", "=", "False", ")", "cnames", "=", "t", ".", "colnames", "(", "...
Add the columns to an MS needed for the casa imager. It adds the columns MODEL_DATA, CORRECTED_DATA, and IMAGING_WEIGHT. It also sets the CHANNEL_SELECTION keyword needed for the older casa imagers. A column is not added if already existing.
[ "Add", "the", "columns", "to", "an", "MS", "needed", "for", "the", "casa", "imager", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/msutil.py#L48-L128
train
casacore/python-casacore
casacore/tables/msutil.py
addDerivedMSCal
def addDerivedMSCal(msname): """ Add the derived columns like HA to an MS or CalTable. It adds the columns HA, HA1, HA2, PA1, PA2, LAST, LAST1, LAST2, AZEL1, AZEL2, and UVW_J2000. They are all bound to the DerivedMSCal virtual data manager. It fails if one of the columns already exists. """ ...
python
def addDerivedMSCal(msname): """ Add the derived columns like HA to an MS or CalTable. It adds the columns HA, HA1, HA2, PA1, PA2, LAST, LAST1, LAST2, AZEL1, AZEL2, and UVW_J2000. They are all bound to the DerivedMSCal virtual data manager. It fails if one of the columns already exists. """ ...
[ "def", "addDerivedMSCal", "(", "msname", ")", ":", "t", "=", "table", "(", "msname", ",", "readonly", "=", "False", ",", "ack", "=", "False", ")", "colnames", "=", "t", ".", "colnames", "(", ")", "for", "col", "in", "[", "\"TIME\"", ",", "\"ANTENNA1\...
Add the derived columns like HA to an MS or CalTable. It adds the columns HA, HA1, HA2, PA1, PA2, LAST, LAST1, LAST2, AZEL1, AZEL2, and UVW_J2000. They are all bound to the DerivedMSCal virtual data manager. It fails if one of the columns already exists.
[ "Add", "the", "derived", "columns", "like", "HA", "to", "an", "MS", "or", "CalTable", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/msutil.py#L145-L189
train
casacore/python-casacore
casacore/tables/msutil.py
removeDerivedMSCal
def removeDerivedMSCal(msname): """ Remove the derived columns like HA from an MS or CalTable. It removes the columns using the data manager DerivedMSCal. Such columns are HA, HA1, HA2, PA1, PA2, LAST, LAST1, LAST2, AZEL1, AZEL2, and UVW_J2000. It fails if one of the columns already exists. "...
python
def removeDerivedMSCal(msname): """ Remove the derived columns like HA from an MS or CalTable. It removes the columns using the data manager DerivedMSCal. Such columns are HA, HA1, HA2, PA1, PA2, LAST, LAST1, LAST2, AZEL1, AZEL2, and UVW_J2000. It fails if one of the columns already exists. "...
[ "def", "removeDerivedMSCal", "(", "msname", ")", ":", "t", "=", "table", "(", "msname", ",", "readonly", "=", "False", ",", "ack", "=", "False", ")", "dmi", "=", "t", ".", "getdminfo", "(", ")", "for", "x", "in", "dmi", ".", "values", "(", ")", "...
Remove the derived columns like HA from an MS or CalTable. It removes the columns using the data manager DerivedMSCal. Such columns are HA, HA1, HA2, PA1, PA2, LAST, LAST1, LAST2, AZEL1, AZEL2, and UVW_J2000. It fails if one of the columns already exists.
[ "Remove", "the", "derived", "columns", "like", "HA", "from", "an", "MS", "or", "CalTable", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/msutil.py#L192-L210
train
casacore/python-casacore
casacore/tables/msutil.py
msregularize
def msregularize(msname, newname): """ Regularize an MS The output MS will be such that it has the same number of baselines for each time stamp. Where needed fully flagged rows are added. Possibly missing rows are written into a separate MS <newname>-add. It is concatenated with the original MS an...
python
def msregularize(msname, newname): """ Regularize an MS The output MS will be such that it has the same number of baselines for each time stamp. Where needed fully flagged rows are added. Possibly missing rows are written into a separate MS <newname>-add. It is concatenated with the original MS an...
[ "def", "msregularize", "(", "msname", ",", "newname", ")", ":", "t", "=", "table", "(", "msname", ")", "t1", "=", "t", ".", "sort", "(", "'unique ANTENNA1,ANTENNA2'", ")", "nadded", "=", "0", "for", "tsub", "in", "t", ".", "iter", "(", "[", "'TIME'",...
Regularize an MS The output MS will be such that it has the same number of baselines for each time stamp. Where needed fully flagged rows are added. Possibly missing rows are written into a separate MS <newname>-add. It is concatenated with the original MS and sorted in order of TIME, DATADESC_ID,...
[ "Regularize", "an", "MS" ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/msutil.py#L362-L429
train
casacore/python-casacore
casacore/tables/tablecolumn.py
tablecolumn._repr_html_
def _repr_html_(self): """Give a nice representation of columns in notebooks.""" out="<table class='taqltable'>\n" # Print column name (not if it is auto-generated) if not(self.name()[:4]=="Col_"): out+="<tr>" out+="<th><b>"+self.name()+"</b></th>" ou...
python
def _repr_html_(self): """Give a nice representation of columns in notebooks.""" out="<table class='taqltable'>\n" # Print column name (not if it is auto-generated) if not(self.name()[:4]=="Col_"): out+="<tr>" out+="<th><b>"+self.name()+"</b></th>" ou...
[ "def", "_repr_html_", "(", "self", ")", ":", "out", "=", "\"<table class='taqltable'>\\n\"", "if", "not", "(", "self", ".", "name", "(", ")", "[", ":", "4", "]", "==", "\"Col_\"", ")", ":", "out", "+=", "\"<tr>\"", "out", "+=", "\"<th><b>\"", "+", "sel...
Give a nice representation of columns in notebooks.
[ "Give", "a", "nice", "representation", "of", "columns", "in", "notebooks", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/tablecolumn.py#L305-L336
train
casacore/python-casacore
casacore/images/coordinates.py
coordinatesystem._get_coordinatenames
def _get_coordinatenames(self): """Create ordered list of coordinate names """ validnames = ("direction", "spectral", "linear", "stokes", "tabular") self._names = [""] * len(validnames) n = 0 for key in self._csys.keys(): for name in validnames: ...
python
def _get_coordinatenames(self): """Create ordered list of coordinate names """ validnames = ("direction", "spectral", "linear", "stokes", "tabular") self._names = [""] * len(validnames) n = 0 for key in self._csys.keys(): for name in validnames: ...
[ "def", "_get_coordinatenames", "(", "self", ")", ":", "validnames", "=", "(", "\"direction\"", ",", "\"spectral\"", ",", "\"linear\"", ",", "\"stokes\"", ",", "\"tabular\"", ")", "self", ".", "_names", "=", "[", "\"\"", "]", "*", "len", "(", "validnames", ...
Create ordered list of coordinate names
[ "Create", "ordered", "list", "of", "coordinate", "names" ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/images/coordinates.py#L71-L87
train
casacore/python-casacore
casacore/images/coordinates.py
directioncoordinate.set_projection
def set_projection(self, val): """Set the projection of the given axis in this coordinate. The known projections are SIN, ZEA, TAN, NCP, AIT, ZEA """ knownproj = ["SIN", "ZEA", "TAN", "NCP", "AIT", "ZEA"] # etc assert val.upper() in knownproj self._coord["projection"] =...
python
def set_projection(self, val): """Set the projection of the given axis in this coordinate. The known projections are SIN, ZEA, TAN, NCP, AIT, ZEA """ knownproj = ["SIN", "ZEA", "TAN", "NCP", "AIT", "ZEA"] # etc assert val.upper() in knownproj self._coord["projection"] =...
[ "def", "set_projection", "(", "self", ",", "val", ")", ":", "knownproj", "=", "[", "\"SIN\"", ",", "\"ZEA\"", ",", "\"TAN\"", ",", "\"NCP\"", ",", "\"AIT\"", ",", "\"ZEA\"", "]", "assert", "val", ".", "upper", "(", ")", "in", "knownproj", "self", ".", ...
Set the projection of the given axis in this coordinate. The known projections are SIN, ZEA, TAN, NCP, AIT, ZEA
[ "Set", "the", "projection", "of", "the", "given", "axis", "in", "this", "coordinate", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/images/coordinates.py#L250-L257
train
casacore/python-casacore
casacore/tables/tableutil.py
tablefromascii
def tablefromascii(tablename, asciifile, headerfile='', autoheader=False, autoshape=[], columnnames=[], datatypes=[], sep=' ', commentmarker='', firstline=1, lastline=-1, readonly=True, ...
python
def tablefromascii(tablename, asciifile, headerfile='', autoheader=False, autoshape=[], columnnames=[], datatypes=[], sep=' ', commentmarker='', firstline=1, lastline=-1, readonly=True, ...
[ "def", "tablefromascii", "(", "tablename", ",", "asciifile", ",", "headerfile", "=", "''", ",", "autoheader", "=", "False", ",", "autoshape", "=", "[", "]", ",", "columnnames", "=", "[", "]", ",", "datatypes", "=", "[", "]", ",", "sep", "=", "' '", "...
Create a table from an ASCII file. Create a table from a file in ASCII format. Columnar data as well as table and column keywords may be specified. Once the table is created from the ASCII data, it is opened in the specified mode and a table object is returned. The table columns are filled from a ...
[ "Create", "a", "table", "from", "an", "ASCII", "file", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/tableutil.py#L35-L240
train
casacore/python-casacore
casacore/tables/tableutil.py
makescacoldesc
def makescacoldesc(columnname, value, datamanagertype='', datamanagergroup='', options=0, maxlen=0, comment='', valuetype='', keywords={}): """Create description of a scalar column. A description for a scalar column can be created from...
python
def makescacoldesc(columnname, value, datamanagertype='', datamanagergroup='', options=0, maxlen=0, comment='', valuetype='', keywords={}): """Create description of a scalar column. A description for a scalar column can be created from...
[ "def", "makescacoldesc", "(", "columnname", ",", "value", ",", "datamanagertype", "=", "''", ",", "datamanagergroup", "=", "''", ",", "options", "=", "0", ",", "maxlen", "=", "0", ",", "comment", "=", "''", ",", "valuetype", "=", "''", ",", "keywords", ...
Create description of a scalar column. A description for a scalar column can be created from a name for the column and a data value, which is used only to determine the type of the column. Note that a dict value is also possible. It is possible to create the column description in more detail by gi...
[ "Create", "description", "of", "a", "scalar", "column", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/tableutil.py#L244-L313
train
casacore/python-casacore
casacore/tables/tableutil.py
makearrcoldesc
def makearrcoldesc(columnname, value, ndim=0, shape=[], datamanagertype='', datamanagergroup='', options=0, maxlen=0, comment='', valuetype='', keywords={}): """Create description of an array column. A description for a scalar column c...
python
def makearrcoldesc(columnname, value, ndim=0, shape=[], datamanagertype='', datamanagergroup='', options=0, maxlen=0, comment='', valuetype='', keywords={}): """Create description of an array column. A description for a scalar column c...
[ "def", "makearrcoldesc", "(", "columnname", ",", "value", ",", "ndim", "=", "0", ",", "shape", "=", "[", "]", ",", "datamanagertype", "=", "''", ",", "datamanagergroup", "=", "''", ",", "options", "=", "0", ",", "maxlen", "=", "0", ",", "comment", "=...
Create description of an array column. A description for a scalar column can be created from a name for the column and a data value, which is used only to determine the type of the column. Note that a dict value is also possible. It is possible to create the column description in more detail by gi...
[ "Create", "description", "of", "an", "array", "column", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/tableutil.py#L317-L417
train
casacore/python-casacore
casacore/tables/tableutil.py
maketabdesc
def maketabdesc(descs=[]): """Create a table description. Creates a table description from a set of column descriptions. The resulting table description can be used in the :class:`table` constructor. For example:: scd1 = makescacoldesc("col2", "aa") scd2 = makescacoldesc("col1", 1, "Incre...
python
def maketabdesc(descs=[]): """Create a table description. Creates a table description from a set of column descriptions. The resulting table description can be used in the :class:`table` constructor. For example:: scd1 = makescacoldesc("col2", "aa") scd2 = makescacoldesc("col1", 1, "Incre...
[ "def", "maketabdesc", "(", "descs", "=", "[", "]", ")", ":", "rec", "=", "{", "}", "if", "isinstance", "(", "descs", ",", "dict", ")", ":", "descs", "=", "[", "descs", "]", "for", "desc", "in", "descs", ":", "colname", "=", "desc", "[", "'name'",...
Create a table description. Creates a table description from a set of column descriptions. The resulting table description can be used in the :class:`table` constructor. For example:: scd1 = makescacoldesc("col2", "aa") scd2 = makescacoldesc("col1", 1, "IncrementalStMan") scd3 = makesca...
[ "Create", "a", "table", "description", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/tableutil.py#L450-L483
train
casacore/python-casacore
casacore/tables/tableutil.py
makedminfo
def makedminfo(tabdesc, group_spec=None): """Creates a data manager information object. Create a data manager information dictionary outline from a table description. The resulting dictionary is a bare outline and is available for the purposes of further customising the data manager via the `group_spec` argume...
python
def makedminfo(tabdesc, group_spec=None): """Creates a data manager information object. Create a data manager information dictionary outline from a table description. The resulting dictionary is a bare outline and is available for the purposes of further customising the data manager via the `group_spec` argume...
[ "def", "makedminfo", "(", "tabdesc", ",", "group_spec", "=", "None", ")", ":", "if", "group_spec", "is", "None", ":", "group_spec", "=", "{", "}", "class", "DMGroup", "(", "object", ")", ":", "def", "__init__", "(", "self", ")", ":", "self", ".", "co...
Creates a data manager information object. Create a data manager information dictionary outline from a table description. The resulting dictionary is a bare outline and is available for the purposes of further customising the data manager via the `group_spec` argument. The resulting dictionary can be used in ...
[ "Creates", "a", "data", "manager", "information", "object", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/tableutil.py#L485-L569
train
casacore/python-casacore
casacore/tables/tableutil.py
tabledefinehypercolumn
def tabledefinehypercolumn(tabdesc, name, ndim, datacolumns, coordcolumns=False, idcolumns=False): """Add a hypercolumn to a table description. It defines a hypercolumn and adds it the given table description. A hypercolumn is...
python
def tabledefinehypercolumn(tabdesc, name, ndim, datacolumns, coordcolumns=False, idcolumns=False): """Add a hypercolumn to a table description. It defines a hypercolumn and adds it the given table description. A hypercolumn is...
[ "def", "tabledefinehypercolumn", "(", "tabdesc", ",", "name", ",", "ndim", ",", "datacolumns", ",", "coordcolumns", "=", "False", ",", "idcolumns", "=", "False", ")", ":", "rec", "=", "{", "'HCndim'", ":", "ndim", ",", "'HCdatanames'", ":", "datacolumns", ...
Add a hypercolumn to a table description. It defines a hypercolumn and adds it the given table description. A hypercolumn is an entity used by the Tiled Storage Managers (TSM). It defines which columns have to be stored together with a TSM. It should only be used by expert users who want to use a TSM ...
[ "Add", "a", "hypercolumn", "to", "a", "table", "description", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/tableutil.py#L579-L635
train
casacore/python-casacore
casacore/tables/tableutil.py
tabledelete
def tabledelete(tablename, checksubtables=False, ack=True): """Delete a table on disk. It is the same as :func:`table.delete`, but without the need to open the table first. """ tabname = _remove_prefix(tablename) t = table(tabname, ack=False) if t.ismultiused(checksubtables): six.p...
python
def tabledelete(tablename, checksubtables=False, ack=True): """Delete a table on disk. It is the same as :func:`table.delete`, but without the need to open the table first. """ tabname = _remove_prefix(tablename) t = table(tabname, ack=False) if t.ismultiused(checksubtables): six.p...
[ "def", "tabledelete", "(", "tablename", ",", "checksubtables", "=", "False", ",", "ack", "=", "True", ")", ":", "tabname", "=", "_remove_prefix", "(", "tablename", ")", "t", "=", "table", "(", "tabname", ",", "ack", "=", "False", ")", "if", "t", ".", ...
Delete a table on disk. It is the same as :func:`table.delete`, but without the need to open the table first.
[ "Delete", "a", "table", "on", "disk", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/tableutil.py#L638-L653
train
casacore/python-casacore
casacore/tables/tableutil.py
tableexists
def tableexists(tablename): """Test if a table exists.""" result = True try: t = table(tablename, ack=False) except: result = False return result
python
def tableexists(tablename): """Test if a table exists.""" result = True try: t = table(tablename, ack=False) except: result = False return result
[ "def", "tableexists", "(", "tablename", ")", ":", "result", "=", "True", "try", ":", "t", "=", "table", "(", "tablename", ",", "ack", "=", "False", ")", "except", ":", "result", "=", "False", "return", "result" ]
Test if a table exists.
[ "Test", "if", "a", "table", "exists", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/tableutil.py#L656-L663
train
casacore/python-casacore
casacore/tables/tableutil.py
tableiswritable
def tableiswritable(tablename): """Test if a table is writable.""" result = True try: t = table(tablename, readonly=False, ack=False) result = t.iswritable() except: result = False return result
python
def tableiswritable(tablename): """Test if a table is writable.""" result = True try: t = table(tablename, readonly=False, ack=False) result = t.iswritable() except: result = False return result
[ "def", "tableiswritable", "(", "tablename", ")", ":", "result", "=", "True", "try", ":", "t", "=", "table", "(", "tablename", ",", "readonly", "=", "False", ",", "ack", "=", "False", ")", "result", "=", "t", ".", "iswritable", "(", ")", "except", ":"...
Test if a table is writable.
[ "Test", "if", "a", "table", "is", "writable", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/tableutil.py#L666-L674
train
casacore/python-casacore
casacore/tables/tableutil.py
tablestructure
def tablestructure(tablename, dataman=True, column=True, subtable=False, sort=False): """Print the structure of a table. It is the same as :func:`table.showstructure`, but without the need to open the table first. """ t = table(tablename, ack=False) six.print_(t.showstructur...
python
def tablestructure(tablename, dataman=True, column=True, subtable=False, sort=False): """Print the structure of a table. It is the same as :func:`table.showstructure`, but without the need to open the table first. """ t = table(tablename, ack=False) six.print_(t.showstructur...
[ "def", "tablestructure", "(", "tablename", ",", "dataman", "=", "True", ",", "column", "=", "True", ",", "subtable", "=", "False", ",", "sort", "=", "False", ")", ":", "t", "=", "table", "(", "tablename", ",", "ack", "=", "False", ")", "six", ".", ...
Print the structure of a table. It is the same as :func:`table.showstructure`, but without the need to open the table first.
[ "Print", "the", "structure", "of", "a", "table", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/tableutil.py#L723-L732
train
casacore/python-casacore
casacore/images/image.py
image.attrget
def attrget(self, groupname, attrname, rownr): """Get the value of an attribute in the given row in a group.""" return self._attrget(groupname, attrname, rownr)
python
def attrget(self, groupname, attrname, rownr): """Get the value of an attribute in the given row in a group.""" return self._attrget(groupname, attrname, rownr)
[ "def", "attrget", "(", "self", ",", "groupname", ",", "attrname", ",", "rownr", ")", ":", "return", "self", ".", "_attrget", "(", "groupname", ",", "attrname", ",", "rownr", ")" ]
Get the value of an attribute in the given row in a group.
[ "Get", "the", "value", "of", "an", "attribute", "in", "the", "given", "row", "in", "a", "group", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/images/image.py#L237-L239
train
casacore/python-casacore
casacore/images/image.py
image.attrgetcol
def attrgetcol(self, groupname, attrname): """Get the value of an attribute for all rows in a group.""" values = [] for rownr in range(self.attrnrows(groupname)): values.append(self.attrget(groupname, attrname, rownr)) return values
python
def attrgetcol(self, groupname, attrname): """Get the value of an attribute for all rows in a group.""" values = [] for rownr in range(self.attrnrows(groupname)): values.append(self.attrget(groupname, attrname, rownr)) return values
[ "def", "attrgetcol", "(", "self", ",", "groupname", ",", "attrname", ")", ":", "values", "=", "[", "]", "for", "rownr", "in", "range", "(", "self", ".", "attrnrows", "(", "groupname", ")", ")", ":", "values", ".", "append", "(", "self", ".", "attrget...
Get the value of an attribute for all rows in a group.
[ "Get", "the", "value", "of", "an", "attribute", "for", "all", "rows", "in", "a", "group", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/images/image.py#L241-L246
train
casacore/python-casacore
casacore/images/image.py
image.attrfindrows
def attrfindrows(self, groupname, attrname, value): """Get the row numbers of all rows where the attribute matches the given value.""" values = self.attrgetcol(groupname, attrname) return [i for i in range(len(values)) if values[i] == value]
python
def attrfindrows(self, groupname, attrname, value): """Get the row numbers of all rows where the attribute matches the given value.""" values = self.attrgetcol(groupname, attrname) return [i for i in range(len(values)) if values[i] == value]
[ "def", "attrfindrows", "(", "self", ",", "groupname", ",", "attrname", ",", "value", ")", ":", "values", "=", "self", ".", "attrgetcol", "(", "groupname", ",", "attrname", ")", "return", "[", "i", "for", "i", "in", "range", "(", "len", "(", "values", ...
Get the row numbers of all rows where the attribute matches the given value.
[ "Get", "the", "row", "numbers", "of", "all", "rows", "where", "the", "attribute", "matches", "the", "given", "value", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/images/image.py#L248-L251
train
casacore/python-casacore
casacore/images/image.py
image.attrgetrow
def attrgetrow(self, groupname, key, value=None): """Get the values of all attributes of a row in a group. If the key is an integer, the key is the row number for which the attribute values have to be returned. Otherwise the key has to be a string and it defines the name of an ...
python
def attrgetrow(self, groupname, key, value=None): """Get the values of all attributes of a row in a group. If the key is an integer, the key is the row number for which the attribute values have to be returned. Otherwise the key has to be a string and it defines the name of an ...
[ "def", "attrgetrow", "(", "self", ",", "groupname", ",", "key", ",", "value", "=", "None", ")", ":", "if", "not", "isinstance", "(", "key", ",", "str", ")", ":", "return", "self", ".", "_attrgetrow", "(", "groupname", ",", "key", ")", "rownrs", "=", ...
Get the values of all attributes of a row in a group. If the key is an integer, the key is the row number for which the attribute values have to be returned. Otherwise the key has to be a string and it defines the name of an attribute. The attribute values of the row for which the key ...
[ "Get", "the", "values", "of", "all", "attributes", "of", "a", "row", "in", "a", "group", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/images/image.py#L253-L277
train
casacore/python-casacore
casacore/images/image.py
image.attrput
def attrput(self, groupname, attrname, rownr, value, unit=[], meas=[]): """Put the value and optionally unit and measinfo of an attribute in a row in a group.""" return self._attrput(groupname, attrname, rownr, value, unit, meas)
python
def attrput(self, groupname, attrname, rownr, value, unit=[], meas=[]): """Put the value and optionally unit and measinfo of an attribute in a row in a group.""" return self._attrput(groupname, attrname, rownr, value, unit, meas)
[ "def", "attrput", "(", "self", ",", "groupname", ",", "attrname", ",", "rownr", ",", "value", ",", "unit", "=", "[", "]", ",", "meas", "=", "[", "]", ")", ":", "return", "self", ".", "_attrput", "(", "groupname", ",", "attrname", ",", "rownr", ",",...
Put the value and optionally unit and measinfo of an attribute in a row in a group.
[ "Put", "the", "value", "and", "optionally", "unit", "and", "measinfo", "of", "an", "attribute", "in", "a", "row", "in", "a", "group", "." ]
975510861ea005f7919dd9e438b5f98a1682eebe
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/images/image.py#L287-L290
train