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
phoebe-project/phoebe2
phoebe/frontend/bundle.py
Bundle.get_system
def get_system(self, twig=None, **kwargs): """ Filter in the 'system' context :parameter str twig: twig to use for filtering :parameter **kwargs: any other tags to do the filter (except twig or context) :return: :class:`phoebe.parameters.parameters.Parameter` or ...
python
def get_system(self, twig=None, **kwargs): """ Filter in the 'system' context :parameter str twig: twig to use for filtering :parameter **kwargs: any other tags to do the filter (except twig or context) :return: :class:`phoebe.parameters.parameters.Parameter` or ...
[ "def", "get_system", "(", "self", ",", "twig", "=", "None", ",", "**", "kwargs", ")", ":", "if", "twig", "is", "not", "None", ":", "kwargs", "[", "'twig'", "]", "=", "twig", "kwargs", "[", "'context'", "]", "=", "'system'", "return", "self", ".", "...
Filter in the 'system' context :parameter str twig: twig to use for filtering :parameter **kwargs: any other tags to do the filter (except twig or context) :return: :class:`phoebe.parameters.parameters.Parameter` or :class:`phoebe.parameters.parameters.ParameterSet`
[ "Filter", "in", "the", "system", "context" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L1345-L1359
train
phoebe-project/phoebe2
phoebe/frontend/bundle.py
Bundle.get_feature
def get_feature(self, feature=None, **kwargs): """ Filter in the 'proerty' context :parameter str feature: name of the feature (optional) :parameter **kwargs: any other tags to do the filter (except component or context) :return: :class:`phoebe.parameters.parameters....
python
def get_feature(self, feature=None, **kwargs): """ Filter in the 'proerty' context :parameter str feature: name of the feature (optional) :parameter **kwargs: any other tags to do the filter (except component or context) :return: :class:`phoebe.parameters.parameters....
[ "def", "get_feature", "(", "self", ",", "feature", "=", "None", ",", "**", "kwargs", ")", ":", "if", "feature", "is", "not", "None", ":", "kwargs", "[", "'feature'", "]", "=", "feature", "kwargs", "[", "'context'", "]", "=", "'feature'", "return", "sel...
Filter in the 'proerty' context :parameter str feature: name of the feature (optional) :parameter **kwargs: any other tags to do the filter (except component or context) :return: :class:`phoebe.parameters.parameters.ParameterSet`
[ "Filter", "in", "the", "proerty", "context" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L1750-L1762
train
phoebe-project/phoebe2
phoebe/frontend/bundle.py
Bundle.rename_feature
def rename_feature(self, old_feature, new_feature): """ Change the label of a feature attached to the Bundle :parameter str old_feature: the current name of the feature (must exist) :parameter str new_feature: the desired new name of the feature (must not exist) ...
python
def rename_feature(self, old_feature, new_feature): """ Change the label of a feature attached to the Bundle :parameter str old_feature: the current name of the feature (must exist) :parameter str new_feature: the desired new name of the feature (must not exist) ...
[ "def", "rename_feature", "(", "self", ",", "old_feature", ",", "new_feature", ")", ":", "self", ".", "_check_label", "(", "new_feature", ")", "self", ".", "_rename_label", "(", "'feature'", ",", "old_feature", ",", "new_feature", ")" ]
Change the label of a feature attached to the Bundle :parameter str old_feature: the current name of the feature (must exist) :parameter str new_feature: the desired new name of the feature (must not exist) :return: None :raises ValueError: if the new_feature is ...
[ "Change", "the", "label", "of", "a", "feature", "attached", "to", "the", "Bundle" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L1803-L1817
train
phoebe-project/phoebe2
phoebe/frontend/bundle.py
Bundle.get_component
def get_component(self, component=None, **kwargs): """ Filter in the 'component' context :parameter str component: name of the component (optional) :parameter **kwargs: any other tags to do the filter (except component or context) :return: :class:`phoebe.parameters.p...
python
def get_component(self, component=None, **kwargs): """ Filter in the 'component' context :parameter str component: name of the component (optional) :parameter **kwargs: any other tags to do the filter (except component or context) :return: :class:`phoebe.parameters.p...
[ "def", "get_component", "(", "self", ",", "component", "=", "None", ",", "**", "kwargs", ")", ":", "if", "component", "is", "not", "None", ":", "kwargs", "[", "'component'", "]", "=", "component", "kwargs", "[", "'context'", "]", "=", "'component'", "ret...
Filter in the 'component' context :parameter str component: name of the component (optional) :parameter **kwargs: any other tags to do the filter (except component or context) :return: :class:`phoebe.parameters.parameters.ParameterSet`
[ "Filter", "in", "the", "component", "context" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L1921-L1933
train
phoebe-project/phoebe2
phoebe/frontend/bundle.py
Bundle.rename_component
def rename_component(self, old_component, new_component): """ Change the label of a component attached to the Bundle :parameter str old_component: the current name of the component (must exist) :parameter str new_component: the desired new name of the component (...
python
def rename_component(self, old_component, new_component): """ Change the label of a component attached to the Bundle :parameter str old_component: the current name of the component (must exist) :parameter str new_component: the desired new name of the component (...
[ "def", "rename_component", "(", "self", ",", "old_component", ",", "new_component", ")", ":", "self", ".", "_check_label", "(", "new_component", ")", "if", "len", "(", "[", "c", "for", "c", "in", "self", ".", "components", "if", "new_component", "in", "c",...
Change the label of a component attached to the Bundle :parameter str old_component: the current name of the component (must exist) :parameter str new_component: the desired new name of the component (must not exist) :return: None :raises ValueError: if the new_c...
[ "Change", "the", "label", "of", "a", "component", "attached", "to", "the", "Bundle" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L1949-L1974
train
phoebe-project/phoebe2
phoebe/frontend/bundle.py
Bundle.get_dataset
def get_dataset(self, dataset=None, **kwargs): """ Filter in the 'dataset' context :parameter str dataset: name of the dataset (optional) :parameter **kwargs: any other tags to do the filter (except dataset or context) :return: :class:`phoebe.parameters.parameters.Pa...
python
def get_dataset(self, dataset=None, **kwargs): """ Filter in the 'dataset' context :parameter str dataset: name of the dataset (optional) :parameter **kwargs: any other tags to do the filter (except dataset or context) :return: :class:`phoebe.parameters.parameters.Pa...
[ "def", "get_dataset", "(", "self", ",", "dataset", "=", "None", ",", "**", "kwargs", ")", ":", "if", "dataset", "is", "not", "None", ":", "kwargs", "[", "'dataset'", "]", "=", "dataset", "kwargs", "[", "'context'", "]", "=", "'dataset'", "if", "'kind'"...
Filter in the 'dataset' context :parameter str dataset: name of the dataset (optional) :parameter **kwargs: any other tags to do the filter (except dataset or context) :return: :class:`phoebe.parameters.parameters.ParameterSet`
[ "Filter", "in", "the", "dataset", "context" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L2410-L2427
train
phoebe-project/phoebe2
phoebe/frontend/bundle.py
Bundle.remove_dataset
def remove_dataset(self, dataset=None, **kwargs): """ Remove a dataset from the Bundle. This removes all matching Parameters from the dataset, model, and constraint contexts (by default if the context tag is not provided). You must provide some sort of filter or this will raise an Erro...
python
def remove_dataset(self, dataset=None, **kwargs): """ Remove a dataset from the Bundle. This removes all matching Parameters from the dataset, model, and constraint contexts (by default if the context tag is not provided). You must provide some sort of filter or this will raise an Erro...
[ "def", "remove_dataset", "(", "self", ",", "dataset", "=", "None", ",", "**", "kwargs", ")", ":", "self", ".", "_kwargs_checks", "(", "kwargs", ")", "if", "dataset", "is", "None", "and", "not", "len", "(", "kwargs", ".", "items", "(", ")", ")", ":", ...
Remove a dataset from the Bundle. This removes all matching Parameters from the dataset, model, and constraint contexts (by default if the context tag is not provided). You must provide some sort of filter or this will raise an Error (so that all Parameters are not accidentally removed...
[ "Remove", "a", "dataset", "from", "the", "Bundle", "." ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L2429-L2502
train
phoebe-project/phoebe2
phoebe/frontend/bundle.py
Bundle.rename_dataset
def rename_dataset(self, old_dataset, new_dataset): """ Change the label of a dataset attached to the Bundle :parameter str old_dataset: the current name of the dataset (must exist) :parameter str new_dataset: the desired new name of the dataset (must not exist) ...
python
def rename_dataset(self, old_dataset, new_dataset): """ Change the label of a dataset attached to the Bundle :parameter str old_dataset: the current name of the dataset (must exist) :parameter str new_dataset: the desired new name of the dataset (must not exist) ...
[ "def", "rename_dataset", "(", "self", ",", "old_dataset", ",", "new_dataset", ")", ":", "self", ".", "_check_label", "(", "new_dataset", ")", "self", ".", "_rename_label", "(", "'dataset'", ",", "old_dataset", ",", "new_dataset", ")", "self", ".", "_handle_dat...
Change the label of a dataset attached to the Bundle :parameter str old_dataset: the current name of the dataset (must exist) :parameter str new_dataset: the desired new name of the dataset (must not exist) :return: None :raises ValueError: if the new_dataset is ...
[ "Change", "the", "label", "of", "a", "dataset", "attached", "to", "the", "Bundle" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L2511-L2526
train
phoebe-project/phoebe2
phoebe/frontend/bundle.py
Bundle.get_constraint
def get_constraint(self, twig=None, **kwargs): """ Filter in the 'constraint' context :parameter str constraint: name of the constraint (optional) :parameter **kwargs: any other tags to do the filter (except constraint or context) :return: :class:`phoebe.parameters.p...
python
def get_constraint(self, twig=None, **kwargs): """ Filter in the 'constraint' context :parameter str constraint: name of the constraint (optional) :parameter **kwargs: any other tags to do the filter (except constraint or context) :return: :class:`phoebe.parameters.p...
[ "def", "get_constraint", "(", "self", ",", "twig", "=", "None", ",", "**", "kwargs", ")", ":", "if", "twig", "is", "not", "None", ":", "kwargs", "[", "'twig'", "]", "=", "twig", "kwargs", "[", "'context'", "]", "=", "'constraint'", "return", "self", ...
Filter in the 'constraint' context :parameter str constraint: name of the constraint (optional) :parameter **kwargs: any other tags to do the filter (except constraint or context) :return: :class:`phoebe.parameters.parameters.ParameterSet`
[ "Filter", "in", "the", "constraint", "context" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L2698-L2710
train
phoebe-project/phoebe2
phoebe/frontend/bundle.py
Bundle.remove_constraint
def remove_constraint(self, twig=None, **kwargs): """ Remove a 'constraint' from the bundle :parameter str twig: twig to filter for the constraint :parameter **kwargs: any other tags to do the filter (except twig or context) """ # let's run delayed constraint...
python
def remove_constraint(self, twig=None, **kwargs): """ Remove a 'constraint' from the bundle :parameter str twig: twig to filter for the constraint :parameter **kwargs: any other tags to do the filter (except twig or context) """ # let's run delayed constraint...
[ "def", "remove_constraint", "(", "self", ",", "twig", "=", "None", ",", "**", "kwargs", ")", ":", "changed_params", "=", "self", ".", "run_delayed_constraints", "(", ")", "kwargs", "[", "'twig'", "]", "=", "twig", "redo_kwargs", "=", "deepcopy", "(", "kwar...
Remove a 'constraint' from the bundle :parameter str twig: twig to filter for the constraint :parameter **kwargs: any other tags to do the filter (except twig or context)
[ "Remove", "a", "constraint", "from", "the", "bundle" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L2712-L2751
train
phoebe-project/phoebe2
phoebe/frontend/bundle.py
Bundle.flip_constraint
def flip_constraint(self, twig=None, solve_for=None, **kwargs): """ Flip an existing constraint to solve for a different parameter :parameter str twig: twig to filter the constraint :parameter solve_for: twig or actual parameter object of the new parameter which this constra...
python
def flip_constraint(self, twig=None, solve_for=None, **kwargs): """ Flip an existing constraint to solve for a different parameter :parameter str twig: twig to filter the constraint :parameter solve_for: twig or actual parameter object of the new parameter which this constra...
[ "def", "flip_constraint", "(", "self", ",", "twig", "=", "None", ",", "solve_for", "=", "None", ",", "**", "kwargs", ")", ":", "self", ".", "_kwargs_checks", "(", "kwargs", ",", "additional_allowed_keys", "=", "[", "'check_nan'", "]", ")", "kwargs", "[", ...
Flip an existing constraint to solve for a different parameter :parameter str twig: twig to filter the constraint :parameter solve_for: twig or actual parameter object of the new parameter which this constraint should constraint (solve for). :type solve_for: str or :class:`phoebe.pa...
[ "Flip", "an", "existing", "constraint", "to", "solve", "for", "a", "different", "parameter" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L2754-L2797
train
phoebe-project/phoebe2
phoebe/frontend/bundle.py
Bundle.run_constraint
def run_constraint(self, twig=None, return_parameter=False, **kwargs): """ Run a given 'constraint' now and set the value of the constrained parameter. In general, there shouldn't be any need to manually call this - constraints should automatically be run whenever a dependent pa...
python
def run_constraint(self, twig=None, return_parameter=False, **kwargs): """ Run a given 'constraint' now and set the value of the constrained parameter. In general, there shouldn't be any need to manually call this - constraints should automatically be run whenever a dependent pa...
[ "def", "run_constraint", "(", "self", ",", "twig", "=", "None", ",", "return_parameter", "=", "False", ",", "**", "kwargs", ")", ":", "if", "not", "kwargs", ".", "get", "(", "'skip_kwargs_checks'", ",", "False", ")", ":", "self", ".", "_kwargs_checks", "...
Run a given 'constraint' now and set the value of the constrained parameter. In general, there shouldn't be any need to manually call this - constraints should automatically be run whenever a dependent parameter's value is change. :parameter str twig: twig to filter for the constraint ...
[ "Run", "a", "given", "constraint", "now", "and", "set", "the", "value", "of", "the", "constrained", "parameter", ".", "In", "general", "there", "shouldn", "t", "be", "any", "need", "to", "manually", "call", "this", "-", "constraints", "should", "automaticall...
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L2799-L2851
train
phoebe-project/phoebe2
phoebe/frontend/bundle.py
Bundle.get_compute
def get_compute(self, compute=None, **kwargs): """ Filter in the 'compute' context :parameter str compute: name of the compute options (optional) :parameter **kwargs: any other tags to do the filter (except compute or context) :return: :class:`phoebe.parameters.param...
python
def get_compute(self, compute=None, **kwargs): """ Filter in the 'compute' context :parameter str compute: name of the compute options (optional) :parameter **kwargs: any other tags to do the filter (except compute or context) :return: :class:`phoebe.parameters.param...
[ "def", "get_compute", "(", "self", ",", "compute", "=", "None", ",", "**", "kwargs", ")", ":", "if", "compute", "is", "not", "None", ":", "kwargs", "[", "'compute'", "]", "=", "compute", "kwargs", "[", "'context'", "]", "=", "'compute'", "return", "sel...
Filter in the 'compute' context :parameter str compute: name of the compute options (optional) :parameter **kwargs: any other tags to do the filter (except compute or context) :return: :class:`phoebe.parameters.parameters.ParameterSet`
[ "Filter", "in", "the", "compute", "context" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L2977-L2989
train
phoebe-project/phoebe2
phoebe/frontend/bundle.py
Bundle.remove_compute
def remove_compute(self, compute, **kwargs): """ Remove a 'compute' from the bundle :parameter str compute: name of the compute options :parameter **kwargs: any other tags to do the filter (except twig or context) :raise NotImplementedError: because it isn't ...
python
def remove_compute(self, compute, **kwargs): """ Remove a 'compute' from the bundle :parameter str compute: name of the compute options :parameter **kwargs: any other tags to do the filter (except twig or context) :raise NotImplementedError: because it isn't ...
[ "def", "remove_compute", "(", "self", ",", "compute", ",", "**", "kwargs", ")", ":", "kwargs", "[", "'compute'", "]", "=", "compute", "kwargs", "[", "'context'", "]", "=", "'comute'", "self", ".", "remove_parameters_all", "(", "**", "kwargs", ")" ]
Remove a 'compute' from the bundle :parameter str compute: name of the compute options :parameter **kwargs: any other tags to do the filter (except twig or context) :raise NotImplementedError: because it isn't
[ "Remove", "a", "compute", "from", "the", "bundle" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L2991-L3002
train
phoebe-project/phoebe2
phoebe/frontend/bundle.py
Bundle.rename_compute
def rename_compute(self, old_compute, new_compute): """ Change the label of a compute attached to the Bundle :parameter str old_compute: the current name of the compute options (must exist) :parameter str new_compute: the desired new name of the compute options (...
python
def rename_compute(self, old_compute, new_compute): """ Change the label of a compute attached to the Bundle :parameter str old_compute: the current name of the compute options (must exist) :parameter str new_compute: the desired new name of the compute options (...
[ "def", "rename_compute", "(", "self", ",", "old_compute", ",", "new_compute", ")", ":", "self", ".", "_check_label", "(", "new_compute", ")", "self", ".", "_rename_label", "(", "'compute'", ",", "old_compute", ",", "new_compute", ")" ]
Change the label of a compute attached to the Bundle :parameter str old_compute: the current name of the compute options (must exist) :parameter str new_compute: the desired new name of the compute options (must not exist) :return: None :raises ValueError: if the...
[ "Change", "the", "label", "of", "a", "compute", "attached", "to", "the", "Bundle" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L3011-L3025
train
phoebe-project/phoebe2
phoebe/frontend/bundle.py
Bundle.get_model
def get_model(self, model=None, **kwargs): """ Filter in the 'model' context :parameter str model: name of the model (optional) :parameter **kwargs: any other tags to do the filter (except model or context) :return: :class:`phoebe.parameters.parameters.ParameterSet` ...
python
def get_model(self, model=None, **kwargs): """ Filter in the 'model' context :parameter str model: name of the model (optional) :parameter **kwargs: any other tags to do the filter (except model or context) :return: :class:`phoebe.parameters.parameters.ParameterSet` ...
[ "def", "get_model", "(", "self", ",", "model", "=", "None", ",", "**", "kwargs", ")", ":", "if", "model", "is", "not", "None", ":", "kwargs", "[", "'model'", "]", "=", "model", "kwargs", "[", "'context'", "]", "=", "'model'", "return", "self", ".", ...
Filter in the 'model' context :parameter str model: name of the model (optional) :parameter **kwargs: any other tags to do the filter (except model or context) :return: :class:`phoebe.parameters.parameters.ParameterSet`
[ "Filter", "in", "the", "model", "context" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L3306-L3318
train
phoebe-project/phoebe2
phoebe/frontend/bundle.py
Bundle.remove_model
def remove_model(self, model, **kwargs): """ Remove a 'model' from the bundle :parameter str twig: twig to filter for the model :parameter **kwargs: any other tags to do the filter (except twig or context) """ kwargs['model'] = model kwargs['context']...
python
def remove_model(self, model, **kwargs): """ Remove a 'model' from the bundle :parameter str twig: twig to filter for the model :parameter **kwargs: any other tags to do the filter (except twig or context) """ kwargs['model'] = model kwargs['context']...
[ "def", "remove_model", "(", "self", ",", "model", ",", "**", "kwargs", ")", ":", "kwargs", "[", "'model'", "]", "=", "model", "kwargs", "[", "'context'", "]", "=", "'model'", "self", ".", "remove_parameters_all", "(", "**", "kwargs", ")" ]
Remove a 'model' from the bundle :parameter str twig: twig to filter for the model :parameter **kwargs: any other tags to do the filter (except twig or context)
[ "Remove", "a", "model", "from", "the", "bundle" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L3320-L3330
train
phoebe-project/phoebe2
phoebe/frontend/bundle.py
Bundle.rename_model
def rename_model(self, old_model, new_model): """ Change the label of a model attached to the Bundle :parameter str old_model: the current name of the model (must exist) :parameter str new_model: the desired new name of the model (must not exist) :return:...
python
def rename_model(self, old_model, new_model): """ Change the label of a model attached to the Bundle :parameter str old_model: the current name of the model (must exist) :parameter str new_model: the desired new name of the model (must not exist) :return:...
[ "def", "rename_model", "(", "self", ",", "old_model", ",", "new_model", ")", ":", "self", ".", "_check_label", "(", "new_model", ")", "self", ".", "_rename_label", "(", "'model'", ",", "old_model", ",", "new_model", ")" ]
Change the label of a model attached to the Bundle :parameter str old_model: the current name of the model (must exist) :parameter str new_model: the desired new name of the model (must not exist) :return: None :raises ValueError: if the new_model is forbidden
[ "Change", "the", "label", "of", "a", "model", "attached", "to", "the", "Bundle" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L3339-L3353
train
phoebe-project/phoebe2
phoebe/parameters/twighelpers.py
_twig_to_uniqueid
def _twig_to_uniqueid(bundle, twig, **kwargs): """ kwargs are passed on to filter """ res = bundle.filter(twig=twig, force_ps=True, check_visible=False, check_default=False, **kwargs) # we force_ps instead of checking is_instance(res, ParameterSet) to avoid # having to import from parameters ...
python
def _twig_to_uniqueid(bundle, twig, **kwargs): """ kwargs are passed on to filter """ res = bundle.filter(twig=twig, force_ps=True, check_visible=False, check_default=False, **kwargs) # we force_ps instead of checking is_instance(res, ParameterSet) to avoid # having to import from parameters ...
[ "def", "_twig_to_uniqueid", "(", "bundle", ",", "twig", ",", "**", "kwargs", ")", ":", "res", "=", "bundle", ".", "filter", "(", "twig", "=", "twig", ",", "force_ps", "=", "True", ",", "check_visible", "=", "False", ",", "check_default", "=", "False", ...
kwargs are passed on to filter
[ "kwargs", "are", "passed", "on", "to", "filter" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/twighelpers.py#L10-L21
train
phoebe-project/phoebe2
phoebe/constraints/expression.py
ConstraintVar.update_user_label
def update_user_label(self): """ finds this parameter and gets the least_unique_twig from the bundle """ self._user_label = _uniqueid_to_uniquetwig(self._bundle, self.unique_label) self._set_curly_label()
python
def update_user_label(self): """ finds this parameter and gets the least_unique_twig from the bundle """ self._user_label = _uniqueid_to_uniquetwig(self._bundle, self.unique_label) self._set_curly_label()
[ "def", "update_user_label", "(", "self", ")", ":", "self", ".", "_user_label", "=", "_uniqueid_to_uniquetwig", "(", "self", ".", "_bundle", ",", "self", ".", "unique_label", ")", "self", ".", "_set_curly_label", "(", ")" ]
finds this parameter and gets the least_unique_twig from the bundle
[ "finds", "this", "parameter", "and", "gets", "the", "least_unique_twig", "from", "the", "bundle" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/constraints/expression.py#L53-L59
train
phoebe-project/phoebe2
phoebe/constraints/expression.py
ConstraintVar.get_parameter
def get_parameter(self): """ get the parameter object from the system for this var needs to be backend safe (not passing or storing bundle) """ if not self.is_param: raise ValueError("this var does not point to a parameter") # this is quite expensive, so let...
python
def get_parameter(self): """ get the parameter object from the system for this var needs to be backend safe (not passing or storing bundle) """ if not self.is_param: raise ValueError("this var does not point to a parameter") # this is quite expensive, so let...
[ "def", "get_parameter", "(", "self", ")", ":", "if", "not", "self", ".", "is_param", ":", "raise", "ValueError", "(", "\"this var does not point to a parameter\"", ")", "if", "self", ".", "_parameter", "is", "None", ":", "self", ".", "_parameter", "=", "self",...
get the parameter object from the system for this var needs to be backend safe (not passing or storing bundle)
[ "get", "the", "parameter", "object", "from", "the", "system", "for", "this", "var" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/constraints/expression.py#L82-L96
train
phoebe-project/phoebe2
phoebe/dependencies/autofig/axes.py
_process_dimension_kwargs
def _process_dimension_kwargs(direction, kwargs): """ process kwargs for AxDimension instances by stripping off the prefix for the appropriate direction """ acceptable_keys = ['unit', 'pad', 'lim', 'label'] # if direction in ['s']: # acceptable_keys += ['mode'] processed_kwargs = {} ...
python
def _process_dimension_kwargs(direction, kwargs): """ process kwargs for AxDimension instances by stripping off the prefix for the appropriate direction """ acceptable_keys = ['unit', 'pad', 'lim', 'label'] # if direction in ['s']: # acceptable_keys += ['mode'] processed_kwargs = {} ...
[ "def", "_process_dimension_kwargs", "(", "direction", ",", "kwargs", ")", ":", "acceptable_keys", "=", "[", "'unit'", ",", "'pad'", ",", "'lim'", ",", "'label'", "]", "processed_kwargs", "=", "{", "}", "for", "k", ",", "v", "in", "kwargs", ".", "items", ...
process kwargs for AxDimension instances by stripping off the prefix for the appropriate direction
[ "process", "kwargs", "for", "AxDimension", "instances", "by", "stripping", "off", "the", "prefix", "for", "the", "appropriate", "direction" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dependencies/autofig/axes.py#L1249-L1267
train
phoebe-project/phoebe2
phoebe/dependencies/autofig/axes.py
Axes.calls_sorted
def calls_sorted(self): """ calls sorted in z """ def _z(call): if isinstance(call.z.value, np.ndarray): return np.mean(call.z.value.flatten()) elif isinstance(call.z.value, float) or isinstance(call.z.value, int): return call.z.val...
python
def calls_sorted(self): """ calls sorted in z """ def _z(call): if isinstance(call.z.value, np.ndarray): return np.mean(call.z.value.flatten()) elif isinstance(call.z.value, float) or isinstance(call.z.value, int): return call.z.val...
[ "def", "calls_sorted", "(", "self", ")", ":", "def", "_z", "(", "call", ")", ":", "if", "isinstance", "(", "call", ".", "z", ".", "value", ",", "np", ".", "ndarray", ")", ":", "return", "np", ".", "mean", "(", "call", ".", "z", ".", "value", "....
calls sorted in z
[ "calls", "sorted", "in", "z" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dependencies/autofig/axes.py#L145-L163
train
pinax/pinax-teams
pinax/teams/utils.py
create_teams
def create_teams(obj, user, access): """ Will create new teams associated with the referenced obj and set the resulting relation to the correct attribute. The naming convention for team foreign keys is pluralname_team (for example, instructors_team). This function will take the access dictiona...
python
def create_teams(obj, user, access): """ Will create new teams associated with the referenced obj and set the resulting relation to the correct attribute. The naming convention for team foreign keys is pluralname_team (for example, instructors_team). This function will take the access dictiona...
[ "def", "create_teams", "(", "obj", ",", "user", ",", "access", ")", ":", "for", "field_name", ",", "access_types", "in", "access", ".", "items", "(", ")", ":", "id_field", "=", "\"{}_id\"", ".", "format", "(", "field_name", ")", "if", "hasattr", "(", "...
Will create new teams associated with the referenced obj and set the resulting relation to the correct attribute. The naming convention for team foreign keys is pluralname_team (for example, instructors_team). This function will take the access dictionary and apply the specified access types as fo...
[ "Will", "create", "new", "teams", "associated", "with", "the", "referenced", "obj", "and", "set", "the", "resulting", "relation", "to", "the", "correct", "attribute", "." ]
f8354ba0d32b3979d1dc18f50d23fd0096445ab7
https://github.com/pinax/pinax-teams/blob/f8354ba0d32b3979d1dc18f50d23fd0096445ab7/pinax/teams/utils.py#L4-L43
train
phoebe-project/phoebe2
phoebe/parameters/hierarchy.py
binaryorbit
def binaryorbit(orbit, comp1, comp2, envelope=None): """ Build the string representation of a hierarchy containing a binary orbit with 2 components. Generally, this will be used as an input to the kind argument in :meth:`phoebe.frontend.bundle.Bundle.set_hierarchy` :parameter comp1: an existin...
python
def binaryorbit(orbit, comp1, comp2, envelope=None): """ Build the string representation of a hierarchy containing a binary orbit with 2 components. Generally, this will be used as an input to the kind argument in :meth:`phoebe.frontend.bundle.Bundle.set_hierarchy` :parameter comp1: an existin...
[ "def", "binaryorbit", "(", "orbit", ",", "comp1", ",", "comp2", ",", "envelope", "=", "None", ")", ":", "if", "envelope", ":", "return", "'{}({}, {}, {})'", ".", "format", "(", "_to_component", "(", "orbit", ",", "False", ")", ",", "_to_component", "(", ...
Build the string representation of a hierarchy containing a binary orbit with 2 components. Generally, this will be used as an input to the kind argument in :meth:`phoebe.frontend.bundle.Bundle.set_hierarchy` :parameter comp1: an existing hierarchy string, Parameter, or ParameterSet :parameter com...
[ "Build", "the", "string", "representation", "of", "a", "hierarchy", "containing", "a", "binary", "orbit", "with", "2", "components", "." ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/hierarchy.py#L37-L53
train
phoebe-project/phoebe2
phoebe/dependencies/autofig/call.py
CallDimension.direction
def direction(self, direction): """ set the direction """ if not isinstance(direction, str): raise TypeError("direction must be of type str") accepted_values = ['i', 'x', 'y', 'z', 's', 'c'] if direction not in accepted_values: raise ValueError("m...
python
def direction(self, direction): """ set the direction """ if not isinstance(direction, str): raise TypeError("direction must be of type str") accepted_values = ['i', 'x', 'y', 'z', 's', 'c'] if direction not in accepted_values: raise ValueError("m...
[ "def", "direction", "(", "self", ",", "direction", ")", ":", "if", "not", "isinstance", "(", "direction", ",", "str", ")", ":", "raise", "TypeError", "(", "\"direction must be of type str\"", ")", "accepted_values", "=", "[", "'i'", ",", "'x'", ",", "'y'", ...
set the direction
[ "set", "the", "direction" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dependencies/autofig/call.py#L1397-L1408
train
phoebe-project/phoebe2
phoebe/dependencies/autofig/call.py
CallDimension.error
def error(self, error): """ set the error """ # TODO: check length with value? # TODO: type checks (similar to value) if self.direction not in ['x', 'y', 'z'] and error is not None: raise ValueError("error only accepted for x, y, z dimensions") if isi...
python
def error(self, error): """ set the error """ # TODO: check length with value? # TODO: type checks (similar to value) if self.direction not in ['x', 'y', 'z'] and error is not None: raise ValueError("error only accepted for x, y, z dimensions") if isi...
[ "def", "error", "(", "self", ",", "error", ")", ":", "if", "self", ".", "direction", "not", "in", "[", "'x'", ",", "'y'", ",", "'z'", "]", "and", "error", "is", "not", "None", ":", "raise", "ValueError", "(", "\"error only accepted for x, y, z dimensions\"...
set the error
[ "set", "the", "error" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dependencies/autofig/call.py#L1783-L1795
train
phoebe-project/phoebe2
phoebe/dependencies/autofig/call.py
CallDimension.label
def label(self, label): """ set the label """ if self.direction in ['i'] and label is not None: raise ValueError("label not accepted for indep dimension") if label is None: self._label = label return if not isinstance(label, str): ...
python
def label(self, label): """ set the label """ if self.direction in ['i'] and label is not None: raise ValueError("label not accepted for indep dimension") if label is None: self._label = label return if not isinstance(label, str): ...
[ "def", "label", "(", "self", ",", "label", ")", ":", "if", "self", ".", "direction", "in", "[", "'i'", "]", "and", "label", "is", "not", "None", ":", "raise", "ValueError", "(", "\"label not accepted for indep dimension\"", ")", "if", "label", "is", "None"...
set the label
[ "set", "the", "label" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dependencies/autofig/call.py#L1820-L1838
train
phoebe-project/phoebe2
phoebe/dependencies/autofig/call.py
CallDimensionI.value
def value(self): """ access the value """ if isinstance(self._value, str): dimension = self._value return getattr(self.call, dimension).value return super(CallDimensionI, self)._get_value()
python
def value(self): """ access the value """ if isinstance(self._value, str): dimension = self._value return getattr(self.call, dimension).value return super(CallDimensionI, self)._get_value()
[ "def", "value", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "_value", ",", "str", ")", ":", "dimension", "=", "self", ".", "_value", "return", "getattr", "(", "self", ".", "call", ",", "dimension", ")", ".", "value", "return", "super...
access the value
[ "access", "the", "value" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dependencies/autofig/call.py#L1865-L1873
train
phoebe-project/phoebe2
phoebe/dynamics/nbody.py
_ensure_tuple
def _ensure_tuple(item): """ Simply ensure that the passed item is a tuple. If it is not, then convert it if possible, or raise a NotImplementedError Args: item: the item that needs to become a tuple Returns: the item casted as a tuple Raises: NotImplementedError: if ...
python
def _ensure_tuple(item): """ Simply ensure that the passed item is a tuple. If it is not, then convert it if possible, or raise a NotImplementedError Args: item: the item that needs to become a tuple Returns: the item casted as a tuple Raises: NotImplementedError: if ...
[ "def", "_ensure_tuple", "(", "item", ")", ":", "if", "isinstance", "(", "item", ",", "tuple", ")", ":", "return", "item", "elif", "isinstance", "(", "item", ",", "list", ")", ":", "return", "tuple", "(", "item", ")", "elif", "isinstance", "(", "item", ...
Simply ensure that the passed item is a tuple. If it is not, then convert it if possible, or raise a NotImplementedError Args: item: the item that needs to become a tuple Returns: the item casted as a tuple Raises: NotImplementedError: if converting the given item to a tuple ...
[ "Simply", "ensure", "that", "the", "passed", "item", "is", "a", "tuple", ".", "If", "it", "is", "not", "then", "convert", "it", "if", "possible", "or", "raise", "a", "NotImplementedError" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dynamics/nbody.py#L36-L58
train
phoebe-project/phoebe2
phoebe/parameters/constraint.py
asini
def asini(b, orbit, solve_for=None): """ Create a constraint for asini in an orbit. If any of the required parameters ('asini', 'sma', 'incl') do not exist in the orbit, they will be created. :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str orbit: the label of the orbit ...
python
def asini(b, orbit, solve_for=None): """ Create a constraint for asini in an orbit. If any of the required parameters ('asini', 'sma', 'incl') do not exist in the orbit, they will be created. :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str orbit: the label of the orbit ...
[ "def", "asini", "(", "b", ",", "orbit", ",", "solve_for", "=", "None", ")", ":", "orbit_ps", "=", "_get_system_ps", "(", "b", ",", "orbit", ")", "metawargs", "=", "orbit_ps", ".", "meta", "metawargs", ".", "pop", "(", "'qualifier'", ")", "sma_def", "="...
Create a constraint for asini in an orbit. If any of the required parameters ('asini', 'sma', 'incl') do not exist in the orbit, they will be created. :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str orbit: the label of the orbit in which this constraint should be built ...
[ "Create", "a", "constraint", "for", "asini", "in", "an", "orbit", "." ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/constraint.py#L236-L287
train
phoebe-project/phoebe2
phoebe/parameters/constraint.py
esinw
def esinw(b, orbit, solve_for=None, **kwargs): """ Create a constraint for esinw in an orbit. If 'esinw' does not exist in the orbit, it will be created :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str orbit: the label of the orbit in which this constraint should be ...
python
def esinw(b, orbit, solve_for=None, **kwargs): """ Create a constraint for esinw in an orbit. If 'esinw' does not exist in the orbit, it will be created :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str orbit: the label of the orbit in which this constraint should be ...
[ "def", "esinw", "(", "b", ",", "orbit", ",", "solve_for", "=", "None", ",", "**", "kwargs", ")", ":", "orbit_ps", "=", "_get_system_ps", "(", "b", ",", "orbit", ")", "metawargs", "=", "orbit_ps", ".", "meta", "metawargs", ".", "pop", "(", "'qualifier'"...
Create a constraint for esinw in an orbit. If 'esinw' does not exist in the orbit, it will be created :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str orbit: the label of the orbit in which this constraint should be built :parameter str solve_for: if 'esinw' should not ...
[ "Create", "a", "constraint", "for", "esinw", "in", "an", "orbit", "." ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/constraint.py#L289-L329
train
phoebe-project/phoebe2
phoebe/parameters/constraint.py
ecosw
def ecosw(b, orbit, solve_for=None, **kwargs): """ Create a constraint for ecosw in an orbit. If 'ecosw' does not exist in the orbit, it will be created :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str orbit: the label of the orbit in which this constraint should be ...
python
def ecosw(b, orbit, solve_for=None, **kwargs): """ Create a constraint for ecosw in an orbit. If 'ecosw' does not exist in the orbit, it will be created :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str orbit: the label of the orbit in which this constraint should be ...
[ "def", "ecosw", "(", "b", ",", "orbit", ",", "solve_for", "=", "None", ",", "**", "kwargs", ")", ":", "orbit_ps", "=", "_get_system_ps", "(", "b", ",", "orbit", ")", "metawargs", "=", "orbit_ps", ".", "meta", "metawargs", ".", "pop", "(", "'qualifier'"...
Create a constraint for ecosw in an orbit. If 'ecosw' does not exist in the orbit, it will be created :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str orbit: the label of the orbit in which this constraint should be built :parameter str solve_for: if 'ecosw' should not ...
[ "Create", "a", "constraint", "for", "ecosw", "in", "an", "orbit", "." ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/constraint.py#L331-L371
train
phoebe-project/phoebe2
phoebe/parameters/constraint.py
t0_perpass_supconj
def t0_perpass_supconj(b, orbit, solve_for=None, **kwargs): """ Create a constraint for t0_perpass in an orbit - allowing translating between t0_perpass and t0_supconj. :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str orbit: the label of the orbit in which this constr...
python
def t0_perpass_supconj(b, orbit, solve_for=None, **kwargs): """ Create a constraint for t0_perpass in an orbit - allowing translating between t0_perpass and t0_supconj. :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str orbit: the label of the orbit in which this constr...
[ "def", "t0_perpass_supconj", "(", "b", ",", "orbit", ",", "solve_for", "=", "None", ",", "**", "kwargs", ")", ":", "orbit_ps", "=", "_get_system_ps", "(", "b", ",", "orbit", ")", "metawargs", "=", "orbit_ps", ".", "meta", "metawargs", ".", "pop", "(", ...
Create a constraint for t0_perpass in an orbit - allowing translating between t0_perpass and t0_supconj. :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str orbit: the label of the orbit in which this constraint should be built :parameter str solve_for: if 't0_perpass' shou...
[ "Create", "a", "constraint", "for", "t0_perpass", "in", "an", "orbit", "-", "allowing", "translating", "between", "t0_perpass", "and", "t0_supconj", "." ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/constraint.py#L373-L413
train
phoebe-project/phoebe2
phoebe/parameters/constraint.py
t0_ref_supconj
def t0_ref_supconj(b, orbit, solve_for=None, **kwargs): """ Create a constraint for t0_ref in an orbit - allowing translating between t0_ref and t0_supconj. :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str orbit: the label of the orbit in which this constraint should ...
python
def t0_ref_supconj(b, orbit, solve_for=None, **kwargs): """ Create a constraint for t0_ref in an orbit - allowing translating between t0_ref and t0_supconj. :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str orbit: the label of the orbit in which this constraint should ...
[ "def", "t0_ref_supconj", "(", "b", ",", "orbit", ",", "solve_for", "=", "None", ",", "**", "kwargs", ")", ":", "orbit_ps", "=", "_get_system_ps", "(", "b", ",", "orbit", ")", "metawargs", "=", "orbit_ps", ".", "meta", "metawargs", ".", "pop", "(", "'qu...
Create a constraint for t0_ref in an orbit - allowing translating between t0_ref and t0_supconj. :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str orbit: the label of the orbit in which this constraint should be built :parameter str solve_for: if 't0_ref' should not be th...
[ "Create", "a", "constraint", "for", "t0_ref", "in", "an", "orbit", "-", "allowing", "translating", "between", "t0_ref", "and", "t0_supconj", "." ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/constraint.py#L421-L459
train
phoebe-project/phoebe2
phoebe/parameters/constraint.py
irrad_frac
def irrad_frac(b, component, solve_for=None, **kwargs): """ Create a constraint to ensure that energy is conserved and all incident light is accounted for. """ comp_ps = b.get_component(component=component) irrad_frac_refl_bol = comp_ps.get_parameter(qualifier='irrad_frac_refl_bol') irrad_...
python
def irrad_frac(b, component, solve_for=None, **kwargs): """ Create a constraint to ensure that energy is conserved and all incident light is accounted for. """ comp_ps = b.get_component(component=component) irrad_frac_refl_bol = comp_ps.get_parameter(qualifier='irrad_frac_refl_bol') irrad_...
[ "def", "irrad_frac", "(", "b", ",", "component", ",", "solve_for", "=", "None", ",", "**", "kwargs", ")", ":", "comp_ps", "=", "b", ".", "get_component", "(", "component", "=", "component", ")", "irrad_frac_refl_bol", "=", "comp_ps", ".", "get_parameter", ...
Create a constraint to ensure that energy is conserved and all incident light is accounted for.
[ "Create", "a", "constraint", "to", "ensure", "that", "energy", "is", "conserved", "and", "all", "incident", "light", "is", "accounted", "for", "." ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/constraint.py#L666-L686
train
phoebe-project/phoebe2
phoebe/parameters/constraint.py
semidetached
def semidetached(b, component, solve_for=None, **kwargs): """ Create a constraint to force requiv to be semidetached """ comp_ps = b.get_component(component=component) requiv = comp_ps.get_parameter(qualifier='requiv') requiv_critical = comp_ps.get_parameter(qualifier='requiv_max') if solv...
python
def semidetached(b, component, solve_for=None, **kwargs): """ Create a constraint to force requiv to be semidetached """ comp_ps = b.get_component(component=component) requiv = comp_ps.get_parameter(qualifier='requiv') requiv_critical = comp_ps.get_parameter(qualifier='requiv_max') if solv...
[ "def", "semidetached", "(", "b", ",", "component", ",", "solve_for", "=", "None", ",", "**", "kwargs", ")", ":", "comp_ps", "=", "b", ".", "get_component", "(", "component", "=", "component", ")", "requiv", "=", "comp_ps", ".", "get_parameter", "(", "qua...
Create a constraint to force requiv to be semidetached
[ "Create", "a", "constraint", "to", "force", "requiv", "to", "be", "semidetached" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/constraint.py#L688-L703
train
phoebe-project/phoebe2
phoebe/parameters/constraint.py
mass
def mass(b, component, solve_for=None, **kwargs): """ Create a constraint for the mass of a star based on Kepler's third law from its parent orbit. If 'mass' does not exist in the component, it will be created :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str component: t...
python
def mass(b, component, solve_for=None, **kwargs): """ Create a constraint for the mass of a star based on Kepler's third law from its parent orbit. If 'mass' does not exist in the component, it will be created :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str component: t...
[ "def", "mass", "(", "b", ",", "component", ",", "solve_for", "=", "None", ",", "**", "kwargs", ")", ":", "hier", "=", "b", ".", "get_hierarchy", "(", ")", "if", "not", "len", "(", "hier", ".", "get_value", "(", ")", ")", ":", "raise", "NotImplement...
Create a constraint for the mass of a star based on Kepler's third law from its parent orbit. If 'mass' does not exist in the component, it will be created :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str component: the label of the star in which this constraint should b...
[ "Create", "a", "constraint", "for", "the", "mass", "of", "a", "star", "based", "on", "Kepler", "s", "third", "law", "from", "its", "parent", "orbit", "." ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/constraint.py#L719-L795
train
phoebe-project/phoebe2
phoebe/parameters/constraint.py
comp_sma
def comp_sma(b, component, solve_for=None, **kwargs): """ Create a constraint for the star's semi-major axes WITHIN its parent orbit. This is NOT the same as the semi-major axes OF the parent orbit If 'sma' does not exist in the component, it will be created :parameter b: the :class:`phoebe.f...
python
def comp_sma(b, component, solve_for=None, **kwargs): """ Create a constraint for the star's semi-major axes WITHIN its parent orbit. This is NOT the same as the semi-major axes OF the parent orbit If 'sma' does not exist in the component, it will be created :parameter b: the :class:`phoebe.f...
[ "def", "comp_sma", "(", "b", ",", "component", ",", "solve_for", "=", "None", ",", "**", "kwargs", ")", ":", "hier", "=", "b", ".", "get_hierarchy", "(", ")", "if", "not", "len", "(", "hier", ".", "get_value", "(", ")", ")", ":", "raise", "NotImple...
Create a constraint for the star's semi-major axes WITHIN its parent orbit. This is NOT the same as the semi-major axes OF the parent orbit If 'sma' does not exist in the component, it will be created :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str component: the label of ...
[ "Create", "a", "constraint", "for", "the", "star", "s", "semi", "-", "major", "axes", "WITHIN", "its", "parent", "orbit", ".", "This", "is", "NOT", "the", "same", "as", "the", "semi", "-", "major", "axes", "OF", "the", "parent", "orbit" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/constraint.py#L798-L857
train
phoebe-project/phoebe2
phoebe/parameters/constraint.py
fillout_factor
def fillout_factor(b, component, solve_for=None, **kwargs): """ Create a constraint to determine the fillout factor of a contact envelope. :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str component: the label of the star in which this constraint should be built :param...
python
def fillout_factor(b, component, solve_for=None, **kwargs): """ Create a constraint to determine the fillout factor of a contact envelope. :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str component: the label of the star in which this constraint should be built :param...
[ "def", "fillout_factor", "(", "b", ",", "component", ",", "solve_for", "=", "None", ",", "**", "kwargs", ")", ":", "hier", "=", "b", ".", "get_hierarchy", "(", ")", "if", "not", "len", "(", "hier", ".", "get_value", "(", ")", ")", ":", "raise", "No...
Create a constraint to determine the fillout factor of a contact envelope. :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str component: the label of the star in which this constraint should be built :parameter str solve_for: if 'requiv_max' should not be the derived/constrain...
[ "Create", "a", "constraint", "to", "determine", "the", "fillout", "factor", "of", "a", "contact", "envelope", "." ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/constraint.py#L1067-L1106
train
phoebe-project/phoebe2
phoebe/parameters/constraint.py
rotation_period
def rotation_period(b, component, solve_for=None, **kwargs): """ Create a constraint for the rotation period of a star given its orbital period and synchronicity parameters. :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str component: the label of the star in which this ...
python
def rotation_period(b, component, solve_for=None, **kwargs): """ Create a constraint for the rotation period of a star given its orbital period and synchronicity parameters. :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str component: the label of the star in which this ...
[ "def", "rotation_period", "(", "b", ",", "component", ",", "solve_for", "=", "None", ",", "**", "kwargs", ")", ":", "hier", "=", "b", ".", "get_hierarchy", "(", ")", "if", "not", "len", "(", "hier", ".", "get_value", "(", ")", ")", ":", "raise", "N...
Create a constraint for the rotation period of a star given its orbital period and synchronicity parameters. :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str component: the label of the star in which this constraint should be built :parameter str solve_for: if 'period@st...
[ "Create", "a", "constraint", "for", "the", "rotation", "period", "of", "a", "star", "given", "its", "orbital", "period", "and", "synchronicity", "parameters", "." ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/constraint.py#L1108-L1158
train
phoebe-project/phoebe2
phoebe/dependencies/nparray/nparray.py
is_unit
def is_unit(value): """must be an astropy unit""" if not _has_astropy: raise ImportError("astropy must be installed for unit support") if (isinstance(value, units.Unit) or isinstance(value, units.IrreducibleUnit) or isinstance(value, units.CompositeUnit)): return True, value else: ...
python
def is_unit(value): """must be an astropy unit""" if not _has_astropy: raise ImportError("astropy must be installed for unit support") if (isinstance(value, units.Unit) or isinstance(value, units.IrreducibleUnit) or isinstance(value, units.CompositeUnit)): return True, value else: ...
[ "def", "is_unit", "(", "value", ")", ":", "if", "not", "_has_astropy", ":", "raise", "ImportError", "(", "\"astropy must be installed for unit support\"", ")", "if", "(", "isinstance", "(", "value", ",", "units", ".", "Unit", ")", "or", "isinstance", "(", "val...
must be an astropy unit
[ "must", "be", "an", "astropy", "unit" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dependencies/nparray/nparray.py#L17-L24
train
phoebe-project/phoebe2
phoebe/dependencies/nparray/nparray.py
is_unit_or_unitstring
def is_unit_or_unitstring(value): """must be an astropy.unit""" if is_unit(value)[0]: return True, value try: unit = units.Unit(value) except: return False, value else: return True, unit
python
def is_unit_or_unitstring(value): """must be an astropy.unit""" if is_unit(value)[0]: return True, value try: unit = units.Unit(value) except: return False, value else: return True, unit
[ "def", "is_unit_or_unitstring", "(", "value", ")", ":", "if", "is_unit", "(", "value", ")", "[", "0", "]", ":", "return", "True", ",", "value", "try", ":", "unit", "=", "units", ".", "Unit", "(", "value", ")", "except", ":", "return", "False", ",", ...
must be an astropy.unit
[ "must", "be", "an", "astropy", ".", "unit" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dependencies/nparray/nparray.py#L26-L35
train
phoebe-project/phoebe2
phoebe/dependencies/nparray/nparray.py
is_float
def is_float(value): """must be a float""" return isinstance(value, float) or isinstance(value, int) or isinstance(value, np.float64), float(value)
python
def is_float(value): """must be a float""" return isinstance(value, float) or isinstance(value, int) or isinstance(value, np.float64), float(value)
[ "def", "is_float", "(", "value", ")", ":", "return", "isinstance", "(", "value", ",", "float", ")", "or", "isinstance", "(", "value", ",", "int", ")", "or", "isinstance", "(", "value", ",", "np", ".", "float64", ")", ",", "float", "(", "value", ")" ]
must be a float
[ "must", "be", "a", "float" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dependencies/nparray/nparray.py#L47-L49
train
phoebe-project/phoebe2
phoebe/dependencies/nparray/nparray.py
ArrayWrapper.to
def to(self, unit): """ convert between units. Returns a new nparray object with the new units """ if not _has_astropy: raise ImportError("astropy must be installed for unit/quantity support") if self.unit is None: raise ValueError("no units currently se...
python
def to(self, unit): """ convert between units. Returns a new nparray object with the new units """ if not _has_astropy: raise ImportError("astropy must be installed for unit/quantity support") if self.unit is None: raise ValueError("no units currently se...
[ "def", "to", "(", "self", ",", "unit", ")", ":", "if", "not", "_has_astropy", ":", "raise", "ImportError", "(", "\"astropy must be installed for unit/quantity support\"", ")", "if", "self", ".", "unit", "is", "None", ":", "raise", "ValueError", "(", "\"no units ...
convert between units. Returns a new nparray object with the new units
[ "convert", "between", "units", ".", "Returns", "a", "new", "nparray", "object", "with", "the", "new", "units" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dependencies/nparray/nparray.py#L136-L152
train
phoebe-project/phoebe2
phoebe/dependencies/nparray/nparray.py
ArrayWrapper.to_dict
def to_dict(self): """ dump a representation of the nparray object to a dictionary. The nparray object should then be able to be fully restored via nparray.from_dict """ def _json_safe(v): if isinstance(v, np.ndarray): return v.tolist() ...
python
def to_dict(self): """ dump a representation of the nparray object to a dictionary. The nparray object should then be able to be fully restored via nparray.from_dict """ def _json_safe(v): if isinstance(v, np.ndarray): return v.tolist() ...
[ "def", "to_dict", "(", "self", ")", ":", "def", "_json_safe", "(", "v", ")", ":", "if", "isinstance", "(", "v", ",", "np", ".", "ndarray", ")", ":", "return", "v", ".", "tolist", "(", ")", "elif", "is_unit", "(", "v", ")", "[", "0", "]", ":", ...
dump a representation of the nparray object to a dictionary. The nparray object should then be able to be fully restored via nparray.from_dict
[ "dump", "a", "representation", "of", "the", "nparray", "object", "to", "a", "dictionary", ".", "The", "nparray", "object", "should", "then", "be", "able", "to", "be", "fully", "restored", "via", "nparray", ".", "from_dict" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dependencies/nparray/nparray.py#L224-L239
train
phoebe-project/phoebe2
phoebe/dependencies/nparray/nparray.py
ArrayWrapper.to_file
def to_file(self, filename, **kwargs): """ dump a representation of the nparray object to a json-formatted file. The nparray object should then be able to be fully restored via nparray.from_file @parameter str filename: path to the file to be created (will overwrite ...
python
def to_file(self, filename, **kwargs): """ dump a representation of the nparray object to a json-formatted file. The nparray object should then be able to be fully restored via nparray.from_file @parameter str filename: path to the file to be created (will overwrite ...
[ "def", "to_file", "(", "self", ",", "filename", ",", "**", "kwargs", ")", ":", "f", "=", "open", "(", "filename", ",", "'w'", ")", "f", ".", "write", "(", "self", ".", "to_json", "(", "**", "kwargs", ")", ")", "f", ".", "close", "(", ")", "retu...
dump a representation of the nparray object to a json-formatted file. The nparray object should then be able to be fully restored via nparray.from_file @parameter str filename: path to the file to be created (will overwrite if already exists) @rtype: str @returns: th...
[ "dump", "a", "representation", "of", "the", "nparray", "object", "to", "a", "json", "-", "formatted", "file", ".", "The", "nparray", "object", "should", "then", "be", "able", "to", "be", "fully", "restored", "via", "nparray", ".", "from_file" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dependencies/nparray/nparray.py#L249-L263
train
phoebe-project/phoebe2
phoebe/dependencies/nparray/nparray.py
Arange.to_linspace
def to_linspace(self): """ convert from arange to linspace """ num = int((self.stop-self.start)/(self.step)) return Linspace(self.start, self.stop-self.step, num)
python
def to_linspace(self): """ convert from arange to linspace """ num = int((self.stop-self.start)/(self.step)) return Linspace(self.start, self.stop-self.step, num)
[ "def", "to_linspace", "(", "self", ")", ":", "num", "=", "int", "(", "(", "self", ".", "stop", "-", "self", ".", "start", ")", "/", "(", "self", ".", "step", ")", ")", "return", "Linspace", "(", "self", ".", "start", ",", "self", ".", "stop", "...
convert from arange to linspace
[ "convert", "from", "arange", "to", "linspace" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dependencies/nparray/nparray.py#L382-L387
train
phoebe-project/phoebe2
phoebe/dependencies/nparray/nparray.py
Linspace.to_arange
def to_arange(self): """ convert from linspace to arange """ arr, step = np.linspace(self.start, self.stop, self.num, self.endpoint, retstep=True) return Arange(self.start, self.stop+step, step)
python
def to_arange(self): """ convert from linspace to arange """ arr, step = np.linspace(self.start, self.stop, self.num, self.endpoint, retstep=True) return Arange(self.start, self.stop+step, step)
[ "def", "to_arange", "(", "self", ")", ":", "arr", ",", "step", "=", "np", ".", "linspace", "(", "self", ".", "start", ",", "self", ".", "stop", ",", "self", ".", "num", ",", "self", ".", "endpoint", ",", "retstep", "=", "True", ")", "return", "Ar...
convert from linspace to arange
[ "convert", "from", "linspace", "to", "arange" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dependencies/nparray/nparray.py#L427-L432
train
phoebe-project/phoebe2
phoebe/dependencies/nparray/nparray.py
Full.to_linspace
def to_linspace(self): """ convert from full to linspace """ if hasattr(self.shape, '__len__'): raise NotImplementedError("can only convert flat Full arrays to linspace") return Linspace(self.fill_value, self.fill_value, self.shape)
python
def to_linspace(self): """ convert from full to linspace """ if hasattr(self.shape, '__len__'): raise NotImplementedError("can only convert flat Full arrays to linspace") return Linspace(self.fill_value, self.fill_value, self.shape)
[ "def", "to_linspace", "(", "self", ")", ":", "if", "hasattr", "(", "self", ".", "shape", ",", "'__len__'", ")", ":", "raise", "NotImplementedError", "(", "\"can only convert flat Full arrays to linspace\"", ")", "return", "Linspace", "(", "self", ".", "fill_value"...
convert from full to linspace
[ "convert", "from", "full", "to", "linspace" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dependencies/nparray/nparray.py#L525-L531
train
phoebe-project/phoebe2
phoebe/backend/etvs.py
crossing
def crossing(b, component, time, dynamics_method='keplerian', ltte=True, tol=1e-4, maxiter=1000): """ tol in days """ def projected_separation_sq(time, b, dynamics_method, cind1, cind2, ltte=True): """ """ #print "*** projected_separation_sq", time, dynamics_method, cind1, cind...
python
def crossing(b, component, time, dynamics_method='keplerian', ltte=True, tol=1e-4, maxiter=1000): """ tol in days """ def projected_separation_sq(time, b, dynamics_method, cind1, cind2, ltte=True): """ """ #print "*** projected_separation_sq", time, dynamics_method, cind1, cind...
[ "def", "crossing", "(", "b", ",", "component", ",", "time", ",", "dynamics_method", "=", "'keplerian'", ",", "ltte", "=", "True", ",", "tol", "=", "1e-4", ",", "maxiter", "=", "1000", ")", ":", "def", "projected_separation_sq", "(", "time", ",", "b", "...
tol in days
[ "tol", "in", "days" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/etvs.py#L15-L53
train
phoebe-project/phoebe2
phoebe/constraints/builtin.py
_delta_t_supconj_perpass
def _delta_t_supconj_perpass(period, ecc, per0): """ time shift between superior conjuction and periastron passage """ ups_sc = np.pi/2-per0 E_sc = 2*np.arctan( np.sqrt((1-ecc)/(1+ecc)) * np.tan(ups_sc/2) ) M_sc = E_sc - ecc*np.sin(E_sc) return period*(M_sc/2./np.pi)
python
def _delta_t_supconj_perpass(period, ecc, per0): """ time shift between superior conjuction and periastron passage """ ups_sc = np.pi/2-per0 E_sc = 2*np.arctan( np.sqrt((1-ecc)/(1+ecc)) * np.tan(ups_sc/2) ) M_sc = E_sc - ecc*np.sin(E_sc) return period*(M_sc/2./np.pi)
[ "def", "_delta_t_supconj_perpass", "(", "period", ",", "ecc", ",", "per0", ")", ":", "ups_sc", "=", "np", ".", "pi", "/", "2", "-", "per0", "E_sc", "=", "2", "*", "np", ".", "arctan", "(", "np", ".", "sqrt", "(", "(", "1", "-", "ecc", ")", "/",...
time shift between superior conjuction and periastron passage
[ "time", "shift", "between", "superior", "conjuction", "and", "periastron", "passage" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/constraints/builtin.py#L106-L113
train
phoebe-project/phoebe2
phoebe/dependencies/nparray/__init__.py
from_dict
def from_dict(d): """ load an nparray object from a dictionary @parameter str d: dictionary representing the nparray object """ if isinstance(d, str): return from_json(d) if not isinstance(d, dict): raise TypeError("argument must be of type dict") if 'nparray' not in d.keys...
python
def from_dict(d): """ load an nparray object from a dictionary @parameter str d: dictionary representing the nparray object """ if isinstance(d, str): return from_json(d) if not isinstance(d, dict): raise TypeError("argument must be of type dict") if 'nparray' not in d.keys...
[ "def", "from_dict", "(", "d", ")", ":", "if", "isinstance", "(", "d", ",", "str", ")", ":", "return", "from_json", "(", "d", ")", "if", "not", "isinstance", "(", "d", ",", "dict", ")", ":", "raise", "TypeError", "(", "\"argument must be of type dict\"", ...
load an nparray object from a dictionary @parameter str d: dictionary representing the nparray object
[ "load", "an", "nparray", "object", "from", "a", "dictionary" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dependencies/nparray/__init__.py#L106-L121
train
phoebe-project/phoebe2
phoebe/dependencies/nparray/__init__.py
from_json
def from_json(j): """ load an nparray object from a json-formatted string @parameter str j: json-formatted string """ if isinstance(j, dict): return from_dict(j) if not (isinstance(j, str) or isinstance(j, unicode)): raise TypeError("argument must be of type str") return f...
python
def from_json(j): """ load an nparray object from a json-formatted string @parameter str j: json-formatted string """ if isinstance(j, dict): return from_dict(j) if not (isinstance(j, str) or isinstance(j, unicode)): raise TypeError("argument must be of type str") return f...
[ "def", "from_json", "(", "j", ")", ":", "if", "isinstance", "(", "j", ",", "dict", ")", ":", "return", "from_dict", "(", "j", ")", "if", "not", "(", "isinstance", "(", "j", ",", "str", ")", "or", "isinstance", "(", "j", ",", "unicode", ")", ")", ...
load an nparray object from a json-formatted string @parameter str j: json-formatted string
[ "load", "an", "nparray", "object", "from", "a", "json", "-", "formatted", "string" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dependencies/nparray/__init__.py#L123-L135
train
phoebe-project/phoebe2
phoebe/dependencies/nparray/__init__.py
from_file
def from_file(filename): """ load an nparray object from a json filename @parameter str filename: path to the file """ f = open(filename, 'r') j = json.load(f) f.close() return from_dict(j)
python
def from_file(filename): """ load an nparray object from a json filename @parameter str filename: path to the file """ f = open(filename, 'r') j = json.load(f) f.close() return from_dict(j)
[ "def", "from_file", "(", "filename", ")", ":", "f", "=", "open", "(", "filename", ",", "'r'", ")", "j", "=", "json", ".", "load", "(", "f", ")", "f", ".", "close", "(", ")", "return", "from_dict", "(", "j", ")" ]
load an nparray object from a json filename @parameter str filename: path to the file
[ "load", "an", "nparray", "object", "from", "a", "json", "filename" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dependencies/nparray/__init__.py#L137-L147
train
phoebe-project/phoebe2
phoebe/dependencies/nparray/__init__.py
monkeypatch
def monkeypatch(): """ monkeypath built-in numpy functions to call those provided by nparray instead. """ np.array = array np.arange = arange np.linspace = linspace np.logspace = logspace np.geomspace = geomspace np.full = full np.full_like = full_like np.zeros = zeros np...
python
def monkeypatch(): """ monkeypath built-in numpy functions to call those provided by nparray instead. """ np.array = array np.arange = arange np.linspace = linspace np.logspace = logspace np.geomspace = geomspace np.full = full np.full_like = full_like np.zeros = zeros np...
[ "def", "monkeypatch", "(", ")", ":", "np", ".", "array", "=", "array", "np", ".", "arange", "=", "arange", "np", ".", "linspace", "=", "linspace", "np", ".", "logspace", "=", "logspace", "np", ".", "geomspace", "=", "geomspace", "np", ".", "full", "=...
monkeypath built-in numpy functions to call those provided by nparray instead.
[ "monkeypath", "built", "-", "in", "numpy", "functions", "to", "call", "those", "provided", "by", "nparray", "instead", "." ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dependencies/nparray/__init__.py#L149-L164
train
phoebe-project/phoebe2
phoebe/atmospheres/passbands.py
install_passband
def install_passband(fname, local=True): """ Install a passband from a local file. This simply copies the file into the install path - but beware that clearing the installation will clear the passband as well If local=False, you must have permissions to access the installation directory """ ...
python
def install_passband(fname, local=True): """ Install a passband from a local file. This simply copies the file into the install path - but beware that clearing the installation will clear the passband as well If local=False, you must have permissions to access the installation directory """ ...
[ "def", "install_passband", "(", "fname", ",", "local", "=", "True", ")", ":", "pbdir", "=", "_pbdir_local", "if", "local", "else", "_pbdir_global", "shutil", ".", "copy", "(", "fname", ",", "pbdir", ")", "init_passband", "(", "os", ".", "path", ".", "joi...
Install a passband from a local file. This simply copies the file into the install path - but beware that clearing the installation will clear the passband as well If local=False, you must have permissions to access the installation directory
[ "Install", "a", "passband", "from", "a", "local", "file", ".", "This", "simply", "copies", "the", "file", "into", "the", "install", "path", "-", "but", "beware", "that", "clearing", "the", "installation", "will", "clear", "the", "passband", "as", "well" ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/atmospheres/passbands.py#L1161-L1171
train
phoebe-project/phoebe2
phoebe/atmospheres/passbands.py
download_passband
def download_passband(passband, local=True): """ Download and install a given passband from the repository. If local=False, you must have permission to access the installation directory """ if passband not in list_online_passbands(): raise ValueError("passband '{}' not available".format(pas...
python
def download_passband(passband, local=True): """ Download and install a given passband from the repository. If local=False, you must have permission to access the installation directory """ if passband not in list_online_passbands(): raise ValueError("passband '{}' not available".format(pas...
[ "def", "download_passband", "(", "passband", ",", "local", "=", "True", ")", ":", "if", "passband", "not", "in", "list_online_passbands", "(", ")", ":", "raise", "ValueError", "(", "\"passband '{}' not available\"", ".", "format", "(", "passband", ")", ")", "p...
Download and install a given passband from the repository. If local=False, you must have permission to access the installation directory
[ "Download", "and", "install", "a", "given", "passband", "from", "the", "repository", "." ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/atmospheres/passbands.py#L1186-L1206
train
phoebe-project/phoebe2
phoebe/atmospheres/passbands.py
Passband._planck_deriv
def _planck_deriv(self, lam, Teff): """ Computes the derivative of the monochromatic blackbody intensity using the Planck function. @lam: wavelength in m @Teff: effective temperature in K Returns: the derivative of monochromatic blackbody intensity """ ...
python
def _planck_deriv(self, lam, Teff): """ Computes the derivative of the monochromatic blackbody intensity using the Planck function. @lam: wavelength in m @Teff: effective temperature in K Returns: the derivative of monochromatic blackbody intensity """ ...
[ "def", "_planck_deriv", "(", "self", ",", "lam", ",", "Teff", ")", ":", "expterm", "=", "np", ".", "exp", "(", "self", ".", "h", "*", "self", ".", "c", "/", "lam", "/", "self", ".", "k", "/", "Teff", ")", "return", "2", "*", "self", ".", "h",...
Computes the derivative of the monochromatic blackbody intensity using the Planck function. @lam: wavelength in m @Teff: effective temperature in K Returns: the derivative of monochromatic blackbody intensity
[ "Computes", "the", "derivative", "of", "the", "monochromatic", "blackbody", "intensity", "using", "the", "Planck", "function", "." ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/atmospheres/passbands.py#L326-L338
train
phoebe-project/phoebe2
phoebe/atmospheres/passbands.py
Passband.interpolate_ck2004_ldcoeffs
def interpolate_ck2004_ldcoeffs(self, Teff=5772., logg=4.43, abun=0.0, atm='ck2004', ld_func='power', photon_weighted=False): """ Interpolate the passband-stored table of LD model coefficients. """ if 'ck2004_ld' not in self.content: print('Castelli & Kurucz (2004) limb dark...
python
def interpolate_ck2004_ldcoeffs(self, Teff=5772., logg=4.43, abun=0.0, atm='ck2004', ld_func='power', photon_weighted=False): """ Interpolate the passband-stored table of LD model coefficients. """ if 'ck2004_ld' not in self.content: print('Castelli & Kurucz (2004) limb dark...
[ "def", "interpolate_ck2004_ldcoeffs", "(", "self", ",", "Teff", "=", "5772.", ",", "logg", "=", "4.43", ",", "abun", "=", "0.0", ",", "atm", "=", "'ck2004'", ",", "ld_func", "=", "'power'", ",", "photon_weighted", "=", "False", ")", ":", "if", "'ck2004_l...
Interpolate the passband-stored table of LD model coefficients.
[ "Interpolate", "the", "passband", "-", "stored", "table", "of", "LD", "model", "coefficients", "." ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/atmospheres/passbands.py#L793-L828
train
phoebe-project/phoebe2
phoebe/atmospheres/passbands.py
Passband.import_wd_atmcof
def import_wd_atmcof(self, plfile, atmfile, wdidx, Nabun=19, Nlogg=11, Npb=25, Nints=4): """ Parses WD's atmcof and reads in all Legendre polynomials for the given passband. @plfile: path and filename of atmcofplanck.dat @atmfile: path and filename of atmcof.dat @wdidx: ...
python
def import_wd_atmcof(self, plfile, atmfile, wdidx, Nabun=19, Nlogg=11, Npb=25, Nints=4): """ Parses WD's atmcof and reads in all Legendre polynomials for the given passband. @plfile: path and filename of atmcofplanck.dat @atmfile: path and filename of atmcof.dat @wdidx: ...
[ "def", "import_wd_atmcof", "(", "self", ",", "plfile", ",", "atmfile", ",", "wdidx", ",", "Nabun", "=", "19", ",", "Nlogg", "=", "11", ",", "Npb", "=", "25", ",", "Nints", "=", "4", ")", ":", "self", ".", "wd_data", "=", "libphoebe", ".", "wd_readd...
Parses WD's atmcof and reads in all Legendre polynomials for the given passband. @plfile: path and filename of atmcofplanck.dat @atmfile: path and filename of atmcof.dat @wdidx: WD index of the passed passband. This can be automated but it's not a high priority. ...
[ "Parses", "WD", "s", "atmcof", "and", "reads", "in", "all", "Legendre", "polynomials", "for", "the", "given", "passband", "." ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/atmospheres/passbands.py#L830-L869
train
phoebe-project/phoebe2
phoebe/atmospheres/passbands.py
Passband._log10_Inorm_extern_planckint
def _log10_Inorm_extern_planckint(self, Teff): """ Internal function to compute normal passband intensities using the external WD machinery that employs blackbody approximation. @Teff: effective temperature in K Returns: log10(Inorm) """ log10_Inorm = libphoebe...
python
def _log10_Inorm_extern_planckint(self, Teff): """ Internal function to compute normal passband intensities using the external WD machinery that employs blackbody approximation. @Teff: effective temperature in K Returns: log10(Inorm) """ log10_Inorm = libphoebe...
[ "def", "_log10_Inorm_extern_planckint", "(", "self", ",", "Teff", ")", ":", "log10_Inorm", "=", "libphoebe", ".", "wd_planckint", "(", "Teff", ",", "self", ".", "extern_wd_idx", ",", "self", ".", "wd_data", "[", "\"planck_table\"", "]", ")", "return", "log10_I...
Internal function to compute normal passband intensities using the external WD machinery that employs blackbody approximation. @Teff: effective temperature in K Returns: log10(Inorm)
[ "Internal", "function", "to", "compute", "normal", "passband", "intensities", "using", "the", "external", "WD", "machinery", "that", "employs", "blackbody", "approximation", "." ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/atmospheres/passbands.py#L871-L883
train
phoebe-project/phoebe2
phoebe/atmospheres/passbands.py
Passband._log10_Inorm_extern_atmx
def _log10_Inorm_extern_atmx(self, Teff, logg, abun): """ Internal function to compute normal passband intensities using the external WD machinery that employs model atmospheres and ramps. @Teff: effective temperature in K @logg: surface gravity in cgs @abun: met...
python
def _log10_Inorm_extern_atmx(self, Teff, logg, abun): """ Internal function to compute normal passband intensities using the external WD machinery that employs model atmospheres and ramps. @Teff: effective temperature in K @logg: surface gravity in cgs @abun: met...
[ "def", "_log10_Inorm_extern_atmx", "(", "self", ",", "Teff", ",", "logg", ",", "abun", ")", ":", "log10_Inorm", "=", "libphoebe", ".", "wd_atmint", "(", "Teff", ",", "logg", ",", "abun", ",", "self", ".", "extern_wd_idx", ",", "self", ".", "wd_data", "["...
Internal function to compute normal passband intensities using the external WD machinery that employs model atmospheres and ramps. @Teff: effective temperature in K @logg: surface gravity in cgs @abun: metallicity in dex, Solar=0.0 Returns: log10(Inorm)
[ "Internal", "function", "to", "compute", "normal", "passband", "intensities", "using", "the", "external", "WD", "machinery", "that", "employs", "model", "atmospheres", "and", "ramps", "." ]
e64b8be683977064e2d55dd1b3ac400f64c3e379
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/atmospheres/passbands.py#L885-L900
train
driftx/Telephus
telephus/protocol.py
ManagedCassandraClientFactory.set_keyspace
def set_keyspace(self, keyspace): """ switch all connections to another keyspace """ self.keyspace = keyspace dfrds = [] for p in self._protos: dfrds.append(p.submitRequest(ManagedThriftRequest( 'set_keyspace', keyspace))) return defer.gatherResults(df...
python
def set_keyspace(self, keyspace): """ switch all connections to another keyspace """ self.keyspace = keyspace dfrds = [] for p in self._protos: dfrds.append(p.submitRequest(ManagedThriftRequest( 'set_keyspace', keyspace))) return defer.gatherResults(df...
[ "def", "set_keyspace", "(", "self", ",", "keyspace", ")", ":", "self", ".", "keyspace", "=", "keyspace", "dfrds", "=", "[", "]", "for", "p", "in", "self", ".", "_protos", ":", "dfrds", ".", "append", "(", "p", ".", "submitRequest", "(", "ManagedThriftR...
switch all connections to another keyspace
[ "switch", "all", "connections", "to", "another", "keyspace" ]
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/protocol.py#L195-L202
train
driftx/Telephus
telephus/protocol.py
ManagedCassandraClientFactory.login
def login(self, credentials): """ authenticate all connections """ dfrds = [] for p in self._protos: dfrds.append(p.submitRequest(ManagedThriftRequest('login', ttypes.AuthenticationRequest(credentials=credentials)))) return defer.gatherResults(dfrds)
python
def login(self, credentials): """ authenticate all connections """ dfrds = [] for p in self._protos: dfrds.append(p.submitRequest(ManagedThriftRequest('login', ttypes.AuthenticationRequest(credentials=credentials)))) return defer.gatherResults(dfrds)
[ "def", "login", "(", "self", ",", "credentials", ")", ":", "dfrds", "=", "[", "]", "for", "p", "in", "self", ".", "_protos", ":", "dfrds", ".", "append", "(", "p", ".", "submitRequest", "(", "ManagedThriftRequest", "(", "'login'", ",", "ttypes", ".", ...
authenticate all connections
[ "authenticate", "all", "connections" ]
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/protocol.py#L204-L210
train
driftx/Telephus
telephus/pool.py
CassandraPoolReconnectorFactory.retry
def retry(self): """ Retry this factory's connection. It is assumed that a previous connection was attempted and failed- either before or after a successful connection. """ if self.connector is None: raise ValueError("No connector to retry") if self.s...
python
def retry(self): """ Retry this factory's connection. It is assumed that a previous connection was attempted and failed- either before or after a successful connection. """ if self.connector is None: raise ValueError("No connector to retry") if self.s...
[ "def", "retry", "(", "self", ")", ":", "if", "self", ".", "connector", "is", "None", ":", "raise", "ValueError", "(", "\"No connector to retry\"", ")", "if", "self", ".", "service", "is", "None", ":", "return", "self", ".", "connector", ".", "connect", "...
Retry this factory's connection. It is assumed that a previous connection was attempted and failed- either before or after a successful connection.
[ "Retry", "this", "factory", "s", "connection", ".", "It", "is", "assumed", "that", "a", "previous", "connection", "was", "attempted", "and", "failed", "-", "either", "before", "or", "after", "a", "successful", "connection", "." ]
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/pool.py#L244-L255
train
driftx/Telephus
telephus/pool.py
CassandraPoolReconnectorFactory.prep_connection
def prep_connection(self, creds=None, keyspace=None, node_auto_discovery=True): """ Do login and set_keyspace tasks as necessary, and also check this node's idea of the Cassandra ring. Expects that our connection is alive. Return a Deferred that will fire with the ring informati...
python
def prep_connection(self, creds=None, keyspace=None, node_auto_discovery=True): """ Do login and set_keyspace tasks as necessary, and also check this node's idea of the Cassandra ring. Expects that our connection is alive. Return a Deferred that will fire with the ring informati...
[ "def", "prep_connection", "(", "self", ",", "creds", "=", "None", ",", "keyspace", "=", "None", ",", "node_auto_discovery", "=", "True", ")", ":", "d", "=", "defer", ".", "succeed", "(", "None", ")", "if", "creds", "is", "not", "None", ":", "d", ".",...
Do login and set_keyspace tasks as necessary, and also check this node's idea of the Cassandra ring. Expects that our connection is alive. Return a Deferred that will fire with the ring information, or be errbacked if something goes wrong.
[ "Do", "login", "and", "set_keyspace", "tasks", "as", "necessary", "and", "also", "check", "this", "node", "s", "idea", "of", "the", "Cassandra", "ring", ".", "Expects", "that", "our", "connection", "is", "alive", "." ]
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/pool.py#L257-L276
train
driftx/Telephus
telephus/pool.py
CassandraPoolReconnectorFactory.my_pick_non_system_keyspace
def my_pick_non_system_keyspace(self): """ Find a keyspace in the cluster which is not 'system', for the purpose of getting a valid ring view. Can't use 'system' or null. """ d = self.my_describe_keyspaces() def pick_non_system(klist): for k in klist: ...
python
def my_pick_non_system_keyspace(self): """ Find a keyspace in the cluster which is not 'system', for the purpose of getting a valid ring view. Can't use 'system' or null. """ d = self.my_describe_keyspaces() def pick_non_system(klist): for k in klist: ...
[ "def", "my_pick_non_system_keyspace", "(", "self", ")", ":", "d", "=", "self", ".", "my_describe_keyspaces", "(", ")", "def", "pick_non_system", "(", "klist", ")", ":", "for", "k", "in", "klist", ":", "if", "k", ".", "name", "not", "in", "SYSTEM_KEYSPACES"...
Find a keyspace in the cluster which is not 'system', for the purpose of getting a valid ring view. Can't use 'system' or null.
[ "Find", "a", "keyspace", "in", "the", "cluster", "which", "is", "not", "system", "for", "the", "purpose", "of", "getting", "a", "valid", "ring", "view", ".", "Can", "t", "use", "system", "or", "null", "." ]
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/pool.py#L326-L343
train
driftx/Telephus
telephus/pool.py
CassandraPoolReconnectorFactory.finish_and_die
def finish_and_die(self): """ If there is a request pending, let it finish and be handled, then disconnect and die. If not, cancel any pending queue requests and just die. """ self.logstate('finish_and_die') self.stop_working_on_queue() if self.jobphase !=...
python
def finish_and_die(self): """ If there is a request pending, let it finish and be handled, then disconnect and die. If not, cancel any pending queue requests and just die. """ self.logstate('finish_and_die') self.stop_working_on_queue() if self.jobphase !=...
[ "def", "finish_and_die", "(", "self", ")", ":", "self", ".", "logstate", "(", "'finish_and_die'", ")", "self", ".", "stop_working_on_queue", "(", ")", "if", "self", ".", "jobphase", "!=", "'pending_request'", ":", "self", ".", "stopFactory", "(", ")" ]
If there is a request pending, let it finish and be handled, then disconnect and die. If not, cancel any pending queue requests and just die.
[ "If", "there", "is", "a", "request", "pending", "let", "it", "finish", "and", "be", "handled", "then", "disconnect", "and", "die", ".", "If", "not", "cancel", "any", "pending", "queue", "requests", "and", "just", "die", "." ]
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/pool.py#L449-L458
train
driftx/Telephus
telephus/pool.py
CassandraClusterPool.add_connection_score
def add_connection_score(self, node): """ Return a numeric value that determines this node's score for adding a new connection. A negative value indicates that no connections should be made to this node for at least that number of seconds. A value of -inf indicates no connections...
python
def add_connection_score(self, node): """ Return a numeric value that determines this node's score for adding a new connection. A negative value indicates that no connections should be made to this node for at least that number of seconds. A value of -inf indicates no connections...
[ "def", "add_connection_score", "(", "self", ",", "node", ")", ":", "conntime", "=", "node", ".", "seconds_until_connect_ok", "(", ")", "if", "conntime", ">", "0", ":", "self", ".", "log", "(", "\"not considering %r for new connection; has %r left on \"", "\"connect ...
Return a numeric value that determines this node's score for adding a new connection. A negative value indicates that no connections should be made to this node for at least that number of seconds. A value of -inf indicates no connections should be made to this node for the foreseeable f...
[ "Return", "a", "numeric", "value", "that", "determines", "this", "node", "s", "score", "for", "adding", "a", "new", "connection", ".", "A", "negative", "value", "indicates", "that", "no", "connections", "should", "be", "made", "to", "this", "node", "for", ...
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/pool.py#L893-L916
train
driftx/Telephus
telephus/pool.py
CassandraClusterPool.resubmit
def resubmit(self, req, keyspace, req_d, retries): """ Push this request to the front of the line, just to be a jerk. """ self.log('resubmitting %s request' % (req.method,)) self.pushRequest_really(req, keyspace, req_d, retries) try: self.request_queue.pending...
python
def resubmit(self, req, keyspace, req_d, retries): """ Push this request to the front of the line, just to be a jerk. """ self.log('resubmitting %s request' % (req.method,)) self.pushRequest_really(req, keyspace, req_d, retries) try: self.request_queue.pending...
[ "def", "resubmit", "(", "self", ",", "req", ",", "keyspace", ",", "req_d", ",", "retries", ")", ":", "self", ".", "log", "(", "'resubmitting %s request'", "%", "(", "req", ".", "method", ",", ")", ")", "self", ".", "pushRequest_really", "(", "req", ","...
Push this request to the front of the line, just to be a jerk.
[ "Push", "this", "request", "to", "the", "front", "of", "the", "line", "just", "to", "be", "a", "jerk", "." ]
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/pool.py#L1154-L1166
train
driftx/Telephus
telephus/pool.py
CassandraClusterPool.set_keyspace
def set_keyspace(self, keyspace): """ Change the keyspace which will be used for subsequent requests to this CassandraClusterPool, and return a Deferred that will fire once it can be verified that connections can successfully use that keyspace. If something goes wrong trying to ...
python
def set_keyspace(self, keyspace): """ Change the keyspace which will be used for subsequent requests to this CassandraClusterPool, and return a Deferred that will fire once it can be verified that connections can successfully use that keyspace. If something goes wrong trying to ...
[ "def", "set_keyspace", "(", "self", ",", "keyspace", ")", ":", "d", "=", "self", ".", "pushRequest", "(", "ManagedThriftRequest", "(", "'set_keyspace'", ",", "keyspace", ")", ")", "def", "store_keyspace", "(", "_", ")", ":", "self", ".", "keyspace", "=", ...
Change the keyspace which will be used for subsequent requests to this CassandraClusterPool, and return a Deferred that will fire once it can be verified that connections can successfully use that keyspace. If something goes wrong trying to change a connection to that keyspace, the Defe...
[ "Change", "the", "keyspace", "which", "will", "be", "used", "for", "subsequent", "requests", "to", "this", "CassandraClusterPool", "and", "return", "a", "Deferred", "that", "will", "fire", "once", "it", "can", "be", "verified", "that", "connections", "can", "s...
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/pool.py#L1168-L1196
train
driftx/Telephus
telephus/pool.py
CassandraClusterPool.keyspaceConnection
def keyspaceConnection(self, keyspace, consistency=ConsistencyLevel.ONE): """ Return a CassandraClient instance which uses this CassandraClusterPool by way of a CassandraKeyspaceConnection, so that all requests made through it are guaranteed to go to the given keyspace, no matter what ...
python
def keyspaceConnection(self, keyspace, consistency=ConsistencyLevel.ONE): """ Return a CassandraClient instance which uses this CassandraClusterPool by way of a CassandraKeyspaceConnection, so that all requests made through it are guaranteed to go to the given keyspace, no matter what ...
[ "def", "keyspaceConnection", "(", "self", ",", "keyspace", ",", "consistency", "=", "ConsistencyLevel", ".", "ONE", ")", ":", "conn", "=", "CassandraKeyspaceConnection", "(", "self", ",", "keyspace", ")", "return", "CassandraClient", "(", "conn", ",", "consisten...
Return a CassandraClient instance which uses this CassandraClusterPool by way of a CassandraKeyspaceConnection, so that all requests made through it are guaranteed to go to the given keyspace, no matter what other consumers of this pool may do.
[ "Return", "a", "CassandraClient", "instance", "which", "uses", "this", "CassandraClusterPool", "by", "way", "of", "a", "CassandraKeyspaceConnection", "so", "that", "all", "requests", "made", "through", "it", "are", "guaranteed", "to", "go", "to", "the", "given", ...
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/pool.py#L1213-L1221
train
pre-commit/pre-commit-mirror-maker
pre_commit_mirror_maker/main.py
split_by_commas
def split_by_commas(maybe_s: str) -> Tuple[str, ...]: """Split a string by commas, but allow escaped commas. - If maybe_s is falsey, returns an empty tuple - Ignore backslashed commas """ if not maybe_s: return () parts: List[str] = [] split_by_backslash = maybe_s.split(r'\,') fo...
python
def split_by_commas(maybe_s: str) -> Tuple[str, ...]: """Split a string by commas, but allow escaped commas. - If maybe_s is falsey, returns an empty tuple - Ignore backslashed commas """ if not maybe_s: return () parts: List[str] = [] split_by_backslash = maybe_s.split(r'\,') fo...
[ "def", "split_by_commas", "(", "maybe_s", ":", "str", ")", "->", "Tuple", "[", "str", ",", "...", "]", ":", "if", "not", "maybe_s", ":", "return", "(", ")", "parts", ":", "List", "[", "str", "]", "=", "[", "]", "split_by_backslash", "=", "maybe_s", ...
Split a string by commas, but allow escaped commas. - If maybe_s is falsey, returns an empty tuple - Ignore backslashed commas
[ "Split", "a", "string", "by", "commas", "but", "allow", "escaped", "commas", ".", "-", "If", "maybe_s", "is", "falsey", "returns", "an", "empty", "tuple", "-", "Ignore", "backslashed", "commas" ]
8bafa3b87e67d291d5a747f0137b921a170a1723
https://github.com/pre-commit/pre-commit-mirror-maker/blob/8bafa3b87e67d291d5a747f0137b921a170a1723/pre_commit_mirror_maker/main.py#L12-L28
train
driftx/Telephus
telephus/cassandra/Cassandra.py
Client.multiget_slice
def multiget_slice(self, keys, column_parent, predicate, consistency_level): """ Performs a get_slice for column_parent and predicate for the given keys in parallel. Parameters: - keys - column_parent - predicate - consistency_level """ self._seqid += 1 d = self._reqs[self._...
python
def multiget_slice(self, keys, column_parent, predicate, consistency_level): """ Performs a get_slice for column_parent and predicate for the given keys in parallel. Parameters: - keys - column_parent - predicate - consistency_level """ self._seqid += 1 d = self._reqs[self._...
[ "def", "multiget_slice", "(", "self", ",", "keys", ",", "column_parent", ",", "predicate", ",", "consistency_level", ")", ":", "self", ".", "_seqid", "+=", "1", "d", "=", "self", ".", "_reqs", "[", "self", ".", "_seqid", "]", "=", "defer", ".", "Deferr...
Performs a get_slice for column_parent and predicate for the given keys in parallel. Parameters: - keys - column_parent - predicate - consistency_level
[ "Performs", "a", "get_slice", "for", "column_parent", "and", "predicate", "for", "the", "given", "keys", "in", "parallel", "." ]
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/cassandra/Cassandra.py#L676-L689
train
driftx/Telephus
telephus/cassandra/Cassandra.py
Client.get_range_slices
def get_range_slices(self, column_parent, predicate, range, consistency_level): """ returns a subset of columns for a contiguous range of keys. Parameters: - column_parent - predicate - range - consistency_level """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferr...
python
def get_range_slices(self, column_parent, predicate, range, consistency_level): """ returns a subset of columns for a contiguous range of keys. Parameters: - column_parent - predicate - range - consistency_level """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferr...
[ "def", "get_range_slices", "(", "self", ",", "column_parent", ",", "predicate", ",", "range", ",", "consistency_level", ")", ":", "self", ".", "_seqid", "+=", "1", "d", "=", "self", ".", "_reqs", "[", "self", ".", "_seqid", "]", "=", "defer", ".", "Def...
returns a subset of columns for a contiguous range of keys. Parameters: - column_parent - predicate - range - consistency_level
[ "returns", "a", "subset", "of", "columns", "for", "a", "contiguous", "range", "of", "keys", "." ]
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/cassandra/Cassandra.py#L770-L783
train
driftx/Telephus
telephus/cassandra/Cassandra.py
Client.get_paged_slice
def get_paged_slice(self, column_family, range, start_column, consistency_level): """ returns a range of columns, wrapping to the next rows if necessary to collect max_results. Parameters: - column_family - range - start_column - consistency_level """ self._seqid += 1 d = se...
python
def get_paged_slice(self, column_family, range, start_column, consistency_level): """ returns a range of columns, wrapping to the next rows if necessary to collect max_results. Parameters: - column_family - range - start_column - consistency_level """ self._seqid += 1 d = se...
[ "def", "get_paged_slice", "(", "self", ",", "column_family", ",", "range", ",", "start_column", ",", "consistency_level", ")", ":", "self", ".", "_seqid", "+=", "1", "d", "=", "self", ".", "_reqs", "[", "self", ".", "_seqid", "]", "=", "defer", ".", "D...
returns a range of columns, wrapping to the next rows if necessary to collect max_results. Parameters: - column_family - range - start_column - consistency_level
[ "returns", "a", "range", "of", "columns", "wrapping", "to", "the", "next", "rows", "if", "necessary", "to", "collect", "max_results", "." ]
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/cassandra/Cassandra.py#L817-L830
train
driftx/Telephus
telephus/cassandra/Cassandra.py
Client.insert
def insert(self, key, column_parent, column, consistency_level): """ Insert a Column at the given column_parent.column_family and optional column_parent.super_column. Parameters: - key - column_parent - column - consistency_level """ self._seqid += 1 d = self._reqs[self._seq...
python
def insert(self, key, column_parent, column, consistency_level): """ Insert a Column at the given column_parent.column_family and optional column_parent.super_column. Parameters: - key - column_parent - column - consistency_level """ self._seqid += 1 d = self._reqs[self._seq...
[ "def", "insert", "(", "self", ",", "key", ",", "column_parent", ",", "column", ",", "consistency_level", ")", ":", "self", ".", "_seqid", "+=", "1", "d", "=", "self", ".", "_reqs", "[", "self", ".", "_seqid", "]", "=", "defer", ".", "Deferred", "(", ...
Insert a Column at the given column_parent.column_family and optional column_parent.super_column. Parameters: - key - column_parent - column - consistency_level
[ "Insert", "a", "Column", "at", "the", "given", "column_parent", ".", "column_family", "and", "optional", "column_parent", ".", "super_column", "." ]
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/cassandra/Cassandra.py#L912-L925
train
driftx/Telephus
telephus/cassandra/Cassandra.py
Client.add
def add(self, key, column_parent, column, consistency_level): """ Increment or decrement a counter. Parameters: - key - column_parent - column - consistency_level """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_add(key, column_parent, column...
python
def add(self, key, column_parent, column, consistency_level): """ Increment or decrement a counter. Parameters: - key - column_parent - column - consistency_level """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_add(key, column_parent, column...
[ "def", "add", "(", "self", ",", "key", ",", "column_parent", ",", "column", ",", "consistency_level", ")", ":", "self", ".", "_seqid", "+=", "1", "d", "=", "self", ".", "_reqs", "[", "self", ".", "_seqid", "]", "=", "defer", ".", "Deferred", "(", "...
Increment or decrement a counter. Parameters: - key - column_parent - column - consistency_level
[ "Increment", "or", "decrement", "a", "counter", "." ]
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/cassandra/Cassandra.py#L957-L970
train
driftx/Telephus
telephus/cassandra/Cassandra.py
Client.truncate
def truncate(self, cfname): """ Truncate will mark and entire column family as deleted. From the user's perspective a successful call to truncate will result complete data deletion from cfname. Internally, however, disk space will not be immediatily released, as with all deletes in cassandra, this one ...
python
def truncate(self, cfname): """ Truncate will mark and entire column family as deleted. From the user's perspective a successful call to truncate will result complete data deletion from cfname. Internally, however, disk space will not be immediatily released, as with all deletes in cassandra, this one ...
[ "def", "truncate", "(", "self", ",", "cfname", ")", ":", "self", ".", "_seqid", "+=", "1", "d", "=", "self", ".", "_reqs", "[", "self", ".", "_seqid", "]", "=", "defer", ".", "Deferred", "(", ")", "self", ".", "send_truncate", "(", "cfname", ")", ...
Truncate will mark and entire column family as deleted. From the user's perspective a successful call to truncate will result complete data deletion from cfname. Internally, however, disk space will not be immediatily released, as with all deletes in cassandra, this one only marks the data as deleted. T...
[ "Truncate", "will", "mark", "and", "entire", "column", "family", "as", "deleted", ".", "From", "the", "user", "s", "perspective", "a", "successful", "call", "to", "truncate", "will", "result", "complete", "data", "deletion", "from", "cfname", ".", "Internally"...
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/cassandra/Cassandra.py#L1182-L1197
train
driftx/Telephus
telephus/cassandra/Cassandra.py
Client.describe_schema_versions
def describe_schema_versions(self, ): """ for each schema version present in the cluster, returns a list of nodes at that version. hosts that do not respond will be under the key DatabaseDescriptor.INITIAL_VERSION. the cluster is all on the same version if the size of the map is 1. """ self._seq...
python
def describe_schema_versions(self, ): """ for each schema version present in the cluster, returns a list of nodes at that version. hosts that do not respond will be under the key DatabaseDescriptor.INITIAL_VERSION. the cluster is all on the same version if the size of the map is 1. """ self._seq...
[ "def", "describe_schema_versions", "(", "self", ",", ")", ":", "self", ".", "_seqid", "+=", "1", "d", "=", "self", ".", "_reqs", "[", "self", ".", "_seqid", "]", "=", "defer", ".", "Deferred", "(", ")", "self", ".", "send_describe_schema_versions", "(", ...
for each schema version present in the cluster, returns a list of nodes at that version. hosts that do not respond will be under the key DatabaseDescriptor.INITIAL_VERSION. the cluster is all on the same version if the size of the map is 1.
[ "for", "each", "schema", "version", "present", "in", "the", "cluster", "returns", "a", "list", "of", "nodes", "at", "that", "version", ".", "hosts", "that", "do", "not", "respond", "will", "be", "under", "the", "key", "DatabaseDescriptor", ".", "INITIAL_VERS...
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/cassandra/Cassandra.py#L1226-L1235
train
driftx/Telephus
telephus/cassandra/Cassandra.py
Client.describe_keyspaces
def describe_keyspaces(self, ): """ list the defined keyspaces in this cluster """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_describe_keyspaces() return d
python
def describe_keyspaces(self, ): """ list the defined keyspaces in this cluster """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_describe_keyspaces() return d
[ "def", "describe_keyspaces", "(", "self", ",", ")", ":", "self", ".", "_seqid", "+=", "1", "d", "=", "self", ".", "_reqs", "[", "self", ".", "_seqid", "]", "=", "defer", ".", "Deferred", "(", ")", "self", ".", "send_describe_keyspaces", "(", ")", "re...
list the defined keyspaces in this cluster
[ "list", "the", "defined", "keyspaces", "in", "this", "cluster" ]
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/cassandra/Cassandra.py#L1261-L1268
train
driftx/Telephus
telephus/cassandra/Cassandra.py
Client.describe_cluster_name
def describe_cluster_name(self, ): """ get the cluster name """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_describe_cluster_name() return d
python
def describe_cluster_name(self, ): """ get the cluster name """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_describe_cluster_name() return d
[ "def", "describe_cluster_name", "(", "self", ",", ")", ":", "self", ".", "_seqid", "+=", "1", "d", "=", "self", ".", "_reqs", "[", "self", ".", "_seqid", "]", "=", "defer", ".", "Deferred", "(", ")", "self", ".", "send_describe_cluster_name", "(", ")",...
get the cluster name
[ "get", "the", "cluster", "name" ]
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/cassandra/Cassandra.py#L1294-L1301
train
driftx/Telephus
telephus/cassandra/Cassandra.py
Client.describe_version
def describe_version(self, ): """ get the thrift api version """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_describe_version() return d
python
def describe_version(self, ): """ get the thrift api version """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_describe_version() return d
[ "def", "describe_version", "(", "self", ",", ")", ":", "self", ".", "_seqid", "+=", "1", "d", "=", "self", ".", "_reqs", "[", "self", ".", "_seqid", "]", "=", "defer", ".", "Deferred", "(", ")", "self", ".", "send_describe_version", "(", ")", "return...
get the thrift api version
[ "get", "the", "thrift", "api", "version" ]
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/cassandra/Cassandra.py#L1325-L1332
train
driftx/Telephus
telephus/cassandra/Cassandra.py
Client.describe_partitioner
def describe_partitioner(self, ): """ returns the partitioner used by this cluster """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_describe_partitioner() return d
python
def describe_partitioner(self, ): """ returns the partitioner used by this cluster """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_describe_partitioner() return d
[ "def", "describe_partitioner", "(", "self", ",", ")", ":", "self", ".", "_seqid", "+=", "1", "d", "=", "self", ".", "_reqs", "[", "self", ".", "_seqid", "]", "=", "defer", ".", "Deferred", "(", ")", "self", ".", "send_describe_partitioner", "(", ")", ...
returns the partitioner used by this cluster
[ "returns", "the", "partitioner", "used", "by", "this", "cluster" ]
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/cassandra/Cassandra.py#L1435-L1442
train
driftx/Telephus
telephus/cassandra/Cassandra.py
Client.describe_snitch
def describe_snitch(self, ): """ returns the snitch used by this cluster """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_describe_snitch() return d
python
def describe_snitch(self, ): """ returns the snitch used by this cluster """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_describe_snitch() return d
[ "def", "describe_snitch", "(", "self", ",", ")", ":", "self", ".", "_seqid", "+=", "1", "d", "=", "self", ".", "_reqs", "[", "self", ".", "_seqid", "]", "=", "defer", ".", "Deferred", "(", ")", "self", ".", "send_describe_snitch", "(", ")", "return",...
returns the snitch used by this cluster
[ "returns", "the", "snitch", "used", "by", "this", "cluster" ]
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/cassandra/Cassandra.py#L1466-L1473
train
driftx/Telephus
telephus/cassandra/Cassandra.py
Client.describe_keyspace
def describe_keyspace(self, keyspace): """ describe specified keyspace Parameters: - keyspace """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_describe_keyspace(keyspace) return d
python
def describe_keyspace(self, keyspace): """ describe specified keyspace Parameters: - keyspace """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_describe_keyspace(keyspace) return d
[ "def", "describe_keyspace", "(", "self", ",", "keyspace", ")", ":", "self", ".", "_seqid", "+=", "1", "d", "=", "self", ".", "_reqs", "[", "self", ".", "_seqid", "]", "=", "defer", ".", "Deferred", "(", ")", "self", ".", "send_describe_keyspace", "(", ...
describe specified keyspace Parameters: - keyspace
[ "describe", "specified", "keyspace" ]
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/cassandra/Cassandra.py#L1497-L1507
train
driftx/Telephus
telephus/cassandra/Cassandra.py
Client.trace_next_query
def trace_next_query(self, ): """ Enables tracing for the next query in this connection and returns the UUID for that trace session The next query will be traced idependently of trace probability and the returned UUID can be used to query the trace keyspace """ self._seqid += 1 d = self._reqs[se...
python
def trace_next_query(self, ): """ Enables tracing for the next query in this connection and returns the UUID for that trace session The next query will be traced idependently of trace probability and the returned UUID can be used to query the trace keyspace """ self._seqid += 1 d = self._reqs[se...
[ "def", "trace_next_query", "(", "self", ",", ")", ":", "self", ".", "_seqid", "+=", "1", "d", "=", "self", ".", "_reqs", "[", "self", ".", "_seqid", "]", "=", "defer", ".", "Deferred", "(", ")", "self", ".", "send_trace_next_query", "(", ")", "return...
Enables tracing for the next query in this connection and returns the UUID for that trace session The next query will be traced idependently of trace probability and the returned UUID can be used to query the trace keyspace
[ "Enables", "tracing", "for", "the", "next", "query", "in", "this", "connection", "and", "returns", "the", "UUID", "for", "that", "trace", "session", "The", "next", "query", "will", "be", "traced", "idependently", "of", "trace", "probability", "and", "the", "...
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/cassandra/Cassandra.py#L1583-L1591
train
driftx/Telephus
telephus/cassandra/Cassandra.py
Client.system_add_column_family
def system_add_column_family(self, cf_def): """ adds a column family. returns the new schema id. Parameters: - cf_def """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_system_add_column_family(cf_def) return d
python
def system_add_column_family(self, cf_def): """ adds a column family. returns the new schema id. Parameters: - cf_def """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_system_add_column_family(cf_def) return d
[ "def", "system_add_column_family", "(", "self", ",", "cf_def", ")", ":", "self", ".", "_seqid", "+=", "1", "d", "=", "self", ".", "_reqs", "[", "self", ".", "_seqid", "]", "=", "defer", ".", "Deferred", "(", ")", "self", ".", "send_system_add_column_fami...
adds a column family. returns the new schema id. Parameters: - cf_def
[ "adds", "a", "column", "family", ".", "returns", "the", "new", "schema", "id", "." ]
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/cassandra/Cassandra.py#L1656-L1666
train
driftx/Telephus
telephus/cassandra/Cassandra.py
Client.system_drop_column_family
def system_drop_column_family(self, column_family): """ drops a column family. returns the new schema id. Parameters: - column_family """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_system_drop_column_family(column_family) return d
python
def system_drop_column_family(self, column_family): """ drops a column family. returns the new schema id. Parameters: - column_family """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_system_drop_column_family(column_family) return d
[ "def", "system_drop_column_family", "(", "self", ",", "column_family", ")", ":", "self", ".", "_seqid", "+=", "1", "d", "=", "self", ".", "_reqs", "[", "self", ".", "_seqid", "]", "=", "defer", ".", "Deferred", "(", ")", "self", ".", "send_system_drop_co...
drops a column family. returns the new schema id. Parameters: - column_family
[ "drops", "a", "column", "family", ".", "returns", "the", "new", "schema", "id", "." ]
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/cassandra/Cassandra.py#L1695-L1705
train
driftx/Telephus
telephus/cassandra/Cassandra.py
Client.system_add_keyspace
def system_add_keyspace(self, ks_def): """ adds a keyspace and any column families that are part of it. returns the new schema id. Parameters: - ks_def """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_system_add_keyspace(ks_def) return d
python
def system_add_keyspace(self, ks_def): """ adds a keyspace and any column families that are part of it. returns the new schema id. Parameters: - ks_def """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_system_add_keyspace(ks_def) return d
[ "def", "system_add_keyspace", "(", "self", ",", "ks_def", ")", ":", "self", ".", "_seqid", "+=", "1", "d", "=", "self", ".", "_reqs", "[", "self", ".", "_seqid", "]", "=", "defer", ".", "Deferred", "(", ")", "self", ".", "send_system_add_keyspace", "("...
adds a keyspace and any column families that are part of it. returns the new schema id. Parameters: - ks_def
[ "adds", "a", "keyspace", "and", "any", "column", "families", "that", "are", "part", "of", "it", ".", "returns", "the", "new", "schema", "id", "." ]
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/cassandra/Cassandra.py#L1734-L1744
train
driftx/Telephus
telephus/cassandra/Cassandra.py
Client.system_drop_keyspace
def system_drop_keyspace(self, keyspace): """ drops a keyspace and any column families that are part of it. returns the new schema id. Parameters: - keyspace """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_system_drop_keyspace(keyspace) return d
python
def system_drop_keyspace(self, keyspace): """ drops a keyspace and any column families that are part of it. returns the new schema id. Parameters: - keyspace """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_system_drop_keyspace(keyspace) return d
[ "def", "system_drop_keyspace", "(", "self", ",", "keyspace", ")", ":", "self", ".", "_seqid", "+=", "1", "d", "=", "self", ".", "_reqs", "[", "self", ".", "_seqid", "]", "=", "defer", ".", "Deferred", "(", ")", "self", ".", "send_system_drop_keyspace", ...
drops a keyspace and any column families that are part of it. returns the new schema id. Parameters: - keyspace
[ "drops", "a", "keyspace", "and", "any", "column", "families", "that", "are", "part", "of", "it", ".", "returns", "the", "new", "schema", "id", "." ]
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/cassandra/Cassandra.py#L1773-L1783
train
driftx/Telephus
telephus/cassandra/Cassandra.py
Client.system_update_keyspace
def system_update_keyspace(self, ks_def): """ updates properties of a keyspace. returns the new schema id. Parameters: - ks_def """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_system_update_keyspace(ks_def) return d
python
def system_update_keyspace(self, ks_def): """ updates properties of a keyspace. returns the new schema id. Parameters: - ks_def """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_system_update_keyspace(ks_def) return d
[ "def", "system_update_keyspace", "(", "self", ",", "ks_def", ")", ":", "self", ".", "_seqid", "+=", "1", "d", "=", "self", ".", "_reqs", "[", "self", ".", "_seqid", "]", "=", "defer", ".", "Deferred", "(", ")", "self", ".", "send_system_update_keyspace",...
updates properties of a keyspace. returns the new schema id. Parameters: - ks_def
[ "updates", "properties", "of", "a", "keyspace", ".", "returns", "the", "new", "schema", "id", "." ]
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/cassandra/Cassandra.py#L1812-L1822
train
driftx/Telephus
telephus/cassandra/Cassandra.py
Client.system_update_column_family
def system_update_column_family(self, cf_def): """ updates properties of a column family. returns the new schema id. Parameters: - cf_def """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_system_update_column_family(cf_def) return d
python
def system_update_column_family(self, cf_def): """ updates properties of a column family. returns the new schema id. Parameters: - cf_def """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_system_update_column_family(cf_def) return d
[ "def", "system_update_column_family", "(", "self", ",", "cf_def", ")", ":", "self", ".", "_seqid", "+=", "1", "d", "=", "self", ".", "_reqs", "[", "self", ".", "_seqid", "]", "=", "defer", ".", "Deferred", "(", ")", "self", ".", "send_system_update_colum...
updates properties of a column family. returns the new schema id. Parameters: - cf_def
[ "updates", "properties", "of", "a", "column", "family", ".", "returns", "the", "new", "schema", "id", "." ]
860a03a0fafe71605e1a4316dfdd8d0c29094703
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/cassandra/Cassandra.py#L1851-L1861
train
ttinoco/OPTALG
optalg/lin_solver/__init__.py
new_linsolver
def new_linsolver(name,prop): """ Creates a linear solver. Parameters ---------- name : string prop : string Returns ------- solver : :class:`LinSolver <optalg.lin_solver.LinSolver>` """ if name == 'mumps': return LinSolverMUMPS(prop) elif name == 'supe...
python
def new_linsolver(name,prop): """ Creates a linear solver. Parameters ---------- name : string prop : string Returns ------- solver : :class:`LinSolver <optalg.lin_solver.LinSolver>` """ if name == 'mumps': return LinSolverMUMPS(prop) elif name == 'supe...
[ "def", "new_linsolver", "(", "name", ",", "prop", ")", ":", "if", "name", "==", "'mumps'", ":", "return", "LinSolverMUMPS", "(", "prop", ")", "elif", "name", "==", "'superlu'", ":", "return", "LinSolverSUPERLU", "(", "prop", ")", "elif", "name", "==", "'...
Creates a linear solver. Parameters ---------- name : string prop : string Returns ------- solver : :class:`LinSolver <optalg.lin_solver.LinSolver>`
[ "Creates", "a", "linear", "solver", "." ]
d4f141292f281eea4faa71473258139e7f433001
https://github.com/ttinoco/OPTALG/blob/d4f141292f281eea4faa71473258139e7f433001/optalg/lin_solver/__init__.py#L14-L40
train
ttinoco/OPTALG
optalg/opt_solver/problem.py
cast_problem
def cast_problem(problem): """ Casts problem object with known interface as OptProblem. Parameters ---------- problem : Object """ # Optproblem if isinstance(problem,OptProblem): return problem # Other else: # Type Base if (not hasattr(...
python
def cast_problem(problem): """ Casts problem object with known interface as OptProblem. Parameters ---------- problem : Object """ # Optproblem if isinstance(problem,OptProblem): return problem # Other else: # Type Base if (not hasattr(...
[ "def", "cast_problem", "(", "problem", ")", ":", "if", "isinstance", "(", "problem", ",", "OptProblem", ")", ":", "return", "problem", "else", ":", "if", "(", "not", "hasattr", "(", "problem", ",", "'G'", ")", "or", "(", "problem", ".", "G", ".", "sh...
Casts problem object with known interface as OptProblem. Parameters ---------- problem : Object
[ "Casts", "problem", "object", "with", "known", "interface", "as", "OptProblem", "." ]
d4f141292f281eea4faa71473258139e7f433001
https://github.com/ttinoco/OPTALG/blob/d4f141292f281eea4faa71473258139e7f433001/optalg/opt_solver/problem.py#L185-L211
train
ttinoco/OPTALG
optalg/opt_solver/problem.py
create_problem_from_type_base
def create_problem_from_type_base(problem): """ Creates OptProblem from type-base problem. Parameters ---------- problem : Object """ p = OptProblem() # Init attributes p.phi = problem.phi p.gphi = problem.gphi p.Hphi = problem.Hphi p.A = problem.A p.b = problem....
python
def create_problem_from_type_base(problem): """ Creates OptProblem from type-base problem. Parameters ---------- problem : Object """ p = OptProblem() # Init attributes p.phi = problem.phi p.gphi = problem.gphi p.Hphi = problem.Hphi p.A = problem.A p.b = problem....
[ "def", "create_problem_from_type_base", "(", "problem", ")", ":", "p", "=", "OptProblem", "(", ")", "p", ".", "phi", "=", "problem", ".", "phi", "p", ".", "gphi", "=", "problem", ".", "gphi", "p", ".", "Hphi", "=", "problem", ".", "Hphi", "p", ".", ...
Creates OptProblem from type-base problem. Parameters ---------- problem : Object
[ "Creates", "OptProblem", "from", "type", "-", "base", "problem", "." ]
d4f141292f281eea4faa71473258139e7f433001
https://github.com/ttinoco/OPTALG/blob/d4f141292f281eea4faa71473258139e7f433001/optalg/opt_solver/problem.py#L213-L262
train
ttinoco/OPTALG
optalg/opt_solver/problem.py
OptProblem.recover_dual_variables
def recover_dual_variables(self,lam,nu,mu,pi): """ Recovers dual variables for original problem. Parameters ---------- lam : ndarray nu : ndarray mu : ndarray pi : ndarray """ return lam,nu,mu,pi
python
def recover_dual_variables(self,lam,nu,mu,pi): """ Recovers dual variables for original problem. Parameters ---------- lam : ndarray nu : ndarray mu : ndarray pi : ndarray """ return lam,nu,mu,pi
[ "def", "recover_dual_variables", "(", "self", ",", "lam", ",", "nu", ",", "mu", ",", "pi", ")", ":", "return", "lam", ",", "nu", ",", "mu", ",", "pi" ]
Recovers dual variables for original problem. Parameters ---------- lam : ndarray nu : ndarray mu : ndarray pi : ndarray
[ "Recovers", "dual", "variables", "for", "original", "problem", "." ]
d4f141292f281eea4faa71473258139e7f433001
https://github.com/ttinoco/OPTALG/blob/d4f141292f281eea4faa71473258139e7f433001/optalg/opt_solver/problem.py#L89-L101
train
ttinoco/OPTALG
optalg/opt_solver/problem.py
OptProblem.get_num_primal_variables
def get_num_primal_variables(self): """ Gets number of primal variables. Returns ------- num : int """ if self.x is not None: return self.x.size if self.gphi is not None: return self.gphi.size if self.Hphi is not None: ...
python
def get_num_primal_variables(self): """ Gets number of primal variables. Returns ------- num : int """ if self.x is not None: return self.x.size if self.gphi is not None: return self.gphi.size if self.Hphi is not None: ...
[ "def", "get_num_primal_variables", "(", "self", ")", ":", "if", "self", ".", "x", "is", "not", "None", ":", "return", "self", ".", "x", ".", "size", "if", "self", ".", "gphi", "is", "not", "None", ":", "return", "self", ".", "gphi", ".", "size", "i...
Gets number of primal variables. Returns ------- num : int
[ "Gets", "number", "of", "primal", "variables", "." ]
d4f141292f281eea4faa71473258139e7f433001
https://github.com/ttinoco/OPTALG/blob/d4f141292f281eea4faa71473258139e7f433001/optalg/opt_solver/problem.py#L103-L126
train
ttinoco/OPTALG
optalg/opt_solver/opt_solver.py
OptSolver.get_results
def get_results(self): """ Gets results. Returns ------- results : dictionary """ return {'status': self.status, 'error_msg': self.error_msg, 'k': self.k, 'x': self.x, 'lam': self.lam*self.obj_sca, ...
python
def get_results(self): """ Gets results. Returns ------- results : dictionary """ return {'status': self.status, 'error_msg': self.error_msg, 'k': self.k, 'x': self.x, 'lam': self.lam*self.obj_sca, ...
[ "def", "get_results", "(", "self", ")", ":", "return", "{", "'status'", ":", "self", ".", "status", ",", "'error_msg'", ":", "self", ".", "error_msg", ",", "'k'", ":", "self", ".", "k", ",", "'x'", ":", "self", ".", "x", ",", "'lam'", ":", "self", ...
Gets results. Returns ------- results : dictionary
[ "Gets", "results", "." ]
d4f141292f281eea4faa71473258139e7f433001
https://github.com/ttinoco/OPTALG/blob/d4f141292f281eea4faa71473258139e7f433001/optalg/opt_solver/opt_solver.py#L144-L160
train