repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
jim-easterbrook/pywws
src/pywws/conversions.py
pressure_trend_text
def pressure_trend_text(trend): """Convert pressure trend to a string, as used by the UK met office. """ _ = pywws.localisation.translation.ugettext if trend > 6.0: return _(u'rising very rapidly') elif trend > 3.5: return _(u'rising quickly') elif trend > 1.5: retur...
python
def pressure_trend_text(trend): """Convert pressure trend to a string, as used by the UK met office. """ _ = pywws.localisation.translation.ugettext if trend > 6.0: return _(u'rising very rapidly') elif trend > 3.5: return _(u'rising quickly') elif trend > 1.5: retur...
[ "def", "pressure_trend_text", "(", "trend", ")", ":", "_", "=", "pywws", ".", "localisation", ".", "translation", ".", "ugettext", "if", "trend", ">", "6.0", ":", "return", "_", "(", "u'rising very rapidly'", ")", "elif", "trend", ">", "3.5", ":", "return"...
Convert pressure trend to a string, as used by the UK met office.
[ "Convert", "pressure", "trend", "to", "a", "string", "as", "used", "by", "the", "UK", "met", "office", "." ]
train
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/conversions.py#L50-L72
jim-easterbrook/pywws
src/pywws/conversions.py
winddir_average
def winddir_average(data, threshold, min_count, decay=1.0): """Compute average wind direction (in degrees) for a slice of data. The wind speed and direction of each data item is converted to a vector before averaging, so the result reflects the dominant wind direction during the time period covered by ...
python
def winddir_average(data, threshold, min_count, decay=1.0): """Compute average wind direction (in degrees) for a slice of data. The wind speed and direction of each data item is converted to a vector before averaging, so the result reflects the dominant wind direction during the time period covered by ...
[ "def", "winddir_average", "(", "data", ",", "threshold", ",", "min_count", ",", "decay", "=", "1.0", ")", ":", "wind_filter", "=", "pywws", ".", "process", ".", "WindFilter", "(", ")", "count", "=", "0", "for", "item", "in", "data", ":", "wind_filter", ...
Compute average wind direction (in degrees) for a slice of data. The wind speed and direction of each data item is converted to a vector before averaging, so the result reflects the dominant wind direction during the time period covered by the data. Setting the ``decay`` parameter converts the filter ...
[ "Compute", "average", "wind", "direction", "(", "in", "degrees", ")", "for", "a", "slice", "of", "data", "." ]
train
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/conversions.py#L84-L141
jim-easterbrook/pywws
src/pywws/conversions.py
winddir_text
def winddir_text(pts): "Convert wind direction from 0..15 to compass point text" global _winddir_text_array if pts is None: return None if not isinstance(pts, int): pts = int(pts + 0.5) % 16 if not _winddir_text_array: _ = pywws.localisation.translation.ugettext _wind...
python
def winddir_text(pts): "Convert wind direction from 0..15 to compass point text" global _winddir_text_array if pts is None: return None if not isinstance(pts, int): pts = int(pts + 0.5) % 16 if not _winddir_text_array: _ = pywws.localisation.translation.ugettext _wind...
[ "def", "winddir_text", "(", "pts", ")", ":", "global", "_winddir_text_array", "if", "pts", "is", "None", ":", "return", "None", "if", "not", "isinstance", "(", "pts", ",", "int", ")", ":", "pts", "=", "int", "(", "pts", "+", "0.5", ")", "%", "16", ...
Convert wind direction from 0..15 to compass point text
[ "Convert", "wind", "direction", "from", "0", "..", "15", "to", "compass", "point", "text" ]
train
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/conversions.py#L149-L164
jim-easterbrook/pywws
src/pywws/conversions.py
wind_bft
def wind_bft(ms): "Convert wind from metres per second to Beaufort scale" if ms is None: return None for bft in range(len(_bft_threshold)): if ms < _bft_threshold[bft]: return bft return len(_bft_threshold)
python
def wind_bft(ms): "Convert wind from metres per second to Beaufort scale" if ms is None: return None for bft in range(len(_bft_threshold)): if ms < _bft_threshold[bft]: return bft return len(_bft_threshold)
[ "def", "wind_bft", "(", "ms", ")", ":", "if", "ms", "is", "None", ":", "return", "None", "for", "bft", "in", "range", "(", "len", "(", "_bft_threshold", ")", ")", ":", "if", "ms", "<", "_bft_threshold", "[", "bft", "]", ":", "return", "bft", "retur...
Convert wind from metres per second to Beaufort scale
[ "Convert", "wind", "from", "metres", "per", "second", "to", "Beaufort", "scale" ]
train
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/conversions.py#L181-L188
jim-easterbrook/pywws
src/pywws/conversions.py
dew_point
def dew_point(temp, hum): """Compute dew point, using formula from http://en.wikipedia.org/wiki/Dew_point. """ if temp is None or hum is None: return None a = 17.27 b = 237.7 gamma = ((a * temp) / (b + temp)) + math.log(float(hum) / 100.0) return (b * gamma) / (a - gamma)
python
def dew_point(temp, hum): """Compute dew point, using formula from http://en.wikipedia.org/wiki/Dew_point. """ if temp is None or hum is None: return None a = 17.27 b = 237.7 gamma = ((a * temp) / (b + temp)) + math.log(float(hum) / 100.0) return (b * gamma) / (a - gamma)
[ "def", "dew_point", "(", "temp", ",", "hum", ")", ":", "if", "temp", "is", "None", "or", "hum", "is", "None", ":", "return", "None", "a", "=", "17.27", "b", "=", "237.7", "gamma", "=", "(", "(", "a", "*", "temp", ")", "/", "(", "b", "+", "tem...
Compute dew point, using formula from http://en.wikipedia.org/wiki/Dew_point.
[ "Compute", "dew", "point", "using", "formula", "from", "http", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Dew_point", "." ]
train
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/conversions.py#L190-L200
jim-easterbrook/pywws
src/pywws/conversions.py
cadhumidex
def cadhumidex(temp, humidity): "Calculate Humidity Index as per Canadian Weather Standards" if temp is None or humidity is None: return None # Formulas are adapted to not use e^(...) with no appreciable # change in accuracy (0.0227%) saturation_pressure = (6.112 * (10.0**(7.5 * temp / (237....
python
def cadhumidex(temp, humidity): "Calculate Humidity Index as per Canadian Weather Standards" if temp is None or humidity is None: return None # Formulas are adapted to not use e^(...) with no appreciable # change in accuracy (0.0227%) saturation_pressure = (6.112 * (10.0**(7.5 * temp / (237....
[ "def", "cadhumidex", "(", "temp", ",", "humidity", ")", ":", "if", "temp", "is", "None", "or", "humidity", "is", "None", ":", "return", "None", "# Formulas are adapted to not use e^(...) with no appreciable", "# change in accuracy (0.0227%)", "saturation_pressure", "=", ...
Calculate Humidity Index as per Canadian Weather Standards
[ "Calculate", "Humidity", "Index", "as", "per", "Canadian", "Weather", "Standards" ]
train
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/conversions.py#L202-L210
jim-easterbrook/pywws
src/pywws/conversions.py
usaheatindex
def usaheatindex(temp, humidity, dew=None): """Calculate Heat Index as per USA National Weather Service Standards See http://en.wikipedia.org/wiki/Heat_index, formula 1. The formula is not valid for T < 26.7C, Dew Point < 12C, or RH < 40% """ if temp is None or humidity is None: return Non...
python
def usaheatindex(temp, humidity, dew=None): """Calculate Heat Index as per USA National Weather Service Standards See http://en.wikipedia.org/wiki/Heat_index, formula 1. The formula is not valid for T < 26.7C, Dew Point < 12C, or RH < 40% """ if temp is None or humidity is None: return Non...
[ "def", "usaheatindex", "(", "temp", ",", "humidity", ",", "dew", "=", "None", ")", ":", "if", "temp", "is", "None", "or", "humidity", "is", "None", ":", "return", "None", "if", "dew", "is", "None", ":", "dew", "=", "dew_point", "(", "temp", ",", "h...
Calculate Heat Index as per USA National Weather Service Standards See http://en.wikipedia.org/wiki/Heat_index, formula 1. The formula is not valid for T < 26.7C, Dew Point < 12C, or RH < 40%
[ "Calculate", "Heat", "Index", "as", "per", "USA", "National", "Weather", "Service", "Standards" ]
train
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/conversions.py#L212-L238
jim-easterbrook/pywws
src/pywws/conversions.py
wind_chill
def wind_chill(temp, wind): """Compute wind chill, using formula from http://en.wikipedia.org/wiki/wind_chill """ if temp is None or wind is None: return None wind_kph = wind * 3.6 if wind_kph <= 4.8 or temp > 10.0: return temp return min(13.12 + (temp * 0.6215) + ...
python
def wind_chill(temp, wind): """Compute wind chill, using formula from http://en.wikipedia.org/wiki/wind_chill """ if temp is None or wind is None: return None wind_kph = wind * 3.6 if wind_kph <= 4.8 or temp > 10.0: return temp return min(13.12 + (temp * 0.6215) + ...
[ "def", "wind_chill", "(", "temp", ",", "wind", ")", ":", "if", "temp", "is", "None", "or", "wind", "is", "None", ":", "return", "None", "wind_kph", "=", "wind", "*", "3.6", "if", "wind_kph", "<=", "4.8", "or", "temp", ">", "10.0", ":", "return", "t...
Compute wind chill, using formula from http://en.wikipedia.org/wiki/wind_chill
[ "Compute", "wind", "chill", "using", "formula", "from", "http", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "wind_chill" ]
train
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/conversions.py#L240-L252
jim-easterbrook/pywws
src/pywws/conversions.py
apparent_temp
def apparent_temp(temp, rh, wind): """Compute apparent temperature (real feel), using formula from http://www.bom.gov.au/info/thermal_stress/ """ if temp is None or rh is None or wind is None: return None vap_press = (float(rh) / 100.0) * 6.105 * math.exp( 17.27 * temp / (237.7 + te...
python
def apparent_temp(temp, rh, wind): """Compute apparent temperature (real feel), using formula from http://www.bom.gov.au/info/thermal_stress/ """ if temp is None or rh is None or wind is None: return None vap_press = (float(rh) / 100.0) * 6.105 * math.exp( 17.27 * temp / (237.7 + te...
[ "def", "apparent_temp", "(", "temp", ",", "rh", ",", "wind", ")", ":", "if", "temp", "is", "None", "or", "rh", "is", "None", "or", "wind", "is", "None", ":", "return", "None", "vap_press", "=", "(", "float", "(", "rh", ")", "/", "100.0", ")", "*"...
Compute apparent temperature (real feel), using formula from http://www.bom.gov.au/info/thermal_stress/
[ "Compute", "apparent", "temperature", "(", "real", "feel", ")", "using", "formula", "from", "http", ":", "//", "www", ".", "bom", ".", "gov", ".", "au", "/", "info", "/", "thermal_stress", "/" ]
train
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/conversions.py#L254-L263
jim-easterbrook/pywws
src/pywws/conversions.py
cloud_base
def cloud_base(temp, hum): """Calculate cumulus cloud base in metres, using formula from https://en.wikipedia.org/wiki/Cloud_base or https://de.wikipedia.org/wiki/Kondensationsniveau#Konvektionskondensationsniveau """ if temp is None or hum is None: return None dew_pt = dew_point(temp, h...
python
def cloud_base(temp, hum): """Calculate cumulus cloud base in metres, using formula from https://en.wikipedia.org/wiki/Cloud_base or https://de.wikipedia.org/wiki/Kondensationsniveau#Konvektionskondensationsniveau """ if temp is None or hum is None: return None dew_pt = dew_point(temp, h...
[ "def", "cloud_base", "(", "temp", ",", "hum", ")", ":", "if", "temp", "is", "None", "or", "hum", "is", "None", ":", "return", "None", "dew_pt", "=", "dew_point", "(", "temp", ",", "hum", ")", "spread", "=", "float", "(", "temp", ")", "-", "dew_pt",...
Calculate cumulus cloud base in metres, using formula from https://en.wikipedia.org/wiki/Cloud_base or https://de.wikipedia.org/wiki/Kondensationsniveau#Konvektionskondensationsniveau
[ "Calculate", "cumulus", "cloud", "base", "in", "metres", "using", "formula", "from", "https", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Cloud_base", "or", "https", ":", "//", "de", ".", "wikipedia", ".", "org", "/", "wiki", "/",...
train
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/conversions.py#L265-L274
ppaquette/gym-pull
gym_pull/scoreboard/api.py
upload
def upload(training_dir, algorithm_id=None, writeup=None, api_key=None, ignore_open_monitors=False): """Upload the results of training (as automatically recorded by your env's monitor) to OpenAI Gym. Args: training_dir (Optional[str]): A directory containing the results of a training run. a...
python
def upload(training_dir, algorithm_id=None, writeup=None, api_key=None, ignore_open_monitors=False): """Upload the results of training (as automatically recorded by your env's monitor) to OpenAI Gym. Args: training_dir (Optional[str]): A directory containing the results of a training run. a...
[ "def", "upload", "(", "training_dir", ",", "algorithm_id", "=", "None", ",", "writeup", "=", "None", ",", "api_key", "=", "None", ",", "ignore_open_monitors", "=", "False", ")", ":", "if", "not", "ignore_open_monitors", ":", "open_monitors", "=", "monitoring",...
Upload the results of training (as automatically recorded by your env's monitor) to OpenAI Gym. Args: training_dir (Optional[str]): A directory containing the results of a training run. algorithm_id (Optional[str]): An algorithm id indicating the particular version of the algorithm (including c...
[ "Upload", "the", "results", "of", "training", "(", "as", "automatically", "recorded", "by", "your", "env", "s", "monitor", ")", "to", "OpenAI", "Gym", "." ]
train
https://github.com/ppaquette/gym-pull/blob/5b2797fd081ba5be26544983d1eba764e6d9f73b/gym_pull/scoreboard/api.py#L10-L72
ppaquette/gym-pull
gym_pull/package/manager.py
PackageManager.load_user_envs
def load_user_envs(self): """ Loads downloaded user envs from filesystem cache on `import gym` """ installed_packages = self._list_packages() # Tagging core envs gym_package = 'gym ({})'.format(installed_packages['gym']) if 'gym' in installed_packages else 'gym' core_specs = reg...
python
def load_user_envs(self): """ Loads downloaded user envs from filesystem cache on `import gym` """ installed_packages = self._list_packages() # Tagging core envs gym_package = 'gym ({})'.format(installed_packages['gym']) if 'gym' in installed_packages else 'gym' core_specs = reg...
[ "def", "load_user_envs", "(", "self", ")", ":", "installed_packages", "=", "self", ".", "_list_packages", "(", ")", "# Tagging core envs", "gym_package", "=", "'gym ({})'", ".", "format", "(", "installed_packages", "[", "'gym'", "]", ")", "if", "'gym'", "in", ...
Loads downloaded user envs from filesystem cache on `import gym`
[ "Loads", "downloaded", "user", "envs", "from", "filesystem", "cache", "on", "import", "gym" ]
train
https://github.com/ppaquette/gym-pull/blob/5b2797fd081ba5be26544983d1eba764e6d9f73b/gym_pull/package/manager.py#L31-L53
ppaquette/gym-pull
gym_pull/package/manager.py
PackageManager.pull
def pull(self, source=''): """ Downloads and registers a user environment from a git repository Args: source: the source where to download the envname (expected 'github.com/user/repo[@branch]') Note: the user environment will be registered as (username/EnvName-vVersion) ...
python
def pull(self, source=''): """ Downloads and registers a user environment from a git repository Args: source: the source where to download the envname (expected 'github.com/user/repo[@branch]') Note: the user environment will be registered as (username/EnvName-vVersion) ...
[ "def", "pull", "(", "self", ",", "source", "=", "''", ")", ":", "# Checking syntax", "branch_parts", "=", "source", ".", "split", "(", "'@'", ")", "if", "len", "(", "branch_parts", ")", "==", "2", ":", "branch", "=", "branch_parts", "[", "1", "]", "s...
Downloads and registers a user environment from a git repository Args: source: the source where to download the envname (expected 'github.com/user/repo[@branch]') Note: the user environment will be registered as (username/EnvName-vVersion)
[ "Downloads", "and", "registers", "a", "user", "environment", "from", "a", "git", "repository", "Args", ":", "source", ":", "the", "source", "where", "to", "download", "the", "envname", "(", "expected", "github", ".", "com", "/", "user", "/", "repo", "[", ...
train
https://github.com/ppaquette/gym-pull/blob/5b2797fd081ba5be26544983d1eba764e6d9f73b/gym_pull/package/manager.py#L55-L162
ppaquette/gym-pull
gym_pull/package/manager.py
PackageManager._load_package
def _load_package(self, json_line, installed_packages): """ Returns the user_package (name, version, source), and the list of envs registered when the package was loaded """ if len(json_line) == 0: return {}, set([]) valid_json = False try: user_package = json.lo...
python
def _load_package(self, json_line, installed_packages): """ Returns the user_package (name, version, source), and the list of envs registered when the package was loaded """ if len(json_line) == 0: return {}, set([]) valid_json = False try: user_package = json.lo...
[ "def", "_load_package", "(", "self", ",", "json_line", ",", "installed_packages", ")", ":", "if", "len", "(", "json_line", ")", "==", "0", ":", "return", "{", "}", ",", "set", "(", "[", "]", ")", "valid_json", "=", "False", "try", ":", "user_package", ...
Returns the user_package (name, version, source), and the list of envs registered when the package was loaded
[ "Returns", "the", "user_package", "(", "name", "version", "source", ")", "and", "the", "list", "of", "envs", "registered", "when", "the", "package", "was", "loaded" ]
train
https://github.com/ppaquette/gym-pull/blob/5b2797fd081ba5be26544983d1eba764e6d9f73b/gym_pull/package/manager.py#L201-L260
ppaquette/gym-pull
gym_pull/envs/registration.py
EnvSpec.make
def make(self): """Instantiates an instance of the environment with appropriate kwargs""" if self._entry_point is None: raise error.Error('Attempting to make deprecated env {}. (HINT: is there a newer registered version of this env?)'.format(self.id)) cls = load(self._entry_point) ...
python
def make(self): """Instantiates an instance of the environment with appropriate kwargs""" if self._entry_point is None: raise error.Error('Attempting to make deprecated env {}. (HINT: is there a newer registered version of this env?)'.format(self.id)) cls = load(self._entry_point) ...
[ "def", "make", "(", "self", ")", ":", "if", "self", ".", "_entry_point", "is", "None", ":", "raise", "error", ".", "Error", "(", "'Attempting to make deprecated env {}. (HINT: is there a newer registered version of this env?)'", ".", "format", "(", "self", ".", "id", ...
Instantiates an instance of the environment with appropriate kwargs
[ "Instantiates", "an", "instance", "of", "the", "environment", "with", "appropriate", "kwargs" ]
train
https://github.com/ppaquette/gym-pull/blob/5b2797fd081ba5be26544983d1eba764e6d9f73b/gym_pull/envs/registration.py#L63-L75
jingw/pyhdfs
pyhdfs.py
HdfsClient._parse_path
def _parse_path(self, path): """Return (hosts, path) tuple""" # Support specifying another host via hdfs://host:port/path syntax # We ignore the scheme and piece together the query and fragment # Note that HDFS URIs are not URL encoded, so a '?' or a '#' in the URI is part of the ...
python
def _parse_path(self, path): """Return (hosts, path) tuple""" # Support specifying another host via hdfs://host:port/path syntax # We ignore the scheme and piece together the query and fragment # Note that HDFS URIs are not URL encoded, so a '?' or a '#' in the URI is part of the ...
[ "def", "_parse_path", "(", "self", ",", "path", ")", ":", "# Support specifying another host via hdfs://host:port/path syntax", "# We ignore the scheme and piece together the query and fragment", "# Note that HDFS URIs are not URL encoded, so a '?' or a '#' in the URI is part of the", "# path"...
Return (hosts, path) tuple
[ "Return", "(", "hosts", "path", ")", "tuple" ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L321-L340
jingw/pyhdfs
pyhdfs.py
HdfsClient._record_last_active
def _record_last_active(self, host): """Put host first in our host list, so we try it first next time The implementation of get_active_namenode relies on this reordering. """ if host in self.hosts: # this check is for when user passes a host at request time # Keep this thre...
python
def _record_last_active(self, host): """Put host first in our host list, so we try it first next time The implementation of get_active_namenode relies on this reordering. """ if host in self.hosts: # this check is for when user passes a host at request time # Keep this thre...
[ "def", "_record_last_active", "(", "self", ",", "host", ")", ":", "if", "host", "in", "self", ".", "hosts", ":", "# this check is for when user passes a host at request time", "# Keep this thread safe: set hosts atomically and update it before the timestamp", "self", ".", "host...
Put host first in our host list, so we try it first next time The implementation of get_active_namenode relies on this reordering.
[ "Put", "host", "first", "in", "our", "host", "list", "so", "we", "try", "it", "first", "next", "time" ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L342-L350
jingw/pyhdfs
pyhdfs.py
HdfsClient._request
def _request(self, method, path, op, expected_status=httplib.OK, **kwargs): """Make a WebHDFS request against the NameNodes This function handles NameNode failover and error checking. All kwargs are passed as query params to the WebHDFS server. """ hosts, path = self._parse_path...
python
def _request(self, method, path, op, expected_status=httplib.OK, **kwargs): """Make a WebHDFS request against the NameNodes This function handles NameNode failover and error checking. All kwargs are passed as query params to the WebHDFS server. """ hosts, path = self._parse_path...
[ "def", "_request", "(", "self", ",", "method", ",", "path", ",", "op", ",", "expected_status", "=", "httplib", ".", "OK", ",", "*", "*", "kwargs", ")", ":", "hosts", ",", "path", "=", "self", ".", "_parse_path", "(", "path", ")", "_transform_user_name_...
Make a WebHDFS request against the NameNodes This function handles NameNode failover and error checking. All kwargs are passed as query params to the WebHDFS server.
[ "Make", "a", "WebHDFS", "request", "against", "the", "NameNodes" ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L352-L391
jingw/pyhdfs
pyhdfs.py
HdfsClient.create
def create(self, path, data, **kwargs): """Create a file at the given path. :param data: ``bytes`` or a ``file``-like object to upload :param overwrite: If a file already exists, should it be overwritten? :type overwrite: bool :param blocksize: The block size of a file. ...
python
def create(self, path, data, **kwargs): """Create a file at the given path. :param data: ``bytes`` or a ``file``-like object to upload :param overwrite: If a file already exists, should it be overwritten? :type overwrite: bool :param blocksize: The block size of a file. ...
[ "def", "create", "(", "self", ",", "path", ",", "data", ",", "*", "*", "kwargs", ")", ":", "metadata_response", "=", "self", ".", "_put", "(", "path", ",", "'CREATE'", ",", "expected_status", "=", "httplib", ".", "TEMPORARY_REDIRECT", ",", "*", "*", "k...
Create a file at the given path. :param data: ``bytes`` or a ``file``-like object to upload :param overwrite: If a file already exists, should it be overwritten? :type overwrite: bool :param blocksize: The block size of a file. :type blocksize: long :param replication: T...
[ "Create", "a", "file", "at", "the", "given", "path", "." ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L409-L431
jingw/pyhdfs
pyhdfs.py
HdfsClient.append
def append(self, path, data, **kwargs): """Append to the given file. :param data: ``bytes`` or a ``file``-like object :param buffersize: The size of the buffer used in transferring data. :type buffersize: int """ metadata_response = self._post( path, 'APPEND'...
python
def append(self, path, data, **kwargs): """Append to the given file. :param data: ``bytes`` or a ``file``-like object :param buffersize: The size of the buffer used in transferring data. :type buffersize: int """ metadata_response = self._post( path, 'APPEND'...
[ "def", "append", "(", "self", ",", "path", ",", "data", ",", "*", "*", "kwargs", ")", ":", "metadata_response", "=", "self", ".", "_post", "(", "path", ",", "'APPEND'", ",", "expected_status", "=", "httplib", ".", "TEMPORARY_REDIRECT", ",", "*", "*", "...
Append to the given file. :param data: ``bytes`` or a ``file``-like object :param buffersize: The size of the buffer used in transferring data. :type buffersize: int
[ "Append", "to", "the", "given", "file", "." ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L433-L445
jingw/pyhdfs
pyhdfs.py
HdfsClient.concat
def concat(self, target, sources, **kwargs): """Concat existing files together. For preconditions, see https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/filesystem/filesystem.html#void_concatPath_p_Path_sources :param target: the path to the target destination. ...
python
def concat(self, target, sources, **kwargs): """Concat existing files together. For preconditions, see https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/filesystem/filesystem.html#void_concatPath_p_Path_sources :param target: the path to the target destination. ...
[ "def", "concat", "(", "self", ",", "target", ",", "sources", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "sources", ",", "basestring", ")", ":", "raise", "ValueError", "(", "\"sources should be a list\"", ")", "if", "any", "(", "','", "in...
Concat existing files together. For preconditions, see https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/filesystem/filesystem.html#void_concatPath_p_Path_sources :param target: the path to the target destination. :param sources: the paths to the sources to use f...
[ "Concat", "existing", "files", "together", "." ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L447-L462
jingw/pyhdfs
pyhdfs.py
HdfsClient.open
def open(self, path, **kwargs): """Return a file-like object for reading the given HDFS path. :param offset: The starting byte position. :type offset: long :param length: The number of bytes to be processed. :type length: long :param buffersize: The size of the buffer us...
python
def open(self, path, **kwargs): """Return a file-like object for reading the given HDFS path. :param offset: The starting byte position. :type offset: long :param length: The number of bytes to be processed. :type length: long :param buffersize: The size of the buffer us...
[ "def", "open", "(", "self", ",", "path", ",", "*", "*", "kwargs", ")", ":", "metadata_response", "=", "self", ".", "_get", "(", "path", ",", "'OPEN'", ",", "expected_status", "=", "httplib", ".", "TEMPORARY_REDIRECT", ",", "*", "*", "kwargs", ")", "dat...
Return a file-like object for reading the given HDFS path. :param offset: The starting byte position. :type offset: long :param length: The number of bytes to be processed. :type length: long :param buffersize: The size of the buffer used in transferring data. :type buff...
[ "Return", "a", "file", "-", "like", "object", "for", "reading", "the", "given", "HDFS", "path", "." ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L464-L480
jingw/pyhdfs
pyhdfs.py
HdfsClient.create_symlink
def create_symlink(self, link, destination, **kwargs): """Create a symbolic link at ``link`` pointing to ``destination``. :param link: the path to be created that points to target :param destination: the target of the symbolic link :param createParent: If the parent directories do not e...
python
def create_symlink(self, link, destination, **kwargs): """Create a symbolic link at ``link`` pointing to ``destination``. :param link: the path to be created that points to target :param destination: the target of the symbolic link :param createParent: If the parent directories do not e...
[ "def", "create_symlink", "(", "self", ",", "link", ",", "destination", ",", "*", "*", "kwargs", ")", ":", "response", "=", "self", ".", "_put", "(", "link", ",", "'CREATESYMLINK'", ",", "destination", "=", "destination", ",", "*", "*", "kwargs", ")", "...
Create a symbolic link at ``link`` pointing to ``destination``. :param link: the path to be created that points to target :param destination: the target of the symbolic link :param createParent: If the parent directories do not exist, should they be created? :type createParent: bool ...
[ "Create", "a", "symbolic", "link", "at", "link", "pointing", "to", "destination", "." ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L496-L507
jingw/pyhdfs
pyhdfs.py
HdfsClient.rename
def rename(self, path, destination, **kwargs): """Renames Path src to Path dst. :returns: true if rename is successful :rtype: bool """ return _json(self._put(path, 'RENAME', destination=destination, **kwargs))['boolean']
python
def rename(self, path, destination, **kwargs): """Renames Path src to Path dst. :returns: true if rename is successful :rtype: bool """ return _json(self._put(path, 'RENAME', destination=destination, **kwargs))['boolean']
[ "def", "rename", "(", "self", ",", "path", ",", "destination", ",", "*", "*", "kwargs", ")", ":", "return", "_json", "(", "self", ".", "_put", "(", "path", ",", "'RENAME'", ",", "destination", "=", "destination", ",", "*", "*", "kwargs", ")", ")", ...
Renames Path src to Path dst. :returns: true if rename is successful :rtype: bool
[ "Renames", "Path", "src", "to", "Path", "dst", "." ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L509-L515
jingw/pyhdfs
pyhdfs.py
HdfsClient.get_file_status
def get_file_status(self, path, **kwargs): """Return a :py:class:`FileStatus` object that represents the path.""" return FileStatus(**_json(self._get(path, 'GETFILESTATUS', **kwargs))['FileStatus'])
python
def get_file_status(self, path, **kwargs): """Return a :py:class:`FileStatus` object that represents the path.""" return FileStatus(**_json(self._get(path, 'GETFILESTATUS', **kwargs))['FileStatus'])
[ "def", "get_file_status", "(", "self", ",", "path", ",", "*", "*", "kwargs", ")", ":", "return", "FileStatus", "(", "*", "*", "_json", "(", "self", ".", "_get", "(", "path", ",", "'GETFILESTATUS'", ",", "*", "*", "kwargs", ")", ")", "[", "'FileStatus...
Return a :py:class:`FileStatus` object that represents the path.
[ "Return", "a", ":", "py", ":", "class", ":", "FileStatus", "object", "that", "represents", "the", "path", "." ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L528-L530
jingw/pyhdfs
pyhdfs.py
HdfsClient.list_status
def list_status(self, path, **kwargs): """List the statuses of the files/directories in the given path if the path is a directory. :rtype: ``list`` of :py:class:`FileStatus` objects """ return [ FileStatus(**item) for item in _json(self._get(path, 'LISTSTATUS', *...
python
def list_status(self, path, **kwargs): """List the statuses of the files/directories in the given path if the path is a directory. :rtype: ``list`` of :py:class:`FileStatus` objects """ return [ FileStatus(**item) for item in _json(self._get(path, 'LISTSTATUS', *...
[ "def", "list_status", "(", "self", ",", "path", ",", "*", "*", "kwargs", ")", ":", "return", "[", "FileStatus", "(", "*", "*", "item", ")", "for", "item", "in", "_json", "(", "self", ".", "_get", "(", "path", ",", "'LISTSTATUS'", ",", "*", "*", "...
List the statuses of the files/directories in the given path if the path is a directory. :rtype: ``list`` of :py:class:`FileStatus` objects
[ "List", "the", "statuses", "of", "the", "files", "/", "directories", "in", "the", "given", "path", "if", "the", "path", "is", "a", "directory", "." ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L532-L540
jingw/pyhdfs
pyhdfs.py
HdfsClient.get_content_summary
def get_content_summary(self, path, **kwargs): """Return the :py:class:`ContentSummary` of a given Path.""" return ContentSummary( **_json(self._get(path, 'GETCONTENTSUMMARY', **kwargs))['ContentSummary'])
python
def get_content_summary(self, path, **kwargs): """Return the :py:class:`ContentSummary` of a given Path.""" return ContentSummary( **_json(self._get(path, 'GETCONTENTSUMMARY', **kwargs))['ContentSummary'])
[ "def", "get_content_summary", "(", "self", ",", "path", ",", "*", "*", "kwargs", ")", ":", "return", "ContentSummary", "(", "*", "*", "_json", "(", "self", ".", "_get", "(", "path", ",", "'GETCONTENTSUMMARY'", ",", "*", "*", "kwargs", ")", ")", "[", ...
Return the :py:class:`ContentSummary` of a given Path.
[ "Return", "the", ":", "py", ":", "class", ":", "ContentSummary", "of", "a", "given", "Path", "." ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L546-L549
jingw/pyhdfs
pyhdfs.py
HdfsClient.get_file_checksum
def get_file_checksum(self, path, **kwargs): """Get the checksum of a file. :rtype: :py:class:`FileChecksum` """ metadata_response = self._get( path, 'GETFILECHECKSUM', expected_status=httplib.TEMPORARY_REDIRECT, **kwargs) assert not metadata_response.content ...
python
def get_file_checksum(self, path, **kwargs): """Get the checksum of a file. :rtype: :py:class:`FileChecksum` """ metadata_response = self._get( path, 'GETFILECHECKSUM', expected_status=httplib.TEMPORARY_REDIRECT, **kwargs) assert not metadata_response.content ...
[ "def", "get_file_checksum", "(", "self", ",", "path", ",", "*", "*", "kwargs", ")", ":", "metadata_response", "=", "self", ".", "_get", "(", "path", ",", "'GETFILECHECKSUM'", ",", "expected_status", "=", "httplib", ".", "TEMPORARY_REDIRECT", ",", "*", "*", ...
Get the checksum of a file. :rtype: :py:class:`FileChecksum`
[ "Get", "the", "checksum", "of", "a", "file", "." ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L551-L562
jingw/pyhdfs
pyhdfs.py
HdfsClient.set_permission
def set_permission(self, path, **kwargs): """Set permission of a path. :param permission: The permission of a file/directory. Any radix-8 integer (leading zeros may be omitted.) :type permission: octal """ response = self._put(path, 'SETPERMISSION', **kwargs) ...
python
def set_permission(self, path, **kwargs): """Set permission of a path. :param permission: The permission of a file/directory. Any radix-8 integer (leading zeros may be omitted.) :type permission: octal """ response = self._put(path, 'SETPERMISSION', **kwargs) ...
[ "def", "set_permission", "(", "self", ",", "path", ",", "*", "*", "kwargs", ")", ":", "response", "=", "self", ".", "_put", "(", "path", ",", "'SETPERMISSION'", ",", "*", "*", "kwargs", ")", "assert", "not", "response", ".", "content" ]
Set permission of a path. :param permission: The permission of a file/directory. Any radix-8 integer (leading zeros may be omitted.) :type permission: octal
[ "Set", "permission", "of", "a", "path", "." ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L568-L576
jingw/pyhdfs
pyhdfs.py
HdfsClient.set_owner
def set_owner(self, path, **kwargs): """Set owner of a path (i.e. a file or a directory). The parameters owner and group cannot both be null. :param owner: user :param group: group """ response = self._put(path, 'SETOWNER', **kwargs) assert not response.content
python
def set_owner(self, path, **kwargs): """Set owner of a path (i.e. a file or a directory). The parameters owner and group cannot both be null. :param owner: user :param group: group """ response = self._put(path, 'SETOWNER', **kwargs) assert not response.content
[ "def", "set_owner", "(", "self", ",", "path", ",", "*", "*", "kwargs", ")", ":", "response", "=", "self", ".", "_put", "(", "path", ",", "'SETOWNER'", ",", "*", "*", "kwargs", ")", "assert", "not", "response", ".", "content" ]
Set owner of a path (i.e. a file or a directory). The parameters owner and group cannot both be null. :param owner: user :param group: group
[ "Set", "owner", "of", "a", "path", "(", "i", ".", "e", ".", "a", "file", "or", "a", "directory", ")", "." ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L578-L587
jingw/pyhdfs
pyhdfs.py
HdfsClient.set_times
def set_times(self, path, **kwargs): """Set access time of a file. :param modificationtime: Set the modification time of this file. The number of milliseconds since Jan 1, 1970. :type modificationtime: long :param accesstime: Set the access time of this file. The number of m...
python
def set_times(self, path, **kwargs): """Set access time of a file. :param modificationtime: Set the modification time of this file. The number of milliseconds since Jan 1, 1970. :type modificationtime: long :param accesstime: Set the access time of this file. The number of m...
[ "def", "set_times", "(", "self", ",", "path", ",", "*", "*", "kwargs", ")", ":", "response", "=", "self", ".", "_put", "(", "path", ",", "'SETTIMES'", ",", "*", "*", "kwargs", ")", "assert", "not", "response", ".", "content" ]
Set access time of a file. :param modificationtime: Set the modification time of this file. The number of milliseconds since Jan 1, 1970. :type modificationtime: long :param accesstime: Set the access time of this file. The number of milliseconds since Jan 1 1970. ...
[ "Set", "access", "time", "of", "a", "file", "." ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L599-L610
jingw/pyhdfs
pyhdfs.py
HdfsClient.set_xattr
def set_xattr(self, path, xattr_name, xattr_value, flag, **kwargs): """Set an xattr of a file or directory. :param xattr_name: The name must be prefixed with the namespace followed by ``.``. For example, ``user.attr``. :param flag: ``CREATE`` or ``REPLACE`` """ kwarg...
python
def set_xattr(self, path, xattr_name, xattr_value, flag, **kwargs): """Set an xattr of a file or directory. :param xattr_name: The name must be prefixed with the namespace followed by ``.``. For example, ``user.attr``. :param flag: ``CREATE`` or ``REPLACE`` """ kwarg...
[ "def", "set_xattr", "(", "self", ",", "path", ",", "xattr_name", ",", "xattr_value", ",", "flag", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'xattr.name'", "]", "=", "xattr_name", "kwargs", "[", "'xattr.value'", "]", "=", "xattr_value", "response",...
Set an xattr of a file or directory. :param xattr_name: The name must be prefixed with the namespace followed by ``.``. For example, ``user.attr``. :param flag: ``CREATE`` or ``REPLACE``
[ "Set", "an", "xattr", "of", "a", "file", "or", "directory", "." ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L616-L626
jingw/pyhdfs
pyhdfs.py
HdfsClient.remove_xattr
def remove_xattr(self, path, xattr_name, **kwargs): """Remove an xattr of a file or directory.""" kwargs['xattr.name'] = xattr_name response = self._put(path, 'REMOVEXATTR', **kwargs) assert not response.content
python
def remove_xattr(self, path, xattr_name, **kwargs): """Remove an xattr of a file or directory.""" kwargs['xattr.name'] = xattr_name response = self._put(path, 'REMOVEXATTR', **kwargs) assert not response.content
[ "def", "remove_xattr", "(", "self", ",", "path", ",", "xattr_name", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'xattr.name'", "]", "=", "xattr_name", "response", "=", "self", ".", "_put", "(", "path", ",", "'REMOVEXATTR'", ",", "*", "*", "kwarg...
Remove an xattr of a file or directory.
[ "Remove", "an", "xattr", "of", "a", "file", "or", "directory", "." ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L628-L632
jingw/pyhdfs
pyhdfs.py
HdfsClient.get_xattrs
def get_xattrs(self, path, xattr_name=None, encoding='text', **kwargs): """Get one or more xattr values for a file or directory. :param xattr_name: ``str`` to get one attribute, ``list`` to get multiple attributes, ``None`` to get all attributes. :param encoding: ``text`` | ``hex`` ...
python
def get_xattrs(self, path, xattr_name=None, encoding='text', **kwargs): """Get one or more xattr values for a file or directory. :param xattr_name: ``str`` to get one attribute, ``list`` to get multiple attributes, ``None`` to get all attributes. :param encoding: ``text`` | ``hex`` ...
[ "def", "get_xattrs", "(", "self", ",", "path", ",", "xattr_name", "=", "None", ",", "encoding", "=", "'text'", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'xattr.name'", "]", "=", "xattr_name", "json", "=", "_json", "(", "self", ".", "_get", "...
Get one or more xattr values for a file or directory. :param xattr_name: ``str`` to get one attribute, ``list`` to get multiple attributes, ``None`` to get all attributes. :param encoding: ``text`` | ``hex`` | ``base64``, defaults to ``text`` :returns: Dictionary mapping xattr name...
[ "Get", "one", "or", "more", "xattr", "values", "for", "a", "file", "or", "directory", "." ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L634-L668
jingw/pyhdfs
pyhdfs.py
HdfsClient.list_xattrs
def list_xattrs(self, path, **kwargs): """Get all of the xattr names for a file or directory. :rtype: list """ return simplejson.loads(_json(self._get(path, 'LISTXATTRS', **kwargs))['XAttrNames'])
python
def list_xattrs(self, path, **kwargs): """Get all of the xattr names for a file or directory. :rtype: list """ return simplejson.loads(_json(self._get(path, 'LISTXATTRS', **kwargs))['XAttrNames'])
[ "def", "list_xattrs", "(", "self", ",", "path", ",", "*", "*", "kwargs", ")", ":", "return", "simplejson", ".", "loads", "(", "_json", "(", "self", ".", "_get", "(", "path", ",", "'LISTXATTRS'", ",", "*", "*", "kwargs", ")", ")", "[", "'XAttrNames'",...
Get all of the xattr names for a file or directory. :rtype: list
[ "Get", "all", "of", "the", "xattr", "names", "for", "a", "file", "or", "directory", "." ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L670-L675
jingw/pyhdfs
pyhdfs.py
HdfsClient.delete_snapshot
def delete_snapshot(self, path, snapshotname, **kwargs): """Delete a snapshot of a directory""" response = self._delete(path, 'DELETESNAPSHOT', snapshotname=snapshotname, **kwargs) assert not response.content
python
def delete_snapshot(self, path, snapshotname, **kwargs): """Delete a snapshot of a directory""" response = self._delete(path, 'DELETESNAPSHOT', snapshotname=snapshotname, **kwargs) assert not response.content
[ "def", "delete_snapshot", "(", "self", ",", "path", ",", "snapshotname", ",", "*", "*", "kwargs", ")", ":", "response", "=", "self", ".", "_delete", "(", "path", ",", "'DELETESNAPSHOT'", ",", "snapshotname", "=", "snapshotname", ",", "*", "*", "kwargs", ...
Delete a snapshot of a directory
[ "Delete", "a", "snapshot", "of", "a", "directory" ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L690-L693
jingw/pyhdfs
pyhdfs.py
HdfsClient.rename_snapshot
def rename_snapshot(self, path, oldsnapshotname, snapshotname, **kwargs): """Rename a snapshot""" response = self._put(path, 'RENAMESNAPSHOT', oldsnapshotname=oldsnapshotname, snapshotname=snapshotname, **kwargs) assert not response.content
python
def rename_snapshot(self, path, oldsnapshotname, snapshotname, **kwargs): """Rename a snapshot""" response = self._put(path, 'RENAMESNAPSHOT', oldsnapshotname=oldsnapshotname, snapshotname=snapshotname, **kwargs) assert not response.content
[ "def", "rename_snapshot", "(", "self", ",", "path", ",", "oldsnapshotname", ",", "snapshotname", ",", "*", "*", "kwargs", ")", ":", "response", "=", "self", ".", "_put", "(", "path", ",", "'RENAMESNAPSHOT'", ",", "oldsnapshotname", "=", "oldsnapshotname", ",...
Rename a snapshot
[ "Rename", "a", "snapshot" ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L695-L699
jingw/pyhdfs
pyhdfs.py
HdfsClient.listdir
def listdir(self, path, **kwargs): """Return a list containing names of files in the given path""" statuses = self.list_status(path, **kwargs) if len(statuses) == 1 and statuses[0].pathSuffix == '' and statuses[0].type == 'FILE': raise NotADirectoryError('Not a directory: {!r}'.forma...
python
def listdir(self, path, **kwargs): """Return a list containing names of files in the given path""" statuses = self.list_status(path, **kwargs) if len(statuses) == 1 and statuses[0].pathSuffix == '' and statuses[0].type == 'FILE': raise NotADirectoryError('Not a directory: {!r}'.forma...
[ "def", "listdir", "(", "self", ",", "path", ",", "*", "*", "kwargs", ")", ":", "statuses", "=", "self", ".", "list_status", "(", "path", ",", "*", "*", "kwargs", ")", "if", "len", "(", "statuses", ")", "==", "1", "and", "statuses", "[", "0", "]",...
Return a list containing names of files in the given path
[ "Return", "a", "list", "containing", "names", "of", "files", "in", "the", "given", "path" ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L706-L711
jingw/pyhdfs
pyhdfs.py
HdfsClient.exists
def exists(self, path, **kwargs): """Return true if the given path exists""" try: self.get_file_status(path, **kwargs) return True except HdfsFileNotFoundException: return False
python
def exists(self, path, **kwargs): """Return true if the given path exists""" try: self.get_file_status(path, **kwargs) return True except HdfsFileNotFoundException: return False
[ "def", "exists", "(", "self", ",", "path", ",", "*", "*", "kwargs", ")", ":", "try", ":", "self", ".", "get_file_status", "(", "path", ",", "*", "*", "kwargs", ")", "return", "True", "except", "HdfsFileNotFoundException", ":", "return", "False" ]
Return true if the given path exists
[ "Return", "true", "if", "the", "given", "path", "exists" ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L713-L719
jingw/pyhdfs
pyhdfs.py
HdfsClient.walk
def walk(self, top, topdown=True, onerror=None, **kwargs): """See ``os.walk`` for documentation""" try: listing = self.list_status(top, **kwargs) except HdfsException as e: if onerror is not None: onerror(e) return dirnames, filenames ...
python
def walk(self, top, topdown=True, onerror=None, **kwargs): """See ``os.walk`` for documentation""" try: listing = self.list_status(top, **kwargs) except HdfsException as e: if onerror is not None: onerror(e) return dirnames, filenames ...
[ "def", "walk", "(", "self", ",", "top", ",", "topdown", "=", "True", ",", "onerror", "=", "None", ",", "*", "*", "kwargs", ")", ":", "try", ":", "listing", "=", "self", ".", "list_status", "(", "top", ",", "*", "*", "kwargs", ")", "except", "Hdfs...
See ``os.walk`` for documentation
[ "See", "os", ".", "walk", "for", "documentation" ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L721-L746
jingw/pyhdfs
pyhdfs.py
HdfsClient.copy_from_local
def copy_from_local(self, localsrc, dest, **kwargs): """Copy a single file from the local file system to ``dest`` Takes all arguments that :py:meth:`create` takes. """ with io.open(localsrc, 'rb') as f: self.create(dest, f, **kwargs)
python
def copy_from_local(self, localsrc, dest, **kwargs): """Copy a single file from the local file system to ``dest`` Takes all arguments that :py:meth:`create` takes. """ with io.open(localsrc, 'rb') as f: self.create(dest, f, **kwargs)
[ "def", "copy_from_local", "(", "self", ",", "localsrc", ",", "dest", ",", "*", "*", "kwargs", ")", ":", "with", "io", ".", "open", "(", "localsrc", ",", "'rb'", ")", "as", "f", ":", "self", ".", "create", "(", "dest", ",", "f", ",", "*", "*", "...
Copy a single file from the local file system to ``dest`` Takes all arguments that :py:meth:`create` takes.
[ "Copy", "a", "single", "file", "from", "the", "local", "file", "system", "to", "dest" ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L748-L754
jingw/pyhdfs
pyhdfs.py
HdfsClient.copy_to_local
def copy_to_local(self, src, localdest, **kwargs): """Copy a single file from ``src`` to the local file system Takes all arguments that :py:meth:`open` takes. """ with self.open(src, **kwargs) as fsrc: with io.open(localdest, 'wb') as fdst: shutil.copyfileobj...
python
def copy_to_local(self, src, localdest, **kwargs): """Copy a single file from ``src`` to the local file system Takes all arguments that :py:meth:`open` takes. """ with self.open(src, **kwargs) as fsrc: with io.open(localdest, 'wb') as fdst: shutil.copyfileobj...
[ "def", "copy_to_local", "(", "self", ",", "src", ",", "localdest", ",", "*", "*", "kwargs", ")", ":", "with", "self", ".", "open", "(", "src", ",", "*", "*", "kwargs", ")", "as", "fsrc", ":", "with", "io", ".", "open", "(", "localdest", ",", "'wb...
Copy a single file from ``src`` to the local file system Takes all arguments that :py:meth:`open` takes.
[ "Copy", "a", "single", "file", "from", "src", "to", "the", "local", "file", "system" ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L756-L763
jingw/pyhdfs
pyhdfs.py
HdfsClient.get_active_namenode
def get_active_namenode(self, max_staleness=None): """Return the address of the currently active NameNode. :param max_staleness: This function caches the active NameNode. If this age of this cached result is less than ``max_staleness`` seconds, return it. Otherwise, or if this p...
python
def get_active_namenode(self, max_staleness=None): """Return the address of the currently active NameNode. :param max_staleness: This function caches the active NameNode. If this age of this cached result is less than ``max_staleness`` seconds, return it. Otherwise, or if this p...
[ "def", "get_active_namenode", "(", "self", ",", "max_staleness", "=", "None", ")", ":", "if", "(", "max_staleness", "is", "None", "or", "self", ".", "_last_time_recorded_active", "is", "None", "or", "self", ".", "_last_time_recorded_active", "<", "time", ".", ...
Return the address of the currently active NameNode. :param max_staleness: This function caches the active NameNode. If this age of this cached result is less than ``max_staleness`` seconds, return it. Otherwise, or if this parameter is None, do a lookup. :type max_staleness: fl...
[ "Return", "the", "address", "of", "the", "currently", "active", "NameNode", "." ]
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L765-L779
fracpete/python-weka-wrapper
python/weka/core/tokenizers.py
TokenIterator.next
def next(self): """ Reads the next dataset row. :return: the next row :rtype: Instance """ if not self.__has_more(): raise StopIteration() else: return javabridge.get_env().get_string(self.__next())
python
def next(self): """ Reads the next dataset row. :return: the next row :rtype: Instance """ if not self.__has_more(): raise StopIteration() else: return javabridge.get_env().get_string(self.__next())
[ "def", "next", "(", "self", ")", ":", "if", "not", "self", ".", "__has_more", "(", ")", ":", "raise", "StopIteration", "(", ")", "else", ":", "return", "javabridge", ".", "get_env", "(", ")", ".", "get_string", "(", "self", ".", "__next", "(", ")", ...
Reads the next dataset row. :return: the next row :rtype: Instance
[ "Reads", "the", "next", "dataset", "row", "." ]
train
https://github.com/fracpete/python-weka-wrapper/blob/e865915146faf40d3bbfedb440328d1360541633/python/weka/core/tokenizers.py#L42-L52
fracpete/python-weka-wrapper
python/weka/associations.py
main
def main(): """ Runs a associator from the command-line. Calls JVM start/stop automatically. Use -h to see all options. """ parser = argparse.ArgumentParser( description='Executes an associator from the command-line. Calls JVM start/stop automatically.') parser.add_argument("-j", metava...
python
def main(): """ Runs a associator from the command-line. Calls JVM start/stop automatically. Use -h to see all options. """ parser = argparse.ArgumentParser( description='Executes an associator from the command-line. Calls JVM start/stop automatically.') parser.add_argument("-j", metava...
[ "def", "main", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Executes an associator from the command-line. Calls JVM start/stop automatically.'", ")", "parser", ".", "add_argument", "(", "\"-j\"", ",", "metavar", "=", "\"cla...
Runs a associator from the command-line. Calls JVM start/stop automatically. Use -h to see all options.
[ "Runs", "a", "associator", "from", "the", "command", "-", "line", ".", "Calls", "JVM", "start", "/", "stop", "automatically", ".", "Use", "-", "h", "to", "see", "all", "options", "." ]
train
https://github.com/fracpete/python-weka-wrapper/blob/e865915146faf40d3bbfedb440328d1360541633/python/weka/associations.py#L605-L638
fracpete/python-weka-wrapper
python/weka/associations.py
AssociationRulesIterator.next
def next(self): """ Returns the next rule. :return: the next rule object :rtype: AssociationRule """ if self.index < self.length: index = self.index self.index += 1 return self.rules[index] else: raise StopIteration...
python
def next(self): """ Returns the next rule. :return: the next rule object :rtype: AssociationRule """ if self.index < self.length: index = self.index self.index += 1 return self.rules[index] else: raise StopIteration...
[ "def", "next", "(", "self", ")", ":", "if", "self", ".", "index", "<", "self", ".", "length", ":", "index", "=", "self", ".", "index", "self", ".", "index", "+=", "1", "return", "self", ".", "rules", "[", "index", "]", "else", ":", "raise", "Stop...
Returns the next rule. :return: the next rule object :rtype: AssociationRule
[ "Returns", "the", "next", "rule", "." ]
train
https://github.com/fracpete/python-weka-wrapper/blob/e865915146faf40d3bbfedb440328d1360541633/python/weka/associations.py#L419-L431
fracpete/python-weka-wrapper
python/weka/flow/control.py
ActorHandler._build_tree
def _build_tree(self, actor, content): """ Builds the tree for the given actor. :param actor: the actor to process :type actor: Actor :param content: the rows of the tree collected so far :type content: list """ depth = actor.depth row = "" ...
python
def _build_tree(self, actor, content): """ Builds the tree for the given actor. :param actor: the actor to process :type actor: Actor :param content: the rows of the tree collected so far :type content: list """ depth = actor.depth row = "" ...
[ "def", "_build_tree", "(", "self", ",", "actor", ",", "content", ")", ":", "depth", "=", "actor", ".", "depth", "row", "=", "\"\"", "for", "i", "in", "xrange", "(", "depth", "-", "1", ")", ":", "row", "+=", "\"| \"", "if", "depth", ">", "0", ":",...
Builds the tree for the given actor. :param actor: the actor to process :type actor: Actor :param content: the rows of the tree collected so far :type content: list
[ "Builds", "the", "tree", "for", "the", "given", "actor", "." ]
train
https://github.com/fracpete/python-weka-wrapper/blob/e865915146faf40d3bbfedb440328d1360541633/python/weka/flow/control.py#L284-L310
fracpete/python-weka-wrapper
python/weka/flow/control.py
SequentialDirector.check_actors
def check_actors(self): """ Checks the actors of the owner. Raises an exception if invalid. """ actors = [] for actor in self.owner.actors: if actor.skip: continue actors.append(actor) if len(actors) == 0: return ...
python
def check_actors(self): """ Checks the actors of the owner. Raises an exception if invalid. """ actors = [] for actor in self.owner.actors: if actor.skip: continue actors.append(actor) if len(actors) == 0: return ...
[ "def", "check_actors", "(", "self", ")", ":", "actors", "=", "[", "]", "for", "actor", "in", "self", ".", "owner", ".", "actors", ":", "if", "actor", ".", "skip", ":", "continue", "actors", ".", "append", "(", "actor", ")", "if", "len", "(", "actor...
Checks the actors of the owner. Raises an exception if invalid.
[ "Checks", "the", "actors", "of", "the", "owner", ".", "Raises", "an", "exception", "if", "invalid", "." ]
train
https://github.com/fracpete/python-weka-wrapper/blob/e865915146faf40d3bbfedb440328d1360541633/python/weka/flow/control.py#L508-L523
fracpete/python-weka-wrapper
python/weka/flow/control.py
Flow.save
def save(cls, flow, fname): """ Saves the flow to a JSON file. :param flow: the flow to save :type flow: Flow :param fname: the file to load :type fname: str :return: None if successful, otherwise error message :rtype: str """ result = Non...
python
def save(cls, flow, fname): """ Saves the flow to a JSON file. :param flow: the flow to save :type flow: Flow :param fname: the file to load :type fname: str :return: None if successful, otherwise error message :rtype: str """ result = Non...
[ "def", "save", "(", "cls", ",", "flow", ",", "fname", ")", ":", "result", "=", "None", "try", ":", "f", "=", "open", "(", "fname", ",", "'w'", ")", "f", ".", "write", "(", "flow", ".", "to_json", "(", ")", ")", "f", ".", "close", "(", ")", ...
Saves the flow to a JSON file. :param flow: the flow to save :type flow: Flow :param fname: the file to load :type fname: str :return: None if successful, otherwise error message :rtype: str
[ "Saves", "the", "flow", "to", "a", "JSON", "file", "." ]
train
https://github.com/fracpete/python-weka-wrapper/blob/e865915146faf40d3bbfedb440328d1360541633/python/weka/flow/control.py#L709-L727
fracpete/python-weka-wrapper
python/weka/flow/control.py
BranchDirector.setup
def setup(self): """ Performs some checks. :return: None if successful, otherwise error message. :rtype: str """ result = super(BranchDirector, self).setup() if result is None: try: self.check_actors() except Exception, e: ...
python
def setup(self): """ Performs some checks. :return: None if successful, otherwise error message. :rtype: str """ result = super(BranchDirector, self).setup() if result is None: try: self.check_actors() except Exception, e: ...
[ "def", "setup", "(", "self", ")", ":", "result", "=", "super", "(", "BranchDirector", ",", "self", ")", ".", "setup", "(", ")", "if", "result", "is", "None", ":", "try", ":", "self", ".", "check_actors", "(", ")", "except", "Exception", ",", "e", "...
Performs some checks. :return: None if successful, otherwise error message. :rtype: str
[ "Performs", "some", "checks", "." ]
train
https://github.com/fracpete/python-weka-wrapper/blob/e865915146faf40d3bbfedb440328d1360541633/python/weka/flow/control.py#L1076-L1089
fracpete/python-weka-wrapper
python/weka/attribute_selection.py
AttributeSelection.ranked_attributes
def ranked_attributes(self): """ Returns the matrix of ranked attributes from the last run. :return: the Numpy matrix :rtype: ndarray """ matrix = javabridge.call(self.jobject, "rankedAttributes", "()[[D") if matrix is None: return None else: ...
python
def ranked_attributes(self): """ Returns the matrix of ranked attributes from the last run. :return: the Numpy matrix :rtype: ndarray """ matrix = javabridge.call(self.jobject, "rankedAttributes", "()[[D") if matrix is None: return None else: ...
[ "def", "ranked_attributes", "(", "self", ")", ":", "matrix", "=", "javabridge", ".", "call", "(", "self", ".", "jobject", ",", "\"rankedAttributes\"", ",", "\"()[[D\"", ")", "if", "matrix", "is", "None", ":", "return", "None", "else", ":", "return", "array...
Returns the matrix of ranked attributes from the last run. :return: the Numpy matrix :rtype: ndarray
[ "Returns", "the", "matrix", "of", "ranked", "attributes", "from", "the", "last", "run", "." ]
train
https://github.com/fracpete/python-weka-wrapper/blob/e865915146faf40d3bbfedb440328d1360541633/python/weka/attribute_selection.py#L259-L270
fracpete/python-weka-wrapper
python/weka/core/classes.py
JavaArrayIterator.next
def next(self): """ Returns the next element from the array. :return: the next array element object, wrapped as JavaObject if not null :rtype: JavaObject or None """ if self.index < self.length: index = self.index self.index += 1 retur...
python
def next(self): """ Returns the next element from the array. :return: the next array element object, wrapped as JavaObject if not null :rtype: JavaObject or None """ if self.index < self.length: index = self.index self.index += 1 retur...
[ "def", "next", "(", "self", ")", ":", "if", "self", ".", "index", "<", "self", ".", "length", ":", "index", "=", "self", ".", "index", "self", ".", "index", "+=", "1", "return", "self", ".", "data", "[", "index", "]", "else", ":", "raise", "StopI...
Returns the next element from the array. :return: the next array element object, wrapped as JavaObject if not null :rtype: JavaObject or None
[ "Returns", "the", "next", "element", "from", "the", "array", "." ]
train
https://github.com/fracpete/python-weka-wrapper/blob/e865915146faf40d3bbfedb440328d1360541633/python/weka/core/classes.py#L755-L767
fracpete/python-weka-wrapper
python/weka/core/classes.py
OptionHandler.options
def options(self): """ Obtains the currently set options as list. :return: the list of options :rtype: list """ if self.is_optionhandler: return types.string_array_to_list(javabridge.call(self.jobject, "getOptions", "()[Ljava/lang/String;")) else: ...
python
def options(self): """ Obtains the currently set options as list. :return: the list of options :rtype: list """ if self.is_optionhandler: return types.string_array_to_list(javabridge.call(self.jobject, "getOptions", "()[Ljava/lang/String;")) else: ...
[ "def", "options", "(", "self", ")", ":", "if", "self", ".", "is_optionhandler", ":", "return", "types", ".", "string_array_to_list", "(", "javabridge", ".", "call", "(", "self", ".", "jobject", ",", "\"getOptions\"", ",", "\"()[Ljava/lang/String;\"", ")", ")",...
Obtains the currently set options as list. :return: the list of options :rtype: list
[ "Obtains", "the", "currently", "set", "options", "as", "list", "." ]
train
https://github.com/fracpete/python-weka-wrapper/blob/e865915146faf40d3bbfedb440328d1360541633/python/weka/core/classes.py#L1081-L1091
fracpete/python-weka-wrapper
python/weka/core/classes.py
OptionHandler.options
def options(self, options): """ Sets the command-line options (as list). :param options: the list of command-line options to set :type options: list """ if self.is_optionhandler: javabridge.call(self.jobject, "setOptions", "([Ljava/lang/String;)V", types.stri...
python
def options(self, options): """ Sets the command-line options (as list). :param options: the list of command-line options to set :type options: list """ if self.is_optionhandler: javabridge.call(self.jobject, "setOptions", "([Ljava/lang/String;)V", types.stri...
[ "def", "options", "(", "self", ",", "options", ")", ":", "if", "self", ".", "is_optionhandler", ":", "javabridge", ".", "call", "(", "self", ".", "jobject", ",", "\"setOptions\"", ",", "\"([Ljava/lang/String;)V\"", ",", "types", ".", "string_list_to_array", "(...
Sets the command-line options (as list). :param options: the list of command-line options to set :type options: list
[ "Sets", "the", "command", "-", "line", "options", "(", "as", "list", ")", "." ]
train
https://github.com/fracpete/python-weka-wrapper/blob/e865915146faf40d3bbfedb440328d1360541633/python/weka/core/classes.py#L1094-L1102
fracpete/python-weka-wrapper
python/weka/plot/clusterers.py
plot_cluster_assignments
def plot_cluster_assignments(evl, data, atts=None, inst_no=False, size=10, title=None, outfile=None, wait=True): """ Plots the cluster assignments against the specified attributes. TODO: click events http://matplotlib.org/examples/event_handling/data_browser.html :param evl: the cluster evaluation to ...
python
def plot_cluster_assignments(evl, data, atts=None, inst_no=False, size=10, title=None, outfile=None, wait=True): """ Plots the cluster assignments against the specified attributes. TODO: click events http://matplotlib.org/examples/event_handling/data_browser.html :param evl: the cluster evaluation to ...
[ "def", "plot_cluster_assignments", "(", "evl", ",", "data", ",", "atts", "=", "None", ",", "inst_no", "=", "False", ",", "size", "=", "10", ",", "title", "=", "None", ",", "outfile", "=", "None", ",", "wait", "=", "True", ")", ":", "if", "not", "pl...
Plots the cluster assignments against the specified attributes. TODO: click events http://matplotlib.org/examples/event_handling/data_browser.html :param evl: the cluster evaluation to obtain the cluster assignments from :type evl: ClusterEvaluation :param data: the dataset the clusterer was evaluated...
[ "Plots", "the", "cluster", "assignments", "against", "the", "specified", "attributes", "." ]
train
https://github.com/fracpete/python-weka-wrapper/blob/e865915146faf40d3bbfedb440328d1360541633/python/weka/plot/clusterers.py#L28-L111
fracpete/python-weka-wrapper
python/weka/core/serialization.py
write_all
def write_all(filename, jobjects): """ Serializes the list of objects to disk. JavaObject instances get automatically unwrapped. :param filename: the file to serialize the object to :type filename: str :param jobjects: the list of objects to serialize :type jobjects: list """ array = ja...
python
def write_all(filename, jobjects): """ Serializes the list of objects to disk. JavaObject instances get automatically unwrapped. :param filename: the file to serialize the object to :type filename: str :param jobjects: the list of objects to serialize :type jobjects: list """ array = ja...
[ "def", "write_all", "(", "filename", ",", "jobjects", ")", ":", "array", "=", "javabridge", ".", "get_env", "(", ")", ".", "make_object_array", "(", "len", "(", "jobjects", ")", ",", "javabridge", ".", "get_env", "(", ")", ".", "find_class", "(", "\"java...
Serializes the list of objects to disk. JavaObject instances get automatically unwrapped. :param filename: the file to serialize the object to :type filename: str :param jobjects: the list of objects to serialize :type jobjects: list
[ "Serializes", "the", "list", "of", "objects", "to", "disk", ".", "JavaObject", "instances", "get", "automatically", "unwrapped", "." ]
train
https://github.com/fracpete/python-weka-wrapper/blob/e865915146faf40d3bbfedb440328d1360541633/python/weka/core/serialization.py#L104-L122
fracpete/python-weka-wrapper
python/weka/filters.py
main
def main(): """ Runs a filter from the command-line. Calls JVM start/stop automatically. Use -h to see all options. """ parser = argparse.ArgumentParser( description='Executes a filter from the command-line. Calls JVM start/stop automatically.') parser.add_argument("-j", metavar="classpa...
python
def main(): """ Runs a filter from the command-line. Calls JVM start/stop automatically. Use -h to see all options. """ parser = argparse.ArgumentParser( description='Executes a filter from the command-line. Calls JVM start/stop automatically.') parser.add_argument("-j", metavar="classpa...
[ "def", "main", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Executes a filter from the command-line. Calls JVM start/stop automatically.'", ")", "parser", ".", "add_argument", "(", "\"-j\"", ",", "metavar", "=", "\"classpat...
Runs a filter from the command-line. Calls JVM start/stop automatically. Use -h to see all options.
[ "Runs", "a", "filter", "from", "the", "command", "-", "line", ".", "Calls", "JVM", "start", "/", "stop", "automatically", ".", "Use", "-", "h", "to", "see", "all", "options", "." ]
train
https://github.com/fracpete/python-weka-wrapper/blob/e865915146faf40d3bbfedb440328d1360541633/python/weka/filters.py#L316-L380
fracpete/python-weka-wrapper
python/weka/core/converters.py
IncrementalLoaderIterator.next
def next(self): """ Reads the next dataset row. :return: the next row :rtype: Instance """ result = javabridge.call( self.loader.jobject, "getNextInstance", "(Lweka/core/Instances;)Lweka/core/Instance;", self.structure.jobject) if result i...
python
def next(self): """ Reads the next dataset row. :return: the next row :rtype: Instance """ result = javabridge.call( self.loader.jobject, "getNextInstance", "(Lweka/core/Instances;)Lweka/core/Instance;", self.structure.jobject) if result i...
[ "def", "next", "(", "self", ")", ":", "result", "=", "javabridge", ".", "call", "(", "self", ".", "loader", ".", "jobject", ",", "\"getNextInstance\"", ",", "\"(Lweka/core/Instances;)Lweka/core/Instance;\"", ",", "self", ".", "structure", ".", "jobject", ")", ...
Reads the next dataset row. :return: the next row :rtype: Instance
[ "Reads", "the", "next", "dataset", "row", "." ]
train
https://github.com/fracpete/python-weka-wrapper/blob/e865915146faf40d3bbfedb440328d1360541633/python/weka/core/converters.py#L133-L146
fracpete/python-weka-wrapper
python/weka/plot/classifiers.py
plot_classifier_errors
def plot_classifier_errors(predictions, absolute=True, max_relative_size=50, absolute_size=50, title=None, outfile=None, wait=True): """ Plots the classifers for the given list of predictions. TODO: click events http://matplotlib.org/examples/event_handling/data_browser.html ...
python
def plot_classifier_errors(predictions, absolute=True, max_relative_size=50, absolute_size=50, title=None, outfile=None, wait=True): """ Plots the classifers for the given list of predictions. TODO: click events http://matplotlib.org/examples/event_handling/data_browser.html ...
[ "def", "plot_classifier_errors", "(", "predictions", ",", "absolute", "=", "True", ",", "max_relative_size", "=", "50", ",", "absolute_size", "=", "50", ",", "title", "=", "None", ",", "outfile", "=", "None", ",", "wait", "=", "True", ")", ":", "if", "no...
Plots the classifers for the given list of predictions. TODO: click events http://matplotlib.org/examples/event_handling/data_browser.html :param predictions: the predictions to plot :type predictions: list :param absolute: whether to use absolute errors as size or relative ones :type absolute: bo...
[ "Plots", "the", "classifers", "for", "the", "given", "list", "of", "predictions", "." ]
train
https://github.com/fracpete/python-weka-wrapper/blob/e865915146faf40d3bbfedb440328d1360541633/python/weka/plot/classifiers.py#L30-L98
fracpete/python-weka-wrapper
python/weka/classifiers.py
main
def main(): """ Runs a classifier from the command-line. Calls JVM start/stop automatically. Use -h to see all options. """ parser = argparse.ArgumentParser( description='Performs classification/regression from the command-line. Calls JVM start/stop automatically.') parser.add_argument("...
python
def main(): """ Runs a classifier from the command-line. Calls JVM start/stop automatically. Use -h to see all options. """ parser = argparse.ArgumentParser( description='Performs classification/regression from the command-line. Calls JVM start/stop automatically.') parser.add_argument("...
[ "def", "main", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Performs classification/regression from the command-line. Calls JVM start/stop automatically.'", ")", "parser", ".", "add_argument", "(", "\"-j\"", ",", "metavar", "...
Runs a classifier from the command-line. Calls JVM start/stop automatically. Use -h to see all options.
[ "Runs", "a", "classifier", "from", "the", "command", "-", "line", ".", "Calls", "JVM", "start", "/", "stop", "automatically", ".", "Use", "-", "h", "to", "see", "all", "options", "." ]
train
https://github.com/fracpete/python-weka-wrapper/blob/e865915146faf40d3bbfedb440328d1360541633/python/weka/classifiers.py#L2117-L2185
fracpete/python-weka-wrapper
python/weka/classifiers.py
Classifier.distributions_for_instances
def distributions_for_instances(self, data): """ Peforms predictions, returning the class distributions. :param data: the Instances to get the class distributions for :type data: Instances :return: the class distribution matrix, None if not a batch predictor :rtype: ndar...
python
def distributions_for_instances(self, data): """ Peforms predictions, returning the class distributions. :param data: the Instances to get the class distributions for :type data: Instances :return: the class distribution matrix, None if not a batch predictor :rtype: ndar...
[ "def", "distributions_for_instances", "(", "self", ",", "data", ")", ":", "if", "self", ".", "is_batchpredictor", ":", "return", "arrays", ".", "double_matrix_to_ndarray", "(", "self", ".", "__distributions", "(", "data", ".", "jobject", ")", ")", "else", ":",...
Peforms predictions, returning the class distributions. :param data: the Instances to get the class distributions for :type data: Instances :return: the class distribution matrix, None if not a batch predictor :rtype: ndarray
[ "Peforms", "predictions", "returning", "the", "class", "distributions", "." ]
train
https://github.com/fracpete/python-weka-wrapper/blob/e865915146faf40d3bbfedb440328d1360541633/python/weka/classifiers.py#L120-L132
fracpete/python-weka-wrapper
python/weka/core/dataset.py
Instances.values
def values(self, index): """ Returns the internal values of this attribute from all the instance objects. :return: the values as numpy array :rtype: list """ values = [] for i in xrange(self.num_instances): inst = self.get_instance(i) valu...
python
def values(self, index): """ Returns the internal values of this attribute from all the instance objects. :return: the values as numpy array :rtype: list """ values = [] for i in xrange(self.num_instances): inst = self.get_instance(i) valu...
[ "def", "values", "(", "self", ",", "index", ")", ":", "values", "=", "[", "]", "for", "i", "in", "xrange", "(", "self", ".", "num_instances", ")", ":", "inst", "=", "self", ".", "get_instance", "(", "i", ")", "values", ".", "append", "(", "inst", ...
Returns the internal values of this attribute from all the instance objects. :return: the values as numpy array :rtype: list
[ "Returns", "the", "internal", "values", "of", "this", "attribute", "from", "all", "the", "instance", "objects", "." ]
train
https://github.com/fracpete/python-weka-wrapper/blob/e865915146faf40d3bbfedb440328d1360541633/python/weka/core/dataset.py#L144-L155
fracpete/python-weka-wrapper
python/weka/core/dataset.py
Instances.append_instances
def append_instances(cls, inst1, inst2): """ Merges the two datasets (one-after-the-other). Throws an exception if the datasets aren't compatible. :param inst1: the first dataset :type inst1: Instances :param inst2: the first dataset :type inst2: Instances :retur...
python
def append_instances(cls, inst1, inst2): """ Merges the two datasets (one-after-the-other). Throws an exception if the datasets aren't compatible. :param inst1: the first dataset :type inst1: Instances :param inst2: the first dataset :type inst2: Instances :retur...
[ "def", "append_instances", "(", "cls", ",", "inst1", ",", "inst2", ")", ":", "msg", "=", "inst1", ".", "equal_headers", "(", "inst2", ")", "if", "msg", "is", "not", "None", ":", "raise", "Exception", "(", "\"Cannot appent instances: \"", "+", "msg", ")", ...
Merges the two datasets (one-after-the-other). Throws an exception if the datasets aren't compatible. :param inst1: the first dataset :type inst1: Instances :param inst2: the first dataset :type inst2: Instances :return: the combined dataset :rtype: Instances
[ "Merges", "the", "two", "datasets", "(", "one", "-", "after", "-", "the", "-", "other", ")", ".", "Throws", "an", "exception", "if", "the", "datasets", "aren", "t", "compatible", "." ]
train
https://github.com/fracpete/python-weka-wrapper/blob/e865915146faf40d3bbfedb440328d1360541633/python/weka/core/dataset.py#L489-L506
fracpete/python-weka-wrapper
python/weka/core/dataset.py
Attribute.values
def values(self): """ Returns the labels, strings or relation-values. :return: all the values, None if not NOMINAL, STRING, or RELATION :rtype: list """ enm = javabridge.call(self.jobject, "enumerateValues", "()Ljava/util/Enumeration;") if enm is None: ...
python
def values(self): """ Returns the labels, strings or relation-values. :return: all the values, None if not NOMINAL, STRING, or RELATION :rtype: list """ enm = javabridge.call(self.jobject, "enumerateValues", "()Ljava/util/Enumeration;") if enm is None: ...
[ "def", "values", "(", "self", ")", ":", "enm", "=", "javabridge", ".", "call", "(", "self", ".", "jobject", ",", "\"enumerateValues\"", ",", "\"()Ljava/util/Enumeration;\"", ")", "if", "enm", "is", "None", ":", "return", "None", "else", ":", "return", "typ...
Returns the labels, strings or relation-values. :return: all the values, None if not NOMINAL, STRING, or RELATION :rtype: list
[ "Returns", "the", "labels", "strings", "or", "relation", "-", "values", "." ]
train
https://github.com/fracpete/python-weka-wrapper/blob/e865915146faf40d3bbfedb440328d1360541633/python/weka/core/dataset.py#L913-L924
fracpete/python-weka-wrapper
python/weka/core/dataset.py
InstanceIterator.next
def next(self): """ Returns the next row from the Instances object. :return: the next Instance object :rtype: Instance """ if self.row < self.data.num_instances: index = self.row self.row += 1 return self.data.get_instance(index) ...
python
def next(self): """ Returns the next row from the Instances object. :return: the next Instance object :rtype: Instance """ if self.row < self.data.num_instances: index = self.row self.row += 1 return self.data.get_instance(index) ...
[ "def", "next", "(", "self", ")", ":", "if", "self", ".", "row", "<", "self", ".", "data", ".", "num_instances", ":", "index", "=", "self", ".", "row", "self", ".", "row", "+=", "1", "return", "self", ".", "data", ".", "get_instance", "(", "index", ...
Returns the next row from the Instances object. :return: the next Instance object :rtype: Instance
[ "Returns", "the", "next", "row", "from", "the", "Instances", "object", "." ]
train
https://github.com/fracpete/python-weka-wrapper/blob/e865915146faf40d3bbfedb440328d1360541633/python/weka/core/dataset.py#L1405-L1417
fracpete/python-weka-wrapper
python/weka/core/dataset.py
AttributeIterator.next
def next(self): """ Returns the next attribute from the Instances object. :return: the next Attribute object :rtype: Attribute """ if self.col < self.data.num_attributes: index = self.col self.col += 1 return self.data.attribute(index)...
python
def next(self): """ Returns the next attribute from the Instances object. :return: the next Attribute object :rtype: Attribute """ if self.col < self.data.num_attributes: index = self.col self.col += 1 return self.data.attribute(index)...
[ "def", "next", "(", "self", ")", ":", "if", "self", ".", "col", "<", "self", ".", "data", ".", "num_attributes", ":", "index", "=", "self", ".", "col", "self", ".", "col", "+=", "1", "return", "self", ".", "data", ".", "attribute", "(", "index", ...
Returns the next attribute from the Instances object. :return: the next Attribute object :rtype: Attribute
[ "Returns", "the", "next", "attribute", "from", "the", "Instances", "object", "." ]
train
https://github.com/fracpete/python-weka-wrapper/blob/e865915146faf40d3bbfedb440328d1360541633/python/weka/core/dataset.py#L1440-L1452
HDI-Project/ballet
ballet/validation/project_structure/checks.py
IsPythonSourceCheck.check
def check(self, diff): """Check that the new file introduced is a python source file""" path = diff.b_path assert any( path.endswith(ext) for ext in importlib.machinery.SOURCE_SUFFIXES )
python
def check(self, diff): """Check that the new file introduced is a python source file""" path = diff.b_path assert any( path.endswith(ext) for ext in importlib.machinery.SOURCE_SUFFIXES )
[ "def", "check", "(", "self", ",", "diff", ")", ":", "path", "=", "diff", ".", "b_path", "assert", "any", "(", "path", ".", "endswith", "(", "ext", ")", "for", "ext", "in", "importlib", ".", "machinery", ".", "SOURCE_SUFFIXES", ")" ]
Check that the new file introduced is a python source file
[ "Check", "that", "the", "new", "file", "introduced", "is", "a", "python", "source", "file" ]
train
https://github.com/HDI-Project/ballet/blob/6f4d4b87b8234cb6bb38b9e9484a58ef8fe8fdb2/ballet/validation/project_structure/checks.py#L34-L40
HDI-Project/ballet
ballet/validation/project_structure/checks.py
WithinContribCheck.check
def check(self, diff): """Check that the new file is within the contrib subdirectory""" path = diff.b_path contrib_path = self.project.contrib_module_path assert pathlib.Path(contrib_path) in pathlib.Path(path).parents
python
def check(self, diff): """Check that the new file is within the contrib subdirectory""" path = diff.b_path contrib_path = self.project.contrib_module_path assert pathlib.Path(contrib_path) in pathlib.Path(path).parents
[ "def", "check", "(", "self", ",", "diff", ")", ":", "path", "=", "diff", ".", "b_path", "contrib_path", "=", "self", ".", "project", ".", "contrib_module_path", "assert", "pathlib", ".", "Path", "(", "contrib_path", ")", "in", "pathlib", ".", "Path", "("...
Check that the new file is within the contrib subdirectory
[ "Check", "that", "the", "new", "file", "is", "within", "the", "contrib", "subdirectory" ]
train
https://github.com/HDI-Project/ballet/blob/6f4d4b87b8234cb6bb38b9e9484a58ef8fe8fdb2/ballet/validation/project_structure/checks.py#L45-L49
HDI-Project/ballet
ballet/validation/project_structure/checks.py
SubpackageNameCheck.check
def check(self, diff): """Check that the name of the subpackage within contrib is valid The package name must match ``user_[a-zA-Z0-9_]+``. """ relative_path = relative_to_contrib(diff, self.project) subpackage_name = relative_path.parts[0] assert re_test(SUBPACKAGE_NAME...
python
def check(self, diff): """Check that the name of the subpackage within contrib is valid The package name must match ``user_[a-zA-Z0-9_]+``. """ relative_path = relative_to_contrib(diff, self.project) subpackage_name = relative_path.parts[0] assert re_test(SUBPACKAGE_NAME...
[ "def", "check", "(", "self", ",", "diff", ")", ":", "relative_path", "=", "relative_to_contrib", "(", "diff", ",", "self", ".", "project", ")", "subpackage_name", "=", "relative_path", ".", "parts", "[", "0", "]", "assert", "re_test", "(", "SUBPACKAGE_NAME_R...
Check that the name of the subpackage within contrib is valid The package name must match ``user_[a-zA-Z0-9_]+``.
[ "Check", "that", "the", "name", "of", "the", "subpackage", "within", "contrib", "is", "valid" ]
train
https://github.com/HDI-Project/ballet/blob/6f4d4b87b8234cb6bb38b9e9484a58ef8fe8fdb2/ballet/validation/project_structure/checks.py#L54-L61
HDI-Project/ballet
ballet/validation/project_structure/checks.py
RelativeNameDepthCheck.check
def check(self, diff): """Check that the new file introduced is at the proper depth The proper depth is 2 (contrib/user_example/new_file.py) """ relative_path = relative_to_contrib(diff, self.project) assert len(relative_path.parts) == 2
python
def check(self, diff): """Check that the new file introduced is at the proper depth The proper depth is 2 (contrib/user_example/new_file.py) """ relative_path = relative_to_contrib(diff, self.project) assert len(relative_path.parts) == 2
[ "def", "check", "(", "self", ",", "diff", ")", ":", "relative_path", "=", "relative_to_contrib", "(", "diff", ",", "self", ".", "project", ")", "assert", "len", "(", "relative_path", ".", "parts", ")", "==", "2" ]
Check that the new file introduced is at the proper depth The proper depth is 2 (contrib/user_example/new_file.py)
[ "Check", "that", "the", "new", "file", "introduced", "is", "at", "the", "proper", "depth" ]
train
https://github.com/HDI-Project/ballet/blob/6f4d4b87b8234cb6bb38b9e9484a58ef8fe8fdb2/ballet/validation/project_structure/checks.py#L66-L72
HDI-Project/ballet
ballet/validation/project_structure/checks.py
ModuleNameCheck.check
def check(self, diff): r"""Check that the new file introduced has a valid name The module can either be an __init__.py file or must match ``feature_[a-zA-Z0-9_]+\.\w+``. """ filename = pathlib.Path(diff.b_path).parts[-1] is_valid_feature_module_name = re_test( ...
python
def check(self, diff): r"""Check that the new file introduced has a valid name The module can either be an __init__.py file or must match ``feature_[a-zA-Z0-9_]+\.\w+``. """ filename = pathlib.Path(diff.b_path).parts[-1] is_valid_feature_module_name = re_test( ...
[ "def", "check", "(", "self", ",", "diff", ")", ":", "filename", "=", "pathlib", ".", "Path", "(", "diff", ".", "b_path", ")", ".", "parts", "[", "-", "1", "]", "is_valid_feature_module_name", "=", "re_test", "(", "FEATURE_MODULE_NAME_REGEX", ",", "filename...
r"""Check that the new file introduced has a valid name The module can either be an __init__.py file or must match ``feature_[a-zA-Z0-9_]+\.\w+``.
[ "r", "Check", "that", "the", "new", "file", "introduced", "has", "a", "valid", "name" ]
train
https://github.com/HDI-Project/ballet/blob/6f4d4b87b8234cb6bb38b9e9484a58ef8fe8fdb2/ballet/validation/project_structure/checks.py#L77-L87
HDI-Project/ballet
ballet/validation/project_structure/checks.py
IfInitModuleThenIsEmptyCheck.check
def check(self, diff): """Check that if the new file is __init__.py, then it is empty""" path = pathlib.Path(diff.b_path) filename = path.parts[-1] if filename == '__init__.py': abspath = self.project.path.joinpath(path) assert isemptyfile(abspath)
python
def check(self, diff): """Check that if the new file is __init__.py, then it is empty""" path = pathlib.Path(diff.b_path) filename = path.parts[-1] if filename == '__init__.py': abspath = self.project.path.joinpath(path) assert isemptyfile(abspath)
[ "def", "check", "(", "self", ",", "diff", ")", ":", "path", "=", "pathlib", ".", "Path", "(", "diff", ".", "b_path", ")", "filename", "=", "path", ".", "parts", "[", "-", "1", "]", "if", "filename", "==", "'__init__.py'", ":", "abspath", "=", "self...
Check that if the new file is __init__.py, then it is empty
[ "Check", "that", "if", "the", "new", "file", "is", "__init__", ".", "py", "then", "it", "is", "empty" ]
train
https://github.com/HDI-Project/ballet/blob/6f4d4b87b8234cb6bb38b9e9484a58ef8fe8fdb2/ballet/validation/project_structure/checks.py#L92-L98
HDI-Project/ballet
ballet/util/log.py
enable
def enable(logger=logger, level=logging.INFO, format=DETAIL_LOG_FORMAT, echo=True): """Enable simple console logging for this module""" global _handler if _handler is None: _handler = logging.StreamHandler() formatter = logging.Formatter(format) _hand...
python
def enable(logger=logger, level=logging.INFO, format=DETAIL_LOG_FORMAT, echo=True): """Enable simple console logging for this module""" global _handler if _handler is None: _handler = logging.StreamHandler() formatter = logging.Formatter(format) _hand...
[ "def", "enable", "(", "logger", "=", "logger", ",", "level", "=", "logging", ".", "INFO", ",", "format", "=", "DETAIL_LOG_FORMAT", ",", "echo", "=", "True", ")", ":", "global", "_handler", "if", "_handler", "is", "None", ":", "_handler", "=", "logging", ...
Enable simple console logging for this module
[ "Enable", "simple", "console", "logging", "for", "this", "module" ]
train
https://github.com/HDI-Project/ballet/blob/6f4d4b87b8234cb6bb38b9e9484a58ef8fe8fdb2/ballet/util/log.py#L14-L36
openstack/os-refresh-config
os_refresh_config/os_refresh_config.py
default_base_dir
def default_base_dir(): """Determine the default base directory path If the OS_REFRESH_CONFIG_BASE_DIR environment variable is set, use its value. Otherwise, prefer the new default path, but still allow the old one for backwards compatibility. """ base_dir = os.environ.get('OS_REFRESH_CONFI...
python
def default_base_dir(): """Determine the default base directory path If the OS_REFRESH_CONFIG_BASE_DIR environment variable is set, use its value. Otherwise, prefer the new default path, but still allow the old one for backwards compatibility. """ base_dir = os.environ.get('OS_REFRESH_CONFI...
[ "def", "default_base_dir", "(", ")", ":", "base_dir", "=", "os", ".", "environ", ".", "get", "(", "'OS_REFRESH_CONFIG_BASE_DIR'", ")", "if", "base_dir", "is", "None", ":", "# NOTE(bnemec): Prefer the new location, but still allow the old one.", "if", "os", ".", "path"...
Determine the default base directory path If the OS_REFRESH_CONFIG_BASE_DIR environment variable is set, use its value. Otherwise, prefer the new default path, but still allow the old one for backwards compatibility.
[ "Determine", "the", "default", "base", "directory", "path" ]
train
https://github.com/openstack/os-refresh-config/blob/39c1df66510ffd9a528a783208661217242dbd9e/os_refresh_config/os_refresh_config.py#L32-L50
HDI-Project/ballet
ballet/util/code.py
blacken_code
def blacken_code(code): """Format code content using Black Args: code (str): code as string Returns: str """ if black is None: raise NotImplementedError major, minor, _ = platform.python_version_tuple() pyversion = 'py{major}{minor}'.format(major=major, minor=minor...
python
def blacken_code(code): """Format code content using Black Args: code (str): code as string Returns: str """ if black is None: raise NotImplementedError major, minor, _ = platform.python_version_tuple() pyversion = 'py{major}{minor}'.format(major=major, minor=minor...
[ "def", "blacken_code", "(", "code", ")", ":", "if", "black", "is", "None", ":", "raise", "NotImplementedError", "major", ",", "minor", ",", "_", "=", "platform", ".", "python_version_tuple", "(", ")", "pyversion", "=", "'py{major}{minor}'", ".", "format", "(...
Format code content using Black Args: code (str): code as string Returns: str
[ "Format", "code", "content", "using", "Black" ]
train
https://github.com/HDI-Project/ballet/blob/6f4d4b87b8234cb6bb38b9e9484a58ef8fe8fdb2/ballet/util/code.py#L6-L31
wbond/csrbuilder
csrbuilder/__init__.py
_writer
def _writer(func): """ Decorator for a custom writer, but a default reader """ name = func.__name__ return property(fget=lambda self: getattr(self, '_%s' % name), fset=func)
python
def _writer(func): """ Decorator for a custom writer, but a default reader """ name = func.__name__ return property(fget=lambda self: getattr(self, '_%s' % name), fset=func)
[ "def", "_writer", "(", "func", ")", ":", "name", "=", "func", ".", "__name__", "return", "property", "(", "fget", "=", "lambda", "self", ":", "getattr", "(", "self", ",", "'_%s'", "%", "name", ")", ",", "fset", "=", "func", ")" ]
Decorator for a custom writer, but a default reader
[ "Decorator", "for", "a", "custom", "writer", "but", "a", "default", "reader" ]
train
https://github.com/wbond/csrbuilder/blob/269565e7772fb0081bc3e954e622f5b3b8ce3e30/csrbuilder/__init__.py#L30-L36
wbond/csrbuilder
csrbuilder/__init__.py
pem_armor_csr
def pem_armor_csr(certification_request): """ Encodes a CSR into PEM format :param certification_request: An asn1crypto.csr.CertificationRequest object of the CSR to armor. Typically this is obtained from CSRBuilder.build(). :return: A byte string of the PEM-encoded CSR """...
python
def pem_armor_csr(certification_request): """ Encodes a CSR into PEM format :param certification_request: An asn1crypto.csr.CertificationRequest object of the CSR to armor. Typically this is obtained from CSRBuilder.build(). :return: A byte string of the PEM-encoded CSR """...
[ "def", "pem_armor_csr", "(", "certification_request", ")", ":", "if", "not", "isinstance", "(", "certification_request", ",", "csr", ".", "CertificationRequest", ")", ":", "raise", "TypeError", "(", "_pretty_message", "(", "'''\n certification_request must be a...
Encodes a CSR into PEM format :param certification_request: An asn1crypto.csr.CertificationRequest object of the CSR to armor. Typically this is obtained from CSRBuilder.build(). :return: A byte string of the PEM-encoded CSR
[ "Encodes", "a", "CSR", "into", "PEM", "format" ]
train
https://github.com/wbond/csrbuilder/blob/269565e7772fb0081bc3e954e622f5b3b8ce3e30/csrbuilder/__init__.py#L39-L63
wbond/csrbuilder
csrbuilder/__init__.py
_pretty_message
def _pretty_message(string, *params): """ Takes a multi-line string and does the following: - dedents - converts newlines with text before and after into a single line - strips leading and trailing whitespace :param string: The string to format :param *params: Params to...
python
def _pretty_message(string, *params): """ Takes a multi-line string and does the following: - dedents - converts newlines with text before and after into a single line - strips leading and trailing whitespace :param string: The string to format :param *params: Params to...
[ "def", "_pretty_message", "(", "string", ",", "*", "params", ")", ":", "output", "=", "textwrap", ".", "dedent", "(", "string", ")", "# Unwrap lines, taking into account bulleted lists, ordered lists and", "# underlines consisting of = signs", "if", "output", ".", "find",...
Takes a multi-line string and does the following: - dedents - converts newlines with text before and after into a single line - strips leading and trailing whitespace :param string: The string to format :param *params: Params to interpolate into the string :return: ...
[ "Takes", "a", "multi", "-", "line", "string", "and", "does", "the", "following", ":" ]
train
https://github.com/wbond/csrbuilder/blob/269565e7772fb0081bc3e954e622f5b3b8ce3e30/csrbuilder/__init__.py#L523-L553
wbond/csrbuilder
csrbuilder/__init__.py
CSRBuilder.subject
def subject(self, value): """ An asn1crypto.x509.Name object, or a dict with at least the following keys: - country_name - state_or_province_name - locality_name - organization_name - common_name Less common keys include: - organiz...
python
def subject(self, value): """ An asn1crypto.x509.Name object, or a dict with at least the following keys: - country_name - state_or_province_name - locality_name - organization_name - common_name Less common keys include: - organiz...
[ "def", "subject", "(", "self", ",", "value", ")", ":", "is_dict", "=", "isinstance", "(", "value", ",", "dict", ")", "if", "not", "isinstance", "(", "value", ",", "x509", ".", "Name", ")", "and", "not", "is_dict", ":", "raise", "TypeError", "(", "_pr...
An asn1crypto.x509.Name object, or a dict with at least the following keys: - country_name - state_or_province_name - locality_name - organization_name - common_name Less common keys include: - organizational_unit_name - email_address ...
[ "An", "asn1crypto", ".", "x509", ".", "Name", "object", "or", "a", "dict", "with", "at", "least", "the", "following", "keys", ":" ]
train
https://github.com/wbond/csrbuilder/blob/269565e7772fb0081bc3e954e622f5b3b8ce3e30/csrbuilder/__init__.py#L105-L156
wbond/csrbuilder
csrbuilder/__init__.py
CSRBuilder.subject_public_key
def subject_public_key(self, value): """ An asn1crypto.keys.PublicKeyInfo or oscrypto.asymmetric.PublicKey object of the subject's public key. """ is_oscrypto = isinstance(value, asymmetric.PublicKey) if not isinstance(value, keys.PublicKeyInfo) and not is_oscrypto: ...
python
def subject_public_key(self, value): """ An asn1crypto.keys.PublicKeyInfo or oscrypto.asymmetric.PublicKey object of the subject's public key. """ is_oscrypto = isinstance(value, asymmetric.PublicKey) if not isinstance(value, keys.PublicKeyInfo) and not is_oscrypto: ...
[ "def", "subject_public_key", "(", "self", ",", "value", ")", ":", "is_oscrypto", "=", "isinstance", "(", "value", ",", "asymmetric", ".", "PublicKey", ")", "if", "not", "isinstance", "(", "value", ",", "keys", ".", "PublicKeyInfo", ")", "and", "not", "is_o...
An asn1crypto.keys.PublicKeyInfo or oscrypto.asymmetric.PublicKey object of the subject's public key.
[ "An", "asn1crypto", ".", "keys", ".", "PublicKeyInfo", "or", "oscrypto", ".", "asymmetric", ".", "PublicKey", "object", "of", "the", "subject", "s", "public", "key", "." ]
train
https://github.com/wbond/csrbuilder/blob/269565e7772fb0081bc3e954e622f5b3b8ce3e30/csrbuilder/__init__.py#L159-L182
wbond/csrbuilder
csrbuilder/__init__.py
CSRBuilder.hash_algo
def hash_algo(self, value): """ A unicode string of the hash algorithm to use when signing the request - "sha1" (not recommended), "sha256" or "sha512" """ if value not in set(['sha1', 'sha256', 'sha512']): raise ValueError(_pretty_message( ''' ...
python
def hash_algo(self, value): """ A unicode string of the hash algorithm to use when signing the request - "sha1" (not recommended), "sha256" or "sha512" """ if value not in set(['sha1', 'sha256', 'sha512']): raise ValueError(_pretty_message( ''' ...
[ "def", "hash_algo", "(", "self", ",", "value", ")", ":", "if", "value", "not", "in", "set", "(", "[", "'sha1'", ",", "'sha256'", ",", "'sha512'", "]", ")", ":", "raise", "ValueError", "(", "_pretty_message", "(", "'''\n hash_algo must be one of ...
A unicode string of the hash algorithm to use when signing the request - "sha1" (not recommended), "sha256" or "sha512"
[ "A", "unicode", "string", "of", "the", "hash", "algorithm", "to", "use", "when", "signing", "the", "request", "-", "sha1", "(", "not", "recommended", ")", "sha256", "or", "sha512" ]
train
https://github.com/wbond/csrbuilder/blob/269565e7772fb0081bc3e954e622f5b3b8ce3e30/csrbuilder/__init__.py#L185-L199
wbond/csrbuilder
csrbuilder/__init__.py
CSRBuilder._get_subject_alt
def _get_subject_alt(self, name): """ Returns the native value for each value in the subject alt name extension reqiest that is an asn1crypto.x509.GeneralName of the type specified by the name param :param name: A unicode string use to filter the x509.GeneralName obj...
python
def _get_subject_alt(self, name): """ Returns the native value for each value in the subject alt name extension reqiest that is an asn1crypto.x509.GeneralName of the type specified by the name param :param name: A unicode string use to filter the x509.GeneralName obj...
[ "def", "_get_subject_alt", "(", "self", ",", "name", ")", ":", "if", "self", ".", "_subject_alt_name", "is", "None", ":", "return", "[", "]", "output", "=", "[", "]", "for", "general_name", "in", "self", ".", "_subject_alt_name", ":", "if", "general_name",...
Returns the native value for each value in the subject alt name extension reqiest that is an asn1crypto.x509.GeneralName of the type specified by the name param :param name: A unicode string use to filter the x509.GeneralName objects by - is the choice name x509.GeneralN...
[ "Returns", "the", "native", "value", "for", "each", "value", "in", "the", "subject", "alt", "name", "extension", "reqiest", "that", "is", "an", "asn1crypto", ".", "x509", ".", "GeneralName", "of", "the", "type", "specified", "by", "the", "name", "param" ]
train
https://github.com/wbond/csrbuilder/blob/269565e7772fb0081bc3e954e622f5b3b8ce3e30/csrbuilder/__init__.py#L255-L277
wbond/csrbuilder
csrbuilder/__init__.py
CSRBuilder._set_subject_alt
def _set_subject_alt(self, name, values): """ Replaces all existing asn1crypto.x509.GeneralName objects of the choice represented by the name parameter with the values :param name: A unicode string of the choice name of the x509.GeneralName object :param values: ...
python
def _set_subject_alt(self, name, values): """ Replaces all existing asn1crypto.x509.GeneralName objects of the choice represented by the name parameter with the values :param name: A unicode string of the choice name of the x509.GeneralName object :param values: ...
[ "def", "_set_subject_alt", "(", "self", ",", "name", ",", "values", ")", ":", "if", "self", ".", "_subject_alt_name", "is", "not", "None", ":", "filtered_general_names", "=", "[", "]", "for", "general_name", "in", "self", ".", "_subject_alt_name", ":", "if",...
Replaces all existing asn1crypto.x509.GeneralName objects of the choice represented by the name parameter with the values :param name: A unicode string of the choice name of the x509.GeneralName object :param values: A list of unicode strings to use as the values for th...
[ "Replaces", "all", "existing", "asn1crypto", ".", "x509", ".", "GeneralName", "objects", "of", "the", "choice", "represented", "by", "the", "name", "parameter", "with", "the", "values" ]
train
https://github.com/wbond/csrbuilder/blob/269565e7772fb0081bc3e954e622f5b3b8ce3e30/csrbuilder/__init__.py#L279-L307
wbond/csrbuilder
csrbuilder/__init__.py
CSRBuilder.set_extension
def set_extension(self, name, value): """ Sets the value for an extension using a fully constructed Asn1Value object from asn1crypto. Normally this should not be needed, and the convenience attributes should be sufficient. See the definition of asn1crypto.x509.Extension to deter...
python
def set_extension(self, name, value): """ Sets the value for an extension using a fully constructed Asn1Value object from asn1crypto. Normally this should not be needed, and the convenience attributes should be sufficient. See the definition of asn1crypto.x509.Extension to deter...
[ "def", "set_extension", "(", "self", ",", "name", ",", "value", ")", ":", "extension", "=", "x509", ".", "Extension", "(", "{", "'extn_id'", ":", "name", "}", ")", "# We use native here to convert OIDs to meaningful names", "name", "=", "extension", "[", "'extn_...
Sets the value for an extension using a fully constructed Asn1Value object from asn1crypto. Normally this should not be needed, and the convenience attributes should be sufficient. See the definition of asn1crypto.x509.Extension to determine the appropriate object type for a given exten...
[ "Sets", "the", "value", "for", "an", "extension", "using", "a", "fully", "constructed", "Asn1Value", "object", "from", "asn1crypto", ".", "Normally", "this", "should", "not", "be", "needed", "and", "the", "convenience", "attributes", "should", "be", "sufficient"...
train
https://github.com/wbond/csrbuilder/blob/269565e7772fb0081bc3e954e622f5b3b8ce3e30/csrbuilder/__init__.py#L364-L408
wbond/csrbuilder
csrbuilder/__init__.py
CSRBuilder._determine_critical
def _determine_critical(self, name): """ :return: A boolean indicating the correct value of the critical flag for an extension, based on information from RFC5280 and RFC 6960. The correct value is based on the terminology SHOULD or MUST. """ if name =...
python
def _determine_critical(self, name): """ :return: A boolean indicating the correct value of the critical flag for an extension, based on information from RFC5280 and RFC 6960. The correct value is based on the terminology SHOULD or MUST. """ if name =...
[ "def", "_determine_critical", "(", "self", ",", "name", ")", ":", "if", "name", "==", "'subject_alt_name'", ":", "return", "len", "(", "self", ".", "_subject", ")", "==", "0", "if", "name", "==", "'basic_constraints'", ":", "return", "self", ".", "ca", "...
:return: A boolean indicating the correct value of the critical flag for an extension, based on information from RFC5280 and RFC 6960. The correct value is based on the terminology SHOULD or MUST.
[ ":", "return", ":", "A", "boolean", "indicating", "the", "correct", "value", "of", "the", "critical", "flag", "for", "an", "extension", "based", "on", "information", "from", "RFC5280", "and", "RFC", "6960", ".", "The", "correct", "value", "is", "based", "o...
train
https://github.com/wbond/csrbuilder/blob/269565e7772fb0081bc3e954e622f5b3b8ce3e30/csrbuilder/__init__.py#L410-L440
wbond/csrbuilder
csrbuilder/__init__.py
CSRBuilder.build
def build(self, signing_private_key): """ Validates the certificate information, constructs an X.509 certificate and then signs it :param signing_private_key: An asn1crypto.keys.PrivateKeyInfo or oscrypto.asymmetric.PrivateKey object for the private key to sign t...
python
def build(self, signing_private_key): """ Validates the certificate information, constructs an X.509 certificate and then signs it :param signing_private_key: An asn1crypto.keys.PrivateKeyInfo or oscrypto.asymmetric.PrivateKey object for the private key to sign t...
[ "def", "build", "(", "self", ",", "signing_private_key", ")", ":", "is_oscrypto", "=", "isinstance", "(", "signing_private_key", ",", "asymmetric", ".", "PrivateKey", ")", "if", "not", "isinstance", "(", "signing_private_key", ",", "keys", ".", "PrivateKeyInfo", ...
Validates the certificate information, constructs an X.509 certificate and then signs it :param signing_private_key: An asn1crypto.keys.PrivateKeyInfo or oscrypto.asymmetric.PrivateKey object for the private key to sign the request with. This should be the private ke...
[ "Validates", "the", "certificate", "information", "constructs", "an", "X", ".", "509", "certificate", "and", "then", "signs", "it" ]
train
https://github.com/wbond/csrbuilder/blob/269565e7772fb0081bc3e954e622f5b3b8ce3e30/csrbuilder/__init__.py#L442-L520
HDI-Project/ballet
ballet/modeler.py
Modeler.compute_metrics_cv
def compute_metrics_cv(self, X, y, **kwargs): '''Compute cross-validated metrics. Trains this model on data X with labels y. Returns a list of dict with keys name, scoring_name, value. Args: X (Union[np.array, pd.DataFrame]): data y (Union[np.array, pd.DataFrame, pd.Ser...
python
def compute_metrics_cv(self, X, y, **kwargs): '''Compute cross-validated metrics. Trains this model on data X with labels y. Returns a list of dict with keys name, scoring_name, value. Args: X (Union[np.array, pd.DataFrame]): data y (Union[np.array, pd.DataFrame, pd.Ser...
[ "def", "compute_metrics_cv", "(", "self", ",", "X", ",", "y", ",", "*", "*", "kwargs", ")", ":", "# compute scores", "results", "=", "self", ".", "cv_score_mean", "(", "X", ",", "y", ")", "return", "results" ]
Compute cross-validated metrics. Trains this model on data X with labels y. Returns a list of dict with keys name, scoring_name, value. Args: X (Union[np.array, pd.DataFrame]): data y (Union[np.array, pd.DataFrame, pd.Series]): labels
[ "Compute", "cross", "-", "validated", "metrics", "." ]
train
https://github.com/HDI-Project/ballet/blob/6f4d4b87b8234cb6bb38b9e9484a58ef8fe8fdb2/ballet/modeler.py#L86-L99
HDI-Project/ballet
ballet/modeler.py
Modeler.cv_score_mean
def cv_score_mean(self, X, y): '''Compute mean score across cross validation folds. Split data and labels into cross validation folds and fit the model for each fold. Then, for each scoring type in scorings, compute the score. Finally, average the scores across folds. Returns a dictiona...
python
def cv_score_mean(self, X, y): '''Compute mean score across cross validation folds. Split data and labels into cross validation folds and fit the model for each fold. Then, for each scoring type in scorings, compute the score. Finally, average the scores across folds. Returns a dictiona...
[ "def", "cv_score_mean", "(", "self", ",", "X", ",", "y", ")", ":", "X", ",", "y", "=", "self", ".", "_format_inputs", "(", "X", ",", "y", ")", "if", "self", ".", "problem_type", ".", "binary_classification", ":", "kf", "=", "StratifiedKFold", "(", "s...
Compute mean score across cross validation folds. Split data and labels into cross validation folds and fit the model for each fold. Then, for each scoring type in scorings, compute the score. Finally, average the scores across folds. Returns a dictionary mapping scoring to score. ...
[ "Compute", "mean", "score", "across", "cross", "validation", "folds", "." ]
train
https://github.com/HDI-Project/ballet/blob/6f4d4b87b8234cb6bb38b9e9484a58ef8fe8fdb2/ballet/modeler.py#L125-L165
HDI-Project/ballet
ballet/contrib.py
get_contrib_features
def get_contrib_features(project_root): """Get contributed features for a project at project_root For a project ``foo``, walks modules within the ``foo.features.contrib`` subpackage. A single object that is an instance of ``ballet.Feature`` is imported if present in each module. The resulting ``Feature...
python
def get_contrib_features(project_root): """Get contributed features for a project at project_root For a project ``foo``, walks modules within the ``foo.features.contrib`` subpackage. A single object that is an instance of ``ballet.Feature`` is imported if present in each module. The resulting ``Feature...
[ "def", "get_contrib_features", "(", "project_root", ")", ":", "# TODO Project should require ModuleType", "project", "=", "Project", "(", "project_root", ")", "contrib", "=", "project", ".", "_resolve", "(", "'.features.contrib'", ")", "return", "_get_contrib_features", ...
Get contributed features for a project at project_root For a project ``foo``, walks modules within the ``foo.features.contrib`` subpackage. A single object that is an instance of ``ballet.Feature`` is imported if present in each module. The resulting ``Feature`` objects are collected. Args: ...
[ "Get", "contributed", "features", "for", "a", "project", "at", "project_root" ]
train
https://github.com/HDI-Project/ballet/blob/6f4d4b87b8234cb6bb38b9e9484a58ef8fe8fdb2/ballet/contrib.py#L16-L33
HDI-Project/ballet
ballet/contrib.py
_get_contrib_features
def _get_contrib_features(module): """Get contributed features from within given module Be very careful with untrusted code. The module/package will be walked, every submodule will be imported, and all the code therein will be executed. But why would you be trying to import from an untrusted package ...
python
def _get_contrib_features(module): """Get contributed features from within given module Be very careful with untrusted code. The module/package will be walked, every submodule will be imported, and all the code therein will be executed. But why would you be trying to import from an untrusted package ...
[ "def", "_get_contrib_features", "(", "module", ")", ":", "if", "isinstance", "(", "module", ",", "types", ".", "ModuleType", ")", ":", "# any module that has a __path__ attribute is also a package", "if", "hasattr", "(", "module", ",", "'__path__'", ")", ":", "yield...
Get contributed features from within given module Be very careful with untrusted code. The module/package will be walked, every submodule will be imported, and all the code therein will be executed. But why would you be trying to import from an untrusted package anyway? Args: contrib (modu...
[ "Get", "contributed", "features", "from", "within", "given", "module" ]
train
https://github.com/HDI-Project/ballet/blob/6f4d4b87b8234cb6bb38b9e9484a58ef8fe8fdb2/ballet/contrib.py#L38-L61
HDI-Project/ballet
ballet/cli.py
quickstart
def quickstart(): """Generate a brand-new ballet project""" import ballet.templating import ballet.util.log ballet.util.log.enable(level='INFO', format=ballet.util.log.SIMPLE_LOG_FORMAT, echo=False) ballet.templating.render_project_template()
python
def quickstart(): """Generate a brand-new ballet project""" import ballet.templating import ballet.util.log ballet.util.log.enable(level='INFO', format=ballet.util.log.SIMPLE_LOG_FORMAT, echo=False) ballet.templating.render_project_template()
[ "def", "quickstart", "(", ")", ":", "import", "ballet", ".", "templating", "import", "ballet", ".", "util", ".", "log", "ballet", ".", "util", ".", "log", ".", "enable", "(", "level", "=", "'INFO'", ",", "format", "=", "ballet", ".", "util", ".", "lo...
Generate a brand-new ballet project
[ "Generate", "a", "brand", "-", "new", "ballet", "project" ]
train
https://github.com/HDI-Project/ballet/blob/6f4d4b87b8234cb6bb38b9e9484a58ef8fe8fdb2/ballet/cli.py#L13-L20
HDI-Project/ballet
ballet/cli.py
update_project_template
def update_project_template(push): """Update an existing ballet project from the upstream template""" import ballet.update import ballet.util.log ballet.util.log.enable(level='INFO', format=ballet.util.log.SIMPLE_LOG_FORMAT, echo=False) ballet.up...
python
def update_project_template(push): """Update an existing ballet project from the upstream template""" import ballet.update import ballet.util.log ballet.util.log.enable(level='INFO', format=ballet.util.log.SIMPLE_LOG_FORMAT, echo=False) ballet.up...
[ "def", "update_project_template", "(", "push", ")", ":", "import", "ballet", ".", "update", "import", "ballet", ".", "util", ".", "log", "ballet", ".", "util", ".", "log", ".", "enable", "(", "level", "=", "'INFO'", ",", "format", "=", "ballet", ".", "...
Update an existing ballet project from the upstream template
[ "Update", "an", "existing", "ballet", "project", "from", "the", "upstream", "template" ]
train
https://github.com/HDI-Project/ballet/blob/6f4d4b87b8234cb6bb38b9e9484a58ef8fe8fdb2/ballet/cli.py#L27-L34
HDI-Project/ballet
ballet/cli.py
start_new_feature
def start_new_feature(): """Start working on a new feature from a template""" import ballet.templating import ballet.util.log ballet.util.log.enable(level='INFO', format=ballet.util.log.SIMPLE_LOG_FORMAT, echo=False) ballet.templating.start_new_f...
python
def start_new_feature(): """Start working on a new feature from a template""" import ballet.templating import ballet.util.log ballet.util.log.enable(level='INFO', format=ballet.util.log.SIMPLE_LOG_FORMAT, echo=False) ballet.templating.start_new_f...
[ "def", "start_new_feature", "(", ")", ":", "import", "ballet", ".", "templating", "import", "ballet", ".", "util", ".", "log", "ballet", ".", "util", ".", "log", ".", "enable", "(", "level", "=", "'INFO'", ",", "format", "=", "ballet", ".", "util", "."...
Start working on a new feature from a template
[ "Start", "working", "on", "a", "new", "feature", "from", "a", "template" ]
train
https://github.com/HDI-Project/ballet/blob/6f4d4b87b8234cb6bb38b9e9484a58ef8fe8fdb2/ballet/cli.py#L38-L45
HDI-Project/ballet
ballet/util/io.py
write_tabular
def write_tabular(obj, filepath): """Write tabular object in HDF5 or pickle format Args: obj (array or DataFrame): tabular object to write filepath (path-like): path to write to; must end in '.h5' or '.pkl' """ _, fn, ext = splitext2(filepath) if ext == '.h5': _write_tabular...
python
def write_tabular(obj, filepath): """Write tabular object in HDF5 or pickle format Args: obj (array or DataFrame): tabular object to write filepath (path-like): path to write to; must end in '.h5' or '.pkl' """ _, fn, ext = splitext2(filepath) if ext == '.h5': _write_tabular...
[ "def", "write_tabular", "(", "obj", ",", "filepath", ")", ":", "_", ",", "fn", ",", "ext", "=", "splitext2", "(", "filepath", ")", "if", "ext", "==", "'.h5'", ":", "_write_tabular_h5", "(", "obj", ",", "filepath", ")", "elif", "ext", "==", "'.pkl'", ...
Write tabular object in HDF5 or pickle format Args: obj (array or DataFrame): tabular object to write filepath (path-like): path to write to; must end in '.h5' or '.pkl'
[ "Write", "tabular", "object", "in", "HDF5", "or", "pickle", "format" ]
train
https://github.com/HDI-Project/ballet/blob/6f4d4b87b8234cb6bb38b9e9484a58ef8fe8fdb2/ballet/util/io.py#L20-L33
HDI-Project/ballet
ballet/util/io.py
read_tabular
def read_tabular(filepath): """Read tabular object in HDF5 or pickle format Args: filepath (path-like): path to read to; must end in '.h5' or '.pkl' """ _, fn, ext = splitext2(filepath) if ext == '.h5': return _read_tabular_h5(filepath) elif ext == '.pkl': return _read_t...
python
def read_tabular(filepath): """Read tabular object in HDF5 or pickle format Args: filepath (path-like): path to read to; must end in '.h5' or '.pkl' """ _, fn, ext = splitext2(filepath) if ext == '.h5': return _read_tabular_h5(filepath) elif ext == '.pkl': return _read_t...
[ "def", "read_tabular", "(", "filepath", ")", ":", "_", ",", "fn", ",", "ext", "=", "splitext2", "(", "filepath", ")", "if", "ext", "==", "'.h5'", ":", "return", "_read_tabular_h5", "(", "filepath", ")", "elif", "ext", "==", "'.pkl'", ":", "return", "_r...
Read tabular object in HDF5 or pickle format Args: filepath (path-like): path to read to; must end in '.h5' or '.pkl'
[ "Read", "tabular", "object", "in", "HDF5", "or", "pickle", "format" ]
train
https://github.com/HDI-Project/ballet/blob/6f4d4b87b8234cb6bb38b9e9484a58ef8fe8fdb2/ballet/util/io.py#L60-L72
HDI-Project/ballet
ballet/util/io.py
load_table_from_config
def load_table_from_config(input_dir, config): """Load table from table config dict Args: input_dir (path-like): directory containing input files config (dict): mapping with keys 'name', 'path', and 'pd_read_kwargs'. Returns: pd.DataFrame """ path = pathlib.Path(input_dir)....
python
def load_table_from_config(input_dir, config): """Load table from table config dict Args: input_dir (path-like): directory containing input files config (dict): mapping with keys 'name', 'path', and 'pd_read_kwargs'. Returns: pd.DataFrame """ path = pathlib.Path(input_dir)....
[ "def", "load_table_from_config", "(", "input_dir", ",", "config", ")", ":", "path", "=", "pathlib", ".", "Path", "(", "input_dir", ")", ".", "joinpath", "(", "config", "[", "'path'", "]", ")", "kwargs", "=", "config", "[", "'pd_read_kwargs'", "]", "return"...
Load table from table config dict Args: input_dir (path-like): directory containing input files config (dict): mapping with keys 'name', 'path', and 'pd_read_kwargs'. Returns: pd.DataFrame
[ "Load", "table", "from", "table", "config", "dict" ]
train
https://github.com/HDI-Project/ballet/blob/6f4d4b87b8234cb6bb38b9e9484a58ef8fe8fdb2/ballet/util/io.py#L118-L130
HDI-Project/ballet
ballet/validation/main.py
validate_feature_api
def validate_feature_api(project, force=False): """Validate feature API""" if not force and not project.on_pr(): raise SkippedValidationTest('Not on PR') validator = FeatureApiValidator(project) result = validator.validate() if not result: raise InvalidFeatureApi
python
def validate_feature_api(project, force=False): """Validate feature API""" if not force and not project.on_pr(): raise SkippedValidationTest('Not on PR') validator = FeatureApiValidator(project) result = validator.validate() if not result: raise InvalidFeatureApi
[ "def", "validate_feature_api", "(", "project", ",", "force", "=", "False", ")", ":", "if", "not", "force", "and", "not", "project", ".", "on_pr", "(", ")", ":", "raise", "SkippedValidationTest", "(", "'Not on PR'", ")", "validator", "=", "FeatureApiValidator",...
Validate feature API
[ "Validate", "feature", "API" ]
train
https://github.com/HDI-Project/ballet/blob/6f4d4b87b8234cb6bb38b9e9484a58ef8fe8fdb2/ballet/validation/main.py#L61-L69
HDI-Project/ballet
ballet/validation/main.py
evaluate_feature_performance
def evaluate_feature_performance(project, force=False): """Evaluate feature performance""" if not force and not project.on_pr(): raise SkippedValidationTest('Not on PR') out = project.build() X_df, y, features = out['X_df'], out['y'], out['features'] proposed_feature = get_proposed_feature...
python
def evaluate_feature_performance(project, force=False): """Evaluate feature performance""" if not force and not project.on_pr(): raise SkippedValidationTest('Not on PR') out = project.build() X_df, y, features = out['X_df'], out['y'], out['features'] proposed_feature = get_proposed_feature...
[ "def", "evaluate_feature_performance", "(", "project", ",", "force", "=", "False", ")", ":", "if", "not", "force", "and", "not", "project", ".", "on_pr", "(", ")", ":", "raise", "SkippedValidationTest", "(", "'Not on PR'", ")", "out", "=", "project", ".", ...
Evaluate feature performance
[ "Evaluate", "feature", "performance" ]
train
https://github.com/HDI-Project/ballet/blob/6f4d4b87b8234cb6bb38b9e9484a58ef8fe8fdb2/ballet/validation/main.py#L73-L87
HDI-Project/ballet
ballet/validation/main.py
prune_existing_features
def prune_existing_features(project, force=False): """Prune existing features""" if not force and not project.on_master_after_merge(): raise SkippedValidationTest('Not on master') out = project.build() X_df, y, features = out['X_df'], out['y'], out['features'] proposed_feature = get_propose...
python
def prune_existing_features(project, force=False): """Prune existing features""" if not force and not project.on_master_after_merge(): raise SkippedValidationTest('Not on master') out = project.build() X_df, y, features = out['X_df'], out['y'], out['features'] proposed_feature = get_propose...
[ "def", "prune_existing_features", "(", "project", ",", "force", "=", "False", ")", ":", "if", "not", "force", "and", "not", "project", ".", "on_master_after_merge", "(", ")", ":", "raise", "SkippedValidationTest", "(", "'Not on master'", ")", "out", "=", "proj...
Prune existing features
[ "Prune", "existing", "features" ]
train
https://github.com/HDI-Project/ballet/blob/6f4d4b87b8234cb6bb38b9e9484a58ef8fe8fdb2/ballet/validation/main.py#L91-L108
HDI-Project/ballet
ballet/validation/main.py
validate
def validate(package, test_target_type=None): """Entrypoint for ./validate.py script in ballet projects""" project = Project(package) if test_target_type is None: test_target_type = detect_target_type() if test_target_type == BalletTestTypes.PROJECT_STRUCTURE_VALIDATION: check_project_...
python
def validate(package, test_target_type=None): """Entrypoint for ./validate.py script in ballet projects""" project = Project(package) if test_target_type is None: test_target_type = detect_target_type() if test_target_type == BalletTestTypes.PROJECT_STRUCTURE_VALIDATION: check_project_...
[ "def", "validate", "(", "package", ",", "test_target_type", "=", "None", ")", ":", "project", "=", "Project", "(", "package", ")", "if", "test_target_type", "is", "None", ":", "test_target_type", "=", "detect_target_type", "(", ")", "if", "test_target_type", "...
Entrypoint for ./validate.py script in ballet projects
[ "Entrypoint", "for", ".", "/", "validate", ".", "py", "script", "in", "ballet", "projects" ]
train
https://github.com/HDI-Project/ballet/blob/6f4d4b87b8234cb6bb38b9e9484a58ef8fe8fdb2/ballet/validation/main.py#L111-L130