hexsha
stringlengths
40
40
repo
stringlengths
7
114
path
stringlengths
4
124
license
listlengths
1
9
language
stringclasses
1 value
identifier
stringlengths
1
71
return_type
stringlengths
1
749
⌀
original_string
stringlengths
76
22.7k
original_docstring
stringlengths
16
7.61k
docstring
stringlengths
16
2.47k
docstring_tokens
listlengths
6
477
code
stringlengths
14
10.2k
code_tokens
listlengths
6
996
short_docstring
stringlengths
2
644
short_docstring_tokens
listlengths
1
116
comment
listlengths
1
89
parameters
listlengths
0
64
docstring_params
dict
efd14bad3862a768cae695ff816e251c13b161c8
maneeshd/braintree_python
braintree/transparent_redirect_gateway.py
[ "MIT" ]
Python
url
<not_specific>
def url(self): """ Returns the url for POSTing Transparent Redirect HTML forms """ return self.config.base_url() + self.config.base_merchant_path() + "/transparent_redirect_requests"
Returns the url for POSTing Transparent Redirect HTML forms
Returns the url for POSTing Transparent Redirect HTML forms
[ "Returns", "the", "url", "for", "POSTing", "Transparent", "Redirect", "HTML", "forms" ]
def url(self): return self.config.base_url() + self.config.base_merchant_path() + "/transparent_redirect_requests"
[ "def", "url", "(", "self", ")", ":", "return", "self", ".", "config", ".", "base_url", "(", ")", "+", "self", ".", "config", ".", "base_merchant_path", "(", ")", "+", "\"/transparent_redirect_requests\"" ]
Returns the url for POSTing Transparent Redirect HTML forms
[ "Returns", "the", "url", "for", "POSTing", "Transparent", "Redirect", "HTML", "forms" ]
[ "\"\"\"\n Returns the url for POSTing Transparent Redirect HTML forms\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
fbe3dee360559b0cb7ad8d74a43cf30f6cb3789f
mstipanov/ariston-aqua-remotethermo-home-assistant
custom_components/aquaariston/binary_sensor.py
[ "MIT" ]
Python
available
<not_specific>
def available(self): """Return True if entity is available.""" if self._sensor_type == PARAM_ONLINE: return True elif self._sensor_type == PARAM_CHANGING_DATA: return self._api.available else: return ( self._api.available ...
Return True if entity is available.
Return True if entity is available.
[ "Return", "True", "if", "entity", "is", "available", "." ]
def available(self): if self._sensor_type == PARAM_ONLINE: return True elif self._sensor_type == PARAM_CHANGING_DATA: return self._api.available else: return ( self._api.available and not self._api.sensor_values[self._sensor_typ...
[ "def", "available", "(", "self", ")", ":", "if", "self", ".", "_sensor_type", "==", "PARAM_ONLINE", ":", "return", "True", "elif", "self", ".", "_sensor_type", "==", "PARAM_CHANGING_DATA", ":", "return", "self", ".", "_api", ".", "available", "else", ":", ...
Return True if entity is available.
[ "Return", "True", "if", "entity", "is", "available", "." ]
[ "\"\"\"Return True if entity is available.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b38cde7fbcfbfc874017cd982d0688ec364b167e
mstipanov/ariston-aqua-remotethermo-home-assistant
custom_components/aquaariston/water_heater.py
[ "MIT" ]
Python
icon
<not_specific>
def icon(self): """Return the name of the Water Heater device.""" power_on = False try: if self._api.available: power_on = self._api.sensor_values[PARAM_ON][VALUE] except KeyError: return "mdi:water-pump-off" if power_on: return...
Return the name of the Water Heater device.
Return the name of the Water Heater device.
[ "Return", "the", "name", "of", "the", "Water", "Heater", "device", "." ]
def icon(self): power_on = False try: if self._api.available: power_on = self._api.sensor_values[PARAM_ON][VALUE] except KeyError: return "mdi:water-pump-off" if power_on: return "mdi:water-pump" else: return "mdi:wa...
[ "def", "icon", "(", "self", ")", ":", "power_on", "=", "False", "try", ":", "if", "self", ".", "_api", ".", "available", ":", "power_on", "=", "self", ".", "_api", ".", "sensor_values", "[", "PARAM_ON", "]", "[", "VALUE", "]", "except", "KeyError", "...
Return the name of the Water Heater device.
[ "Return", "the", "name", "of", "the", "Water", "Heater", "device", "." ]
[ "\"\"\"Return the name of the Water Heater device.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b38cde7fbcfbfc874017cd982d0688ec364b167e
mstipanov/ariston-aqua-remotethermo-home-assistant
custom_components/aquaariston/water_heater.py
[ "MIT" ]
Python
target_temperature
<not_specific>
def target_temperature(self): """Return the temperature we try to reach.""" try: target_temp = self._api.sensor_values[PARAM_REQUIRED_TEMPERATURE][VALUE] except KeyError: return UNKNOWN_TEMP return target_temp
Return the temperature we try to reach.
Return the temperature we try to reach.
[ "Return", "the", "temperature", "we", "try", "to", "reach", "." ]
def target_temperature(self): try: target_temp = self._api.sensor_values[PARAM_REQUIRED_TEMPERATURE][VALUE] except KeyError: return UNKNOWN_TEMP return target_temp
[ "def", "target_temperature", "(", "self", ")", ":", "try", ":", "target_temp", "=", "self", ".", "_api", ".", "sensor_values", "[", "PARAM_REQUIRED_TEMPERATURE", "]", "[", "VALUE", "]", "except", "KeyError", ":", "return", "UNKNOWN_TEMP", "return", "target_temp"...
Return the temperature we try to reach.
[ "Return", "the", "temperature", "we", "try", "to", "reach", "." ]
[ "\"\"\"Return the temperature we try to reach.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b38cde7fbcfbfc874017cd982d0688ec364b167e
mstipanov/ariston-aqua-remotethermo-home-assistant
custom_components/aquaariston/water_heater.py
[ "MIT" ]
Python
target_temperature_step
<not_specific>
def target_temperature_step(self): """Return the supported step of target temperature.""" try: step = self._api.supported_sensors_set_values[PARAM_REQUIRED_TEMPERATURE]["step"] except KeyError: return 1.0 return step
Return the supported step of target temperature.
Return the supported step of target temperature.
[ "Return", "the", "supported", "step", "of", "target", "temperature", "." ]
def target_temperature_step(self): try: step = self._api.supported_sensors_set_values[PARAM_REQUIRED_TEMPERATURE]["step"] except KeyError: return 1.0 return step
[ "def", "target_temperature_step", "(", "self", ")", ":", "try", ":", "step", "=", "self", ".", "_api", ".", "supported_sensors_set_values", "[", "PARAM_REQUIRED_TEMPERATURE", "]", "[", "\"step\"", "]", "except", "KeyError", ":", "return", "1.0", "return", "step"...
Return the supported step of target temperature.
[ "Return", "the", "supported", "step", "of", "target", "temperature", "." ]
[ "\"\"\"Return the supported step of target temperature.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b38cde7fbcfbfc874017cd982d0688ec364b167e
mstipanov/ariston-aqua-remotethermo-home-assistant
custom_components/aquaariston/water_heater.py
[ "MIT" ]
Python
extra_state_attributes
<not_specific>
def extra_state_attributes(self): """Return the supported step of target temperature.""" try: step = self._api.supported_sensors_set_values[PARAM_REQUIRED_TEMPERATURE]["step"] except KeyError: step = 1.0 try: if self._api.sensor_values[PARAM_HEATING][V...
Return the supported step of target temperature.
Return the supported step of target temperature.
[ "Return", "the", "supported", "step", "of", "target", "temperature", "." ]
def extra_state_attributes(self): try: step = self._api.supported_sensors_set_values[PARAM_REQUIRED_TEMPERATURE]["step"] except KeyError: step = 1.0 try: if self._api.sensor_values[PARAM_HEATING][VALUE]: action = ACTION_HEATING else...
[ "def", "extra_state_attributes", "(", "self", ")", ":", "try", ":", "step", "=", "self", ".", "_api", ".", "supported_sensors_set_values", "[", "PARAM_REQUIRED_TEMPERATURE", "]", "[", "\"step\"", "]", "except", "KeyError", ":", "step", "=", "1.0", "try", ":", ...
Return the supported step of target temperature.
[ "Return", "the", "supported", "step", "of", "target", "temperature", "." ]
[ "\"\"\"Return the supported step of target temperature.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b38cde7fbcfbfc874017cd982d0688ec364b167e
mstipanov/ariston-aqua-remotethermo-home-assistant
custom_components/aquaariston/water_heater.py
[ "MIT" ]
Python
operation_list
<not_specific>
def operation_list(self): """List of available operation modes.""" try: op_list = [*self._api.supported_sensors_set_values[PARAM_MODE]] except KeyError: return [] return op_list
List of available operation modes.
List of available operation modes.
[ "List", "of", "available", "operation", "modes", "." ]
def operation_list(self): try: op_list = [*self._api.supported_sensors_set_values[PARAM_MODE]] except KeyError: return [] return op_list
[ "def", "operation_list", "(", "self", ")", ":", "try", ":", "op_list", "=", "[", "*", "self", ".", "_api", ".", "supported_sensors_set_values", "[", "PARAM_MODE", "]", "]", "except", "KeyError", ":", "return", "[", "]", "return", "op_list" ]
List of available operation modes.
[ "List", "of", "available", "operation", "modes", "." ]
[ "\"\"\"List of available operation modes.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9b009e6a5263407ac7976f56cc9d291f3bd05109
mstipanov/ariston-aqua-remotethermo-home-assistant
custom_components/aquaariston/sensor.py
[ "MIT" ]
Python
icon
<not_specific>
def icon(self): """Icon to use in the frontend, if any.""" if self._sensor_type == PARAM_ERRORS: try: if self._api.sensor_values[PARAM_ERRORS][VALUE] == []: return "mdi:shield" except KeyError: pass elif self._sensor_typ...
Icon to use in the frontend, if any.
Icon to use in the frontend, if any.
[ "Icon", "to", "use", "in", "the", "frontend", "if", "any", "." ]
def icon(self): if self._sensor_type == PARAM_ERRORS: try: if self._api.sensor_values[PARAM_ERRORS][VALUE] == []: return "mdi:shield" except KeyError: pass elif self._sensor_type == PARAM_MODE: try: i...
[ "def", "icon", "(", "self", ")", ":", "if", "self", ".", "_sensor_type", "==", "PARAM_ERRORS", ":", "try", ":", "if", "self", ".", "_api", ".", "sensor_values", "[", "PARAM_ERRORS", "]", "[", "VALUE", "]", "==", "[", "]", ":", "return", "\"mdi:shield\"...
Icon to use in the frontend, if any.
[ "Icon", "to", "use", "in", "the", "frontend", "if", "any", "." ]
[ "\"\"\"Icon to use in the frontend, if any.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9b009e6a5263407ac7976f56cc9d291f3bd05109
mstipanov/ariston-aqua-remotethermo-home-assistant
custom_components/aquaariston/sensor.py
[ "MIT" ]
Python
unit_of_measurement
<not_specific>
def unit_of_measurement(self): """Return the units of measurement.""" if self._sensor_type == PARAM_TEMPERATURE_MODE: return None try: return self._api.sensor_values[self._sensor_type][UNITS] except KeyError: return None
Return the units of measurement.
Return the units of measurement.
[ "Return", "the", "units", "of", "measurement", "." ]
def unit_of_measurement(self): if self._sensor_type == PARAM_TEMPERATURE_MODE: return None try: return self._api.sensor_values[self._sensor_type][UNITS] except KeyError: return None
[ "def", "unit_of_measurement", "(", "self", ")", ":", "if", "self", ".", "_sensor_type", "==", "PARAM_TEMPERATURE_MODE", ":", "return", "None", "try", ":", "return", "self", ".", "_api", ".", "sensor_values", "[", "self", ".", "_sensor_type", "]", "[", "UNITS...
Return the units of measurement.
[ "Return", "the", "units", "of", "measurement", "." ]
[ "\"\"\"Return the units of measurement.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9b009e6a5263407ac7976f56cc9d291f3bd05109
mstipanov/ariston-aqua-remotethermo-home-assistant
custom_components/aquaariston/sensor.py
[ "MIT" ]
Python
available
<not_specific>
def available(self): """Return True if entity is available.""" if self._sensor_type == PARAM_TEMPERATURE_MODE: return self._api.available return self._api.available \ and not self._api.sensor_values[self._sensor_type][VALUE] is None
Return True if entity is available.
Return True if entity is available.
[ "Return", "True", "if", "entity", "is", "available", "." ]
def available(self): if self._sensor_type == PARAM_TEMPERATURE_MODE: return self._api.available return self._api.available \ and not self._api.sensor_values[self._sensor_type][VALUE] is None
[ "def", "available", "(", "self", ")", ":", "if", "self", ".", "_sensor_type", "==", "PARAM_TEMPERATURE_MODE", ":", "return", "self", ".", "_api", ".", "available", "return", "self", ".", "_api", ".", "available", "and", "not", "self", ".", "_api", ".", "...
Return True if entity is available.
[ "Return", "True", "if", "entity", "is", "available", "." ]
[ "\"\"\"Return True if entity is available.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9b009e6a5263407ac7976f56cc9d291f3bd05109
mstipanov/ariston-aqua-remotethermo-home-assistant
custom_components/aquaariston/sensor.py
[ "MIT" ]
Python
update
<not_specific>
def update(self): """Get the latest data and updates the state.""" try: if self._sensor_type == PARAM_TEMPERATURE_MODE: self._state = self._api.temperature_mode return if not self._api.available: return if not self._api....
Get the latest data and updates the state.
Get the latest data and updates the state.
[ "Get", "the", "latest", "data", "and", "updates", "the", "state", "." ]
def update(self): try: if self._sensor_type == PARAM_TEMPERATURE_MODE: self._state = self._api.temperature_mode return if not self._api.available: return if not self._api.sensor_values[self._sensor_type][VALUE] is None: ...
[ "def", "update", "(", "self", ")", ":", "try", ":", "if", "self", ".", "_sensor_type", "==", "PARAM_TEMPERATURE_MODE", ":", "self", ".", "_state", "=", "self", ".", "_api", ".", "temperature_mode", "return", "if", "not", "self", ".", "_api", ".", "availa...
Get the latest data and updates the state.
[ "Get", "the", "latest", "data", "and", "updates", "the", "state", "." ]
[ "\"\"\"Get the latest data and updates the state.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9314152d8185be34a66420ff572e5f824a49d4df
mstipanov/ariston-aqua-remotethermo-home-assistant
custom_components/aquaariston/switch.py
[ "MIT" ]
Python
available
<not_specific>
def available(self): """Return True if entity is available.""" try: return ( self._api.available and not self._api.sensor_values[self._switch_type][VALUE] is None ) except KeyError: return False
Return True if entity is available.
Return True if entity is available.
[ "Return", "True", "if", "entity", "is", "available", "." ]
def available(self): try: return ( self._api.available and not self._api.sensor_values[self._switch_type][VALUE] is None ) except KeyError: return False
[ "def", "available", "(", "self", ")", ":", "try", ":", "return", "(", "self", ".", "_api", ".", "available", "and", "not", "self", ".", "_api", ".", "sensor_values", "[", "self", ".", "_switch_type", "]", "[", "VALUE", "]", "is", "None", ")", "except...
Return True if entity is available.
[ "Return", "True", "if", "entity", "is", "available", "." ]
[ "\"\"\"Return True if entity is available.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9314152d8185be34a66420ff572e5f824a49d4df
mstipanov/ariston-aqua-remotethermo-home-assistant
custom_components/aquaariston/switch.py
[ "MIT" ]
Python
is_on
<not_specific>
def is_on(self): """Return true if switch is on.""" try: if not self._api.available: return False return self._api.sensor_values[self._switch_type][VALUE] except KeyError: return False
Return true if switch is on.
Return true if switch is on.
[ "Return", "true", "if", "switch", "is", "on", "." ]
def is_on(self): try: if not self._api.available: return False return self._api.sensor_values[self._switch_type][VALUE] except KeyError: return False
[ "def", "is_on", "(", "self", ")", ":", "try", ":", "if", "not", "self", ".", "_api", ".", "available", ":", "return", "False", "return", "self", ".", "_api", ".", "sensor_values", "[", "self", ".", "_switch_type", "]", "[", "VALUE", "]", "except", "K...
Return true if switch is on.
[ "Return", "true", "if", "switch", "is", "on", "." ]
[ "\"\"\"Return true if switch is on.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cf7eca9d47c2361d1c7674d9bb0a08265ee35bb3
tisnik/insights-core
insights/client/connection.py
[ "Apache-2.0" ]
Python
_init_session
<not_specific>
def _init_session(self): """ Set up the session, auth is handled here """ session = requests.Session() session.headers = {'User-Agent': self.user_agent, 'Accept': 'application/json'} if self.systemid is not None: session.headers.upda...
Set up the session, auth is handled here
Set up the session, auth is handled here
[ "Set", "up", "the", "session", "auth", "is", "handled", "here" ]
def _init_session(self): session = requests.Session() session.headers = {'User-Agent': self.user_agent, 'Accept': 'application/json'} if self.systemid is not None: session.headers.update({'systemid': self.systemid}) if self.authmethod == "BASIC": ...
[ "def", "_init_session", "(", "self", ")", ":", "session", "=", "requests", ".", "Session", "(", ")", "session", ".", "headers", "=", "{", "'User-Agent'", ":", "self", ".", "user_agent", ",", "'Accept'", ":", "'application/json'", "}", "if", "self", ".", ...
Set up the session, auth is handled here
[ "Set", "up", "the", "session", "auth", "is", "handled", "here" ]
[ "\"\"\"\n Set up the session, auth is handled here\n \"\"\"", "# HACKY", "# Need to make a request that will fail to get proxies set up", "# Major hack, requests/urllib3 does not make access to", "# proxy_headers easy" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cf7eca9d47c2361d1c7674d9bb0a08265ee35bb3
tisnik/insights-core
insights/client/connection.py
[ "Apache-2.0" ]
Python
handle_fail_rcs
<not_specific>
def handle_fail_rcs(self, req): """ Bail out if we get a 401 and leave a message """ try: logger.debug("HTTP Status Code: %s", req.status_code) logger.debug("HTTP Response Text: %s", req.text) logger.debug("HTTP Response Reason: %s", req.reason) ...
Bail out if we get a 401 and leave a message
Bail out if we get a 401 and leave a message
[ "Bail", "out", "if", "we", "get", "a", "401", "and", "leave", "a", "message" ]
def handle_fail_rcs(self, req): try: logger.debug("HTTP Status Code: %s", req.status_code) logger.debug("HTTP Response Text: %s", req.text) logger.debug("HTTP Response Reason: %s", req.reason) logger.debug("HTTP Response Content: %s", req.content) except: ...
[ "def", "handle_fail_rcs", "(", "self", ",", "req", ")", ":", "try", ":", "logger", ".", "debug", "(", "\"HTTP Status Code: %s\"", ",", "req", ".", "status_code", ")", "logger", ".", "debug", "(", "\"HTTP Response Text: %s\"", ",", "req", ".", "text", ")", ...
Bail out if we get a 401 and leave a message
[ "Bail", "out", "if", "we", "get", "a", "401", "and", "leave", "a", "message" ]
[ "\"\"\"\n Bail out if we get a 401 and leave a message\n \"\"\"", "# attempt to read the HTTP response JSON message", "# handle specific status codes", "# failed registration because of entitlement limit hit", "# Insights disabled in satellite" ]
[ { "param": "self", "type": null }, { "param": "req", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "req", "type": null, "docstring": null, "docstring_tokens": []...
cf7eca9d47c2361d1c7674d9bb0a08265ee35bb3
tisnik/insights-core
insights/client/connection.py
[ "Apache-2.0" ]
Python
create_system
<not_specific>
def create_system(self, new_machine_id=False): """ Create the machine via the API """ client_hostname = determine_hostname() machine_id = generate_machine_id(new_machine_id) branch_info = self.config.branch_info if not branch_info: return False ...
Create the machine via the API
Create the machine via the API
[ "Create", "the", "machine", "via", "the", "API" ]
def create_system(self, new_machine_id=False): client_hostname = determine_hostname() machine_id = generate_machine_id(new_machine_id) branch_info = self.config.branch_info if not branch_info: return False remote_branch = branch_info['remote_branch'] remote_le...
[ "def", "create_system", "(", "self", ",", "new_machine_id", "=", "False", ")", ":", "client_hostname", "=", "determine_hostname", "(", ")", "machine_id", "=", "generate_machine_id", "(", "new_machine_id", ")", "branch_info", "=", "self", ".", "config", ".", "bra...
Create the machine via the API
[ "Create", "the", "machine", "via", "the", "API" ]
[ "\"\"\"\n Create the machine via the API\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "new_machine_id", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "new_machine_id", "type": null, "docstring": null, "docstring_...
cf7eca9d47c2361d1c7674d9bb0a08265ee35bb3
tisnik/insights-core
insights/client/connection.py
[ "Apache-2.0" ]
Python
group_systems
null
def group_systems(self, group_name, systems): """ Adds an array of systems to specified group Args: group_name: Display name of group systems: Array of {'machine_id': machine_id} """ api_group_id = None headers = {'Content-Type': 'application/json...
Adds an array of systems to specified group Args: group_name: Display name of group systems: Array of {'machine_id': machine_id}
Adds an array of systems to specified group
[ "Adds", "an", "array", "of", "systems", "to", "specified", "group" ]
def group_systems(self, group_name, systems): api_group_id = None headers = {'Content-Type': 'application/json'} group_path = self.api_url + '/v1/groups' group_get_path = group_path + ('?display_name=%s' % quote(group_name)) logger.debug("GET group: %s", group_get_path) n...
[ "def", "group_systems", "(", "self", ",", "group_name", ",", "systems", ")", ":", "api_group_id", "=", "None", "headers", "=", "{", "'Content-Type'", ":", "'application/json'", "}", "group_path", "=", "self", ".", "api_url", "+", "'/v1/groups'", "group_get_path"...
Adds an array of systems to specified group
[ "Adds", "an", "array", "of", "systems", "to", "specified", "group" ]
[ "\"\"\"\n Adds an array of systems to specified group\n\n Args:\n group_name: Display name of group\n systems: Array of {'machine_id': machine_id}\n \"\"\"", "# Group does not exist, POST to create" ]
[ { "param": "self", "type": null }, { "param": "group_name", "type": null }, { "param": "systems", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "group_name", "type": null, "docstring": "Display name of group", ...
cf7eca9d47c2361d1c7674d9bb0a08265ee35bb3
tisnik/insights-core
insights/client/connection.py
[ "Apache-2.0" ]
Python
_fetch_system_by_machine_id
<not_specific>
def _fetch_system_by_machine_id(self): ''' Get a system by machine ID Returns dict system exists in inventory False system does not exist in inventory None error connection or parsing response ''' machine_id = generate_machine_id() ...
Get a system by machine ID Returns dict system exists in inventory False system does not exist in inventory None error connection or parsing response
Get a system by machine ID Returns dict system exists in inventory False system does not exist in inventory None error connection or parsing response
[ "Get", "a", "system", "by", "machine", "ID", "Returns", "dict", "system", "exists", "in", "inventory", "False", "system", "does", "not", "exist", "in", "inventory", "None", "error", "connection", "or", "parsing", "response" ]
def _fetch_system_by_machine_id(self): machine_id = generate_machine_id() try: if self.config.legacy_upload: url = self.base_url + '/platform/inventory/v1/hosts?insights_id=' + machine_id else: url = self.base_url + '/inventory/v1/hosts?insights_id...
[ "def", "_fetch_system_by_machine_id", "(", "self", ")", ":", "machine_id", "=", "generate_machine_id", "(", ")", "try", ":", "if", "self", ".", "config", ".", "legacy_upload", ":", "url", "=", "self", ".", "base_url", "+", "'/platform/inventory/v1/hosts?insights_i...
Get a system by machine ID Returns dict system exists in inventory False system does not exist in inventory None error connection or parsing response
[ "Get", "a", "system", "by", "machine", "ID", "Returns", "dict", "system", "exists", "in", "inventory", "False", "system", "does", "not", "exist", "in", "inventory", "None", "error", "connection", "or", "parsing", "response" ]
[ "'''\n Get a system by machine ID\n Returns\n dict system exists in inventory\n False system does not exist in inventory\n None error connection or parsing response\n '''", "# [circus music]" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cf7eca9d47c2361d1c7674d9bb0a08265ee35bb3
tisnik/insights-core
insights/client/connection.py
[ "Apache-2.0" ]
Python
_legacy_unregister
<not_specific>
def _legacy_unregister(self): """ Unregister this system from the insights service """ machine_id = generate_machine_id() try: logger.debug("Unregistering %s", machine_id) url = self.api_url + "/v1/systems/" + machine_id net_logger.info("DELETE...
Unregister this system from the insights service
Unregister this system from the insights service
[ "Unregister", "this", "system", "from", "the", "insights", "service" ]
def _legacy_unregister(self): machine_id = generate_machine_id() try: logger.debug("Unregistering %s", machine_id) url = self.api_url + "/v1/systems/" + machine_id net_logger.info("DELETE %s", url) self.session.delete(url) logger.info( ...
[ "def", "_legacy_unregister", "(", "self", ")", ":", "machine_id", "=", "generate_machine_id", "(", ")", "try", ":", "logger", ".", "debug", "(", "\"Unregistering %s\"", ",", "machine_id", ")", "url", "=", "self", ".", "api_url", "+", "\"/v1/systems/\"", "+", ...
Unregister this system from the insights service
[ "Unregister", "this", "system", "from", "the", "insights", "service" ]
[ "\"\"\"\n Unregister this system from the insights service\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cf7eca9d47c2361d1c7674d9bb0a08265ee35bb3
tisnik/insights-core
insights/client/connection.py
[ "Apache-2.0" ]
Python
unregister
<not_specific>
def unregister(self): """ Unregister this system from the insights service """ if self.config.legacy_upload: return self._legacy_unregister() results = self._fetch_system_by_machine_id() try: logger.debug("Unregistering host...") url =...
Unregister this system from the insights service
Unregister this system from the insights service
[ "Unregister", "this", "system", "from", "the", "insights", "service" ]
def unregister(self): if self.config.legacy_upload: return self._legacy_unregister() results = self._fetch_system_by_machine_id() try: logger.debug("Unregistering host...") url = self.api_url + "/inventory/v1/hosts/" + results[0]['id'] net_logger.i...
[ "def", "unregister", "(", "self", ")", ":", "if", "self", ".", "config", ".", "legacy_upload", ":", "return", "self", ".", "_legacy_unregister", "(", ")", "results", "=", "self", ".", "_fetch_system_by_machine_id", "(", ")", "try", ":", "logger", ".", "deb...
Unregister this system from the insights service
[ "Unregister", "this", "system", "from", "the", "insights", "service" ]
[ "\"\"\"\n Unregister this system from the insights service\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cf7eca9d47c2361d1c7674d9bb0a08265ee35bb3
tisnik/insights-core
insights/client/connection.py
[ "Apache-2.0" ]
Python
_legacy_upload_archive
<not_specific>
def _legacy_upload_archive(self, data_collected, duration): ''' Do an HTTPS upload of the archive ''' file_name = os.path.basename(data_collected) try: from insights.contrib import magic m = magic.open(magic.MAGIC_MIME) m.load() mim...
Do an HTTPS upload of the archive
Do an HTTPS upload of the archive
[ "Do", "an", "HTTPS", "upload", "of", "the", "archive" ]
def _legacy_upload_archive(self, data_collected, duration): file_name = os.path.basename(data_collected) try: from insights.contrib import magic m = magic.open(magic.MAGIC_MIME) m.load() mime_type = m.file(data_collected) except ImportError: ...
[ "def", "_legacy_upload_archive", "(", "self", ",", "data_collected", ",", "duration", ")", ":", "file_name", "=", "os", ".", "path", ".", "basename", "(", "data_collected", ")", "try", ":", "from", "insights", ".", "contrib", "import", "magic", "m", "=", "...
Do an HTTPS upload of the archive
[ "Do", "an", "HTTPS", "upload", "of", "the", "archive" ]
[ "'''\n Do an HTTPS upload of the archive\n '''" ]
[ { "param": "self", "type": null }, { "param": "data_collected", "type": null }, { "param": "duration", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data_collected", "type": null, "docstring": null, "docstring_...
cf7eca9d47c2361d1c7674d9bb0a08265ee35bb3
tisnik/insights-core
insights/client/connection.py
[ "Apache-2.0" ]
Python
upload_archive
<not_specific>
def upload_archive(self, data_collected, content_type, duration): """ Do an HTTPS Upload of the archive """ if self.config.legacy_upload: return self._legacy_upload_archive(data_collected, duration) file_name = os.path.basename(data_collected) upload_url = sel...
Do an HTTPS Upload of the archive
Do an HTTPS Upload of the archive
[ "Do", "an", "HTTPS", "Upload", "of", "the", "archive" ]
def upload_archive(self, data_collected, content_type, duration): if self.config.legacy_upload: return self._legacy_upload_archive(data_collected, duration) file_name = os.path.basename(data_collected) upload_url = self.upload_url c_facts = {} try: c_facts...
[ "def", "upload_archive", "(", "self", ",", "data_collected", ",", "content_type", ",", "duration", ")", ":", "if", "self", ".", "config", ".", "legacy_upload", ":", "return", "self", ".", "_legacy_upload_archive", "(", "data_collected", ",", "duration", ")", "...
Do an HTTPS Upload of the archive
[ "Do", "an", "HTTPS", "Upload", "of", "the", "archive" ]
[ "\"\"\"\n Do an HTTPS Upload of the archive\n \"\"\"", "# add display_name to canonical facts", "# 202 from platform, no json response", "# upload = registration on platform" ]
[ { "param": "self", "type": null }, { "param": "data_collected", "type": null }, { "param": "content_type", "type": null }, { "param": "duration", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data_collected", "type": null, "docstring": null, "docstring_...
fe750a4d7f804d16ada33980f4bddb3426f48fbd
tisnik/insights-core
insights/parsr/query/__init__.py
[ "Apache-2.0" ]
Python
pretty_format
<not_specific>
def pretty_format(root, indent=4): """ pretty_format generates a text representation of a model as a list of lines. """ results = [] def sep(): if results and results[-1] != "": results.append("") def inner(d, prefix=""): if isinstance(d, Result): fo...
pretty_format generates a text representation of a model as a list of lines.
pretty_format generates a text representation of a model as a list of lines.
[ "pretty_format", "generates", "a", "text", "representation", "of", "a", "model", "as", "a", "list", "of", "lines", "." ]
def pretty_format(root, indent=4): results = [] def sep(): if results and results[-1] != "": results.append("") def inner(d, prefix=""): if isinstance(d, Result): for c in d.children: inner(c, prefix) return if d.children: ...
[ "def", "pretty_format", "(", "root", ",", "indent", "=", "4", ")", ":", "results", "=", "[", "]", "def", "sep", "(", ")", ":", "if", "results", "and", "results", "[", "-", "1", "]", "!=", "\"\"", ":", "results", ".", "append", "(", "\"\"", ")", ...
pretty_format generates a text representation of a model as a list of lines.
[ "pretty_format", "generates", "a", "text", "representation", "of", "a", "model", "as", "a", "list", "of", "lines", "." ]
[ "\"\"\"\n pretty_format generates a text representation of a model as a list of\n lines.\n \"\"\"" ]
[ { "param": "root", "type": null }, { "param": "indent", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "root", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "indent", "type": null, "docstring": null, "docstring_tokens":...
fe750a4d7f804d16ada33980f4bddb3426f48fbd
tisnik/insights-core
insights/parsr/query/__init__.py
[ "Apache-2.0" ]
Python
pluck
<not_specific>
def pluck(self, *names): """ Select just the children with requested names. """ names = set(names) return Result(children=[c for c in self.children if c.name in names])
Select just the children with requested names.
Select just the children with requested names.
[ "Select", "just", "the", "children", "with", "requested", "names", "." ]
def pluck(self, *names): names = set(names) return Result(children=[c for c in self.children if c.name in names])
[ "def", "pluck", "(", "self", ",", "*", "names", ")", ":", "names", "=", "set", "(", "names", ")", "return", "Result", "(", "children", "=", "[", "c", "for", "c", "in", "self", ".", "children", "if", "c", ".", "name", "in", "names", "]", ")" ]
Select just the children with requested names.
[ "Select", "just", "the", "children", "with", "requested", "names", "." ]
[ "\"\"\"\n Select just the children with requested names.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
fe750a4d7f804d16ada33980f4bddb3426f48fbd
tisnik/insights-core
insights/parsr/query/__init__.py
[ "Apache-2.0" ]
Python
where
<not_specific>
def where(self, name, value=None): """ Selects current nodes based on name and value queries of child nodes. If any immediate children match the queries, the parent is included in the results. The :py:func:``make_child_query`` function can be used to construct queries that act on...
Selects current nodes based on name and value queries of child nodes. If any immediate children match the queries, the parent is included in the results. The :py:func:``make_child_query`` function can be used to construct queries that act on the children as a whole instead of one ...
Selects current nodes based on name and value queries of child nodes. If any immediate children match the queries, the parent is included in the results. The :py:func:``make_child_query`` function can be used to construct queries that act on the children as a whole instead of one at a time.
[ "Selects", "current", "nodes", "based", "on", "name", "and", "value", "queries", "of", "child", "nodes", ".", "If", "any", "immediate", "children", "match", "the", "queries", "the", "parent", "is", "included", "in", "the", "results", ".", "The", ":", "py",...
def where(self, name, value=None): query = make_child_query(name, value) if not isinstance(name, DictQueryBase) else name return Result(children=self.children if query.test(self) else [])
[ "def", "where", "(", "self", ",", "name", ",", "value", "=", "None", ")", ":", "query", "=", "make_child_query", "(", "name", ",", "value", ")", "if", "not", "isinstance", "(", "name", ",", "DictQueryBase", ")", "else", "name", "return", "Result", "(",...
Selects current nodes based on name and value queries of child nodes.
[ "Selects", "current", "nodes", "based", "on", "name", "and", "value", "queries", "of", "child", "nodes", "." ]
[ "\"\"\"\n Selects current nodes based on name and value queries of child nodes.\n If any immediate children match the queries, the parent is included in\n the results. The :py:func:``make_child_query`` function can be used to\n construct queries that act on the children as a whole instea...
[ { "param": "self", "type": null }, { "param": "name", "type": null }, { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": null, "docstring": null, "docstring_tokens": [...
fe750a4d7f804d16ada33980f4bddb3426f48fbd
tisnik/insights-core
insights/parsr/query/__init__.py
[ "Apache-2.0" ]
Python
parents
<not_specific>
def parents(self): """ Returns the values of all the children as a list. """ return Result(children=[c.parent for c in self.children])
Returns the values of all the children as a list.
Returns the values of all the children as a list.
[ "Returns", "the", "values", "of", "all", "the", "children", "as", "a", "list", "." ]
def parents(self): return Result(children=[c.parent for c in self.children])
[ "def", "parents", "(", "self", ")", ":", "return", "Result", "(", "children", "=", "[", "c", ".", "parent", "for", "c", "in", "self", ".", "children", "]", ")" ]
Returns the values of all the children as a list.
[ "Returns", "the", "values", "of", "all", "the", "children", "as", "a", "list", "." ]
[ "\"\"\"\n Returns the values of all the children as a list.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
fe750a4d7f804d16ada33980f4bddb3426f48fbd
tisnik/insights-core
insights/parsr/query/__init__.py
[ "Apache-2.0" ]
Python
values
<not_specific>
def values(self): """ Returns the values of all the children as a list. """ return [c.value for c in self.children]
Returns the values of all the children as a list.
Returns the values of all the children as a list.
[ "Returns", "the", "values", "of", "all", "the", "children", "as", "a", "list", "." ]
def values(self): return [c.value for c in self.children]
[ "def", "values", "(", "self", ")", ":", "return", "[", "c", ".", "value", "for", "c", "in", "self", ".", "children", "]" ]
Returns the values of all the children as a list.
[ "Returns", "the", "values", "of", "all", "the", "children", "as", "a", "list", "." ]
[ "\"\"\"\n Returns the values of all the children as a list.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
fe750a4d7f804d16ada33980f4bddb3426f48fbd
tisnik/insights-core
insights/parsr/query/__init__.py
[ "Apache-2.0" ]
Python
unique_values
<not_specific>
def unique_values(self): """ Returns the values of all the children as a list. """ return list(set(c.value for c in self.children))
Returns the values of all the children as a list.
Returns the values of all the children as a list.
[ "Returns", "the", "values", "of", "all", "the", "children", "as", "a", "list", "." ]
def unique_values(self): return list(set(c.value for c in self.children))
[ "def", "unique_values", "(", "self", ")", ":", "return", "list", "(", "set", "(", "c", ".", "value", "for", "c", "in", "self", ".", "children", ")", ")" ]
Returns the values of all the children as a list.
[ "Returns", "the", "values", "of", "all", "the", "children", "as", "a", "list", "." ]
[ "\"\"\"\n Returns the values of all the children as a list.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
fe750a4d7f804d16ada33980f4bddb3426f48fbd
tisnik/insights-core
insights/parsr/query/__init__.py
[ "Apache-2.0" ]
Python
pluck
<not_specific>
def pluck(self, *names): """ Select just the grandchildren with requested names. """ names = set(names) return Result(children=[c for c in self.grandchildren if c.name in names])
Select just the grandchildren with requested names.
Select just the grandchildren with requested names.
[ "Select", "just", "the", "grandchildren", "with", "requested", "names", "." ]
def pluck(self, *names): names = set(names) return Result(children=[c for c in self.grandchildren if c.name in names])
[ "def", "pluck", "(", "self", ",", "*", "names", ")", ":", "names", "=", "set", "(", "names", ")", "return", "Result", "(", "children", "=", "[", "c", "for", "c", "in", "self", ".", "grandchildren", "if", "c", ".", "name", "in", "names", "]", ")" ...
Select just the grandchildren with requested names.
[ "Select", "just", "the", "grandchildren", "with", "requested", "names", "." ]
[ "\"\"\"\n Select just the grandchildren with requested names.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
fe750a4d7f804d16ada33980f4bddb3426f48fbd
tisnik/insights-core
insights/parsr/query/__init__.py
[ "Apache-2.0" ]
Python
where
<not_specific>
def where(self, name, value=None): """ Selects current nodes based on name and value queries of child nodes. If any immediate children match the queries, the parent is included in the results. The :py:func:``make_child_query`` function can be used to construct queries that act on...
Selects current nodes based on name and value queries of child nodes. If any immediate children match the queries, the parent is included in the results. The :py:func:``make_child_query`` function can be used to construct queries that act on the children as a whole instead of one ...
Selects current nodes based on name and value queries of child nodes. If any immediate children match the queries, the parent is included in the results. The :py:func:``make_child_query`` function can be used to construct queries that act on the children as a whole instead of one at a time.
[ "Selects", "current", "nodes", "based", "on", "name", "and", "value", "queries", "of", "child", "nodes", ".", "If", "any", "immediate", "children", "match", "the", "queries", "the", "parent", "is", "included", "in", "the", "results", ".", "The", ":", "py",...
def where(self, name, value=None): query = make_child_query(name, value) if not isinstance(name, DictQueryBase) else name return Result(children=list(set(c for c in self.children if query.test(c))))
[ "def", "where", "(", "self", ",", "name", ",", "value", "=", "None", ")", ":", "query", "=", "make_child_query", "(", "name", ",", "value", ")", "if", "not", "isinstance", "(", "name", ",", "DictQueryBase", ")", "else", "name", "return", "Result", "(",...
Selects current nodes based on name and value queries of child nodes.
[ "Selects", "current", "nodes", "based", "on", "name", "and", "value", "queries", "of", "child", "nodes", "." ]
[ "\"\"\"\n Selects current nodes based on name and value queries of child nodes.\n If any immediate children match the queries, the parent is included in\n the results. The :py:func:``make_child_query`` function can be used to\n construct queries that act on the children as a whole instea...
[ { "param": "self", "type": null }, { "param": "name", "type": null }, { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": null, "docstring": null, "docstring_tokens": [...
fe750a4d7f804d16ada33980f4bddb3426f48fbd
tisnik/insights-core
insights/parsr/query/__init__.py
[ "Apache-2.0" ]
Python
make_child_query
<not_specific>
def make_child_query(name, value=None): """ Converts a query into a DictQuery that works on all child nodes at once to determine if the current node is accepted. """ q = _desugar((name, value) if value is not None else name) return DictQuery(q)
Converts a query into a DictQuery that works on all child nodes at once to determine if the current node is accepted.
Converts a query into a DictQuery that works on all child nodes at once to determine if the current node is accepted.
[ "Converts", "a", "query", "into", "a", "DictQuery", "that", "works", "on", "all", "child", "nodes", "at", "once", "to", "determine", "if", "the", "current", "node", "is", "accepted", "." ]
def make_child_query(name, value=None): q = _desugar((name, value) if value is not None else name) return DictQuery(q)
[ "def", "make_child_query", "(", "name", ",", "value", "=", "None", ")", ":", "q", "=", "_desugar", "(", "(", "name", ",", "value", ")", "if", "value", "is", "not", "None", "else", "name", ")", "return", "DictQuery", "(", "q", ")" ]
Converts a query into a DictQuery that works on all child nodes at once to determine if the current node is accepted.
[ "Converts", "a", "query", "into", "a", "DictQuery", "that", "works", "on", "all", "child", "nodes", "at", "once", "to", "determine", "if", "the", "current", "node", "is", "accepted", "." ]
[ "\"\"\"\n Converts a query into a DictQuery that works on all child nodes at once\n to determine if the current node is accepted.\n \"\"\"" ]
[ { "param": "name", "type": null }, { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "name", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": null, "docstring": null, "docstring_tokens": ...
9d48451235bcf2b8bf821a09c43bbb20d2db7189
Kritikalcoder/opacus
opacus/autograd_grad_sample.py
[ "Apache-2.0" ]
Python
disable_hooks
null
def disable_hooks(): r""" Globally disables all hooks installed by this library. """ global _hooks_disabled _hooks_disabled = True
r""" Globally disables all hooks installed by this library.
r""" Globally disables all hooks installed by this library.
[ "r", "\"", "\"", "\"", "Globally", "disables", "all", "hooks", "installed", "by", "this", "library", "." ]
def disable_hooks(): global _hooks_disabled _hooks_disabled = True
[ "def", "disable_hooks", "(", ")", ":", "global", "_hooks_disabled", "_hooks_disabled", "=", "True" ]
r""" Globally disables all hooks installed by this library.
[ "r", "\"", "\"", "\"", "Globally", "disables", "all", "hooks", "installed", "by", "this", "library", "." ]
[ "r\"\"\"\n Globally disables all hooks installed by this library.\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
9d48451235bcf2b8bf821a09c43bbb20d2db7189
Kritikalcoder/opacus
opacus/autograd_grad_sample.py
[ "Apache-2.0" ]
Python
enable_hooks
null
def enable_hooks(): r""" Globally enables all hooks installed by this library. """ global _hooks_disabled _hooks_disabled = False
r""" Globally enables all hooks installed by this library.
r""" Globally enables all hooks installed by this library.
[ "r", "\"", "\"", "\"", "Globally", "enables", "all", "hooks", "installed", "by", "this", "library", "." ]
def enable_hooks(): global _hooks_disabled _hooks_disabled = False
[ "def", "enable_hooks", "(", ")", ":", "global", "_hooks_disabled", "_hooks_disabled", "=", "False" ]
r""" Globally enables all hooks installed by this library.
[ "r", "\"", "\"", "\"", "Globally", "enables", "all", "hooks", "installed", "by", "this", "library", "." ]
[ "r\"\"\"\n Globally enables all hooks installed by this library.\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
9d48451235bcf2b8bf821a09c43bbb20d2db7189
Kritikalcoder/opacus
opacus/autograd_grad_sample.py
[ "Apache-2.0" ]
Python
_capture_backprops
<not_specific>
def _capture_backprops( layer: nn.Module, inputs: Tuple[torch.Tensor], outputs: Tuple[torch.Tensor], loss_reduction: str, batch_first: bool, ): r"""Backward hook handler captures backpropagated gradients during backward pass, and computes and stores per-sample gradients. Args: l...
r"""Backward hook handler captures backpropagated gradients during backward pass, and computes and stores per-sample gradients. Args: layer: Layer to capture gradients in. inputs: Gradients of the tensor on which ``.backward()`` is called with respect to the inputs to the ``layer``....
r"""Backward hook handler captures backpropagated gradients during backward pass, and computes and stores per-sample gradients.
[ "r", "\"", "\"", "\"", "Backward", "hook", "handler", "captures", "backpropagated", "gradients", "during", "backward", "pass", "and", "computes", "and", "stores", "per", "-", "sample", "gradients", "." ]
def _capture_backprops( layer: nn.Module, inputs: Tuple[torch.Tensor], outputs: Tuple[torch.Tensor], loss_reduction: str, batch_first: bool, ): if _hooks_disabled: return backprops = outputs[0].detach() _compute_grad_sample(layer, backprops, loss_reduction, batch_first)
[ "def", "_capture_backprops", "(", "layer", ":", "nn", ".", "Module", ",", "inputs", ":", "Tuple", "[", "torch", ".", "Tensor", "]", ",", "outputs", ":", "Tuple", "[", "torch", ".", "Tensor", "]", ",", "loss_reduction", ":", "str", ",", "batch_first", "...
r"""Backward hook handler captures backpropagated gradients during backward pass, and computes and stores per-sample gradients.
[ "r", "\"", "\"", "\"", "Backward", "hook", "handler", "captures", "backpropagated", "gradients", "during", "backward", "pass", "and", "computes", "and", "stores", "per", "-", "sample", "gradients", "." ]
[ "r\"\"\"Backward hook handler captures backpropagated gradients during\n backward pass, and computes and stores per-sample gradients.\n\n Args:\n layer: Layer to capture gradients in.\n inputs: Gradients of the tensor on which ``.backward()`` is called with\n respect to the inputs to ...
[ { "param": "layer", "type": "nn.Module" }, { "param": "inputs", "type": "Tuple[torch.Tensor]" }, { "param": "outputs", "type": "Tuple[torch.Tensor]" }, { "param": "loss_reduction", "type": "str" }, { "param": "batch_first", "type": "bool" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "layer", "type": "nn.Module", "docstring": "Layer to capture gradients in.", "docstring_tokens": [ "Layer", "to", "capture", "gradients", "in", "." ], "default": null,...
693897df83a41cd3cf1c11ca5fd608839be2186a
Kritikalcoder/opacus
examples/char-lstm-classification.py
[ "Apache-2.0" ]
Python
build_category_lines
<not_specific>
def build_category_lines(all_filenames, all_letters): r""" Build the category_lines dictionary, a list of names per language Returns the dataset dict, list of languages, and number of classes """ category_lines = {} all_categories = [] for filename in all_filenames: category = filen...
r""" Build the category_lines dictionary, a list of names per language Returns the dataset dict, list of languages, and number of classes
r""" Build the category_lines dictionary, a list of names per language Returns the dataset dict, list of languages, and number of classes
[ "r", "\"", "\"", "\"", "Build", "the", "category_lines", "dictionary", "a", "list", "of", "names", "per", "language", "Returns", "the", "dataset", "dict", "list", "of", "languages", "and", "number", "of", "classes" ]
def build_category_lines(all_filenames, all_letters): category_lines = {} all_categories = [] for filename in all_filenames: category = filename.stem all_categories.append(category) lines = read_lines(filename, all_letters) category_lines[category] = lines n_categories = ...
[ "def", "build_category_lines", "(", "all_filenames", ",", "all_letters", ")", ":", "category_lines", "=", "{", "}", "all_categories", "=", "[", "]", "for", "filename", "in", "all_filenames", ":", "category", "=", "filename", ".", "stem", "all_categories", ".", ...
r""" Build the category_lines dictionary, a list of names per language Returns the dataset dict, list of languages, and number of classes
[ "r", "\"", "\"", "\"", "Build", "the", "category_lines", "dictionary", "a", "list", "of", "names", "per", "language", "Returns", "the", "dataset", "dict", "list", "of", "languages", "and", "number", "of", "classes" ]
[ "r\"\"\"\n Build the category_lines dictionary, a list of names per language\n Returns the dataset dict, list of languages, and number of classes\n \"\"\"" ]
[ { "param": "all_filenames", "type": null }, { "param": "all_letters", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "all_filenames", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "all_letters", "type": null, "docstring": null, "docs...
693897df83a41cd3cf1c11ca5fd608839be2186a
Kritikalcoder/opacus
examples/char-lstm-classification.py
[ "Apache-2.0" ]
Python
split_data_train_eval
<not_specific>
def split_data_train_eval(category_lines, frac): r""" Split the data into a training and a evaluation set with a specified split 'frac' is the percentage of data tp retain in the training set Returns the training and the validation sets as dictionaries """ category_lines_train = {} category_...
r""" Split the data into a training and a evaluation set with a specified split 'frac' is the percentage of data tp retain in the training set Returns the training and the validation sets as dictionaries
r""" Split the data into a training and a evaluation set with a specified split 'frac' is the percentage of data tp retain in the training set Returns the training and the validation sets as dictionaries
[ "r", "\"", "\"", "\"", "Split", "the", "data", "into", "a", "training", "and", "a", "evaluation", "set", "with", "a", "specified", "split", "'", "frac", "'", "is", "the", "percentage", "of", "data", "tp", "retain", "in", "the", "training", "set", "Retu...
def split_data_train_eval(category_lines, frac): category_lines_train = {} category_lines_eval = {} for key in category_lines.keys(): category_lines_train[key] = [] category_lines_eval[key] = [] for key in category_lines.keys(): for val in category_lines[key]: if rand...
[ "def", "split_data_train_eval", "(", "category_lines", ",", "frac", ")", ":", "category_lines_train", "=", "{", "}", "category_lines_eval", "=", "{", "}", "for", "key", "in", "category_lines", ".", "keys", "(", ")", ":", "category_lines_train", "[", "key", "]"...
r""" Split the data into a training and a evaluation set with a specified split 'frac' is the percentage of data tp retain in the training set Returns the training and the validation sets as dictionaries
[ "r", "\"", "\"", "\"", "Split", "the", "data", "into", "a", "training", "and", "a", "evaluation", "set", "with", "a", "specified", "split", "'", "frac", "'", "is", "the", "percentage", "of", "data", "tp", "retain", "in", "the", "training", "set", "Retu...
[ "r\"\"\"\n Split the data into a training and a evaluation set with a specified split\n 'frac' is the percentage of data tp retain in the training set\n Returns the training and the validation sets as dictionaries\n \"\"\"" ]
[ { "param": "category_lines", "type": null }, { "param": "frac", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "category_lines", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "frac", "type": null, "docstring": null, "docstring_...
693897df83a41cd3cf1c11ca5fd608839be2186a
Kritikalcoder/opacus
examples/char-lstm-classification.py
[ "Apache-2.0" ]
Python
line_to_tensor
<not_specific>
def line_to_tensor(batch_size, max_seq_length, lines, all_letters, n_letters): r""" Turn a list of batch_size lines into a <line_length x batch_size> tensor where each element of tensor is index of corresponding letter in all_letters """ tensor = torch.zeros(max_seq_length, batch_size).type(torch.Lo...
r""" Turn a list of batch_size lines into a <line_length x batch_size> tensor where each element of tensor is index of corresponding letter in all_letters
r""" Turn a list of batch_size lines into a tensor where each element of tensor is index of corresponding letter in all_letters
[ "r", "\"", "\"", "\"", "Turn", "a", "list", "of", "batch_size", "lines", "into", "a", "tensor", "where", "each", "element", "of", "tensor", "is", "index", "of", "corresponding", "letter", "in", "all_letters" ]
def line_to_tensor(batch_size, max_seq_length, lines, all_letters, n_letters): tensor = torch.zeros(max_seq_length, batch_size).type(torch.LongTensor) for batch_idx, line in enumerate(lines): padded_line = line[0:max_seq_length] + "#" * (max_seq_length - len(line)) for li, letter in enumerate(pa...
[ "def", "line_to_tensor", "(", "batch_size", ",", "max_seq_length", ",", "lines", ",", "all_letters", ",", "n_letters", ")", ":", "tensor", "=", "torch", ".", "zeros", "(", "max_seq_length", ",", "batch_size", ")", ".", "type", "(", "torch", ".", "LongTensor"...
r""" Turn a list of batch_size lines into a <line_length x batch_size> tensor where each element of tensor is index of corresponding letter in all_letters
[ "r", "\"", "\"", "\"", "Turn", "a", "list", "of", "batch_size", "lines", "into", "a", "<line_length", "x", "batch_size", ">", "tensor", "where", "each", "element", "of", "tensor", "is", "index", "of", "corresponding", "letter", "in", "all_letters" ]
[ "r\"\"\"\n Turn a list of batch_size lines into a <line_length x batch_size> tensor\n where each element of tensor is index of corresponding letter in all_letters\n \"\"\"", "# Pad/truncate line to fit to max_seq_length" ]
[ { "param": "batch_size", "type": null }, { "param": "max_seq_length", "type": null }, { "param": "lines", "type": null }, { "param": "all_letters", "type": null }, { "param": "n_letters", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "batch_size", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "max_seq_length", "type": null, "docstring": null, "docs...
30fac79fcd3be33fd7266d1e183a6b1e4f41e082
Kritikalcoder/opacus
opacus/privacy_engine.py
[ "Apache-2.0" ]
Python
step
null
def step(self): """ Takes a step for the privacy engine. Notes: You should not call this method directly. Rather, by attaching your ``PrivacyEngine`` to the optimizer, the ``PrivacyEngine`` would have the optimizer call this method for you. Raises: ...
Takes a step for the privacy engine. Notes: You should not call this method directly. Rather, by attaching your ``PrivacyEngine`` to the optimizer, the ``PrivacyEngine`` would have the optimizer call this method for you. Raises: ValueError: If t...
Takes a step for the privacy engine. Notes: You should not call this method directly.
[ "Takes", "a", "step", "for", "the", "privacy", "engine", ".", "Notes", ":", "You", "should", "not", "call", "this", "method", "directly", "." ]
def step(self): self.steps += 1 self.clipper.clip_and_accumulate() clip_values, batch_size = self.clipper.pre_step() if batch_size > self.batch_size: raise ValueError( f"PrivacyEngine expected a batch of size {self.batch_size} " f"but received ...
[ "def", "step", "(", "self", ")", ":", "self", ".", "steps", "+=", "1", "self", ".", "clipper", ".", "clip_and_accumulate", "(", ")", "clip_values", ",", "batch_size", "=", "self", ".", "clipper", ".", "pre_step", "(", ")", "if", "batch_size", ">", "sel...
Takes a step for the privacy engine.
[ "Takes", "a", "step", "for", "the", "privacy", "engine", "." ]
[ "\"\"\"\n Takes a step for the privacy engine.\n\n Notes:\n You should not call this method directly. Rather, by attaching your\n ``PrivacyEngine`` to the optimizer, the ``PrivacyEngine`` would have\n the optimizer call this method for you.\n\n Raises:\n ...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [ { "docstring": "If the last batch of training epoch is greater than others.\nThis ensures the clipper consumed the right amount of gradients.\nIn the last batch of a training epoch, we might get a batch that is\nsmaller than others but we should never get a batch that is too l...
eccf8473c59d64f599eb6f498057bb7c984f5c1d
Kritikalcoder/opacus
opacus/layers/dp_lstm.py
[ "Apache-2.0" ]
Python
validate_parameters
null
def validate_parameters(self): r""" Validates the DPLSTM configuration and raises a ``NotImplementedError`` if the number of layers is more than 1, the DPLSTM is bidirectional, uses dropout at the output or, it does not have a bias term. Raises: NotImplementedError ...
r""" Validates the DPLSTM configuration and raises a ``NotImplementedError`` if the number of layers is more than 1, the DPLSTM is bidirectional, uses dropout at the output or, it does not have a bias term. Raises: NotImplementedError If the number of layers ...
r""" Validates the DPLSTM configuration and raises a ``NotImplementedError`` if the number of layers is more than 1, the DPLSTM is bidirectional, uses dropout at the output or, it does not have a bias term. NotImplementedError If the number of layers is more than 1, the DPLSTM is bidirectional, uses dropout at the out...
[ "r", "\"", "\"", "\"", "Validates", "the", "DPLSTM", "configuration", "and", "raises", "a", "`", "`", "NotImplementedError", "`", "`", "if", "the", "number", "of", "layers", "is", "more", "than", "1", "the", "DPLSTM", "is", "bidirectional", "uses", "dropou...
def validate_parameters(self): if self.num_layers > 1 or not self.bias or self.dropout or self.bidirectional: raise NotImplementedError( "DPLSTM Layer initialized with unsupported non-default flag. " "Only supported flags are bias=True, bidirectional=False " ...
[ "def", "validate_parameters", "(", "self", ")", ":", "if", "self", ".", "num_layers", ">", "1", "or", "not", "self", ".", "bias", "or", "self", ".", "dropout", "or", "self", ".", "bidirectional", ":", "raise", "NotImplementedError", "(", "\"DPLSTM Layer init...
r""" Validates the DPLSTM configuration and raises a ``NotImplementedError`` if the number of layers is more than 1, the DPLSTM is bidirectional, uses dropout at the output or, it does not have a bias term.
[ "r", "\"", "\"", "\"", "Validates", "the", "DPLSTM", "configuration", "and", "raises", "a", "`", "`", "NotImplementedError", "`", "`", "if", "the", "number", "of", "layers", "is", "more", "than", "1", "the", "DPLSTM", "is", "bidirectional", "uses", "dropou...
[ "r\"\"\"\n Validates the DPLSTM configuration and raises a ``NotImplementedError`` if the number of\n layers is more than 1, the DPLSTM is bidirectional, uses dropout at the output\n or, it does not have a bias term.\n\n Raises:\n NotImplementedError\n If the nu...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
eccf8473c59d64f599eb6f498057bb7c984f5c1d
Kritikalcoder/opacus
opacus/layers/dp_lstm.py
[ "Apache-2.0" ]
Python
reset_parameters
null
def reset_parameters(self): r""" Resets parameters of the DPLSTM by initializing them from an uniform distribution. """ stdv = 1.0 / math.sqrt(self.hidden_size) for weight in self.parameters(): init.uniform_(weight, -stdv, stdv)
r""" Resets parameters of the DPLSTM by initializing them from an uniform distribution.
r""" Resets parameters of the DPLSTM by initializing them from an uniform distribution.
[ "r", "\"", "\"", "\"", "Resets", "parameters", "of", "the", "DPLSTM", "by", "initializing", "them", "from", "an", "uniform", "distribution", "." ]
def reset_parameters(self): stdv = 1.0 / math.sqrt(self.hidden_size) for weight in self.parameters(): init.uniform_(weight, -stdv, stdv)
[ "def", "reset_parameters", "(", "self", ")", ":", "stdv", "=", "1.0", "/", "math", ".", "sqrt", "(", "self", ".", "hidden_size", ")", "for", "weight", "in", "self", ".", "parameters", "(", ")", ":", "init", ".", "uniform_", "(", "weight", ",", "-", ...
r""" Resets parameters of the DPLSTM by initializing them from an uniform distribution.
[ "r", "\"", "\"", "\"", "Resets", "parameters", "of", "the", "DPLSTM", "by", "initializing", "them", "from", "an", "uniform", "distribution", "." ]
[ "r\"\"\"\n Resets parameters of the DPLSTM by initializing them from an uniform distribution.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
eccf8473c59d64f599eb6f498057bb7c984f5c1d
Kritikalcoder/opacus
opacus/layers/dp_lstm.py
[ "Apache-2.0" ]
Python
forward
Tuple[torch.Tensor, Tuple[torch.Tensor, torch.Tensor]]
def forward( self, x: torch.Tensor, state_init: Tuple[torch.Tensor, torch.Tensor] = None ) -> Tuple[torch.Tensor, Tuple[torch.Tensor, torch.Tensor]]: r""" Implements the forward pass of the DPLSTM when a sequence is input. Args: x: Input sequence to the DPLSTM of shape `...
r""" Implements the forward pass of the DPLSTM when a sequence is input. Args: x: Input sequence to the DPLSTM of shape ``[T, B, D]`` state_init: Initial state of the LSTM as a tuple ``(h_init, c_init)`` where ``h_init`` is the initial hidden state and ``c_init``...
r""" Implements the forward pass of the DPLSTM when a sequence is input.
[ "r", "\"", "\"", "\"", "Implements", "the", "forward", "pass", "of", "the", "DPLSTM", "when", "a", "sequence", "is", "input", "." ]
def forward( self, x: torch.Tensor, state_init: Tuple[torch.Tensor, torch.Tensor] = None ) -> Tuple[torch.Tensor, Tuple[torch.Tensor, torch.Tensor]]: x = self._rearrange_batch_dim(x) seq_length, batch_sz, _ = x.shape hc = [(None, None)] * seq_length x = torch.unbind(x, dim=0)...
[ "def", "forward", "(", "self", ",", "x", ":", "torch", ".", "Tensor", ",", "state_init", ":", "Tuple", "[", "torch", ".", "Tensor", ",", "torch", ".", "Tensor", "]", "=", "None", ")", "->", "Tuple", "[", "torch", ".", "Tensor", ",", "Tuple", "[", ...
r""" Implements the forward pass of the DPLSTM when a sequence is input.
[ "r", "\"", "\"", "\"", "Implements", "the", "forward", "pass", "of", "the", "DPLSTM", "when", "a", "sequence", "is", "input", "." ]
[ "r\"\"\"\n Implements the forward pass of the DPLSTM when a sequence is input.\n\n Args:\n x: Input sequence to the DPLSTM of shape ``[T, B, D]``\n state_init: Initial state of the LSTM as a tuple ``(h_init, c_init)``\n where ``h_init`` is the initial hidden state ...
[ { "param": "self", "type": null }, { "param": "x", "type": "torch.Tensor" }, { "param": "state_init", "type": "Tuple[torch.Tensor, torch.Tensor]" } ]
{ "returns": [ { "docstring": "``output, (h_n, c_n)`` where ``output`` is of shape ``[T, B, H]`` and is a\ntensor containing the output features (``h_t``) from the last layer of the\nDPLSTM for each timestep ``t``. ``h_n`` is of shape ``[B,H]`` and is a\ntensor containing the hidden state for ``t = T``. ``c...
992b8e3c93262e1e76335768f83cef3a6765f137
encukou/kojistatus
kojistatus/status.py
[ "MIT" ]
Python
status
<not_specific>
def status(username=None, *, kojiurl=None, session=None): """ For given username, return the last builds with status information. Returns an iterable of 2-tuples, sorted descending. Only the first page with maximum 50 results is fetched. """ kojiurl = kojiurl or 'https://koji.fedoraproject.org/...
For given username, return the last builds with status information. Returns an iterable of 2-tuples, sorted descending. Only the first page with maximum 50 results is fetched.
For given username, return the last builds with status information. Returns an iterable of 2-tuples, sorted descending. Only the first page with maximum 50 results is fetched.
[ "For", "given", "username", "return", "the", "last", "builds", "with", "status", "information", ".", "Returns", "an", "iterable", "of", "2", "-", "tuples", "sorted", "descending", ".", "Only", "the", "first", "page", "with", "maximum", "50", "results", "is",...
def status(username=None, *, kojiurl=None, session=None): kojiurl = kojiurl or 'https://koji.fedoraproject.org/' session = session or requests.Session() url = '{}koji/tasks'.format(kojiurl) params = { 'state': 'all', 'view': 'toplevel' } if username: params['owner'] = use...
[ "def", "status", "(", "username", "=", "None", ",", "*", ",", "kojiurl", "=", "None", ",", "session", "=", "None", ")", ":", "kojiurl", "=", "kojiurl", "or", "'https://koji.fedoraproject.org/'", "session", "=", "session", "or", "requests", ".", "Session", ...
For given username, return the last builds with status information.
[ "For", "given", "username", "return", "the", "last", "builds", "with", "status", "information", "." ]
[ "\"\"\"\n For given username, return the last builds with status information.\n Returns an iterable of 2-tuples, sorted descending.\n\n Only the first page with maximum 50 results is fetched.\n \"\"\"" ]
[ { "param": "username", "type": null }, { "param": "kojiurl", "type": null }, { "param": "session", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "username", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "kojiurl", "type": null, "docstring": null, "docstring_tok...
992b8e3c93262e1e76335768f83cef3a6765f137
encukou/kojistatus
kojistatus/status.py
[ "MIT" ]
Python
_parse
null
def _parse(html): """ Parses the given HTML source using regular expressions (I know :P) Returns status information for status() """ ids = RE_ID.findall(html) statuses = RE_STATUS.findall(html) for idx, status in enumerate(statuses): yield (int(ids[idx]), status)
Parses the given HTML source using regular expressions (I know :P) Returns status information for status()
Parses the given HTML source using regular expressions (I know :P) Returns status information for status()
[ "Parses", "the", "given", "HTML", "source", "using", "regular", "expressions", "(", "I", "know", ":", "P", ")", "Returns", "status", "information", "for", "status", "()" ]
def _parse(html): ids = RE_ID.findall(html) statuses = RE_STATUS.findall(html) for idx, status in enumerate(statuses): yield (int(ids[idx]), status)
[ "def", "_parse", "(", "html", ")", ":", "ids", "=", "RE_ID", ".", "findall", "(", "html", ")", "statuses", "=", "RE_STATUS", ".", "findall", "(", "html", ")", "for", "idx", ",", "status", "in", "enumerate", "(", "statuses", ")", ":", "yield", "(", ...
Parses the given HTML source using regular expressions (I know :P) Returns status information for status()
[ "Parses", "the", "given", "HTML", "source", "using", "regular", "expressions", "(", "I", "know", ":", "P", ")", "Returns", "status", "information", "for", "status", "()" ]
[ "\"\"\"\n Parses the given HTML source using regular expressions (I know :P)\n Returns status information for status()\n \"\"\"" ]
[ { "param": "html", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "html", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c40f2442a9dc803188a5ddc28b47d8ae9c6142e2
nebloc/cairis
cairis/data/AssetDAO.py
[ "Apache-2.0" ]
Python
simplify
<not_specific>
def simplify(self, asset): """ Simplifies the Asset object by removing the environment properties :param asset: The Asset to simplify :type asset: Asset :return: The simplified Asset :rtype: Asset """ assert isinstance(asset, Asset) del asset.theId asset.theInterfaces = self.conv...
Simplifies the Asset object by removing the environment properties :param asset: The Asset to simplify :type asset: Asset :return: The simplified Asset :rtype: Asset
Simplifies the Asset object by removing the environment properties
[ "Simplifies", "the", "Asset", "object", "by", "removing", "the", "environment", "properties" ]
def simplify(self, asset): assert isinstance(asset, Asset) del asset.theId asset.theInterfaces = self.convert_ifs(real_ifs=asset.theInterfaces) asset.theEnvironmentProperties = self.convert_props(real_props=asset.theEnvironmentProperties) del asset.theEnvironmentDictionary del asset.theAssetProp...
[ "def", "simplify", "(", "self", ",", "asset", ")", ":", "assert", "isinstance", "(", "asset", ",", "Asset", ")", "del", "asset", ".", "theId", "asset", ".", "theInterfaces", "=", "self", ".", "convert_ifs", "(", "real_ifs", "=", "asset", ".", "theInterfa...
Simplifies the Asset object by removing the environment properties
[ "Simplifies", "the", "Asset", "object", "by", "removing", "the", "environment", "properties" ]
[ "\"\"\"\n Simplifies the Asset object by removing the environment properties\n :param asset: The Asset to simplify\n :type asset: Asset\n :return: The simplified Asset\n :rtype: Asset\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "asset", "type": null } ]
{ "returns": [ { "docstring": "The simplified Asset", "docstring_tokens": [ "The", "simplified", "Asset" ], "type": "Asset" } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_token...
6ea03a108d7a85a3f4516b3e1e6db7c91d85736a
AndreiJirohHaliliDev2006/BotBase
BotBase/modules/antiflood.py
[ "Apache-2.0" ]
Python
is_flood
<not_specific>
def is_flood(updates: list): """ Calculates if a sequence of updates corresponds to a flood """ genexpr = [i <= ANTIFLOOD_SENSIBILITY for i in ((updates[i + 1] - timestamp) if i < (MAX_UPDATE_THRESHOLD - 1) else (timestamp - updates[i - 1]) for i, timestamp in enumera...
Calculates if a sequence of updates corresponds to a flood
Calculates if a sequence of updates corresponds to a flood
[ "Calculates", "if", "a", "sequence", "of", "updates", "corresponds", "to", "a", "flood" ]
def is_flood(updates: list): genexpr = [i <= ANTIFLOOD_SENSIBILITY for i in ((updates[i + 1] - timestamp) if i < (MAX_UPDATE_THRESHOLD - 1) else (timestamp - updates[i - 1]) for i, timestamp in enumerate(updates))] return sum(genexpr) >= int((len(genexpr) / 100) * FLOOD_PERCENTAGE...
[ "def", "is_flood", "(", "updates", ":", "list", ")", ":", "genexpr", "=", "[", "i", "<=", "ANTIFLOOD_SENSIBILITY", "for", "i", "in", "(", "(", "updates", "[", "i", "+", "1", "]", "-", "timestamp", ")", "if", "i", "<", "(", "MAX_UPDATE_THRESHOLD", "-"...
Calculates if a sequence of updates corresponds to a flood
[ "Calculates", "if", "a", "sequence", "of", "updates", "corresponds", "to", "a", "flood" ]
[ "\"\"\"\n Calculates if a sequence of\n updates corresponds to a flood\n \"\"\"" ]
[ { "param": "updates", "type": "list" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "updates", "type": "list", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
85bd27489c69a5da99b7a2fa059515e41d6577e5
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/xml_configuration.py
[ "Apache-2.0" ]
Python
Format
<not_specific>
def Format(self): """Formats text. Only wraps descriptions.""" if self._element.getElementsByTagName('*'): # Do not Destroy <envVars> return text = self.text.strip() if (len(text) > self._MAX_WIDTH - 27 - 2 * len(_INDENT) and self._element.nodeName == 'des...
Formats text. Only wraps descriptions.
Formats text. Only wraps descriptions.
[ "Formats", "text", ".", "Only", "wraps", "descriptions", "." ]
def Format(self): if self._element.getElementsByTagName('*'): return text = self.text.strip() if (len(text) > self._MAX_WIDTH - 27 - 2 * len(_INDENT) and self._element.nodeName == 'description'): text = '\n{0}\n{1}'.format( self._TEXT_WRAPPER.fill(te...
[ "def", "Format", "(", "self", ")", ":", "if", "self", ".", "_element", ".", "getElementsByTagName", "(", "'*'", ")", ":", "return", "text", "=", "self", ".", "text", ".", "strip", "(", ")", "if", "(", "len", "(", "text", ")", ">", "self", ".", "_...
Formats text.
[ "Formats", "text", "." ]
[ "\"\"\"Formats text. Only wraps descriptions.\"\"\"", "# Do not Destroy <envVars>" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
85bd27489c69a5da99b7a2fa059515e41d6577e5
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/xml_configuration.py
[ "Apache-2.0" ]
Python
FromFile
<not_specific>
def FromFile(cls, file): """Loads the specified file as a Configuration. Args: file: File name or file object of a config XML file. Returns: The configuration """ document = minidom.parse(file) return cls(document)
Loads the specified file as a Configuration. Args: file: File name or file object of a config XML file. Returns: The configuration
Loads the specified file as a Configuration.
[ "Loads", "the", "specified", "file", "as", "a", "Configuration", "." ]
def FromFile(cls, file): document = minidom.parse(file) return cls(document)
[ "def", "FromFile", "(", "cls", ",", "file", ")", ":", "document", "=", "minidom", ".", "parse", "(", "file", ")", "return", "cls", "(", "document", ")" ]
Loads the specified file as a Configuration.
[ "Loads", "the", "specified", "file", "as", "a", "Configuration", "." ]
[ "\"\"\"Loads the specified file as a Configuration.\n\n Args:\n file: File name or file object of a config XML file.\n\n Returns:\n The configuration\n \"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "file", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
85bd27489c69a5da99b7a2fa059515e41d6577e5
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/xml_configuration.py
[ "Apache-2.0" ]
Python
FromString
<not_specific>
def FromString(cls, xml_string, compact_document=True, env_var_store=None): """Loads the specified string as a Configuration. Args: xml_string of a config XML file. compact_document: Whether or not to clean white_space of the document. env_var_store: (Optional) A dictionary holding environmen...
Loads the specified string as a Configuration. Args: xml_string of a config XML file. compact_document: Whether or not to clean white_space of the document. env_var_store: (Optional) A dictionary holding environment variable, key pairs. Returns: The configuration
Loads the specified string as a Configuration. Args: xml_string of a config XML file. compact_document: Whether or not to clean white_space of the document. env_var_store: (Optional) A dictionary holding environment variable, key pairs. The configuration
[ "Loads", "the", "specified", "string", "as", "a", "Configuration", ".", "Args", ":", "xml_string", "of", "a", "config", "XML", "file", ".", "compact_document", ":", "Whether", "or", "not", "to", "clean", "white_space", "of", "the", "document", ".", "env_var_...
def FromString(cls, xml_string, compact_document=True, env_var_store=None): document = minidom.parseString(xml_string) return cls(document, compact_document, env_var_store)
[ "def", "FromString", "(", "cls", ",", "xml_string", ",", "compact_document", "=", "True", ",", "env_var_store", "=", "None", ")", ":", "document", "=", "minidom", ".", "parseString", "(", "xml_string", ")", "return", "cls", "(", "document", ",", "compact_doc...
Loads the specified string as a Configuration.
[ "Loads", "the", "specified", "string", "as", "a", "Configuration", "." ]
[ "\"\"\"Loads the specified string as a Configuration.\n\n Args:\n xml_string of a config XML file.\n compact_document: Whether or not to clean white_space of the document.\n env_var_store: (Optional) A dictionary holding environment variable,\n key pairs.\n\n Returns:\n The configur...
[ { "param": "cls", "type": null }, { "param": "xml_string", "type": null }, { "param": "compact_document", "type": null }, { "param": "env_var_store", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "xml_string", "type": null, "docstring": null, "docstring_token...
85bd27489c69a5da99b7a2fa059515e41d6577e5
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/xml_configuration.py
[ "Apache-2.0" ]
Python
ToXml
<not_specific>
def ToXml(self): """Returns a compact string of the underlying document. Returns: The raw text string of the value of the property requested. """ return self._document.toxml()
Returns a compact string of the underlying document. Returns: The raw text string of the value of the property requested.
Returns a compact string of the underlying document.
[ "Returns", "a", "compact", "string", "of", "the", "underlying", "document", "." ]
def ToXml(self): return self._document.toxml()
[ "def", "ToXml", "(", "self", ")", ":", "return", "self", ".", "_document", ".", "toxml", "(", ")" ]
Returns a compact string of the underlying document.
[ "Returns", "a", "compact", "string", "of", "the", "underlying", "document", "." ]
[ "\"\"\"Returns a compact string of the underlying document.\n\n Returns:\n The raw text string of the value of the property requested.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "The raw text string of the value of the property requested.", "docstring_tokens": [ "The", "raw", "text", "string", "of", "the", "value", "of", "the", "property", "requested", ...
85bd27489c69a5da99b7a2fa059515e41d6577e5
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/xml_configuration.py
[ "Apache-2.0" ]
Python
ToPrettyXml
<not_specific>
def ToPrettyXml(self): """Returns a well formatted string of the underlying document Returns: The raw text string of the value of the property requested. """ self._FormatTextElements() pretty_xml = self._document.toprettyxml(indent=_INDENT) # Python 2.6 pretty_prints text nodes terribly....
Returns a well formatted string of the underlying document Returns: The raw text string of the value of the property requested.
Returns a well formatted string of the underlying document
[ "Returns", "a", "well", "formatted", "string", "of", "the", "underlying", "document" ]
def ToPrettyXml(self): self._FormatTextElements() pretty_xml = self._document.toprettyxml(indent=_INDENT) if tuple(sys.version_info[:2]) < (2, 7): mangled_document = self.FromString(pretty_xml, compact_document=False) mangled_document._FormatTextElements() pretty_xml = mangled_document.ToX...
[ "def", "ToPrettyXml", "(", "self", ")", ":", "self", ".", "_FormatTextElements", "(", ")", "pretty_xml", "=", "self", ".", "_document", ".", "toprettyxml", "(", "indent", "=", "_INDENT", ")", "if", "tuple", "(", "sys", ".", "version_info", "[", ":", "2",...
Returns a well formatted string of the underlying document
[ "Returns", "a", "well", "formatted", "string", "of", "the", "underlying", "document" ]
[ "\"\"\"Returns a well formatted string of the underlying document\n\n Returns:\n The raw text string of the value of the property requested.\n \"\"\"", "# Python 2.6 pretty_prints text nodes terribly." ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "The raw text string of the value of the property requested.", "docstring_tokens": [ "The", "raw", "text", "string", "of", "the", "value", "of", "the", "property", "requested", ...
85bd27489c69a5da99b7a2fa059515e41d6577e5
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/xml_configuration.py
[ "Apache-2.0" ]
Python
WriteToFile
null
def WriteToFile(self, file_name): """Wrties a well formatted string of the underlying document to a file Args: The name of the file """ with open(file_name, 'w') as f: f.write(self.ToPrettyXml())
Wrties a well formatted string of the underlying document to a file Args: The name of the file
Wrties a well formatted string of the underlying document to a file Args: The name of the file
[ "Wrties", "a", "well", "formatted", "string", "of", "the", "underlying", "document", "to", "a", "file", "Args", ":", "The", "name", "of", "the", "file" ]
def WriteToFile(self, file_name): with open(file_name, 'w') as f: f.write(self.ToPrettyXml())
[ "def", "WriteToFile", "(", "self", ",", "file_name", ")", ":", "with", "open", "(", "file_name", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "(", "self", ".", "ToPrettyXml", "(", ")", ")" ]
Wrties a well formatted string of the underlying document to a file Args: The name of the file
[ "Wrties", "a", "well", "formatted", "string", "of", "the", "underlying", "document", "to", "a", "file", "Args", ":", "The", "name", "of", "the", "file" ]
[ "\"\"\"Wrties a well formatted string of the underlying document to a file\n\n Args:\n The name of the file\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "file_name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "file_name", "type": null, "docstring": null, "docstring_token...
85bd27489c69a5da99b7a2fa059515e41d6577e5
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/xml_configuration.py
[ "Apache-2.0" ]
Python
GetNumProperties
<not_specific>
def GetNumProperties(self): """Returns the total number of <property> elements in the configuration. Returns: The total number of <property> elements in the configuration. """ return len(self._properties)
Returns the total number of <property> elements in the configuration. Returns: The total number of <property> elements in the configuration.
Returns the total number of elements in the configuration.
[ "Returns", "the", "total", "number", "of", "elements", "in", "the", "configuration", "." ]
def GetNumProperties(self): return len(self._properties)
[ "def", "GetNumProperties", "(", "self", ")", ":", "return", "len", "(", "self", ".", "_properties", ")" ]
Returns the total number of <property> elements in the configuration.
[ "Returns", "the", "total", "number", "of", "<property", ">", "elements", "in", "the", "configuration", "." ]
[ "\"\"\"Returns the total number of <property> elements in the configuration.\n\n Returns:\n The total number of <property> elements in the configuration.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "The total number of elements in the configuration.", "docstring_tokens": [ "The", "total", "number", "of", "elements", "in", "the", "configuration", "." ], "type": null } ], "rai...
85bd27489c69a5da99b7a2fa059515e41d6577e5
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/xml_configuration.py
[ "Apache-2.0" ]
Python
GetPropertyValue
<not_specific>
def GetPropertyValue(self, name): """Retrieves the text value of a property by name. Returns the raw text of the <value> node residing under a <property> element whose <name> contains text matching name. Args: name: The name of the property to retrieve. Returns: The raw text string of...
Retrieves the text value of a property by name. Returns the raw text of the <value> node residing under a <property> element whose <name> contains text matching name. Args: name: The name of the property to retrieve. Returns: The raw text string of the value of the property requested. ...
Retrieves the text value of a property by name. Returns the raw text of the node residing under a element whose contains text matching name.
[ "Retrieves", "the", "text", "value", "of", "a", "property", "by", "name", ".", "Returns", "the", "raw", "text", "of", "the", "node", "residing", "under", "a", "element", "whose", "contains", "text", "matching", "name", "." ]
def GetPropertyValue(self, name): property = self._properties.get(name) if property: return property.value return None
[ "def", "GetPropertyValue", "(", "self", ",", "name", ")", ":", "property", "=", "self", ".", "_properties", ".", "get", "(", "name", ")", "if", "property", ":", "return", "property", ".", "value", "return", "None" ]
Retrieves the text value of a property by name.
[ "Retrieves", "the", "text", "value", "of", "a", "property", "by", "name", "." ]
[ "\"\"\"Retrieves the text value of a property by name.\n\n Returns the raw text of the <value> node residing under a <property> element\n whose <name> contains text matching name.\n\n Args:\n name: The name of the property to retrieve.\n\n Returns:\n The raw text string of the value of the pro...
[ { "param": "self", "type": null }, { "param": "name", "type": null } ]
{ "returns": [ { "docstring": "The raw text string of the value of the property requested.", "docstring_tokens": [ "The", "raw", "text", "string", "of", "the", "value", "of", "the", "property", "requested", ...
85bd27489c69a5da99b7a2fa059515e41d6577e5
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/xml_configuration.py
[ "Apache-2.0" ]
Python
GetPropertyDescription
<not_specific>
def GetPropertyDescription(self, name): """Retrieves the text value of a property by name. Returns the raw text of the <description> node residing under a <property> element whose <name> contains text matching name. Args: name: The name of the property to retrieve. Returns: The raw te...
Retrieves the text value of a property by name. Returns the raw text of the <description> node residing under a <property> element whose <name> contains text matching name. Args: name: The name of the property to retrieve. Returns: The raw text string of the description of the property re...
Retrieves the text value of a property by name. Returns the raw text of the node residing under a element whose contains text matching name.
[ "Retrieves", "the", "text", "value", "of", "a", "property", "by", "name", ".", "Returns", "the", "raw", "text", "of", "the", "node", "residing", "under", "a", "element", "whose", "contains", "text", "matching", "name", "." ]
def GetPropertyDescription(self, name): property = self._properties.get(name) if property: return property.description return None
[ "def", "GetPropertyDescription", "(", "self", ",", "name", ")", ":", "property", "=", "self", ".", "_properties", ".", "get", "(", "name", ")", "if", "property", ":", "return", "property", ".", "description", "return", "None" ]
Retrieves the text value of a property by name.
[ "Retrieves", "the", "text", "value", "of", "a", "property", "by", "name", "." ]
[ "\"\"\"Retrieves the text value of a property by name.\n\n Returns the raw text of the <description> node residing under a <property>\n element whose <name> contains text matching name.\n\n Args:\n name: The name of the property to retrieve.\n\n Returns:\n The raw text string of the descriptio...
[ { "param": "self", "type": null }, { "param": "name", "type": null } ]
{ "returns": [ { "docstring": "The raw text string of the description of the property requested.", "docstring_tokens": [ "The", "raw", "text", "string", "of", "the", "description", "of", "the", "property", "request...
85bd27489c69a5da99b7a2fa059515e41d6577e5
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/xml_configuration.py
[ "Apache-2.0" ]
Python
SetProperty
<not_specific>
def SetProperty(self, name, value, description=None, clobber=True): """Sets value and optionally description of property with given name. Args: name: The name of the property to set. value: The value to set the property to. description: (Optional) The description to give the property. c...
Sets value and optionally description of property with given name. Args: name: The name of the property to set. value: The value to set the property to. description: (Optional) The description to give the property. clobber: Whether or not to overwrite existing properties. True by default. ...
Sets value and optionally description of property with given name.
[ "Sets", "value", "and", "optionally", "description", "of", "property", "with", "given", "name", "." ]
def SetProperty(self, name, value, description=None, clobber=True): if name in self._properties: if not clobber: logging.warn( 'Property "{0}" is already set. Not clobbering.'.format(name)) return False property = self._properties[name] else: property_element = self...
[ "def", "SetProperty", "(", "self", ",", "name", ",", "value", ",", "description", "=", "None", ",", "clobber", "=", "True", ")", ":", "if", "name", "in", "self", ".", "_properties", ":", "if", "not", "clobber", ":", "logging", ".", "warn", "(", "'Pro...
Sets value and optionally description of property with given name.
[ "Sets", "value", "and", "optionally", "description", "of", "property", "with", "given", "name", "." ]
[ "\"\"\"Sets value and optionally description of property with given name.\n\n Args:\n name: The name of the property to set.\n value: The value to set the property to.\n description: (Optional) The description to give the property.\n clobber: Whether or not to overwrite existing properties. T...
[ { "param": "self", "type": null }, { "param": "name", "type": null }, { "param": "value", "type": null }, { "param": "description", "type": null }, { "param": "clobber", "type": null } ]
{ "returns": [ { "docstring": "Whether or not the value was set.", "docstring_tokens": [ "Whether", "or", "not", "the", "value", "was", "set", "." ], "type": null } ], "raises": [], "params": [ { "identifie...
85bd27489c69a5da99b7a2fa059515e41d6577e5
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/xml_configuration.py
[ "Apache-2.0" ]
Python
RemoveProperty
<not_specific>
def RemoveProperty(self, name): """Removes property with given name. Args: name: The name of the property to remove. Returns: Whether or not the value was removed. """ property = self._properties.get(name) if property: self._configuration.removeChild(property._element) ...
Removes property with given name. Args: name: The name of the property to remove. Returns: Whether or not the value was removed.
Removes property with given name.
[ "Removes", "property", "with", "given", "name", "." ]
def RemoveProperty(self, name): property = self._properties.get(name) if property: self._configuration.removeChild(property._element) del self._properties[name] return True logging.info('Property "{0}" is not present. Not removing'.format(name)) return False
[ "def", "RemoveProperty", "(", "self", ",", "name", ")", ":", "property", "=", "self", ".", "_properties", ".", "get", "(", "name", ")", "if", "property", ":", "self", ".", "_configuration", ".", "removeChild", "(", "property", ".", "_element", ")", "del"...
Removes property with given name.
[ "Removes", "property", "with", "given", "name", "." ]
[ "\"\"\"Removes property with given name.\n\n Args:\n name: The name of the property to remove.\n\n Returns:\n Whether or not the value was removed.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "name", "type": null } ]
{ "returns": [ { "docstring": "Whether or not the value was removed.", "docstring_tokens": [ "Whether", "or", "not", "the", "value", "was", "removed", "." ], "type": null } ], "raises": [], "params": [ { "i...
85bd27489c69a5da99b7a2fa059515e41d6577e5
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/xml_configuration.py
[ "Apache-2.0" ]
Python
Merge
null
def Merge(self, other_conf, clobber=False): """Merge the properties of another configuration into this one. WARNING: This will remove properties from the other_conf. Args: other_conf: The other configuration. clobber: Whether or not to overwrite existing properties. False by default. ...
Merge the properties of another configuration into this one. WARNING: This will remove properties from the other_conf. Args: other_conf: The other configuration. clobber: Whether or not to overwrite existing properties. False by default.
Merge the properties of another configuration into this one. WARNING: This will remove properties from the other_conf.
[ "Merge", "the", "properties", "of", "another", "configuration", "into", "this", "one", ".", "WARNING", ":", "This", "will", "remove", "properties", "from", "the", "other_conf", "." ]
def Merge(self, other_conf, clobber=False): for name in other_conf._properties: if name in self._properties and not clobber: logging.info( 'Property "{0}" is already set. Not clobbering'.format(name)) else: self._PutProperty(other_conf._properties[name])
[ "def", "Merge", "(", "self", ",", "other_conf", ",", "clobber", "=", "False", ")", ":", "for", "name", "in", "other_conf", ".", "_properties", ":", "if", "name", "in", "self", ".", "_properties", "and", "not", "clobber", ":", "logging", ".", "info", "(...
Merge the properties of another configuration into this one.
[ "Merge", "the", "properties", "of", "another", "configuration", "into", "this", "one", "." ]
[ "\"\"\"Merge the properties of another configuration into this one.\n\n WARNING: This will remove properties from the other_conf.\n\n Args:\n other_conf: The other configuration.\n clobber: Whether or not to overwrite existing properties.\n False by default.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "other_conf", "type": null }, { "param": "clobber", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "other_conf", "type": null, "docstring": "The other configuration.",...
85bd27489c69a5da99b7a2fa059515e41d6577e5
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/xml_configuration.py
[ "Apache-2.0" ]
Python
Update
null
def Update(self, properties_to_update, optional_properties_to_add): """Updates properties in the configuration. Args: properties_to_update: Dict of properties to update. where, key = name of a property, value = property is set to this value. optional_properties_to_add: Map o...
Updates properties in the configuration. Args: properties_to_update: Dict of properties to update. where, key = name of a property, value = property is set to this value. optional_properties_to_add: Map of properties to add only if it doesn't already exist in the file. ...
Updates properties in the configuration.
[ "Updates", "properties", "in", "the", "configuration", "." ]
def Update(self, properties_to_update, optional_properties_to_add): for name, value in sorted(properties_to_update.iteritems()): if value is None: self.RemoveProperty(name) else: self.SetProperty(name, value) for name, value in sorted(optional_properties_to_add.iteritems()): if...
[ "def", "Update", "(", "self", ",", "properties_to_update", ",", "optional_properties_to_add", ")", ":", "for", "name", ",", "value", "in", "sorted", "(", "properties_to_update", ".", "iteritems", "(", ")", ")", ":", "if", "value", "is", "None", ":", "self", ...
Updates properties in the configuration.
[ "Updates", "properties", "in", "the", "configuration", "." ]
[ "\"\"\"Updates properties in the configuration.\n\n Args:\n properties_to_update: Dict of properties to update.\n where,\n key = name of a property,\n value = property is set to this value.\n optional_properties_to_add: Map of properties to add\n only if it doesn't already e...
[ { "param": "self", "type": null }, { "param": "properties_to_update", "type": null }, { "param": "optional_properties_to_add", "type": null } ]
{ "returns": [], "raises": [ { "docstring": "if a property lookup in optional_properties_to_add is None.", "docstring_tokens": [ "if", "a", "property", "lookup", "in", "optional_properties_to_add", "is", "None", "." ], ...
85bd27489c69a5da99b7a2fa059515e41d6577e5
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/xml_configuration.py
[ "Apache-2.0" ]
Python
ResolveEnvironmentVariables
null
def ResolveEnvironmentVariables(self): """Replace <envVar/> elements with the corresponding environment variables. Raises: KeyError: If a variable is not set or empty. ValueError: If an <envVar/> element is malformed. """ for node in self._document.getElementsByTagName('envVar'): var_...
Replace <envVar/> elements with the corresponding environment variables. Raises: KeyError: If a variable is not set or empty. ValueError: If an <envVar/> element is malformed.
Replace elements with the corresponding environment variables.
[ "Replace", "elements", "with", "the", "corresponding", "environment", "variables", "." ]
def ResolveEnvironmentVariables(self): for node in self._document.getElementsByTagName('envVar'): var_name = node.getAttribute('name') if var_name: value = self._env_var_store.get(var_name) if not value: raise LookupError( 'No environment variable named "{0}" foun...
[ "def", "ResolveEnvironmentVariables", "(", "self", ")", ":", "for", "node", "in", "self", ".", "_document", ".", "getElementsByTagName", "(", "'envVar'", ")", ":", "var_name", "=", "node", ".", "getAttribute", "(", "'name'", ")", "if", "var_name", ":", "valu...
Replace <envVar/> elements with the corresponding environment variables.
[ "Replace", "<envVar", "/", ">", "elements", "with", "the", "corresponding", "environment", "variables", "." ]
[ "\"\"\"Replace <envVar/> elements with the corresponding environment variables.\n\n Raises:\n KeyError: If a variable is not set or empty.\n ValueError: If an <envVar/> element is malformed.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [ { "docstring": "If a variable is not set or empty.", "docstring_tokens": [ "If", "a", "variable", "is", "not", "set", "or", "empty", "." ], "type": "KeyError" }, { "docstrin...
85bd27489c69a5da99b7a2fa059515e41d6577e5
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/xml_configuration.py
[ "Apache-2.0" ]
Python
_Compact
null
def _Compact(node): """Compacts all whitespace that exists purely for indentation.""" for child in node.childNodes: if (child.nodeType == dom.Node.TEXT_NODE and (node.nodeName == 'configuration' or node.nodeName == 'property' or node.nodeName == '#document')): child...
Compacts all whitespace that exists purely for indentation.
Compacts all whitespace that exists purely for indentation.
[ "Compacts", "all", "whitespace", "that", "exists", "purely", "for", "indentation", "." ]
def _Compact(node): for child in node.childNodes: if (child.nodeType == dom.Node.TEXT_NODE and (node.nodeName == 'configuration' or node.nodeName == 'property' or node.nodeName == '#document')): child.nodeValue = '' Configuration._Compact(child)
[ "def", "_Compact", "(", "node", ")", ":", "for", "child", "in", "node", ".", "childNodes", ":", "if", "(", "child", ".", "nodeType", "==", "dom", ".", "Node", ".", "TEXT_NODE", "and", "(", "node", ".", "nodeName", "==", "'configuration'", "or", "node",...
Compacts all whitespace that exists purely for indentation.
[ "Compacts", "all", "whitespace", "that", "exists", "purely", "for", "indentation", "." ]
[ "\"\"\"Compacts all whitespace that exists purely for indentation.\"\"\"" ]
[ { "param": "node", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "node", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
85bd27489c69a5da99b7a2fa059515e41d6577e5
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/xml_configuration.py
[ "Apache-2.0" ]
Python
_FormatTextElements
null
def _FormatTextElements(self): """Strips and text wraps text elements.""" elements = ( self._document.getElementsByTagName('name') + self._document.getElementsByTagName('value') + self._document.getElementsByTagName('description')) for element in elements: text_element = self._...
Strips and text wraps text elements.
Strips and text wraps text elements.
[ "Strips", "and", "text", "wraps", "text", "elements", "." ]
def _FormatTextElements(self): elements = ( self._document.getElementsByTagName('name') + self._document.getElementsByTagName('value') + self._document.getElementsByTagName('description')) for element in elements: text_element = self._Property._TextElement(element) text_eleme...
[ "def", "_FormatTextElements", "(", "self", ")", ":", "elements", "=", "(", "self", ".", "_document", ".", "getElementsByTagName", "(", "'name'", ")", "+", "self", ".", "_document", ".", "getElementsByTagName", "(", "'value'", ")", "+", "self", ".", "_documen...
Strips and text wraps text elements.
[ "Strips", "and", "text", "wraps", "text", "elements", "." ]
[ "\"\"\"Strips and text wraps text elements.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
85bd27489c69a5da99b7a2fa059515e41d6577e5
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/xml_configuration.py
[ "Apache-2.0" ]
Python
_PutProperty
null
def _PutProperty(self, property): """Puts a <property> element in the configuration.""" old_property = self._properties.get(property.name) if old_property: self._configuration.replaceChild(property._element, old_property._element) else: self._configuration.appendChild(property._element) ...
Puts a <property> element in the configuration.
Puts a element in the configuration.
[ "Puts", "a", "element", "in", "the", "configuration", "." ]
def _PutProperty(self, property): old_property = self._properties.get(property.name) if old_property: self._configuration.replaceChild(property._element, old_property._element) else: self._configuration.appendChild(property._element) self._properties[property.name] = property
[ "def", "_PutProperty", "(", "self", ",", "property", ")", ":", "old_property", "=", "self", ".", "_properties", ".", "get", "(", "property", ".", "name", ")", "if", "old_property", ":", "self", ".", "_configuration", ".", "replaceChild", "(", "property", "...
Puts a <property> element in the configuration.
[ "Puts", "a", "<property", ">", "element", "in", "the", "configuration", "." ]
[ "\"\"\"Puts a <property> element in the configuration.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "property", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "property", "type": null, "docstring": null, "docstring_tokens...
25f7f23d7bef14b144a569df54db21b166c9edb3
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/path_validator_test.py
[ "Apache-2.0" ]
Python
_TestAbsoluteBase
null
def _TestAbsoluteBase( self, validator_func, succeed_on_nonexistent_dir, succeed_on_file, succeed_on_dir): """Helper for failure cases of absolute path validators. Args: validator_func: The function to test for basic failure modes. succeed_on_nonexistent_dir: Whether validator_func acce...
Helper for failure cases of absolute path validators. Args: validator_func: The function to test for basic failure modes. succeed_on_nonexistent_dir: Whether validator_func accepts an absolute non-existent directory. succeed_on_file: Whether validator_func accepts an absolute ...
Helper for failure cases of absolute path validators.
[ "Helper", "for", "failure", "cases", "of", "absolute", "path", "validators", "." ]
def _TestAbsoluteBase( self, validator_func, succeed_on_nonexistent_dir, succeed_on_file, succeed_on_dir): outcomes = { 'file:///tmp': False, '../': False, '': False, self._nonexistent_dir: succeed_on_nonexistent_dir, self._test_filename: succeed_on_file, ...
[ "def", "_TestAbsoluteBase", "(", "self", ",", "validator_func", ",", "succeed_on_nonexistent_dir", ",", "succeed_on_file", ",", "succeed_on_dir", ")", ":", "outcomes", "=", "{", "'file:///tmp'", ":", "False", ",", "'../'", ":", "False", ",", "''", ":", "False", ...
Helper for failure cases of absolute path validators.
[ "Helper", "for", "failure", "cases", "of", "absolute", "path", "validators", "." ]
[ "\"\"\"Helper for failure cases of absolute path validators.\n\n Args:\n validator_func: The function to test for basic failure modes.\n succeed_on_nonexistent_dir: Whether validator_func accepts an\n absolute non-existent directory.\n succeed_on_file: Whether validator_func accepts an\n ...
[ { "param": "self", "type": null }, { "param": "validator_func", "type": null }, { "param": "succeed_on_nonexistent_dir", "type": null }, { "param": "succeed_on_file", "type": null }, { "param": "succeed_on_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "validator_func", "type": null, "docstring": "The function to test f...
6dc6a5a0af6cf1f8d6b412a4fdc8c696842fead4
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands_test.py
[ "Apache-2.0" ]
Python
testValidationFailsAfterRegistrationBeforeSettingValues
null
def testValidationFailsAfterRegistrationBeforeSettingValues(self): """Check flag validation fails after appcommand has registered its flags.""" if self._test_cmd: # Empty flags right after setup/registration should fail validator. with self.assertRaises(flags.IllegalFlagValue): self._flag_va...
Check flag validation fails after appcommand has registered its flags.
Check flag validation fails after appcommand has registered its flags.
[ "Check", "flag", "validation", "fails", "after", "appcommand", "has", "registered", "its", "flags", "." ]
def testValidationFailsAfterRegistrationBeforeSettingValues(self): if self._test_cmd: with self.assertRaises(flags.IllegalFlagValue): self._flag_values_copy._AssertAllValidators()
[ "def", "testValidationFailsAfterRegistrationBeforeSettingValues", "(", "self", ")", ":", "if", "self", ".", "_test_cmd", ":", "with", "self", ".", "assertRaises", "(", "flags", ".", "IllegalFlagValue", ")", ":", "self", ".", "_flag_values_copy", ".", "_AssertAllVali...
Check flag validation fails after appcommand has registered its flags.
[ "Check", "flag", "validation", "fails", "after", "appcommand", "has", "registered", "its", "flags", "." ]
[ "\"\"\"Check flag validation fails after appcommand has registered its flags.\"\"\"", "# Empty flags right after setup/registration should fail validator." ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6dc6a5a0af6cf1f8d6b412a4fdc8c696842fead4
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands_test.py
[ "Apache-2.0" ]
Python
testDryRun
<not_specific>
def testDryRun(self): """Test --dry_run prevents modifications from being committed.""" if not self._test_cmd: return self._SetDefaultValidFlags() self._flag_values_copy.dry_run = True self._test_cmd.Run(None) # Nothing added. conf = xml_configuration.Configuration.FromFile(self._core...
Test --dry_run prevents modifications from being committed.
-dry_run prevents modifications from being committed.
[ "-", "dry_run", "prevents", "modifications", "from", "being", "committed", "." ]
def testDryRun(self): if not self._test_cmd: return self._SetDefaultValidFlags() self._flag_values_copy.dry_run = True self._test_cmd.Run(None) conf = xml_configuration.Configuration.FromFile(self._core_site_filename) self.assertEqual(0, conf.GetNumProperties()) conf = xml_configuratio...
[ "def", "testDryRun", "(", "self", ")", ":", "if", "not", "self", ".", "_test_cmd", ":", "return", "self", ".", "_SetDefaultValidFlags", "(", ")", "self", ".", "_flag_values_copy", ".", "dry_run", "=", "True", "self", ".", "_test_cmd", ".", "Run", "(", "N...
Test --dry_run prevents modifications from being committed.
[ "Test", "--", "dry_run", "prevents", "modifications", "from", "being", "committed", "." ]
[ "\"\"\"Test --dry_run prevents modifications from being committed.\"\"\"", "# Nothing added." ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6dc6a5a0af6cf1f8d6b412a4fdc8c696842fead4
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands_test.py
[ "Apache-2.0" ]
Python
_CreateXmlFile
null
def _CreateXmlFile(self, filename): """Helper for creating empty XML file. Args: filename: The fully-qualified file name to create. """ with open(filename, 'w') as f: f.write('<?xml version="1.0"?>') f.write('<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>') f.write(...
Helper for creating empty XML file. Args: filename: The fully-qualified file name to create.
Helper for creating empty XML file.
[ "Helper", "for", "creating", "empty", "XML", "file", "." ]
def _CreateXmlFile(self, filename): with open(filename, 'w') as f: f.write('<?xml version="1.0"?>') f.write('<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>') f.write('<configuration/>')
[ "def", "_CreateXmlFile", "(", "self", ",", "filename", ")", ":", "with", "open", "(", "filename", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "(", "'<?xml version=\"1.0\"?>'", ")", "f", ".", "write", "(", "'<?xml-stylesheet type=\"text/xsl\" href=\"con...
Helper for creating empty XML file.
[ "Helper", "for", "creating", "empty", "XML", "file", "." ]
[ "\"\"\"Helper for creating empty XML file.\n\n Args:\n filename: The fully-qualified file name to create.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "filename", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "filename", "type": null, "docstring": "The fully-qualified file nam...
6dc6a5a0af6cf1f8d6b412a4fdc8c696842fead4
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands_test.py
[ "Apache-2.0" ]
Python
_ValidateFlagFailures
null
def _ValidateFlagFailures(self, failure_modes): """Helper for iterating over a list of expected illegal flag values. Args: failure_modes: List of flag/value pairs which should cause an error. """ for failure_arg in failure_modes: with self.assertRaises(flags.IllegalFlagValue): print...
Helper for iterating over a list of expected illegal flag values. Args: failure_modes: List of flag/value pairs which should cause an error.
Helper for iterating over a list of expected illegal flag values.
[ "Helper", "for", "iterating", "over", "a", "list", "of", "expected", "illegal", "flag", "values", "." ]
def _ValidateFlagFailures(self, failure_modes): for failure_arg in failure_modes: with self.assertRaises(flags.IllegalFlagValue): print 'Validating expected failure setting %s = %s' % ( failure_arg[0], failure_arg[1]) self._flag_values_copy.__setattr__(failure_arg[0], failure_arg[1...
[ "def", "_ValidateFlagFailures", "(", "self", ",", "failure_modes", ")", ":", "for", "failure_arg", "in", "failure_modes", ":", "with", "self", ".", "assertRaises", "(", "flags", ".", "IllegalFlagValue", ")", ":", "print", "'Validating expected failure setting %s = %s'...
Helper for iterating over a list of expected illegal flag values.
[ "Helper", "for", "iterating", "over", "a", "list", "of", "expected", "illegal", "flag", "values", "." ]
[ "\"\"\"Helper for iterating over a list of expected illegal flag values.\n\n Args:\n failure_modes: List of flag/value pairs which should cause an error.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "failure_modes", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "failure_modes", "type": null, "docstring": "List of flag/value pair...
6dc6a5a0af6cf1f8d6b412a4fdc8c696842fead4
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands_test.py
[ "Apache-2.0" ]
Python
testFlagValidation
null
def testFlagValidation(self): """Test basic flag failures for configure_hadoop.""" # Validators get invoked on __setattr__ (overload for '='). failure_modes = [ ('hadoop_conf_dir', '/unreadable/path'), ('hadoop_conf_dir', None), ('java_home', '/unreadable/path'), ('java_home'...
Test basic flag failures for configure_hadoop.
Test basic flag failures for configure_hadoop.
[ "Test", "basic", "flag", "failures", "for", "configure_hadoop", "." ]
def testFlagValidation(self): failure_modes = [ ('hadoop_conf_dir', '/unreadable/path'), ('hadoop_conf_dir', None), ('java_home', '/unreadable/path'), ('java_home', None), ('hadoop_tmp_dir', '/unreadable/path'), ] self._ValidateFlagFailures(failure_modes)
[ "def", "testFlagValidation", "(", "self", ")", ":", "failure_modes", "=", "[", "(", "'hadoop_conf_dir'", ",", "'/unreadable/path'", ")", ",", "(", "'hadoop_conf_dir'", ",", "None", ")", ",", "(", "'java_home'", ",", "'/unreadable/path'", ")", ",", "(", "'java_...
Test basic flag failures for configure_hadoop.
[ "Test", "basic", "flag", "failures", "for", "configure_hadoop", "." ]
[ "\"\"\"Test basic flag failures for configure_hadoop.\"\"\"", "# Validators get invoked on __setattr__ (overload for '=')." ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6dc6a5a0af6cf1f8d6b412a4fdc8c696842fead4
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands_test.py
[ "Apache-2.0" ]
Python
testNormalOperation
null
def testNormalOperation(self): """Test configure_hadoop values wire through to correct xml keys.""" self._SetDefaultValidFlags() self._flag_values_copy.dry_run = False self._test_cmd.Run(None) conf = xml_configuration.Configuration.FromFile(self._mapred_site_filename) self.assertEqual(6, conf.G...
Test configure_hadoop values wire through to correct xml keys.
Test configure_hadoop values wire through to correct xml keys.
[ "Test", "configure_hadoop", "values", "wire", "through", "to", "correct", "xml", "keys", "." ]
def testNormalOperation(self): self._SetDefaultValidFlags() self._flag_values_copy.dry_run = False self._test_cmd.Run(None) conf = xml_configuration.Configuration.FromFile(self._mapred_site_filename) self.assertEqual(6, conf.GetNumProperties()) self.assertEquals('foo-host:9101', conf.GetProperty...
[ "def", "testNormalOperation", "(", "self", ")", ":", "self", ".", "_SetDefaultValidFlags", "(", ")", "self", ".", "_flag_values_copy", ".", "dry_run", "=", "False", "self", ".", "_test_cmd", ".", "Run", "(", "None", ")", "conf", "=", "xml_configuration", "."...
Test configure_hadoop values wire through to correct xml keys.
[ "Test", "configure_hadoop", "values", "wire", "through", "to", "correct", "xml", "keys", "." ]
[ "\"\"\"Test configure_hadoop values wire through to correct xml keys.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6dc6a5a0af6cf1f8d6b412a4fdc8c696842fead4
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands_test.py
[ "Apache-2.0" ]
Python
testFlagValidation
null
def testFlagValidation(self): """Test basic flag failures for configure_ghfs.""" # Validators. failure_modes = [ ('hadoop_conf_dir', '/unreadable/path'), ('hadoop_conf_dir', None), ('ghfs_jar_path', '/unreadable/path'), ('ghfs_jar_path', self._conf_dir), ('ghfs_jar_pa...
Test basic flag failures for configure_ghfs.
Test basic flag failures for configure_ghfs.
[ "Test", "basic", "flag", "failures", "for", "configure_ghfs", "." ]
def testFlagValidation(self): failure_modes = [ ('hadoop_conf_dir', '/unreadable/path'), ('hadoop_conf_dir', None), ('ghfs_jar_path', '/unreadable/path'), ('ghfs_jar_path', self._conf_dir), ('ghfs_jar_path', None), ('system_bucket', None), ('enable_service_acc...
[ "def", "testFlagValidation", "(", "self", ")", ":", "failure_modes", "=", "[", "(", "'hadoop_conf_dir'", ",", "'/unreadable/path'", ")", ",", "(", "'hadoop_conf_dir'", ",", "None", ")", ",", "(", "'ghfs_jar_path'", ",", "'/unreadable/path'", ")", ",", "(", "'g...
Test basic flag failures for configure_ghfs.
[ "Test", "basic", "flag", "failures", "for", "configure_ghfs", "." ]
[ "\"\"\"Test basic flag failures for configure_ghfs.\"\"\"", "# Validators." ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6dc6a5a0af6cf1f8d6b412a4fdc8c696842fead4
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands_test.py
[ "Apache-2.0" ]
Python
testNormalOperation
null
def testNormalOperation(self): """Test configure_ghfs values wire through to correct xml keys.""" self._SetDefaultValidFlags() self._flag_values_copy.dry_run = False self._test_cmd.Run(None) conf = xml_configuration.Configuration.FromFile(self._core_site_filename) self.assertEqual(6, conf.GetNu...
Test configure_ghfs values wire through to correct xml keys.
Test configure_ghfs values wire through to correct xml keys.
[ "Test", "configure_ghfs", "values", "wire", "through", "to", "correct", "xml", "keys", "." ]
def testNormalOperation(self): self._SetDefaultValidFlags() self._flag_values_copy.dry_run = False self._test_cmd.Run(None) conf = xml_configuration.Configuration.FromFile(self._core_site_filename) self.assertEqual(6, conf.GetNumProperties()) self.assertEquals('foo-bucket', conf.GetPropertyValue...
[ "def", "testNormalOperation", "(", "self", ")", ":", "self", ".", "_SetDefaultValidFlags", "(", ")", "self", ".", "_flag_values_copy", ".", "dry_run", "=", "False", "self", ".", "_test_cmd", ".", "Run", "(", "None", ")", "conf", "=", "xml_configuration", "."...
Test configure_ghfs values wire through to correct xml keys.
[ "Test", "configure_ghfs", "values", "wire", "through", "to", "correct", "xml", "keys", "." ]
[ "\"\"\"Test configure_ghfs values wire through to correct xml keys.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6dc6a5a0af6cf1f8d6b412a4fdc8c696842fead4
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands_test.py
[ "Apache-2.0" ]
Python
testReconfiguringDoesntReappendLineToEnvFile
null
def testReconfiguringDoesntReappendLineToEnvFile(self): """Calling configure_ghfs twice shouldn't re-add lines to hadoop-env.sh.""" self._SetDefaultValidFlags() self._flag_values_copy.dry_run = False self._test_cmd.Run(None) self._test_cmd.Run(None) with open(self._hadoop_env_filename, 'r') as ...
Calling configure_ghfs twice shouldn't re-add lines to hadoop-env.sh.
Calling configure_ghfs twice shouldn't re-add lines to hadoop-env.sh.
[ "Calling", "configure_ghfs", "twice", "shouldn", "'", "t", "re", "-", "add", "lines", "to", "hadoop", "-", "env", ".", "sh", "." ]
def testReconfiguringDoesntReappendLineToEnvFile(self): self._SetDefaultValidFlags() self._flag_values_copy.dry_run = False self._test_cmd.Run(None) self._test_cmd.Run(None) with open(self._hadoop_env_filename, 'r') as f: self.assertEqual(2, len(f.readlines()))
[ "def", "testReconfiguringDoesntReappendLineToEnvFile", "(", "self", ")", ":", "self", ".", "_SetDefaultValidFlags", "(", ")", "self", ".", "_flag_values_copy", ".", "dry_run", "=", "False", "self", ".", "_test_cmd", ".", "Run", "(", "None", ")", "self", ".", "...
Calling configure_ghfs twice shouldn't re-add lines to hadoop-env.sh.
[ "Calling", "configure_ghfs", "twice", "shouldn", "'", "t", "re", "-", "add", "lines", "to", "hadoop", "-", "env", ".", "sh", "." ]
[ "\"\"\"Calling configure_ghfs twice shouldn't re-add lines to hadoop-env.sh.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6dc6a5a0af6cf1f8d6b412a4fdc8c696842fead4
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands_test.py
[ "Apache-2.0" ]
Python
testServiceAccountRequiresClientIdAndSecret
null
def testServiceAccountRequiresClientIdAndSecret(self): """Setting enable_service_account_auth adds extra validators.""" self._SetDefaultValidFlags() self._flag_values_copy.dry_run = False # If we set enable_service_account_auth to False, we now require client_id # and client_secret. self._flag_...
Setting enable_service_account_auth adds extra validators.
Setting enable_service_account_auth adds extra validators.
[ "Setting", "enable_service_account_auth", "adds", "extra", "validators", "." ]
def testServiceAccountRequiresClientIdAndSecret(self): self._SetDefaultValidFlags() self._flag_values_copy.dry_run = False self._flag_values_copy.enable_service_account_auth = False self.assertRaises(flags.IllegalFlagValue, self._test_cmd.Run, None) self.assertRaises( flags.IllegalFlagValue,...
[ "def", "testServiceAccountRequiresClientIdAndSecret", "(", "self", ")", ":", "self", ".", "_SetDefaultValidFlags", "(", ")", "self", ".", "_flag_values_copy", ".", "dry_run", "=", "False", "self", ".", "_flag_values_copy", ".", "enable_service_account_auth", "=", "Fal...
Setting enable_service_account_auth adds extra validators.
[ "Setting", "enable_service_account_auth", "adds", "extra", "validators", "." ]
[ "\"\"\"Setting enable_service_account_auth adds extra validators.\"\"\"", "# If we set enable_service_account_auth to False, we now require client_id", "# and client_secret." ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6dc6a5a0af6cf1f8d6b412a4fdc8c696842fead4
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands_test.py
[ "Apache-2.0" ]
Python
testFlagValidation
null
def testFlagValidation(self): """Test basic flag failures for configure_hdfs.""" # Validators. failure_modes = [ ('hadoop_conf_dir', '/unreadable/path'), ('hadoop_conf_dir', None), ('hdfs_data_dirs', None), ('hdfs_data_dirs', FLAGS.test_tmpdir + ' /unreadable.path'), ...
Test basic flag failures for configure_hdfs.
Test basic flag failures for configure_hdfs.
[ "Test", "basic", "flag", "failures", "for", "configure_hdfs", "." ]
def testFlagValidation(self): failure_modes = [ ('hadoop_conf_dir', '/unreadable/path'), ('hadoop_conf_dir', None), ('hdfs_data_dirs', None), ('hdfs_data_dirs', FLAGS.test_tmpdir + ' /unreadable.path'), ('hdfs_name_dir', None), ('hdfs_name_dir', 'conf'), ('nam...
[ "def", "testFlagValidation", "(", "self", ")", ":", "failure_modes", "=", "[", "(", "'hadoop_conf_dir'", ",", "'/unreadable/path'", ")", ",", "(", "'hadoop_conf_dir'", ",", "None", ")", ",", "(", "'hdfs_data_dirs'", ",", "None", ")", ",", "(", "'hdfs_data_dirs...
Test basic flag failures for configure_hdfs.
[ "Test", "basic", "flag", "failures", "for", "configure_hdfs", "." ]
[ "\"\"\"Test basic flag failures for configure_hdfs.\"\"\"", "# Validators.", "# Missing trailing slash." ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6dc6a5a0af6cf1f8d6b412a4fdc8c696842fead4
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands_test.py
[ "Apache-2.0" ]
Python
testNormalOperation
null
def testNormalOperation(self): """Test configure_hdfs values wire through to correct xml keys.""" self._SetDefaultValidFlags() self._flag_values_copy.dry_run = False self._test_cmd.Run(None) conf = xml_configuration.Configuration.FromFile(self._hdfs_site_filename) self.assertEqual(3, conf.GetNu...
Test configure_hdfs values wire through to correct xml keys.
Test configure_hdfs values wire through to correct xml keys.
[ "Test", "configure_hdfs", "values", "wire", "through", "to", "correct", "xml", "keys", "." ]
def testNormalOperation(self): self._SetDefaultValidFlags() self._flag_values_copy.dry_run = False self._test_cmd.Run(None) conf = xml_configuration.Configuration.FromFile(self._hdfs_site_filename) self.assertEqual(3, conf.GetNumProperties()) self.assertEqual( ','.join(self._flag_values_...
[ "def", "testNormalOperation", "(", "self", ")", ":", "self", ".", "_SetDefaultValidFlags", "(", ")", "self", ".", "_flag_values_copy", ".", "dry_run", "=", "False", "self", ".", "_test_cmd", ".", "Run", "(", "None", ")", "conf", "=", "xml_configuration", "."...
Test configure_hdfs values wire through to correct xml keys.
[ "Test", "configure_hdfs", "values", "wire", "through", "to", "correct", "xml", "keys", "." ]
[ "\"\"\"Test configure_hdfs values wire through to correct xml keys.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6dc6a5a0af6cf1f8d6b412a4fdc8c696842fead4
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands_test.py
[ "Apache-2.0" ]
Python
testFlagValidation
null
def testFlagValidation(self): """Test basic flag failures for set_default_fs.""" # Validators. failure_modes = [ ('hadoop_conf_dir', '/unreadable/path'), ('hadoop_conf_dir', None), ('default_fs', None), ] self._ValidateFlagFailures(failure_modes)
Test basic flag failures for set_default_fs.
Test basic flag failures for set_default_fs.
[ "Test", "basic", "flag", "failures", "for", "set_default_fs", "." ]
def testFlagValidation(self): failure_modes = [ ('hadoop_conf_dir', '/unreadable/path'), ('hadoop_conf_dir', None), ('default_fs', None), ] self._ValidateFlagFailures(failure_modes)
[ "def", "testFlagValidation", "(", "self", ")", ":", "failure_modes", "=", "[", "(", "'hadoop_conf_dir'", ",", "'/unreadable/path'", ")", ",", "(", "'hadoop_conf_dir'", ",", "None", ")", ",", "(", "'default_fs'", ",", "None", ")", ",", "]", "self", ".", "_V...
Test basic flag failures for set_default_fs.
[ "Test", "basic", "flag", "failures", "for", "set_default_fs", "." ]
[ "\"\"\"Test basic flag failures for set_default_fs.\"\"\"", "# Validators." ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6dc6a5a0af6cf1f8d6b412a4fdc8c696842fead4
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands_test.py
[ "Apache-2.0" ]
Python
testNormalOperationWithSystemBucketFallback
null
def testNormalOperationWithSystemBucketFallback(self): """Test set_default_fs values wire through to correct xml keys.""" self._SetDefaultValidFlags() self._flag_values_copy.dry_run = False self._flag_values_copy.default_bucket = None system_bucket = 'system-bucket' conf = xml_configuration.Con...
Test set_default_fs values wire through to correct xml keys.
Test set_default_fs values wire through to correct xml keys.
[ "Test", "set_default_fs", "values", "wire", "through", "to", "correct", "xml", "keys", "." ]
def testNormalOperationWithSystemBucketFallback(self): self._SetDefaultValidFlags() self._flag_values_copy.dry_run = False self._flag_values_copy.default_bucket = None system_bucket = 'system-bucket' conf = xml_configuration.Configuration.FromFile(self._core_site_filename) conf.Update({'fs.gs.sy...
[ "def", "testNormalOperationWithSystemBucketFallback", "(", "self", ")", ":", "self", ".", "_SetDefaultValidFlags", "(", ")", "self", ".", "_flag_values_copy", ".", "dry_run", "=", "False", "self", ".", "_flag_values_copy", ".", "default_bucket", "=", "None", "system...
Test set_default_fs values wire through to correct xml keys.
[ "Test", "set_default_fs", "values", "wire", "through", "to", "correct", "xml", "keys", "." ]
[ "\"\"\"Test set_default_fs values wire through to correct xml keys.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6dc6a5a0af6cf1f8d6b412a4fdc8c696842fead4
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands_test.py
[ "Apache-2.0" ]
Python
testSystemBucketFallbackFailure
null
def testSystemBucketFallbackFailure(self): """Without default_bucket, attempts and fails to fetch system_bucket.""" self._SetDefaultValidFlags() self._flag_values_copy.dry_run = False self._flag_values_copy.default_bucket = None # Default_bucket fails to be set using fs.gs.system.bucket without the...
Without default_bucket, attempts and fails to fetch system_bucket.
Without default_bucket, attempts and fails to fetch system_bucket.
[ "Without", "default_bucket", "attempts", "and", "fails", "to", "fetch", "system_bucket", "." ]
def testSystemBucketFallbackFailure(self): self._SetDefaultValidFlags() self._flag_values_copy.dry_run = False self._flag_values_copy.default_bucket = None self.assertRaises(KeyError, self._test_cmd.Run, None)
[ "def", "testSystemBucketFallbackFailure", "(", "self", ")", ":", "self", ".", "_SetDefaultValidFlags", "(", ")", "self", ".", "_flag_values_copy", ".", "dry_run", "=", "False", "self", ".", "_flag_values_copy", ".", "default_bucket", "=", "None", "self", ".", "a...
Without default_bucket, attempts and fails to fetch system_bucket.
[ "Without", "default_bucket", "attempts", "and", "fails", "to", "fetch", "system_bucket", "." ]
[ "\"\"\"Without default_bucket, attempts and fails to fetch system_bucket.\"\"\"", "# Default_bucket fails to be set using fs.gs.system.bucket without the", "# corresponding value already present in the xml file." ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6dc6a5a0af6cf1f8d6b412a4fdc8c696842fead4
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands_test.py
[ "Apache-2.0" ]
Python
testNormalOperationWithDefaultBucket
null
def testNormalOperationWithDefaultBucket(self): """With default_bucket provided, no fallback, check normal wiring.""" self._SetDefaultValidFlags() self._flag_values_copy.dry_run = False self._flag_values_copy.default_bucket = 'some-other-bucket' system_bucket = 'system-bucket' conf = xml_config...
With default_bucket provided, no fallback, check normal wiring.
With default_bucket provided, no fallback, check normal wiring.
[ "With", "default_bucket", "provided", "no", "fallback", "check", "normal", "wiring", "." ]
def testNormalOperationWithDefaultBucket(self): self._SetDefaultValidFlags() self._flag_values_copy.dry_run = False self._flag_values_copy.default_bucket = 'some-other-bucket' system_bucket = 'system-bucket' conf = xml_configuration.Configuration.FromFile(self._core_site_filename) conf.Update({'...
[ "def", "testNormalOperationWithDefaultBucket", "(", "self", ")", ":", "self", ".", "_SetDefaultValidFlags", "(", ")", "self", ".", "_flag_values_copy", ".", "dry_run", "=", "False", "self", ".", "_flag_values_copy", ".", "default_bucket", "=", "'some-other-bucket'", ...
With default_bucket provided, no fallback, check normal wiring.
[ "With", "default_bucket", "provided", "no", "fallback", "check", "normal", "wiring", "." ]
[ "\"\"\"With default_bucket provided, no fallback, check normal wiring.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6dc6a5a0af6cf1f8d6b412a4fdc8c696842fead4
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands_test.py
[ "Apache-2.0" ]
Python
testHdfsSpecificValidators
null
def testHdfsSpecificValidators(self): """If default_fs is hdfs, then we add extra validators.""" self._SetDefaultValidFlags() self._flag_values_copy.dry_run = False # Using hdfs will invoke new validators. self._flag_values_copy.default_fs = 'hdfs' # namenode_uri fails to be set using hdfs-sit...
If default_fs is hdfs, then we add extra validators.
If default_fs is hdfs, then we add extra validators.
[ "If", "default_fs", "is", "hdfs", "then", "we", "add", "extra", "validators", "." ]
def testHdfsSpecificValidators(self): self._SetDefaultValidFlags() self._flag_values_copy.dry_run = False self._flag_values_copy.default_fs = 'hdfs' self.assertRaises(KeyError, self._test_cmd.Run, None) self.assertRaises( flags.IllegalFlagValue, self._flag_values_copy.__setattr__, 'n...
[ "def", "testHdfsSpecificValidators", "(", "self", ")", ":", "self", ".", "_SetDefaultValidFlags", "(", ")", "self", ".", "_flag_values_copy", ".", "dry_run", "=", "False", "self", ".", "_flag_values_copy", ".", "default_fs", "=", "'hdfs'", "self", ".", "assertRa...
If default_fs is hdfs, then we add extra validators.
[ "If", "default_fs", "is", "hdfs", "then", "we", "add", "extra", "validators", "." ]
[ "\"\"\"If default_fs is hdfs, then we add extra validators.\"\"\"", "# Using hdfs will invoke new validators.", "# namenode_uri fails to be set using hdfs-site.xml", "# Missing trailing slash." ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6dc6a5a0af6cf1f8d6b412a4fdc8c696842fead4
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands_test.py
[ "Apache-2.0" ]
Python
testHdfsFallbackToNamenodeRpcAddressFailure
null
def testHdfsFallbackToNamenodeRpcAddressFailure(self): """With hdfs, absence of fs.default.name fetches rpc-address and fails.""" self._SetDefaultValidFlags() self._flag_values_copy.dry_run = False self._flag_values_copy.default_fs = 'hdfs' conf = xml_configuration.Configuration.FromFile(self._hdf...
With hdfs, absence of fs.default.name fetches rpc-address and fails.
With hdfs, absence of fs.default.name fetches rpc-address and fails.
[ "With", "hdfs", "absence", "of", "fs", ".", "default", ".", "name", "fetches", "rpc", "-", "address", "and", "fails", "." ]
def testHdfsFallbackToNamenodeRpcAddressFailure(self): self._SetDefaultValidFlags() self._flag_values_copy.dry_run = False self._flag_values_copy.default_fs = 'hdfs' conf = xml_configuration.Configuration.FromFile(self._hdfs_site_filename) conf.Update({'dfs.namenode.rpc-address': 'badscheme://localh...
[ "def", "testHdfsFallbackToNamenodeRpcAddressFailure", "(", "self", ")", ":", "self", ".", "_SetDefaultValidFlags", "(", ")", "self", ".", "_flag_values_copy", ".", "dry_run", "=", "False", "self", ".", "_flag_values_copy", ".", "default_fs", "=", "'hdfs'", "conf", ...
With hdfs, absence of fs.default.name fetches rpc-address and fails.
[ "With", "hdfs", "absence", "of", "fs", ".", "default", ".", "name", "fetches", "rpc", "-", "address", "and", "fails", "." ]
[ "\"\"\"With hdfs, absence of fs.default.name fetches rpc-address and fails.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6dc6a5a0af6cf1f8d6b412a4fdc8c696842fead4
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands_test.py
[ "Apache-2.0" ]
Python
testHdfsFallbackToNamenodeRpcAddressSuccess
null
def testHdfsFallbackToNamenodeRpcAddressSuccess(self): """With hdfs, absence of fs.default.name successfully uses rpc-address.""" self._SetDefaultValidFlags() self._flag_values_copy.dry_run = False self._flag_values_copy.default_fs = 'hdfs' self._flag_values_copy.namenode_uri = None namenode_...
With hdfs, absence of fs.default.name successfully uses rpc-address.
With hdfs, absence of fs.default.name successfully uses rpc-address.
[ "With", "hdfs", "absence", "of", "fs", ".", "default", ".", "name", "successfully", "uses", "rpc", "-", "address", "." ]
def testHdfsFallbackToNamenodeRpcAddressSuccess(self): self._SetDefaultValidFlags() self._flag_values_copy.dry_run = False self._flag_values_copy.default_fs = 'hdfs' self._flag_values_copy.namenode_uri = None namenode_uri = 'hdfs://localhost:8020/' conf = xml_configuration.Configuration.FromFile...
[ "def", "testHdfsFallbackToNamenodeRpcAddressSuccess", "(", "self", ")", ":", "self", ".", "_SetDefaultValidFlags", "(", ")", "self", ".", "_flag_values_copy", ".", "dry_run", "=", "False", "self", ".", "_flag_values_copy", ".", "default_fs", "=", "'hdfs'", "self", ...
With hdfs, absence of fs.default.name successfully uses rpc-address.
[ "With", "hdfs", "absence", "of", "fs", ".", "default", ".", "name", "successfully", "uses", "rpc", "-", "address", "." ]
[ "\"\"\"With hdfs, absence of fs.default.name successfully uses rpc-address.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0d765e64658947d67dfe0222a15454ffeca4955d
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/path_validator.py
[ "Apache-2.0" ]
Python
AbsolutePath
<not_specific>
def AbsolutePath(path): """Validates that the given path is absolute.""" if path is None: # Value is allowed to not be set return True components = urlparse.urlparse(path) if components.scheme: raise flags_validators.Error( 'The given path must not be a url: ' + path) elif not os.path.isab...
Validates that the given path is absolute.
Validates that the given path is absolute.
[ "Validates", "that", "the", "given", "path", "is", "absolute", "." ]
def AbsolutePath(path): if path is None: return True components = urlparse.urlparse(path) if components.scheme: raise flags_validators.Error( 'The given path must not be a url: ' + path) elif not os.path.isabs(path): raise flags_validators.Error('Path must be absolute: ' + path) else: ...
[ "def", "AbsolutePath", "(", "path", ")", ":", "if", "path", "is", "None", ":", "return", "True", "components", "=", "urlparse", ".", "urlparse", "(", "path", ")", "if", "components", ".", "scheme", ":", "raise", "flags_validators", ".", "Error", "(", "'T...
Validates that the given path is absolute.
[ "Validates", "that", "the", "given", "path", "is", "absolute", "." ]
[ "\"\"\"Validates that the given path is absolute.\"\"\"", "# Value is allowed to not be set" ]
[ { "param": "path", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "path", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0d765e64658947d67dfe0222a15454ffeca4955d
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/path_validator.py
[ "Apache-2.0" ]
Python
AbsoluteReadablePath
<not_specific>
def AbsoluteReadablePath(path): """Validates that the given path is absolute and is readable.""" if path is None: # Value is allowed to not be set return True AbsolutePath(path) if not os.access(path, os.R_OK): raise flags_validators.Error('Cannot read path: ' + path) else: return True
Validates that the given path is absolute and is readable.
Validates that the given path is absolute and is readable.
[ "Validates", "that", "the", "given", "path", "is", "absolute", "and", "is", "readable", "." ]
def AbsoluteReadablePath(path): if path is None: return True AbsolutePath(path) if not os.access(path, os.R_OK): raise flags_validators.Error('Cannot read path: ' + path) else: return True
[ "def", "AbsoluteReadablePath", "(", "path", ")", ":", "if", "path", "is", "None", ":", "return", "True", "AbsolutePath", "(", "path", ")", "if", "not", "os", ".", "access", "(", "path", ",", "os", ".", "R_OK", ")", ":", "raise", "flags_validators", "."...
Validates that the given path is absolute and is readable.
[ "Validates", "that", "the", "given", "path", "is", "absolute", "and", "is", "readable", "." ]
[ "\"\"\"Validates that the given path is absolute and is readable.\"\"\"", "# Value is allowed to not be set" ]
[ { "param": "path", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "path", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0d765e64658947d67dfe0222a15454ffeca4955d
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/path_validator.py
[ "Apache-2.0" ]
Python
AbsoluteDirectoryPath
<not_specific>
def AbsoluteDirectoryPath(path): """Validates that the given path is absolute and points to a directory.""" if path is None: # Value is allowed to not be set return True AbsoluteReadablePath(path) if not os.path.isdir(path): raise flags_validators.Error( 'Path must point to an existing direc...
Validates that the given path is absolute and points to a directory.
Validates that the given path is absolute and points to a directory.
[ "Validates", "that", "the", "given", "path", "is", "absolute", "and", "points", "to", "a", "directory", "." ]
def AbsoluteDirectoryPath(path): if path is None: return True AbsoluteReadablePath(path) if not os.path.isdir(path): raise flags_validators.Error( 'Path must point to an existing directory: ' + path) else: return True
[ "def", "AbsoluteDirectoryPath", "(", "path", ")", ":", "if", "path", "is", "None", ":", "return", "True", "AbsoluteReadablePath", "(", "path", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "path", ")", ":", "raise", "flags_validators", ".", "Er...
Validates that the given path is absolute and points to a directory.
[ "Validates", "that", "the", "given", "path", "is", "absolute", "and", "points", "to", "a", "directory", "." ]
[ "\"\"\"Validates that the given path is absolute and points to a directory.\"\"\"", "# Value is allowed to not be set" ]
[ { "param": "path", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "path", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0d765e64658947d67dfe0222a15454ffeca4955d
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/path_validator.py
[ "Apache-2.0" ]
Python
AbsoluteFilePath
<not_specific>
def AbsoluteFilePath(path): """Validates that the given path is absolute and points to a file.""" if path is None: # Value is allowed to not be set return True AbsoluteReadablePath(path) if os.path.isdir(path): raise flags_validators.Error( 'Path must point to an existing file: ' + path) e...
Validates that the given path is absolute and points to a file.
Validates that the given path is absolute and points to a file.
[ "Validates", "that", "the", "given", "path", "is", "absolute", "and", "points", "to", "a", "file", "." ]
def AbsoluteFilePath(path): if path is None: return True AbsoluteReadablePath(path) if os.path.isdir(path): raise flags_validators.Error( 'Path must point to an existing file: ' + path) else: return True
[ "def", "AbsoluteFilePath", "(", "path", ")", ":", "if", "path", "is", "None", ":", "return", "True", "AbsoluteReadablePath", "(", "path", ")", "if", "os", ".", "path", ".", "isdir", "(", "path", ")", ":", "raise", "flags_validators", ".", "Error", "(", ...
Validates that the given path is absolute and points to a file.
[ "Validates", "that", "the", "given", "path", "is", "absolute", "and", "points", "to", "a", "file", "." ]
[ "\"\"\"Validates that the given path is absolute and points to a file.\"\"\"", "# Value is allowed to not be set" ]
[ { "param": "path", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "path", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0d765e64658947d67dfe0222a15454ffeca4955d
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/path_validator.py
[ "Apache-2.0" ]
Python
AbsoluteHDFSUri
<not_specific>
def AbsoluteHDFSUri(uri): """Validates that the given path is absolute and looks like an HDFS path.""" if uri is None: # Value is allowed to not be set return True components = urlparse.urlparse(uri) if components.scheme != 'hdfs': raise flags_validators.Error( 'The given path must use hdfs ...
Validates that the given path is absolute and looks like an HDFS path.
Validates that the given path is absolute and looks like an HDFS path.
[ "Validates", "that", "the", "given", "path", "is", "absolute", "and", "looks", "like", "an", "HDFS", "path", "." ]
def AbsoluteHDFSUri(uri): if uri is None: return True components = urlparse.urlparse(uri) if components.scheme != 'hdfs': raise flags_validators.Error( 'The given path must use hdfs scheme: ' + uri) elif not components.path.startswith('/'): raise flags_validators.Error( 'The given HD...
[ "def", "AbsoluteHDFSUri", "(", "uri", ")", ":", "if", "uri", "is", "None", ":", "return", "True", "components", "=", "urlparse", ".", "urlparse", "(", "uri", ")", "if", "components", ".", "scheme", "!=", "'hdfs'", ":", "raise", "flags_validators", ".", "...
Validates that the given path is absolute and looks like an HDFS path.
[ "Validates", "that", "the", "given", "path", "is", "absolute", "and", "looks", "like", "an", "HDFS", "path", "." ]
[ "\"\"\"Validates that the given path is absolute and looks like an HDFS path.\"\"\"", "# Value is allowed to not be set" ]
[ { "param": "uri", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "uri", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
dd0ddd4fed26348a57b042dcd8747cbe55e41703
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/xml_config_commands.py
[ "Apache-2.0" ]
Python
SetFlagsInstance
null
def SetFlagsInstance(self, flags_instance): """Sets the FlagValues instance to be used to retrieve command flags. Useful for unittesting. Args: flags_instance: Instance of FlagValues to be used. """ self._flags = flags_instance
Sets the FlagValues instance to be used to retrieve command flags. Useful for unittesting. Args: flags_instance: Instance of FlagValues to be used.
Sets the FlagValues instance to be used to retrieve command flags. Useful for unittesting.
[ "Sets", "the", "FlagValues", "instance", "to", "be", "used", "to", "retrieve", "command", "flags", ".", "Useful", "for", "unittesting", "." ]
def SetFlagsInstance(self, flags_instance): self._flags = flags_instance
[ "def", "SetFlagsInstance", "(", "self", ",", "flags_instance", ")", ":", "self", ".", "_flags", "=", "flags_instance" ]
Sets the FlagValues instance to be used to retrieve command flags.
[ "Sets", "the", "FlagValues", "instance", "to", "be", "used", "to", "retrieve", "command", "flags", "." ]
[ "\"\"\"Sets the FlagValues instance to be used to retrieve command flags.\n\n Useful for unittesting.\n\n Args:\n flags_instance: Instance of FlagValues to be used.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "flags_instance", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "flags_instance", "type": null, "docstring": "Instance of FlagValues...
dd0ddd4fed26348a57b042dcd8747cbe55e41703
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/xml_config_commands.py
[ "Apache-2.0" ]
Python
Run
null
def Run(self, unused_argv): """Main method invoked by appcommands.""" conf = self.LoadConfiguration() conf.SetProperty( self._flags.name, self._flags.value, description=self._flags.description, clobber=self._flags.clobber) self.WriteConfiguration(conf)
Main method invoked by appcommands.
Main method invoked by appcommands.
[ "Main", "method", "invoked", "by", "appcommands", "." ]
def Run(self, unused_argv): conf = self.LoadConfiguration() conf.SetProperty( self._flags.name, self._flags.value, description=self._flags.description, clobber=self._flags.clobber) self.WriteConfiguration(conf)
[ "def", "Run", "(", "self", ",", "unused_argv", ")", ":", "conf", "=", "self", ".", "LoadConfiguration", "(", ")", "conf", ".", "SetProperty", "(", "self", ".", "_flags", ".", "name", ",", "self", ".", "_flags", ".", "value", ",", "description", "=", ...
Main method invoked by appcommands.
[ "Main", "method", "invoked", "by", "appcommands", "." ]
[ "\"\"\"Main method invoked by appcommands.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "unused_argv", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "unused_argv", "type": null, "docstring": null, "docstring_tok...
dd0ddd4fed26348a57b042dcd8747cbe55e41703
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/xml_config_commands.py
[ "Apache-2.0" ]
Python
Run
null
def Run(self, unused_argv): """Main method invoked by appcommands.""" conf = self.LoadConfiguration() conf.RemoveProperty(self._flags.name) self.WriteConfiguration(conf)
Main method invoked by appcommands.
Main method invoked by appcommands.
[ "Main", "method", "invoked", "by", "appcommands", "." ]
def Run(self, unused_argv): conf = self.LoadConfiguration() conf.RemoveProperty(self._flags.name) self.WriteConfiguration(conf)
[ "def", "Run", "(", "self", ",", "unused_argv", ")", ":", "conf", "=", "self", ".", "LoadConfiguration", "(", ")", "conf", ".", "RemoveProperty", "(", "self", ".", "_flags", ".", "name", ")", "self", ".", "WriteConfiguration", "(", "conf", ")" ]
Main method invoked by appcommands.
[ "Main", "method", "invoked", "by", "appcommands", "." ]
[ "\"\"\"Main method invoked by appcommands.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "unused_argv", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "unused_argv", "type": null, "docstring": null, "docstring_tok...
dd0ddd4fed26348a57b042dcd8747cbe55e41703
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/xml_config_commands.py
[ "Apache-2.0" ]
Python
Run
null
def Run(self, unused_argv): """Main method invoked by appcommands.""" conf = self.LoadConfiguration() value = conf.GetPropertyValue(self._flags.name) logging.info('Property value is: "{0}"'.format(value)) print value
Main method invoked by appcommands.
Main method invoked by appcommands.
[ "Main", "method", "invoked", "by", "appcommands", "." ]
def Run(self, unused_argv): conf = self.LoadConfiguration() value = conf.GetPropertyValue(self._flags.name) logging.info('Property value is: "{0}"'.format(value)) print value
[ "def", "Run", "(", "self", ",", "unused_argv", ")", ":", "conf", "=", "self", ".", "LoadConfiguration", "(", ")", "value", "=", "conf", ".", "GetPropertyValue", "(", "self", ".", "_flags", ".", "name", ")", "logging", ".", "info", "(", "'Property value i...
Main method invoked by appcommands.
[ "Main", "method", "invoked", "by", "appcommands", "." ]
[ "\"\"\"Main method invoked by appcommands.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "unused_argv", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "unused_argv", "type": null, "docstring": null, "docstring_tok...
dd0ddd4fed26348a57b042dcd8747cbe55e41703
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/xml_config_commands.py
[ "Apache-2.0" ]
Python
Run
null
def Run(self, unused_argv): """Main method invoked by appcommands.""" conf = self.LoadConfiguration() source_conf = xml_configuration.Configuration.FromFile( self._flags.source_configuration_file) conf.Merge(source_conf, clobber=self._flags.clobber) if self._flags.resolve_environment_variab...
Main method invoked by appcommands.
Main method invoked by appcommands.
[ "Main", "method", "invoked", "by", "appcommands", "." ]
def Run(self, unused_argv): conf = self.LoadConfiguration() source_conf = xml_configuration.Configuration.FromFile( self._flags.source_configuration_file) conf.Merge(source_conf, clobber=self._flags.clobber) if self._flags.resolve_environment_variables: conf.ResolveEnvironmentVariables() ...
[ "def", "Run", "(", "self", ",", "unused_argv", ")", ":", "conf", "=", "self", ".", "LoadConfiguration", "(", ")", "source_conf", "=", "xml_configuration", ".", "Configuration", ".", "FromFile", "(", "self", ".", "_flags", ".", "source_configuration_file", ")",...
Main method invoked by appcommands.
[ "Main", "method", "invoked", "by", "appcommands", "." ]
[ "\"\"\"Main method invoked by appcommands.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "unused_argv", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "unused_argv", "type": null, "docstring": null, "docstring_tok...
dd0ddd4fed26348a57b042dcd8747cbe55e41703
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/xml_config_commands.py
[ "Apache-2.0" ]
Python
Run
null
def Run(self, unused_argv): """Main method invoked by appcommands.""" conf = self.LoadConfiguration() conf.ResolveEnvironmentVariables() self.WriteConfiguration(conf)
Main method invoked by appcommands.
Main method invoked by appcommands.
[ "Main", "method", "invoked", "by", "appcommands", "." ]
def Run(self, unused_argv): conf = self.LoadConfiguration() conf.ResolveEnvironmentVariables() self.WriteConfiguration(conf)
[ "def", "Run", "(", "self", ",", "unused_argv", ")", ":", "conf", "=", "self", ".", "LoadConfiguration", "(", ")", "conf", ".", "ResolveEnvironmentVariables", "(", ")", "self", ".", "WriteConfiguration", "(", "conf", ")" ]
Main method invoked by appcommands.
[ "Main", "method", "invoked", "by", "appcommands", "." ]
[ "\"\"\"Main method invoked by appcommands.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "unused_argv", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "unused_argv", "type": null, "docstring": null, "docstring_tok...
38a0826ecd0b6dcc6f0f09576bc70b8a6be1fa6e
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands.py
[ "Apache-2.0" ]
Python
AddLineToFile
null
def AddLineToFile(file_name, line, dry_run): """Appends the given line to the given file if it is not already present.""" with open(file_name, 'a+') as f: line = line.strip() if line in (f_line.strip() for f_line in f): logging.warn( 'Line: "{0}" already in file "{1}"; not appending to file'...
Appends the given line to the given file if it is not already present.
Appends the given line to the given file if it is not already present.
[ "Appends", "the", "given", "line", "to", "the", "given", "file", "if", "it", "is", "not", "already", "present", "." ]
def AddLineToFile(file_name, line, dry_run): with open(file_name, 'a+') as f: line = line.strip() if line in (f_line.strip() for f_line in f): logging.warn( 'Line: "{0}" already in file "{1}"; not appending to file'.format( line, file_name)) elif dry_run: print 'Appendi...
[ "def", "AddLineToFile", "(", "file_name", ",", "line", ",", "dry_run", ")", ":", "with", "open", "(", "file_name", ",", "'a+'", ")", "as", "f", ":", "line", "=", "line", ".", "strip", "(", ")", "if", "line", "in", "(", "f_line", ".", "strip", "(", ...
Appends the given line to the given file if it is not already present.
[ "Appends", "the", "given", "line", "to", "the", "given", "file", "if", "it", "is", "not", "already", "present", "." ]
[ "\"\"\"Appends the given line to the given file if it is not already present.\"\"\"" ]
[ { "param": "file_name", "type": null }, { "param": "line", "type": null }, { "param": "dry_run", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "file_name", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "line", "type": null, "docstring": null, "docstring_token...
38a0826ecd0b6dcc6f0f09576bc70b8a6be1fa6e
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands.py
[ "Apache-2.0" ]
Python
_UpdateHadoopEnv
null
def _UpdateHadoopEnv(self): """Updates hadoop-env.sh file by adding necessary exports.""" path = os.path.join(self._flags.hadoop_conf_dir, 'hadoop-env.sh') exports = 'export JAVA_HOME="{0}"'.format(self._flags.java_home) AddLineToFile(path, exports, self._flags.dry_run)
Updates hadoop-env.sh file by adding necessary exports.
Updates hadoop-env.sh file by adding necessary exports.
[ "Updates", "hadoop", "-", "env", ".", "sh", "file", "by", "adding", "necessary", "exports", "." ]
def _UpdateHadoopEnv(self): path = os.path.join(self._flags.hadoop_conf_dir, 'hadoop-env.sh') exports = 'export JAVA_HOME="{0}"'.format(self._flags.java_home) AddLineToFile(path, exports, self._flags.dry_run)
[ "def", "_UpdateHadoopEnv", "(", "self", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "_flags", ".", "hadoop_conf_dir", ",", "'hadoop-env.sh'", ")", "exports", "=", "'export JAVA_HOME=\"{0}\"'", ".", "format", "(", "self", ".", "...
Updates hadoop-env.sh file by adding necessary exports.
[ "Updates", "hadoop", "-", "env", ".", "sh", "file", "by", "adding", "necessary", "exports", "." ]
[ "\"\"\"Updates hadoop-env.sh file by adding necessary exports.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
38a0826ecd0b6dcc6f0f09576bc70b8a6be1fa6e
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands.py
[ "Apache-2.0" ]
Python
Run
null
def Run(self, unused_argv): """Main method invoked by appcommands.""" if not self._flags.enable_service_account_auth: flags.MarkFlagAsRequired('client_id', flag_values=self._command_flags) # Resetting the flag from itself triggers newly added validators. self._flags.client_id = self._flags.cli...
Main method invoked by appcommands.
Main method invoked by appcommands.
[ "Main", "method", "invoked", "by", "appcommands", "." ]
def Run(self, unused_argv): if not self._flags.enable_service_account_auth: flags.MarkFlagAsRequired('client_id', flag_values=self._command_flags) self._flags.client_id = self._flags.client_id flags.MarkFlagAsRequired('client_secret', flag_values=self._command_flags) self._flags.client_secre...
[ "def", "Run", "(", "self", ",", "unused_argv", ")", ":", "if", "not", "self", ".", "_flags", ".", "enable_service_account_auth", ":", "flags", ".", "MarkFlagAsRequired", "(", "'client_id'", ",", "flag_values", "=", "self", ".", "_command_flags", ")", "self", ...
Main method invoked by appcommands.
[ "Main", "method", "invoked", "by", "appcommands", "." ]
[ "\"\"\"Main method invoked by appcommands.\"\"\"", "# Resetting the flag from itself triggers newly added validators.", "# Resetting the flag from itself triggers newly added validators." ]
[ { "param": "self", "type": null }, { "param": "unused_argv", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "unused_argv", "type": null, "docstring": null, "docstring_tok...
38a0826ecd0b6dcc6f0f09576bc70b8a6be1fa6e
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands.py
[ "Apache-2.0" ]
Python
_UpdateHadoopEnv
null
def _UpdateHadoopEnv(self): """Updates hadoop-env.sh file by adding necessary exports.""" path = os.path.join(self._flags.hadoop_conf_dir, 'hadoop-env.sh') exports = 'export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:{0}'.format( self._flags.ghfs_jar_path) AddLineToFile(path, exports, self._flags.dry_r...
Updates hadoop-env.sh file by adding necessary exports.
Updates hadoop-env.sh file by adding necessary exports.
[ "Updates", "hadoop", "-", "env", ".", "sh", "file", "by", "adding", "necessary", "exports", "." ]
def _UpdateHadoopEnv(self): path = os.path.join(self._flags.hadoop_conf_dir, 'hadoop-env.sh') exports = 'export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:{0}'.format( self._flags.ghfs_jar_path) AddLineToFile(path, exports, self._flags.dry_run)
[ "def", "_UpdateHadoopEnv", "(", "self", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "_flags", ".", "hadoop_conf_dir", ",", "'hadoop-env.sh'", ")", "exports", "=", "'export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:{0}'", ".", "format", "(",...
Updates hadoop-env.sh file by adding necessary exports.
[ "Updates", "hadoop", "-", "env", ".", "sh", "file", "by", "adding", "necessary", "exports", "." ]
[ "\"\"\"Updates hadoop-env.sh file by adding necessary exports.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
38a0826ecd0b6dcc6f0f09576bc70b8a6be1fa6e
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands.py
[ "Apache-2.0" ]
Python
Run
null
def Run(self, unused_argv): """Main method invoked by appcommands.""" if self._flags.default_fs == 'gs': self._SetGsDefault() elif self._flags.default_fs == 'hdfs': self._SetHdfsDefault() self._UpdateCoreSiteXml()
Main method invoked by appcommands.
Main method invoked by appcommands.
[ "Main", "method", "invoked", "by", "appcommands", "." ]
def Run(self, unused_argv): if self._flags.default_fs == 'gs': self._SetGsDefault() elif self._flags.default_fs == 'hdfs': self._SetHdfsDefault() self._UpdateCoreSiteXml()
[ "def", "Run", "(", "self", ",", "unused_argv", ")", ":", "if", "self", ".", "_flags", ".", "default_fs", "==", "'gs'", ":", "self", ".", "_SetGsDefault", "(", ")", "elif", "self", ".", "_flags", ".", "default_fs", "==", "'hdfs'", ":", "self", ".", "_...
Main method invoked by appcommands.
[ "Main", "method", "invoked", "by", "appcommands", "." ]
[ "\"\"\"Main method invoked by appcommands.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "unused_argv", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "unused_argv", "type": null, "docstring": null, "docstring_tok...
38a0826ecd0b6dcc6f0f09576bc70b8a6be1fa6e
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands.py
[ "Apache-2.0" ]
Python
_SetGsDefault
null
def _SetGsDefault(self): """Helper method for dealing with gs-specific default-fs settings.""" if not self._flags.default_bucket: system_bucket = self._ExtractDefaultBucketFromSystemBucket() else: system_bucket = self._flags.default_bucket # Setting the flag from itself triggers newly added...
Helper method for dealing with gs-specific default-fs settings.
Helper method for dealing with gs-specific default-fs settings.
[ "Helper", "method", "for", "dealing", "with", "gs", "-", "specific", "default", "-", "fs", "settings", "." ]
def _SetGsDefault(self): if not self._flags.default_bucket: system_bucket = self._ExtractDefaultBucketFromSystemBucket() else: system_bucket = self._flags.default_bucket self._flags.default_bucket = system_bucket
[ "def", "_SetGsDefault", "(", "self", ")", ":", "if", "not", "self", ".", "_flags", ".", "default_bucket", ":", "system_bucket", "=", "self", ".", "_ExtractDefaultBucketFromSystemBucket", "(", ")", "else", ":", "system_bucket", "=", "self", ".", "_flags", ".", ...
Helper method for dealing with gs-specific default-fs settings.
[ "Helper", "method", "for", "dealing", "with", "gs", "-", "specific", "default", "-", "fs", "settings", "." ]
[ "\"\"\"Helper method for dealing with gs-specific default-fs settings.\"\"\"", "# Setting the flag from itself triggers newly added validators." ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
38a0826ecd0b6dcc6f0f09576bc70b8a6be1fa6e
zulily/bigdata-interop
tools/bdconfig/lib/google_hadoop/bdconfig_lib/config_commands.py
[ "Apache-2.0" ]
Python
_ExtractDefaultBucketFromSystemBucket
<not_specific>
def _ExtractDefaultBucketFromSystemBucket(self): """Tries falling back to system_bucket due to absence of default_bucket.""" logging.warn('--default_bucket not specified. ' 'Checking for system bucket in core-site.xml.') core_site_file_name = os.path.join( self._flags.hadoop_conf_di...
Tries falling back to system_bucket due to absence of default_bucket.
Tries falling back to system_bucket due to absence of default_bucket.
[ "Tries", "falling", "back", "to", "system_bucket", "due", "to", "absence", "of", "default_bucket", "." ]
def _ExtractDefaultBucketFromSystemBucket(self): logging.warn('--default_bucket not specified. ' 'Checking for system bucket in core-site.xml.') core_site_file_name = os.path.join( self._flags.hadoop_conf_dir, 'core-site.xml') conf = xml_configuration.Configuration.FromFile(core_sit...
[ "def", "_ExtractDefaultBucketFromSystemBucket", "(", "self", ")", ":", "logging", ".", "warn", "(", "'--default_bucket not specified. '", "'Checking for system bucket in core-site.xml.'", ")", "core_site_file_name", "=", "os", ".", "path", ".", "join", "(", "self", ".", ...
Tries falling back to system_bucket due to absence of default_bucket.
[ "Tries", "falling", "back", "to", "system_bucket", "due", "to", "absence", "of", "default_bucket", "." ]
[ "\"\"\"Tries falling back to system_bucket due to absence of default_bucket.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }