partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
UnityFileSystem.has_snap
This method won't count the snaps in "destroying" state! :return: false if no snaps or all snaps are destroying.
storops/unity/resource/filesystem.py
def has_snap(self): """ This method won't count the snaps in "destroying" state! :return: false if no snaps or all snaps are destroying. """ return len(list(filter(lambda s: s.state != SnapStateEnum.DESTROYING, self.snapshots))) > 0
def has_snap(self): """ This method won't count the snaps in "destroying" state! :return: false if no snaps or all snaps are destroying. """ return len(list(filter(lambda s: s.state != SnapStateEnum.DESTROYING, self.snapshots))) > 0
[ "This", "method", "won", "t", "count", "the", "snaps", "in", "destroying", "state!" ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/filesystem.py#L155-L161
[ "def", "has_snap", "(", "self", ")", ":", "return", "len", "(", "list", "(", "filter", "(", "lambda", "s", ":", "s", ".", "state", "!=", "SnapStateEnum", ".", "DESTROYING", ",", "self", ".", "snapshots", ")", ")", ")", ">", "0" ]
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
median2D
Return a 2D average of data_label over a season and label1, label2. Parameters ---------- const: Constellation or Instrument bin#: [min, max, number of bins] label#: string identifies data product for bin# data_label: list-like contains strings identify...
pysat/ssnl/avg.py
def median2D(const, bin1, label1, bin2, label2, data_label, returnData=False): """Return a 2D average of data_label over a season and label1, label2. Parameters ---------- const: Constellation or Instrument bin#: [min, max, number of bins] label#: string i...
def median2D(const, bin1, label1, bin2, label2, data_label, returnData=False): """Return a 2D average of data_label over a season and label1, label2. Parameters ---------- const: Constellation or Instrument bin#: [min, max, number of bins] label#: string i...
[ "Return", "a", "2D", "average", "of", "data_label", "over", "a", "season", "and", "label1", "label2", "." ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/ssnl/avg.py#L14-L98
[ "def", "median2D", "(", "const", ",", "bin1", ",", "label1", ",", "bin2", ",", "label2", ",", "data_label", ",", "returnData", "=", "False", ")", ":", "# const is either an Instrument or a Constellation, and we want to ", "# iterate over it. ", "# If it's a Constellation...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
VNXSystem.get_rsc_list_2
get the list of resource list to collect based on clz list :param rsc_clz_list: the list of classes to collect :return: filtered list of resource list, like [VNXLunList(), VNXDiskList()]
storops/vnx/resource/system.py
def get_rsc_list_2(self, rsc_clz_list=None): """get the list of resource list to collect based on clz list :param rsc_clz_list: the list of classes to collect :return: filtered list of resource list, like [VNXLunList(), VNXDiskList()] """ rsc_list_2 = self._defa...
def get_rsc_list_2(self, rsc_clz_list=None): """get the list of resource list to collect based on clz list :param rsc_clz_list: the list of classes to collect :return: filtered list of resource list, like [VNXLunList(), VNXDiskList()] """ rsc_list_2 = self._defa...
[ "get", "the", "list", "of", "resource", "list", "to", "collect", "based", "on", "clz", "list" ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/resource/system.py#L518-L531
[ "def", "get_rsc_list_2", "(", "self", ",", "rsc_clz_list", "=", "None", ")", ":", "rsc_list_2", "=", "self", ".", "_default_rsc_list_with_perf_stats", "(", ")", "if", "rsc_clz_list", "is", "None", ":", "rsc_clz_list", "=", "ResourceList", ".", "get_rsc_clz_list", ...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
load
cosmic data load routine, called by pysat
pysat/instruments/cosmic_gps.py
def load(cosmicFiles, tag=None, sat_id=None): """ cosmic data load routine, called by pysat """ import netCDF4 num = len(cosmicFiles) # make sure there are files to read if num != 0: # call separate load_files routine, segemented for possible # multiprocessor load, not in...
def load(cosmicFiles, tag=None, sat_id=None): """ cosmic data load routine, called by pysat """ import netCDF4 num = len(cosmicFiles) # make sure there are files to read if num != 0: # call separate load_files routine, segemented for possible # multiprocessor load, not in...
[ "cosmic", "data", "load", "routine", "called", "by", "pysat" ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/cosmic_gps.py#L119-L158
[ "def", "load", "(", "cosmicFiles", ",", "tag", "=", "None", ",", "sat_id", "=", "None", ")", ":", "import", "netCDF4", "num", "=", "len", "(", "cosmicFiles", ")", "# make sure there are files to read", "if", "num", "!=", "0", ":", "# call separate load_files r...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
load_files
Loads a list of COSMIC data files, supplied by user. Returns a list of dicts, a dict for each file.
pysat/instruments/cosmic_gps.py
def load_files(files, tag=None, sat_id=None): '''Loads a list of COSMIC data files, supplied by user. Returns a list of dicts, a dict for each file. ''' output = [None]*len(files) drop_idx = [] for (i,file) in enumerate(files): try: data = netCDF4.Dataset(file) ...
def load_files(files, tag=None, sat_id=None): '''Loads a list of COSMIC data files, supplied by user. Returns a list of dicts, a dict for each file. ''' output = [None]*len(files) drop_idx = [] for (i,file) in enumerate(files): try: data = netCDF4.Dataset(file) ...
[ "Loads", "a", "list", "of", "COSMIC", "data", "files", "supplied", "by", "user", ".", "Returns", "a", "list", "of", "dicts", "a", "dict", "for", "each", "file", "." ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/cosmic_gps.py#L165-L202
[ "def", "load_files", "(", "files", ",", "tag", "=", "None", ",", "sat_id", "=", "None", ")", ":", "output", "=", "[", "None", "]", "*", "len", "(", "files", ")", "drop_idx", "=", "[", "]", "for", "(", "i", ",", "file", ")", "in", "enumerate", "...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
download
Downloads data from Madrigal. The user's names should be provided in field user. John Malkovich should be entered as John+Malkovich The password field should be the user's email address. These parameters are passed to Madrigal when downloading. The affiliation field is set to pysat ...
pysat/instruments/dmsp_ivm.py
def download(date_array, tag, sat_id, data_path=None, user=None, password=None): """Downloads data from Madrigal. The user's names should be provided in field user. John Malkovich should be entered as John+Malkovich The password field should be the user's email address. These parameters ...
def download(date_array, tag, sat_id, data_path=None, user=None, password=None): """Downloads data from Madrigal. The user's names should be provided in field user. John Malkovich should be entered as John+Malkovich The password field should be the user's email address. These parameters ...
[ "Downloads", "data", "from", "Madrigal", ".", "The", "user", "s", "names", "should", "be", "provided", "in", "field", "user", ".", "John", "Malkovich", "should", "be", "entered", "as", "John", "+", "Malkovich", "The", "password", "field", "should", "be", "...
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/dmsp_ivm.py#L135-L175
[ "def", "download", "(", "date_array", ",", "tag", ",", "sat_id", ",", "data_path", "=", "None", ",", "user", "=", "None", ",", "password", "=", "None", ")", ":", "import", "subprocess", "# currently passes things along if no user and password supplied", "# need to d...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
clean
Routine to return DMSP IVM data cleaned to the specified level 'Clean' enforces that both RPA and DM flags are <= 1 'Dusty' <= 2 'Dirty' <= 3 'None' None Routine is called by pysat, and not by the end user directly. Parameters ----------- inst : (pysat.Instrument) Inst...
pysat/instruments/dmsp_ivm.py
def clean(self): """Routine to return DMSP IVM data cleaned to the specified level 'Clean' enforces that both RPA and DM flags are <= 1 'Dusty' <= 2 'Dirty' <= 3 'None' None Routine is called by pysat, and not by the end user directly. Parameters ----------- inst : (pysat....
def clean(self): """Routine to return DMSP IVM data cleaned to the specified level 'Clean' enforces that both RPA and DM flags are <= 1 'Dusty' <= 2 'Dirty' <= 3 'None' None Routine is called by pysat, and not by the end user directly. Parameters ----------- inst : (pysat....
[ "Routine", "to", "return", "DMSP", "IVM", "data", "cleaned", "to", "the", "specified", "level" ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/dmsp_ivm.py#L182-L221
[ "def", "clean", "(", "self", ")", ":", "if", "self", ".", "clean_level", "==", "'clean'", ":", "idx", ",", "=", "np", ".", "where", "(", "(", "self", "[", "'rpa_flag_ut'", "]", "<=", "1", ")", "&", "(", "self", "[", "'idm_flag_ut'", "]", "<=", "1...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
UnityRemoteSystem.create
Configures a remote system for remote replication. :param cls: this class. :param cli: the rest client. :param management_address: the management IP address of the remote system. :param local_username: administrative username of local system. :param local_password: a...
storops/unity/resource/remote_system.py
def create(cls, cli, management_address, local_username=None, local_password=None, remote_username=None, remote_password=None, connection_type=None): """ Configures a remote system for remote replication. :param cls: this class. :param cli: t...
def create(cls, cli, management_address, local_username=None, local_password=None, remote_username=None, remote_password=None, connection_type=None): """ Configures a remote system for remote replication. :param cls: this class. :param cli: t...
[ "Configures", "a", "remote", "system", "for", "remote", "replication", "." ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/remote_system.py#L30-L57
[ "def", "create", "(", "cls", ",", "cli", ",", "management_address", ",", "local_username", "=", "None", ",", "local_password", "=", "None", ",", "remote_username", "=", "None", ",", "remote_password", "=", "None", ",", "connection_type", "=", "None", ")", ":...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
UnityRemoteSystem.modify
Modifies a remote system for remote replication. :param management_address: same as the one in `create` method. :param username: username for accessing the remote system. :param password: password for accessing the remote system. :param connection_type: same as the one in `create` metho...
storops/unity/resource/remote_system.py
def modify(self, management_address=None, username=None, password=None, connection_type=None): """ Modifies a remote system for remote replication. :param management_address: same as the one in `create` method. :param username: username for accessing the remote system. ...
def modify(self, management_address=None, username=None, password=None, connection_type=None): """ Modifies a remote system for remote replication. :param management_address: same as the one in `create` method. :param username: username for accessing the remote system. ...
[ "Modifies", "a", "remote", "system", "for", "remote", "replication", "." ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/remote_system.py#L59-L75
[ "def", "modify", "(", "self", ",", "management_address", "=", "None", ",", "username", "=", "None", ",", "password", "=", "None", ",", "connection_type", "=", "None", ")", ":", "req_body", "=", "self", ".", "_cli", ".", "make_body", "(", "managementAddress...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
UnityRemoteSystem.verify
Verifies and update the remote system settings. :param connection_type: same as the one in `create` method.
storops/unity/resource/remote_system.py
def verify(self, connection_type=None): """ Verifies and update the remote system settings. :param connection_type: same as the one in `create` method. """ req_body = self._cli.make_body(connectionType=connection_type) resp = self.action('verify', **req_body) re...
def verify(self, connection_type=None): """ Verifies and update the remote system settings. :param connection_type: same as the one in `create` method. """ req_body = self._cli.make_body(connectionType=connection_type) resp = self.action('verify', **req_body) re...
[ "Verifies", "and", "update", "the", "remote", "system", "settings", "." ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/remote_system.py#L77-L87
[ "def", "verify", "(", "self", ",", "connection_type", "=", "None", ")", ":", "req_body", "=", "self", ".", "_cli", ".", "make_body", "(", "connectionType", "=", "connection_type", ")", "resp", "=", "self", ".", "action", "(", "'verify'", ",", "*", "*", ...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
UnityReplicationInterface.create
Creates a replication interface. :param cls: this class. :param cli: the rest cli. :param sp: `UnityStorageProcessor` object. Storage processor on which the replication interface is running. :param ip_port: `UnityIpPort` object. Physical port or link aggregation ...
storops/unity/resource/replication_interface.py
def create(cls, cli, sp, ip_port, ip_address, netmask=None, v6_prefix_length=None, gateway=None, vlan_id=None): """ Creates a replication interface. :param cls: this class. :param cli: the rest cli. :param sp: `UnityStorageProcessor` object. Storage processor on w...
def create(cls, cli, sp, ip_port, ip_address, netmask=None, v6_prefix_length=None, gateway=None, vlan_id=None): """ Creates a replication interface. :param cls: this class. :param cli: the rest cli. :param sp: `UnityStorageProcessor` object. Storage processor on w...
[ "Creates", "a", "replication", "interface", "." ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/replication_interface.py#L29-L57
[ "def", "create", "(", "cls", ",", "cli", ",", "sp", ",", "ip_port", ",", "ip_address", ",", "netmask", "=", "None", ",", "v6_prefix_length", "=", "None", ",", "gateway", "=", "None", ",", "vlan_id", "=", "None", ")", ":", "req_body", "=", "cli", ".",...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
UnityReplicationInterface.modify
Modifies a replication interface. :param sp: same as the one in `create` method. :param ip_port: same as the one in `create` method. :param ip_address: same as the one in `create` method. :param netmask: same as the one in `create` method. :param v6_prefix_length: same as the on...
storops/unity/resource/replication_interface.py
def modify(self, sp=None, ip_port=None, ip_address=None, netmask=None, v6_prefix_length=None, gateway=None, vlan_id=None): """ Modifies a replication interface. :param sp: same as the one in `create` method. :param ip_port: same as the one in `create` method. :par...
def modify(self, sp=None, ip_port=None, ip_address=None, netmask=None, v6_prefix_length=None, gateway=None, vlan_id=None): """ Modifies a replication interface. :param sp: same as the one in `create` method. :param ip_port: same as the one in `create` method. :par...
[ "Modifies", "a", "replication", "interface", "." ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/replication_interface.py#L59-L79
[ "def", "modify", "(", "self", ",", "sp", "=", "None", ",", "ip_port", "=", "None", ",", "ip_address", "=", "None", ",", "netmask", "=", "None", ",", "v6_prefix_length", "=", "None", ",", "gateway", "=", "None", ",", "vlan_id", "=", "None", ")", ":", ...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
UnityMetricQueryResult.sp_sum_values
return sp level values input: "values": { "spa": { "19": "385", "18": "0", "20": "0", "17": "0", "16": "0" }, "spb": { "19": "101", "18": "101", ...
storops/unity/resource/metric.py
def sp_sum_values(self): """ return sp level values input: "values": { "spa": { "19": "385", "18": "0", "20": "0", "17": "0", "16": "0" }, "spb": { "19": "...
def sp_sum_values(self): """ return sp level values input: "values": { "spa": { "19": "385", "18": "0", "20": "0", "17": "0", "16": "0" }, "spb": { "19": "...
[ "return", "sp", "level", "values" ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/metric.py#L130-L163
[ "def", "sp_sum_values", "(", "self", ")", ":", "if", "self", ".", "values", "is", "None", ":", "ret", "=", "IdValues", "(", ")", "else", ":", "ret", "=", "IdValues", "(", "{", "k", ":", "sum", "(", "int", "(", "x", ")", "for", "x", "in", "v", ...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
UnityMetricQueryResult.sum_sp_values
return system level values (spa + spb) input: "values": { "spa": 385, "spb": 505 }, return: "values": { "0": 890 },
storops/unity/resource/metric.py
def sum_sp_values(self): """ return system level values (spa + spb) input: "values": { "spa": 385, "spb": 505 }, return: "values": { "0": 890 }, """ if self.values is None: ret = IdValues() ...
def sum_sp_values(self): """ return system level values (spa + spb) input: "values": { "spa": 385, "spb": 505 }, return: "values": { "0": 890 }, """ if self.values is None: ret = IdValues() ...
[ "return", "system", "level", "values", "(", "spa", "+", "spb", ")" ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/metric.py#L166-L185
[ "def", "sum_sp_values", "(", "self", ")", ":", "if", "self", ".", "values", "is", "None", ":", "ret", "=", "IdValues", "(", ")", "else", ":", "ret", "=", "IdValues", "(", "{", "'0'", ":", "sum", "(", "int", "(", "x", ")", "for", "x", "in", "sel...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
UnityMetricQueryResult.combine_numeric_values
numeric_values * sp_values
storops/unity/resource/metric.py
def combine_numeric_values(self, other): """ numeric_values * sp_values """ if self.values is None: ret = IdValues() else: ret = sum([IdValues( {k: int(v) * int(other.values[key]) for k, v in value.items()}) for key, value i...
def combine_numeric_values(self, other): """ numeric_values * sp_values """ if self.values is None: ret = IdValues() else: ret = sum([IdValues( {k: int(v) * int(other.values[key]) for k, v in value.items()}) for key, value i...
[ "numeric_values", "*", "sp_values" ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/metric.py#L187-L197
[ "def", "combine_numeric_values", "(", "self", ",", "other", ")", ":", "if", "self", ".", "values", "is", "None", ":", "ret", "=", "IdValues", "(", ")", "else", ":", "ret", "=", "sum", "(", "[", "IdValues", "(", "{", "k", ":", "int", "(", "v", ")"...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
UnityMetricQueryResult.combine_sp_values
sp_values * sp_values
storops/unity/resource/metric.py
def combine_sp_values(self, other): """ sp_values * sp_values """ if self.values is None: ret = IdValues() else: ret = IdValues({k: int(v) * int(other.values[k]) for k, v in self.values.items()}) return ret
def combine_sp_values(self, other): """ sp_values * sp_values """ if self.values is None: ret = IdValues() else: ret = IdValues({k: int(v) * int(other.values[k]) for k, v in self.values.items()}) return ret
[ "sp_values", "*", "sp_values" ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/metric.py#L199-L208
[ "def", "combine_sp_values", "(", "self", ",", "other", ")", ":", "if", "self", ".", "values", "is", "None", ":", "ret", "=", "IdValues", "(", ")", "else", ":", "ret", "=", "IdValues", "(", "{", "k", ":", "int", "(", "v", ")", "*", "int", "(", "...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
UnityMetricQueryResult.sum_combined_sp_values
sum(sp_values * sp_values)
storops/unity/resource/metric.py
def sum_combined_sp_values(self, other): """ sum(sp_values * sp_values) """ if self.values is None: ret = IdValues() else: ret = IdValues({'0': sum(int(x) for x in {k: int(v) * int(other.values[k]) for k, v ...
def sum_combined_sp_values(self, other): """ sum(sp_values * sp_values) """ if self.values is None: ret = IdValues() else: ret = IdValues({'0': sum(int(x) for x in {k: int(v) * int(other.values[k]) for k, v ...
[ "sum", "(", "sp_values", "*", "sp_values", ")" ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/metric.py#L210-L220
[ "def", "sum_combined_sp_values", "(", "self", ",", "other", ")", ":", "if", "self", ".", "values", "is", "None", ":", "ret", "=", "IdValues", "(", ")", "else", ":", "ret", "=", "IdValues", "(", "{", "'0'", ":", "sum", "(", "int", "(", "x", ")", "...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
Custom.add
Add a function to custom processing queue. Custom functions are applied automatically to associated pysat instrument whenever instrument.load command called. Parameters ---------- function : string or function object name of function or function obj...
pysat/_custom.py
def add(self, function, kind='add', at_pos='end',*args, **kwargs): """Add a function to custom processing queue. Custom functions are applied automatically to associated pysat instrument whenever instrument.load command called. Parameters ---------- functio...
def add(self, function, kind='add', at_pos='end',*args, **kwargs): """Add a function to custom processing queue. Custom functions are applied automatically to associated pysat instrument whenever instrument.load command called. Parameters ---------- functio...
[ "Add", "a", "function", "to", "custom", "processing", "queue", ".", "Custom", "functions", "are", "applied", "automatically", "to", "associated", "pysat", "instrument", "whenever", "instrument", ".", "load", "command", "called", "." ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_custom.py#L51-L114
[ "def", "add", "(", "self", ",", "function", ",", "kind", "=", "'add'", ",", "at_pos", "=", "'end'", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "function", ",", "str", ")", ":", "# convert string to function object", "...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Custom._apply_all
Apply all of the custom functions to the satellite data object.
pysat/_custom.py
def _apply_all(self, sat): """ Apply all of the custom functions to the satellite data object. """ if len(self._functions) > 0: for func, arg, kwarg, kind in zip(self._functions, self._args, self._kwargs, self._kind): ...
def _apply_all(self, sat): """ Apply all of the custom functions to the satellite data object. """ if len(self._functions) > 0: for func, arg, kwarg, kind in zip(self._functions, self._args, self._kwargs, self._kind): ...
[ "Apply", "all", "of", "the", "custom", "functions", "to", "the", "satellite", "data", "object", "." ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_custom.py#L116-L214
[ "def", "_apply_all", "(", "self", ",", "sat", ")", ":", "if", "len", "(", "self", ".", "_functions", ")", ">", "0", ":", "for", "func", ",", "arg", ",", "kwarg", ",", "kind", "in", "zip", "(", "self", ".", "_functions", ",", "self", ".", "_args",...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Custom.clear
Clear custom function list.
pysat/_custom.py
def clear(self): """Clear custom function list.""" self._functions=[] self._args=[] self._kwargs=[] self._kind=[]
def clear(self): """Clear custom function list.""" self._functions=[] self._args=[] self._kwargs=[] self._kind=[]
[ "Clear", "custom", "function", "list", "." ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_custom.py#L216-L221
[ "def", "clear", "(", "self", ")", ":", "self", ".", "_functions", "=", "[", "]", "self", ".", "_args", "=", "[", "]", "self", ".", "_kwargs", "=", "[", "]", "self", ".", "_kind", "=", "[", "]" ]
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
list_files
Return a Pandas Series of every file for chosen satellite data Parameters ----------- tag : (string) Denotes type of file to load. Accepted types are 'north' and 'south'. (default='north') sat_id : (string or NoneType) Specifies the satellite ID for a constellation. Not used. ...
pysat/instruments/superdarn_grdex.py
def list_files(tag='north', sat_id=None, data_path=None, format_str=None): """Return a Pandas Series of every file for chosen satellite data Parameters ----------- tag : (string) Denotes type of file to load. Accepted types are 'north' and 'south'. (default='north') sat_id : (strin...
def list_files(tag='north', sat_id=None, data_path=None, format_str=None): """Return a Pandas Series of every file for chosen satellite data Parameters ----------- tag : (string) Denotes type of file to load. Accepted types are 'north' and 'south'. (default='north') sat_id : (strin...
[ "Return", "a", "Pandas", "Series", "of", "every", "file", "for", "chosen", "satellite", "data" ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/superdarn_grdex.py#L53-L88
[ "def", "list_files", "(", "tag", "=", "'north'", ",", "sat_id", "=", "None", ",", "data_path", "=", "None", ",", "format_str", "=", "None", ")", ":", "if", "format_str", "is", "None", "and", "tag", "is", "not", "None", ":", "if", "tag", "==", "'north...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
download
Download SuperDARN data from Virginia Tech organized for loading by pysat.
pysat/instruments/superdarn_grdex.py
def download(date_array, tag, sat_id, data_path, user=None, password=None): """ Download SuperDARN data from Virginia Tech organized for loading by pysat. """ import sys import os import pysftp import davitpy if user is None: user = os.environ['DBREADUSER'] if password...
def download(date_array, tag, sat_id, data_path, user=None, password=None): """ Download SuperDARN data from Virginia Tech organized for loading by pysat. """ import sys import os import pysftp import davitpy if user is None: user = os.environ['DBREADUSER'] if password...
[ "Download", "SuperDARN", "data", "from", "Virginia", "Tech", "organized", "for", "loading", "by", "pysat", "." ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/superdarn_grdex.py#L178-L214
[ "def", "download", "(", "date_array", ",", "tag", ",", "sat_id", ",", "data_path", ",", "user", "=", "None", ",", "password", "=", "None", ")", ":", "import", "sys", "import", "os", "import", "pysftp", "import", "davitpy", "if", "user", "is", "None", "...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
VNXDiskList.same_disks
filter self to the required number of disks with same size and type Select the disks with the same type and same size. If not enough disks available, set self to empty. :param count: number of disks to retrieve :return: disk list
storops/vnx/resource/disk.py
def same_disks(self, count=2): """ filter self to the required number of disks with same size and type Select the disks with the same type and same size. If not enough disks available, set self to empty. :param count: number of disks to retrieve :return: disk list """ ...
def same_disks(self, count=2): """ filter self to the required number of disks with same size and type Select the disks with the same type and same size. If not enough disks available, set self to empty. :param count: number of disks to retrieve :return: disk list """ ...
[ "filter", "self", "to", "the", "required", "number", "of", "disks", "with", "same", "size", "and", "type" ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/resource/disk.py#L141-L166
[ "def", "same_disks", "(", "self", ",", "count", "=", "2", ")", ":", "ret", "=", "self", "if", "len", "(", "self", ")", ">", "0", ":", "type_counter", "=", "Counter", "(", "self", ".", "drive_type", ")", "drive_type", ",", "counts", "=", "type_counter...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
Constellation.set_bounds
Sets boundaries for all instruments in constellation
pysat/_constellation.py
def set_bounds(self, start, stop): """ Sets boundaries for all instruments in constellation """ for instrument in self.instruments: instrument.bounds = (start, stop)
def set_bounds(self, start, stop): """ Sets boundaries for all instruments in constellation """ for instrument in self.instruments: instrument.bounds = (start, stop)
[ "Sets", "boundaries", "for", "all", "instruments", "in", "constellation" ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_constellation.py#L64-L69
[ "def", "set_bounds", "(", "self", ",", "start", ",", "stop", ")", ":", "for", "instrument", "in", "self", ".", "instruments", ":", "instrument", ".", "bounds", "=", "(", "start", ",", "stop", ")" ]
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Constellation.data_mod
Register a function to modify data of member Instruments. The function is not partially applied to modify member data. When the Constellation receives a function call to register a function for data modification, it passes the call to each instrument and registers it in the instrument's pysat....
pysat/_constellation.py
def data_mod(self, *args, **kwargs): """ Register a function to modify data of member Instruments. The function is not partially applied to modify member data. When the Constellation receives a function call to register a function for data modification, it passes the call to ea...
def data_mod(self, *args, **kwargs): """ Register a function to modify data of member Instruments. The function is not partially applied to modify member data. When the Constellation receives a function call to register a function for data modification, it passes the call to ea...
[ "Register", "a", "function", "to", "modify", "data", "of", "member", "Instruments", "." ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_constellation.py#L71-L119
[ "def", "data_mod", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "for", "instrument", "in", "self", ".", "instruments", ":", "instrument", ".", "custom", ".", "add", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Constellation.load
Load instrument data into instrument object.data (Wraps pysat.Instrument.load; documentation of that function is reproduced here.) Parameters --------- yr : integer Year for desired data doy : integer day of year data : datetime object ...
pysat/_constellation.py
def load(self, *args, **kwargs): """ Load instrument data into instrument object.data (Wraps pysat.Instrument.load; documentation of that function is reproduced here.) Parameters --------- yr : integer Year for desired data doy : integer ...
def load(self, *args, **kwargs): """ Load instrument data into instrument object.data (Wraps pysat.Instrument.load; documentation of that function is reproduced here.) Parameters --------- yr : integer Year for desired data doy : integer ...
[ "Load", "instrument", "data", "into", "instrument", "object", ".", "data" ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_constellation.py#L121-L143
[ "def", "load", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "for", "instrument", "in", "self", ".", "instruments", ":", "instrument", ".", "load", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Constellation.add
Combines signals from multiple instruments within given bounds. Parameters ---------- bounds1 : (min, max) Bounds for selecting data on the axis of label1 Data points with label1 in [min, max) will be considered. label1 : string Data label for...
pysat/_constellation.py
def add(self, bounds1, label1, bounds2, label2, bin3, label3, data_label): """ Combines signals from multiple instruments within given bounds. Parameters ---------- bounds1 : (min, max) Bounds for selecting data on the axis of label1 D...
def add(self, bounds1, label1, bounds2, label2, bin3, label3, data_label): """ Combines signals from multiple instruments within given bounds. Parameters ---------- bounds1 : (min, max) Bounds for selecting data on the axis of label1 D...
[ "Combines", "signals", "from", "multiple", "instruments", "within", "given", "bounds", "." ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_constellation.py#L145-L252
[ "def", "add", "(", "self", ",", "bounds1", ",", "label1", ",", "bounds2", ",", "label2", ",", "bin3", ",", "label3", ",", "data_label", ")", ":", "# TODO Update for 2.7 compatability.", "if", "isinstance", "(", "data_label", ",", "str", ")", ":", "data_label...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Constellation.difference
Calculates the difference in signals from multiple instruments within the given bounds. Parameters ---------- instrument1 : Instrument Information must already be loaded into the instrument. instrument2 : Instrument Information must already b...
pysat/_constellation.py
def difference(self, instrument1, instrument2, bounds, data_labels, cost_function): """ Calculates the difference in signals from multiple instruments within the given bounds. Parameters ---------- instrument1 : Instrument Information must ...
def difference(self, instrument1, instrument2, bounds, data_labels, cost_function): """ Calculates the difference in signals from multiple instruments within the given bounds. Parameters ---------- instrument1 : Instrument Information must ...
[ "Calculates", "the", "difference", "in", "signals", "from", "multiple", "instruments", "within", "the", "given", "bounds", "." ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_constellation.py#L254-L451
[ "def", "difference", "(", "self", ",", "instrument1", ",", "instrument2", ",", "bounds", ",", "data_labels", ",", "cost_function", ")", ":", "\"\"\"\n Draft Pseudocode\n ----------------\n Check integrity of inputs.\n\n Let STD_LABELS be the constant tuple...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
daily2D
2D Daily Occurrence Probability of data_label > gate over a season. If data_label is greater than gate at least once per day, then a 100% occurrence probability results.Season delineated by the bounds attached to Instrument object. Prob = (# of times with at least one hit)/(# of times in bin) ...
pysat/ssnl/occur_prob.py
def daily2D(inst, bin1, label1, bin2, label2, data_label, gate, returnBins=False): """2D Daily Occurrence Probability of data_label > gate over a season. If data_label is greater than gate at least once per day, then a 100% occurrence probability results.Season delineated by the bounds attached to...
def daily2D(inst, bin1, label1, bin2, label2, data_label, gate, returnBins=False): """2D Daily Occurrence Probability of data_label > gate over a season. If data_label is greater than gate at least once per day, then a 100% occurrence probability results.Season delineated by the bounds attached to...
[ "2D", "Daily", "Occurrence", "Probability", "of", "data_label", ">", "gate", "over", "a", "season", ".", "If", "data_label", "is", "greater", "than", "gate", "at", "least", "once", "per", "day", "then", "a", "100%", "occurrence", "probability", "results", "....
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/ssnl/occur_prob.py#L22-L61
[ "def", "daily2D", "(", "inst", ",", "bin1", ",", "label1", ",", "bin2", ",", "label2", ",", "data_label", ",", "gate", ",", "returnBins", "=", "False", ")", ":", "return", "_occurrence2D", "(", "inst", ",", "bin1", ",", "label1", ",", "bin2", ",", "l...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
by_orbit2D
2D Occurrence Probability of data_label orbit-by-orbit over a season. If data_label is greater than gate atleast once per orbit, then a 100% occurrence probability results. Season delineated by the bounds attached to Instrument object. Prob = (# of times with at least one hit)/(# of times in bin) ...
pysat/ssnl/occur_prob.py
def by_orbit2D(inst, bin1, label1, bin2, label2, data_label, gate, returnBins=False): """2D Occurrence Probability of data_label orbit-by-orbit over a season. If data_label is greater than gate atleast once per orbit, then a 100% occurrence probability results. Season delineated by the bounds atta...
def by_orbit2D(inst, bin1, label1, bin2, label2, data_label, gate, returnBins=False): """2D Occurrence Probability of data_label orbit-by-orbit over a season. If data_label is greater than gate atleast once per orbit, then a 100% occurrence probability results. Season delineated by the bounds atta...
[ "2D", "Occurrence", "Probability", "of", "data_label", "orbit", "-", "by", "-", "orbit", "over", "a", "season", ".", "If", "data_label", "is", "greater", "than", "gate", "atleast", "once", "per", "orbit", "then", "a", "100%", "occurrence", "probability", "re...
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/ssnl/occur_prob.py#L64-L102
[ "def", "by_orbit2D", "(", "inst", ",", "bin1", ",", "label1", ",", "bin2", ",", "label2", ",", "data_label", ",", "gate", ",", "returnBins", "=", "False", ")", ":", "return", "_occurrence2D", "(", "inst", ",", "bin1", ",", "label1", ",", "bin2", ",", ...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
daily3D
3D Daily Occurrence Probability of data_label > gate over a season. If data_label is greater than gate atleast once per day, then a 100% occurrence probability results. Season delineated by the bounds attached to Instrument object. Prob = (# of times with at least one hit)/(# of times in bin) ...
pysat/ssnl/occur_prob.py
def daily3D(inst, bin1, label1, bin2, label2, bin3, label3, data_label, gate, returnBins=False): """3D Daily Occurrence Probability of data_label > gate over a season. If data_label is greater than gate atleast once per day, then a 100% occurrence probability results. Season delineated by...
def daily3D(inst, bin1, label1, bin2, label2, bin3, label3, data_label, gate, returnBins=False): """3D Daily Occurrence Probability of data_label > gate over a season. If data_label is greater than gate atleast once per day, then a 100% occurrence probability results. Season delineated by...
[ "3D", "Daily", "Occurrence", "Probability", "of", "data_label", ">", "gate", "over", "a", "season", ".", "If", "data_label", "is", "greater", "than", "gate", "atleast", "once", "per", "day", "then", "a", "100%", "occurrence", "probability", "results", ".", "...
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/ssnl/occur_prob.py#L168-L207
[ "def", "daily3D", "(", "inst", ",", "bin1", ",", "label1", ",", "bin2", ",", "label2", ",", "bin3", ",", "label3", ",", "data_label", ",", "gate", ",", "returnBins", "=", "False", ")", ":", "return", "_occurrence3D", "(", "inst", ",", "bin1", ",", "l...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
computational_form
Input Series of numbers, Series, or DataFrames repackaged for calculation. Parameters ---------- data : pandas.Series Series of numbers, Series, DataFrames Returns ------- pandas.Series, DataFrame, or Panel repacked data, aligned by indices, ready for calculation
pysat/utils.py
def computational_form(data): """ Input Series of numbers, Series, or DataFrames repackaged for calculation. Parameters ---------- data : pandas.Series Series of numbers, Series, DataFrames Returns ------- pandas.Series, DataFrame, or Panel repacked data, aligned by...
def computational_form(data): """ Input Series of numbers, Series, or DataFrames repackaged for calculation. Parameters ---------- data : pandas.Series Series of numbers, Series, DataFrames Returns ------- pandas.Series, DataFrame, or Panel repacked data, aligned by...
[ "Input", "Series", "of", "numbers", "Series", "or", "DataFrames", "repackaged", "for", "calculation", "." ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/utils.py#L16-L40
[ "def", "computational_form", "(", "data", ")", ":", "if", "isinstance", "(", "data", ".", "iloc", "[", "0", "]", ",", "DataFrame", ")", ":", "dslice", "=", "Panel", ".", "from_dict", "(", "dict", "(", "[", "(", "i", ",", "data", ".", "iloc", "[", ...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
set_data_dir
Set the top level directory pysat uses to look for data and reload. Parameters ---------- path : string valid path to directory pysat uses to look for data store : bool if True, store data directory for future runs
pysat/utils.py
def set_data_dir(path=None, store=None): """ Set the top level directory pysat uses to look for data and reload. Parameters ---------- path : string valid path to directory pysat uses to look for data store : bool if True, store data directory for future runs """ import ...
def set_data_dir(path=None, store=None): """ Set the top level directory pysat uses to look for data and reload. Parameters ---------- path : string valid path to directory pysat uses to look for data store : bool if True, store data directory for future runs """ import ...
[ "Set", "the", "top", "level", "directory", "pysat", "uses", "to", "look", "for", "data", "and", "reload", "." ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/utils.py#L42-L76
[ "def", "set_data_dir", "(", "path", "=", "None", ",", "store", "=", "None", ")", ":", "import", "sys", "import", "os", "import", "pysat", "if", "sys", ".", "version_info", "[", "0", "]", ">=", "3", ":", "if", "sys", ".", "version_info", "[", "1", "...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
load_netcdf4
Load netCDF-3/4 file produced by pysat. Parameters ---------- fnames : string or array_like of strings filenames to load strict_meta : boolean check if metadata across fnames is the same file_format : string file_format keyword passed to netCDF4 routine NETCDF3_CLASS...
pysat/utils.py
def load_netcdf4(fnames=None, strict_meta=False, file_format=None, epoch_name='Epoch', units_label='units', name_label='long_name', notes_label='notes', desc_label='desc', plot_label='label', axis_label='axis', scale_label='scale', m...
def load_netcdf4(fnames=None, strict_meta=False, file_format=None, epoch_name='Epoch', units_label='units', name_label='long_name', notes_label='notes', desc_label='desc', plot_label='label', axis_label='axis', scale_label='scale', m...
[ "Load", "netCDF", "-", "3", "/", "4", "file", "produced", "by", "pysat", "." ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/utils.py#L78-L362
[ "def", "load_netcdf4", "(", "fnames", "=", "None", ",", "strict_meta", "=", "False", ",", "file_format", "=", "None", ",", "epoch_name", "=", "'Epoch'", ",", "units_label", "=", "'units'", ",", "name_label", "=", "'long_name'", ",", "notes_label", "=", "'not...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
getyrdoy
Return a tuple of year, day of year for a supplied datetime object.
pysat/utils.py
def getyrdoy(date): """Return a tuple of year, day of year for a supplied datetime object.""" try: doy = date.toordinal()-datetime(date.year,1,1).toordinal()+1 except AttributeError: raise AttributeError("Must supply a pandas datetime object or " + "equivalent")...
def getyrdoy(date): """Return a tuple of year, day of year for a supplied datetime object.""" try: doy = date.toordinal()-datetime(date.year,1,1).toordinal()+1 except AttributeError: raise AttributeError("Must supply a pandas datetime object or " + "equivalent")...
[ "Return", "a", "tuple", "of", "year", "day", "of", "year", "for", "a", "supplied", "datetime", "object", "." ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/utils.py#L365-L374
[ "def", "getyrdoy", "(", "date", ")", ":", "try", ":", "doy", "=", "date", ".", "toordinal", "(", ")", "-", "datetime", "(", "date", ".", "year", ",", "1", ",", "1", ")", ".", "toordinal", "(", ")", "+", "1", "except", "AttributeError", ":", "rais...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
season_date_range
Return array of datetime objects using input frequency from start to stop Supports single datetime object or list, tuple, ndarray of start and stop dates. freq codes correspond to pandas date_range codes, D daily, M monthly, S secondly
pysat/utils.py
def season_date_range(start, stop, freq='D'): """ Return array of datetime objects using input frequency from start to stop Supports single datetime object or list, tuple, ndarray of start and stop dates. freq codes correspond to pandas date_range codes, D daily, M monthly, S secondly """...
def season_date_range(start, stop, freq='D'): """ Return array of datetime objects using input frequency from start to stop Supports single datetime object or list, tuple, ndarray of start and stop dates. freq codes correspond to pandas date_range codes, D daily, M monthly, S secondly """...
[ "Return", "array", "of", "datetime", "objects", "using", "input", "frequency", "from", "start", "to", "stop" ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/utils.py#L377-L395
[ "def", "season_date_range", "(", "start", ",", "stop", ",", "freq", "=", "'D'", ")", ":", "if", "hasattr", "(", "start", ",", "'__iter__'", ")", ":", "# missing check for datetime", "season", "=", "pds", ".", "date_range", "(", "start", "[", "0", "]", ",...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
create_datetime_index
Create a timeseries index using supplied year, month, day, and ut in seconds. Parameters ---------- year : array_like of ints month : array_like of ints or None day : array_like of ints for day (default) or day of year (use month=None) uts : array_like of floats...
pysat/utils.py
def create_datetime_index(year=None, month=None, day=None, uts=None): """Create a timeseries index using supplied year, month, day, and ut in seconds. Parameters ---------- year : array_like of ints month : array_like of ints or None day : array_like of ints for day...
def create_datetime_index(year=None, month=None, day=None, uts=None): """Create a timeseries index using supplied year, month, day, and ut in seconds. Parameters ---------- year : array_like of ints month : array_like of ints or None day : array_like of ints for day...
[ "Create", "a", "timeseries", "index", "using", "supplied", "year", "month", "day", "and", "ut", "in", "seconds", "." ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/utils.py#L413-L475
[ "def", "create_datetime_index", "(", "year", "=", "None", ",", "month", "=", "None", ",", "day", "=", "None", ",", "uts", "=", "None", ")", ":", "# need a timeseries index for storing satellite data in pandas but", "# creating a datetime object for everything is too slow", ...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
nan_circmean
NaN insensitive version of scipy's circular mean routine Parameters ----------- samples : array_like Input array low : float or int Lower boundary for circular standard deviation range (default=0) high: float or int Upper boundary for circular standard deviation range (defau...
pysat/utils.py
def nan_circmean(samples, high=2.0*np.pi, low=0.0, axis=None): """NaN insensitive version of scipy's circular mean routine Parameters ----------- samples : array_like Input array low : float or int Lower boundary for circular standard deviation range (default=0) high: float or i...
def nan_circmean(samples, high=2.0*np.pi, low=0.0, axis=None): """NaN insensitive version of scipy's circular mean routine Parameters ----------- samples : array_like Input array low : float or int Lower boundary for circular standard deviation range (default=0) high: float or i...
[ "NaN", "insensitive", "version", "of", "scipy", "s", "circular", "mean", "routine" ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/utils.py#L478-L523
[ "def", "nan_circmean", "(", "samples", ",", "high", "=", "2.0", "*", "np", ".", "pi", ",", "low", "=", "0.0", ",", "axis", "=", "None", ")", ":", "samples", "=", "np", ".", "asarray", "(", "samples", ")", "samples", "=", "samples", "[", "~", "np"...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
nan_circstd
NaN insensitive version of scipy's circular standard deviation routine Parameters ----------- samples : array_like Input array low : float or int Lower boundary for circular standard deviation range (default=0) high: float or int Upper boundary for circular standard deviatio...
pysat/utils.py
def nan_circstd(samples, high=2.0*np.pi, low=0.0, axis=None): """NaN insensitive version of scipy's circular standard deviation routine Parameters ----------- samples : array_like Input array low : float or int Lower boundary for circular standard deviation range (default=0) hig...
def nan_circstd(samples, high=2.0*np.pi, low=0.0, axis=None): """NaN insensitive version of scipy's circular standard deviation routine Parameters ----------- samples : array_like Input array low : float or int Lower boundary for circular standard deviation range (default=0) hig...
[ "NaN", "insensitive", "version", "of", "scipy", "s", "circular", "standard", "deviation", "routine" ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/utils.py#L526-L563
[ "def", "nan_circstd", "(", "samples", ",", "high", "=", "2.0", "*", "np", ".", "pi", ",", "low", "=", "0.0", ",", "axis", "=", "None", ")", ":", "samples", "=", "np", ".", "asarray", "(", "samples", ")", "samples", "=", "samples", "[", "~", "np",...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
default
Default routine to be applied when loading data. Removes redundant naming
pysat/instruments/icon_euv.py
def default(inst): """Default routine to be applied when loading data. Removes redundant naming """ import pysat.instruments.icon_ivm as icivm inst.tag = 'level_2' icivm.remove_icon_names(inst, target='ICON_L2_EUV_Daytime_OP_')
def default(inst): """Default routine to be applied when loading data. Removes redundant naming """ import pysat.instruments.icon_ivm as icivm inst.tag = 'level_2' icivm.remove_icon_names(inst, target='ICON_L2_EUV_Daytime_OP_')
[ "Default", "routine", "to", "be", "applied", "when", "loading", "data", ".", "Removes", "redundant", "naming" ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/icon_euv.py#L53-L59
[ "def", "default", "(", "inst", ")", ":", "import", "pysat", ".", "instruments", ".", "icon_ivm", "as", "icivm", "inst", ".", "tag", "=", "'level_2'", "icivm", ".", "remove_icon_names", "(", "inst", ",", "target", "=", "'ICON_L2_EUV_Daytime_OP_'", ")" ]
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
list_files
Produce a list of ICON EUV files. Notes ----- Currently fixed to level-2
pysat/instruments/icon_euv.py
def list_files(tag=None, sat_id=None, data_path=None, format_str=None): """Produce a list of ICON EUV files. Notes ----- Currently fixed to level-2 """ desc = None level = tag if level == 'level_1': code = 'L1' desc = None elif level == 'level_2': code = 'L...
def list_files(tag=None, sat_id=None, data_path=None, format_str=None): """Produce a list of ICON EUV files. Notes ----- Currently fixed to level-2 """ desc = None level = tag if level == 'level_1': code = 'L1' desc = None elif level == 'level_2': code = 'L...
[ "Produce", "a", "list", "of", "ICON", "EUV", "files", "." ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/icon_euv.py#L76-L103
[ "def", "list_files", "(", "tag", "=", "None", ",", "sat_id", "=", "None", ",", "data_path", "=", "None", ",", "format_str", "=", "None", ")", ":", "desc", "=", "None", "level", "=", "tag", "if", "level", "==", "'level_1'", ":", "code", "=", "'L1'", ...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Resource.shadow_copy
Return a copy of the resource with same raw data :return: copy of the resource
storops/lib/resource.py
def shadow_copy(self): """ Return a copy of the resource with same raw data :return: copy of the resource """ ret = self.__class__() if not self._is_updated(): # before copy, make sure source is updated. self.update() ret._parsed_resource = self._...
def shadow_copy(self): """ Return a copy of the resource with same raw data :return: copy of the resource """ ret = self.__class__() if not self._is_updated(): # before copy, make sure source is updated. self.update() ret._parsed_resource = self._...
[ "Return", "a", "copy", "of", "the", "resource", "with", "same", "raw", "data" ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/lib/resource.py#L31-L41
[ "def", "shadow_copy", "(", "self", ")", ":", "ret", "=", "self", ".", "__class__", "(", ")", "if", "not", "self", ".", "_is_updated", "(", ")", ":", "# before copy, make sure source is updated.", "self", ".", "update", "(", ")", "ret", ".", "_parsed_resource...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
load
Loads data using pysat.utils.load_netcdf4 . This routine is called as needed by pysat. It is not intended for direct user interaction. Parameters ---------- fnames : array-like iterable of filename strings, full path, to data files to be loaded. This input is nominally provided...
pysat/instruments/netcdf_pandas.py
def load(fnames, tag=None, sat_id=None, **kwargs): """Loads data using pysat.utils.load_netcdf4 . This routine is called as needed by pysat. It is not intended for direct user interaction. Parameters ---------- fnames : array-like iterable of filename strings, full path, to data fi...
def load(fnames, tag=None, sat_id=None, **kwargs): """Loads data using pysat.utils.load_netcdf4 . This routine is called as needed by pysat. It is not intended for direct user interaction. Parameters ---------- fnames : array-like iterable of filename strings, full path, to data fi...
[ "Loads", "data", "using", "pysat", ".", "utils", ".", "load_netcdf4", "." ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/netcdf_pandas.py#L49-L104
[ "def", "load", "(", "fnames", ",", "tag", "=", "None", ",", "sat_id", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "pysat", ".", "utils", ".", "load_netcdf4", "(", "fnames", ",", "*", "*", "kwargs", ")" ]
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
list_files
Produce a list of files corresponding to format_str located at data_path. This routine is invoked by pysat and is not intended for direct use by the end user. Multiple data levels may be supported via the 'tag' and 'sat_id' input strings. Parameters ---------- tag : string ('') tag na...
pysat/instruments/netcdf_pandas.py
def list_files(tag=None, sat_id=None, data_path=None, format_str=None): """Produce a list of files corresponding to format_str located at data_path. This routine is invoked by pysat and is not intended for direct use by the end user. Multiple data levels may be supported via the 'tag' and 'sat_id' inp...
def list_files(tag=None, sat_id=None, data_path=None, format_str=None): """Produce a list of files corresponding to format_str located at data_path. This routine is invoked by pysat and is not intended for direct use by the end user. Multiple data levels may be supported via the 'tag' and 'sat_id' inp...
[ "Produce", "a", "list", "of", "files", "corresponding", "to", "format_str", "located", "at", "data_path", "." ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/netcdf_pandas.py#L107-L164
[ "def", "list_files", "(", "tag", "=", "None", ",", "sat_id", "=", "None", ",", "data_path", "=", "None", ",", "format_str", "=", "None", ")", ":", "return", "pysat", ".", "Files", ".", "from_os", "(", "data_path", "=", "data_path", ",", "format_str", "...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
command
indicate it's a command of naviseccli :param f: function that returns the command in list :return: command execution result
storops/vnx/block_cli.py
def command(f): """ indicate it's a command of naviseccli :param f: function that returns the command in list :return: command execution result """ @functools.wraps(f) def func_wrapper(self, *argv, **kwargs): if 'ip' in kwargs: ip = kwargs['ip'] del kwargs['ip']...
def command(f): """ indicate it's a command of naviseccli :param f: function that returns the command in list :return: command execution result """ @functools.wraps(f) def func_wrapper(self, *argv, **kwargs): if 'ip' in kwargs: ip = kwargs['ip'] del kwargs['ip']...
[ "indicate", "it", "s", "a", "command", "of", "naviseccli" ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/block_cli.py#L57-L75
[ "def", "command", "(", "f", ")", ":", "@", "functools", ".", "wraps", "(", "f", ")", "def", "func_wrapper", "(", "self", ",", "*", "argv", ",", "*", "*", "kwargs", ")", ":", "if", "'ip'", "in", "kwargs", ":", "ip", "=", "kwargs", "[", "'ip'", "...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
duel_command
indicate it's a command need to be called on both SP :param f: function that returns the command in list :return: command execution result on both sps (tuple of 2)
storops/vnx/block_cli.py
def duel_command(f): """ indicate it's a command need to be called on both SP :param f: function that returns the command in list :return: command execution result on both sps (tuple of 2) """ @functools.wraps(f) def func_wrapper(self, *argv, **kwargs): commands = _get_commands(f, self...
def duel_command(f): """ indicate it's a command need to be called on both SP :param f: function that returns the command in list :return: command execution result on both sps (tuple of 2) """ @functools.wraps(f) def func_wrapper(self, *argv, **kwargs): commands = _get_commands(f, self...
[ "indicate", "it", "s", "a", "command", "need", "to", "be", "called", "on", "both", "SP" ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/block_cli.py#L78-L90
[ "def", "duel_command", "(", "f", ")", ":", "@", "functools", ".", "wraps", "(", "f", ")", "def", "func_wrapper", "(", "self", ",", "*", "argv", ",", "*", "*", "kwargs", ")", ":", "commands", "=", "_get_commands", "(", "f", ",", "self", ",", "*", ...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
supplement_filesystem
Return new size accounting for the metadata.
storops/lib/common.py
def supplement_filesystem(old_size, user_cap=False): """Return new size accounting for the metadata.""" new_size = old_size if user_cap: if old_size <= _GiB_to_Byte(1.5): new_size = _GiB_to_Byte(3) else: new_size += _GiB_to_Byte(1.5) return int(new_size)
def supplement_filesystem(old_size, user_cap=False): """Return new size accounting for the metadata.""" new_size = old_size if user_cap: if old_size <= _GiB_to_Byte(1.5): new_size = _GiB_to_Byte(3) else: new_size += _GiB_to_Byte(1.5) return int(new_size)
[ "Return", "new", "size", "accounting", "for", "the", "metadata", "." ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/lib/common.py#L551-L559
[ "def", "supplement_filesystem", "(", "old_size", ",", "user_cap", "=", "False", ")", ":", "new_size", "=", "old_size", "if", "user_cap", ":", "if", "old_size", "<=", "_GiB_to_Byte", "(", "1.5", ")", ":", "new_size", "=", "_GiB_to_Byte", "(", "3", ")", "els...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
SynchronizedDecorator.synchronized
synchronize on obj if obj is supplied. :param obj: the obj to lock on. if none, lock to the function :return: return of the func.
storops/lib/common.py
def synchronized(cls, obj=None): """ synchronize on obj if obj is supplied. :param obj: the obj to lock on. if none, lock to the function :return: return of the func. """ def get_key(f, o): if o is None: key = hash(f) else: ...
def synchronized(cls, obj=None): """ synchronize on obj if obj is supplied. :param obj: the obj to lock on. if none, lock to the function :return: return of the func. """ def get_key(f, o): if o is None: key = hash(f) else: ...
[ "synchronize", "on", "obj", "if", "obj", "is", "supplied", "." ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/lib/common.py#L347-L377
[ "def", "synchronized", "(", "cls", ",", "obj", "=", "None", ")", ":", "def", "get_key", "(", "f", ",", "o", ")", ":", "if", "o", "is", "None", ":", "key", "=", "hash", "(", "f", ")", "else", ":", "key", "=", "hash", "(", "o", ")", "return", ...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
PQueue.re_enqueue
Re-enqueue till reach max retries.
storops/lib/tasks.py
def re_enqueue(self, item): """Re-enqueue till reach max retries.""" if 'retries' in item: retries = item['retries'] if retries >= self.MAX_RETRIES: log.warn("Failed to execute {} after {} retries, give it " " up.".format(item['method'], r...
def re_enqueue(self, item): """Re-enqueue till reach max retries.""" if 'retries' in item: retries = item['retries'] if retries >= self.MAX_RETRIES: log.warn("Failed to execute {} after {} retries, give it " " up.".format(item['method'], r...
[ "Re", "-", "enqueue", "till", "reach", "max", "retries", "." ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/lib/tasks.py#L74-L87
[ "def", "re_enqueue", "(", "self", ",", "item", ")", ":", "if", "'retries'", "in", "item", ":", "retries", "=", "item", "[", "'retries'", "]", "if", "retries", ">=", "self", ".", "MAX_RETRIES", ":", "log", ".", "warn", "(", "\"Failed to execute {} after {} ...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
Criteria._support_op
Internal decorator to define an criteria compare operations.
storops/lib/version.py
def _support_op(*args): """Internal decorator to define an criteria compare operations.""" def inner(func): for one_arg in args: _op_mapping_[one_arg] = func return func return inner
def _support_op(*args): """Internal decorator to define an criteria compare operations.""" def inner(func): for one_arg in args: _op_mapping_[one_arg] = func return func return inner
[ "Internal", "decorator", "to", "define", "an", "criteria", "compare", "operations", "." ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/lib/version.py#L37-L44
[ "def", "_support_op", "(", "*", "args", ")", ":", "def", "inner", "(", "func", ")", ":", "for", "one_arg", "in", "args", ":", "_op_mapping_", "[", "one_arg", "]", "=", "func", "return", "func", "return", "inner" ]
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
clean
Routine to return VEFI data cleaned to the specified level Parameters ----------- inst : (pysat.Instrument) Instrument class object, whose attribute clean_level is used to return the desired level of data selectivity. Returns -------- Void : (NoneType) data in inst is m...
pysat/instruments/cnofs_vefi.py
def clean(inst): """Routine to return VEFI data cleaned to the specified level Parameters ----------- inst : (pysat.Instrument) Instrument class object, whose attribute clean_level is used to return the desired level of data selectivity. Returns -------- Void : (NoneType) ...
def clean(inst): """Routine to return VEFI data cleaned to the specified level Parameters ----------- inst : (pysat.Instrument) Instrument class object, whose attribute clean_level is used to return the desired level of data selectivity. Returns -------- Void : (NoneType) ...
[ "Routine", "to", "return", "VEFI", "data", "cleaned", "to", "the", "specified", "level" ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/cnofs_vefi.py#L63-L86
[ "def", "clean", "(", "inst", ")", ":", "if", "(", "inst", ".", "clean_level", "==", "'dusty'", ")", "|", "(", "inst", ".", "clean_level", "==", "'clean'", ")", ":", "idx", ",", "=", "np", ".", "where", "(", "inst", "[", "'B_flag'", "]", "==", "0"...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
remove_icon_names
Removes leading text on ICON project variable names Parameters ---------- inst : pysat.Instrument ICON associated pysat.Instrument object target : str Leading string to remove. If none supplied, ICON project standards are used to identify and remove leading text Ret...
pysat/instruments/icon_ivm.py
def remove_icon_names(inst, target=None): """Removes leading text on ICON project variable names Parameters ---------- inst : pysat.Instrument ICON associated pysat.Instrument object target : str Leading string to remove. If none supplied, ICON project standards are used to ...
def remove_icon_names(inst, target=None): """Removes leading text on ICON project variable names Parameters ---------- inst : pysat.Instrument ICON associated pysat.Instrument object target : str Leading string to remove. If none supplied, ICON project standards are used to ...
[ "Removes", "leading", "text", "on", "ICON", "project", "variable", "names" ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/icon_ivm.py#L114-L170
[ "def", "remove_icon_names", "(", "inst", ",", "target", "=", "None", ")", ":", "if", "target", "is", "None", ":", "lev", "=", "inst", ".", "tag", "if", "lev", "==", "'level_2'", ":", "lev", "=", "'L2'", "elif", "lev", "==", "'level_0'", ":", "lev", ...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
list_files
Return a Pandas Series of every file for chosen satellite data Parameters ----------- tag : (string or NoneType) Denotes type of file to load. Accepted types are '1min' and '5min'. (default=None) sat_id : (string or NoneType) Specifies the satellite ID for a constellation. Not...
pysat/instruments/omni_hro.py
def list_files(tag=None, sat_id=None, data_path=None, format_str=None): """Return a Pandas Series of every file for chosen satellite data Parameters ----------- tag : (string or NoneType) Denotes type of file to load. Accepted types are '1min' and '5min'. (default=None) sat_id : (s...
def list_files(tag=None, sat_id=None, data_path=None, format_str=None): """Return a Pandas Series of every file for chosen satellite data Parameters ----------- tag : (string or NoneType) Denotes type of file to load. Accepted types are '1min' and '5min'. (default=None) sat_id : (s...
[ "Return", "a", "Pandas", "Series", "of", "every", "file", "for", "chosen", "satellite", "data" ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/omni_hro.py#L66-L110
[ "def", "list_files", "(", "tag", "=", "None", ",", "sat_id", "=", "None", ",", "data_path", "=", "None", ",", "format_str", "=", "None", ")", ":", "if", "format_str", "is", "None", "and", "data_path", "is", "not", "None", ":", "if", "(", "tag", "==",...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
time_shift_to_magnetic_poles
OMNI data is time-shifted to bow shock. Time shifted again to intersections with magnetic pole. Parameters ----------- inst : Instrument class object Instrument with OMNI HRO data Notes --------- Time shift calculated using distance to bow shock nose (BSN) and velocity of solar...
pysat/instruments/omni_hro.py
def time_shift_to_magnetic_poles(inst): """ OMNI data is time-shifted to bow shock. Time shifted again to intersections with magnetic pole. Parameters ----------- inst : Instrument class object Instrument with OMNI HRO data Notes --------- Time shift calculated using distance t...
def time_shift_to_magnetic_poles(inst): """ OMNI data is time-shifted to bow shock. Time shifted again to intersections with magnetic pole. Parameters ----------- inst : Instrument class object Instrument with OMNI HRO data Notes --------- Time shift calculated using distance t...
[ "OMNI", "data", "is", "time", "-", "shifted", "to", "bow", "shock", ".", "Time", "shifted", "again", "to", "intersections", "with", "magnetic", "pole", "." ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/omni_hro.py#L141-L186
[ "def", "time_shift_to_magnetic_poles", "(", "inst", ")", ":", "# need to fill in Vx to get an estimate of what is going on", "inst", "[", "'Vx'", "]", "=", "inst", "[", "'Vx'", "]", ".", "interpolate", "(", "'nearest'", ")", "inst", "[", "'Vx'", "]", "=", "inst", ...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
calculate_clock_angle
Calculate IMF clock angle and magnitude of IMF in GSM Y-Z plane Parameters ----------- inst : pysat.Instrument Instrument with OMNI HRO data
pysat/instruments/omni_hro.py
def calculate_clock_angle(inst): """ Calculate IMF clock angle and magnitude of IMF in GSM Y-Z plane Parameters ----------- inst : pysat.Instrument Instrument with OMNI HRO data """ # Calculate clock angle in degrees clock_angle = np.degrees(np.arctan2(inst['BY_GSM'], inst['BZ_...
def calculate_clock_angle(inst): """ Calculate IMF clock angle and magnitude of IMF in GSM Y-Z plane Parameters ----------- inst : pysat.Instrument Instrument with OMNI HRO data """ # Calculate clock angle in degrees clock_angle = np.degrees(np.arctan2(inst['BY_GSM'], inst['BZ_...
[ "Calculate", "IMF", "clock", "angle", "and", "magnitude", "of", "IMF", "in", "GSM", "Y", "-", "Z", "plane" ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/omni_hro.py#L240-L259
[ "def", "calculate_clock_angle", "(", "inst", ")", ":", "# Calculate clock angle in degrees", "clock_angle", "=", "np", ".", "degrees", "(", "np", ".", "arctan2", "(", "inst", "[", "'BY_GSM'", "]", ",", "inst", "[", "'BZ_GSM'", "]", ")", ")", "clock_angle", "...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
calculate_imf_steadiness
Calculate IMF steadiness using clock angle standard deviation and the coefficient of variation of the IMF magnitude in the GSM Y-Z plane Parameters ----------- inst : pysat.Instrument Instrument with OMNI HRO data steady_window : int Window for calculating running statistical moment...
pysat/instruments/omni_hro.py
def calculate_imf_steadiness(inst, steady_window=15, min_window_frac=0.75, max_clock_angle_std=90.0/np.pi, max_bmag_cv=0.5): """ Calculate IMF steadiness using clock angle standard deviation and the coefficient of variation of the IMF magnitude in the GSM Y-Z plane Parameters ...
def calculate_imf_steadiness(inst, steady_window=15, min_window_frac=0.75, max_clock_angle_std=90.0/np.pi, max_bmag_cv=0.5): """ Calculate IMF steadiness using clock angle standard deviation and the coefficient of variation of the IMF magnitude in the GSM Y-Z plane Parameters ...
[ "Calculate", "IMF", "steadiness", "using", "clock", "angle", "standard", "deviation", "and", "the", "coefficient", "of", "variation", "of", "the", "IMF", "magnitude", "in", "the", "GSM", "Y", "-", "Z", "plane" ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/omni_hro.py#L261-L329
[ "def", "calculate_imf_steadiness", "(", "inst", ",", "steady_window", "=", "15", ",", "min_window_frac", "=", "0.75", ",", "max_clock_angle_std", "=", "90.0", "/", "np", ".", "pi", ",", "max_bmag_cv", "=", "0.5", ")", ":", "# We are not going to interpolate throug...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
calculate_dayside_reconnection
Calculate the dayside reconnection rate (Milan et al. 2014) Parameters ----------- inst : pysat.Instrument Instrument with OMNI HRO data, requires BYZ_GSM and clock_angle Notes -------- recon_day = 3.8 Re (Vx / 4e5 m/s)^1/3 Vx B_yz (sin(theta/2))^9/2
pysat/instruments/omni_hro.py
def calculate_dayside_reconnection(inst): """ Calculate the dayside reconnection rate (Milan et al. 2014) Parameters ----------- inst : pysat.Instrument Instrument with OMNI HRO data, requires BYZ_GSM and clock_angle Notes -------- recon_day = 3.8 Re (Vx / 4e5 m/s)^1/3 Vx B_yz (sin...
def calculate_dayside_reconnection(inst): """ Calculate the dayside reconnection rate (Milan et al. 2014) Parameters ----------- inst : pysat.Instrument Instrument with OMNI HRO data, requires BYZ_GSM and clock_angle Notes -------- recon_day = 3.8 Re (Vx / 4e5 m/s)^1/3 Vx B_yz (sin...
[ "Calculate", "the", "dayside", "reconnection", "rate", "(", "Milan", "et", "al", ".", "2014", ")" ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/omni_hro.py#L331-L351
[ "def", "calculate_dayside_reconnection", "(", "inst", ")", ":", "rearth", "=", "6371008.8", "sin_htheta", "=", "np", ".", "power", "(", "np", ".", "sin", "(", "np", ".", "radians", "(", "0.5", "*", "inst", "[", "'clock_angle'", "]", ")", ")", ",", "4.5...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
UnityCifsShare.clear_access
clear all ace entries of the share :param white_list: list of username whose access entry won't be cleared :return: sid list of ace entries removed successfully
storops/unity/resource/cifs_share.py
def clear_access(self, white_list=None): """ clear all ace entries of the share :param white_list: list of username whose access entry won't be cleared :return: sid list of ace entries removed successfully """ access_entries = self.get_ace_list() sid_list = access_entrie...
def clear_access(self, white_list=None): """ clear all ace entries of the share :param white_list: list of username whose access entry won't be cleared :return: sid list of ace entries removed successfully """ access_entries = self.get_ace_list() sid_list = access_entrie...
[ "clear", "all", "ace", "entries", "of", "the", "share" ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/cifs_share.py#L114-L132
[ "def", "clear_access", "(", "self", ",", "white_list", "=", "None", ")", ":", "access_entries", "=", "self", ".", "get_ace_list", "(", ")", "sid_list", "=", "access_entries", ".", "sid_list", "if", "white_list", ":", "sid_white_list", "=", "[", "UnityAclUser",...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
UnityCifsShare.delete_ace
delete ACE for the share delete ACE for the share. User could either supply the domain and username or the sid of the user. :param domain: domain of the user :param user: username :param sid: sid of the user or sid list of the user :return: REST API response
storops/unity/resource/cifs_share.py
def delete_ace(self, domain=None, user=None, sid=None): """ delete ACE for the share delete ACE for the share. User could either supply the domain and username or the sid of the user. :param domain: domain of the user :param user: username :param sid: sid of the user o...
def delete_ace(self, domain=None, user=None, sid=None): """ delete ACE for the share delete ACE for the share. User could either supply the domain and username or the sid of the user. :param domain: domain of the user :param user: username :param sid: sid of the user o...
[ "delete", "ACE", "for", "the", "share" ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/cifs_share.py#L153-L175
[ "def", "delete_ace", "(", "self", ",", "domain", "=", "None", ",", "user", "=", "None", ",", "sid", "=", "None", ")", ":", "if", "sid", "is", "None", ":", "if", "domain", "is", "None", ":", "domain", "=", "self", ".", "cifs_server", ".", "domain", ...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
VNXIOClass.luns
Aggregator for ioclass_luns and ioclass_snapshots.
storops/vnx/resource/nqm.py
def luns(self): """Aggregator for ioclass_luns and ioclass_snapshots.""" lun_list, smp_list = [], [] if self.ioclass_luns: lun_list = map(lambda l: VNXLun(lun_id=l.lun_id, name=l.name, cli=self._cli), self.ioclass_luns) if self.iocl...
def luns(self): """Aggregator for ioclass_luns and ioclass_snapshots.""" lun_list, smp_list = [], [] if self.ioclass_luns: lun_list = map(lambda l: VNXLun(lun_id=l.lun_id, name=l.name, cli=self._cli), self.ioclass_luns) if self.iocl...
[ "Aggregator", "for", "ioclass_luns", "and", "ioclass_snapshots", "." ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/resource/nqm.py#L107-L116
[ "def", "luns", "(", "self", ")", ":", "lun_list", ",", "smp_list", "=", "[", "]", ",", "[", "]", "if", "self", ".", "ioclass_luns", ":", "lun_list", "=", "map", "(", "lambda", "l", ":", "VNXLun", "(", "lun_id", "=", "l", ".", "lun_id", ",", "name...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
VNXIOClass.policy
Returns policy which contains this ioclass.
storops/vnx/resource/nqm.py
def policy(self): """Returns policy which contains this ioclass.""" policies = VNXIOPolicy.get(cli=self._cli) ret = None for policy in policies: contained = policy.ioclasses.name if self._get_name() in contained: ret = VNXIOPolicy.get(name=policy.n...
def policy(self): """Returns policy which contains this ioclass.""" policies = VNXIOPolicy.get(cli=self._cli) ret = None for policy in policies: contained = policy.ioclasses.name if self._get_name() in contained: ret = VNXIOPolicy.get(name=policy.n...
[ "Returns", "policy", "which", "contains", "this", "ioclass", "." ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/resource/nqm.py#L119-L128
[ "def", "policy", "(", "self", ")", ":", "policies", "=", "VNXIOPolicy", ".", "get", "(", "cli", "=", "self", ".", "_cli", ")", "ret", "=", "None", "for", "policy", "in", "policies", ":", "contained", "=", "policy", ".", "ioclasses", ".", "name", "if"...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
VNXIOClass.modify
Overwrite the current properties for a VNX ioclass. :param new_name: new name for the ioclass :param iotype: can be 'rw', 'r' or 'w' :param lun_ids: list of LUN IDs :param smp_names: list of Snapshot Mount Point names :param ctrlmethod: the new CtrlMethod :param minsize:...
storops/vnx/resource/nqm.py
def modify(self, new_name=None, iotype=None, lun_ids=None, smp_names=None, ctrlmethod=None, minsize=None, maxsize=None): """Overwrite the current properties for a VNX ioclass. :param new_name: new name for the ioclass :param iotype: can be 'rw', 'r' or 'w' :param lun_ids:...
def modify(self, new_name=None, iotype=None, lun_ids=None, smp_names=None, ctrlmethod=None, minsize=None, maxsize=None): """Overwrite the current properties for a VNX ioclass. :param new_name: new name for the ioclass :param iotype: can be 'rw', 'r' or 'w' :param lun_ids:...
[ "Overwrite", "the", "current", "properties", "for", "a", "VNX", "ioclass", "." ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/resource/nqm.py#L143-L172
[ "def", "modify", "(", "self", ",", "new_name", "=", "None", ",", "iotype", "=", "None", ",", "lun_ids", "=", "None", ",", "smp_names", "=", "None", ",", "ctrlmethod", "=", "None", ",", "minsize", "=", "None", ",", "maxsize", "=", "None", ")", ":", ...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
VNXIOClass.add_lun
A wrapper for modify method. .. note:: This API only append luns to existing luns.
storops/vnx/resource/nqm.py
def add_lun(self, luns): """A wrapper for modify method. .. note:: This API only append luns to existing luns. """ curr_lun_ids, curr_smp_names = self._get_current_names() luns = normalize_lun(luns, self._cli) new_ids, new_smps = convert_lun(luns) if new_ids: ...
def add_lun(self, luns): """A wrapper for modify method. .. note:: This API only append luns to existing luns. """ curr_lun_ids, curr_smp_names = self._get_current_names() luns = normalize_lun(luns, self._cli) new_ids, new_smps = convert_lun(luns) if new_ids: ...
[ "A", "wrapper", "for", "modify", "method", "." ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/resource/nqm.py#L174-L186
[ "def", "add_lun", "(", "self", ",", "luns", ")", ":", "curr_lun_ids", ",", "curr_smp_names", "=", "self", ".", "_get_current_names", "(", ")", "luns", "=", "normalize_lun", "(", "luns", ",", "self", ".", "_cli", ")", "new_ids", ",", "new_smps", "=", "con...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
VNXIOPolicy.add_class
Add one VNXIOClass instance to policy. .. note: due to the limitation of VNX, need to stop the policy first.
storops/vnx/resource/nqm.py
def add_class(self, ioclass): """Add one VNXIOClass instance to policy. .. note: due to the limitation of VNX, need to stop the policy first. """ current_ioclasses = self.ioclasses if ioclass.name in current_ioclasses.name: return current_ioclasses.append(ioc...
def add_class(self, ioclass): """Add one VNXIOClass instance to policy. .. note: due to the limitation of VNX, need to stop the policy first. """ current_ioclasses = self.ioclasses if ioclass.name in current_ioclasses.name: return current_ioclasses.append(ioc...
[ "Add", "one", "VNXIOClass", "instance", "to", "policy", "." ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/resource/nqm.py#L280-L289
[ "def", "add_class", "(", "self", ",", "ioclass", ")", ":", "current_ioclasses", "=", "self", ".", "ioclasses", "if", "ioclass", ".", "name", "in", "current_ioclasses", ".", "name", ":", "return", "current_ioclasses", ".", "append", "(", "ioclass", ")", "self...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
VNXIOPolicy.remove_class
Remove VNXIOClass instance from policy.
storops/vnx/resource/nqm.py
def remove_class(self, ioclass): """Remove VNXIOClass instance from policy.""" current_ioclasses = self.ioclasses new_ioclasses = filter(lambda x: x.name != ioclass.name, current_ioclasses) self.modify(new_ioclasses=new_ioclasses)
def remove_class(self, ioclass): """Remove VNXIOClass instance from policy.""" current_ioclasses = self.ioclasses new_ioclasses = filter(lambda x: x.name != ioclass.name, current_ioclasses) self.modify(new_ioclasses=new_ioclasses)
[ "Remove", "VNXIOClass", "instance", "from", "policy", "." ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/resource/nqm.py#L291-L296
[ "def", "remove_class", "(", "self", ",", "ioclass", ")", ":", "current_ioclasses", "=", "self", ".", "ioclasses", "new_ioclasses", "=", "filter", "(", "lambda", "x", ":", "x", ".", "name", "!=", "ioclass", ".", "name", ",", "current_ioclasses", ")", "self"...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
UnityConsistencyGroup.replace_lun
Replaces the exiting LUNs to lun_list.
storops/unity/resource/cg.py
def replace_lun(self, *lun_list): """Replaces the exiting LUNs to lun_list.""" lun_add = self._prepare_luns_add(lun_list) lun_remove = self._prepare_luns_remove(lun_list, False) return self.modify(lun_add=lun_add, lun_remove=lun_remove)
def replace_lun(self, *lun_list): """Replaces the exiting LUNs to lun_list.""" lun_add = self._prepare_luns_add(lun_list) lun_remove = self._prepare_luns_remove(lun_list, False) return self.modify(lun_add=lun_add, lun_remove=lun_remove)
[ "Replaces", "the", "exiting", "LUNs", "to", "lun_list", "." ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/cg.py#L208-L212
[ "def", "replace_lun", "(", "self", ",", "*", "lun_list", ")", ":", "lun_add", "=", "self", ".", "_prepare_luns_add", "(", "lun_list", ")", "lun_remove", "=", "self", ".", "_prepare_luns_remove", "(", "lun_list", ",", "False", ")", "return", "self", ".", "m...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
UnityConsistencyGroup.update_lun
Updates the LUNs in CG, adding the ones in `add_luns` and removing the ones in `remove_luns`
storops/unity/resource/cg.py
def update_lun(self, add_luns=None, remove_luns=None): """Updates the LUNs in CG, adding the ones in `add_luns` and removing the ones in `remove_luns`""" if not add_luns and not remove_luns: log.debug("Empty add_luns and remove_luns passed in, " "skip update_lun...
def update_lun(self, add_luns=None, remove_luns=None): """Updates the LUNs in CG, adding the ones in `add_luns` and removing the ones in `remove_luns`""" if not add_luns and not remove_luns: log.debug("Empty add_luns and remove_luns passed in, " "skip update_lun...
[ "Updates", "the", "LUNs", "in", "CG", "adding", "the", "ones", "in", "add_luns", "and", "removing", "the", "ones", "in", "remove_luns" ]
emc-openstack/storops
python
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/cg.py#L214-L223
[ "def", "update_lun", "(", "self", ",", "add_luns", "=", "None", ",", "remove_luns", "=", "None", ")", ":", "if", "not", "add_luns", "and", "not", "remove_luns", ":", "log", ".", "debug", "(", "\"Empty add_luns and remove_luns passed in, \"", "\"skip update_lun.\""...
24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd
train
clean
Routine to return FPMU data cleaned to the specified level Parameters ----------- inst : (pysat.Instrument) Instrument class object, whose attribute clean_level is used to return the desired level of data selectivity. Returns -------- Void : (NoneType) data in inst is m...
pysat/instruments/iss_fpmu.py
def clean(inst): """Routine to return FPMU data cleaned to the specified level Parameters ----------- inst : (pysat.Instrument) Instrument class object, whose attribute clean_level is used to return the desired level of data selectivity. Returns -------- Void : (NoneType) ...
def clean(inst): """Routine to return FPMU data cleaned to the specified level Parameters ----------- inst : (pysat.Instrument) Instrument class object, whose attribute clean_level is used to return the desired level of data selectivity. Returns -------- Void : (NoneType) ...
[ "Routine", "to", "return", "FPMU", "data", "cleaned", "to", "the", "specified", "level" ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/iss_fpmu.py#L59-L81
[ "def", "clean", "(", "inst", ")", ":", "inst", ".", "data", ".", "replace", "(", "-", "999.", ",", "np", ".", "nan", ",", "inplace", "=", "True", ")", "# Te", "inst", ".", "data", ".", "replace", "(", "-", "9.9999998e+30", ",", "np", ".", "nan", ...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Files._attach_files
Attaches info returned by instrument list_files routine to Instrument object.
pysat/_files.py
def _attach_files(self, files_info): """Attaches info returned by instrument list_files routine to Instrument object. """ if not files_info.empty: if (len(files_info.index.unique()) != len(files_info)): estr = 'WARNING! Duplicate datetimes in provided file ' ...
def _attach_files(self, files_info): """Attaches info returned by instrument list_files routine to Instrument object. """ if not files_info.empty: if (len(files_info.index.unique()) != len(files_info)): estr = 'WARNING! Duplicate datetimes in provided file ' ...
[ "Attaches", "info", "returned", "by", "instrument", "list_files", "routine", "to", "Instrument", "object", "." ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_files.py#L141-L168
[ "def", "_attach_files", "(", "self", ",", "files_info", ")", ":", "if", "not", "files_info", ".", "empty", ":", "if", "(", "len", "(", "files_info", ".", "index", ".", "unique", "(", ")", ")", "!=", "len", "(", "files_info", ")", ")", ":", "estr", ...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Files._store
Store currently loaded filelist for instrument onto filesystem
pysat/_files.py
def _store(self): """Store currently loaded filelist for instrument onto filesystem""" name = self.stored_file_name # check if current file data is different than stored file list # if so, move file list to previous file list, store current to file # if not, do nothing s...
def _store(self): """Store currently loaded filelist for instrument onto filesystem""" name = self.stored_file_name # check if current file data is different than stored file list # if so, move file list to previous file list, store current to file # if not, do nothing s...
[ "Store", "currently", "loaded", "filelist", "for", "instrument", "onto", "filesystem" ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_files.py#L170-L200
[ "def", "_store", "(", "self", ")", ":", "name", "=", "self", ".", "stored_file_name", "# check if current file data is different than stored file list", "# if so, move file list to previous file list, store current to file", "# if not, do nothing", "stored_files", "=", "self", ".",...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Files._load
Load stored filelist and return as Pandas Series Parameters ---------- prev_version : boolean if True, will load previous version of file list Returns ------- pandas.Series Full path file names are indexed by datetime Series is empty ...
pysat/_files.py
def _load(self, prev_version=False): """Load stored filelist and return as Pandas Series Parameters ---------- prev_version : boolean if True, will load previous version of file list Returns ------- pandas.Series Full path file names are ...
def _load(self, prev_version=False): """Load stored filelist and return as Pandas Series Parameters ---------- prev_version : boolean if True, will load previous version of file list Returns ------- pandas.Series Full path file names are ...
[ "Load", "stored", "filelist", "and", "return", "as", "Pandas", "Series" ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_files.py#L202-L234
[ "def", "_load", "(", "self", ",", "prev_version", "=", "False", ")", ":", "fname", "=", "self", ".", "stored_file_name", "if", "prev_version", ":", "fname", "=", "os", ".", "path", ".", "join", "(", "self", ".", "home_path", ",", "'previous_'", "+", "f...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Files.refresh
Update list of files, if there are changes. Calls underlying list_rtn for the particular science instrument. Typically, these routines search in the pysat provided path, pysat_data_dir/platform/name/tag/, where pysat_data_dir is set by pysat.utils.set_data_dir(path=path).
pysat/_files.py
def refresh(self): """Update list of files, if there are changes. Calls underlying list_rtn for the particular science instrument. Typically, these routines search in the pysat provided path, pysat_data_dir/platform/name/tag/, where pysat_data_dir is set by pysat.utils.s...
def refresh(self): """Update list of files, if there are changes. Calls underlying list_rtn for the particular science instrument. Typically, these routines search in the pysat provided path, pysat_data_dir/platform/name/tag/, where pysat_data_dir is set by pysat.utils.s...
[ "Update", "list", "of", "files", "if", "there", "are", "changes", ".", "Calls", "underlying", "list_rtn", "for", "the", "particular", "science", "instrument", ".", "Typically", "these", "routines", "search", "in", "the", "pysat", "provided", "path", "pysat_data_...
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_files.py#L237-L269
[ "def", "refresh", "(", "self", ")", ":", "output_str", "=", "'{platform} {name} {tag} {sat_id}'", "output_str", "=", "output_str", ".", "format", "(", "platform", "=", "self", ".", "_sat", ".", "platform", ",", "name", "=", "self", ".", "_sat", ".", "name", ...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Files.get_new
List new files since last recorded file state. pysat stores filenames in the user_home/.pysat directory. Returns a list of all new fileanmes since the last known change to files. Filenames are stored if there is a change and either update_files is True at instrument object level...
pysat/_files.py
def get_new(self): """List new files since last recorded file state. pysat stores filenames in the user_home/.pysat directory. Returns a list of all new fileanmes since the last known change to files. Filenames are stored if there is a change and either update_files is T...
def get_new(self): """List new files since last recorded file state. pysat stores filenames in the user_home/.pysat directory. Returns a list of all new fileanmes since the last known change to files. Filenames are stored if there is a change and either update_files is T...
[ "List", "new", "files", "since", "last", "recorded", "file", "state", ".", "pysat", "stores", "filenames", "in", "the", "user_home", "/", ".", "pysat", "directory", ".", "Returns", "a", "list", "of", "all", "new", "fileanmes", "since", "the", "last", "know...
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_files.py#L271-L293
[ "def", "get_new", "(", "self", ")", ":", "# refresh files", "self", ".", "refresh", "(", ")", "# current files", "new_info", "=", "self", ".", "_load", "(", ")", "# previous set of files", "old_info", "=", "self", ".", "_load", "(", "prev_version", "=", "Tru...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Files.get_index
Return index for a given filename. Parameters ---------- fname : string filename Note ---- If fname not found in the file information already attached to the instrument.files instance, then a files.refresh() call is made.
pysat/_files.py
def get_index(self, fname): """Return index for a given filename. Parameters ---------- fname : string filename Note ---- If fname not found in the file information already attached to the instrument.files instance, then a f...
def get_index(self, fname): """Return index for a given filename. Parameters ---------- fname : string filename Note ---- If fname not found in the file information already attached to the instrument.files instance, then a f...
[ "Return", "index", "for", "a", "given", "filename", ".", "Parameters", "----------", "fname", ":", "string", "filename", "Note", "----", "If", "fname", "not", "found", "in", "the", "file", "information", "already", "attached", "to", "the", "instrument", ".", ...
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_files.py#L314-L343
[ "def", "get_index", "(", "self", ",", "fname", ")", ":", "idx", ",", "=", "np", ".", "where", "(", "fname", "==", "self", ".", "files", ")", "if", "len", "(", "idx", ")", "==", "0", ":", "# filename not in index, try reloading files from disk", "self", "...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Files.get_file_array
Return a list of filenames between and including start and end. Parameters ---------- start: array_like or single string filenames for start of returned filelist stop: array_like or single string filenames inclusive end of list ...
pysat/_files.py
def get_file_array(self, start, end): """Return a list of filenames between and including start and end. Parameters ---------- start: array_like or single string filenames for start of returned filelist stop: array_like or single string ...
def get_file_array(self, start, end): """Return a list of filenames between and including start and end. Parameters ---------- start: array_like or single string filenames for start of returned filelist stop: array_like or single string ...
[ "Return", "a", "list", "of", "filenames", "between", "and", "including", "start", "and", "end", ".", "Parameters", "----------", "start", ":", "array_like", "or", "single", "string", "filenames", "for", "start", "of", "returned", "filelist", "stop", ":", "arra...
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_files.py#L382-L411
[ "def", "get_file_array", "(", "self", ",", "start", ",", "end", ")", ":", "if", "hasattr", "(", "start", ",", "'__iter__'", ")", "&", "hasattr", "(", "end", ",", "'__iter__'", ")", ":", "files", "=", "[", "]", "for", "(", "sta", ",", "stp", ")", ...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Files._remove_data_dir_path
Remove the data directory path from filenames
pysat/_files.py
def _remove_data_dir_path(self, inp=None): # import string """Remove the data directory path from filenames""" # need to add a check in here to make sure data_dir path is actually in # the filename if inp is not None: split_str = os.path.join(self.data_path, '') ...
def _remove_data_dir_path(self, inp=None): # import string """Remove the data directory path from filenames""" # need to add a check in here to make sure data_dir path is actually in # the filename if inp is not None: split_str = os.path.join(self.data_path, '') ...
[ "Remove", "the", "data", "directory", "path", "from", "filenames" ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_files.py#L413-L420
[ "def", "_remove_data_dir_path", "(", "self", ",", "inp", "=", "None", ")", ":", "# import string", "# need to add a check in here to make sure data_dir path is actually in", "# the filename", "if", "inp", "is", "not", "None", ":", "split_str", "=", "os", ".", "path", ...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Files.from_os
Produces a list of files and and formats it for Files class. Requires fixed_width filename Parameters ---------- data_path : string Top level directory to search files for. This directory is provided by pysat to the instrument_module.list_files ...
pysat/_files.py
def from_os(cls, data_path=None, format_str=None, two_digit_year_break=None): """ Produces a list of files and and formats it for Files class. Requires fixed_width filename Parameters ---------- data_path : string Top level directory...
def from_os(cls, data_path=None, format_str=None, two_digit_year_break=None): """ Produces a list of files and and formats it for Files class. Requires fixed_width filename Parameters ---------- data_path : string Top level directory...
[ "Produces", "a", "list", "of", "files", "and", "and", "formats", "it", "for", "Files", "class", "." ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_files.py#L431-L599
[ "def", "from_os", "(", "cls", ",", "data_path", "=", "None", ",", "format_str", "=", "None", ",", "two_digit_year_break", "=", "None", ")", ":", "import", "collections", "from", "pysat", ".", "utils", "import", "create_datetime_index", "if", "format_str", "is"...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Meta.merge
Adds metadata variables to self that are in other but not in self. Parameters ---------- other : pysat.Meta
pysat/_meta.py
def merge(self, other): """Adds metadata variables to self that are in other but not in self. Parameters ---------- other : pysat.Meta """ for key in other.keys(): if key not in self: # copies over both lower and high...
def merge(self, other): """Adds metadata variables to self that are in other but not in self. Parameters ---------- other : pysat.Meta """ for key in other.keys(): if key not in self: # copies over both lower and high...
[ "Adds", "metadata", "variables", "to", "self", "that", "are", "in", "other", "but", "not", "in", "self", ".", "Parameters", "----------", "other", ":", "pysat", ".", "Meta" ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_meta.py#L240-L252
[ "def", "merge", "(", "self", ",", "other", ")", ":", "for", "key", "in", "other", ".", "keys", "(", ")", ":", "if", "key", "not", "in", "self", ":", "# copies over both lower and higher dimensional data", "self", "[", "key", "]", "=", "other", "[", "key"...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Meta.drop
Drops variables (names) from metadata.
pysat/_meta.py
def drop(self, names): """Drops variables (names) from metadata.""" # drop lower dimension data self._data = self._data.drop(names, axis=0) # drop higher dimension data for name in names: if name in self._ho_data: _ = self._ho_data.pop(name)
def drop(self, names): """Drops variables (names) from metadata.""" # drop lower dimension data self._data = self._data.drop(names, axis=0) # drop higher dimension data for name in names: if name in self._ho_data: _ = self._ho_data.pop(name)
[ "Drops", "variables", "(", "names", ")", "from", "metadata", "." ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_meta.py#L254-L262
[ "def", "drop", "(", "self", ",", "names", ")", ":", "# drop lower dimension data", "self", ".", "_data", "=", "self", ".", "_data", ".", "drop", "(", "names", ",", "axis", "=", "0", ")", "# drop higher dimension data", "for", "name", "in", "names", ":", ...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Meta.keep
Keeps variables (keep_names) while dropping other parameters
pysat/_meta.py
def keep(self, keep_names): """Keeps variables (keep_names) while dropping other parameters""" current_names = self._data.columns drop_names = [] for name in current_names: if name not in keep_names: drop_names.append(name) self.drop(drop_name...
def keep(self, keep_names): """Keeps variables (keep_names) while dropping other parameters""" current_names = self._data.columns drop_names = [] for name in current_names: if name not in keep_names: drop_names.append(name) self.drop(drop_name...
[ "Keeps", "variables", "(", "keep_names", ")", "while", "dropping", "other", "parameters" ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_meta.py#L264-L272
[ "def", "keep", "(", "self", ",", "keep_names", ")", ":", "current_names", "=", "self", ".", "_data", ".", "columns", "drop_names", "=", "[", "]", "for", "name", "in", "current_names", ":", "if", "name", "not", "in", "keep_names", ":", "drop_names", ".", ...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Meta.apply_default_labels
Applies labels for default meta labels from self onto other. Parameters ---------- other : Meta Meta object to have default labels applied Returns ------- Meta
pysat/_meta.py
def apply_default_labels(self, other): """Applies labels for default meta labels from self onto other. Parameters ---------- other : Meta Meta object to have default labels applied Returns ------- Meta """ oth...
def apply_default_labels(self, other): """Applies labels for default meta labels from self onto other. Parameters ---------- other : Meta Meta object to have default labels applied Returns ------- Meta """ oth...
[ "Applies", "labels", "for", "default", "meta", "labels", "from", "self", "onto", "other", ".", "Parameters", "----------", "other", ":", "Meta", "Meta", "object", "to", "have", "default", "labels", "applied", "Returns", "-------", "Meta" ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_meta.py#L307-L331
[ "def", "apply_default_labels", "(", "self", ",", "other", ")", ":", "other_updated", "=", "other", ".", "copy", "(", ")", "other_updated", ".", "units_label", "=", "self", ".", "units_label", "other_updated", ".", "name_label", "=", "self", ".", "name_label", ...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Meta.accept_default_labels
Applies labels for default meta labels from other onto self. Parameters ---------- other : Meta Meta object to take default labels from Returns ------- Meta
pysat/_meta.py
def accept_default_labels(self, other): """Applies labels for default meta labels from other onto self. Parameters ---------- other : Meta Meta object to take default labels from Returns ------- Meta """ self...
def accept_default_labels(self, other): """Applies labels for default meta labels from other onto self. Parameters ---------- other : Meta Meta object to take default labels from Returns ------- Meta """ self...
[ "Applies", "labels", "for", "default", "meta", "labels", "from", "other", "onto", "self", ".", "Parameters", "----------", "other", ":", "Meta", "Meta", "object", "to", "take", "default", "labels", "from", "Returns", "-------", "Meta" ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_meta.py#L333-L357
[ "def", "accept_default_labels", "(", "self", ",", "other", ")", ":", "self", ".", "units_label", "=", "other", ".", "units_label", "self", ".", "name_label", "=", "other", ".", "name_label", "self", ".", "notes_label", "=", "other", ".", "notes_label", "self...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Meta._label_setter
Generalized setter of default meta attributes Parameters ---------- new_label : str New label to use in the Meta object current_label : str The hidden attribute to be updated that actually stores metadata default : Deafult setting to ...
pysat/_meta.py
def _label_setter(self, new_label, current_label, attr_label, default=np.NaN, use_names_default=False): """Generalized setter of default meta attributes Parameters ---------- new_label : str New label to use in the Meta object current_label : str ...
def _label_setter(self, new_label, current_label, attr_label, default=np.NaN, use_names_default=False): """Generalized setter of default meta attributes Parameters ---------- new_label : str New label to use in the Meta object current_label : str ...
[ "Generalized", "setter", "of", "default", "meta", "attributes", "Parameters", "----------", "new_label", ":", "str", "New", "label", "to", "use", "in", "the", "Meta", "object", "current_label", ":", "str", "The", "hidden", "attribute", "to", "be", "updated", "...
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_meta.py#L574-L631
[ "def", "_label_setter", "(", "self", ",", "new_label", ",", "current_label", ",", "attr_label", ",", "default", "=", "np", ".", "NaN", ",", "use_names_default", "=", "False", ")", ":", "if", "new_label", "not", "in", "self", ".", "attrs", "(", ")", ":", ...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Meta.var_case_name
Provides stored name (case preserved) for case insensitive input If name is not found (case-insensitive check) then name is returned, as input. This function is intended to be used to help ensure the case of a given variable name is the same across the Meta object. Para...
pysat/_meta.py
def var_case_name(self, name): """Provides stored name (case preserved) for case insensitive input If name is not found (case-insensitive check) then name is returned, as input. This function is intended to be used to help ensure the case of a given variable name is the same acr...
def var_case_name(self, name): """Provides stored name (case preserved) for case insensitive input If name is not found (case-insensitive check) then name is returned, as input. This function is intended to be used to help ensure the case of a given variable name is the same acr...
[ "Provides", "stored", "name", "(", "case", "preserved", ")", "for", "case", "insensitive", "input", "If", "name", "is", "not", "found", "(", "case", "-", "insensitive", "check", ")", "then", "name", "is", "returned", "as", "input", ".", "This", "function",...
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_meta.py#L704-L731
[ "def", "var_case_name", "(", "self", ",", "name", ")", ":", "lower_name", "=", "name", ".", "lower", "(", ")", "if", "name", "in", "self", ":", "for", "i", "in", "self", ".", "keys", "(", ")", ":", "if", "lower_name", "==", "i", ".", "lower", "("...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Meta.has_attr
Returns boolean indicating presence of given attribute name Case-insensitive check Notes ----- Does not check higher order meta objects Parameters ---------- name : str name of variable to get stored case form ...
pysat/_meta.py
def has_attr(self, name): """Returns boolean indicating presence of given attribute name Case-insensitive check Notes ----- Does not check higher order meta objects Parameters ---------- name : str name of variable to...
def has_attr(self, name): """Returns boolean indicating presence of given attribute name Case-insensitive check Notes ----- Does not check higher order meta objects Parameters ---------- name : str name of variable to...
[ "Returns", "boolean", "indicating", "presence", "of", "given", "attribute", "name", "Case", "-", "insensitive", "check", "Notes", "-----", "Does", "not", "check", "higher", "order", "meta", "objects", "Parameters", "----------", "name", ":", "str", "name", "of",...
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_meta.py#L751-L774
[ "def", "has_attr", "(", "self", ",", "name", ")", ":", "if", "name", ".", "lower", "(", ")", "in", "[", "i", ".", "lower", "(", ")", "for", "i", "in", "self", ".", "data", ".", "columns", "]", ":", "return", "True", "return", "False" ]
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Meta.attr_case_name
Returns preserved case name for case insensitive value of name. Checks first within standard attributes. If not found there, checks attributes for higher order data structures. If not found, returns supplied name as it is available for use. Intended to be used to help ensure tha...
pysat/_meta.py
def attr_case_name(self, name): """Returns preserved case name for case insensitive value of name. Checks first within standard attributes. If not found there, checks attributes for higher order data structures. If not found, returns supplied name as it is available for use. Int...
def attr_case_name(self, name): """Returns preserved case name for case insensitive value of name. Checks first within standard attributes. If not found there, checks attributes for higher order data structures. If not found, returns supplied name as it is available for use. Int...
[ "Returns", "preserved", "case", "name", "for", "case", "insensitive", "value", "of", "name", ".", "Checks", "first", "within", "standard", "attributes", ".", "If", "not", "found", "there", "checks", "attributes", "for", "higher", "order", "data", "structures", ...
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_meta.py#L776-L807
[ "def", "attr_case_name", "(", "self", ",", "name", ")", ":", "lower_name", "=", "name", ".", "lower", "(", ")", "for", "i", "in", "self", ".", "attrs", "(", ")", ":", "if", "lower_name", "==", "i", ".", "lower", "(", ")", ":", "return", "i", "# c...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Meta.concat
Concats two metadata objects together. Parameters ---------- other : Meta Meta object to be concatenated strict : bool if True, ensure there are no duplicate variable names Notes ----- Uses units and name label of self if other is differe...
pysat/_meta.py
def concat(self, other, strict=False): """Concats two metadata objects together. Parameters ---------- other : Meta Meta object to be concatenated strict : bool if True, ensure there are no duplicate variable names Notes ----- Use...
def concat(self, other, strict=False): """Concats two metadata objects together. Parameters ---------- other : Meta Meta object to be concatenated strict : bool if True, ensure there are no duplicate variable names Notes ----- Use...
[ "Concats", "two", "metadata", "objects", "together", "." ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_meta.py#L809-L859
[ "def", "concat", "(", "self", ",", "other", ",", "strict", "=", "False", ")", ":", "mdata", "=", "self", ".", "copy", "(", ")", "# checks", "if", "strict", ":", "for", "key", "in", "other", ".", "keys", "(", ")", ":", "if", "key", "in", "mdata", ...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Meta.pop
Remove and return metadata about variable Parameters ---------- name : str variable name Returns ------- pandas.Series Series of metadata for variable
pysat/_meta.py
def pop(self, name): """Remove and return metadata about variable Parameters ---------- name : str variable name Returns ------- pandas.Series Series of metadata for variable """ # check if present if name in self:...
def pop(self, name): """Remove and return metadata about variable Parameters ---------- name : str variable name Returns ------- pandas.Series Series of metadata for variable """ # check if present if name in self:...
[ "Remove", "and", "return", "metadata", "about", "variable" ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_meta.py#L866-L892
[ "def", "pop", "(", "self", ",", "name", ")", ":", "# check if present", "if", "name", "in", "self", ":", "# get case preserved name for variable", "new_name", "=", "self", ".", "var_case_name", "(", "name", ")", "# check if 1D or nD", "if", "new_name", "in", "se...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Meta.transfer_attributes_to_instrument
Transfer non-standard attributes in Meta to Instrument object. Pysat's load_netCDF and similar routines are only able to attach netCDF4 attributes to a Meta object. This routine identifies these attributes and removes them from the Meta object. Intent is to support simple transfers to ...
pysat/_meta.py
def transfer_attributes_to_instrument(self, inst, strict_names=False): """Transfer non-standard attributes in Meta to Instrument object. Pysat's load_netCDF and similar routines are only able to attach netCDF4 attributes to a Meta object. This routine identifies these attributes and rem...
def transfer_attributes_to_instrument(self, inst, strict_names=False): """Transfer non-standard attributes in Meta to Instrument object. Pysat's load_netCDF and similar routines are only able to attach netCDF4 attributes to a Meta object. This routine identifies these attributes and rem...
[ "Transfer", "non", "-", "standard", "attributes", "in", "Meta", "to", "Instrument", "object", "." ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_meta.py#L895-L951
[ "def", "transfer_attributes_to_instrument", "(", "self", ",", "inst", ",", "strict_names", "=", "False", ")", ":", "# base Instrument attributes", "banned", "=", "inst", ".", "_base_attr", "# get base attribute set, and attributes attached to instance", "base_attrb", "=", "...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
Meta.from_csv
Create instrument metadata object from csv. Parameters ---------- name : string absolute filename for csv file or name of file stored in pandas instruments location col_names : list-like collection of strings column names in csv and resultant meta obj...
pysat/_meta.py
def from_csv(cls, name=None, col_names=None, sep=None, **kwargs): """Create instrument metadata object from csv. Parameters ---------- name : string absolute filename for csv file or name of file stored in pandas instruments location col_names : list-like...
def from_csv(cls, name=None, col_names=None, sep=None, **kwargs): """Create instrument metadata object from csv. Parameters ---------- name : string absolute filename for csv file or name of file stored in pandas instruments location col_names : list-like...
[ "Create", "instrument", "metadata", "object", "from", "csv", "." ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_meta.py#L1047-L1102
[ "def", "from_csv", "(", "cls", ",", "name", "=", "None", ",", "col_names", "=", "None", ",", "sep", "=", "None", ",", "*", "*", "kwargs", ")", ":", "import", "pysat", "req_names", "=", "[", "'name'", ",", "'long_name'", ",", "'units'", "]", "if", "...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
clean
Routine to return C/NOFS IVM data cleaned to the specified level Parameters ----------- inst : (pysat.Instrument) Instrument class object, whose attribute clean_level is used to return the desired level of data selectivity. Returns -------- Void : (NoneType) data in ins...
pysat/instruments/cnofs_ivm.py
def clean(self): """Routine to return C/NOFS IVM data cleaned to the specified level Parameters ----------- inst : (pysat.Instrument) Instrument class object, whose attribute clean_level is used to return the desired level of data selectivity. Returns -------- Void : (NoneT...
def clean(self): """Routine to return C/NOFS IVM data cleaned to the specified level Parameters ----------- inst : (pysat.Instrument) Instrument class object, whose attribute clean_level is used to return the desired level of data selectivity. Returns -------- Void : (NoneT...
[ "Routine", "to", "return", "C", "/", "NOFS", "IVM", "data", "cleaned", "to", "the", "specified", "level" ]
rstoneback/pysat
python
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/cnofs_ivm.py#L67-L130
[ "def", "clean", "(", "self", ")", ":", "# cleans cindi data", "if", "self", ".", "clean_level", "==", "'clean'", ":", "# choose areas below 550km", "# self.data = self.data[self.data.alt <= 550]", "idx", ",", "=", "np", ".", "where", "(", "self", ".", "data", ".",...
4ae1afd80e15e4449397d39dce8c3e969c32c422
train
nonraw_instance
A signal receiver decorator that fetch the complete instance from db when it's passed as raw
mutant/management/__init__.py
def nonraw_instance(receiver): """ A signal receiver decorator that fetch the complete instance from db when it's passed as raw """ @wraps(receiver) def wrapper(sender, instance, raw, using, **kwargs): if raw: instance = sender._default_manager.using(using).get(pk=instance.pk...
def nonraw_instance(receiver): """ A signal receiver decorator that fetch the complete instance from db when it's passed as raw """ @wraps(receiver) def wrapper(sender, instance, raw, using, **kwargs): if raw: instance = sender._default_manager.using(using).get(pk=instance.pk...
[ "A", "signal", "receiver", "decorator", "that", "fetch", "the", "complete", "instance", "from", "db", "when", "it", "s", "passed", "as", "raw" ]
charettes/django-mutant
python
https://github.com/charettes/django-mutant/blob/865a1b712ce30501901c4691ce2110ab03f0f93b/mutant/management/__init__.py#L24-L35
[ "def", "nonraw_instance", "(", "receiver", ")", ":", "@", "wraps", "(", "receiver", ")", "def", "wrapper", "(", "sender", ",", "instance", ",", "raw", ",", "using", ",", "*", "*", "kwargs", ")", ":", "if", "raw", ":", "instance", "=", "sender", ".", ...
865a1b712ce30501901c4691ce2110ab03f0f93b
train
base_definition_pre_delete
This is used to pass data required for deletion to the post_delete signal that is no more available thereafter.
mutant/management/__init__.py
def base_definition_pre_delete(sender, instance, **kwargs): """ This is used to pass data required for deletion to the post_delete signal that is no more available thereafter. """ # see CASCADE_MARK_ORIGIN's docstring cascade_deletion_origin = popattr( instance._state, '_cascade_deletion...
def base_definition_pre_delete(sender, instance, **kwargs): """ This is used to pass data required for deletion to the post_delete signal that is no more available thereafter. """ # see CASCADE_MARK_ORIGIN's docstring cascade_deletion_origin = popattr( instance._state, '_cascade_deletion...
[ "This", "is", "used", "to", "pass", "data", "required", "for", "deletion", "to", "the", "post_delete", "signal", "that", "is", "no", "more", "available", "thereafter", "." ]
charettes/django-mutant
python
https://github.com/charettes/django-mutant/blob/865a1b712ce30501901c4691ce2110ab03f0f93b/mutant/management/__init__.py#L132-L145
[ "def", "base_definition_pre_delete", "(", "sender", ",", "instance", ",", "*", "*", "kwargs", ")", ":", "# see CASCADE_MARK_ORIGIN's docstring", "cascade_deletion_origin", "=", "popattr", "(", "instance", ".", "_state", ",", "'_cascade_deletion_origin'", ",", "None", ...
865a1b712ce30501901c4691ce2110ab03f0f93b
train
base_definition_post_delete
Make sure to delete fields inherited from an abstract model base.
mutant/management/__init__.py
def base_definition_post_delete(sender, instance, **kwargs): """ Make sure to delete fields inherited from an abstract model base. """ if hasattr(instance._state, '_deletion'): # Make sure to flatten abstract bases since Django # migrations can't deal with them. model = popattr(i...
def base_definition_post_delete(sender, instance, **kwargs): """ Make sure to delete fields inherited from an abstract model base. """ if hasattr(instance._state, '_deletion'): # Make sure to flatten abstract bases since Django # migrations can't deal with them. model = popattr(i...
[ "Make", "sure", "to", "delete", "fields", "inherited", "from", "an", "abstract", "model", "base", "." ]
charettes/django-mutant
python
https://github.com/charettes/django-mutant/blob/865a1b712ce30501901c4691ce2110ab03f0f93b/mutant/management/__init__.py#L148-L157
[ "def", "base_definition_post_delete", "(", "sender", ",", "instance", ",", "*", "*", "kwargs", ")", ":", "if", "hasattr", "(", "instance", ".", "_state", ",", "'_deletion'", ")", ":", "# Make sure to flatten abstract bases since Django", "# migrations can't deal with th...
865a1b712ce30501901c4691ce2110ab03f0f93b
train
raw_field_definition_proxy_post_save
When proxy field definitions are loaded from a fixture they're not passing through the `field_definition_post_save` signal. Make sure they are.
mutant/management/__init__.py
def raw_field_definition_proxy_post_save(sender, instance, raw, **kwargs): """ When proxy field definitions are loaded from a fixture they're not passing through the `field_definition_post_save` signal. Make sure they are. """ if raw: model_class = instance.content_type.model_class() ...
def raw_field_definition_proxy_post_save(sender, instance, raw, **kwargs): """ When proxy field definitions are loaded from a fixture they're not passing through the `field_definition_post_save` signal. Make sure they are. """ if raw: model_class = instance.content_type.model_class() ...
[ "When", "proxy", "field", "definitions", "are", "loaded", "from", "a", "fixture", "they", "re", "not", "passing", "through", "the", "field_definition_post_save", "signal", ".", "Make", "sure", "they", "are", "." ]
charettes/django-mutant
python
https://github.com/charettes/django-mutant/blob/865a1b712ce30501901c4691ce2110ab03f0f93b/mutant/management/__init__.py#L172-L185
[ "def", "raw_field_definition_proxy_post_save", "(", "sender", ",", "instance", ",", "raw", ",", "*", "*", "kwargs", ")", ":", "if", "raw", ":", "model_class", "=", "instance", ".", "content_type", ".", "model_class", "(", ")", "opts", "=", "model_class", "."...
865a1b712ce30501901c4691ce2110ab03f0f93b
train
field_definition_post_save
This signal is connected by all FieldDefinition subclasses see comment in FieldDefinitionBase for more details
mutant/management/__init__.py
def field_definition_post_save(sender, instance, created, raw, **kwargs): """ This signal is connected by all FieldDefinition subclasses see comment in FieldDefinitionBase for more details """ model_class = instance.model_def.model_class().render_state() field = instance.construct_for_migrate() ...
def field_definition_post_save(sender, instance, created, raw, **kwargs): """ This signal is connected by all FieldDefinition subclasses see comment in FieldDefinitionBase for more details """ model_class = instance.model_def.model_class().render_state() field = instance.construct_for_migrate() ...
[ "This", "signal", "is", "connected", "by", "all", "FieldDefinition", "subclasses", "see", "comment", "in", "FieldDefinitionBase", "for", "more", "details" ]
charettes/django-mutant
python
https://github.com/charettes/django-mutant/blob/865a1b712ce30501901c4691ce2110ab03f0f93b/mutant/management/__init__.py#L189-L211
[ "def", "field_definition_post_save", "(", "sender", ",", "instance", ",", "created", ",", "raw", ",", "*", "*", "kwargs", ")", ":", "model_class", "=", "instance", ".", "model_def", ".", "model_class", "(", ")", ".", "render_state", "(", ")", "field", "=",...
865a1b712ce30501901c4691ce2110ab03f0f93b
train
popattr
Useful for retrieving an object attr and removing it if it's part of it's dict while allowing retrieving from subclass. i.e. class A: a = 'a' class B(A): b = 'b' >>> popattr(B, 'a', None) 'a' >>> A.a 'a'
mutant/utils.py
def popattr(obj, attr, default=NOT_PROVIDED): """ Useful for retrieving an object attr and removing it if it's part of it's dict while allowing retrieving from subclass. i.e. class A: a = 'a' class B(A): b = 'b' >>> popattr(B, 'a', None) 'a' >>> A.a 'a' """ ...
def popattr(obj, attr, default=NOT_PROVIDED): """ Useful for retrieving an object attr and removing it if it's part of it's dict while allowing retrieving from subclass. i.e. class A: a = 'a' class B(A): b = 'b' >>> popattr(B, 'a', None) 'a' >>> A.a 'a' """ ...
[ "Useful", "for", "retrieving", "an", "object", "attr", "and", "removing", "it", "if", "it", "s", "part", "of", "it", "s", "dict", "while", "allowing", "retrieving", "from", "subclass", ".", "i", ".", "e", ".", "class", "A", ":", "a", "=", "a", "class...
charettes/django-mutant
python
https://github.com/charettes/django-mutant/blob/865a1b712ce30501901c4691ce2110ab03f0f93b/mutant/utils.py#L27-L47
[ "def", "popattr", "(", "obj", ",", "attr", ",", "default", "=", "NOT_PROVIDED", ")", ":", "val", "=", "getattr", "(", "obj", ",", "attr", ",", "default", ")", "try", ":", "delattr", "(", "obj", ",", "attr", ")", "except", "AttributeError", ":", "if",...
865a1b712ce30501901c4691ce2110ab03f0f93b
train
_app_cache_deepcopy
An helper that correctly deepcopy model cache state
mutant/utils.py
def _app_cache_deepcopy(obj): """ An helper that correctly deepcopy model cache state """ if isinstance(obj, defaultdict): return deepcopy(obj) elif isinstance(obj, dict): return type(obj)((_app_cache_deepcopy(key), _app_cache_deepcopy(val)) for key, val in obj.items()) elif isin...
def _app_cache_deepcopy(obj): """ An helper that correctly deepcopy model cache state """ if isinstance(obj, defaultdict): return deepcopy(obj) elif isinstance(obj, dict): return type(obj)((_app_cache_deepcopy(key), _app_cache_deepcopy(val)) for key, val in obj.items()) elif isin...
[ "An", "helper", "that", "correctly", "deepcopy", "model", "cache", "state" ]
charettes/django-mutant
python
https://github.com/charettes/django-mutant/blob/865a1b712ce30501901c4691ce2110ab03f0f93b/mutant/utils.py#L139-L154
[ "def", "_app_cache_deepcopy", "(", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "defaultdict", ")", ":", "return", "deepcopy", "(", "obj", ")", "elif", "isinstance", "(", "obj", ",", "dict", ")", ":", "return", "type", "(", "obj", ")", "(", ...
865a1b712ce30501901c4691ce2110ab03f0f93b
train
app_cache_restorer
A context manager that restore model cache state as it was before entering context.
mutant/utils.py
def app_cache_restorer(): """ A context manager that restore model cache state as it was before entering context. """ state = _app_cache_deepcopy(apps.__dict__) try: yield state finally: with apps_lock(): apps.__dict__ = state # Rebind the app registry...
def app_cache_restorer(): """ A context manager that restore model cache state as it was before entering context. """ state = _app_cache_deepcopy(apps.__dict__) try: yield state finally: with apps_lock(): apps.__dict__ = state # Rebind the app registry...
[ "A", "context", "manager", "that", "restore", "model", "cache", "state", "as", "it", "was", "before", "entering", "context", "." ]
charettes/django-mutant
python
https://github.com/charettes/django-mutant/blob/865a1b712ce30501901c4691ce2110ab03f0f93b/mutant/utils.py#L158-L173
[ "def", "app_cache_restorer", "(", ")", ":", "state", "=", "_app_cache_deepcopy", "(", "apps", ".", "__dict__", ")", "try", ":", "yield", "state", "finally", ":", "with", "apps_lock", "(", ")", ":", "apps", ".", "__dict__", "=", "state", "# Rebind the app reg...
865a1b712ce30501901c4691ce2110ab03f0f93b
train
CASCADE_MARK_ORIGIN
Custom on_delete handler which sets _cascade_deletion_origin on the _state of the all relating objects that will deleted. We use this handler on ModelDefinitionAttribute.model_def, so when we delete a ModelDefinition we can skip field_definition_post_delete and base_definition_post_delete and avoid an...
mutant/db/deletion.py
def CASCADE_MARK_ORIGIN(collector, field, sub_objs, using): """ Custom on_delete handler which sets _cascade_deletion_origin on the _state of the all relating objects that will deleted. We use this handler on ModelDefinitionAttribute.model_def, so when we delete a ModelDefinition we can skip field...
def CASCADE_MARK_ORIGIN(collector, field, sub_objs, using): """ Custom on_delete handler which sets _cascade_deletion_origin on the _state of the all relating objects that will deleted. We use this handler on ModelDefinitionAttribute.model_def, so when we delete a ModelDefinition we can skip field...
[ "Custom", "on_delete", "handler", "which", "sets", "_cascade_deletion_origin", "on", "the", "_state", "of", "the", "all", "relating", "objects", "that", "will", "deleted", ".", "We", "use", "this", "handler", "on", "ModelDefinitionAttribute", ".", "model_def", "so...
charettes/django-mutant
python
https://github.com/charettes/django-mutant/blob/865a1b712ce30501901c4691ce2110ab03f0f93b/mutant/db/deletion.py#L6-L18
[ "def", "CASCADE_MARK_ORIGIN", "(", "collector", ",", "field", ",", "sub_objs", ",", "using", ")", ":", "CASCADE", "(", "collector", ",", "field", ",", "sub_objs", ",", "using", ")", "if", "sub_objs", ":", "for", "obj", "in", "sub_objs", ":", "obj", ".", ...
865a1b712ce30501901c4691ce2110ab03f0f93b