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 |
|---|---|---|---|---|---|---|---|
@victims.setter
def victims(self, victims):
'Sets the victims of this CredentialSetSchemaData.\n\n List of purported victims. # noqa: E501\n\n :param victims: The victims of this CredentialSetSchemaData. # noqa: E501\n :type victims: list[CredentialSetSchemaDataVictims]\n '
self._v... | -6,781,148,290,898,929,000 | Sets the victims of this CredentialSetSchemaData.
List of purported victims. # noqa: E501
:param victims: The victims of this CredentialSetSchemaData. # noqa: E501
:type victims: list[CredentialSetSchemaDataVictims] | titan_client/models/credential_set_schema_data.py | victims | intel471/titan-client-python | python | @victims.setter
def victims(self, victims):
'Sets the victims of this CredentialSetSchemaData.\n\n List of purported victims. # noqa: E501\n\n :param victims: The victims of this CredentialSetSchemaData. # noqa: E501\n :type victims: list[CredentialSetSchemaDataVictims]\n '
self._v... |
def to_dict(self, serialize=False):
'Returns the model properties as a dict'
result = {}
def convert(x):
if hasattr(x, 'to_dict'):
args = getfullargspec(x.to_dict).args
if (len(args) == 1):
return x.to_dict()
else:
return x.to_dict... | -1,664,115,404,714,547,500 | Returns the model properties as a dict | titan_client/models/credential_set_schema_data.py | to_dict | intel471/titan-client-python | python | def to_dict(self, serialize=False):
result = {}
def convert(x):
if hasattr(x, 'to_dict'):
args = getfullargspec(x.to_dict).args
if (len(args) == 1):
return x.to_dict()
else:
return x.to_dict(serialize)
else:
re... |
def to_str(self):
'Returns the string representation of the model'
return pprint.pformat(self.to_dict()) | 5,849,158,643,760,736,000 | Returns the string representation of the model | titan_client/models/credential_set_schema_data.py | to_str | intel471/titan-client-python | python | def to_str(self):
return pprint.pformat(self.to_dict()) |
def __repr__(self):
'For `print` and `pprint`'
return self.to_str() | -8,960,031,694,814,905,000 | For `print` and `pprint` | titan_client/models/credential_set_schema_data.py | __repr__ | intel471/titan-client-python | python | def __repr__(self):
return self.to_str() |
def __eq__(self, other):
'Returns true if both objects are equal'
if (not isinstance(other, CredentialSetSchemaData)):
return False
return (self.to_dict() == other.to_dict()) | -3,107,021,995,298,215,400 | Returns true if both objects are equal | titan_client/models/credential_set_schema_data.py | __eq__ | intel471/titan-client-python | python | def __eq__(self, other):
if (not isinstance(other, CredentialSetSchemaData)):
return False
return (self.to_dict() == other.to_dict()) |
def __ne__(self, other):
'Returns true if both objects are not equal'
if (not isinstance(other, CredentialSetSchemaData)):
return True
return (self.to_dict() != other.to_dict()) | -4,546,790,678,469,889,000 | Returns true if both objects are not equal | titan_client/models/credential_set_schema_data.py | __ne__ | intel471/titan-client-python | python | def __ne__(self, other):
if (not isinstance(other, CredentialSetSchemaData)):
return True
return (self.to_dict() != other.to_dict()) |
def solve1(buses, est):
'Get the earliest bus from the <buses> according to the <est>imate\n time. '
arrival = [(bus - (est % bus)) for bus in buses]
earliest = min(arrival)
return (min(arrival) * buses[arrival.index(earliest)]) | -3,282,658,681,182,208,000 | Get the earliest bus from the <buses> according to the <est>imate
time. | src/day13.py | solve1 | mfrdbigolin/AoC2020 | python | def solve1(buses, est):
'Get the earliest bus from the <buses> according to the <est>imate\n time. '
arrival = [(bus - (est % bus)) for bus in buses]
earliest = min(arrival)
return (min(arrival) * buses[arrival.index(earliest)]) |
def solve2(buses, depart):
'Find the smallest timestamp, such that all the <buses> follow their\n bus ID, which is indexically paired with <depart>.\n\n Here I used the Chinese Remainder Theorem, someone well acquainted to\n anyone who does competitive or discrete mathematics. '
mods = [((b - d) % b) ... | -6,611,917,787,805,794,000 | Find the smallest timestamp, such that all the <buses> follow their
bus ID, which is indexically paired with <depart>.
Here I used the Chinese Remainder Theorem, someone well acquainted to
anyone who does competitive or discrete mathematics. | src/day13.py | solve2 | mfrdbigolin/AoC2020 | python | def solve2(buses, depart):
'Find the smallest timestamp, such that all the <buses> follow their\n bus ID, which is indexically paired with <depart>.\n\n Here I used the Chinese Remainder Theorem, someone well acquainted to\n anyone who does competitive or discrete mathematics. '
mods = [((b - d) % b) ... |
@numba.jit(nopython=True, nogil=True, parallel=True)
def _numba_add(xx, yy, nn, cinf, x, y, z, w, typ, zw, varw, ww):
'\n numba jit compiled add function\n\n - Numba compiles this function, ensure that no classes/functions are within unless they are also numba-ized\n - Numba.prange forces numba to parallel... | -2,726,346,112,734,129,700 | numba jit compiled add function
- Numba compiles this function, ensure that no classes/functions are within unless they are also numba-ized
- Numba.prange forces numba to parallelize, generates exception when parallelism fails, helping you figure out
what needs to be fixed. Otherwise parallel=True can fail silent... | VGRID/vgrid.py | _numba_add | valschmidt/vgrid | python | @numba.jit(nopython=True, nogil=True, parallel=True)
def _numba_add(xx, yy, nn, cinf, x, y, z, w, typ, zw, varw, ww):
'\n numba jit compiled add function\n\n - Numba compiles this function, ensure that no classes/functions are within unless they are also numba-ized\n - Numba.prange forces numba to parallel... |
@numba.jit(nopython=True)
def _numba_median_by_cell(zw_cell, ww_cell, varw_cell, z):
' Calculate the median value in each grid cell.\n\n The method used here to provide a "running median" is for each add(),\n calculate the average of the existing value with the median of the\n new points. This method works... | 1,534,134,619,217,558,300 | Calculate the median value in each grid cell.
The method used here to provide a "running median" is for each add(),
calculate the average of the existing value with the median of the
new points. This method works reasonably well, but can produce
inferior results if a single add() contains only outliers and their
are i... | VGRID/vgrid.py | _numba_median_by_cell | valschmidt/vgrid | python | @numba.jit(nopython=True)
def _numba_median_by_cell(zw_cell, ww_cell, varw_cell, z):
' Calculate the median value in each grid cell.\n\n The method used here to provide a "running median" is for each add(),\n calculate the average of the existing value with the median of the\n new points. This method works... |
def zz(self):
' Calculate the z values for the grid.'
return (self.zw / self.ww) | -3,181,243,170,877,537,000 | Calculate the z values for the grid. | VGRID/vgrid.py | zz | valschmidt/vgrid | python | def zz(self):
' '
return (self.zw / self.ww) |
def mean_wholegrid(self):
' Calculate mean values for the whole grid.'
[self.mean(idx, jdx) for idx in range(self.yy.size) for jdx in range(self.xx.size) if (self._I[idx][jdx] is not None)] | 8,913,522,569,416,889,000 | Calculate mean values for the whole grid. | VGRID/vgrid.py | mean_wholegrid | valschmidt/vgrid | python | def mean_wholegrid(self):
' '
[self.mean(idx, jdx) for idx in range(self.yy.size) for jdx in range(self.xx.size) if (self._I[idx][jdx] is not None)] |
def median_wholegrid(self):
' Calculate median values for the whole grid.'
[self.median(idx, jdx) for idx in range(self.yy.size) for jdx in range(self.xx.size) if (self._I[idx][jdx] is not None)] | -3,475,235,760,687,923,700 | Calculate median values for the whole grid. | VGRID/vgrid.py | median_wholegrid | valschmidt/vgrid | python | def median_wholegrid(self):
' '
[self.median(idx, jdx) for idx in range(self.yy.size) for jdx in range(self.xx.size) if (self._I[idx][jdx] is not None)] |
def mean(self, idx, jdx):
'Mean gridding algorithm.\n\n vgrid implemnets incremental gridding where possible.\n To do this, the sum of the product of the weights and z values are\n retained in addition to the sum of the weights. Then method zz()\n calculates the quotient of the two to ob... | -1,551,458,373,005,666,000 | Mean gridding algorithm.
vgrid implemnets incremental gridding where possible.
To do this, the sum of the product of the weights and z values are
retained in addition to the sum of the weights. Then method zz()
calculates the quotient of the two to obtain the actual weighted
mean z values. Note that when all weights a... | VGRID/vgrid.py | mean | valschmidt/vgrid | python | def mean(self, idx, jdx):
'Mean gridding algorithm.\n\n vgrid implemnets incremental gridding where possible.\n To do this, the sum of the product of the weights and z values are\n retained in addition to the sum of the weights. Then method zz()\n calculates the quotient of the two to ob... |
def var(self):
' Calculate the variance'
return (self.varw / self.ww) | 8,553,262,426,190,962,000 | Calculate the variance | VGRID/vgrid.py | var | valschmidt/vgrid | python | def var(self):
' '
return (self.varw / self.ww) |
def std(self):
'Calculate the standard deviation'
return np.sqrt(self.var()) | -7,358,242,616,525,090,000 | Calculate the standard deviation | VGRID/vgrid.py | std | valschmidt/vgrid | python | def std(self):
return np.sqrt(self.var()) |
def meanwithoutlierrejection(self):
' TO DO: Calculate the mean, rejecting values that exceed 3-sigma\n from existing estimate.'
pass | 4,126,677,113,143,395,000 | TO DO: Calculate the mean, rejecting values that exceed 3-sigma
from existing estimate. | VGRID/vgrid.py | meanwithoutlierrejection | valschmidt/vgrid | python | def meanwithoutlierrejection(self):
' TO DO: Calculate the mean, rejecting values that exceed 3-sigma\n from existing estimate.'
pass |
def median(self, idx, jdx):
' Calculate the median value in each grid cell.\n \n The method used here to provide a "running median" is for each add(),\n calculate the average of the existing value with the median of the\n new points. This method works reasonably well, but can produce\n ... | -8,187,741,193,710,137,000 | Calculate the median value in each grid cell.
The method used here to provide a "running median" is for each add(),
calculate the average of the existing value with the median of the
new points. This method works reasonably well, but can produce
inferior results if a single add() contains only outliers and their
are i... | VGRID/vgrid.py | median | valschmidt/vgrid | python | def median(self, idx, jdx):
' Calculate the median value in each grid cell.\n \n The method used here to provide a "running median" is for each add(),\n calculate the average of the existing value with the median of the\n new points. This method works reasonably well, but can produce\n ... |
def gridsizesanitycheck(self, M):
'Check to see if the grid size is going to be REALLY large. '
if (M.__len__() > 10000.0):
return False
else:
return True | -5,416,826,466,113,330,000 | Check to see if the grid size is going to be REALLY large. | VGRID/vgrid.py | gridsizesanitycheck | valschmidt/vgrid | python | def gridsizesanitycheck(self, M):
' '
if (M.__len__() > 10000.0):
return False
else:
return True |
def create_new_grid(self):
' Create a new empty grid.'
self.xx = np.arange(min(self._x), (max(self._x) + self.cs), self.cs)
self.yy = np.arange(min(self._y), (max(self._y) + self.cs), self.cs)
if (not (self.gridsizesanitycheck(self.xx) and self.gridsizesanitycheck(self.yy))):
print('Grid size is... | -1,567,089,638,302,527,200 | Create a new empty grid. | VGRID/vgrid.py | create_new_grid | valschmidt/vgrid | python | def create_new_grid(self):
' '
self.xx = np.arange(min(self._x), (max(self._x) + self.cs), self.cs)
self.yy = np.arange(min(self._y), (max(self._y) + self.cs), self.cs)
if (not (self.gridsizesanitycheck(self.xx) and self.gridsizesanitycheck(self.yy))):
print('Grid size is too large.')
re... |
def add(self, x, y, z, w):
" An incremental gridding function\n\n Arguments:\n x: x-coordinates\n y: y-coordiantes\n z: z-scalar values to grid\n w: w-weight applied to each point (size of x or 1 for no weighting)\n When 'type' = Nlowerthan or Ngreaterthan, w i... | 6,376,264,592,654,362,000 | An incremental gridding function
Arguments:
x: x-coordinates
y: y-coordiantes
z: z-scalar values to grid
w: w-weight applied to each point (size of x or 1 for no weighting)
When 'type' = Nlowerthan or Ngreaterthan, w is the threshold value
When 'type' = distance weighted mean, distance = R^w
cs: gri... | VGRID/vgrid.py | add | valschmidt/vgrid | python | def add(self, x, y, z, w):
" An incremental gridding function\n\n Arguments:\n x: x-coordinates\n y: y-coordiantes\n z: z-scalar values to grid\n w: w-weight applied to each point (size of x or 1 for no weighting)\n When 'type' = Nlowerthan or Ngreaterthan, w i... |
def sort_data_kdtree(self):
' A sorting of the data into grid cells using KDtrees.'
tree = spatial.cKDTree(list(zip(self._x.ravel(), self._y.ravel())), leafsize=10000000.0)
(xxx, yyy) = np.meshgrid(self.xx, self.yy)
indexes = tree.query_ball_point(np.vstack((xxx.ravel(), yyy.ravel())).T, r=self.cinf, p=... | -8,088,798,651,022,963,000 | A sorting of the data into grid cells using KDtrees. | VGRID/vgrid.py | sort_data_kdtree | valschmidt/vgrid | python | def sort_data_kdtree(self):
' '
tree = spatial.cKDTree(list(zip(self._x.ravel(), self._y.ravel())), leafsize=10000000.0)
(xxx, yyy) = np.meshgrid(self.xx, self.yy)
indexes = tree.query_ball_point(np.vstack((xxx.ravel(), yyy.ravel())).T, r=self.cinf, p=2, n_jobs=(- 1)).reshape(xxx.shape)
self._I = in... |
def sort_data(self):
' Determine which data contributes to each grid node.\n The list of indices is populated in self._I[n][m], where n and m\n indicate the grid node.'
self._I = [x[:] for x in ([([None] * self.xx.size)] * self.yy.size)]
cinf2 = (self.cinf ** 2)
for idx in np.arange(0, sel... | -7,180,185,893,760,760,000 | Determine which data contributes to each grid node.
The list of indices is populated in self._I[n][m], where n and m
indicate the grid node. | VGRID/vgrid.py | sort_data | valschmidt/vgrid | python | def sort_data(self):
' Determine which data contributes to each grid node.\n The list of indices is populated in self._I[n][m], where n and m\n indicate the grid node.'
self._I = [x[:] for x in ([([None] * self.xx.size)] * self.yy.size)]
cinf2 = (self.cinf ** 2)
for idx in np.arange(0, sel... |
def numba_add(self, x, y, z, w, chnksize=100000):
"\n An attempt at running self.add with numba. Key here is to chunk the points so that the numba compiled function\n _numba_add runs multiple times, where the first run is slow as it compiles. _numba_add is not within the class,\n as classes a... | 7,784,261,836,886,096,000 | An attempt at running self.add with numba. Key here is to chunk the points so that the numba compiled function
_numba_add runs multiple times, where the first run is slow as it compiles. _numba_add is not within the class,
as classes aren't supported. There is this new thing numba.jitclass, but it appears to still b... | VGRID/vgrid.py | numba_add | valschmidt/vgrid | python | def numba_add(self, x, y, z, w, chnksize=100000):
"\n An attempt at running self.add with numba. Key here is to chunk the points so that the numba compiled function\n _numba_add runs multiple times, where the first run is slow as it compiles. _numba_add is not within the class,\n as classes a... |
def gridTest(N=2, ProfileON=False):
' Method to test gridding.'
print(('N=%d' % N))
x = (np.random.random((N, 1)) * 100)
y = (np.random.random((N, 1)) * 100)
z = np.exp((np.sqrt((((x - 50.0) ** 2) + ((y - 50.0) ** 2))) / 50))
G = vgrid(1, 1, 'mean')
if profileON:
print('Profiling on.... | 2,034,815,446,680,505,300 | Method to test gridding. | VGRID/vgrid.py | gridTest | valschmidt/vgrid | python | def gridTest(N=2, ProfileON=False):
' '
print(('N=%d' % N))
x = (np.random.random((N, 1)) * 100)
y = (np.random.random((N, 1)) * 100)
z = np.exp((np.sqrt((((x - 50.0) ** 2) + ((y - 50.0) ** 2))) / 50))
G = vgrid(1, 1, 'mean')
if profileON:
print('Profiling on.')
lp = LineProf... |
def setup_platform(hass, config, add_entities, discovery_info=None):
'Set up the Samsung TV platform.'
known_devices = hass.data.get(KNOWN_DEVICES_KEY)
if (known_devices is None):
known_devices = set()
hass.data[KNOWN_DEVICES_KEY] = known_devices
uuid = None
if (config.get(CONF_HOST)... | 7,478,801,825,985,793,000 | Set up the Samsung TV platform. | homeassistant/components/samsungtv/media_player.py | setup_platform | MagicalTrev89/home-assistant | python | def setup_platform(hass, config, add_entities, discovery_info=None):
known_devices = hass.data.get(KNOWN_DEVICES_KEY)
if (known_devices is None):
known_devices = set()
hass.data[KNOWN_DEVICES_KEY] = known_devices
uuid = None
if (config.get(CONF_HOST) is not None):
host = con... |
def __init__(self, host, port, name, timeout, mac, uuid):
'Initialize the Samsung device.'
from samsungctl import exceptions
from samsungctl import Remote
import wakeonlan
self._exceptions_class = exceptions
self._remote_class = Remote
self._name = name
self._mac = mac
self._uuid = u... | 5,848,817,460,881,256,000 | Initialize the Samsung device. | homeassistant/components/samsungtv/media_player.py | __init__ | MagicalTrev89/home-assistant | python | def __init__(self, host, port, name, timeout, mac, uuid):
from samsungctl import exceptions
from samsungctl import Remote
import wakeonlan
self._exceptions_class = exceptions
self._remote_class = Remote
self._name = name
self._mac = mac
self._uuid = uuid
self._wol = wakeonlan
... |
def update(self):
'Update state of device.'
self.send_key('KEY') | -2,328,262,338,321,575,400 | Update state of device. | homeassistant/components/samsungtv/media_player.py | update | MagicalTrev89/home-assistant | python | def update(self):
self.send_key('KEY') |
def get_remote(self):
'Create or return a remote control instance.'
if (self._remote is None):
self._remote = self._remote_class(self._config)
return self._remote | 6,487,959,911,410,992,000 | Create or return a remote control instance. | homeassistant/components/samsungtv/media_player.py | get_remote | MagicalTrev89/home-assistant | python | def get_remote(self):
if (self._remote is None):
self._remote = self._remote_class(self._config)
return self._remote |
def send_key(self, key):
'Send a key to the tv and handles exceptions.'
if (self._power_off_in_progress() and (key not in ('KEY_POWER', 'KEY_POWEROFF'))):
_LOGGER.info('TV is powering off, not sending command: %s', key)
return
try:
retry_count = 1
for _ in range((retry_count ... | -9,098,840,057,020,562,000 | Send a key to the tv and handles exceptions. | homeassistant/components/samsungtv/media_player.py | send_key | MagicalTrev89/home-assistant | python | def send_key(self, key):
if (self._power_off_in_progress() and (key not in ('KEY_POWER', 'KEY_POWEROFF'))):
_LOGGER.info('TV is powering off, not sending command: %s', key)
return
try:
retry_count = 1
for _ in range((retry_count + 1)):
try:
self.g... |
@property
def unique_id(self) -> str:
'Return the unique ID of the device.'
return self._uuid | 1,727,077,770,470,627,600 | Return the unique ID of the device. | homeassistant/components/samsungtv/media_player.py | unique_id | MagicalTrev89/home-assistant | python | @property
def unique_id(self) -> str:
return self._uuid |
@property
def name(self):
'Return the name of the device.'
return self._name | -4,231,536,673,663,769,600 | Return the name of the device. | homeassistant/components/samsungtv/media_player.py | name | MagicalTrev89/home-assistant | python | @property
def name(self):
return self._name |
@property
def state(self):
'Return the state of the device.'
return self._state | -1,086,931,682,847,915,500 | Return the state of the device. | homeassistant/components/samsungtv/media_player.py | state | MagicalTrev89/home-assistant | python | @property
def state(self):
return self._state |
@property
def is_volume_muted(self):
'Boolean if volume is currently muted.'
return self._muted | 7,300,793,638,546,656,000 | Boolean if volume is currently muted. | homeassistant/components/samsungtv/media_player.py | is_volume_muted | MagicalTrev89/home-assistant | python | @property
def is_volume_muted(self):
return self._muted |
@property
def source_list(self):
'List of available input sources.'
return list(SOURCES) | -9,049,588,076,648,536,000 | List of available input sources. | homeassistant/components/samsungtv/media_player.py | source_list | MagicalTrev89/home-assistant | python | @property
def source_list(self):
return list(SOURCES) |
@property
def supported_features(self):
'Flag media player features that are supported.'
if self._mac:
return (SUPPORT_SAMSUNGTV | SUPPORT_TURN_ON)
return SUPPORT_SAMSUNGTV | 7,980,298,372,656,887,000 | Flag media player features that are supported. | homeassistant/components/samsungtv/media_player.py | supported_features | MagicalTrev89/home-assistant | python | @property
def supported_features(self):
if self._mac:
return (SUPPORT_SAMSUNGTV | SUPPORT_TURN_ON)
return SUPPORT_SAMSUNGTV |
def turn_off(self):
'Turn off media player.'
self._end_of_power_off = (dt_util.utcnow() + timedelta(seconds=15))
if (self._config['method'] == 'websocket'):
self.send_key('KEY_POWER')
else:
self.send_key('KEY_POWEROFF')
try:
self.get_remote().close()
self._remote = No... | 4,279,632,299,341,431,000 | Turn off media player. | homeassistant/components/samsungtv/media_player.py | turn_off | MagicalTrev89/home-assistant | python | def turn_off(self):
self._end_of_power_off = (dt_util.utcnow() + timedelta(seconds=15))
if (self._config['method'] == 'websocket'):
self.send_key('KEY_POWER')
else:
self.send_key('KEY_POWEROFF')
try:
self.get_remote().close()
self._remote = None
except OSError:
... |
def volume_up(self):
'Volume up the media player.'
self.send_key('KEY_VOLUP') | 559,289,289,374,248,450 | Volume up the media player. | homeassistant/components/samsungtv/media_player.py | volume_up | MagicalTrev89/home-assistant | python | def volume_up(self):
self.send_key('KEY_VOLUP') |
def volume_down(self):
'Volume down media player.'
self.send_key('KEY_VOLDOWN') | 7,823,773,795,804,483,000 | Volume down media player. | homeassistant/components/samsungtv/media_player.py | volume_down | MagicalTrev89/home-assistant | python | def volume_down(self):
self.send_key('KEY_VOLDOWN') |
def mute_volume(self, mute):
'Send mute command.'
self.send_key('KEY_MUTE') | -5,766,217,316,642,036,000 | Send mute command. | homeassistant/components/samsungtv/media_player.py | mute_volume | MagicalTrev89/home-assistant | python | def mute_volume(self, mute):
self.send_key('KEY_MUTE') |
def media_play_pause(self):
'Simulate play pause media player.'
if self._playing:
self.media_pause()
else:
self.media_play() | 5,424,839,084,411,945,000 | Simulate play pause media player. | homeassistant/components/samsungtv/media_player.py | media_play_pause | MagicalTrev89/home-assistant | python | def media_play_pause(self):
if self._playing:
self.media_pause()
else:
self.media_play() |
def media_play(self):
'Send play command.'
self._playing = True
self.send_key('KEY_PLAY') | -4,624,043,560,243,361,000 | Send play command. | homeassistant/components/samsungtv/media_player.py | media_play | MagicalTrev89/home-assistant | python | def media_play(self):
self._playing = True
self.send_key('KEY_PLAY') |
def media_pause(self):
'Send media pause command to media player.'
self._playing = False
self.send_key('KEY_PAUSE') | -4,419,400,526,847,819,000 | Send media pause command to media player. | homeassistant/components/samsungtv/media_player.py | media_pause | MagicalTrev89/home-assistant | python | def media_pause(self):
self._playing = False
self.send_key('KEY_PAUSE') |
def media_next_track(self):
'Send next track command.'
self.send_key('KEY_FF') | 7,350,569,723,410,886,000 | Send next track command. | homeassistant/components/samsungtv/media_player.py | media_next_track | MagicalTrev89/home-assistant | python | def media_next_track(self):
self.send_key('KEY_FF') |
def media_previous_track(self):
'Send the previous track command.'
self.send_key('KEY_REWIND') | -6,217,111,541,976,905,000 | Send the previous track command. | homeassistant/components/samsungtv/media_player.py | media_previous_track | MagicalTrev89/home-assistant | python | def media_previous_track(self):
self.send_key('KEY_REWIND') |
async def async_play_media(self, media_type, media_id, **kwargs):
'Support changing a channel.'
if (media_type != MEDIA_TYPE_CHANNEL):
_LOGGER.error('Unsupported media type')
return
try:
cv.positive_int(media_id)
except vol.Invalid:
_LOGGER.error('Media ID must be positiv... | 922,428,579,967,757,400 | Support changing a channel. | homeassistant/components/samsungtv/media_player.py | async_play_media | MagicalTrev89/home-assistant | python | async def async_play_media(self, media_type, media_id, **kwargs):
if (media_type != MEDIA_TYPE_CHANNEL):
_LOGGER.error('Unsupported media type')
return
try:
cv.positive_int(media_id)
except vol.Invalid:
_LOGGER.error('Media ID must be positive integer')
return
... |
def turn_on(self):
'Turn the media player on.'
if self._mac:
self._wol.send_magic_packet(self._mac)
else:
self.send_key('KEY_POWERON') | -8,216,487,931,362,533,000 | Turn the media player on. | homeassistant/components/samsungtv/media_player.py | turn_on | MagicalTrev89/home-assistant | python | def turn_on(self):
if self._mac:
self._wol.send_magic_packet(self._mac)
else:
self.send_key('KEY_POWERON') |
async def async_select_source(self, source):
'Select input source.'
if (source not in SOURCES):
_LOGGER.error('Unsupported source')
return
(await self.hass.async_add_job(self.send_key, SOURCES[source])) | 2,872,646,657,564,179,500 | Select input source. | homeassistant/components/samsungtv/media_player.py | async_select_source | MagicalTrev89/home-assistant | python | async def async_select_source(self, source):
if (source not in SOURCES):
_LOGGER.error('Unsupported source')
return
(await self.hass.async_add_job(self.send_key, SOURCES[source])) |
def GenerateConfig(context):
'Generate configuration.'
base_name = context.env['name']
instance = {'zone': context.properties['zone'], 'machineType': ZonalComputeUrl(context.env['project'], context.properties['zone'], 'machineTypes', 'f1-micro'), 'metadata': {'items': [{'key': 'gce-container-declaration', '... | -2,596,707,007,980,729,300 | Generate configuration. | templates/container_vm.py | GenerateConfig | AlexBulankou/dm-logbook-sample | python | def GenerateConfig(context):
base_name = context.env['name']
instance = {'zone': context.properties['zone'], 'machineType': ZonalComputeUrl(context.env['project'], context.properties['zone'], 'machineTypes', 'f1-micro'), 'metadata': {'items': [{'key': 'gce-container-declaration', 'value': GenerateManifest(... |
def __init__(self, server_port=None):
'Initialize.\n\n :param server_port: Int. local port.\n '
self.server_port = server_port
self.logged_requests = {}
self.analysis = {'total_requests': 0, 'domains': set(), 'duration': 0} | -7,691,464,755,553,936,000 | Initialize.
:param server_port: Int. local port. | monitor_requests/data.py | __init__ | danpozmanter/monitor_requests | python | def __init__(self, server_port=None):
'Initialize.\n\n :param server_port: Int. local port.\n '
self.server_port = server_port
self.logged_requests = {}
self.analysis = {'total_requests': 0, 'domains': set(), 'duration': 0} |
def delete(self):
'Delete data from server if applicable.'
if (not self.server_port):
return
self._delete() | -1,416,033,866,173,989,000 | Delete data from server if applicable. | monitor_requests/data.py | delete | danpozmanter/monitor_requests | python | def delete(self):
if (not self.server_port):
return
self._delete() |
def log(self, url, domain, method, response, tb_list, duration):
'Log request, store traceback/response data and update counts.'
if self.server_port:
self._post({'url': url, 'domain': domain, 'method': method, 'response_content': str(response.content), 'response_status_code': response.status_code, 'dura... | 6,867,242,971,886,877,000 | Log request, store traceback/response data and update counts. | monitor_requests/data.py | log | danpozmanter/monitor_requests | python | def log(self, url, domain, method, response, tb_list, duration):
if self.server_port:
self._post({'url': url, 'domain': domain, 'method': method, 'response_content': str(response.content), 'response_status_code': response.status_code, 'duration': duration, 'traceback_list': tb_list})
else:
... |
def retrieve(self):
'Retrieve data from server or instance.'
if (not self.server_port):
return (self.logged_requests, self.analysis)
data = self._get()
return (data.get('logged_requests'), data.get('analysis')) | 9,150,144,056,110,489,000 | Retrieve data from server or instance. | monitor_requests/data.py | retrieve | danpozmanter/monitor_requests | python | def retrieve(self):
if (not self.server_port):
return (self.logged_requests, self.analysis)
data = self._get()
return (data.get('logged_requests'), data.get('analysis')) |
def has_perm(self, perm, obj=None):
'Does the user have a specific permission?'
return True | -9,084,859,824,158,067,000 | Does the user have a specific permission? | dentalapp-backend/dentalapp/userauth/models.py | has_perm | PavelescuVictor/DentalApplication | python | def has_perm(self, perm, obj=None):
return True |
def has_module_perms(self, app_label):
'Does the user have permissions to view the app `app_label`?'
return True | 4,992,969,413,468,943,000 | Does the user have permissions to view the app `app_label`? | dentalapp-backend/dentalapp/userauth/models.py | has_module_perms | PavelescuVictor/DentalApplication | python | def has_module_perms(self, app_label):
return True |
def get_args():
' Get args from stdin.\n\n The common options are defined in the object\n libs.nnet3.train.common.CommonParser.parser.\n See steps/libs/nnet3/train/common.py\n '
parser = argparse.ArgumentParser(description='Trains a feed forward raw DNN (without transition model)\n using fram... | 3,313,513,404,749,398,000 | Get args from stdin.
The common options are defined in the object
libs.nnet3.train.common.CommonParser.parser.
See steps/libs/nnet3/train/common.py | egs/wsj/s5/steps/nnet3/train_raw_dnn.py | get_args | iezhanqingran/kaldi | python | def get_args():
' Get args from stdin.\n\n The common options are defined in the object\n libs.nnet3.train.common.CommonParser.parser.\n See steps/libs/nnet3/train/common.py\n '
parser = argparse.ArgumentParser(description='Trains a feed forward raw DNN (without transition model)\n using fram... |
def process_args(args):
' Process the options got from get_args()\n '
if (args.frames_per_eg < 1):
raise Exception('--egs.frames-per-eg should have a minimum value of 1')
if (not common_train_lib.validate_minibatch_size_str(args.minibatch_size)):
raise Exception('--trainer.optimization.mi... | 5,270,192,292,623,299,000 | Process the options got from get_args() | egs/wsj/s5/steps/nnet3/train_raw_dnn.py | process_args | iezhanqingran/kaldi | python | def process_args(args):
' \n '
if (args.frames_per_eg < 1):
raise Exception('--egs.frames-per-eg should have a minimum value of 1')
if (not common_train_lib.validate_minibatch_size_str(args.minibatch_size)):
raise Exception('--trainer.optimization.minibatch-size has an invalid value')
... |
def train(args, run_opts):
' The main function for training.\n\n Args:\n args: a Namespace object with the required parameters\n obtained from the function process_args()\n run_opts: RunOpts object obtained from the process_args()\n '
arg_string = pprint.pformat(vars(args))
lo... | 2,651,687,824,782,216,700 | The main function for training.
Args:
args: a Namespace object with the required parameters
obtained from the function process_args()
run_opts: RunOpts object obtained from the process_args() | egs/wsj/s5/steps/nnet3/train_raw_dnn.py | train | iezhanqingran/kaldi | python | def train(args, run_opts):
' The main function for training.\n\n Args:\n args: a Namespace object with the required parameters\n obtained from the function process_args()\n run_opts: RunOpts object obtained from the process_args()\n '
arg_string = pprint.pformat(vars(args))
lo... |
def mock_get_activity_streams(streams_file):
"\n @TODO: I needed to mock the behavior the `stravalib.client.get_activity_streams`,\n it isn't the best alternative for mock the request from strava by passing a json file.\n "
stream_mock = MockResponse(streams_file).json()
entities = {}
for (key,... | -8,311,206,817,446,089,000 | @TODO: I needed to mock the behavior the `stravalib.client.get_activity_streams`,
it isn't the best alternative for mock the request from strava by passing a json file. | runpandas/tests/test_strava_parser.py | mock_get_activity_streams | bitner/runpandas | python | def mock_get_activity_streams(streams_file):
"\n @TODO: I needed to mock the behavior the `stravalib.client.get_activity_streams`,\n it isn't the best alternative for mock the request from strava by passing a json file.\n "
stream_mock = MockResponse(streams_file).json()
entities = {}
for (key,... |
@RunIf(min_gpus=2, deepspeed=True, standalone=True)
def test_deepspeed_collate_checkpoint(tmpdir):
'Test to ensure that with DeepSpeed Stage 3 we can collate the sharded checkpoints into a single file.'
model = BoringModel()
trainer = Trainer(default_root_dir=tmpdir, strategy=DeepSpeedStrategy(stage=3), gpu... | 6,974,235,595,776,155,000 | Test to ensure that with DeepSpeed Stage 3 we can collate the sharded checkpoints into a single file. | tests/utilities/test_deepspeed_collate_checkpoint.py | test_deepspeed_collate_checkpoint | Borda/pytorch-lightning | python | @RunIf(min_gpus=2, deepspeed=True, standalone=True)
def test_deepspeed_collate_checkpoint(tmpdir):
model = BoringModel()
trainer = Trainer(default_root_dir=tmpdir, strategy=DeepSpeedStrategy(stage=3), gpus=2, fast_dev_run=True, precision=16)
trainer.fit(model)
checkpoint_path = os.path.join(tmpdir,... |
@property
def ExperimenterData(self):
'NOT DEFINED\n\n\t\tReturns:\n\t\t\tstr\n\t\t'
return self._get_attribute('experimenterData') | 3,597,934,062,364,696,000 | NOT DEFINED
Returns:
str | RestPy/ixnetwork_restpy/testplatform/sessions/ixnetwork/vport/protocols/openflow/writeactionsmisslearnedinfo.py | ExperimenterData | kakkotetsu/IxNetwork | python | @property
def ExperimenterData(self):
'NOT DEFINED\n\n\t\tReturns:\n\t\t\tstr\n\t\t'
return self._get_attribute('experimenterData') |
@property
def ExperimenterDataLength(self):
'NOT DEFINED\n\n\t\tReturns:\n\t\t\tnumber\n\t\t'
return self._get_attribute('experimenterDataLength') | -5,109,781,219,003,124,000 | NOT DEFINED
Returns:
number | RestPy/ixnetwork_restpy/testplatform/sessions/ixnetwork/vport/protocols/openflow/writeactionsmisslearnedinfo.py | ExperimenterDataLength | kakkotetsu/IxNetwork | python | @property
def ExperimenterDataLength(self):
'NOT DEFINED\n\n\t\tReturns:\n\t\t\tnumber\n\t\t'
return self._get_attribute('experimenterDataLength') |
@property
def ExperimenterId(self):
'NOT DEFINED\n\n\t\tReturns:\n\t\t\tnumber\n\t\t'
return self._get_attribute('experimenterId') | -575,094,733,073,153,400 | NOT DEFINED
Returns:
number | RestPy/ixnetwork_restpy/testplatform/sessions/ixnetwork/vport/protocols/openflow/writeactionsmisslearnedinfo.py | ExperimenterId | kakkotetsu/IxNetwork | python | @property
def ExperimenterId(self):
'NOT DEFINED\n\n\t\tReturns:\n\t\t\tnumber\n\t\t'
return self._get_attribute('experimenterId') |
@property
def NextTableIds(self):
'NOT DEFINED\n\n\t\tReturns:\n\t\t\tstr\n\t\t'
return self._get_attribute('nextTableIds') | -2,984,752,472,315,336,700 | NOT DEFINED
Returns:
str | RestPy/ixnetwork_restpy/testplatform/sessions/ixnetwork/vport/protocols/openflow/writeactionsmisslearnedinfo.py | NextTableIds | kakkotetsu/IxNetwork | python | @property
def NextTableIds(self):
'NOT DEFINED\n\n\t\tReturns:\n\t\t\tstr\n\t\t'
return self._get_attribute('nextTableIds') |
@property
def Property(self):
'NOT DEFINED\n\n\t\tReturns:\n\t\t\tstr\n\t\t'
return self._get_attribute('property') | 8,491,170,648,330,608,000 | NOT DEFINED
Returns:
str | RestPy/ixnetwork_restpy/testplatform/sessions/ixnetwork/vport/protocols/openflow/writeactionsmisslearnedinfo.py | Property | kakkotetsu/IxNetwork | python | @property
def Property(self):
'NOT DEFINED\n\n\t\tReturns:\n\t\t\tstr\n\t\t'
return self._get_attribute('property') |
@property
def SupportedField(self):
'NOT DEFINED\n\n\t\tReturns:\n\t\t\tstr\n\t\t'
return self._get_attribute('supportedField') | -1,446,900,343,078,529,300 | NOT DEFINED
Returns:
str | RestPy/ixnetwork_restpy/testplatform/sessions/ixnetwork/vport/protocols/openflow/writeactionsmisslearnedinfo.py | SupportedField | kakkotetsu/IxNetwork | python | @property
def SupportedField(self):
'NOT DEFINED\n\n\t\tReturns:\n\t\t\tstr\n\t\t'
return self._get_attribute('supportedField') |
def find(self, ExperimenterData=None, ExperimenterDataLength=None, ExperimenterId=None, NextTableIds=None, Property=None, SupportedField=None):
'Finds and retrieves writeActionsMissLearnedInfo data from the server.\n\n\t\tAll named parameters support regex and can be used to selectively retrieve writeActionsMissLea... | -6,545,267,429,349,218,000 | Finds and retrieves writeActionsMissLearnedInfo data from the server.
All named parameters support regex and can be used to selectively retrieve writeActionsMissLearnedInfo data from the server.
By default the find method takes no parameters and will retrieve all writeActionsMissLearnedInfo data from the server.
Args... | RestPy/ixnetwork_restpy/testplatform/sessions/ixnetwork/vport/protocols/openflow/writeactionsmisslearnedinfo.py | find | kakkotetsu/IxNetwork | python | def find(self, ExperimenterData=None, ExperimenterDataLength=None, ExperimenterId=None, NextTableIds=None, Property=None, SupportedField=None):
'Finds and retrieves writeActionsMissLearnedInfo data from the server.\n\n\t\tAll named parameters support regex and can be used to selectively retrieve writeActionsMissLea... |
def read(self, href):
'Retrieves a single instance of writeActionsMissLearnedInfo data from the server.\n\n\t\tArgs:\n\t\t\thref (str): An href to the instance to be retrieved\n\n\t\tReturns:\n\t\t\tself: This instance with the writeActionsMissLearnedInfo data from the server available through an iterator or index\... | 3,049,726,136,629,737,500 | Retrieves a single instance of writeActionsMissLearnedInfo data from the server.
Args:
href (str): An href to the instance to be retrieved
Returns:
self: This instance with the writeActionsMissLearnedInfo data from the server available through an iterator or index
Raises:
NotFoundError: The r... | RestPy/ixnetwork_restpy/testplatform/sessions/ixnetwork/vport/protocols/openflow/writeactionsmisslearnedinfo.py | read | kakkotetsu/IxNetwork | python | def read(self, href):
'Retrieves a single instance of writeActionsMissLearnedInfo data from the server.\n\n\t\tArgs:\n\t\t\thref (str): An href to the instance to be retrieved\n\n\t\tReturns:\n\t\t\tself: This instance with the writeActionsMissLearnedInfo data from the server available through an iterator or index\... |
def command_line_interface(root_path):
'\n A simple command-line interface for running a tool to resample a library of template spectra onto fixed\n logarithmic rasters representing each of the 4MOST arms.\n\n We use the python argparse module to build the interface, and return the inputs supplied by the u... | -1,154,686,518,924,430,000 | A simple command-line interface for running a tool to resample a library of template spectra onto fixed
logarithmic rasters representing each of the 4MOST arms.
We use the python argparse module to build the interface, and return the inputs supplied by the user.
:param root_path:
The root path of this 4GP install... | src/pythonModules/fourgp_rv/fourgp_rv/templates_resample.py | command_line_interface | dcf21/4most-4gp | python | def command_line_interface(root_path):
'\n A simple command-line interface for running a tool to resample a library of template spectra onto fixed\n logarithmic rasters representing each of the 4MOST arms.\n\n We use the python argparse module to build the interface, and return the inputs supplied by the u... |
def logarithmic_raster(lambda_min, lambda_max, lambda_step):
'\n Create a logarithmic raster with a fixed logarithmic stride, based on a starting wavelength, finishing wavelength,\n and a mean wavelength step.\n\n :param lambda_min:\n Smallest wavelength in raster.\n :param lambda_max:\n L... | 6,637,842,274,579,725,000 | Create a logarithmic raster with a fixed logarithmic stride, based on a starting wavelength, finishing wavelength,
and a mean wavelength step.
:param lambda_min:
Smallest wavelength in raster.
:param lambda_max:
Largest wavelength in raster.
:param lambda_step:
The approximate pixel size in the raster.
:re... | src/pythonModules/fourgp_rv/fourgp_rv/templates_resample.py | logarithmic_raster | dcf21/4most-4gp | python | def logarithmic_raster(lambda_min, lambda_max, lambda_step):
'\n Create a logarithmic raster with a fixed logarithmic stride, based on a starting wavelength, finishing wavelength,\n and a mean wavelength step.\n\n :param lambda_min:\n Smallest wavelength in raster.\n :param lambda_max:\n L... |
def resample_templates(args, logger):
'\n Resample a spectrum library of templates onto a fixed logarithmic stride, representing each of the 4MOST arms in\n turn. We use 4FS to down-sample the templates to the resolution of 4MOST observations, and automatically detect\n the list of arms contained within ea... | -6,798,017,792,568,985,000 | Resample a spectrum library of templates onto a fixed logarithmic stride, representing each of the 4MOST arms in
turn. We use 4FS to down-sample the templates to the resolution of 4MOST observations, and automatically detect
the list of arms contained within each 4FS mock observation. We then resample the 4FS output on... | src/pythonModules/fourgp_rv/fourgp_rv/templates_resample.py | resample_templates | dcf21/4most-4gp | python | def resample_templates(args, logger):
'\n Resample a spectrum library of templates onto a fixed logarithmic stride, representing each of the 4MOST arms in\n turn. We use 4FS to down-sample the templates to the resolution of 4MOST observations, and automatically detect\n the list of arms contained within ea... |
def reset(self):
" Reset detectors\n\n Resets statistics and adwin's window.\n\n Returns\n -------\n ADWIN\n self\n\n "
self.__init__(delta=self.delta) | 3,523,812,558,410,450,000 | Reset detectors
Resets statistics and adwin's window.
Returns
-------
ADWIN
self | src/skmultiflow/drift_detection/adwin.py | reset | denisesato/scikit-multiflow | python | def reset(self):
" Reset detectors\n\n Resets statistics and adwin's window.\n\n Returns\n -------\n ADWIN\n self\n\n "
self.__init__(delta=self.delta) |
def get_change(self):
' Get drift\n\n Returns\n -------\n bool\n Whether or not a drift occurred\n\n '
return self.bln_bucket_deleted | 5,362,007,572,281,735,000 | Get drift
Returns
-------
bool
Whether or not a drift occurred | src/skmultiflow/drift_detection/adwin.py | get_change | denisesato/scikit-multiflow | python | def get_change(self):
' Get drift\n\n Returns\n -------\n bool\n Whether or not a drift occurred\n\n '
return self.bln_bucket_deleted |
def __init_buckets(self):
" Initialize the bucket's List and statistics\n\n Set all statistics to 0 and create a new bucket List.\n\n "
self.list_row_bucket = List()
self.last_bucket_row = 0
self._total = 0
self._variance = 0
self._width = 0
self.bucket_number = 0 | 1,576,856,208,439,225,900 | Initialize the bucket's List and statistics
Set all statistics to 0 and create a new bucket List. | src/skmultiflow/drift_detection/adwin.py | __init_buckets | denisesato/scikit-multiflow | python | def __init_buckets(self):
" Initialize the bucket's List and statistics\n\n Set all statistics to 0 and create a new bucket List.\n\n "
self.list_row_bucket = List()
self.last_bucket_row = 0
self._total = 0
self._variance = 0
self._width = 0
self.bucket_number = 0 |
def add_element(self, value):
" Add a new element to the sample window.\n\n Apart from adding the element value to the window, by inserting it in\n the correct bucket, it will also update the relevant statistics, in\n this case the total sum of all values, the window width and the total\n ... | -116,700,837,709,506,830 | Add a new element to the sample window.
Apart from adding the element value to the window, by inserting it in
the correct bucket, it will also update the relevant statistics, in
this case the total sum of all values, the window width and the total
variance.
Parameters
----------
value: int or float (a numeric value)
... | src/skmultiflow/drift_detection/adwin.py | add_element | denisesato/scikit-multiflow | python | def add_element(self, value):
" Add a new element to the sample window.\n\n Apart from adding the element value to the window, by inserting it in\n the correct bucket, it will also update the relevant statistics, in\n this case the total sum of all values, the window width and the total\n ... |
def delete_element(self):
' Delete an Item from the bucket list.\n\n Deletes the last Item and updates relevant statistics kept by ADWIN.\n\n Returns\n -------\n int\n The bucket size from the updated bucket\n\n '
node = self.list_row_bucket.last
n1 = self.bucke... | -1,062,732,316,874,703,100 | Delete an Item from the bucket list.
Deletes the last Item and updates relevant statistics kept by ADWIN.
Returns
-------
int
The bucket size from the updated bucket | src/skmultiflow/drift_detection/adwin.py | delete_element | denisesato/scikit-multiflow | python | def delete_element(self):
' Delete an Item from the bucket list.\n\n Deletes the last Item and updates relevant statistics kept by ADWIN.\n\n Returns\n -------\n int\n The bucket size from the updated bucket\n\n '
node = self.list_row_bucket.last
n1 = self.bucke... |
def detected_change(self):
" Detects concept change in a drifting data stream.\n\n The ADWIN algorithm is described in Bifet and Gavaldà's 'Learning from\n Time-Changing Data with Adaptive Windowing'. The general idea is to keep\n statistics from a window of variable size while detecting concep... | 5,073,971,440,688,084,000 | Detects concept change in a drifting data stream.
The ADWIN algorithm is described in Bifet and Gavaldà's 'Learning from
Time-Changing Data with Adaptive Windowing'. The general idea is to keep
statistics from a window of variable size while detecting concept drift.
This function is responsible for analysing differen... | src/skmultiflow/drift_detection/adwin.py | detected_change | denisesato/scikit-multiflow | python | def detected_change(self):
" Detects concept change in a drifting data stream.\n\n The ADWIN algorithm is described in Bifet and Gavaldà's 'Learning from\n Time-Changing Data with Adaptive Windowing'. The general idea is to keep\n statistics from a window of variable size while detecting concep... |
def reset(self):
" Reset the algorithm's statistics and window\n\n Returns\n -------\n ADWIN\n self\n\n "
self.bucket_size_row = 0
for i in range((ADWIN.MAX_BUCKETS + 1)):
self.__clear_buckets(i)
return self | 1,662,833,394,584,415,000 | Reset the algorithm's statistics and window
Returns
-------
ADWIN
self | src/skmultiflow/drift_detection/adwin.py | reset | denisesato/scikit-multiflow | python | def reset(self):
" Reset the algorithm's statistics and window\n\n Returns\n -------\n ADWIN\n self\n\n "
self.bucket_size_row = 0
for i in range((ADWIN.MAX_BUCKETS + 1)):
self.__clear_buckets(i)
return self |
def set_dof(self, dof_value_map):
'\n dof_value_map: A dict that maps robot attribute name to a list of corresponding values\n '
if (not isinstance(self._geom, Robot)):
return
dof_val = self.env_body.GetActiveDOFValues()
for (k, v) in dof_value_map.items():
if ((k not i... | -6,041,207,392,714,247,000 | dof_value_map: A dict that maps robot attribute name to a list of corresponding values | opentamp/src/core/util_classes/no_openrave_body.py | set_dof | Algorithmic-Alignment-Lab/OpenTAMP | python | def set_dof(self, dof_value_map):
'\n \n '
if (not isinstance(self._geom, Robot)):
return
dof_val = self.env_body.GetActiveDOFValues()
for (k, v) in dof_value_map.items():
if ((k not in self._geom.dof_map) or np.any(np.isnan(v))):
continue
inds = sel... |
def _set_active_dof_inds(self, inds=None):
'\n Set active dof index to the one we are interested\n This function is implemented to simplify jacobian calculation in the CollisionPredicate\n inds: Optional list of index specifying dof index we are interested in\n '
robot = self.env_bod... | -5,458,568,516,933,556,000 | Set active dof index to the one we are interested
This function is implemented to simplify jacobian calculation in the CollisionPredicate
inds: Optional list of index specifying dof index we are interested in | opentamp/src/core/util_classes/no_openrave_body.py | _set_active_dof_inds | Algorithmic-Alignment-Lab/OpenTAMP | python | def _set_active_dof_inds(self, inds=None):
'\n Set active dof index to the one we are interested\n This function is implemented to simplify jacobian calculation in the CollisionPredicate\n inds: Optional list of index specifying dof index we are interested in\n '
robot = self.env_bod... |
def __init__(self, rate_tables=None):
'RateTableResponse - a model defined in Swagger'
self._rate_tables = None
self.discriminator = None
if (rate_tables is not None):
self.rate_tables = rate_tables | 9,004,336,416,813,501,000 | RateTableResponse - a model defined in Swagger | src/ebay_rest/api/sell_account/models/rate_table_response.py | __init__ | craiga/ebay_rest | python | def __init__(self, rate_tables=None):
self._rate_tables = None
self.discriminator = None
if (rate_tables is not None):
self.rate_tables = rate_tables |
@property
def rate_tables(self):
'Gets the rate_tables of this RateTableResponse. # noqa: E501\n\n A list of elements that provide information on the seller-defined shipping rate tables. # noqa: E501\n\n :return: The rate_tables of this RateTableResponse. # noqa: E501\n :rtype: list[RateTabl... | 5,818,470,464,169,381,000 | Gets the rate_tables of this RateTableResponse. # noqa: E501
A list of elements that provide information on the seller-defined shipping rate tables. # noqa: E501
:return: The rate_tables of this RateTableResponse. # noqa: E501
:rtype: list[RateTable] | src/ebay_rest/api/sell_account/models/rate_table_response.py | rate_tables | craiga/ebay_rest | python | @property
def rate_tables(self):
'Gets the rate_tables of this RateTableResponse. # noqa: E501\n\n A list of elements that provide information on the seller-defined shipping rate tables. # noqa: E501\n\n :return: The rate_tables of this RateTableResponse. # noqa: E501\n :rtype: list[RateTabl... |
@rate_tables.setter
def rate_tables(self, rate_tables):
'Sets the rate_tables of this RateTableResponse.\n\n A list of elements that provide information on the seller-defined shipping rate tables. # noqa: E501\n\n :param rate_tables: The rate_tables of this RateTableResponse. # noqa: E501\n :... | 205,337,510,896,969,600 | Sets the rate_tables of this RateTableResponse.
A list of elements that provide information on the seller-defined shipping rate tables. # noqa: E501
:param rate_tables: The rate_tables of this RateTableResponse. # noqa: E501
:type: list[RateTable] | src/ebay_rest/api/sell_account/models/rate_table_response.py | rate_tables | craiga/ebay_rest | python | @rate_tables.setter
def rate_tables(self, rate_tables):
'Sets the rate_tables of this RateTableResponse.\n\n A list of elements that provide information on the seller-defined shipping rate tables. # noqa: E501\n\n :param rate_tables: The rate_tables of this RateTableResponse. # noqa: E501\n :... |
def to_dict(self):
'Returns the model properties as a dict'
result = {}
for (attr, _) in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
e... | -8,185,449,808,055,180,000 | Returns the model properties as a dict | src/ebay_rest/api/sell_account/models/rate_table_response.py | to_dict | craiga/ebay_rest | python | def to_dict(self):
result = {}
for (attr, _) in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, 'to_dict'):
... |
def to_str(self):
'Returns the string representation of the model'
return pprint.pformat(self.to_dict()) | 5,849,158,643,760,736,000 | Returns the string representation of the model | src/ebay_rest/api/sell_account/models/rate_table_response.py | to_str | craiga/ebay_rest | python | def to_str(self):
return pprint.pformat(self.to_dict()) |
def __repr__(self):
'For `print` and `pprint`'
return self.to_str() | -8,960,031,694,814,905,000 | For `print` and `pprint` | src/ebay_rest/api/sell_account/models/rate_table_response.py | __repr__ | craiga/ebay_rest | python | def __repr__(self):
return self.to_str() |
def __eq__(self, other):
'Returns true if both objects are equal'
if (not isinstance(other, RateTableResponse)):
return False
return (self.__dict__ == other.__dict__) | -6,882,749,671,341,800,000 | Returns true if both objects are equal | src/ebay_rest/api/sell_account/models/rate_table_response.py | __eq__ | craiga/ebay_rest | python | def __eq__(self, other):
if (not isinstance(other, RateTableResponse)):
return False
return (self.__dict__ == other.__dict__) |
def __ne__(self, other):
'Returns true if both objects are not equal'
return (not (self == other)) | 7,764,124,047,908,058,000 | Returns true if both objects are not equal | src/ebay_rest/api/sell_account/models/rate_table_response.py | __ne__ | craiga/ebay_rest | python | def __ne__(self, other):
return (not (self == other)) |
def _check_before_run(self):
'Check if all files are available before going deeper'
if (not osp.exists(self.dataset_dir)):
raise RuntimeError("'{}' is not available".format(self.dataset_dir))
if (not osp.exists(self.train_dir)):
raise RuntimeError("'{}' is not available".format(self.train_di... | -3,003,780,492,068,818,000 | Check if all files are available before going deeper | torchreid/datasets/dukemtmcvidreid.py | _check_before_run | ArronHZG/ABD-Net | python | def _check_before_run(self):
if (not osp.exists(self.dataset_dir)):
raise RuntimeError("'{}' is not available".format(self.dataset_dir))
if (not osp.exists(self.train_dir)):
raise RuntimeError("'{}' is not available".format(self.train_dir))
if (not osp.exists(self.query_dir)):
r... |
def __init__(self, t_prof, eval_env_bldr, chief_handle, evaluator_name, log_conf_interval=False):
'\n Args:\n t_prof (TrainingProfile)\n chief_handle (class instance or ray ActorHandle)\n evaluator_name (str): Name of the evaluator\n '
super().__init... | 6,732,575,788,846,942,000 | Args:
t_prof (TrainingProfile)
chief_handle (class instance or ray ActorHandle)
evaluator_name (str): Name of the evaluator | PokerRL/eval/_/EvaluatorMasterBase.py | __init__ | EricSteinberger/DREAM | python | def __init__(self, t_prof, eval_env_bldr, chief_handle, evaluator_name, log_conf_interval=False):
'\n Args:\n t_prof (TrainingProfile)\n chief_handle (class instance or ray ActorHandle)\n evaluator_name (str): Name of the evaluator\n '
super().__init... |
@property
def is_multi_stack(self):
'\n Whether the agent is evaluated in games that start with different stack sizes each time.\n '
return self._is_multi_stack | 719,053,695,574,214,300 | Whether the agent is evaluated in games that start with different stack sizes each time. | PokerRL/eval/_/EvaluatorMasterBase.py | is_multi_stack | EricSteinberger/DREAM | python | @property
def is_multi_stack(self):
'\n \n '
return self._is_multi_stack |
def evaluate(self, iter_nr):
' Evaluate an agent and send the results as logs to the Chief. '
raise NotImplementedError | 2,693,691,242,665,896,400 | Evaluate an agent and send the results as logs to the Chief. | PokerRL/eval/_/EvaluatorMasterBase.py | evaluate | EricSteinberger/DREAM | python | def evaluate(self, iter_nr):
' '
raise NotImplementedError |
def update_weights(self):
' Update the local weights on the master, for instance by calling .pull_current_strat_from_chief() '
raise NotImplementedError | -622,503,933,067,415,300 | Update the local weights on the master, for instance by calling .pull_current_strat_from_chief() | PokerRL/eval/_/EvaluatorMasterBase.py | update_weights | EricSteinberger/DREAM | python | def update_weights(self):
' '
raise NotImplementedError |
def pull_current_strat_from_chief(self):
'\n Pulls and Returns weights or any other changing algorithm info of any format from the Chief.\n '
return self._ray.get(self._ray.remote(self._chief_handle.pull_current_eval_strategy, self._evaluator_name)) | 5,797,578,648,283,884,000 | Pulls and Returns weights or any other changing algorithm info of any format from the Chief. | PokerRL/eval/_/EvaluatorMasterBase.py | pull_current_strat_from_chief | EricSteinberger/DREAM | python | def pull_current_strat_from_chief(self):
'\n \n '
return self._ray.get(self._ray.remote(self._chief_handle.pull_current_eval_strategy, self._evaluator_name)) |
def _create_experiments(self, self_name):
'\n Registers a new experiment either for each player and their average or just for their average.\n '
if self._log_conf_interval:
exp_names_conf = {eval_mode: [self._ray.get([self._ray.remote(self._chief_handle.create_experiment, ((((((((self._t_p... | -4,117,428,563,300,774,000 | Registers a new experiment either for each player and their average or just for their average. | PokerRL/eval/_/EvaluatorMasterBase.py | _create_experiments | EricSteinberger/DREAM | python | def _create_experiments(self, self_name):
'\n \n '
if self._log_conf_interval:
exp_names_conf = {eval_mode: [self._ray.get([self._ray.remote(self._chief_handle.create_experiment, ((((((((self._t_prof.name + ' ') + eval_mode) + '_stack_') + str(stack_size[0])) + ': ') + self_name) + ' Conf_... |
def _log_results(self, agent_mode, stack_size_idx, iter_nr, score, upper_conf95=None, lower_conf95=None):
'\n Log evaluation results by sending these results to the Chief, who will later send them to the Crayon log server.\n\n Args:\n agent_mode: Evaluation mode of the agent who... | 5,679,980,090,370,800,000 | Log evaluation results by sending these results to the Chief, who will later send them to the Crayon log server.
Args:
agent_mode: Evaluation mode of the agent whose performance is logged
stack_size_idx: If evaluating multiple starting stack sizes, this is an index describing which one
... | PokerRL/eval/_/EvaluatorMasterBase.py | _log_results | EricSteinberger/DREAM | python | def _log_results(self, agent_mode, stack_size_idx, iter_nr, score, upper_conf95=None, lower_conf95=None):
'\n Log evaluation results by sending these results to the Chief, who will later send them to the Crayon log server.\n\n Args:\n agent_mode: Evaluation mode of the agent who... |
def _log_multi_stack(self, agent_mode, iter_nr, score_total, upper_conf95=None, lower_conf95=None):
'\n Additional logging for multistack evaluations\n '
graph_name = ('Evaluation/' + self._eval_env_bldr.env_cls.WIN_METRIC)
self._ray.remote(self._chief_handle.add_scalar, self._exp_name_multi_s... | 5,770,338,791,580,326,000 | Additional logging for multistack evaluations | PokerRL/eval/_/EvaluatorMasterBase.py | _log_multi_stack | EricSteinberger/DREAM | python | def _log_multi_stack(self, agent_mode, iter_nr, score_total, upper_conf95=None, lower_conf95=None):
'\n \n '
graph_name = ('Evaluation/' + self._eval_env_bldr.env_cls.WIN_METRIC)
self._ray.remote(self._chief_handle.add_scalar, self._exp_name_multi_stack[agent_mode], graph_name, iter_nr, score_... |
def makeSemVer(version):
'Turn simple float number (0.1) into semver-compatible number\n for comparison by adding .0(s): (0.1.0)'
version = str(version)
if (version.count('.') < 2):
version = '.'.join(map(str, list(map(int, version.split('.')))))
version = (version + ((2 - version.count('... | -6,835,943,435,101,553,000 | Turn simple float number (0.1) into semver-compatible number
for comparison by adding .0(s): (0.1.0) | Lib/typeworld/api/__init__.py | makeSemVer | typeWorld/api | python | def makeSemVer(version):
'Turn simple float number (0.1) into semver-compatible number\n for comparison by adding .0(s): (0.1.0)'
version = str(version)
if (version.count('.') < 2):
version = '.'.join(map(str, list(map(int, version.split('.')))))
version = (version + ((2 - version.count('... |
def getTextAndLocale(self, locale=['en']):
'Like getText(), but additionally returns the language of whatever\n text was found first.'
if (type(locale) == str):
if self.get(locale):
return (self.get(locale), locale)
elif (type(locale) in (list, tuple)):
for key in locale:
... | -655,386,166,473,927,700 | Like getText(), but additionally returns the language of whatever
text was found first. | Lib/typeworld/api/__init__.py | getTextAndLocale | typeWorld/api | python | def getTextAndLocale(self, locale=['en']):
'Like getText(), but additionally returns the language of whatever\n text was found first.'
if (type(locale) == str):
if self.get(locale):
return (self.get(locale), locale)
elif (type(locale) in (list, tuple)):
for key in locale:
... |
def getText(self, locale=['en']):
'Returns the text in the first language found from the specified\n list of languages. If that language can’t be found, we’ll try English\n as a standard. If that can’t be found either, return the first language\n you can find.'
(text, locale) = self.getText... | 5,000,335,307,026,303,000 | Returns the text in the first language found from the specified
list of languages. If that language can’t be found, we’ll try English
as a standard. If that can’t be found either, return the first language
you can find. | Lib/typeworld/api/__init__.py | getText | typeWorld/api | python | def getText(self, locale=['en']):
'Returns the text in the first language found from the specified\n list of languages. If that language can’t be found, we’ll try English\n as a standard. If that can’t be found either, return the first language\n you can find.'
(text, locale) = self.getText... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.