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 fetch(self): '\n Fetch a FeedbackInstance\n\n :returns: Fetched FeedbackInstance\n :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance\n ' params = values.of({}) payload = self._version.fetch('GET', self._uri, params=params) return FeedbackInstance(self._...
-2,003,002,863,357,165,600
Fetch a FeedbackInstance :returns: Fetched FeedbackInstance :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance
lib/python2.7/site-packages/twilio/rest/api/v2010/account/call/feedback.py
fetch
Jason-Paprocki/hacknjit
python
def fetch(self): '\n Fetch a FeedbackInstance\n\n :returns: Fetched FeedbackInstance\n :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance\n ' params = values.of({}) payload = self._version.fetch('GET', self._uri, params=params) return FeedbackInstance(self._...
def update(self, quality_score, issue=values.unset): '\n Update the FeedbackInstance\n\n :param unicode quality_score: An integer from 1 to 5\n :param FeedbackInstance.Issues issue: Issues experienced during the call\n\n :returns: Updated FeedbackInstance\n :rtype: twilio.rest.api...
1,302,640,320,467,985,700
Update the FeedbackInstance :param unicode quality_score: An integer from 1 to 5 :param FeedbackInstance.Issues issue: Issues experienced during the call :returns: Updated FeedbackInstance :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance
lib/python2.7/site-packages/twilio/rest/api/v2010/account/call/feedback.py
update
Jason-Paprocki/hacknjit
python
def update(self, quality_score, issue=values.unset): '\n Update the FeedbackInstance\n\n :param unicode quality_score: An integer from 1 to 5\n :param FeedbackInstance.Issues issue: Issues experienced during the call\n\n :returns: Updated FeedbackInstance\n :rtype: twilio.rest.api...
def __repr__(self): '\n Provide a friendly representation\n\n :returns: Machine friendly representation\n :rtype: str\n ' context = ' '.join(('{}={}'.format(k, v) for (k, v) in self._solution.items())) return '<Twilio.Api.V2010.FeedbackContext {}>'.format(context)
-4,387,753,038,428,856,000
Provide a friendly representation :returns: Machine friendly representation :rtype: str
lib/python2.7/site-packages/twilio/rest/api/v2010/account/call/feedback.py
__repr__
Jason-Paprocki/hacknjit
python
def __repr__(self): '\n Provide a friendly representation\n\n :returns: Machine friendly representation\n :rtype: str\n ' context = ' '.join(('{}={}'.format(k, v) for (k, v) in self._solution.items())) return '<Twilio.Api.V2010.FeedbackContext {}>'.format(context)
def __init__(self, version, payload, account_sid, call_sid): '\n Initialize the FeedbackInstance\n\n :returns: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance\n :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance\n ' super(FeedbackInstance, self).__init_...
-801,141,970,854,188,800
Initialize the FeedbackInstance :returns: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance
lib/python2.7/site-packages/twilio/rest/api/v2010/account/call/feedback.py
__init__
Jason-Paprocki/hacknjit
python
def __init__(self, version, payload, account_sid, call_sid): '\n Initialize the FeedbackInstance\n\n :returns: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance\n :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance\n ' super(FeedbackInstance, self).__init_...
@property def _proxy(self): '\n Generate an instance context for the instance, the context is capable of\n performing various actions. All instance actions are proxied to the context\n\n :returns: FeedbackContext for this FeedbackInstance\n :rtype: twilio.rest.api.v2010.account.call.fee...
-4,084,114,105,181,760,500
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context :returns: FeedbackContext for this FeedbackInstance :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackContext
lib/python2.7/site-packages/twilio/rest/api/v2010/account/call/feedback.py
_proxy
Jason-Paprocki/hacknjit
python
@property def _proxy(self): '\n Generate an instance context for the instance, the context is capable of\n performing various actions. All instance actions are proxied to the context\n\n :returns: FeedbackContext for this FeedbackInstance\n :rtype: twilio.rest.api.v2010.account.call.fee...
@property def account_sid(self): '\n :returns: The account_sid\n :rtype: unicode\n ' return self._properties['account_sid']
-6,875,424,500,779,715,000
:returns: The account_sid :rtype: unicode
lib/python2.7/site-packages/twilio/rest/api/v2010/account/call/feedback.py
account_sid
Jason-Paprocki/hacknjit
python
@property def account_sid(self): '\n :returns: The account_sid\n :rtype: unicode\n ' return self._properties['account_sid']
@property def date_created(self): '\n :returns: The date_created\n :rtype: datetime\n ' return self._properties['date_created']
-250,917,683,243,838,050
:returns: The date_created :rtype: datetime
lib/python2.7/site-packages/twilio/rest/api/v2010/account/call/feedback.py
date_created
Jason-Paprocki/hacknjit
python
@property def date_created(self): '\n :returns: The date_created\n :rtype: datetime\n ' return self._properties['date_created']
@property def date_updated(self): '\n :returns: The date_updated\n :rtype: datetime\n ' return self._properties['date_updated']
-8,425,627,007,073,683,000
:returns: The date_updated :rtype: datetime
lib/python2.7/site-packages/twilio/rest/api/v2010/account/call/feedback.py
date_updated
Jason-Paprocki/hacknjit
python
@property def date_updated(self): '\n :returns: The date_updated\n :rtype: datetime\n ' return self._properties['date_updated']
@property def issues(self): '\n :returns: The issues\n :rtype: FeedbackInstance.Issues\n ' return self._properties['issues']
-594,813,764,122,206,500
:returns: The issues :rtype: FeedbackInstance.Issues
lib/python2.7/site-packages/twilio/rest/api/v2010/account/call/feedback.py
issues
Jason-Paprocki/hacknjit
python
@property def issues(self): '\n :returns: The issues\n :rtype: FeedbackInstance.Issues\n ' return self._properties['issues']
@property def quality_score(self): '\n :returns: 1 to 5 quality score\n :rtype: unicode\n ' return self._properties['quality_score']
-4,891,796,970,587,220,000
:returns: 1 to 5 quality score :rtype: unicode
lib/python2.7/site-packages/twilio/rest/api/v2010/account/call/feedback.py
quality_score
Jason-Paprocki/hacknjit
python
@property def quality_score(self): '\n :returns: 1 to 5 quality score\n :rtype: unicode\n ' return self._properties['quality_score']
@property def sid(self): '\n :returns: The sid\n :rtype: unicode\n ' return self._properties['sid']
-8,253,500,487,129,927,000
:returns: The sid :rtype: unicode
lib/python2.7/site-packages/twilio/rest/api/v2010/account/call/feedback.py
sid
Jason-Paprocki/hacknjit
python
@property def sid(self): '\n :returns: The sid\n :rtype: unicode\n ' return self._properties['sid']
def create(self, quality_score, issue=values.unset): '\n Create a new FeedbackInstance\n\n :param unicode quality_score: The quality_score\n :param FeedbackInstance.Issues issue: The issue\n\n :returns: Newly created FeedbackInstance\n :rtype: twilio.rest.api.v2010.account.call.fe...
-2,144,275,642,321,963,300
Create a new FeedbackInstance :param unicode quality_score: The quality_score :param FeedbackInstance.Issues issue: The issue :returns: Newly created FeedbackInstance :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance
lib/python2.7/site-packages/twilio/rest/api/v2010/account/call/feedback.py
create
Jason-Paprocki/hacknjit
python
def create(self, quality_score, issue=values.unset): '\n Create a new FeedbackInstance\n\n :param unicode quality_score: The quality_score\n :param FeedbackInstance.Issues issue: The issue\n\n :returns: Newly created FeedbackInstance\n :rtype: twilio.rest.api.v2010.account.call.fe...
def fetch(self): '\n Fetch a FeedbackInstance\n\n :returns: Fetched FeedbackInstance\n :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance\n ' return self._proxy.fetch()
-8,067,892,351,115,993,000
Fetch a FeedbackInstance :returns: Fetched FeedbackInstance :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance
lib/python2.7/site-packages/twilio/rest/api/v2010/account/call/feedback.py
fetch
Jason-Paprocki/hacknjit
python
def fetch(self): '\n Fetch a FeedbackInstance\n\n :returns: Fetched FeedbackInstance\n :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance\n ' return self._proxy.fetch()
def update(self, quality_score, issue=values.unset): '\n Update the FeedbackInstance\n\n :param unicode quality_score: An integer from 1 to 5\n :param FeedbackInstance.Issues issue: Issues experienced during the call\n\n :returns: Updated FeedbackInstance\n :rtype: twilio.rest.api...
969,629,373,209,911,300
Update the FeedbackInstance :param unicode quality_score: An integer from 1 to 5 :param FeedbackInstance.Issues issue: Issues experienced during the call :returns: Updated FeedbackInstance :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance
lib/python2.7/site-packages/twilio/rest/api/v2010/account/call/feedback.py
update
Jason-Paprocki/hacknjit
python
def update(self, quality_score, issue=values.unset): '\n Update the FeedbackInstance\n\n :param unicode quality_score: An integer from 1 to 5\n :param FeedbackInstance.Issues issue: Issues experienced during the call\n\n :returns: Updated FeedbackInstance\n :rtype: twilio.rest.api...
def __repr__(self): '\n Provide a friendly representation\n\n :returns: Machine friendly representation\n :rtype: str\n ' context = ' '.join(('{}={}'.format(k, v) for (k, v) in self._solution.items())) return '<Twilio.Api.V2010.FeedbackInstance {}>'.format(context)
-429,944,536,459,628,300
Provide a friendly representation :returns: Machine friendly representation :rtype: str
lib/python2.7/site-packages/twilio/rest/api/v2010/account/call/feedback.py
__repr__
Jason-Paprocki/hacknjit
python
def __repr__(self): '\n Provide a friendly representation\n\n :returns: Machine friendly representation\n :rtype: str\n ' context = ' '.join(('{}={}'.format(k, v) for (k, v) in self._solution.items())) return '<Twilio.Api.V2010.FeedbackInstance {}>'.format(context)
def processLayoutText(self, layoutText): '\n Coordinates are flipped from the input format to the (x,y) convention here\n\n The shape of the maze. Each character\n represents a different type of object.\n % - Wall\n . - Food\n o - Capsule\n G - Ghost\n P...
9,172,213,862,141,142,000
Coordinates are flipped from the input format to the (x,y) convention here The shape of the maze. Each character represents a different type of object. % - Wall . - Food o - Capsule G - Ghost P - Pacman Other characters are ignored.
tracking/layout.py
processLayoutText
chibinz/CS181
python
def processLayoutText(self, layoutText): '\n Coordinates are flipped from the input format to the (x,y) convention here\n\n The shape of the maze. Each character\n represents a different type of object.\n % - Wall\n . - Food\n o - Capsule\n G - Ghost\n P...
def train(estimator: object, X: Iterable[Union[(int, float)]], y: Iterable): '\n Train custom classifier model.\n\n Parameters:\n estimator: Unfitted estimator.\n X: Input training data.\n y: Labels for test data.\n\n Returns:\n Fitted estimator model.\n ' return estimato...
-8,926,492,144,770,881,000
Train custom classifier model. Parameters: estimator: Unfitted estimator. X: Input training data. y: Labels for test data. Returns: Fitted estimator model.
ml.py
train
Fennec2000GH/Poly-Finance
python
def train(estimator: object, X: Iterable[Union[(int, float)]], y: Iterable): '\n Train custom classifier model.\n\n Parameters:\n estimator: Unfitted estimator.\n X: Input training data.\n y: Labels for test data.\n\n Returns:\n Fitted estimator model.\n ' return estimato...
def classify(estimator: object, X: Iterable[Union[(int, float)]]): '\n Predict with custom classifier model.\n\n Parameters:\n estimator: Fitted estimator.\n X: Input test data.\n\n Returns:\n Predicted labels.\n ' return estimator.predict(X=X)
7,964,491,657,674,355,000
Predict with custom classifier model. Parameters: estimator: Fitted estimator. X: Input test data. Returns: Predicted labels.
ml.py
classify
Fennec2000GH/Poly-Finance
python
def classify(estimator: object, X: Iterable[Union[(int, float)]]): '\n Predict with custom classifier model.\n\n Parameters:\n estimator: Fitted estimator.\n X: Input test data.\n\n Returns:\n Predicted labels.\n ' return estimator.predict(X=X)
def regress(estimator: object, X: Iterable[Union[(int, float)]], y: Iterable): '\n Predict with custom regressor model.\n\n Parameters:\n estimator: Fitted estimator.\n X: Input test data.\n y: Labels for test data.\n\n Returns:\n Predicted labels.\n ' pass
1,504,345,972,072,559,400
Predict with custom regressor model. Parameters: estimator: Fitted estimator. X: Input test data. y: Labels for test data. Returns: Predicted labels.
ml.py
regress
Fennec2000GH/Poly-Finance
python
def regress(estimator: object, X: Iterable[Union[(int, float)]], y: Iterable): '\n Predict with custom regressor model.\n\n Parameters:\n estimator: Fitted estimator.\n X: Input test data.\n y: Labels for test data.\n\n Returns:\n Predicted labels.\n ' pass
def evaluate(estimator: object, X: Iterable[Union[(int, float)]], y: Iterable): '\n Predict with custom classifier model.\n\n Parameters:\n estimator: Fitted estimator.\n X: Input test data.\n y: Labels for test data.\n\n Returns:\n Predicted labels.\n ' pred = estimator....
-6,500,435,570,618,804,000
Predict with custom classifier model. Parameters: estimator: Fitted estimator. X: Input test data. y: Labels for test data. Returns: Predicted labels.
ml.py
evaluate
Fennec2000GH/Poly-Finance
python
def evaluate(estimator: object, X: Iterable[Union[(int, float)]], y: Iterable): '\n Predict with custom classifier model.\n\n Parameters:\n estimator: Fitted estimator.\n X: Input test data.\n y: Labels for test data.\n\n Returns:\n Predicted labels.\n ' pred = estimator....
def iter_linear_fit(xy, uv, wxy=None, wuv=None, fitgeom='general', center=None, nclip=3, sigma=(3.0, 'rmse'), clip_accum=False): '\n Compute linear transformation parameters that "best" (in the sense of\n minimizing residuals) transform ``uv`` source position to ``xy``\n sources iteratively using sigma-cli...
-8,699,323,938,293,037,000
Compute linear transformation parameters that "best" (in the sense of minimizing residuals) transform ``uv`` source position to ``xy`` sources iteratively using sigma-clipping. More precisely, this functions attempts to find a ``2x2`` matrix ``F`` and a shift vector ``s`` that minimize the residuals between the *trans...
tweakwcs/linearfit.py
iter_linear_fit
jhunkeler/tweakwcs
python
def iter_linear_fit(xy, uv, wxy=None, wuv=None, fitgeom='general', center=None, nclip=3, sigma=(3.0, 'rmse'), clip_accum=False): '\n Compute linear transformation parameters that "best" (in the sense of\n minimizing residuals) transform ``uv`` source position to ``xy``\n sources iteratively using sigma-cli...
def fit_shifts(xy, uv, wxy=None, wuv=None): " Fits (non-iteratively and without sigma-clipping) a displacement\n transformation only between input lists of positions ``xy`` and ``uv``.\n When weights are provided, a weighted fit is performed. Parameter\n descriptions and return values are identical to thos...
-1,491,896,026,331,747,000
Fits (non-iteratively and without sigma-clipping) a displacement transformation only between input lists of positions ``xy`` and ``uv``. When weights are provided, a weighted fit is performed. Parameter descriptions and return values are identical to those in `iter_linear_fit`, except returned ``fit`` dictionary does n...
tweakwcs/linearfit.py
fit_shifts
jhunkeler/tweakwcs
python
def fit_shifts(xy, uv, wxy=None, wuv=None): " Fits (non-iteratively and without sigma-clipping) a displacement\n transformation only between input lists of positions ``xy`` and ``uv``.\n When weights are provided, a weighted fit is performed. Parameter\n descriptions and return values are identical to thos...
def fit_rscale(xy, uv, wxy=None, wuv=None): " Fits (non-iteratively and without sigma-clipping) a displacement,\n rotation and scale transformations between input lists of positions\n ``xy`` and ``uv``. When weights are provided, a weighted fit is performed.\n Parameter descriptions and return values are i...
2,982,510,986,755,505,700
Fits (non-iteratively and without sigma-clipping) a displacement, rotation and scale transformations between input lists of positions ``xy`` and ``uv``. When weights are provided, a weighted fit is performed. Parameter descriptions and return values are identical to those in `iter_linear_fit`, except returned ``fit`` d...
tweakwcs/linearfit.py
fit_rscale
jhunkeler/tweakwcs
python
def fit_rscale(xy, uv, wxy=None, wuv=None): " Fits (non-iteratively and without sigma-clipping) a displacement,\n rotation and scale transformations between input lists of positions\n ``xy`` and ``uv``. When weights are provided, a weighted fit is performed.\n Parameter descriptions and return values are i...
def fit_general(xy, uv, wxy=None, wuv=None): " Fits (non-iteratively and without sigma-clipping) a displacement,\n rotation, scale, and skew transformations (i.e., the full ``2x2``\n transformation matrix) between input lists of positions\n ``xy`` and ``uv``. When weights are provided, a weighted fit is pe...
3,775,803,470,868,652,500
Fits (non-iteratively and without sigma-clipping) a displacement, rotation, scale, and skew transformations (i.e., the full ``2x2`` transformation matrix) between input lists of positions ``xy`` and ``uv``. When weights are provided, a weighted fit is performed. Parameter descriptions and return values are identical to...
tweakwcs/linearfit.py
fit_general
jhunkeler/tweakwcs
python
def fit_general(xy, uv, wxy=None, wuv=None): " Fits (non-iteratively and without sigma-clipping) a displacement,\n rotation, scale, and skew transformations (i.e., the full ``2x2``\n transformation matrix) between input lists of positions\n ``xy`` and ``uv``. When weights are provided, a weighted fit is pe...
def build_fit_matrix(rot, scale=1): '\n Create an affine transformation matrix (2x2) from the provided rotation\n angle(s) and scale(s):\n\n .. math::\n\n M = \\begin{bmatrix}\n s_x \\cos(\\theta_x) & s_y \\sin(\\theta_y) \\\\\n -s_x \\sin(\\theta_x) & s_y \\cos(\\theta...
-4,852,843,185,402,100,000
Create an affine transformation matrix (2x2) from the provided rotation angle(s) and scale(s): .. math:: M = \begin{bmatrix} s_x \cos(\theta_x) & s_y \sin(\theta_y) \\ -s_x \sin(\theta_x) & s_y \cos(\theta_y) \end{bmatrix} Parameters ---------- rot: tuple, float, optional Rota...
tweakwcs/linearfit.py
build_fit_matrix
jhunkeler/tweakwcs
python
def build_fit_matrix(rot, scale=1): '\n Create an affine transformation matrix (2x2) from the provided rotation\n angle(s) and scale(s):\n\n .. math::\n\n M = \\begin{bmatrix}\n s_x \\cos(\\theta_x) & s_y \\sin(\\theta_y) \\\\\n -s_x \\sin(\\theta_x) & s_y \\cos(\\theta...
@pytest.fixture async def trio_kivy_app(request, nursery, _app_release_list, _app_release) -> AsyncUnitApp: 'Fixture yielding a :class:`~pytest_kivy.app.AsyncUnitApp` using\n explicitly trio as backend for the async library.\n\n pytest-trio and trio must be installed, and ``trio_mode = true`` must be\n set...
-5,318,611,033,535,439,000
Fixture yielding a :class:`~pytest_kivy.app.AsyncUnitApp` using explicitly trio as backend for the async library. pytest-trio and trio must be installed, and ``trio_mode = true`` must be set in pytest.ini.
pytest_kivy/plugin.py
trio_kivy_app
matham/pytest-kivy
python
@pytest.fixture async def trio_kivy_app(request, nursery, _app_release_list, _app_release) -> AsyncUnitApp: 'Fixture yielding a :class:`~pytest_kivy.app.AsyncUnitApp` using\n explicitly trio as backend for the async library.\n\n pytest-trio and trio must be installed, and ``trio_mode = true`` must be\n set...
@pytest.fixture async def asyncio_kivy_app(request, event_loop, _app_release_list, _app_release) -> AsyncUnitApp: 'Fixture yielding a :class:`~pytest_kivy.app.AsyncUnitApp` using\n explicitly asyncio as backend for the async library.\n\n pytest-asyncio must be installed.\n ' (cls, kwargs, app_cls, app_...
-1,731,140,748,102,840,000
Fixture yielding a :class:`~pytest_kivy.app.AsyncUnitApp` using explicitly asyncio as backend for the async library. pytest-asyncio must be installed.
pytest_kivy/plugin.py
asyncio_kivy_app
matham/pytest-kivy
python
@pytest.fixture async def asyncio_kivy_app(request, event_loop, _app_release_list, _app_release) -> AsyncUnitApp: 'Fixture yielding a :class:`~pytest_kivy.app.AsyncUnitApp` using\n explicitly asyncio as backend for the async library.\n\n pytest-asyncio must be installed.\n ' (cls, kwargs, app_cls, app_...
@pytest.fixture async def async_kivy_app(request, _app_release_list, _app_release, _nursery, _event_loop) -> AsyncUnitApp: 'Fixture yielding a :class:`~pytest_kivy.app.AsyncUnitApp` using\n trio or asyncio as backend for the async library, depending on\n KIVY_EVENTLOOP.\n\n If using trio, pytest-trio and t...
-737,944,087,339,065,900
Fixture yielding a :class:`~pytest_kivy.app.AsyncUnitApp` using trio or asyncio as backend for the async library, depending on KIVY_EVENTLOOP. If using trio, pytest-trio and trio must be installed, and ``trio_mode = true`` must be set in pytest.ini. If using asyncio, pytest-asyncio must be installed.
pytest_kivy/plugin.py
async_kivy_app
matham/pytest-kivy
python
@pytest.fixture async def async_kivy_app(request, _app_release_list, _app_release, _nursery, _event_loop) -> AsyncUnitApp: 'Fixture yielding a :class:`~pytest_kivy.app.AsyncUnitApp` using\n trio or asyncio as backend for the async library, depending on\n KIVY_EVENTLOOP.\n\n If using trio, pytest-trio and t...
def test_purge_old_states(hass, hass_recorder): 'Test deleting old states.' hass = hass_recorder() _add_test_states(hass) with session_scope(hass=hass) as session: states = session.query(States) assert (states.count() == 6) finished = purge_old_data(hass.data[DATA_INSTANCE], 4, r...
3,161,758,145,078,438,000
Test deleting old states.
tests/components/recorder/test_purge.py
test_purge_old_states
AdmiralStipe/core
python
def test_purge_old_states(hass, hass_recorder): hass = hass_recorder() _add_test_states(hass) with session_scope(hass=hass) as session: states = session.query(States) assert (states.count() == 6) finished = purge_old_data(hass.data[DATA_INSTANCE], 4, repack=False) assert...
def test_purge_old_events(hass, hass_recorder): 'Test deleting old events.' hass = hass_recorder() _add_test_events(hass) with session_scope(hass=hass) as session: events = session.query(Events).filter(Events.event_type.like('EVENT_TEST%')) assert (events.count() == 6) finished =...
3,234,367,589,813,852,700
Test deleting old events.
tests/components/recorder/test_purge.py
test_purge_old_events
AdmiralStipe/core
python
def test_purge_old_events(hass, hass_recorder): hass = hass_recorder() _add_test_events(hass) with session_scope(hass=hass) as session: events = session.query(Events).filter(Events.event_type.like('EVENT_TEST%')) assert (events.count() == 6) finished = purge_old_data(hass.data[D...
def test_purge_old_recorder_runs(hass, hass_recorder): 'Test deleting old recorder runs keeps current run.' hass = hass_recorder() _add_test_recorder_runs(hass) with session_scope(hass=hass) as session: recorder_runs = session.query(RecorderRuns) assert (recorder_runs.count() == 7) ...
-3,228,106,912,315,216,000
Test deleting old recorder runs keeps current run.
tests/components/recorder/test_purge.py
test_purge_old_recorder_runs
AdmiralStipe/core
python
def test_purge_old_recorder_runs(hass, hass_recorder): hass = hass_recorder() _add_test_recorder_runs(hass) with session_scope(hass=hass) as session: recorder_runs = session.query(RecorderRuns) assert (recorder_runs.count() == 7) finished = purge_old_data(hass.data[DATA_INSTANCE...
def test_purge_method(hass, hass_recorder): 'Test purge method.' hass = hass_recorder() service_data = {'keep_days': 4} _add_test_events(hass) _add_test_states(hass) _add_test_recorder_runs(hass) with session_scope(hass=hass) as session: states = session.query(States) assert ...
7,501,323,893,733,130,000
Test purge method.
tests/components/recorder/test_purge.py
test_purge_method
AdmiralStipe/core
python
def test_purge_method(hass, hass_recorder): hass = hass_recorder() service_data = {'keep_days': 4} _add_test_events(hass) _add_test_states(hass) _add_test_recorder_runs(hass) with session_scope(hass=hass) as session: states = session.query(States) assert (states.count() == 6...
def _add_test_states(hass): 'Add multiple states to the db for testing.' now = datetime.now() five_days_ago = (now - timedelta(days=5)) eleven_days_ago = (now - timedelta(days=11)) attributes = {'test_attr': 5, 'test_attr_10': 'nice'} hass.block_till_done() hass.data[DATA_INSTANCE].block_til...
6,691,055,191,001,606,000
Add multiple states to the db for testing.
tests/components/recorder/test_purge.py
_add_test_states
AdmiralStipe/core
python
def _add_test_states(hass): now = datetime.now() five_days_ago = (now - timedelta(days=5)) eleven_days_ago = (now - timedelta(days=11)) attributes = {'test_attr': 5, 'test_attr_10': 'nice'} hass.block_till_done() hass.data[DATA_INSTANCE].block_till_done() wait_recording_done(hass) w...
def _add_test_events(hass): 'Add a few events for testing.' now = datetime.now() five_days_ago = (now - timedelta(days=5)) eleven_days_ago = (now - timedelta(days=11)) event_data = {'test_attr': 5, 'test_attr_10': 'nice'} hass.block_till_done() hass.data[DATA_INSTANCE].block_till_done() ...
-3,786,387,227,581,622,300
Add a few events for testing.
tests/components/recorder/test_purge.py
_add_test_events
AdmiralStipe/core
python
def _add_test_events(hass): now = datetime.now() five_days_ago = (now - timedelta(days=5)) eleven_days_ago = (now - timedelta(days=11)) event_data = {'test_attr': 5, 'test_attr_10': 'nice'} hass.block_till_done() hass.data[DATA_INSTANCE].block_till_done() wait_recording_done(hass) w...
def _add_test_recorder_runs(hass): 'Add a few recorder_runs for testing.' now = datetime.now() five_days_ago = (now - timedelta(days=5)) eleven_days_ago = (now - timedelta(days=11)) hass.block_till_done() hass.data[DATA_INSTANCE].block_till_done() wait_recording_done(hass) with recorder....
-535,643,562,059,519,400
Add a few recorder_runs for testing.
tests/components/recorder/test_purge.py
_add_test_recorder_runs
AdmiralStipe/core
python
def _add_test_recorder_runs(hass): now = datetime.now() five_days_ago = (now - timedelta(days=5)) eleven_days_ago = (now - timedelta(days=11)) hass.block_till_done() hass.data[DATA_INSTANCE].block_till_done() wait_recording_done(hass) with recorder.session_scope(hass=hass) as session: ...
@callback @bind_hass def entity_sources(hass: HomeAssistant) -> Dict[(str, Dict[(str, str)])]: 'Get the entity sources.' return hass.data.get(DATA_ENTITY_SOURCE, {})
-6,209,629,769,332,989,000
Get the entity sources.
homeassistant/helpers/entity.py
entity_sources
Leviosa-Shades/core
python
@callback @bind_hass def entity_sources(hass: HomeAssistant) -> Dict[(str, Dict[(str, str)])]: return hass.data.get(DATA_ENTITY_SOURCE, {})
def generate_entity_id(entity_id_format: str, name: Optional[str], current_ids: Optional[List[str]]=None, hass: Optional[HomeAssistant]=None) -> str: 'Generate a unique entity ID based on given entity IDs or used IDs.' return async_generate_entity_id(entity_id_format, name, current_ids, hass)
3,168,408,939,775,173,600
Generate a unique entity ID based on given entity IDs or used IDs.
homeassistant/helpers/entity.py
generate_entity_id
Leviosa-Shades/core
python
def generate_entity_id(entity_id_format: str, name: Optional[str], current_ids: Optional[List[str]]=None, hass: Optional[HomeAssistant]=None) -> str: return async_generate_entity_id(entity_id_format, name, current_ids, hass)
@callback def async_generate_entity_id(entity_id_format: str, name: Optional[str], current_ids: Optional[Iterable[str]]=None, hass: Optional[HomeAssistant]=None) -> str: 'Generate a unique entity ID based on given entity IDs or used IDs.' name = (name or DEVICE_DEFAULT_NAME).lower() preferred_string = entit...
5,117,351,041,053,576,000
Generate a unique entity ID based on given entity IDs or used IDs.
homeassistant/helpers/entity.py
async_generate_entity_id
Leviosa-Shades/core
python
@callback def async_generate_entity_id(entity_id_format: str, name: Optional[str], current_ids: Optional[Iterable[str]]=None, hass: Optional[HomeAssistant]=None) -> str: name = (name or DEVICE_DEFAULT_NAME).lower() preferred_string = entity_id_format.format(slugify(name)) if (current_ids is not None): ...
@property def should_poll(self) -> bool: 'Return True if entity has to be polled for state.\n\n False if entity pushes its state to HA.\n ' return True
8,328,211,760,097,568,000
Return True if entity has to be polled for state. False if entity pushes its state to HA.
homeassistant/helpers/entity.py
should_poll
Leviosa-Shades/core
python
@property def should_poll(self) -> bool: 'Return True if entity has to be polled for state.\n\n False if entity pushes its state to HA.\n ' return True
@property def unique_id(self) -> Optional[str]: 'Return a unique ID.' return None
2,538,883,729,920,680,000
Return a unique ID.
homeassistant/helpers/entity.py
unique_id
Leviosa-Shades/core
python
@property def unique_id(self) -> Optional[str]: return None
@property def name(self) -> Optional[str]: 'Return the name of the entity.' return None
5,905,829,013,751,394,000
Return the name of the entity.
homeassistant/helpers/entity.py
name
Leviosa-Shades/core
python
@property def name(self) -> Optional[str]: return None
@property def state(self) -> StateType: 'Return the state of the entity.' return STATE_UNKNOWN
1,356,358,700,227,505,700
Return the state of the entity.
homeassistant/helpers/entity.py
state
Leviosa-Shades/core
python
@property def state(self) -> StateType: return STATE_UNKNOWN
@property def capability_attributes(self) -> Optional[Dict[(str, Any)]]: 'Return the capability attributes.\n\n Attributes that explain the capabilities of an entity.\n\n Implemented by component base class. Convention for attribute names\n is lowercase snake_case.\n ' return None
4,158,045,754,724,678,700
Return the capability attributes. Attributes that explain the capabilities of an entity. Implemented by component base class. Convention for attribute names is lowercase snake_case.
homeassistant/helpers/entity.py
capability_attributes
Leviosa-Shades/core
python
@property def capability_attributes(self) -> Optional[Dict[(str, Any)]]: 'Return the capability attributes.\n\n Attributes that explain the capabilities of an entity.\n\n Implemented by component base class. Convention for attribute names\n is lowercase snake_case.\n ' return None
@property def state_attributes(self) -> Optional[Dict[(str, Any)]]: 'Return the state attributes.\n\n Implemented by component base class, should not be extended by integrations.\n Convention for attribute names is lowercase snake_case.\n ' return None
7,571,243,939,475,639,000
Return the state attributes. Implemented by component base class, should not be extended by integrations. Convention for attribute names is lowercase snake_case.
homeassistant/helpers/entity.py
state_attributes
Leviosa-Shades/core
python
@property def state_attributes(self) -> Optional[Dict[(str, Any)]]: 'Return the state attributes.\n\n Implemented by component base class, should not be extended by integrations.\n Convention for attribute names is lowercase snake_case.\n ' return None
@property def device_state_attributes(self) -> Optional[Dict[(str, Any)]]: 'Return entity specific state attributes.\n\n This method is deprecated, platform classes should implement\n extra_state_attributes instead.\n ' return None
-3,700,846,581,224,470,000
Return entity specific state attributes. This method is deprecated, platform classes should implement extra_state_attributes instead.
homeassistant/helpers/entity.py
device_state_attributes
Leviosa-Shades/core
python
@property def device_state_attributes(self) -> Optional[Dict[(str, Any)]]: 'Return entity specific state attributes.\n\n This method is deprecated, platform classes should implement\n extra_state_attributes instead.\n ' return None
@property def extra_state_attributes(self) -> Optional[Dict[(str, Any)]]: 'Return entity specific state attributes.\n\n Implemented by platform classes. Convention for attribute names\n is lowercase snake_case.\n ' return None
4,480,478,286,833,381,000
Return entity specific state attributes. Implemented by platform classes. Convention for attribute names is lowercase snake_case.
homeassistant/helpers/entity.py
extra_state_attributes
Leviosa-Shades/core
python
@property def extra_state_attributes(self) -> Optional[Dict[(str, Any)]]: 'Return entity specific state attributes.\n\n Implemented by platform classes. Convention for attribute names\n is lowercase snake_case.\n ' return None
@property def device_info(self) -> Optional[Dict[(str, Any)]]: 'Return device specific attributes.\n\n Implemented by platform classes.\n ' return None
7,117,282,649,591,217,000
Return device specific attributes. Implemented by platform classes.
homeassistant/helpers/entity.py
device_info
Leviosa-Shades/core
python
@property def device_info(self) -> Optional[Dict[(str, Any)]]: 'Return device specific attributes.\n\n Implemented by platform classes.\n ' return None
@property def device_class(self) -> Optional[str]: 'Return the class of this device, from component DEVICE_CLASSES.' return None
-3,089,613,303,586,104,000
Return the class of this device, from component DEVICE_CLASSES.
homeassistant/helpers/entity.py
device_class
Leviosa-Shades/core
python
@property def device_class(self) -> Optional[str]: return None
@property def unit_of_measurement(self) -> Optional[str]: 'Return the unit of measurement of this entity, if any.' return None
4,082,615,635,480,496,000
Return the unit of measurement of this entity, if any.
homeassistant/helpers/entity.py
unit_of_measurement
Leviosa-Shades/core
python
@property def unit_of_measurement(self) -> Optional[str]: return None
@property def icon(self) -> Optional[str]: 'Return the icon to use in the frontend, if any.' return None
-5,121,040,458,521,612,000
Return the icon to use in the frontend, if any.
homeassistant/helpers/entity.py
icon
Leviosa-Shades/core
python
@property def icon(self) -> Optional[str]: return None
@property def entity_picture(self) -> Optional[str]: 'Return the entity picture to use in the frontend, if any.' return None
1,998,631,624,207,249,400
Return the entity picture to use in the frontend, if any.
homeassistant/helpers/entity.py
entity_picture
Leviosa-Shades/core
python
@property def entity_picture(self) -> Optional[str]: return None
@property def available(self) -> bool: 'Return True if entity is available.' return True
-3,548,180,598,612,628,500
Return True if entity is available.
homeassistant/helpers/entity.py
available
Leviosa-Shades/core
python
@property def available(self) -> bool: return True
@property def assumed_state(self) -> bool: 'Return True if unable to access real state of the entity.' return False
1,269,755,479,481,557,800
Return True if unable to access real state of the entity.
homeassistant/helpers/entity.py
assumed_state
Leviosa-Shades/core
python
@property def assumed_state(self) -> bool: return False
@property def force_update(self) -> bool: 'Return True if state updates should be forced.\n\n If True, a state change will be triggered anytime the state property is\n updated, not just when the value changes.\n ' return False
-1,228,016,239,530,733,600
Return True if state updates should be forced. If True, a state change will be triggered anytime the state property is updated, not just when the value changes.
homeassistant/helpers/entity.py
force_update
Leviosa-Shades/core
python
@property def force_update(self) -> bool: 'Return True if state updates should be forced.\n\n If True, a state change will be triggered anytime the state property is\n updated, not just when the value changes.\n ' return False
@property def supported_features(self) -> Optional[int]: 'Flag supported features.' return None
-6,673,123,116,929,117,000
Flag supported features.
homeassistant/helpers/entity.py
supported_features
Leviosa-Shades/core
python
@property def supported_features(self) -> Optional[int]: return None
@property def context_recent_time(self) -> timedelta: 'Time that a context is considered recent.' return timedelta(seconds=5)
4,102,250,335,939,575,300
Time that a context is considered recent.
homeassistant/helpers/entity.py
context_recent_time
Leviosa-Shades/core
python
@property def context_recent_time(self) -> timedelta: return timedelta(seconds=5)
@property def entity_registry_enabled_default(self) -> bool: 'Return if the entity should be enabled when first added to the entity registry.' return True
-6,825,246,018,270,339,000
Return if the entity should be enabled when first added to the entity registry.
homeassistant/helpers/entity.py
entity_registry_enabled_default
Leviosa-Shades/core
python
@property def entity_registry_enabled_default(self) -> bool: return True
@property def enabled(self) -> bool: 'Return if the entity is enabled in the entity registry.\n\n If an entity is not part of the registry, it cannot be disabled\n and will therefore always be enabled.\n ' return ((self.registry_entry is None) or (not self.registry_entry.disabled))
-4,212,866,319,016,292,000
Return if the entity is enabled in the entity registry. If an entity is not part of the registry, it cannot be disabled and will therefore always be enabled.
homeassistant/helpers/entity.py
enabled
Leviosa-Shades/core
python
@property def enabled(self) -> bool: 'Return if the entity is enabled in the entity registry.\n\n If an entity is not part of the registry, it cannot be disabled\n and will therefore always be enabled.\n ' return ((self.registry_entry is None) or (not self.registry_entry.disabled))
@callback def async_set_context(self, context: Context) -> None: 'Set the context the entity currently operates under.' self._context = context self._context_set = dt_util.utcnow()
7,498,294,261,140,403,000
Set the context the entity currently operates under.
homeassistant/helpers/entity.py
async_set_context
Leviosa-Shades/core
python
@callback def async_set_context(self, context: Context) -> None: self._context = context self._context_set = dt_util.utcnow()
async def async_update_ha_state(self, force_refresh: bool=False) -> None: 'Update Home Assistant with current state of entity.\n\n If force_refresh == True will update entity before setting state.\n\n This method must be run in the event loop.\n ' if (self.hass is None): raise Runti...
-2,629,200,371,007,674,000
Update Home Assistant with current state of entity. If force_refresh == True will update entity before setting state. This method must be run in the event loop.
homeassistant/helpers/entity.py
async_update_ha_state
Leviosa-Shades/core
python
async def async_update_ha_state(self, force_refresh: bool=False) -> None: 'Update Home Assistant with current state of entity.\n\n If force_refresh == True will update entity before setting state.\n\n This method must be run in the event loop.\n ' if (self.hass is None): raise Runti...
@callback def async_write_ha_state(self) -> None: 'Write the state to the state machine.' if (self.hass is None): raise RuntimeError(f'Attribute hass is None for {self}') if (self.entity_id is None): raise NoEntitySpecifiedError(f'No entity id specified for entity {self.name}') self._asy...
-7,814,871,863,252,089,000
Write the state to the state machine.
homeassistant/helpers/entity.py
async_write_ha_state
Leviosa-Shades/core
python
@callback def async_write_ha_state(self) -> None: if (self.hass is None): raise RuntimeError(f'Attribute hass is None for {self}') if (self.entity_id is None): raise NoEntitySpecifiedError(f'No entity id specified for entity {self.name}') self._async_write_ha_state()
@callback def _async_write_ha_state(self) -> None: 'Write the state to the state machine.' if (self.registry_entry and self.registry_entry.disabled_by): if (not self._disabled_reported): self._disabled_reported = True assert (self.platform is not None) _LOGGER.warning...
5,703,493,031,829,491,000
Write the state to the state machine.
homeassistant/helpers/entity.py
_async_write_ha_state
Leviosa-Shades/core
python
@callback def _async_write_ha_state(self) -> None: if (self.registry_entry and self.registry_entry.disabled_by): if (not self._disabled_reported): self._disabled_reported = True assert (self.platform is not None) _LOGGER.warning('Entity %s is incorrectly being trigge...
def schedule_update_ha_state(self, force_refresh: bool=False) -> None: 'Schedule an update ha state change task.\n\n Scheduling the update avoids executor deadlocks.\n\n Entity state and attributes are read when the update ha state change\n task is executed.\n If state is changed more th...
4,930,532,841,608,269,000
Schedule an update ha state change task. Scheduling the update avoids executor deadlocks. Entity state and attributes are read when the update ha state change task is executed. If state is changed more than once before the ha state change task has been executed, the intermediate state transitions will be missed.
homeassistant/helpers/entity.py
schedule_update_ha_state
Leviosa-Shades/core
python
def schedule_update_ha_state(self, force_refresh: bool=False) -> None: 'Schedule an update ha state change task.\n\n Scheduling the update avoids executor deadlocks.\n\n Entity state and attributes are read when the update ha state change\n task is executed.\n If state is changed more th...
@callback def async_schedule_update_ha_state(self, force_refresh: bool=False) -> None: 'Schedule an update ha state change task.\n\n This method must be run in the event loop.\n Scheduling the update avoids executor deadlocks.\n\n Entity state and attributes are read when the update ha state ch...
221,238,759,961,931,260
Schedule an update ha state change task. This method must be run in the event loop. Scheduling the update avoids executor deadlocks. Entity state and attributes are read when the update ha state change task is executed. If state is changed more than once before the ha state change task has been executed, the intermed...
homeassistant/helpers/entity.py
async_schedule_update_ha_state
Leviosa-Shades/core
python
@callback def async_schedule_update_ha_state(self, force_refresh: bool=False) -> None: 'Schedule an update ha state change task.\n\n This method must be run in the event loop.\n Scheduling the update avoids executor deadlocks.\n\n Entity state and attributes are read when the update ha state ch...
async def async_device_update(self, warning: bool=True) -> None: "Process 'update' or 'async_update' from entity.\n\n This method is a coroutine.\n " if self._update_staged: return self._update_staged = True if self.parallel_updates: (await self.parallel_updates.acquire()) ...
-3,065,611,561,549,544,400
Process 'update' or 'async_update' from entity. This method is a coroutine.
homeassistant/helpers/entity.py
async_device_update
Leviosa-Shades/core
python
async def async_device_update(self, warning: bool=True) -> None: "Process 'update' or 'async_update' from entity.\n\n This method is a coroutine.\n " if self._update_staged: return self._update_staged = True if self.parallel_updates: (await self.parallel_updates.acquire()) ...
@callback def async_on_remove(self, func: CALLBACK_TYPE) -> None: 'Add a function to call when entity removed.' if (self._on_remove is None): self._on_remove = [] self._on_remove.append(func)
2,298,680,603,316,999,700
Add a function to call when entity removed.
homeassistant/helpers/entity.py
async_on_remove
Leviosa-Shades/core
python
@callback def async_on_remove(self, func: CALLBACK_TYPE) -> None: if (self._on_remove is None): self._on_remove = [] self._on_remove.append(func)
async def async_removed_from_registry(self) -> None: 'Run when entity has been removed from entity registry.\n\n To be extended by integrations.\n '
-4,028,870,512,133,826,600
Run when entity has been removed from entity registry. To be extended by integrations.
homeassistant/helpers/entity.py
async_removed_from_registry
Leviosa-Shades/core
python
async def async_removed_from_registry(self) -> None: 'Run when entity has been removed from entity registry.\n\n To be extended by integrations.\n '
@callback def add_to_platform_start(self, hass: HomeAssistant, platform: EntityPlatform, parallel_updates: Optional[asyncio.Semaphore]) -> None: 'Start adding an entity to a platform.' if self._added: raise HomeAssistantError(f'Entity {self.entity_id} cannot be added a second time to an entity platform'...
-1,761,300,229,261,884,400
Start adding an entity to a platform.
homeassistant/helpers/entity.py
add_to_platform_start
Leviosa-Shades/core
python
@callback def add_to_platform_start(self, hass: HomeAssistant, platform: EntityPlatform, parallel_updates: Optional[asyncio.Semaphore]) -> None: if self._added: raise HomeAssistantError(f'Entity {self.entity_id} cannot be added a second time to an entity platform') self.hass = hass self.platfor...
@callback def add_to_platform_abort(self) -> None: 'Abort adding an entity to a platform.' self.hass = None self.platform = None self.parallel_updates = None self._added = False
-2,633,042,765,756,663,300
Abort adding an entity to a platform.
homeassistant/helpers/entity.py
add_to_platform_abort
Leviosa-Shades/core
python
@callback def add_to_platform_abort(self) -> None: self.hass = None self.platform = None self.parallel_updates = None self._added = False
async def add_to_platform_finish(self) -> None: 'Finish adding an entity to a platform.' (await self.async_internal_added_to_hass()) (await self.async_added_to_hass()) self.async_write_ha_state()
-2,320,288,375,294,386,000
Finish adding an entity to a platform.
homeassistant/helpers/entity.py
add_to_platform_finish
Leviosa-Shades/core
python
async def add_to_platform_finish(self) -> None: (await self.async_internal_added_to_hass()) (await self.async_added_to_hass()) self.async_write_ha_state()
async def async_remove(self, *, force_remove: bool=False) -> None: "Remove entity from Home Assistant.\n\n If the entity has a non disabled entry in the entity registry,\n the entity's state will be set to unavailable, in the same way\n as when the entity registry is loaded.\n\n If the e...
149,070,520,219,460,640
Remove entity from Home Assistant. If the entity has a non disabled entry in the entity registry, the entity's state will be set to unavailable, in the same way as when the entity registry is loaded. If the entity doesn't have a non disabled entry in the entity registry, or if force_remove=True, its state will be rem...
homeassistant/helpers/entity.py
async_remove
Leviosa-Shades/core
python
async def async_remove(self, *, force_remove: bool=False) -> None: "Remove entity from Home Assistant.\n\n If the entity has a non disabled entry in the entity registry,\n the entity's state will be set to unavailable, in the same way\n as when the entity registry is loaded.\n\n If the e...
async def async_added_to_hass(self) -> None: 'Run when entity about to be added to hass.\n\n To be extended by integrations.\n '
-5,585,018,881,033,491,000
Run when entity about to be added to hass. To be extended by integrations.
homeassistant/helpers/entity.py
async_added_to_hass
Leviosa-Shades/core
python
async def async_added_to_hass(self) -> None: 'Run when entity about to be added to hass.\n\n To be extended by integrations.\n '
async def async_will_remove_from_hass(self) -> None: 'Run when entity will be removed from hass.\n\n To be extended by integrations.\n '
-8,817,618,303,532,068,000
Run when entity will be removed from hass. To be extended by integrations.
homeassistant/helpers/entity.py
async_will_remove_from_hass
Leviosa-Shades/core
python
async def async_will_remove_from_hass(self) -> None: 'Run when entity will be removed from hass.\n\n To be extended by integrations.\n '
async def async_internal_added_to_hass(self) -> None: 'Run when entity about to be added to hass.\n\n Not to be extended by integrations.\n ' if self.platform: info = {'domain': self.platform.platform_name} if self.platform.config_entry: info['source'] = SOURCE_CONFIG_E...
7,854,938,287,459,399,000
Run when entity about to be added to hass. Not to be extended by integrations.
homeassistant/helpers/entity.py
async_internal_added_to_hass
Leviosa-Shades/core
python
async def async_internal_added_to_hass(self) -> None: 'Run when entity about to be added to hass.\n\n Not to be extended by integrations.\n ' if self.platform: info = {'domain': self.platform.platform_name} if self.platform.config_entry: info['source'] = SOURCE_CONFIG_E...
async def async_internal_will_remove_from_hass(self) -> None: 'Run when entity will be removed from hass.\n\n Not to be extended by integrations.\n ' if self.platform: self.hass.data[DATA_ENTITY_SOURCE].pop(self.entity_id)
1,536,591,258,824,101,000
Run when entity will be removed from hass. Not to be extended by integrations.
homeassistant/helpers/entity.py
async_internal_will_remove_from_hass
Leviosa-Shades/core
python
async def async_internal_will_remove_from_hass(self) -> None: 'Run when entity will be removed from hass.\n\n Not to be extended by integrations.\n ' if self.platform: self.hass.data[DATA_ENTITY_SOURCE].pop(self.entity_id)
async def _async_registry_updated(self, event: Event) -> None: 'Handle entity registry update.' data = event.data if (data['action'] == 'remove'): (await self.async_removed_from_registry()) self.registry_entry = None (await self.async_remove()) if (data['action'] != 'update'): ...
8,834,064,360,167,315,000
Handle entity registry update.
homeassistant/helpers/entity.py
_async_registry_updated
Leviosa-Shades/core
python
async def _async_registry_updated(self, event: Event) -> None: data = event.data if (data['action'] == 'remove'): (await self.async_removed_from_registry()) self.registry_entry = None (await self.async_remove()) if (data['action'] != 'update'): return ent_reg = (awai...
def __eq__(self, other: Any) -> bool: 'Return the comparison.' if (not isinstance(other, self.__class__)): return False if ((self.unique_id is None) or (other.unique_id is None)): return False if ((self.platform is not None) or (other.platform is not None)): if ((self.platform is...
-4,800,598,507,128,546,000
Return the comparison.
homeassistant/helpers/entity.py
__eq__
Leviosa-Shades/core
python
def __eq__(self, other: Any) -> bool: if (not isinstance(other, self.__class__)): return False if ((self.unique_id is None) or (other.unique_id is None)): return False if ((self.platform is not None) or (other.platform is not None)): if ((self.platform is None) or (other.platfor...
def __repr__(self) -> str: 'Return the representation.' return f'<Entity {self.name}: {self.state}>'
5,428,986,823,689,221,000
Return the representation.
homeassistant/helpers/entity.py
__repr__
Leviosa-Shades/core
python
def __repr__(self) -> str: return f'<Entity {self.name}: {self.state}>'
async def async_request_call(self, coro: Awaitable) -> None: 'Process request batched.' if self.parallel_updates: (await self.parallel_updates.acquire()) try: (await coro) finally: if self.parallel_updates: self.parallel_updates.release()
3,011,644,997,447,190,500
Process request batched.
homeassistant/helpers/entity.py
async_request_call
Leviosa-Shades/core
python
async def async_request_call(self, coro: Awaitable) -> None: if self.parallel_updates: (await self.parallel_updates.acquire()) try: (await coro) finally: if self.parallel_updates: self.parallel_updates.release()
@property def state(self) -> str: 'Return the state.' return (STATE_ON if self.is_on else STATE_OFF)
-3,434,155,257,435,733,000
Return the state.
homeassistant/helpers/entity.py
state
Leviosa-Shades/core
python
@property def state(self) -> str: return (STATE_ON if self.is_on else STATE_OFF)
@property def is_on(self) -> bool: 'Return True if entity is on.' raise NotImplementedError()
8,799,682,652,869,394,000
Return True if entity is on.
homeassistant/helpers/entity.py
is_on
Leviosa-Shades/core
python
@property def is_on(self) -> bool: raise NotImplementedError()
def turn_on(self, **kwargs: Any) -> None: 'Turn the entity on.' raise NotImplementedError()
2,322,256,188,001,028,600
Turn the entity on.
homeassistant/helpers/entity.py
turn_on
Leviosa-Shades/core
python
def turn_on(self, **kwargs: Any) -> None: raise NotImplementedError()
async def async_turn_on(self, **kwargs: Any) -> None: 'Turn the entity on.' (await self.hass.async_add_executor_job(ft.partial(self.turn_on, **kwargs)))
-8,243,134,644,201,260,000
Turn the entity on.
homeassistant/helpers/entity.py
async_turn_on
Leviosa-Shades/core
python
async def async_turn_on(self, **kwargs: Any) -> None: (await self.hass.async_add_executor_job(ft.partial(self.turn_on, **kwargs)))
def turn_off(self, **kwargs: Any) -> None: 'Turn the entity off.' raise NotImplementedError()
-3,799,708,282,002,590,700
Turn the entity off.
homeassistant/helpers/entity.py
turn_off
Leviosa-Shades/core
python
def turn_off(self, **kwargs: Any) -> None: raise NotImplementedError()
async def async_turn_off(self, **kwargs: Any) -> None: 'Turn the entity off.' (await self.hass.async_add_executor_job(ft.partial(self.turn_off, **kwargs)))
-6,121,593,494,274,528,000
Turn the entity off.
homeassistant/helpers/entity.py
async_turn_off
Leviosa-Shades/core
python
async def async_turn_off(self, **kwargs: Any) -> None: (await self.hass.async_add_executor_job(ft.partial(self.turn_off, **kwargs)))
def toggle(self, **kwargs: Any) -> None: 'Toggle the entity.' if self.is_on: self.turn_off(**kwargs) else: self.turn_on(**kwargs)
-6,398,084,867,639,560,000
Toggle the entity.
homeassistant/helpers/entity.py
toggle
Leviosa-Shades/core
python
def toggle(self, **kwargs: Any) -> None: if self.is_on: self.turn_off(**kwargs) else: self.turn_on(**kwargs)
async def async_toggle(self, **kwargs: Any) -> None: 'Toggle the entity.' if self.is_on: (await self.async_turn_off(**kwargs)) else: (await self.async_turn_on(**kwargs))
6,141,564,757,956,466,000
Toggle the entity.
homeassistant/helpers/entity.py
async_toggle
Leviosa-Shades/core
python
async def async_toggle(self, **kwargs: Any) -> None: if self.is_on: (await self.async_turn_off(**kwargs)) else: (await self.async_turn_on(**kwargs))
def get_image_size(fname): 'Determine the image type of fhandle and return its size.\n from draco' with open(fname, 'rb') as fhandle: head = fhandle.read(24) if (len(head) != 24): return if (imghdr.what(fname) == 'png'): check = struct.unpack('>i', head[4:8])[0...
3,716,537,104,232,310,000
Determine the image type of fhandle and return its size. from draco
mdpdfbook/mdpdf/image.py
get_image_size
geraked/mdpdfbook
python
def get_image_size(fname): 'Determine the image type of fhandle and return its size.\n from draco' with open(fname, 'rb') as fhandle: head = fhandle.read(24) if (len(head) != 24): return if (imghdr.what(fname) == 'png'): check = struct.unpack('>i', head[4:8])[0...
@property def path_url(self): 'Build the path URL to use.' url = [] p = urlsplit(self.url) path = p.path if (not path): path = '/' url.append(path) query = p.query if query: url.append('?') url.append(query) return ''.join(url)
1,763,220,040,231,475,700
Build the path URL to use.
src/oci/_vendor/requests/models.py
path_url
LaudateCorpus1/oci-python-sdk
python
@property def path_url(self): url = [] p = urlsplit(self.url) path = p.path if (not path): path = '/' url.append(path) query = p.query if query: url.append('?') url.append(query) return .join(url)
@staticmethod def _encode_params(data): 'Encode parameters in a piece of data.\n\n Will successfully encode parameters when passed as a dict or a list of\n 2-tuples. Order is retained if data is a list of 2-tuples but arbitrary\n if parameters are supplied as a dict.\n ' if isinstanc...
-8,298,462,985,702,277,000
Encode parameters in a piece of data. Will successfully encode parameters when passed as a dict or a list of 2-tuples. Order is retained if data is a list of 2-tuples but arbitrary if parameters are supplied as a dict.
src/oci/_vendor/requests/models.py
_encode_params
LaudateCorpus1/oci-python-sdk
python
@staticmethod def _encode_params(data): 'Encode parameters in a piece of data.\n\n Will successfully encode parameters when passed as a dict or a list of\n 2-tuples. Order is retained if data is a list of 2-tuples but arbitrary\n if parameters are supplied as a dict.\n ' if isinstanc...
@staticmethod def _encode_files(files, data): 'Build the body for a multipart/form-data request.\n\n Will successfully encode files when passed as a dict or a list of\n tuples. Order is retained if data is a list of tuples but arbitrary\n if parameters are supplied as a dict.\n The tuple...
-5,009,398,987,837,660,000
Build the body for a multipart/form-data request. Will successfully encode files when passed as a dict or a list of tuples. Order is retained if data is a list of tuples but arbitrary if parameters are supplied as a dict. The tuples may be 2-tuples (filename, fileobj), 3-tuples (filename, fileobj, contentype) or 4-tup...
src/oci/_vendor/requests/models.py
_encode_files
LaudateCorpus1/oci-python-sdk
python
@staticmethod def _encode_files(files, data): 'Build the body for a multipart/form-data request.\n\n Will successfully encode files when passed as a dict or a list of\n tuples. Order is retained if data is a list of tuples but arbitrary\n if parameters are supplied as a dict.\n The tuple...
def register_hook(self, event, hook): 'Properly register a hook.' if (event not in self.hooks): raise ValueError(('Unsupported event specified, with event name "%s"' % event)) if isinstance(hook, Callable): self.hooks[event].append(hook) elif hasattr(hook, '__iter__'): self.hooks...
-4,681,226,212,105,443,000
Properly register a hook.
src/oci/_vendor/requests/models.py
register_hook
LaudateCorpus1/oci-python-sdk
python
def register_hook(self, event, hook): if (event not in self.hooks): raise ValueError(('Unsupported event specified, with event name "%s"' % event)) if isinstance(hook, Callable): self.hooks[event].append(hook) elif hasattr(hook, '__iter__'): self.hooks[event].extend((h for h in ...
def deregister_hook(self, event, hook): 'Deregister a previously registered hook.\n Returns True if the hook existed, False if not.\n ' try: self.hooks[event].remove(hook) return True except ValueError: return False
7,969,727,305,059,734,000
Deregister a previously registered hook. Returns True if the hook existed, False if not.
src/oci/_vendor/requests/models.py
deregister_hook
LaudateCorpus1/oci-python-sdk
python
def deregister_hook(self, event, hook): 'Deregister a previously registered hook.\n Returns True if the hook existed, False if not.\n ' try: self.hooks[event].remove(hook) return True except ValueError: return False
def prepare(self): 'Constructs a :class:`PreparedRequest <PreparedRequest>` for transmission and returns it.' p = PreparedRequest() p.prepare(method=self.method, url=self.url, headers=self.headers, files=self.files, data=self.data, json=self.json, params=self.params, auth=self.auth, cookies=self.cookies, ho...
-3,505,980,801,294,424,600
Constructs a :class:`PreparedRequest <PreparedRequest>` for transmission and returns it.
src/oci/_vendor/requests/models.py
prepare
LaudateCorpus1/oci-python-sdk
python
def prepare(self): p = PreparedRequest() p.prepare(method=self.method, url=self.url, headers=self.headers, files=self.files, data=self.data, json=self.json, params=self.params, auth=self.auth, cookies=self.cookies, hooks=self.hooks) return p
def prepare(self, method=None, url=None, headers=None, files=None, data=None, params=None, auth=None, cookies=None, hooks=None, json=None): 'Prepares the entire request with the given parameters.' self.prepare_method(method) self.prepare_url(url, params) self.prepare_headers(headers) self.prepare_co...
-8,748,719,649,105,786,000
Prepares the entire request with the given parameters.
src/oci/_vendor/requests/models.py
prepare
LaudateCorpus1/oci-python-sdk
python
def prepare(self, method=None, url=None, headers=None, files=None, data=None, params=None, auth=None, cookies=None, hooks=None, json=None): self.prepare_method(method) self.prepare_url(url, params) self.prepare_headers(headers) self.prepare_cookies(cookies) self.prepare_body(data, files, json) ...
def prepare_method(self, method): 'Prepares the given HTTP method.' self.method = method if (self.method is not None): self.method = to_native_string(self.method.upper())
-8,811,068,185,766,678,000
Prepares the given HTTP method.
src/oci/_vendor/requests/models.py
prepare_method
LaudateCorpus1/oci-python-sdk
python
def prepare_method(self, method): self.method = method if (self.method is not None): self.method = to_native_string(self.method.upper())
def prepare_url(self, url, params): 'Prepares the given HTTP URL.' if isinstance(url, bytes): url = url.decode('utf8') else: url = (unicode(url) if is_py2 else str(url)) url = url.lstrip() if ((':' in url) and (not url.lower().startswith('http'))): self.url = url retu...
-5,598,319,010,347,869,000
Prepares the given HTTP URL.
src/oci/_vendor/requests/models.py
prepare_url
LaudateCorpus1/oci-python-sdk
python
def prepare_url(self, url, params): if isinstance(url, bytes): url = url.decode('utf8') else: url = (unicode(url) if is_py2 else str(url)) url = url.lstrip() if ((':' in url) and (not url.lower().startswith('http'))): self.url = url return try: (scheme, a...
def prepare_headers(self, headers): 'Prepares the given HTTP headers.' self.headers = CaseInsensitiveDict() if headers: for header in headers.items(): check_header_validity(header) (name, value) = header self.headers[to_native_string(name)] = value
5,526,637,669,010,412,000
Prepares the given HTTP headers.
src/oci/_vendor/requests/models.py
prepare_headers
LaudateCorpus1/oci-python-sdk
python
def prepare_headers(self, headers): self.headers = CaseInsensitiveDict() if headers: for header in headers.items(): check_header_validity(header) (name, value) = header self.headers[to_native_string(name)] = value
def prepare_body(self, data, files, json=None): 'Prepares the given HTTP body data.' body = None content_type = None if ((not data) and (json is not None)): content_type = 'application/json' body = complexjson.dumps(json) if (not isinstance(body, bytes)): body = body....
2,758,324,703,423,574,000
Prepares the given HTTP body data.
src/oci/_vendor/requests/models.py
prepare_body
LaudateCorpus1/oci-python-sdk
python
def prepare_body(self, data, files, json=None): body = None content_type = None if ((not data) and (json is not None)): content_type = 'application/json' body = complexjson.dumps(json) if (not isinstance(body, bytes)): body = body.encode('utf-8') is_stream = all(...
def prepare_content_length(self, body): 'Prepare Content-Length header based on request method and body' if (body is not None): length = super_len(body) if length: self.headers['Content-Length'] = builtin_str(length) elif ((self.method not in ('GET', 'HEAD')) and (self.headers.ge...
-1,581,070,182,644,072,400
Prepare Content-Length header based on request method and body
src/oci/_vendor/requests/models.py
prepare_content_length
LaudateCorpus1/oci-python-sdk
python
def prepare_content_length(self, body): if (body is not None): length = super_len(body) if length: self.headers['Content-Length'] = builtin_str(length) elif ((self.method not in ('GET', 'HEAD')) and (self.headers.get('Content-Length') is None)): self.headers['Content-Len...