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 |
|---|---|---|---|---|---|---|---|
@property
@pulumi.getter
def tags(self) -> Optional[pulumi.Input[Mapping[(str, pulumi.Input[str])]]]:
'\n Resource tags.\n '
return pulumi.get(self, 'tags') | -2,047,115,851,061,118,500 | Resource tags. | sdk/python/pulumi_azure_native/synapse/v20200401preview/sql_pools_v3.py | tags | sebtelko/pulumi-azure-native | python | @property
@pulumi.getter
def tags(self) -> Optional[pulumi.Input[Mapping[(str, pulumi.Input[str])]]]:
'\n \n '
return pulumi.get(self, 'tags') |
@overload
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, location: Optional[pulumi.Input[str]]=None, resource_group_name: Optional[pulumi.Input[str]]=None, sku: Optional[pulumi.Input[pulumi.InputType['SkuArgs']]]=None, sql_pool_name: Optional[pulumi.Input[str]]=None, tags: Optio... | 8,612,853,346,195,900,000 | A sql pool resource.
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] location: The geo-location where the resource lives
:param pulumi.Input[str] resource_group_name: The name of the resource group. The name is case insensitive.... | sdk/python/pulumi_azure_native/synapse/v20200401preview/sql_pools_v3.py | __init__ | sebtelko/pulumi-azure-native | python | @overload
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, location: Optional[pulumi.Input[str]]=None, resource_group_name: Optional[pulumi.Input[str]]=None, sku: Optional[pulumi.Input[pulumi.InputType['SkuArgs']]]=None, sql_pool_name: Optional[pulumi.Input[str]]=None, tags: Optio... |
@overload
def __init__(__self__, resource_name: str, args: SqlPoolsV3Args, opts: Optional[pulumi.ResourceOptions]=None):
"\n A sql pool resource.\n\n :param str resource_name: The name of the resource.\n :param SqlPoolsV3Args args: The arguments to use to populate this resource's properties.\n ... | -833,163,991,211,773,700 | A sql pool resource.
:param str resource_name: The name of the resource.
:param SqlPoolsV3Args args: The arguments to use to populate this resource's properties.
:param pulumi.ResourceOptions opts: Options for the resource. | sdk/python/pulumi_azure_native/synapse/v20200401preview/sql_pools_v3.py | __init__ | sebtelko/pulumi-azure-native | python | @overload
def __init__(__self__, resource_name: str, args: SqlPoolsV3Args, opts: Optional[pulumi.ResourceOptions]=None):
"\n A sql pool resource.\n\n :param str resource_name: The name of the resource.\n :param SqlPoolsV3Args args: The arguments to use to populate this resource's properties.\n ... |
@staticmethod
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None) -> 'SqlPoolsV3':
"\n Get an existing SqlPoolsV3 resource's state with the given name, id, and optional extra\n properties used to qualify the lookup.\n\n :param str resource_name: The u... | 1,144,220,005,969,504,100 | Get an existing SqlPoolsV3 resource's state with the given name, id, and optional extra
properties used to qualify the lookup.
:param str resource_name: The unique name of the resulting resource.
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
:param pulumi.ResourceOptions opts: Options ... | sdk/python/pulumi_azure_native/synapse/v20200401preview/sql_pools_v3.py | get | sebtelko/pulumi-azure-native | python | @staticmethod
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None) -> 'SqlPoolsV3':
"\n Get an existing SqlPoolsV3 resource's state with the given name, id, and optional extra\n properties used to qualify the lookup.\n\n :param str resource_name: The u... |
@property
@pulumi.getter(name='currentServiceObjectiveName')
def current_service_objective_name(self) -> pulumi.Output[str]:
'\n The current service level objective name of the sql pool.\n '
return pulumi.get(self, 'current_service_objective_name') | 5,218,573,891,819,161,000 | The current service level objective name of the sql pool. | sdk/python/pulumi_azure_native/synapse/v20200401preview/sql_pools_v3.py | current_service_objective_name | sebtelko/pulumi-azure-native | python | @property
@pulumi.getter(name='currentServiceObjectiveName')
def current_service_objective_name(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'current_service_objective_name') |
@property
@pulumi.getter
def kind(self) -> pulumi.Output[str]:
'\n Kind of SqlPool.\n '
return pulumi.get(self, 'kind') | 8,167,977,468,519,664,000 | Kind of SqlPool. | sdk/python/pulumi_azure_native/synapse/v20200401preview/sql_pools_v3.py | kind | sebtelko/pulumi-azure-native | python | @property
@pulumi.getter
def kind(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'kind') |
@property
@pulumi.getter
def location(self) -> pulumi.Output[str]:
'\n The geo-location where the resource lives\n '
return pulumi.get(self, 'location') | -1,096,732,000,402,900,900 | The geo-location where the resource lives | sdk/python/pulumi_azure_native/synapse/v20200401preview/sql_pools_v3.py | location | sebtelko/pulumi-azure-native | python | @property
@pulumi.getter
def location(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'location') |
@property
@pulumi.getter
def name(self) -> pulumi.Output[str]:
'\n The name of the resource\n '
return pulumi.get(self, 'name') | 2,231,345,607,626,165,800 | The name of the resource | sdk/python/pulumi_azure_native/synapse/v20200401preview/sql_pools_v3.py | name | sebtelko/pulumi-azure-native | python | @property
@pulumi.getter
def name(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'name') |
@property
@pulumi.getter(name='requestedServiceObjectiveName')
def requested_service_objective_name(self) -> pulumi.Output[str]:
'\n The requested service level objective name of the sql pool.\n '
return pulumi.get(self, 'requested_service_objective_name') | -5,669,831,218,008,058,000 | The requested service level objective name of the sql pool. | sdk/python/pulumi_azure_native/synapse/v20200401preview/sql_pools_v3.py | requested_service_objective_name | sebtelko/pulumi-azure-native | python | @property
@pulumi.getter(name='requestedServiceObjectiveName')
def requested_service_objective_name(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'requested_service_objective_name') |
@property
@pulumi.getter
def sku(self) -> pulumi.Output[Optional['outputs.SkuResponse']]:
'\n The sql pool SKU. The list of SKUs may vary by region and support offer.\n '
return pulumi.get(self, 'sku') | 3,816,815,483,821,266,400 | The sql pool SKU. The list of SKUs may vary by region and support offer. | sdk/python/pulumi_azure_native/synapse/v20200401preview/sql_pools_v3.py | sku | sebtelko/pulumi-azure-native | python | @property
@pulumi.getter
def sku(self) -> pulumi.Output[Optional['outputs.SkuResponse']]:
'\n \n '
return pulumi.get(self, 'sku') |
@property
@pulumi.getter(name='sqlPoolGuid')
def sql_pool_guid(self) -> pulumi.Output[str]:
'\n The Guid of the sql pool.\n '
return pulumi.get(self, 'sql_pool_guid') | 2,210,988,124,487,927,600 | The Guid of the sql pool. | sdk/python/pulumi_azure_native/synapse/v20200401preview/sql_pools_v3.py | sql_pool_guid | sebtelko/pulumi-azure-native | python | @property
@pulumi.getter(name='sqlPoolGuid')
def sql_pool_guid(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'sql_pool_guid') |
@property
@pulumi.getter
def status(self) -> pulumi.Output[str]:
'\n The status of the sql pool.\n '
return pulumi.get(self, 'status') | 8,908,813,554,611,460,000 | The status of the sql pool. | sdk/python/pulumi_azure_native/synapse/v20200401preview/sql_pools_v3.py | status | sebtelko/pulumi-azure-native | python | @property
@pulumi.getter
def status(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'status') |
@property
@pulumi.getter(name='systemData')
def system_data(self) -> pulumi.Output['outputs.SystemDataResponse']:
'\n SystemData of SqlPool.\n '
return pulumi.get(self, 'system_data') | -8,966,815,235,898,524,000 | SystemData of SqlPool. | sdk/python/pulumi_azure_native/synapse/v20200401preview/sql_pools_v3.py | system_data | sebtelko/pulumi-azure-native | python | @property
@pulumi.getter(name='systemData')
def system_data(self) -> pulumi.Output['outputs.SystemDataResponse']:
'\n \n '
return pulumi.get(self, 'system_data') |
@property
@pulumi.getter
def tags(self) -> pulumi.Output[Optional[Mapping[(str, str)]]]:
'\n Resource tags.\n '
return pulumi.get(self, 'tags') | -2,929,197,049,816,896,000 | Resource tags. | sdk/python/pulumi_azure_native/synapse/v20200401preview/sql_pools_v3.py | tags | sebtelko/pulumi-azure-native | python | @property
@pulumi.getter
def tags(self) -> pulumi.Output[Optional[Mapping[(str, str)]]]:
'\n \n '
return pulumi.get(self, 'tags') |
@property
@pulumi.getter
def type(self) -> pulumi.Output[str]:
'\n The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"\n '
return pulumi.get(self, 'type') | -5,449,551,391,296,740,000 | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" | sdk/python/pulumi_azure_native/synapse/v20200401preview/sql_pools_v3.py | type | sebtelko/pulumi-azure-native | python | @property
@pulumi.getter
def type(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'type') |
def afficher(self):
"Méthode à redéfinir retournant l'affichage de l'objectif."
if self.doit_reculer:
return 'Doit reculer'
navire = self.navire
distance = self.get_distance()
direction = ((distance.direction + 90) % 360)
msg_dist = get_nom_distance(distance)
return 'Cap sur {}° ({})... | 7,196,368,381,657,184,000 | Méthode à redéfinir retournant l'affichage de l'objectif. | src/secondaires/navigation/equipage/objectifs/rejoindre.py | afficher | stormi/tsunami | python | def afficher(self):
if self.doit_reculer:
return 'Doit reculer'
navire = self.navire
distance = self.get_distance()
direction = ((distance.direction + 90) % 360)
msg_dist = get_nom_distance(distance)
return 'Cap sur {}° ({}), à {}'.format(round(direction), distance.nom_direction, ms... |
def get_distance(self):
'Retourne la distance (Vecteur) entre le navire et la destination.\n\n Cette méthode crée un vecteur (class Vecteur définie dans\n le module primaire vehicule) qui représente la distance entre\n la position du navire et la destination.\n\n '
navire = self.navi... | 6,704,754,725,337,368,000 | Retourne la distance (Vecteur) entre le navire et la destination.
Cette méthode crée un vecteur (class Vecteur définie dans
le module primaire vehicule) qui représente la distance entre
la position du navire et la destination. | src/secondaires/navigation/equipage/objectifs/rejoindre.py | get_distance | stormi/tsunami | python | def get_distance(self):
'Retourne la distance (Vecteur) entre le navire et la destination.\n\n Cette méthode crée un vecteur (class Vecteur définie dans\n le module primaire vehicule) qui représente la distance entre\n la position du navire et la destination.\n\n '
navire = self.navi... |
def trouver_distance_min(self, cible):
"Trouve la distance minimum.\n\n Cette distance est fonction de la distance minimum entre\n une salle du navire d'origine et une salle du navire cible.\n\n "
navire = self.navire
etendue = navire.etendue
altitude = etendue.altitude
salle_ci... | 1,206,798,301,761,401,600 | Trouve la distance minimum.
Cette distance est fonction de la distance minimum entre
une salle du navire d'origine et une salle du navire cible. | src/secondaires/navigation/equipage/objectifs/rejoindre.py | trouver_distance_min | stormi/tsunami | python | def trouver_distance_min(self, cible):
"Trouve la distance minimum.\n\n Cette distance est fonction de la distance minimum entre\n une salle du navire d'origine et une salle du navire cible.\n\n "
navire = self.navire
etendue = navire.etendue
altitude = etendue.altitude
salle_ci... |
def transmettre_controles(self):
'Donne les contrôles indiqués (vitesse et direction).'
equipage = self.equipage
navire = self.navire
distance = self.get_distance()
if self.autre_direction:
direction = round(self.autre_direction)
else:
direction = round(distance.direction)
if... | -6,538,764,887,885,260,000 | Donne les contrôles indiqués (vitesse et direction). | src/secondaires/navigation/equipage/objectifs/rejoindre.py | transmettre_controles | stormi/tsunami | python | def transmettre_controles(self):
equipage = self.equipage
navire = self.navire
distance = self.get_distance()
if self.autre_direction:
direction = round(self.autre_direction)
else:
direction = round(distance.direction)
if equipage.controles.get('direction'):
equipage... |
def trouver_cap(self):
'Trouve le cap, tenant compte des obstacles.'
equipage = self.equipage
navire = self.navire
if self.doit_reculer:
(x, y) = self.doit_reculer
p_x = navire.position.x
p_y = navire.position.y
max_distance = navire.get_max_distance_au_centre()
i... | -7,917,848,045,556,536,000 | Trouve le cap, tenant compte des obstacles. | src/secondaires/navigation/equipage/objectifs/rejoindre.py | trouver_cap | stormi/tsunami | python | def trouver_cap(self):
equipage = self.equipage
navire = self.navire
if self.doit_reculer:
(x, y) = self.doit_reculer
p_x = navire.position.x
p_y = navire.position.y
max_distance = navire.get_max_distance_au_centre()
if (sqrt((((x - p_x) ** 2) + ((y - p_y) ** 2))... |
def creer(self):
"L'objectif est créé.\n\n On crée les contrôles associéss pour atteindre l'objectif\n visé, à savoir, rejoindre le point (x, y), en essayant\n de trouver les obstacles corresondant et un cap de remplacement\n si nécessaire.\n\n "
equipage = self.equipage
c... | -5,156,652,403,956,548,000 | L'objectif est créé.
On crée les contrôles associéss pour atteindre l'objectif
visé, à savoir, rejoindre le point (x, y), en essayant
de trouver les obstacles corresondant et un cap de remplacement
si nécessaire. | src/secondaires/navigation/equipage/objectifs/rejoindre.py | creer | stormi/tsunami | python | def creer(self):
"L'objectif est créé.\n\n On crée les contrôles associéss pour atteindre l'objectif\n visé, à savoir, rejoindre le point (x, y), en essayant\n de trouver les obstacles corresondant et un cap de remplacement\n si nécessaire.\n\n "
equipage = self.equipage
c... |
def verifier(self, prioritaire):
"Vérifie que l'objectif est toujours valide.\n\n Dans cette méthode, on vérifie :\n Qu'il n'y a aucun obstacle sur la trajectoire assignée\n\n "
equipage = self.equipage
navire = self.navire
commandant = self.commandant
if (commandant is None... | -1,071,381,795,624,332,800 | Vérifie que l'objectif est toujours valide.
Dans cette méthode, on vérifie :
Qu'il n'y a aucun obstacle sur la trajectoire assignée | src/secondaires/navigation/equipage/objectifs/rejoindre.py | verifier | stormi/tsunami | python | def verifier(self, prioritaire):
"Vérifie que l'objectif est toujours valide.\n\n Dans cette méthode, on vérifie :\n Qu'il n'y a aucun obstacle sur la trajectoire assignée\n\n "
equipage = self.equipage
navire = self.navire
commandant = self.commandant
if (commandant is None... |
def reagir_collision(self, salle, contre):
'Réagit à une collision.'
if (not self.doit_reculer):
commandant = self.commandant
if (commandant is None):
return
personnage = commandant.personnage
navire = self.navire
equipage = self.equipage
p_x = navire.... | 239,206,026,680,985,800 | Réagit à une collision. | src/secondaires/navigation/equipage/objectifs/rejoindre.py | reagir_collision | stormi/tsunami | python | def reagir_collision(self, salle, contre):
if (not self.doit_reculer):
commandant = self.commandant
if (commandant is None):
return
personnage = commandant.personnage
navire = self.navire
equipage = self.equipage
p_x = navire.position.x
p_y = ... |
def validate_rsa_key(key, is_secret=True):
'\n Validate the format and type of an RSA key.\n '
if key.startswith('ssh-rsa '):
raise forms.ValidationError('OpenSSH line format is not supported. Please ensure that your public is in PEM (base64) format.')
try:
key = RSA.importKey(key)
... | 3,125,702,511,178,122,000 | Validate the format and type of an RSA key. | netbox/secrets/forms.py | validate_rsa_key | Megzo/netbox | python | def validate_rsa_key(key, is_secret=True):
'\n \n '
if key.startswith('ssh-rsa '):
raise forms.ValidationError('OpenSSH line format is not supported. Please ensure that your public is in PEM (base64) format.')
try:
key = RSA.importKey(key)
except ValueError:
raise forms.Val... |
def _tf_fspecial_gauss(size, sigma, ch=1):
"Function to mimic the 'fspecial' gaussian MATLAB function\n "
(x_data, y_data) = np.mgrid[(((- size) // 2) + 1):((size // 2) + 1), (((- size) // 2) + 1):((size // 2) + 1)]
x_data = np.expand_dims(x_data, axis=(- 1))
x_data = np.expand_dims(x_data, axis=(- 1... | -8,443,937,505,276,022,000 | Function to mimic the 'fspecial' gaussian MATLAB function | ssim.py | _tf_fspecial_gauss | 97chenxa/Multiview2Novelview | python | def _tf_fspecial_gauss(size, sigma, ch=1):
"\n "
(x_data, y_data) = np.mgrid[(((- size) // 2) + 1):((size // 2) + 1), (((- size) // 2) + 1):((size // 2) + 1)]
x_data = np.expand_dims(x_data, axis=(- 1))
x_data = np.expand_dims(x_data, axis=(- 1))
y_data = np.expand_dims(y_data, axis=(- 1))
y_... |
def run(self, num_times, board, agents, bombs, items, flames, is_partially_observable, agent_view_size, action_space, training_agent=None, is_communicative=False):
'Run the forward model.\n\n Args:\n num_times: The number of times to run it for. This is a maximum and\n it will stop early ... | 37,734,878,252,812,904 | Run the forward model.
Args:
num_times: The number of times to run it for. This is a maximum and
it will stop early if we reach a done.
board: The board state to run it from.
agents: The agents to use to run it.
bombs: The starting bombs.
items: The starting items.
flames: The starting flames.
is_par... | pommerman/forward_model.py | run | psyoblade/playground | python | def run(self, num_times, board, agents, bombs, items, flames, is_partially_observable, agent_view_size, action_space, training_agent=None, is_communicative=False):
'Run the forward model.\n\n Args:\n num_times: The number of times to run it for. This is a maximum and\n it will stop early ... |
@staticmethod
def act(agents, obs, action_space, is_communicative=False):
'Returns actions for each agent in this list.\n\n Args:\n agents: A list of agent objects.\n obs: A list of matching observations per agent.\n action_space: The action space for the environment using this mod... | 2,517,179,653,179,589,000 | Returns actions for each agent in this list.
Args:
agents: A list of agent objects.
obs: A list of matching observations per agent.
action_space: The action space for the environment using this model.
is_communicative: Whether the action depends on communication
observations as well.
Returns a list of act... | pommerman/forward_model.py | act | psyoblade/playground | python | @staticmethod
def act(agents, obs, action_space, is_communicative=False):
'Returns actions for each agent in this list.\n\n Args:\n agents: A list of agent objects.\n obs: A list of matching observations per agent.\n action_space: The action space for the environment using this mod... |
def get_observations(self, curr_board, agents, bombs, is_partially_observable, agent_view_size, game_type, game_env):
'Gets the observations as an np.array of the visible squares.\n\n The agent gets to choose whether it wants to keep the fogged part in\n memory.\n '
board_size = len(curr_bo... | 8,998,917,911,216,073,000 | Gets the observations as an np.array of the visible squares.
The agent gets to choose whether it wants to keep the fogged part in
memory. | pommerman/forward_model.py | get_observations | psyoblade/playground | python | def get_observations(self, curr_board, agents, bombs, is_partially_observable, agent_view_size, game_type, game_env):
'Gets the observations as an np.array of the visible squares.\n\n The agent gets to choose whether it wants to keep the fogged part in\n memory.\n '
board_size = len(curr_bo... |
def act_ex_communication(agent):
"Handles agent's move without communication"
if agent.is_alive:
return agent.act(obs[agent.agent_id], action_space=action_space)
else:
return constants.Action.Stop.value | 128,353,056,565,292,160 | Handles agent's move without communication | pommerman/forward_model.py | act_ex_communication | psyoblade/playground | python | def act_ex_communication(agent):
if agent.is_alive:
return agent.act(obs[agent.agent_id], action_space=action_space)
else:
return constants.Action.Stop.value |
def act_with_communication(agent):
"Handles agent's move with communication"
if agent.is_alive:
action = agent.act(obs[agent.agent_id], action_space=action_space)
if (type(action) == int):
action = ([action] + [0, 0])
assert (type(action) == list)
return action
el... | 5,499,220,043,339,737,000 | Handles agent's move with communication | pommerman/forward_model.py | act_with_communication | psyoblade/playground | python | def act_with_communication(agent):
if agent.is_alive:
action = agent.act(obs[agent.agent_id], action_space=action_space)
if (type(action) == int):
action = ([action] + [0, 0])
assert (type(action) == list)
return action
else:
return [constants.Action.Stop... |
def crossing(current, desired):
'Checks to see if an agent is crossing paths'
(current_x, current_y) = current
(desired_x, desired_y) = desired
if (current_x != desired_x):
assert (current_y == desired_y)
return ('X', min(current_x, desired_x), current_y)
assert (current_x == desired... | -2,236,711,760,669,926,700 | Checks to see if an agent is crossing paths | pommerman/forward_model.py | crossing | psyoblade/playground | python | def crossing(current, desired):
(current_x, current_y) = current
(desired_x, desired_y) = desired
if (current_x != desired_x):
assert (current_y == desired_y)
return ('X', min(current_x, desired_x), current_y)
assert (current_x == desired_x)
return ('Y', current_x, min(current_y... |
def make_bomb_maps(position):
' Makes an array of an agents bombs and the bombs attributes '
blast_strengths = np.zeros((board_size, board_size))
life = np.zeros((board_size, board_size))
for bomb in bombs:
(x, y) = bomb.position
if ((not is_partially_observable) or in_view_range(positio... | 7,158,962,727,249,455,000 | Makes an array of an agents bombs and the bombs attributes | pommerman/forward_model.py | make_bomb_maps | psyoblade/playground | python | def make_bomb_maps(position):
' '
blast_strengths = np.zeros((board_size, board_size))
life = np.zeros((board_size, board_size))
for bomb in bombs:
(x, y) = bomb.position
if ((not is_partially_observable) or in_view_range(position, x, y)):
blast_strengths[(x, y)] = bomb.blas... |
def in_view_range(position, v_row, v_col):
'Checks to see if a tile is in an agents viewing area'
(row, col) = position
return all([(row >= (v_row - agent_view_size)), (row <= (v_row + agent_view_size)), (col >= (v_col - agent_view_size)), (col <= (v_col + agent_view_size))]) | 6,712,188,905,099,196,000 | Checks to see if a tile is in an agents viewing area | pommerman/forward_model.py | in_view_range | psyoblade/playground | python | def in_view_range(position, v_row, v_col):
(row, col) = position
return all([(row >= (v_row - agent_view_size)), (row <= (v_row + agent_view_size)), (col >= (v_col - agent_view_size)), (col <= (v_col + agent_view_size))]) |
def any_lst_equal(lst, values):
'Checks if list are equal'
return any([(lst == v) for v in values]) | 7,340,273,300,579,551,000 | Checks if list are equal | pommerman/forward_model.py | any_lst_equal | psyoblade/playground | python | def any_lst_equal(lst, values):
return any([(lst == v) for v in values]) |
@app.route('/<path:page_path>')
def get_index_page(page_path):
"\n Handle requests which urls don't end with '.html' (for example, '/doc/')\n\n We don't need any generator here, because such urls are equivalent to the same urls\n with 'index.html' at the end.\n\n :param page_path: str\n :return: str\... | -9,031,548,282,840,157,000 | Handle requests which urls don't end with '.html' (for example, '/doc/')
We don't need any generator here, because such urls are equivalent to the same urls
with 'index.html' at the end.
:param page_path: str
:return: str | kotlin-website.py | get_index_page | Chinay-Domitrix/kotlin-web-site | python | @app.route('/<path:page_path>')
def get_index_page(page_path):
"\n Handle requests which urls don't end with '.html' (for example, '/doc/')\n\n We don't need any generator here, because such urls are equivalent to the same urls\n with 'index.html' at the end.\n\n :param page_path: str\n :return: str\... |
def mean_precision_k(y_true, y_score, k=10):
'Mean precision at rank k\n Parameters\n ----------\n y_true : array-like, shape = [n_samples]\n Ground truth (true relevance labels).\n y_score : array-like, shape = [n_samples]\n Predicted scores.\n k : int\n Rank.\n Returns\n ... | 5,770,015,242,635,812,000 | Mean precision at rank k
Parameters
----------
y_true : array-like, shape = [n_samples]
Ground truth (true relevance labels).
y_score : array-like, shape = [n_samples]
Predicted scores.
k : int
Rank.
Returns
-------
mean precision @k : float | voc_classifier/metrics_for_multilabel.py | mean_precision_k | myeonghak/kobert-multi-label-VOC-classifier | python | def mean_precision_k(y_true, y_score, k=10):
'Mean precision at rank k\n Parameters\n ----------\n y_true : array-like, shape = [n_samples]\n Ground truth (true relevance labels).\n y_score : array-like, shape = [n_samples]\n Predicted scores.\n k : int\n Rank.\n Returns\n ... |
def mean_recall_k(y_true, y_score, k=10):
'Mean recall at rank k\n Parameters\n ----------\n y_true : array-like, shape = [n_samples]\n Ground truth (true relevance labels).\n y_score : array-like, shape = [n_samples]\n Predicted scores.\n k : int\n Rank.\n Returns\n ------... | 7,608,365,527,797,240,000 | Mean recall at rank k
Parameters
----------
y_true : array-like, shape = [n_samples]
Ground truth (true relevance labels).
y_score : array-like, shape = [n_samples]
Predicted scores.
k : int
Rank.
Returns
-------
mean recall @k : float | voc_classifier/metrics_for_multilabel.py | mean_recall_k | myeonghak/kobert-multi-label-VOC-classifier | python | def mean_recall_k(y_true, y_score, k=10):
'Mean recall at rank k\n Parameters\n ----------\n y_true : array-like, shape = [n_samples]\n Ground truth (true relevance labels).\n y_score : array-like, shape = [n_samples]\n Predicted scores.\n k : int\n Rank.\n Returns\n ------... |
def mean_ndcg_score(y_true, y_score, k=10, gains='exponential'):
'Normalized discounted cumulative gain (NDCG) at rank k\n Parameters\n ----------\n y_true : array-like, shape = [n_samples]\n Ground truth (true relevance labels).\n y_score : array-like, shape = [n_samples]\n Predicted scor... | 5,159,041,303,848,239,000 | Normalized discounted cumulative gain (NDCG) at rank k
Parameters
----------
y_true : array-like, shape = [n_samples]
Ground truth (true relevance labels).
y_score : array-like, shape = [n_samples]
Predicted scores.
k : int
Rank.
gains : str
Whether gains should be "exponential" (default) or "linear".
R... | voc_classifier/metrics_for_multilabel.py | mean_ndcg_score | myeonghak/kobert-multi-label-VOC-classifier | python | def mean_ndcg_score(y_true, y_score, k=10, gains='exponential'):
'Normalized discounted cumulative gain (NDCG) at rank k\n Parameters\n ----------\n y_true : array-like, shape = [n_samples]\n Ground truth (true relevance labels).\n y_score : array-like, shape = [n_samples]\n Predicted scor... |
def mean_rprecision_k(y_true, y_score, k=10):
'Mean precision at rank k\n Parameters\n ----------\n y_true : array-like, shape = [n_samples]\n Ground truth (true relevance labels).\n y_score : array-like, shape = [n_samples]\n Predicted scores.\n k : int\n Rank.\n Returns\n ... | 424,993,604,326,264,000 | Mean precision at rank k
Parameters
----------
y_true : array-like, shape = [n_samples]
Ground truth (true relevance labels).
y_score : array-like, shape = [n_samples]
Predicted scores.
k : int
Rank.
Returns
-------
mean precision @k : float | voc_classifier/metrics_for_multilabel.py | mean_rprecision_k | myeonghak/kobert-multi-label-VOC-classifier | python | def mean_rprecision_k(y_true, y_score, k=10):
'Mean precision at rank k\n Parameters\n ----------\n y_true : array-like, shape = [n_samples]\n Ground truth (true relevance labels).\n y_score : array-like, shape = [n_samples]\n Predicted scores.\n k : int\n Rank.\n Returns\n ... |
def ranking_recall_score(y_true, y_score, k=10):
'Recall at rank k\n Parameters\n ----------\n y_true : array-like, shape = [n_samples]\n Ground truth (true relevance labels).\n y_score : array-like, shape = [n_samples]\n Predicted scores.\n k : int\n Rank.\n Returns\n ----... | 8,914,194,712,639,622,000 | Recall at rank k
Parameters
----------
y_true : array-like, shape = [n_samples]
Ground truth (true relevance labels).
y_score : array-like, shape = [n_samples]
Predicted scores.
k : int
Rank.
Returns
-------
precision @k : float | voc_classifier/metrics_for_multilabel.py | ranking_recall_score | myeonghak/kobert-multi-label-VOC-classifier | python | def ranking_recall_score(y_true, y_score, k=10):
'Recall at rank k\n Parameters\n ----------\n y_true : array-like, shape = [n_samples]\n Ground truth (true relevance labels).\n y_score : array-like, shape = [n_samples]\n Predicted scores.\n k : int\n Rank.\n Returns\n ----... |
def ranking_precision_score(y_true, y_score, k=10):
'Precision at rank k\n Parameters\n ----------\n y_true : array-like, shape = [n_samples]\n Ground truth (true relevance labels).\n y_score : array-like, shape = [n_samples]\n Predicted scores.\n k : int\n Rank.\n Returns\n ... | -6,949,153,071,367,454,000 | Precision at rank k
Parameters
----------
y_true : array-like, shape = [n_samples]
Ground truth (true relevance labels).
y_score : array-like, shape = [n_samples]
Predicted scores.
k : int
Rank.
Returns
-------
precision @k : float | voc_classifier/metrics_for_multilabel.py | ranking_precision_score | myeonghak/kobert-multi-label-VOC-classifier | python | def ranking_precision_score(y_true, y_score, k=10):
'Precision at rank k\n Parameters\n ----------\n y_true : array-like, shape = [n_samples]\n Ground truth (true relevance labels).\n y_score : array-like, shape = [n_samples]\n Predicted scores.\n k : int\n Rank.\n Returns\n ... |
def ranking_rprecision_score(y_true, y_score, k=10):
'Precision at rank k\n Parameters\n ----------\n y_true : array-like, shape = [n_samples]\n Ground truth (true relevance labels).\n y_score : array-like, shape = [n_samples]\n Predicted scores.\n k : int\n Rank.\n Returns\n ... | -2,170,543,630,146,516,200 | Precision at rank k
Parameters
----------
y_true : array-like, shape = [n_samples]
Ground truth (true relevance labels).
y_score : array-like, shape = [n_samples]
Predicted scores.
k : int
Rank.
Returns
-------
precision @k : float | voc_classifier/metrics_for_multilabel.py | ranking_rprecision_score | myeonghak/kobert-multi-label-VOC-classifier | python | def ranking_rprecision_score(y_true, y_score, k=10):
'Precision at rank k\n Parameters\n ----------\n y_true : array-like, shape = [n_samples]\n Ground truth (true relevance labels).\n y_score : array-like, shape = [n_samples]\n Predicted scores.\n k : int\n Rank.\n Returns\n ... |
def average_precision_score(y_true, y_score, k=10):
'Average precision at rank k\n Parameters\n ----------\n y_true : array-like, shape = [n_samples]\n Ground truth (true relevance labels).\n y_score : array-like, shape = [n_samples]\n Predicted scores.\n k : int\n Rank.\n Ret... | -1,121,636,309,767,000,700 | Average precision at rank k
Parameters
----------
y_true : array-like, shape = [n_samples]
Ground truth (true relevance labels).
y_score : array-like, shape = [n_samples]
Predicted scores.
k : int
Rank.
Returns
-------
average precision @k : float | voc_classifier/metrics_for_multilabel.py | average_precision_score | myeonghak/kobert-multi-label-VOC-classifier | python | def average_precision_score(y_true, y_score, k=10):
'Average precision at rank k\n Parameters\n ----------\n y_true : array-like, shape = [n_samples]\n Ground truth (true relevance labels).\n y_score : array-like, shape = [n_samples]\n Predicted scores.\n k : int\n Rank.\n Ret... |
def dcg_score(y_true, y_score, k=10, gains='exponential'):
'Discounted cumulative gain (DCG) at rank k\n Parameters\n ----------\n y_true : array-like, shape = [n_samples]\n Ground truth (true relevance labels).\n y_score : array-like, shape = [n_samples]\n Predicted scores.\n k : int\n... | 1,590,550,218,463,529,700 | Discounted cumulative gain (DCG) at rank k
Parameters
----------
y_true : array-like, shape = [n_samples]
Ground truth (true relevance labels).
y_score : array-like, shape = [n_samples]
Predicted scores.
k : int
Rank.
gains : str
Whether gains should be "exponential" (default) or "linear".
Returns
-----... | voc_classifier/metrics_for_multilabel.py | dcg_score | myeonghak/kobert-multi-label-VOC-classifier | python | def dcg_score(y_true, y_score, k=10, gains='exponential'):
'Discounted cumulative gain (DCG) at rank k\n Parameters\n ----------\n y_true : array-like, shape = [n_samples]\n Ground truth (true relevance labels).\n y_score : array-like, shape = [n_samples]\n Predicted scores.\n k : int\n... |
def ndcg_score(y_true, y_score, k=10, gains='exponential'):
'Normalized discounted cumulative gain (NDCG) at rank k\n Parameters\n ----------\n y_true : array-like, shape = [n_samples]\n Ground truth (true relevance labels).\n y_score : array-like, shape = [n_samples]\n Predicted scores.\n... | 5,496,232,716,610,578,000 | Normalized discounted cumulative gain (NDCG) at rank k
Parameters
----------
y_true : array-like, shape = [n_samples]
Ground truth (true relevance labels).
y_score : array-like, shape = [n_samples]
Predicted scores.
k : int
Rank.
gains : str
Whether gains should be "exponential" (default) or "linear".
R... | voc_classifier/metrics_for_multilabel.py | ndcg_score | myeonghak/kobert-multi-label-VOC-classifier | python | def ndcg_score(y_true, y_score, k=10, gains='exponential'):
'Normalized discounted cumulative gain (NDCG) at rank k\n Parameters\n ----------\n y_true : array-like, shape = [n_samples]\n Ground truth (true relevance labels).\n y_score : array-like, shape = [n_samples]\n Predicted scores.\n... |
def dcg_from_ranking(y_true, ranking):
'Discounted cumulative gain (DCG) at rank k\n Parameters\n ----------\n y_true : array-like, shape = [n_samples]\n Ground truth (true relevance labels).\n ranking : array-like, shape = [k]\n Document indices, i.e.,\n ranking[0] is the index... | 837,021,588,487,954,000 | Discounted cumulative gain (DCG) at rank k
Parameters
----------
y_true : array-like, shape = [n_samples]
Ground truth (true relevance labels).
ranking : array-like, shape = [k]
Document indices, i.e.,
ranking[0] is the index of top-ranked document,
ranking[1] is the index of second-ranked docum... | voc_classifier/metrics_for_multilabel.py | dcg_from_ranking | myeonghak/kobert-multi-label-VOC-classifier | python | def dcg_from_ranking(y_true, ranking):
'Discounted cumulative gain (DCG) at rank k\n Parameters\n ----------\n y_true : array-like, shape = [n_samples]\n Ground truth (true relevance labels).\n ranking : array-like, shape = [k]\n Document indices, i.e.,\n ranking[0] is the index... |
def ndcg_from_ranking(y_true, ranking):
'Normalized discounted cumulative gain (NDCG) at rank k\n Parameters\n ----------\n y_true : array-like, shape = [n_samples]\n Ground truth (true relevance labels).\n ranking : array-like, shape = [k]\n Document indices, i.e.,\n ranking[0]... | 4,945,442,521,592,618,000 | Normalized discounted cumulative gain (NDCG) at rank k
Parameters
----------
y_true : array-like, shape = [n_samples]
Ground truth (true relevance labels).
ranking : array-like, shape = [k]
Document indices, i.e.,
ranking[0] is the index of top-ranked document,
ranking[1] is the index of second-... | voc_classifier/metrics_for_multilabel.py | ndcg_from_ranking | myeonghak/kobert-multi-label-VOC-classifier | python | def ndcg_from_ranking(y_true, ranking):
'Normalized discounted cumulative gain (NDCG) at rank k\n Parameters\n ----------\n y_true : array-like, shape = [n_samples]\n Ground truth (true relevance labels).\n ranking : array-like, shape = [k]\n Document indices, i.e.,\n ranking[0]... |
def __init__(self):
'Noise, system setting and x0 settings'
super(NarendraLiBenchmark, self).__init__(nx=2) | 3,262,071,650,773,849,600 | Noise, system setting and x0 settings | deepSI/systems/narendra_li_benchmark.py | __init__ | csutakbalazs/deepSI | python | def __init__(self):
super(NarendraLiBenchmark, self).__init__(nx=2) |
@pytest.fixture()
def test_filename(change_to_resources_dir, storage, request) -> Generator[(str, None, None)]:
'Pushes a file to remote storage, yields its filename and then deletes it from remote storage'
filename = request.param
storage.push_file(filename)
(yield filename)
storage.delete(filename... | -5,960,721,702,347,764,000 | Pushes a file to remote storage, yields its filename and then deletes it from remote storage | tests/accsr/test_remote_storage.py | test_filename | AnesBenmerzoug/accsr | python | @pytest.fixture()
def test_filename(change_to_resources_dir, storage, request) -> Generator[(str, None, None)]:
filename = request.param
storage.push_file(filename)
(yield filename)
storage.delete(filename) |
@pytest.fixture()
def setup_name_collision(change_to_resources_dir, storage):
'\n Pushes files and dirs with colliding names to remote storage, yields files pushed\n and deletes everything at cleanup\n '
pushed_objects = storage.push(NAME_COLLISIONS_DIR_NAME)
(yield pushed_objects)
storage.dele... | 7,052,228,047,297,320,000 | Pushes files and dirs with colliding names to remote storage, yields files pushed
and deletes everything at cleanup | tests/accsr/test_remote_storage.py | setup_name_collision | AnesBenmerzoug/accsr | python | @pytest.fixture()
def setup_name_collision(change_to_resources_dir, storage):
'\n Pushes files and dirs with colliding names to remote storage, yields files pushed\n and deletes everything at cleanup\n '
pushed_objects = storage.push(NAME_COLLISIONS_DIR_NAME)
(yield pushed_objects)
storage.dele... |
@pytest.fixture()
def test_dirname(change_to_resources_dir, storage, request) -> Generator[(str, None, None)]:
'Pushes a directory to remote storage, yields its name and then deletes it from remote storage'
dirname = request.param
storage.push_directory(dirname)
(yield dirname)
storage.delete(dirnam... | 5,710,146,440,443,977,000 | Pushes a directory to remote storage, yields its name and then deletes it from remote storage | tests/accsr/test_remote_storage.py | test_dirname | AnesBenmerzoug/accsr | python | @pytest.fixture()
def test_dirname(change_to_resources_dir, storage, request) -> Generator[(str, None, None)]:
dirname = request.param
storage.push_directory(dirname)
(yield dirname)
storage.delete(dirname) |
def read_infile(infile):
'STUB'
with open(infile) as csvfile:
rps_reader = csv.reader(csvfile, delimiter=',') | 2,087,596,246,220,939,300 | STUB | scripts/csv_xml.py | read_infile | CRobeck/RAJAPerf | python | def read_infile(infile):
with open(infile) as csvfile:
rps_reader = csv.reader(csvfile, delimiter=',') |
def get_date():
'STUB'
date = datetime.now().strftime('%-Y-%m-%dT%H:%M:%S')
return date | -4,645,876,791,713,465,000 | STUB | scripts/csv_xml.py | get_date | CRobeck/RAJAPerf | python | def get_date():
date = datetime.now().strftime('%-Y-%m-%dT%H:%M:%S')
return date |
def associate_timings_with_xml(xml_element, timing_dict, suite_or_test_name):
'STUB -- xml_element will be an element of perf_report;\n timing_dict = a map of variant names to test run times\n '
for (key, value) in timing_dict.items():
xml_element.set(key.lower(), str(value))
xml_element.set('... | -7,996,876,121,615,786,000 | STUB -- xml_element will be an element of perf_report;
timing_dict = a map of variant names to test run times | scripts/csv_xml.py | associate_timings_with_xml | CRobeck/RAJAPerf | python | def associate_timings_with_xml(xml_element, timing_dict, suite_or_test_name):
'STUB -- xml_element will be an element of perf_report;\n timing_dict = a map of variant names to test run times\n '
for (key, value) in timing_dict.items():
xml_element.set(key.lower(), str(value))
xml_element.set('... |
def create_RPS_xml_report(suite_name, suite_data_list):
'STUB - suite_name is a string = Basic, KokkosMechanics, etc.;\n suite_data_list will be the values for a key, Basic or KokkosMechanics\n '
aggregate_results_dict = dict()
for list_item in suite_data_list:
for (index, timing) in enumerate... | -2,429,547,739,994,376,700 | STUB - suite_name is a string = Basic, KokkosMechanics, etc.;
suite_data_list will be the values for a key, Basic or KokkosMechanics | scripts/csv_xml.py | create_RPS_xml_report | CRobeck/RAJAPerf | python | def create_RPS_xml_report(suite_name, suite_data_list):
'STUB - suite_name is a string = Basic, KokkosMechanics, etc.;\n suite_data_list will be the values for a key, Basic or KokkosMechanics\n '
aggregate_results_dict = dict()
for list_item in suite_data_list:
for (index, timing) in enumerate... |
def run():
'STUB'
read_infile(infile)
for key in heirarch_dict.keys():
create_RPS_xml_report(key, heirarch_dict[key])
ET.dump(perf_report) | 873,157,699,713,065,100 | STUB | scripts/csv_xml.py | run | CRobeck/RAJAPerf | python | def run():
read_infile(infile)
for key in heirarch_dict.keys():
create_RPS_xml_report(key, heirarch_dict[key])
ET.dump(perf_report) |
def choose_device(self, window, keystore):
'This dialog box should be usable even if the user has\n forgotten their PIN or it is in bootloader mode.'
device_id = self.device_manager().xpub_id(keystore.xpub)
if (not device_id):
try:
info = self.device_manager().select_device(self, ... | -8,359,277,091,128,003,000 | This dialog box should be usable even if the user has
forgotten their PIN or it is in bootloader mode. | qtum_electrum/plugins/hw_wallet/qt.py | choose_device | mikehash/qtum-electrum | python | def choose_device(self, window, keystore):
'This dialog box should be usable even if the user has\n forgotten their PIN or it is in bootloader mode.'
device_id = self.device_manager().xpub_id(keystore.xpub)
if (not device_id):
try:
info = self.device_manager().select_device(self, ... |
def executeJob(sc=None, app: PyCryptoBot=None, state: AppState=None, trading_data=pd.DataFrame()):
'Trading bot job which runs at a scheduled interval'
global technical_analysis
if (app.isLive() and (app.getTime() is None)):
Logger.warning('Your connection to the exchange has gone down, will retry i... | 1,999,010,670,596,664,600 | Trading bot job which runs at a scheduled interval | pycryptobot.py | executeJob | treggit/pycryptobot | python | def executeJob(sc=None, app: PyCryptoBot=None, state: AppState=None, trading_data=pd.DataFrame()):
global technical_analysis
if (app.isLive() and (app.getTime() is None)):
Logger.warning('Your connection to the exchange has gone down, will retry in 1 minute!')
list(map(s.cancel, s.queue))
... |
def get_parser(parser=None, required=True):
'Get default arguments.'
if (parser is None):
parser = configargparse.ArgumentParser(description='Train an automatic speech recognition (ASR) model on one CPU, one or multiple GPUs', config_file_parser_class=configargparse.YAMLConfigFileParser, formatter_class... | -3,972,185,739,843,250,000 | Get default arguments. | espnet/bin/asr_train.py | get_parser | Advanjef/espnet | python | def get_parser(parser=None, required=True):
if (parser is None):
parser = configargparse.ArgumentParser(description='Train an automatic speech recognition (ASR) model on one CPU, one or multiple GPUs', config_file_parser_class=configargparse.YAMLConfigFileParser, formatter_class=configargparse.Argument... |
def main(cmd_args):
'Run the main training function.'
parser = get_parser()
(args, _) = parser.parse_known_args(cmd_args)
if ((args.backend == 'chainer') and (args.train_dtype != 'float32')):
raise NotImplementedError(f'chainer backend does not support --train-dtype {args.train_dtype}.Use --dtyp... | -4,138,780,070,864,323,600 | Run the main training function. | espnet/bin/asr_train.py | main | Advanjef/espnet | python | def main(cmd_args):
parser = get_parser()
(args, _) = parser.parse_known_args(cmd_args)
if ((args.backend == 'chainer') and (args.train_dtype != 'float32')):
raise NotImplementedError(f'chainer backend does not support --train-dtype {args.train_dtype}.Use --dtype float32.')
if ((args.ngpu =... |
def hextriplet(s):
'\n Wrap clldutils.color.rgb_as_hex to provide unified error handling.\n '
if (s in BASE_COLORS):
return rgb_as_hex([float(d) for d in BASE_COLORS[s]])
if (s in CSS4_COLORS):
return CSS4_COLORS[s]
try:
return rgb_as_hex(s)
except (AssertionError, Valu... | 7,425,507,542,396,912,000 | Wrap clldutils.color.rgb_as_hex to provide unified error handling. | src/cldfviz/colormap.py | hextriplet | cldf/cldfviz | python | def hextriplet(s):
'\n \n '
if (s in BASE_COLORS):
return rgb_as_hex([float(d) for d in BASE_COLORS[s]])
if (s in CSS4_COLORS):
return CSS4_COLORS[s]
try:
return rgb_as_hex(s)
except (AssertionError, ValueError) as e:
raise ValueError('Invalid color spec: "{}" (... |
def fold_split(self, random_seed=None):
'\n Splitting the folds.\n\n Args:\n random_seed: Random seed for reproducibility\n\n Returns:\n tensor containing indices for folds, where dim=0 is the fold number\n\n '
if (random_seed is not None):
torch.manual_... | 8,683,108,462,610,148,000 | Splitting the folds.
Args:
random_seed: Random seed for reproducibility
Returns:
tensor containing indices for folds, where dim=0 is the fold number | pymatch/utils/KFold.py | fold_split | raharth/PyMatch | python | def fold_split(self, random_seed=None):
'\n Splitting the folds.\n\n Args:\n random_seed: Random seed for reproducibility\n\n Returns:\n tensor containing indices for folds, where dim=0 is the fold number\n\n '
if (random_seed is not None):
torch.manual_... |
def fold_loaders(self, fold=(- 1)):
'\n Loading a specific fold as train and test data loader. If no fold number is provided it returns the next fold. It returns a randomly sampled subset of\n the original data set.\n\n Args:\n fold: fold number to return\n\n Returns:\n ... | 2,172,173,981,719,047,200 | Loading a specific fold as train and test data loader. If no fold number is provided it returns the next fold. It returns a randomly sampled subset of
the original data set.
Args:
fold: fold number to return
Returns:
(train data loader, test data loader) | pymatch/utils/KFold.py | fold_loaders | raharth/PyMatch | python | def fold_loaders(self, fold=(- 1)):
'\n Loading a specific fold as train and test data loader. If no fold number is provided it returns the next fold. It returns a randomly sampled subset of\n the original data set.\n\n Args:\n fold: fold number to return\n\n Returns:\n ... |
def __init__(self, num_visible, num_hidden, visible_unit_type='bin', main_dir='/Users/chamalgomes/Documents/Python/GitLab/DeepLearning/KAI PROJECT/rbm/models', model_name='rbm_model', gibbs_sampling_steps=1, learning_rate=0.01, momentum=0.9, l2=0.001, batch_size=10, num_epochs=10, stddev=0.1, verbose=0, plot_training_l... | 3,277,234,088,062,646,000 | "
INPUT PARAMETER 1) num_visible: number of visible units in the RBM
INPUT PARAMETER 2) num_hidden: number of hidden units in the RBM
INPUT PARAMETER 3) main_dir: main directory to put the models, data and summary directories
INPUT PARAMETER 4) model_name: name of the model you wanna save the data
INPUT PARAMETER 5) ... | Unsupervised-Learning/rbm.py | __init__ | Phoebe0222/MLSA-workshops-2019-student | python | def __init__(self, num_visible, num_hidden, visible_unit_type='bin', main_dir='/Users/chamalgomes/Documents/Python/GitLab/DeepLearning/KAI PROJECT/rbm/models', model_name='rbm_model', gibbs_sampling_steps=1, learning_rate=0.01, momentum=0.9, l2=0.001, batch_size=10, num_epochs=10, stddev=0.1, verbose=0, plot_training_l... |
def sample_prob(self, probs, rand):
' takes a tensor of probabilitiesas from a sigmoidal activation and sample from all \n the distributions. \n probs INPUT parameter: tensor of probabilities \n rand INPUT parameter :tensor (of same shape as probabilities) of random values \n :RETURN bin... | 8,988,085,133,716,907,000 | takes a tensor of probabilitiesas from a sigmoidal activation and sample from all
the distributions.
probs INPUT parameter: tensor of probabilities
rand INPUT parameter :tensor (of same shape as probabilities) of random values
:RETURN binary sample of probabilities | Unsupervised-Learning/rbm.py | sample_prob | Phoebe0222/MLSA-workshops-2019-student | python | def sample_prob(self, probs, rand):
' takes a tensor of probabilitiesas from a sigmoidal activation and sample from all \n the distributions. \n probs INPUT parameter: tensor of probabilities \n rand INPUT parameter :tensor (of same shape as probabilities) of random values \n :RETURN bin... |
def gen_batches(self, data, batch_size):
' Divide input data into batches \n data INPUT parameter: input data( like a data frame)\n batch_size INPUT parameter: desired size of each batch\n :RETURN data divided in batches \n '
data = np.array(data)
for i in range(0, data.shape[0],... | -2,090,439,240,268,335,400 | Divide input data into batches
data INPUT parameter: input data( like a data frame)
batch_size INPUT parameter: desired size of each batch
:RETURN data divided in batches | Unsupervised-Learning/rbm.py | gen_batches | Phoebe0222/MLSA-workshops-2019-student | python | def gen_batches(self, data, batch_size):
' Divide input data into batches \n data INPUT parameter: input data( like a data frame)\n batch_size INPUT parameter: desired size of each batch\n :RETURN data divided in batches \n '
data = np.array(data)
for i in range(0, data.shape[0],... |
def fit(self, train_set, validation_set=None, restore_previous_model=False):
'"\n fit the model to the training data \n INPUT PARAMETER train_set: training set\n INPUT PARAMETER validation set.default None (Hence Optional)\n INPUT PARAMETER restore_previous_model:\n if... | -8,941,818,064,905,708,000 | "
fit the model to the training data
INPUT PARAMETER train_set: training set
INPUT PARAMETER validation set.default None (Hence Optional)
INPUT PARAMETER restore_previous_model:
if true, a previous trained model
with the same name of this model is restored from disk to continue training.
OUTPUT... | Unsupervised-Learning/rbm.py | fit | Phoebe0222/MLSA-workshops-2019-student | python | def fit(self, train_set, validation_set=None, restore_previous_model=False):
'"\n fit the model to the training data \n INPUT PARAMETER train_set: training set\n INPUT PARAMETER validation set.default None (Hence Optional)\n INPUT PARAMETER restore_previous_model:\n if... |
def _initialize_tf_utilities_and_ops(self, restore_previous_model):
'"\n Initialize TensorFlow operations: summaries, init operations, saver, summary_writer.\n Restore a previously trained model if the flag restore_previous_model is true.\n '
init_op = tf.global_variables_initializer()
... | 1,191,629,061,674,570,500 | "
Initialize TensorFlow operations: summaries, init operations, saver, summary_writer.
Restore a previously trained model if the flag restore_previous_model is true. | Unsupervised-Learning/rbm.py | _initialize_tf_utilities_and_ops | Phoebe0222/MLSA-workshops-2019-student | python | def _initialize_tf_utilities_and_ops(self, restore_previous_model):
'"\n Initialize TensorFlow operations: summaries, init operations, saver, summary_writer.\n Restore a previously trained model if the flag restore_previous_model is true.\n '
init_op = tf.global_variables_initializer()
... |
def _train_model(self, train_set, validation_set):
'" Train the Model \n \n INPUT PARAMETER train set: Training set \n INPUT PARAMETER validation_set: Validation set \n OUTPUT self\n '
for i in range(self.num_epochs):
self._run_train_step(train_set)
if (validat... | 4,000,757,518,716,573,000 | " Train the Model
INPUT PARAMETER train set: Training set
INPUT PARAMETER validation_set: Validation set
OUTPUT self | Unsupervised-Learning/rbm.py | _train_model | Phoebe0222/MLSA-workshops-2019-student | python | def _train_model(self, train_set, validation_set):
'" Train the Model \n \n INPUT PARAMETER train set: Training set \n INPUT PARAMETER validation_set: Validation set \n OUTPUT self\n '
for i in range(self.num_epochs):
self._run_train_step(train_set)
if (validat... |
def _run_train_step(self, train_set):
'"\n Run a training step. A training step is made by randomly shuffling the training set,\n divide into batches and run the variable update nodes for each batch. If self.plot_training_loss \n is true, will record training loss after each batch. \n IN... | 4,960,448,723,193,601,000 | "
Run a training step. A training step is made by randomly shuffling the training set,
divide into batches and run the variable update nodes for each batch. If self.plot_training_loss
is true, will record training loss after each batch.
INPUT PARAMETER train_set: training set
OUTPUT self | Unsupervised-Learning/rbm.py | _run_train_step | Phoebe0222/MLSA-workshops-2019-student | python | def _run_train_step(self, train_set):
'"\n Run a training step. A training step is made by randomly shuffling the training set,\n divide into batches and run the variable update nodes for each batch. If self.plot_training_loss \n is true, will record training loss after each batch. \n IN... |
def _run_validation_error(self, epoch, validation_set):
' \n Run the error computation on the validation set and print it out for each epoch. \n INPUT PARAMETER: current epoch\n INPUT PARAMETER validation_set: validation data\n OUTPUT: self\n '
loss = self.tf_session.run(self.... | 1,609,787,130,270,361,600 | Run the error computation on the validation set and print it out for each epoch.
INPUT PARAMETER: current epoch
INPUT PARAMETER validation_set: validation data
OUTPUT: self | Unsupervised-Learning/rbm.py | _run_validation_error | Phoebe0222/MLSA-workshops-2019-student | python | def _run_validation_error(self, epoch, validation_set):
' \n Run the error computation on the validation set and print it out for each epoch. \n INPUT PARAMETER: current epoch\n INPUT PARAMETER validation_set: validation data\n OUTPUT: self\n '
loss = self.tf_session.run(self.... |
def _create_feed_dict(self, data):
" Create the dictionary of data to feed to TensorFlow's session during training.\n :param data: training/validation set batch\n :return: dictionary(self.input_data: data, self.hrand: random_uniform)\n "
return {self.input_data: data, self.hrand: np.random.... | 1,993,604,828,718,735,400 | Create the dictionary of data to feed to TensorFlow's session during training.
:param data: training/validation set batch
:return: dictionary(self.input_data: data, self.hrand: random_uniform) | Unsupervised-Learning/rbm.py | _create_feed_dict | Phoebe0222/MLSA-workshops-2019-student | python | def _create_feed_dict(self, data):
" Create the dictionary of data to feed to TensorFlow's session during training.\n :param data: training/validation set batch\n :return: dictionary(self.input_data: data, self.hrand: random_uniform)\n "
return {self.input_data: data, self.hrand: np.random.... |
def _build_model(self):
'\n BUilding the Restriced Boltzman Machine in Tensorflow\n '
(self.input_data, self.hrand) = self._create_placeholders()
(self.W, self.bh_, self.bv_, self.dw, self.dbh_, self.dbv_) = self._create_variables()
(hprobs0, hstates0, vprobs, hprobs1, hstates1) = self.gib... | 5,571,932,781,441,398,000 | BUilding the Restriced Boltzman Machine in Tensorflow | Unsupervised-Learning/rbm.py | _build_model | Phoebe0222/MLSA-workshops-2019-student | python | def _build_model(self):
'\n \n '
(self.input_data, self.hrand) = self._create_placeholders()
(self.W, self.bh_, self.bv_, self.dw, self.dbh_, self.dbv_) = self._create_variables()
(hprobs0, hstates0, vprobs, hprobs1, hstates1) = self.gibbs_sampling_step(self.input_data)
positive = self... |
def _create_free_energy_for_batch(self):
' Create free energy ops to batch input data \n :return: self\n '
if (self.visible_unit_type == 'bin'):
self._create_free_energy_for_bin()
elif (self.visible_unit_type == 'gauss'):
self._create_free_energy_for_gauss()
else:
s... | -7,953,426,236,799,308,000 | Create free energy ops to batch input data
:return: self | Unsupervised-Learning/rbm.py | _create_free_energy_for_batch | Phoebe0222/MLSA-workshops-2019-student | python | def _create_free_energy_for_batch(self):
' Create free energy ops to batch input data \n :return: self\n '
if (self.visible_unit_type == 'bin'):
self._create_free_energy_for_bin()
elif (self.visible_unit_type == 'gauss'):
self._create_free_energy_for_gauss()
else:
s... |
def _create_free_energy_for_bin(self):
' Create free energy for mdoel with Bin visible layer\n :return: self\n '
self.batch_free_energy = (- (tf.matmul(self.input_data, tf.reshape(self.bv_, [(- 1), 1])) + tf.reshape(tf.reduce_sum(tf.log((tf.exp((tf.matmul(self.input_data, self.W) + self.bh_)) + 1)... | -3,489,726,197,046,207,000 | Create free energy for mdoel with Bin visible layer
:return: self | Unsupervised-Learning/rbm.py | _create_free_energy_for_bin | Phoebe0222/MLSA-workshops-2019-student | python | def _create_free_energy_for_bin(self):
' Create free energy for mdoel with Bin visible layer\n :return: self\n '
self.batch_free_energy = (- (tf.matmul(self.input_data, tf.reshape(self.bv_, [(- 1), 1])) + tf.reshape(tf.reduce_sum(tf.log((tf.exp((tf.matmul(self.input_data, self.W) + self.bh_)) + 1)... |
def _create_free_energy_for_gauss(self):
' Create free energy for model with Gauss visible layer \n :return: self\n '
self.batch_free_energy = (- ((tf.matmul(self.input_data, tf.reshape(self.bv_, [(- 1), 1])) - tf.reshape(tf.reduce_sum(((0.5 * self.input_data) * self.input_data), 1), [(- 1), 1])) ... | -4,266,481,182,452,475,400 | Create free energy for model with Gauss visible layer
:return: self | Unsupervised-Learning/rbm.py | _create_free_energy_for_gauss | Phoebe0222/MLSA-workshops-2019-student | python | def _create_free_energy_for_gauss(self):
' Create free energy for model with Gauss visible layer \n :return: self\n '
self.batch_free_energy = (- ((tf.matmul(self.input_data, tf.reshape(self.bv_, [(- 1), 1])) - tf.reshape(tf.reduce_sum(((0.5 * self.input_data) * self.input_data), 1), [(- 1), 1])) ... |
def _create_placeholders(self):
' Create the TensorFlow placeholders for the model.\n :return: tuple(input(shape(None, num_visible)), \n hrand(shape(None, num_hidden)))\n '
x = tf.placeholder('float', [None, self.num_visible], name='x-input')
hrand = tf.placeholder('float... | -8,748,354,369,674,363,000 | Create the TensorFlow placeholders for the model.
:return: tuple(input(shape(None, num_visible)),
hrand(shape(None, num_hidden))) | Unsupervised-Learning/rbm.py | _create_placeholders | Phoebe0222/MLSA-workshops-2019-student | python | def _create_placeholders(self):
' Create the TensorFlow placeholders for the model.\n :return: tuple(input(shape(None, num_visible)), \n hrand(shape(None, num_hidden)))\n '
x = tf.placeholder('float', [None, self.num_visible], name='x-input')
hrand = tf.placeholder('float... |
def _create_variables(self):
' Create the TensorFlow variables for the model.\n :return: tuple(weights(shape(num_visible, num_hidden),\n hidden bias(shape(num_hidden)),\n visible bias(shape(num_visible)))\n '
W = tf.Variable(tf.random_normal((self.num_vi... | -2,261,539,388,551,716,000 | Create the TensorFlow variables for the model.
:return: tuple(weights(shape(num_visible, num_hidden),
hidden bias(shape(num_hidden)),
visible bias(shape(num_visible))) | Unsupervised-Learning/rbm.py | _create_variables | Phoebe0222/MLSA-workshops-2019-student | python | def _create_variables(self):
' Create the TensorFlow variables for the model.\n :return: tuple(weights(shape(num_visible, num_hidden),\n hidden bias(shape(num_hidden)),\n visible bias(shape(num_visible)))\n '
W = tf.Variable(tf.random_normal((self.num_vi... |
def gibbs_sampling_step(self, visible):
' Performs one step of gibbs sampling.\n :param visible: activations of the visible units\n :return: tuple(hidden probs, hidden states, visible probs,\n new hidden probs, new hidden states)\n '
(hprobs, hstates) = self.sample_hid... | 6,320,407,482,200,791,000 | Performs one step of gibbs sampling.
:param visible: activations of the visible units
:return: tuple(hidden probs, hidden states, visible probs,
new hidden probs, new hidden states) | Unsupervised-Learning/rbm.py | gibbs_sampling_step | Phoebe0222/MLSA-workshops-2019-student | python | def gibbs_sampling_step(self, visible):
' Performs one step of gibbs sampling.\n :param visible: activations of the visible units\n :return: tuple(hidden probs, hidden states, visible probs,\n new hidden probs, new hidden states)\n '
(hprobs, hstates) = self.sample_hid... |
def sample_hidden_from_visible(self, visible):
' Sample the hidden units from the visible units.\n This is the Positive phase of the Contrastive Divergence algorithm.\n :param visible: activations of the visible units\n :return: tuple(hidden probabilities, hidden binary states)\n '
h... | -5,385,906,317,538,630,000 | Sample the hidden units from the visible units.
This is the Positive phase of the Contrastive Divergence algorithm.
:param visible: activations of the visible units
:return: tuple(hidden probabilities, hidden binary states) | Unsupervised-Learning/rbm.py | sample_hidden_from_visible | Phoebe0222/MLSA-workshops-2019-student | python | def sample_hidden_from_visible(self, visible):
' Sample the hidden units from the visible units.\n This is the Positive phase of the Contrastive Divergence algorithm.\n :param visible: activations of the visible units\n :return: tuple(hidden probabilities, hidden binary states)\n '
h... |
def sample_visible_from_hidden(self, hidden):
' Sample the visible units from the hidden units.\n This is the Negative phase of the Contrastive Divergence algorithm.\n :param hidden: activations of the hidden units\n :return: visible probabilities\n '
visible_activation = (tf.matmul(... | -3,314,956,082,504,032,000 | Sample the visible units from the hidden units.
This is the Negative phase of the Contrastive Divergence algorithm.
:param hidden: activations of the hidden units
:return: visible probabilities | Unsupervised-Learning/rbm.py | sample_visible_from_hidden | Phoebe0222/MLSA-workshops-2019-student | python | def sample_visible_from_hidden(self, hidden):
' Sample the visible units from the hidden units.\n This is the Negative phase of the Contrastive Divergence algorithm.\n :param hidden: activations of the hidden units\n :return: visible probabilities\n '
visible_activation = (tf.matmul(... |
def compute_positive_association(self, visible, hidden_probs, hidden_states):
' Compute positive associations between visible and hidden units.\n :param visible: visible units\n :param hidden_probs: hidden units probabilities\n :param hidden_states: hidden units states\n :return: positiv... | -2,116,715,240,932,941,800 | Compute positive associations between visible and hidden units.
:param visible: visible units
:param hidden_probs: hidden units probabilities
:param hidden_states: hidden units states
:return: positive association = dot(visible.T, hidden) | Unsupervised-Learning/rbm.py | compute_positive_association | Phoebe0222/MLSA-workshops-2019-student | python | def compute_positive_association(self, visible, hidden_probs, hidden_states):
' Compute positive associations between visible and hidden units.\n :param visible: visible units\n :param hidden_probs: hidden units probabilities\n :param hidden_states: hidden units states\n :return: positiv... |
def _create_model_directory(self):
' Create the directory for storing the model\n :return: self\n '
if (not os.path.isdir(self.main_dir)):
print('Created dir: ', self.main_dir)
os.mkdir(self.main_dir) | 2,877,616,471,642,086,400 | Create the directory for storing the model
:return: self | Unsupervised-Learning/rbm.py | _create_model_directory | Phoebe0222/MLSA-workshops-2019-student | python | def _create_model_directory(self):
' Create the directory for storing the model\n :return: self\n '
if (not os.path.isdir(self.main_dir)):
print('Created dir: ', self.main_dir)
os.mkdir(self.main_dir) |
def getRecontructError(self, data):
' return Reconstruction Error (loss) from data in batch.\n :param data: input data of shape num_samples x visible_size\n :return: Reconstruction cost for each sample in the batch\n '
with tf.Session() as self.tf_session:
self.tf_saver.restore(self... | 554,381,575,356,357,100 | return Reconstruction Error (loss) from data in batch.
:param data: input data of shape num_samples x visible_size
:return: Reconstruction cost for each sample in the batch | Unsupervised-Learning/rbm.py | getRecontructError | Phoebe0222/MLSA-workshops-2019-student | python | def getRecontructError(self, data):
' return Reconstruction Error (loss) from data in batch.\n :param data: input data of shape num_samples x visible_size\n :return: Reconstruction cost for each sample in the batch\n '
with tf.Session() as self.tf_session:
self.tf_saver.restore(self... |
def getFreeEnergy(self, data):
' return Free Energy from data.\n :param data: input data of shape num_samples x visible_size\n :return: Free Energy for each sample: p(x)\n '
with tf.Session() as self.tf_session:
self.tf_saver.restore(self.tf_session, self.model_path)
batch_F... | 2,393,992,164,699,182,600 | return Free Energy from data.
:param data: input data of shape num_samples x visible_size
:return: Free Energy for each sample: p(x) | Unsupervised-Learning/rbm.py | getFreeEnergy | Phoebe0222/MLSA-workshops-2019-student | python | def getFreeEnergy(self, data):
' return Free Energy from data.\n :param data: input data of shape num_samples x visible_size\n :return: Free Energy for each sample: p(x)\n '
with tf.Session() as self.tf_session:
self.tf_saver.restore(self.tf_session, self.model_path)
batch_F... |
def load_model(self, shape, gibbs_sampling_steps, model_path):
' Load a trained model from disk. The shape of the model\n (num_visible, num_hidden) and the number of gibbs sampling steps\n must be known in order to restore the model.\n :param shape: tuple(num_visible, num_hidden)\n :para... | -4,758,758,241,476,712,000 | Load a trained model from disk. The shape of the model
(num_visible, num_hidden) and the number of gibbs sampling steps
must be known in order to restore the model.
:param shape: tuple(num_visible, num_hidden)
:param gibbs_sampling_steps:
:param model_path:
:return: self | Unsupervised-Learning/rbm.py | load_model | Phoebe0222/MLSA-workshops-2019-student | python | def load_model(self, shape, gibbs_sampling_steps, model_path):
' Load a trained model from disk. The shape of the model\n (num_visible, num_hidden) and the number of gibbs sampling steps\n must be known in order to restore the model.\n :param shape: tuple(num_visible, num_hidden)\n :para... |
def get_model_parameters(self):
' Return the model parameters in the form of numpy arrays.\n :return: model parameters\n '
with tf.Session() as self.tf_session:
self.tf_saver.restore(self.tf_session, self.model_path)
return {'W': self.W.eval(), 'bh_': self.bh_.eval(), 'bv_': self.b... | -5,972,333,097,598,204,000 | Return the model parameters in the form of numpy arrays.
:return: model parameters | Unsupervised-Learning/rbm.py | get_model_parameters | Phoebe0222/MLSA-workshops-2019-student | python | def get_model_parameters(self):
' Return the model parameters in the form of numpy arrays.\n :return: model parameters\n '
with tf.Session() as self.tf_session:
self.tf_saver.restore(self.tf_session, self.model_path)
return {'W': self.W.eval(), 'bh_': self.bh_.eval(), 'bv_': self.b... |
def setup(hass, config):
'Set up the Smapee component.'
client_id = config.get(DOMAIN).get(CONF_CLIENT_ID)
client_secret = config.get(DOMAIN).get(CONF_CLIENT_SECRET)
username = config.get(DOMAIN).get(CONF_USERNAME)
password = config.get(DOMAIN).get(CONF_PASSWORD)
host = config.get(DOMAIN).get(CO... | 7,854,840,177,363,320,000 | Set up the Smapee component. | homeassistant/components/smappee.py | setup | Arshrock/home-assistant | python | def setup(hass, config):
client_id = config.get(DOMAIN).get(CONF_CLIENT_ID)
client_secret = config.get(DOMAIN).get(CONF_CLIENT_SECRET)
username = config.get(DOMAIN).get(CONF_USERNAME)
password = config.get(DOMAIN).get(CONF_PASSWORD)
host = config.get(DOMAIN).get(CONF_HOST)
host_password = c... |
def __init__(self, client_id, client_secret, username, password, host, host_password):
'Initialize the data.'
import smappy
self._remote_active = False
self._local_active = False
if (client_id is not None):
try:
self._smappy = smappy.Smappee(client_id, client_secret)
... | 1,914,008,224,257,149,400 | Initialize the data. | homeassistant/components/smappee.py | __init__ | Arshrock/home-assistant | python | def __init__(self, client_id, client_secret, username, password, host, host_password):
import smappy
self._remote_active = False
self._local_active = False
if (client_id is not None):
try:
self._smappy = smappy.Smappee(client_id, client_secret)
self._smappy.authentic... |
@Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self):
'Update data from Smappee API.'
if self.is_remote_active:
service_locations = self._smappy.get_service_locations().get('serviceLocations')
for location in service_locations:
location_id = location.get('serviceLocationId')
... | -5,550,122,194,476,160,000 | Update data from Smappee API. | homeassistant/components/smappee.py | update | Arshrock/home-assistant | python | @Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self):
if self.is_remote_active:
service_locations = self._smappy.get_service_locations().get('serviceLocations')
for location in service_locations:
location_id = location.get('serviceLocationId')
if (location_id is not None... |
@property
def is_remote_active(self):
'Return true if Smappe server is configured and working.'
return self._remote_active | 7,469,132,084,847,460,000 | Return true if Smappe server is configured and working. | homeassistant/components/smappee.py | is_remote_active | Arshrock/home-assistant | python | @property
def is_remote_active(self):
return self._remote_active |
@property
def is_local_active(self):
'Return true if Smappe local device is configured and working.'
return self._local_active | -9,195,173,792,660,097,000 | Return true if Smappe local device is configured and working. | homeassistant/components/smappee.py | is_local_active | Arshrock/home-assistant | python | @property
def is_local_active(self):
return self._local_active |
def get_switches(self):
'Get switches from local Smappee.'
if (not self.is_local_active):
return
try:
return self._localsmappy.load_command_control_config()
except RequestException as error:
_LOGGER.error('Error getting switches from local Smappee. (%s)', error) | 3,160,238,743,753,751,600 | Get switches from local Smappee. | homeassistant/components/smappee.py | get_switches | Arshrock/home-assistant | python | def get_switches(self):
if (not self.is_local_active):
return
try:
return self._localsmappy.load_command_control_config()
except RequestException as error:
_LOGGER.error('Error getting switches from local Smappee. (%s)', error) |
def get_consumption(self, location_id, aggregation, delta):
'Update data from Smappee.'
if (not self.is_remote_active):
return
end = datetime.utcnow()
start = (end - timedelta(minutes=delta))
try:
return self._smappy.get_consumption(location_id, start, end, aggregation)
except Re... | -4,255,988,973,020,689,400 | Update data from Smappee. | homeassistant/components/smappee.py | get_consumption | Arshrock/home-assistant | python | def get_consumption(self, location_id, aggregation, delta):
if (not self.is_remote_active):
return
end = datetime.utcnow()
start = (end - timedelta(minutes=delta))
try:
return self._smappy.get_consumption(location_id, start, end, aggregation)
except RequestException as error:
... |
def get_sensor_consumption(self, location_id, sensor_id, aggregation, delta):
'Update data from Smappee.'
if (not self.is_remote_active):
return
end = datetime.utcnow()
start = (end - timedelta(minutes=delta))
try:
return self._smappy.get_sensor_consumption(location_id, sensor_id, st... | -1,799,282,535,104,980,000 | Update data from Smappee. | homeassistant/components/smappee.py | get_sensor_consumption | Arshrock/home-assistant | python | def get_sensor_consumption(self, location_id, sensor_id, aggregation, delta):
if (not self.is_remote_active):
return
end = datetime.utcnow()
start = (end - timedelta(minutes=delta))
try:
return self._smappy.get_sensor_consumption(location_id, sensor_id, start, end, aggregation)
... |
def actuator_on(self, location_id, actuator_id, is_remote_switch, duration=None):
'Turn on actuator.'
try:
if is_remote_switch:
self._smappy.actuator_on(location_id, actuator_id, duration)
self._smappy.actuator_on(location_id, actuator_id, duration)
else:
self... | 6,920,471,198,806,654,000 | Turn on actuator. | homeassistant/components/smappee.py | actuator_on | Arshrock/home-assistant | python | def actuator_on(self, location_id, actuator_id, is_remote_switch, duration=None):
try:
if is_remote_switch:
self._smappy.actuator_on(location_id, actuator_id, duration)
self._smappy.actuator_on(location_id, actuator_id, duration)
else:
self._localsmappy.on_co... |
def actuator_off(self, location_id, actuator_id, is_remote_switch, duration=None):
'Turn off actuator.'
try:
if is_remote_switch:
self._smappy.actuator_off(location_id, actuator_id, duration)
self._smappy.actuator_off(location_id, actuator_id, duration)
else:
... | 1,006,460,597,006,499,000 | Turn off actuator. | homeassistant/components/smappee.py | actuator_off | Arshrock/home-assistant | python | def actuator_off(self, location_id, actuator_id, is_remote_switch, duration=None):
try:
if is_remote_switch:
self._smappy.actuator_off(location_id, actuator_id, duration)
self._smappy.actuator_off(location_id, actuator_id, duration)
else:
self._localsmappy.of... |
def active_power(self):
'Get sum of all instantaneous active power values from local hub.'
if (not self.is_local_active):
return
try:
return self._localsmappy.active_power()
except RequestException as error:
_LOGGER.error('Error getting data from Local Smappee unit. (%s)', error) | 8,179,547,795,337,284,000 | Get sum of all instantaneous active power values from local hub. | homeassistant/components/smappee.py | active_power | Arshrock/home-assistant | python | def active_power(self):
if (not self.is_local_active):
return
try:
return self._localsmappy.active_power()
except RequestException as error:
_LOGGER.error('Error getting data from Local Smappee unit. (%s)', error) |
def active_cosfi(self):
'Get the average of all instantaneous cosfi values.'
if (not self.is_local_active):
return
try:
return self._localsmappy.active_cosfi()
except RequestException as error:
_LOGGER.error('Error getting data from Local Smappee unit. (%s)', error) | -4,409,512,030,781,574,700 | Get the average of all instantaneous cosfi values. | homeassistant/components/smappee.py | active_cosfi | Arshrock/home-assistant | python | def active_cosfi(self):
if (not self.is_local_active):
return
try:
return self._localsmappy.active_cosfi()
except RequestException as error:
_LOGGER.error('Error getting data from Local Smappee unit. (%s)', error) |
def instantaneous_values(self):
'ReportInstantaneousValues.'
if (not self.is_local_active):
return
report_instantaneous_values = self._localsmappy.report_instantaneous_values()
report_result = report_instantaneous_values['report'].split('<BR>')
properties = {}
for lines in report_result:... | 7,188,063,171,174,411,000 | ReportInstantaneousValues. | homeassistant/components/smappee.py | instantaneous_values | Arshrock/home-assistant | python | def instantaneous_values(self):
if (not self.is_local_active):
return
report_instantaneous_values = self._localsmappy.report_instantaneous_values()
report_result = report_instantaneous_values['report'].split('<BR>')
properties = {}
for lines in report_result:
lines_result = line... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.