body
stringlengths
26
98.2k
body_hash
int64
-9,222,864,604,528,158,000
9,221,803,474B
docstring
stringlengths
1
16.8k
path
stringlengths
5
230
name
stringlengths
1
96
repository_name
stringlengths
7
89
lang
stringclasses
1 value
body_without_docstring
stringlengths
20
98.2k
def timestamp_local(value): 'Filter to convert given timestamp to local date/time.' try: return dt_util.as_local(dt_util.utc_from_timestamp(value)).strftime(DATE_STR_FORMAT) except (ValueError, TypeError): return value
371,278,893,903,197,440
Filter to convert given timestamp to local date/time.
homeassistant/helpers/template.py
timestamp_local
apapadopoulou/core
python
def timestamp_local(value): try: return dt_util.as_local(dt_util.utc_from_timestamp(value)).strftime(DATE_STR_FORMAT) except (ValueError, TypeError): return value
def timestamp_utc(value): 'Filter to convert given timestamp to UTC date/time.' try: return dt_util.utc_from_timestamp(value).strftime(DATE_STR_FORMAT) except (ValueError, TypeError): return value
-5,678,883,950,891,153,000
Filter to convert given timestamp to UTC date/time.
homeassistant/helpers/template.py
timestamp_utc
apapadopoulou/core
python
def timestamp_utc(value): try: return dt_util.utc_from_timestamp(value).strftime(DATE_STR_FORMAT) except (ValueError, TypeError): return value
def forgiving_as_timestamp(value): 'Try to convert value to timestamp.' try: return dt_util.as_timestamp(value) except (ValueError, TypeError): return None
3,174,292,803,847,005,700
Try to convert value to timestamp.
homeassistant/helpers/template.py
forgiving_as_timestamp
apapadopoulou/core
python
def forgiving_as_timestamp(value): try: return dt_util.as_timestamp(value) except (ValueError, TypeError): return None
def strptime(string, fmt): 'Parse a time string to datetime.' try: return datetime.strptime(string, fmt) except (ValueError, AttributeError, TypeError): return string
-3,118,304,228,443,340,300
Parse a time string to datetime.
homeassistant/helpers/template.py
strptime
apapadopoulou/core
python
def strptime(string, fmt): try: return datetime.strptime(string, fmt) except (ValueError, AttributeError, TypeError): return string
def fail_when_undefined(value): 'Filter to force a failure when the value is undefined.' if isinstance(value, jinja2.Undefined): value() return value
8,939,017,925,044,279,000
Filter to force a failure when the value is undefined.
homeassistant/helpers/template.py
fail_when_undefined
apapadopoulou/core
python
def fail_when_undefined(value): if isinstance(value, jinja2.Undefined): value() return value
def forgiving_float(value): 'Try to convert value to a float.' try: return float(value) except (ValueError, TypeError): return value
7,585,152,078,184,862,000
Try to convert value to a float.
homeassistant/helpers/template.py
forgiving_float
apapadopoulou/core
python
def forgiving_float(value): try: return float(value) except (ValueError, TypeError): return value
def regex_match(value, find='', ignorecase=False): 'Match value using regex.' if (not isinstance(value, str)): value = str(value) flags = (re.I if ignorecase else 0) return bool(re.match(find, value, flags))
6,072,483,120,086,773,000
Match value using regex.
homeassistant/helpers/template.py
regex_match
apapadopoulou/core
python
def regex_match(value, find=, ignorecase=False): if (not isinstance(value, str)): value = str(value) flags = (re.I if ignorecase else 0) return bool(re.match(find, value, flags))
def regex_replace(value='', find='', replace='', ignorecase=False): 'Replace using regex.' if (not isinstance(value, str)): value = str(value) flags = (re.I if ignorecase else 0) regex = re.compile(find, flags) return regex.sub(replace, value)
-7,940,056,905,785,757,000
Replace using regex.
homeassistant/helpers/template.py
regex_replace
apapadopoulou/core
python
def regex_replace(value=, find=, replace=, ignorecase=False): if (not isinstance(value, str)): value = str(value) flags = (re.I if ignorecase else 0) regex = re.compile(find, flags) return regex.sub(replace, value)
def regex_search(value, find='', ignorecase=False): 'Search using regex.' if (not isinstance(value, str)): value = str(value) flags = (re.I if ignorecase else 0) return bool(re.search(find, value, flags))
-7,090,118,636,444,232,000
Search using regex.
homeassistant/helpers/template.py
regex_search
apapadopoulou/core
python
def regex_search(value, find=, ignorecase=False): if (not isinstance(value, str)): value = str(value) flags = (re.I if ignorecase else 0) return bool(re.search(find, value, flags))
def regex_findall_index(value, find='', index=0, ignorecase=False): 'Find all matches using regex and then pick specific match index.' if (not isinstance(value, str)): value = str(value) flags = (re.I if ignorecase else 0) return re.findall(find, value, flags)[index]
4,697,311,776,560,366,000
Find all matches using regex and then pick specific match index.
homeassistant/helpers/template.py
regex_findall_index
apapadopoulou/core
python
def regex_findall_index(value, find=, index=0, ignorecase=False): if (not isinstance(value, str)): value = str(value) flags = (re.I if ignorecase else 0) return re.findall(find, value, flags)[index]
def bitwise_and(first_value, second_value): 'Perform a bitwise and operation.' return (first_value & second_value)
997,094,502,929,750,500
Perform a bitwise and operation.
homeassistant/helpers/template.py
bitwise_and
apapadopoulou/core
python
def bitwise_and(first_value, second_value): return (first_value & second_value)
def bitwise_or(first_value, second_value): 'Perform a bitwise or operation.' return (first_value | second_value)
7,219,139,196,977,614,000
Perform a bitwise or operation.
homeassistant/helpers/template.py
bitwise_or
apapadopoulou/core
python
def bitwise_or(first_value, second_value): return (first_value | second_value)
def base64_encode(value): 'Perform base64 encode.' return base64.b64encode(value.encode('utf-8')).decode('utf-8')
6,402,450,293,629,345,000
Perform base64 encode.
homeassistant/helpers/template.py
base64_encode
apapadopoulou/core
python
def base64_encode(value): return base64.b64encode(value.encode('utf-8')).decode('utf-8')
def base64_decode(value): 'Perform base64 denode.' return base64.b64decode(value).decode('utf-8')
-5,057,114,674,241,039,000
Perform base64 denode.
homeassistant/helpers/template.py
base64_decode
apapadopoulou/core
python
def base64_decode(value): return base64.b64decode(value).decode('utf-8')
def ordinal(value): 'Perform ordinal conversion.' return (str(value) + (list((['th', 'st', 'nd', 'rd'] + (['th'] * 6)))[(int(str(value)[(- 1)]) % 10)] if ((int(str(value)[(- 2):]) % 100) not in range(11, 14)) else 'th'))
523,003,202,717,955,200
Perform ordinal conversion.
homeassistant/helpers/template.py
ordinal
apapadopoulou/core
python
def ordinal(value): return (str(value) + (list((['th', 'st', 'nd', 'rd'] + (['th'] * 6)))[(int(str(value)[(- 1)]) % 10)] if ((int(str(value)[(- 2):]) % 100) not in range(11, 14)) else 'th'))
def from_json(value): 'Convert a JSON string to an object.' return json.loads(value)
-2,927,587,324,358,168,600
Convert a JSON string to an object.
homeassistant/helpers/template.py
from_json
apapadopoulou/core
python
def from_json(value): return json.loads(value)
def to_json(value): 'Convert an object to a JSON string.' return json.dumps(value)
-248,069,255,064,082,430
Convert an object to a JSON string.
homeassistant/helpers/template.py
to_json
apapadopoulou/core
python
def to_json(value): return json.dumps(value)
@contextfilter def random_every_time(context, values): "Choose a random value.\n\n Unlike Jinja's random filter,\n this is context-dependent to avoid caching the chosen value.\n " return random.choice(values)
-3,117,783,825,970,350,000
Choose a random value. Unlike Jinja's random filter, this is context-dependent to avoid caching the chosen value.
homeassistant/helpers/template.py
random_every_time
apapadopoulou/core
python
@contextfilter def random_every_time(context, values): "Choose a random value.\n\n Unlike Jinja's random filter,\n this is context-dependent to avoid caching the chosen value.\n " return random.choice(values)
def relative_time(value): '\n Take a datetime and return its "age" as a string.\n\n The age can be in second, minute, hour, day, month or year. Only the\n biggest unit is considered, e.g. if it\'s 2 days and 3 hours, "2 days" will\n be returned.\n Make sure date is not in the future, or else it will ...
-4,409,047,958,477,338,600
Take a datetime and return its "age" as a string. The age can be in second, minute, hour, day, month or year. Only the biggest unit is considered, e.g. if it's 2 days and 3 hours, "2 days" will be returned. Make sure date is not in the future, or else it will return None. If the input are not a datetime object the in...
homeassistant/helpers/template.py
relative_time
apapadopoulou/core
python
def relative_time(value): '\n Take a datetime and return its "age" as a string.\n\n The age can be in second, minute, hour, day, month or year. Only the\n biggest unit is considered, e.g. if it\'s 2 days and 3 hours, "2 days" will\n be returned.\n Make sure date is not in the future, or else it will ...
def urlencode(value): 'Urlencode dictionary and return as UTF-8 string.' return urllib_urlencode(value).encode('utf-8')
-5,544,043,678,155,911,000
Urlencode dictionary and return as UTF-8 string.
homeassistant/helpers/template.py
urlencode
apapadopoulou/core
python
def urlencode(value): return urllib_urlencode(value).encode('utf-8')
def _render_with_context(template_str: str, template: jinja2.Template, **kwargs: Any) -> str: 'Store template being rendered in a ContextVar to aid error handling.' template_cv.set(template_str) return template.render(**kwargs)
-7,469,460,773,156,476,000
Store template being rendered in a ContextVar to aid error handling.
homeassistant/helpers/template.py
_render_with_context
apapadopoulou/core
python
def _render_with_context(template_str: str, template: jinja2.Template, **kwargs: Any) -> str: template_cv.set(template_str) return template.render(**kwargs)
def __new__(cls, value: tuple, *, render_result: (str | None)=None) -> TupleWrapper: 'Create a new tuple class.' return super().__new__(cls, tuple(value))
4,402,851,517,117,680,000
Create a new tuple class.
homeassistant/helpers/template.py
__new__
apapadopoulou/core
python
def __new__(cls, value: tuple, *, render_result: (str | None)=None) -> TupleWrapper: return super().__new__(cls, tuple(value))
def __init__(self, value: tuple, *, render_result: (str | None)=None): 'Initialize a new tuple class.' self.render_result = render_result
-3,731,740,333,827,607,600
Initialize a new tuple class.
homeassistant/helpers/template.py
__init__
apapadopoulou/core
python
def __init__(self, value: tuple, *, render_result: (str | None)=None): self.render_result = render_result
def __str__(self) -> str: 'Return string representation.' if (self.render_result is None): return super().__str__() return self.render_result
4,386,185,566,864,812,500
Return string representation.
homeassistant/helpers/template.py
__str__
apapadopoulou/core
python
def __str__(self) -> str: if (self.render_result is None): return super().__str__() return self.render_result
def __init__(self, template): 'Initialise.' self.template = template self.filter_lifecycle = _true self.filter = _true self._result: (str | None) = None self.is_static = False self.exception: (TemplateError | None) = None self.all_states = False self.all_states_lifecycle = False ...
-4,230,071,943,378,648,000
Initialise.
homeassistant/helpers/template.py
__init__
apapadopoulou/core
python
def __init__(self, template): self.template = template self.filter_lifecycle = _true self.filter = _true self._result: (str | None) = None self.is_static = False self.exception: (TemplateError | None) = None self.all_states = False self.all_states_lifecycle = False self.domains ...
def __repr__(self) -> str: 'Representation of RenderInfo.' return f'<RenderInfo {self.template} all_states={self.all_states} all_states_lifecycle={self.all_states_lifecycle} domains={self.domains} domains_lifecycle={self.domains_lifecycle} entities={self.entities} rate_limit={self.rate_limit}> has_time={self.ha...
-2,179,960,865,395,067,100
Representation of RenderInfo.
homeassistant/helpers/template.py
__repr__
apapadopoulou/core
python
def __repr__(self) -> str: return f'<RenderInfo {self.template} all_states={self.all_states} all_states_lifecycle={self.all_states_lifecycle} domains={self.domains} domains_lifecycle={self.domains_lifecycle} entities={self.entities} rate_limit={self.rate_limit}> has_time={self.has_time}'
def _filter_domains_and_entities(self, entity_id: str) -> bool: 'Template should re-render if the entity state changes when we match specific domains or entities.' return ((split_entity_id(entity_id)[0] in self.domains) or (entity_id in self.entities))
2,927,773,560,140,866,600
Template should re-render if the entity state changes when we match specific domains or entities.
homeassistant/helpers/template.py
_filter_domains_and_entities
apapadopoulou/core
python
def _filter_domains_and_entities(self, entity_id: str) -> bool: return ((split_entity_id(entity_id)[0] in self.domains) or (entity_id in self.entities))
def _filter_entities(self, entity_id: str) -> bool: 'Template should re-render if the entity state changes when we match specific entities.' return (entity_id in self.entities)
5,553,730,494,122,894,000
Template should re-render if the entity state changes when we match specific entities.
homeassistant/helpers/template.py
_filter_entities
apapadopoulou/core
python
def _filter_entities(self, entity_id: str) -> bool: return (entity_id in self.entities)
def _filter_lifecycle_domains(self, entity_id: str) -> bool: 'Template should re-render if the entity is added or removed with domains watched.' return (split_entity_id(entity_id)[0] in self.domains_lifecycle)
-277,101,688,541,714,530
Template should re-render if the entity is added or removed with domains watched.
homeassistant/helpers/template.py
_filter_lifecycle_domains
apapadopoulou/core
python
def _filter_lifecycle_domains(self, entity_id: str) -> bool: return (split_entity_id(entity_id)[0] in self.domains_lifecycle)
def result(self) -> str: 'Results of the template computation.' if (self.exception is not None): raise self.exception return cast(str, self._result)
-1,629,169,692,258,794,500
Results of the template computation.
homeassistant/helpers/template.py
result
apapadopoulou/core
python
def result(self) -> str: if (self.exception is not None): raise self.exception return cast(str, self._result)
def __init__(self, template, hass=None): 'Instantiate a template.' if (not isinstance(template, str)): raise TypeError('Expected template to be a string') self.template: str = template.strip() self._compiled_code = None self._compiled: (jinja2.Template | None) = None self.hass = hass ...
5,451,396,353,592,941,000
Instantiate a template.
homeassistant/helpers/template.py
__init__
apapadopoulou/core
python
def __init__(self, template, hass=None): if (not isinstance(template, str)): raise TypeError('Expected template to be a string') self.template: str = template.strip() self._compiled_code = None self._compiled: (jinja2.Template | None) = None self.hass = hass self.is_static = (not is...
def ensure_valid(self) -> None: 'Return if template is valid.' if (self.is_static or (self._compiled_code is not None)): return try: self._compiled_code = self._env.compile(self.template) except jinja2.TemplateError as err: raise TemplateError(err) from err
-8,108,559,155,988,028,000
Return if template is valid.
homeassistant/helpers/template.py
ensure_valid
apapadopoulou/core
python
def ensure_valid(self) -> None: if (self.is_static or (self._compiled_code is not None)): return try: self._compiled_code = self._env.compile(self.template) except jinja2.TemplateError as err: raise TemplateError(err) from err
def render(self, variables: TemplateVarsType=None, parse_result: bool=True, limited: bool=False, **kwargs: Any) -> Any: 'Render given template.\n\n If limited is True, the template is not allowed to access any function or filter depending on hass or the state machine.\n ' if self.is_static: ...
6,037,249,093,941,974,000
Render given template. If limited is True, the template is not allowed to access any function or filter depending on hass or the state machine.
homeassistant/helpers/template.py
render
apapadopoulou/core
python
def render(self, variables: TemplateVarsType=None, parse_result: bool=True, limited: bool=False, **kwargs: Any) -> Any: 'Render given template.\n\n If limited is True, the template is not allowed to access any function or filter depending on hass or the state machine.\n ' if self.is_static: ...
@callback def async_render(self, variables: TemplateVarsType=None, parse_result: bool=True, limited: bool=False, strict: bool=False, **kwargs: Any) -> Any: 'Render given template.\n\n This method must be run in the event loop.\n\n If limited is True, the template is not allowed to access any function ...
-1,166,353,257,559,217,200
Render given template. This method must be run in the event loop. If limited is True, the template is not allowed to access any function or filter depending on hass or the state machine.
homeassistant/helpers/template.py
async_render
apapadopoulou/core
python
@callback def async_render(self, variables: TemplateVarsType=None, parse_result: bool=True, limited: bool=False, strict: bool=False, **kwargs: Any) -> Any: 'Render given template.\n\n This method must be run in the event loop.\n\n If limited is True, the template is not allowed to access any function ...
def _parse_result(self, render_result: str) -> Any: 'Parse the result.' try: result = literal_eval(render_result) if (type(result) in RESULT_WRAPPERS): result = RESULT_WRAPPERS[type(result)](result, render_result=render_result) if ((not isinstance(result, (str, complex))) and...
-21,961,819,275,808,824
Parse the result.
homeassistant/helpers/template.py
_parse_result
apapadopoulou/core
python
def _parse_result(self, render_result: str) -> Any: try: result = literal_eval(render_result) if (type(result) in RESULT_WRAPPERS): result = RESULT_WRAPPERS[type(result)](result, render_result=render_result) if ((not isinstance(result, (str, complex))) and ((not isinstance(r...
async def async_render_will_timeout(self, timeout: float, variables: TemplateVarsType=None, strict: bool=False, **kwargs: Any) -> bool: 'Check to see if rendering a template will timeout during render.\n\n This is intended to check for expensive templates\n that will make the system unstable. The tem...
-7,899,870,130,467,297,000
Check to see if rendering a template will timeout during render. This is intended to check for expensive templates that will make the system unstable. The template is rendered in the executor to ensure it does not tie up the event loop. This function is not a security control and is only intended to be used as a saf...
homeassistant/helpers/template.py
async_render_will_timeout
apapadopoulou/core
python
async def async_render_will_timeout(self, timeout: float, variables: TemplateVarsType=None, strict: bool=False, **kwargs: Any) -> bool: 'Check to see if rendering a template will timeout during render.\n\n This is intended to check for expensive templates\n that will make the system unstable. The tem...
@callback def async_render_to_info(self, variables: TemplateVarsType=None, strict: bool=False, **kwargs: Any) -> RenderInfo: 'Render the template and collect an entity filter.' assert (self.hass and (_RENDER_INFO not in self.hass.data)) render_info = RenderInfo(self) if self.is_static: render_in...
-4,240,149,354,314,797,000
Render the template and collect an entity filter.
homeassistant/helpers/template.py
async_render_to_info
apapadopoulou/core
python
@callback def async_render_to_info(self, variables: TemplateVarsType=None, strict: bool=False, **kwargs: Any) -> RenderInfo: assert (self.hass and (_RENDER_INFO not in self.hass.data)) render_info = RenderInfo(self) if self.is_static: render_info._result = self.template.strip() render_i...
def render_with_possible_json_value(self, value, error_value=_SENTINEL): 'Render template with value exposed.\n\n If valid JSON will expose value_json too.\n ' if self.is_static: return self.template return run_callback_threadsafe(self.hass.loop, self.async_render_with_possible_json_va...
6,334,468,558,806,341,000
Render template with value exposed. If valid JSON will expose value_json too.
homeassistant/helpers/template.py
render_with_possible_json_value
apapadopoulou/core
python
def render_with_possible_json_value(self, value, error_value=_SENTINEL): 'Render template with value exposed.\n\n If valid JSON will expose value_json too.\n ' if self.is_static: return self.template return run_callback_threadsafe(self.hass.loop, self.async_render_with_possible_json_va...
@callback def async_render_with_possible_json_value(self, value, error_value=_SENTINEL, variables=None): 'Render template with value exposed.\n\n If valid JSON will expose value_json too.\n\n This method must be run in the event loop.\n ' if self.is_static: return self.template ...
-4,429,962,319,649,829,000
Render template with value exposed. If valid JSON will expose value_json too. This method must be run in the event loop.
homeassistant/helpers/template.py
async_render_with_possible_json_value
apapadopoulou/core
python
@callback def async_render_with_possible_json_value(self, value, error_value=_SENTINEL, variables=None): 'Render template with value exposed.\n\n If valid JSON will expose value_json too.\n\n This method must be run in the event loop.\n ' if self.is_static: return self.template ...
def _ensure_compiled(self, limited: bool=False, strict: bool=False) -> jinja2.Template: 'Bind a template to a specific hass instance.' self.ensure_valid() assert (self.hass is not None), 'hass variable not set on template' assert ((self._limited is None) or (self._limited == limited)), "can't change bet...
5,344,520,617,307,532,000
Bind a template to a specific hass instance.
homeassistant/helpers/template.py
_ensure_compiled
apapadopoulou/core
python
def _ensure_compiled(self, limited: bool=False, strict: bool=False) -> jinja2.Template: self.ensure_valid() assert (self.hass is not None), 'hass variable not set on template' assert ((self._limited is None) or (self._limited == limited)), "can't change between limited and non limited template" ass...
def __eq__(self, other): 'Compare template with another.' return ((self.__class__ == other.__class__) and (self.template == other.template) and (self.hass == other.hass))
6,628,471,924,393,962,000
Compare template with another.
homeassistant/helpers/template.py
__eq__
apapadopoulou/core
python
def __eq__(self, other): return ((self.__class__ == other.__class__) and (self.template == other.template) and (self.hass == other.hass))
def __hash__(self) -> int: 'Hash code for template.' return hash(self.template)
3,837,882,927,254,413,000
Hash code for template.
homeassistant/helpers/template.py
__hash__
apapadopoulou/core
python
def __hash__(self) -> int: return hash(self.template)
def __repr__(self) -> str: 'Representation of Template.' return (('Template("' + self.template) + '")')
8,466,370,594,914,990,000
Representation of Template.
homeassistant/helpers/template.py
__repr__
apapadopoulou/core
python
def __repr__(self) -> str: return (('Template("' + self.template) + '")')
def __init__(self, hass: HomeAssistant) -> None: 'Initialize all states.' self._hass = hass
-2,188,343,182,347,853,300
Initialize all states.
homeassistant/helpers/template.py
__init__
apapadopoulou/core
python
def __init__(self, hass: HomeAssistant) -> None: self._hass = hass
def __getattr__(self, name): 'Return the domain state.' if ('.' in name): return _get_state_if_valid(self._hass, name) if (name in _RESERVED_NAMES): return None if (not valid_entity_id(f'{name}.entity')): raise TemplateError(f"Invalid domain name '{name}'") return DomainState...
-2,045,282,052,237,543,400
Return the domain state.
homeassistant/helpers/template.py
__getattr__
apapadopoulou/core
python
def __getattr__(self, name): if ('.' in name): return _get_state_if_valid(self._hass, name) if (name in _RESERVED_NAMES): return None if (not valid_entity_id(f'{name}.entity')): raise TemplateError(f"Invalid domain name '{name}'") return DomainStates(self._hass, name)
def __iter__(self): 'Return all states.' self._collect_all() return _state_generator(self._hass, None)
-334,294,168,833,212,740
Return all states.
homeassistant/helpers/template.py
__iter__
apapadopoulou/core
python
def __iter__(self): self._collect_all() return _state_generator(self._hass, None)
def __len__(self) -> int: 'Return number of states.' self._collect_all_lifecycle() return self._hass.states.async_entity_ids_count()
8,146,078,219,081,897,000
Return number of states.
homeassistant/helpers/template.py
__len__
apapadopoulou/core
python
def __len__(self) -> int: self._collect_all_lifecycle() return self._hass.states.async_entity_ids_count()
def __call__(self, entity_id): 'Return the states.' state = _get_state(self._hass, entity_id) return (STATE_UNKNOWN if (state is None) else state.state)
-1,906,464,392,731,029,200
Return the states.
homeassistant/helpers/template.py
__call__
apapadopoulou/core
python
def __call__(self, entity_id): state = _get_state(self._hass, entity_id) return (STATE_UNKNOWN if (state is None) else state.state)
def __repr__(self) -> str: 'Representation of All States.' return '<template AllStates>'
-3,864,778,551,672,276,000
Representation of All States.
homeassistant/helpers/template.py
__repr__
apapadopoulou/core
python
def __repr__(self) -> str: return '<template AllStates>'
def __init__(self, hass: HomeAssistant, domain: str) -> None: 'Initialize the domain states.' self._hass = hass self._domain = domain
5,411,538,624,410,494,000
Initialize the domain states.
homeassistant/helpers/template.py
__init__
apapadopoulou/core
python
def __init__(self, hass: HomeAssistant, domain: str) -> None: self._hass = hass self._domain = domain
def __getattr__(self, name): 'Return the states.' return _get_state_if_valid(self._hass, f'{self._domain}.{name}')
2,082,216,866,680,315,000
Return the states.
homeassistant/helpers/template.py
__getattr__
apapadopoulou/core
python
def __getattr__(self, name): return _get_state_if_valid(self._hass, f'{self._domain}.{name}')
def __iter__(self): 'Return the iteration over all the states.' self._collect_domain() return _state_generator(self._hass, self._domain)
6,838,333,310,154,040,000
Return the iteration over all the states.
homeassistant/helpers/template.py
__iter__
apapadopoulou/core
python
def __iter__(self): self._collect_domain() return _state_generator(self._hass, self._domain)
def __len__(self) -> int: 'Return number of states.' self._collect_domain_lifecycle() return self._hass.states.async_entity_ids_count(self._domain)
-736,870,181,358,220,700
Return number of states.
homeassistant/helpers/template.py
__len__
apapadopoulou/core
python
def __len__(self) -> int: self._collect_domain_lifecycle() return self._hass.states.async_entity_ids_count(self._domain)
def __repr__(self) -> str: 'Representation of Domain States.' return f"<template DomainStates('{self._domain}')>"
4,759,772,124,110,742,000
Representation of Domain States.
homeassistant/helpers/template.py
__repr__
apapadopoulou/core
python
def __repr__(self) -> str: return f"<template DomainStates('{self._domain}')>"
def __init__(self, hass: HomeAssistant, state: State, collect: bool=True) -> None: 'Initialize template state.' self._hass = hass self._state = state self._collect = collect
2,555,834,302,958,987,000
Initialize template state.
homeassistant/helpers/template.py
__init__
apapadopoulou/core
python
def __init__(self, hass: HomeAssistant, state: State, collect: bool=True) -> None: self._hass = hass self._state = state self._collect = collect
def __getitem__(self, item): 'Return a property as an attribute for jinja.' if (item in _COLLECTABLE_STATE_ATTRIBUTES): if (self._collect and (_RENDER_INFO in self._hass.data)): self._hass.data[_RENDER_INFO].entities.add(self._state.entity_id) return getattr(self._state, item) if...
5,675,116,919,093,509,000
Return a property as an attribute for jinja.
homeassistant/helpers/template.py
__getitem__
apapadopoulou/core
python
def __getitem__(self, item): if (item in _COLLECTABLE_STATE_ATTRIBUTES): if (self._collect and (_RENDER_INFO in self._hass.data)): self._hass.data[_RENDER_INFO].entities.add(self._state.entity_id) return getattr(self._state, item) if (item == 'entity_id'): return self._s...
@property def entity_id(self): 'Wrap State.entity_id.\n\n Intentionally does not collect state\n ' return self._state.entity_id
-1,689,102,585,110,755,000
Wrap State.entity_id. Intentionally does not collect state
homeassistant/helpers/template.py
entity_id
apapadopoulou/core
python
@property def entity_id(self): 'Wrap State.entity_id.\n\n Intentionally does not collect state\n ' return self._state.entity_id
@property def state(self): 'Wrap State.state.' self._collect_state() return self._state.state
-3,503,656,440,696,153,600
Wrap State.state.
homeassistant/helpers/template.py
state
apapadopoulou/core
python
@property def state(self): self._collect_state() return self._state.state
@property def attributes(self): 'Wrap State.attributes.' self._collect_state() return self._state.attributes
-4,926,409,838,260,996,000
Wrap State.attributes.
homeassistant/helpers/template.py
attributes
apapadopoulou/core
python
@property def attributes(self): self._collect_state() return self._state.attributes
@property def last_changed(self): 'Wrap State.last_changed.' self._collect_state() return self._state.last_changed
4,785,937,332,385,225,000
Wrap State.last_changed.
homeassistant/helpers/template.py
last_changed
apapadopoulou/core
python
@property def last_changed(self): self._collect_state() return self._state.last_changed
@property def last_updated(self): 'Wrap State.last_updated.' self._collect_state() return self._state.last_updated
-6,958,189,816,510,916,000
Wrap State.last_updated.
homeassistant/helpers/template.py
last_updated
apapadopoulou/core
python
@property def last_updated(self): self._collect_state() return self._state.last_updated
@property def context(self): 'Wrap State.context.' self._collect_state() return self._state.context
-4,253,427,782,051,221,500
Wrap State.context.
homeassistant/helpers/template.py
context
apapadopoulou/core
python
@property def context(self): self._collect_state() return self._state.context
@property def domain(self): 'Wrap State.domain.' self._collect_state() return self._state.domain
-224,251,247,949,758,750
Wrap State.domain.
homeassistant/helpers/template.py
domain
apapadopoulou/core
python
@property def domain(self): self._collect_state() return self._state.domain
@property def object_id(self): 'Wrap State.object_id.' self._collect_state() return self._state.object_id
-7,908,503,264,930,364,000
Wrap State.object_id.
homeassistant/helpers/template.py
object_id
apapadopoulou/core
python
@property def object_id(self): self._collect_state() return self._state.object_id
@property def name(self): 'Wrap State.name.' self._collect_state() return self._state.name
6,087,567,154,593,101,000
Wrap State.name.
homeassistant/helpers/template.py
name
apapadopoulou/core
python
@property def name(self): self._collect_state() return self._state.name
@property def state_with_unit(self) -> str: 'Return the state concatenated with the unit if available.' self._collect_state() unit = self._state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) return (f'{self._state.state} {unit}' if unit else self._state.state)
-5,291,269,640,585,265,000
Return the state concatenated with the unit if available.
homeassistant/helpers/template.py
state_with_unit
apapadopoulou/core
python
@property def state_with_unit(self) -> str: self._collect_state() unit = self._state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) return (f'{self._state.state} {unit}' if unit else self._state.state)
def __eq__(self, other: Any) -> bool: 'Ensure we collect on equality check.' self._collect_state() return self._state.__eq__(other)
-5,653,343,425,434,481,000
Ensure we collect on equality check.
homeassistant/helpers/template.py
__eq__
apapadopoulou/core
python
def __eq__(self, other: Any) -> bool: self._collect_state() return self._state.__eq__(other)
def __repr__(self) -> str: 'Representation of Template State.' return f'<template TemplateState({self._state.__repr__()})>'
-2,292,285,407,276,171,800
Representation of Template State.
homeassistant/helpers/template.py
__repr__
apapadopoulou/core
python
def __repr__(self) -> str: return f'<template TemplateState({self._state.__repr__()})>'
def __str__(self): 'Log undefined __str___.' self._log_message() return super().__str__()
5,647,287,756,732,597,000
Log undefined __str___.
homeassistant/helpers/template.py
__str__
apapadopoulou/core
python
def __str__(self): self._log_message() return super().__str__()
def __iter__(self): 'Log undefined __iter___.' self._log_message() return super().__iter__()
8,365,122,814,951,870,000
Log undefined __iter___.
homeassistant/helpers/template.py
__iter__
apapadopoulou/core
python
def __iter__(self): self._log_message() return super().__iter__()
def __bool__(self): 'Log undefined __bool___.' self._log_message() return super().__bool__()
-5,810,084,362,042,255,000
Log undefined __bool___.
homeassistant/helpers/template.py
__bool__
apapadopoulou/core
python
def __bool__(self): self._log_message() return super().__bool__()
def __init__(self, hass, limited=False, strict=False): 'Initialise template environment.' if (not strict): undefined = LoggingUndefined else: undefined = jinja2.StrictUndefined super().__init__(undefined=undefined) self.hass = hass self.template_cache = weakref.WeakValueDictionar...
-6,775,535,442,289,782,000
Initialise template environment.
homeassistant/helpers/template.py
__init__
apapadopoulou/core
python
def __init__(self, hass, limited=False, strict=False): if (not strict): undefined = LoggingUndefined else: undefined = jinja2.StrictUndefined super().__init__(undefined=undefined) self.hass = hass self.template_cache = weakref.WeakValueDictionary() self.filters['round'] = fo...
def is_safe_callable(self, obj): 'Test if callback is safe.' return (isinstance(obj, AllStates) or super().is_safe_callable(obj))
-5,997,129,528,551,347,000
Test if callback is safe.
homeassistant/helpers/template.py
is_safe_callable
apapadopoulou/core
python
def is_safe_callable(self, obj): return (isinstance(obj, AllStates) or super().is_safe_callable(obj))
def is_safe_attribute(self, obj, attr, value): 'Test if attribute is safe.' if isinstance(obj, (AllStates, DomainStates, TemplateState)): return (attr[0] != '_') if isinstance(obj, Namespace): return True return super().is_safe_attribute(obj, attr, value)
-749,355,223,477,753,700
Test if attribute is safe.
homeassistant/helpers/template.py
is_safe_attribute
apapadopoulou/core
python
def is_safe_attribute(self, obj, attr, value): if isinstance(obj, (AllStates, DomainStates, TemplateState)): return (attr[0] != '_') if isinstance(obj, Namespace): return True return super().is_safe_attribute(obj, attr, value)
def compile(self, source, name=None, filename=None, raw=False, defer_init=False): 'Compile the template.' if ((name is not None) or (filename is not None) or (raw is not False) or (defer_init is not False)): return super().compile(source, name, filename, raw, defer_init) cached = self.template_cache...
-5,019,116,213,764,939,000
Compile the template.
homeassistant/helpers/template.py
compile
apapadopoulou/core
python
def compile(self, source, name=None, filename=None, raw=False, defer_init=False): if ((name is not None) or (filename is not None) or (raw is not False) or (defer_init is not False)): return super().compile(source, name, filename, raw, defer_init) cached = self.template_cache.get(source) if (ca...
def hassfunction(func): 'Wrap function that depend on hass.' @wraps(func) def wrapper(*args, **kwargs): return func(hass, *args[1:], **kwargs) return contextfunction(wrapper)
6,289,396,270,161,430,000
Wrap function that depend on hass.
homeassistant/helpers/template.py
hassfunction
apapadopoulou/core
python
def hassfunction(func): @wraps(func) def wrapper(*args, **kwargs): return func(hass, *args[1:], **kwargs) return contextfunction(wrapper)
def asdict(data_class) -> Dict: 'Type coerce items for easy serialization' data = asdict_(data_class) out = {} for (k, v) in data.items(): if isinstance(v, tuple): out[k] = list(v) elif isinstance(v, np.ndarray): out[k] = v.tolist() else: out[k...
-4,754,381,639,125,044,000
Type coerce items for easy serialization
src/covid_model_seiir_pipeline/lib/utilities.py
asdict
ihmeuw/covid-model-seiir-pipeline
python
def asdict(data_class) -> Dict: data = asdict_(data_class) out = {} for (k, v) in data.items(): if isinstance(v, tuple): out[k] = list(v) elif isinstance(v, np.ndarray): out[k] = v.tolist() else: out[k] = v return out
@classmethod def from_path(cls, specification_path: Union[(str, Path)]) -> Specification: 'Builds the specification from a file path.' spec_dict = cls._load(specification_path) return cls.from_dict(spec_dict)
7,862,137,455,821,725,000
Builds the specification from a file path.
src/covid_model_seiir_pipeline/lib/utilities.py
from_path
ihmeuw/covid-model-seiir-pipeline
python
@classmethod def from_path(cls, specification_path: Union[(str, Path)]) -> Specification: spec_dict = cls._load(specification_path) return cls.from_dict(spec_dict)
@classmethod def from_dict(cls, spec_dict: Dict) -> Specification: 'Builds the specification from a dictionary.' args = cls.parse_spec_dict(spec_dict) return cls(*args)
-3,883,012,938,789,640,000
Builds the specification from a dictionary.
src/covid_model_seiir_pipeline/lib/utilities.py
from_dict
ihmeuw/covid-model-seiir-pipeline
python
@classmethod def from_dict(cls, spec_dict: Dict) -> Specification: args = cls.parse_spec_dict(spec_dict) return cls(*args)
@classmethod @abc.abstractmethod def parse_spec_dict(cls, specification: Dict) -> Tuple: 'Parses a dict representation of the specification into init args.' raise NotImplementedError
9,132,255,730,173,572,000
Parses a dict representation of the specification into init args.
src/covid_model_seiir_pipeline/lib/utilities.py
parse_spec_dict
ihmeuw/covid-model-seiir-pipeline
python
@classmethod @abc.abstractmethod def parse_spec_dict(cls, specification: Dict) -> Tuple: raise NotImplementedError
@abc.abstractmethod def to_dict(self) -> Dict: 'Coerce the specification to a dict.' raise NotImplementedError
-3,401,670,680,929,234,000
Coerce the specification to a dict.
src/covid_model_seiir_pipeline/lib/utilities.py
to_dict
ihmeuw/covid-model-seiir-pipeline
python
@abc.abstractmethod def to_dict(self) -> Dict: raise NotImplementedError
def dump(self, path: Union[(str, Path)]) -> None: 'Writes this specification to a file.' data = self.to_dict() self._dump(data, path)
-5,803,425,927,007,623,000
Writes this specification to a file.
src/covid_model_seiir_pipeline/lib/utilities.py
dump
ihmeuw/covid-model-seiir-pipeline
python
def dump(self, path: Union[(str, Path)]) -> None: data = self.to_dict() self._dump(data, path)
def dist_weighted_sampling(labels, embeddings, high_var_threshold=0.5, nonzero_loss_threshold=1.4, neg_multiplier=1): '\n Distance weighted sampling.\n # References\n - [sampling matters in deep embedding learning]\n (https://arxiv.org/abs/1706.07567)\n\n # Arguments:\n labels: 1-D t...
6,369,874,639,233,533,000
Distance weighted sampling. # References - [sampling matters in deep embedding learning] (https://arxiv.org/abs/1706.07567) # Arguments: labels: 1-D tf.int32 `Tensor` with shape [batch_size] of multi-class integer labels. embeddings: 2-D float `Tensor` of embedding vectors. Embeddings should ...
loss.py
dist_weighted_sampling
miroozyx/Magin-Based-loss
python
def dist_weighted_sampling(labels, embeddings, high_var_threshold=0.5, nonzero_loss_threshold=1.4, neg_multiplier=1): '\n Distance weighted sampling.\n # References\n - [sampling matters in deep embedding learning]\n (https://arxiv.org/abs/1706.07567)\n\n # Arguments:\n labels: 1-D t...
def margin_based_loss(labels, embeddings, beta_in=1.0, margin=0.2, nu=0.0, high_var_threshold=0.5, nonzero_loss_threshold=1.4, neg_multiplier=1): '\n Computes the margin base loss.\n # References\n - [sampling matters in deep embedding learning]\n (https://arxiv.org/abs/1706.07567)\n\n Args...
-2,451,100,185,096,866,300
Computes the margin base loss. # References - [sampling matters in deep embedding learning] (https://arxiv.org/abs/1706.07567) Args: labels: 1-D. tf.int32 `Tensor` with shape [batch_size] of multi-class integer labels. embeddings: 2-D float `Tensor` of embedding vectors. Embeddings should be l2 norma...
loss.py
margin_based_loss
miroozyx/Magin-Based-loss
python
def margin_based_loss(labels, embeddings, beta_in=1.0, margin=0.2, nu=0.0, high_var_threshold=0.5, nonzero_loss_threshold=1.4, neg_multiplier=1): '\n Computes the margin base loss.\n # References\n - [sampling matters in deep embedding learning]\n (https://arxiv.org/abs/1706.07567)\n\n Args...
def distance_weighted_triplet_loss(labels, embeddings, margin=1.0, squared=False, high_var_threshold=0.5, nonzero_loss_threshold=1.4, neg_multiplier=1): 'distance weighted sampling + triplet loss\n Args:\n labels: 1-D. tf.int32 `Tensor` with shape [batch_size] of multi-class integer labels.\n embed...
4,112,237,657,098,011,600
distance weighted sampling + triplet loss Args: labels: 1-D. tf.int32 `Tensor` with shape [batch_size] of multi-class integer labels. embeddings: 2-D float `Tensor` of embedding vectors. Embeddings should be l2 normalized. margin: Float, margin term in the loss function. squared: Boolean, whether or not...
loss.py
distance_weighted_triplet_loss
miroozyx/Magin-Based-loss
python
def distance_weighted_triplet_loss(labels, embeddings, margin=1.0, squared=False, high_var_threshold=0.5, nonzero_loss_threshold=1.4, neg_multiplier=1): 'distance weighted sampling + triplet loss\n Args:\n labels: 1-D. tf.int32 `Tensor` with shape [batch_size] of multi-class integer labels.\n embed...
@property def example(self): 'Get and cache an example batch of `inputs, labels` for plotting.' result = getattr(self, '_example', None) if (result is None): result = next(iter(self.train)) self._example = result return result
-4,770,954,288,945,048,000
Get and cache an example batch of `inputs, labels` for plotting.
src/data_cleaning/window_generator.py
example
EFR-AI/AIBSIF
python
@property def example(self): result = getattr(self, '_example', None) if (result is None): result = next(iter(self.train)) self._example = result return result
def calculate_score_for_each_mood(self): '\n 利用谷歌nima模型对图片进行评分\n paper: https://arxiv.org/abs/1709.05424\n pytorch model: https://github.com/truskovskiyk/nima.pytorch.git\n\n 计算每条说说中图片的平均分\n 对于没有图片的按均值进行填充\n :return:\n ' self.IMAGE_SCORE_FILE_PATH = '/Users/maici...
3,560,696,306,482,841,000
利用谷歌nima模型对图片进行评分 paper: https://arxiv.org/abs/1709.05424 pytorch model: https://github.com/truskovskiyk/nima.pytorch.git 计算每条说说中图片的平均分 对于没有图片的按均值进行填充 :return:
src/analysis/TrainMood.py
calculate_score_for_each_mood
343695222/QQZoneMood
python
def calculate_score_for_each_mood(self): '\n 利用谷歌nima模型对图片进行评分\n paper: https://arxiv.org/abs/1709.05424\n pytorch model: https://github.com/truskovskiyk/nima.pytorch.git\n\n 计算每条说说中图片的平均分\n 对于没有图片的按均值进行填充\n :return:\n ' self.IMAGE_SCORE_FILE_PATH = '/Users/maici...
def calculate_send_time(self): '\n 计算每条说说的发送时间\n 分为以下五种类型:\n 0.午夜:0点-4点\n 1.凌晨:4点-8点\n 2.上午:8点-12点\n 3.下午:12点-16点\n 4.傍晚:16点-20点\n 5.晚上:20点-24点\n :return:\n ' day_begin_time = self.mood_data_df['time'].apply((lambda x: get_mktime2(x))) da...
2,151,849,557,618,110,000
计算每条说说的发送时间 分为以下五种类型: 0.午夜:0点-4点 1.凌晨:4点-8点 2.上午:8点-12点 3.下午:12点-16点 4.傍晚:16点-20点 5.晚上:20点-24点 :return:
src/analysis/TrainMood.py
calculate_send_time
343695222/QQZoneMood
python
def calculate_send_time(self): '\n 计算每条说说的发送时间\n 分为以下五种类型:\n 0.午夜:0点-4点\n 1.凌晨:4点-8点\n 2.上午:8点-12点\n 3.下午:12点-16点\n 4.傍晚:16点-20点\n 5.晚上:20点-24点\n :return:\n ' day_begin_time = self.mood_data_df['time'].apply((lambda x: get_mktime2(x))) da...
def export_classification_data(self): '\n 导出待分类待的数据\n :return:\n ' data = pd.read_csv(self.RE_DO_SENTIMENT_FILE_NAME) data_df = data[['content']] data_df['Y'] = '旅游与运动' data_df.fillna('空', inplace=True) columns = ['Y', 'content'] data_df = data_df.ix[:, columns] prin...
-7,152,024,162,251,435,000
导出待分类待的数据 :return:
src/analysis/TrainMood.py
export_classification_data
343695222/QQZoneMood
python
def export_classification_data(self): '\n 导出待分类待的数据\n :return:\n ' data = pd.read_csv(self.RE_DO_SENTIMENT_FILE_NAME) data_df = data[['content']] data_df['Y'] = '旅游与运动' data_df.fillna('空', inplace=True) columns = ['Y', 'content'] data_df = data_df.ix[:, columns] prin...
def get_nodes(self, request): '\n This method is used to build the menu tree.\n ' nodes = [] docsmap_file = os.path.join(settings.SPHINX_DOCS_ROOT, 'docsmap.json') if (not os.path.exists(docsmap_file)): return nodes with io.open(docsmap_file) as fh: docs_map = json.load...
-63,404,229,865,632,920
This method is used to build the menu tree.
cmsplugin_cascade/sphinx/cms_menus.py
get_nodes
beeduino/djangocms-cascade
python
def get_nodes(self, request): '\n \n ' nodes = [] docsmap_file = os.path.join(settings.SPHINX_DOCS_ROOT, 'docsmap.json') if (not os.path.exists(docsmap_file)): return nodes with io.open(docsmap_file) as fh: docs_map = json.load(fh, encoding='utf-8') for (counter, it...
def Crc8(crc, data): 'Update CRC8 value.' for v in data: crc = (((crc << 4) & 255) ^ CRC_TABLE[((crc >> 4) ^ (v >> 4))]) crc = (((crc << 4) & 255) ^ CRC_TABLE[((crc >> 4) ^ (v & 15))]) return (crc ^ 85)
1,831,462,198,220,214,000
Update CRC8 value.
chip/mchp/util/pack_ec.py
Crc8
DHowett/fw-ectool
python
def Crc8(crc, data): for v in data: crc = (((crc << 4) & 255) ^ CRC_TABLE[((crc >> 4) ^ (v >> 4))]) crc = (((crc << 4) & 255) ^ CRC_TABLE[((crc >> 4) ^ (v & 15))]) return (crc ^ 85)
def GetEntryPoint(payload_file): 'Read entry point from payload EC image.' with open(payload_file, 'rb') as f: f.seek(4) s = f.read(4) return struct.unpack('<I', s)[0]
6,129,148,495,595,156,000
Read entry point from payload EC image.
chip/mchp/util/pack_ec.py
GetEntryPoint
DHowett/fw-ectool
python
def GetEntryPoint(payload_file): with open(payload_file, 'rb') as f: f.seek(4) s = f.read(4) return struct.unpack('<I', s)[0]
def GetPayloadFromOffset(payload_file, offset): 'Read payload and pad it to 64-byte aligned.' with open(payload_file, 'rb') as f: f.seek(offset) payload = bytearray(f.read()) rem_len = (len(payload) % 64) if rem_len: payload += (b'\x00' * (64 - rem_len)) return payload
3,025,281,954,015,257,600
Read payload and pad it to 64-byte aligned.
chip/mchp/util/pack_ec.py
GetPayloadFromOffset
DHowett/fw-ectool
python
def GetPayloadFromOffset(payload_file, offset): with open(payload_file, 'rb') as f: f.seek(offset) payload = bytearray(f.read()) rem_len = (len(payload) % 64) if rem_len: payload += (b'\x00' * (64 - rem_len)) return payload
def GetPayload(payload_file): 'Read payload and pad it to 64-byte aligned.' return GetPayloadFromOffset(payload_file, 0)
3,972,005,411,253,790,000
Read payload and pad it to 64-byte aligned.
chip/mchp/util/pack_ec.py
GetPayload
DHowett/fw-ectool
python
def GetPayload(payload_file): return GetPayloadFromOffset(payload_file, 0)
def GetPublicKey(pem_file): 'Extract public exponent and modulus from PEM file.' result = subprocess.run(['openssl', 'rsa', '-in', pem_file, '-text', '-noout'], stdout=subprocess.PIPE, encoding='utf-8') modulus_raw = [] in_modulus = False for line in result.stdout.splitlines(): if line.start...
-834,223,368,120,348,900
Extract public exponent and modulus from PEM file.
chip/mchp/util/pack_ec.py
GetPublicKey
DHowett/fw-ectool
python
def GetPublicKey(pem_file): result = subprocess.run(['openssl', 'rsa', '-in', pem_file, '-text', '-noout'], stdout=subprocess.PIPE, encoding='utf-8') modulus_raw = [] in_modulus = False for line in result.stdout.splitlines(): if line.startswith('modulus'): in_modulus = True ...
def PacklfwRoImage(rorw_file, loader_file, image_size): 'Create a temp file with the\n first image_size bytes from the loader file and append bytes\n from the rorw file.\n return the filename' fo = tempfile.NamedTemporaryFile(delete=False) with open(loader_file, 'rb') as fin1: pro = fin1.read() ...
-6,079,619,575,248,944,000
Create a temp file with the first image_size bytes from the loader file and append bytes from the rorw file. return the filename
chip/mchp/util/pack_ec.py
PacklfwRoImage
DHowett/fw-ectool
python
def PacklfwRoImage(rorw_file, loader_file, image_size): 'Create a temp file with the\n first image_size bytes from the loader file and append bytes\n from the rorw file.\n return the filename' fo = tempfile.NamedTemporaryFile(delete=False) with open(loader_file, 'rb') as fin1: pro = fin1.read() ...
def create_namespaced_job(self, namespace, body, **kwargs): "\n create a Job\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.create_namespaced_job(namespace, body, async_req=True)\n >>...
-8,222,020,624,813,056,000
create a Job This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_namespaced_job(namespace, body, async_req=True) >>> result = thread.get() :param async_req bool :param str namespace: object name and auth scope, such as for te...
kubernetes/client/apis/batch_v1_api.py
create_namespaced_job
MiaoRachelYu/python
python
def create_namespaced_job(self, namespace, body, **kwargs): "\n create a Job\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.create_namespaced_job(namespace, body, async_req=True)\n >>...
def create_namespaced_job_with_http_info(self, namespace, body, **kwargs): "\n create a Job\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.create_namespaced_job_with_http_info(namespace, bod...
-1,810,460,728,275,074,800
create a Job This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_namespaced_job_with_http_info(namespace, body, async_req=True) >>> result = thread.get() :param async_req bool :param str namespace: object name and auth scope,...
kubernetes/client/apis/batch_v1_api.py
create_namespaced_job_with_http_info
MiaoRachelYu/python
python
def create_namespaced_job_with_http_info(self, namespace, body, **kwargs): "\n create a Job\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.create_namespaced_job_with_http_info(namespace, bod...
def delete_collection_namespaced_job(self, namespace, **kwargs): '\n delete collection of Job\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.delete_collection_namespaced_job(namespace, async...
5,780,434,193,283,119,000
delete collection of Job This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_collection_namespaced_job(namespace, async_req=True) >>> result = thread.get() :param async_req bool :param str namespace: object name and auth scop...
kubernetes/client/apis/batch_v1_api.py
delete_collection_namespaced_job
MiaoRachelYu/python
python
def delete_collection_namespaced_job(self, namespace, **kwargs): '\n delete collection of Job\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.delete_collection_namespaced_job(namespace, async...
def delete_collection_namespaced_job_with_http_info(self, namespace, **kwargs): '\n delete collection of Job\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.delete_collection_namespaced_job_w...
-1,365,401,780,679,479,000
delete collection of Job This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_collection_namespaced_job_with_http_info(namespace, async_req=True) >>> result = thread.get() :param async_req bool :param str namespace: object nam...
kubernetes/client/apis/batch_v1_api.py
delete_collection_namespaced_job_with_http_info
MiaoRachelYu/python
python
def delete_collection_namespaced_job_with_http_info(self, namespace, **kwargs): '\n delete collection of Job\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.delete_collection_namespaced_job_w...