content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
"""Tracks devices by sending a ICMP echo request (ping).""" PING_TIMEOUT = 3 PING_ATTEMPTS_COUNT = 3
"""Tracks devices by sending a ICMP echo request (ping).""" ping_timeout = 3 ping_attempts_count = 3
set_name(0x80122CDC, "PreGameOnlyTestRoutine__Fv", SN_NOWARN) set_name(0x80124DA0, "DRLG_PlaceDoor__Fii", SN_NOWARN) set_name(0x80125274, "DRLG_L1Shadows__Fv", SN_NOWARN) set_name(0x8012568C, "DRLG_PlaceMiniSet__FPCUciiiiiii", SN_NOWARN) set_name(0x80125AF8, "DRLG_L1Floor__Fv", SN_NOWARN) set_name(0x80125BE4, "StoreBlo...
set_name(2148674780, 'PreGameOnlyTestRoutine__Fv', SN_NOWARN) set_name(2148683168, 'DRLG_PlaceDoor__Fii', SN_NOWARN) set_name(2148684404, 'DRLG_L1Shadows__Fv', SN_NOWARN) set_name(2148685452, 'DRLG_PlaceMiniSet__FPCUciiiiiii', SN_NOWARN) set_name(2148686584, 'DRLG_L1Floor__Fv', SN_NOWARN) set_name(2148686820, 'StoreBlo...
# -*- coding: utf-8 -*- class Solution(object): def reverse(self, x): """ :type x: int :rtype: int """ ans = 0 flag = 1 if x < 0: flag = -1 x = - x while x != 0: cur = x % 10 ans = ans * 10 + cur ...
class Solution(object): def reverse(self, x): """ :type x: int :rtype: int """ ans = 0 flag = 1 if x < 0: flag = -1 x = -x while x != 0: cur = x % 10 ans = ans * 10 + cur x = x // 10 ...
# # PySNMP MIB module ALCATEL-IND1-AUTO-FABRIC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALCATEL-IND1-AUTO-FABRIC-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:01:26 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python vers...
(softent_ind1_auto_fabric,) = mibBuilder.importSymbols('ALCATEL-IND1-BASE', 'softentIND1AutoFabric') (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_cons...
"""settings.py - Contains MAILGUN settings""" MAILGUN_DOMAIN_NAME = "sandbox301369dd8c464b87b7874ba72a5e3039.mailgun.org" MAILGUN_PRIVATE_API_KEY = "key-de714a26093d427c84abcb980d3f3f0a" MAILGUN_PUBLIC_API_KEY = "pubkey-2b308844086ef26cee582ce10ac7303b" MAILGUN_SANDBOX_SENDER = "Mailgun Sandbox <postmaster@sandbox3013...
"""settings.py - Contains MAILGUN settings""" mailgun_domain_name = 'sandbox301369dd8c464b87b7874ba72a5e3039.mailgun.org' mailgun_private_api_key = 'key-de714a26093d427c84abcb980d3f3f0a' mailgun_public_api_key = 'pubkey-2b308844086ef26cee582ce10ac7303b' mailgun_sandbox_sender = 'Mailgun Sandbox <postmaster@sandbox30136...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Cambia el formato de fecha dd/mm/aaaa por aaaa-mm-dd ejemplo: entrada = 20/04/2021 salida = 2021-20-04 """ def plugin_main(*args, **kwargs): # print ('args : ',args) # print ('kwargs: ',kwargs) fecha = kwargs['fecha'][0] fecha = '{}-{}-{}'.format(fecha...
""" Cambia el formato de fecha dd/mm/aaaa por aaaa-mm-dd ejemplo: entrada = 20/04/2021 salida = 2021-20-04 """ def plugin_main(*args, **kwargs): fecha = kwargs['fecha'][0] fecha = '{}-{}-{}'.format(fecha[-4:], fecha[3:5], fecha[:2]) return ('fecha', fecha)
# Copyright (c) 2014, Charles Duyk # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # Redistributions of source code must retain the above copyright # notice, this list of conditions and the fo...
def dict_find(dictionary, name, exact=True): lower_name = name.lower() result = [] if exact: try: result.append(dictionary[lowerName]) except KeyError: pass else: for key in dictionary: if lowerName in key: result.append(diction...
AWS_DOCKER_HOST = "308535385114.dkr.ecr.us-east-1.amazonaws.com" def gen_docker_image(container_type): return ( "/".join([AWS_DOCKER_HOST, "pytorch", container_type]), f"docker-{container_type}", ) def gen_docker_image_requires(image_name): return [f"docker-{image_name}"] DOCKER_IMAGE_BA...
aws_docker_host = '308535385114.dkr.ecr.us-east-1.amazonaws.com' def gen_docker_image(container_type): return ('/'.join([AWS_DOCKER_HOST, 'pytorch', container_type]), f'docker-{container_type}') def gen_docker_image_requires(image_name): return [f'docker-{image_name}'] (docker_image_basic, docker_requirement_...
# # PySNMP MIB module DNOS-KEYING-PRIVATE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DNOS-KEYING-PRIVATE-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:36:48 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 ...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint, constraints_union) ...
class QTimer: def __init__(self, ticks_per_hour = 60, hours_per_day:int = 24): self.ticks = 0 self.ticks_per_hour = ticks_per_hour self.hours_per_day = hours_per_day def tick(self, increment : int = 1): self.ticks += increment @property def minutes(self): retu...
class Qtimer: def __init__(self, ticks_per_hour=60, hours_per_day: int=24): self.ticks = 0 self.ticks_per_hour = ticks_per_hour self.hours_per_day = hours_per_day def tick(self, increment: int=1): self.ticks += increment @property def minutes(self): return self...
# Copyright (C) 2020 Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "No Default Account", "version": "14.0.1.0.0", "development_status": "Beta", "author": "Open Source Integrators, Odoo Community Association (OCA)", "maintainers": ["dreispt"], ...
{'name': 'No Default Account', 'version': '14.0.1.0.0', 'development_status': 'Beta', 'author': 'Open Source Integrators, Odoo Community Association (OCA)', 'maintainers': ['dreispt'], 'summary': 'Remove default expense account for vendor bills journal', 'website': 'https://github.com/OCA/account-financial-tools', 'lic...
def swap_even_and_odd_bits(n): '''Swaps the even and odd bits of an unsigned, 8-bits number. >>> swap_even_and_odd_bits(0b10101010) == 0b01010101 True >>> swap_even_and_odd_bits(0b11100010) == 0b11010001 True ''' assert 0 <= n <= 0xFF, 'Not an 8-bit unsigned number' return ((n & 0b10101...
def swap_even_and_odd_bits(n): """Swaps the even and odd bits of an unsigned, 8-bits number. >>> swap_even_and_odd_bits(0b10101010) == 0b01010101 True >>> swap_even_and_odd_bits(0b11100010) == 0b11010001 True """ assert 0 <= n <= 255, 'Not an 8-bit unsigned number' return (n & 170) >> 1...
URLs = { "ADULT_SAMPLE":[ "https://s3.amazonaws.com/fast-ai-sample/adult_sample.tgz", 968212, "64eb9d7e23732de0b138f7372d15492f" ], "AG_NEWS":[ "https://s3.amazonaws.com/fast-ai-nlp/ag_news_csv.tgz", 11784419, "b86f328f4dbd072486591cb7a5644dcd" ], "AMAZON_REVIEWS":[ ...
ur_ls = {'ADULT_SAMPLE': ['https://s3.amazonaws.com/fast-ai-sample/adult_sample.tgz', 968212, '64eb9d7e23732de0b138f7372d15492f'], 'AG_NEWS': ['https://s3.amazonaws.com/fast-ai-nlp/ag_news_csv.tgz', 11784419, 'b86f328f4dbd072486591cb7a5644dcd'], 'AMAZON_REVIEWS': ['https://s3.amazonaws.com/fast-ai-nlp/amazon_review_ful...
n = 6 k = 3 keys = [i for i in range(int(n))] values = [0] * n a = dict(zip(keys, values)) result = [] def recur(s, n, was, result): if len(s) == k: result.append(s) return for i in range(0, n): if was[i] == 0: was[i] = 1 recur(s + str(i + 1), n, was, result) ...
n = 6 k = 3 keys = [i for i in range(int(n))] values = [0] * n a = dict(zip(keys, values)) result = [] def recur(s, n, was, result): if len(s) == k: result.append(s) return for i in range(0, n): if was[i] == 0: was[i] = 1 recur(s + str(i + 1), n, was, result) ...
"""Test utils for gourde.""" def setup(gourde, args=None): """Setup gourde for testing.""" args = args or [] parser = gourde.get_argparser() # Make sure we don't use sys.argv. args = parser.parse_args(args) # Setup everything. gourde.setup(args)
"""Test utils for gourde.""" def setup(gourde, args=None): """Setup gourde for testing.""" args = args or [] parser = gourde.get_argparser() args = parser.parse_args(args) gourde.setup(args)
# # PySNMP MIB module DeltaUPS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DeltaUPS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:43:21 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019,...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, value_size_constraint, constraints_union, constraints_intersection) ...
with open('trenutek.txt',"r") as datoteka: i = 1 dat2 = open('trenutek1.txt',"w") for vrstica in datoteka: dat2.write(str(i) +","+ vrstica) i += 1 dat2.close()
with open('trenutek.txt', 'r') as datoteka: i = 1 dat2 = open('trenutek1.txt', 'w') for vrstica in datoteka: dat2.write(str(i) + ',' + vrstica) i += 1 dat2.close()
x=[1,1] for i in range(1000): x=x+[x[-1]+x[-2]] #iteration 1 #x=[1,1]+[1+1] #x=[1,1]+[2] #x=[1,1,2] #iteration 2 #x=[1,1,2]+[1+2] #x=[1,1,2]+[3] #x=[1,1,2,3] print(x) print(x[-1]/x[-2])
x = [1, 1] for i in range(1000): x = x + [x[-1] + x[-2]] print(x) print(x[-1] / x[-2])
class Tablet : def __init__(self,tablet_proxy): self._tablet = tablet_proxy def set_background(self,color): self._tablet.setBackgroundColor(color) def set_image(self,url): self._tablet.showImage(url) def load_image(self,url): return self._table.preLoadImage(url)
class Tablet: def __init__(self, tablet_proxy): self._tablet = tablet_proxy def set_background(self, color): self._tablet.setBackgroundColor(color) def set_image(self, url): self._tablet.showImage(url) def load_image(self, url): return self._table.preLoadImage(url)
input = """ b(1). a(X) :- b(X). :- p(X). """ output = """ b(1). a(X) :- b(X). :- p(X). """
input = '\nb(1).\na(X) :- b(X).\n:- p(X).\n' output = '\nb(1).\na(X) :- b(X).\n:- p(X).\n'
''' lab 7 ''' #3.1 i = 0 while i <=5: if i !=3: print(i) i = i+1 #3.2 i = 1 result = 1 while i <=5: print() i = i+1 print(result) #3.3 i = 1 result = 0 while i <=5: result = result +i i = i+1 print(result) #3.4 i = 3 result = 0 while i <=8: ...
""" lab 7 """ i = 0 while i <= 5: if i != 3: print(i) i = i + 1 i = 1 result = 1 while i <= 5: print() i = i + 1 print(result) i = 1 result = 0 while i <= 5: result = result + i i = i + 1 print(result) i = 3 result = 0 while i <= 8: result = result + i i = i + 1 print(result) i =...
lpu = "LPU" speciality = "SPECIALLITY" token = "TOKEN" chat_id = "CHAT_NAME" # if u re planing to send
lpu = 'LPU' speciality = 'SPECIALLITY' token = 'TOKEN' chat_id = 'CHAT_NAME'
""" Super-Automation MySQL plugin-related exceptions. Raising one of these in a test will cause the test-state to be logged appropriately in the DB for tests that use the Super-Automation MySQL plugin. """ class BlockedTest(Exception): """ Raise this to mark a test as Blocked in the DB. """ pass class SkipT...
""" Super-Automation MySQL plugin-related exceptions. Raising one of these in a test will cause the test-state to be logged appropriately in the DB for tests that use the Super-Automation MySQL plugin. """ class Blockedtest(Exception): """ Raise this to mark a test as Blocked in the DB. """ pass class Skiptes...
class Event: """""" PINGED = 'ping' PONGED = 'pong' CONNECTED = 'connected' """ Called when the Websocket client has successfully connected to the server. :param user: The twitch user that connected to the server .. code-block:: python3 @client.event(twitch.Event.CONNECTED)...
class Event: """""" pinged = 'ping' ponged = 'pong' connected = 'connected' "\n Called when the Websocket client has successfully connected to the server.\n\n :param user: The twitch user that connected to the server\n\n .. code-block:: python3\n\n @client.event(twitch.Event.CONNECTE...
def time_difference(was_hours, was_minutes, was_seconds, now_hours, now_minutes, now_seconds): now_hours -= was_hours now_minutes -= was_minutes now_seconds -= was_seconds seconds_passed = 0 now_minutes = now_minutes * 60 now_hours = now_hours * 3600 seconds_passed += now_seconds seconds...
def time_difference(was_hours, was_minutes, was_seconds, now_hours, now_minutes, now_seconds): now_hours -= was_hours now_minutes -= was_minutes now_seconds -= was_seconds seconds_passed = 0 now_minutes = now_minutes * 60 now_hours = now_hours * 3600 seconds_passed += now_seconds seconds...
# Plot the raw data before setting the datetime index df.plot() plt.show() # Convert the 'Date' column into a collection of datetime objects: df.Date df.Date = pd.to_datetime(df.Date) # Set the index to be the converted 'Date' column df.set_index('Date', inplace=True) # Re-plot the DataFrame to see that the axis is ...
df.plot() plt.show() df.Date = pd.to_datetime(df.Date) df.set_index('Date', inplace=True) df.plot() plt.show()
def binary(num): s = "" if num != 0: while num >= 1: if num % 2 == 0: s = s + "0" num = num/2 else: s = s + "1" num = num/2 else: s="0" return "".join(reversed(s)) print(binary(12))
def binary(num): s = '' if num != 0: while num >= 1: if num % 2 == 0: s = s + '0' num = num / 2 else: s = s + '1' num = num / 2 else: s = '0' return ''.join(reversed(s)) print(binary(12))
_lookup = { # https://support.microsoft.com/en-us/kb/89879 'MS_ADPCM': 1, 'IMA_ADPCM': 1, 'PCM_S8': 1, 'PCM_U8': 1, 'PCM_16': 2, 'PCM_24': 3, 'PCM_32': 4, 'FLOAT': 4, 'DOUBLE': 8, # this is a guess, erring on the side of caution 'VORBIS': 3 } def chunk_size_samples(sf...
_lookup = {'MS_ADPCM': 1, 'IMA_ADPCM': 1, 'PCM_S8': 1, 'PCM_U8': 1, 'PCM_16': 2, 'PCM_24': 3, 'PCM_32': 4, 'FLOAT': 4, 'DOUBLE': 8, 'VORBIS': 3} def chunk_size_samples(sf, buf): """ Black magic to account for the fact that libsndfile's behavior varies depending on file format when using the virtual io api....
numbers = [int(s) for s in input().split()] command = input() while command != 'end': command = command.split() action = command[0] if action == 'swap': index_1 = int(command[1]) index_2 = int(command[2]) numbers[index_1], numbers[index_2] = numbers[index_2], numbers[index_1] e...
numbers = [int(s) for s in input().split()] command = input() while command != 'end': command = command.split() action = command[0] if action == 'swap': index_1 = int(command[1]) index_2 = int(command[2]) (numbers[index_1], numbers[index_2]) = (numbers[index_2], numbers[index_1]) ...
_base_ = [ '../_base_/models/stylegan/stylegan3_base.py', '../_base_/datasets/ffhq_flip.py', '../_base_/default_runtime.py' ] batch_size = 32 magnitude_ema_beta = 0.5**(batch_size / (20 * 1e3)) synthesis_cfg = { 'type': 'SynthesisNetwork', 'channel_base': 32768, 'channel_max': 512, 'magnitude_e...
_base_ = ['../_base_/models/stylegan/stylegan3_base.py', '../_base_/datasets/ffhq_flip.py', '../_base_/default_runtime.py'] batch_size = 32 magnitude_ema_beta = 0.5 ** (batch_size / (20 * 1000.0)) synthesis_cfg = {'type': 'SynthesisNetwork', 'channel_base': 32768, 'channel_max': 512, 'magnitude_ema_beta': 0.999} r1_gam...
potencia=int(input()) tempo=int(input()) calculo=(potencia/1000)*(tempo/60) print(f'{calculo:.1f} kWh')
potencia = int(input()) tempo = int(input()) calculo = potencia / 1000 * (tempo / 60) print(f'{calculo:.1f} kWh')
def is_palindrome(input_string): """Check if a string is a palindrome irrespective of capitalisation Returns: True if string is a palindrome e.g >>> is_palindrome("kayak") OUTPUT : True False if string is not a palindrome e.g >>> is_palindro...
def is_palindrome(input_string): """Check if a string is a palindrome irrespective of capitalisation Returns: True if string is a palindrome e.g >>> is_palindrome("kayak") OUTPUT : True False if string is not a palindrome e.g >>> is_palindrome("Boat")...
# Complexity O(n) def linear_search(array: list, elem): for index, number in enumerate(array): if number == elem: print(f"The elem {elem} is present ind array, on index {index}.") return index print(f"The elem {elem} isn't on array.") return -1 def linear_search...
def linear_search(array: list, elem): for (index, number) in enumerate(array): if number == elem: print(f'The elem {elem} is present ind array, on index {index}.') return index print(f"The elem {elem} isn't on array.") return -1 def linear_search_in(array: list, elem...
# lcs = longest_consecutive_series # ccn = count_of_consecutive_numbers class Solution(object): #main function def longestConsecutive(self, values): #sub funcction lcs = 0 # Initializing for i in values: # Iteration the given value if i-1 not in values: # condition check value = i...
class Solution(object): def longest_consecutive(self, values): lcs = 0 for i in values: if i - 1 not in values: value = i ccn = 0 while i in values: i += 1 ccn += 1 lcs = max(lcs,...
""" This module contains some constants and utilities for converting between stars and levels. The EXP system works as follows: - To advance to the next level, you need to acquare 8 banners. - Banners can be bought with stars. A banner costs a single star at level one, with the cost of a banner increasing by a sing...
""" This module contains some constants and utilities for converting between stars and levels. The EXP system works as follows: - To advance to the next level, you need to acquare 8 banners. - Banners can be bought with stars. A banner costs a single star at level one, with the cost of a banner increasing by a sing...
# Uses python3 def lcm_naive(a, b): for l in range(1, a*b + 1): if l % a == 0 and l % b == 0: return l return a*b def gcd(a, b): while b: a, b = b, a % b return a def lcm(a, b): d = gcd(a, b) return (a // d) * b if __name__ == '__main__': a, b = map(int, ...
def lcm_naive(a, b): for l in range(1, a * b + 1): if l % a == 0 and l % b == 0: return l return a * b def gcd(a, b): while b: (a, b) = (b, a % b) return a def lcm(a, b): d = gcd(a, b) return a // d * b if __name__ == '__main__': (a, b) = map(int, input().split(...
""" app.py the main file for launching the web dashboard. By: Calacuda | MIT Licence | Epoch: Mar 25, 2021 """
""" app.py the main file for launching the web dashboard. By: Calacuda | MIT Licence | Epoch: Mar 25, 2021 """
# french verb conjugation (present) # greet the user print('welcome to the french verb conjugator') # user enter their word word = str(input('please enter the word you want to conjugate: ')).lower() # list of conjugated words word_conjugate = [] # function (and conditional) to check word ending def conjugate(): ...
print('welcome to the french verb conjugator') word = str(input('please enter the word you want to conjugate: ')).lower() word_conjugate = [] def conjugate(): if word.endswith('oir'): word_oir = ['je ' + word.replace('oir', 'ois', 1), 'tu ' + word.replace('oir', 'ois', 1), 'il ' + word.replace('oir', 'oit'...
class payload: def __init__(self): self.name = "next" self.description = "tell iTunes to play next track" self.type = "applescript" self.id = 121 def run(self,session,server,command): payload = "tell application \"iTunes\" to next track" server.sendCommand(self.n...
class Payload: def __init__(self): self.name = 'next' self.description = 'tell iTunes to play next track' self.type = 'applescript' self.id = 121 def run(self, session, server, command): payload = 'tell application "iTunes" to next track' server.sendCommand(self...
def draw_polygons(self, pipes, gaps): BLACK = (0, 0, 0) danger = [] # upper left of pipe[0] a = (0, 0) b = (pipes['upper'][0]['x'], 0) c = (pipes['upper'][0]['x'], gaps[0]['y']) d = (0, gaps[0]['y']) danger.append([a, b, c, d]) # lower left of pipe...
def draw_polygons(self, pipes, gaps): black = (0, 0, 0) danger = [] a = (0, 0) b = (pipes['upper'][0]['x'], 0) c = (pipes['upper'][0]['x'], gaps[0]['y']) d = (0, gaps[0]['y']) danger.append([a, b, c, d]) a = (0, pipes['lower'][0]['y']) b = (pipes['lower'][0]['x'], pipes['lower'][0]['...
#!/usr/bin/env python # -*- coding: utf-8 -*- try: f = open('myfile.txt') s = f.readline() i = int(s.strip()) except OSError as err: print("OS error: ", err) except ValueError: print("Could not convert data to integer.") raise except: print("Unexpected error!") raise
try: f = open('myfile.txt') s = f.readline() i = int(s.strip()) except OSError as err: print('OS error: ', err) except ValueError: print('Could not convert data to integer.') raise except: print('Unexpected error!') raise
""" ######################################################################## The parameters.py module contains the Parameters class, which provides I/O tools for defining input parameters, as required for FAO-56 calculations. The parameters.py module contains the following: Parameters - A class for managing input ...
""" ######################################################################## The parameters.py module contains the Parameters class, which provides I/O tools for defining input parameters, as required for FAO-56 calculations. The parameters.py module contains the following: Parameters - A class for managing input ...
""" Iterator in Python is simply an object that can be iterated upon. An object which will return data, one element at a time. Technically, Python 'iterator object' must implement two special methods, __iter__(), and __next__(), collectively called the iterator protocol. Most of built-in containers in python like lis...
""" Iterator in Python is simply an object that can be iterated upon. An object which will return data, one element at a time. Technically, Python 'iterator object' must implement two special methods, __iter__(), and __next__(), collectively called the iterator protocol. Most of built-in containers in python like lis...
test = { 'name': 'q1.1', 'points': 1, 'suites': [ { 'cases': [ { 'code': '>>> assert abs(P[0] - 0.003819) < .1*0.003819;\n' '>>> assert abs(P[1] - 0.016803) < .1*0.016803;\n' '>>> assert abs(P[2] - 0.180881) ...
test = {'name': 'q1.1', 'points': 1, 'suites': [{'cases': [{'code': '>>> assert abs(P[0] - 0.003819) < .1*0.003819;\n>>> assert abs(P[1] - 0.016803) < .1*0.016803;\n>>> assert abs(P[2] - 0.180881) < .1*0.180881;\n>>> assert abs(P[3] - 0.631248) < .1*0.631248\n', 'hidden': False, 'locked': False}], 'scored': True, 'setu...
""" This module contains a class for sharing information on the state of the ACC, rover, and obstacle between the main process for the ACC and the listener process. It allows for this information to be relayed to the user. """ UNKNOWN = "-" # An initial value given to all of the values, so that the user interface has...
""" This module contains a class for sharing information on the state of the ACC, rover, and obstacle between the main process for the ACC and the listener process. It allows for this information to be relayed to the user. """ unknown = '-' class Systeminfo(object): def __init__(self): self.currentSpeed =...
input = """ c num blocks = 1 c num vars = 250 c minblockids[0] = 1 c maxblockids[0] = 250 p cnf 250 1112 -32 148 249 0 169 -98 24 0 -122 -32 -128 0 -9 125 200 0 -216 193 138 0 196 54 31 0 -140 -121 -62 0 237 152 -122 0 91 -206 -247 0 172 -115 -101 0 220 -216 152 0 26 88 -69 0 -130 235 226 0 -96 -242 2 0 -184 -48 -190 0...
input = '\nc num blocks = 1\nc num vars = 250\nc minblockids[0] = 1\nc maxblockids[0] = 250\np cnf 250 1112\n-32 148 249 0\n169 -98 24 0\n-122 -32 -128 0\n-9 125 200 0\n-216 193 138 0\n196 54 31 0\n-140 -121 -62 0\n237 152 -122 0\n91 -206 -247 0\n172 -115 -101 0\n220 -216 152 0\n26 88 -69 0\n-130 235 226 0\n-96 -242 2 ...
''' Write a Python program to make a chain of function decorators (bold, italic, underline etc.). ''' def make_bold(fn): def wrapped(): return "<b>" + fn() + "</b>" return wrapped def make_italic(fn): def wrapped(): return "<i>" + fn() + "</i>" return wrapped def make_underline(fn)...
""" Write a Python program to make a chain of function decorators (bold, italic, underline etc.). """ def make_bold(fn): def wrapped(): return '<b>' + fn() + '</b>' return wrapped def make_italic(fn): def wrapped(): return '<i>' + fn() + '</i>' return wrapped def make_underline(fn):...
"""Run module.""" class Run: """Class describing a TRNSYS simulation. - convention: left (00:00 is [00:00;01:00[ for an hourly series) - clock: tzt """ def __init__(self): """Initialize object.""" pass
"""Run module.""" class Run: """Class describing a TRNSYS simulation. - convention: left (00:00 is [00:00;01:00[ for an hourly series) - clock: tzt """ def __init__(self): """Initialize object.""" pass
# Program to calcualte LCM of two numbers # function to calculate LCM def lcm(x,y): if x > y: greater = x else: greater = y while True: if (greater % x) == 0 and (greater % y) == 0: lcm = greater break greater+=1 return lcm a = int(input("En...
def lcm(x, y): if x > y: greater = x else: greater = y while True: if greater % x == 0 and greater % y == 0: lcm = greater break greater += 1 return lcm a = int(input('Enter first number:')) b = int(input('Enter second number:')) print('The LCM of'...
def processRecord(RecordClass, row): record = RecordClass('mphillips') record.mapping('basic', 'title', row['title'], qualifier='officialtitle') record.mapping('agent', 'creator', row['author'], qualifier='aut', agent_type='per', info='born somewhere') ...
def process_record(RecordClass, row): record = record_class('mphillips') record.mapping('basic', 'title', row['title'], qualifier='officialtitle') record.mapping('agent', 'creator', row['author'], qualifier='aut', agent_type='per', info='born somewhere') record.mapping('basic', 'date', row['date'], qual...
#!/usr/bin/env python # coding: utf-8 # In[1]: # assignment No 1 {day 3} # In[2]: # you all are pilots, & we have to land a plane, the altitiude required to land a plane is 1000ft. if its less than that ask the pilot to land #if its more than 1000ft but less than 5000ft ask the pilot to reduce the altitude t...
at = int(input('inter the altitude')) if at <= 1000: print('its safe to land the plane') elif at > 1000 and at < 5000: print('reduce the altitude to 1000ft') else: print('try later')
#========================================================================= # test_timing.py #========================================================================= # Additional timing assertions for special paths (e.g., feedthroughs) # #------------------------------------------------------------------------- # tes...
def test_clk_pass_through_arrival(): rpt = 'reports/time-clock-passthrough.rpt' def slack(rpt): with open(rpt) as f: lines = [l for l in f.readlines() if 'slack' in l.lower()] output = float(lines[0].split()[-1]) return output def arrival(rpt): with open(rpt) as f: lines = [l for l...
NAME_PREFIX_SEPARATOR = "_" ENDPOINTS_SEPARATOR = ", " CSI_CONTROLLER_SERVER_WORKERS = 10 # array types ARRAY_TYPE_XIV = 'A9000' ARRAY_TYPE_SVC = 'SVC' ARRAY_TYPE_DS8K = 'DS8K'
name_prefix_separator = '_' endpoints_separator = ', ' csi_controller_server_workers = 10 array_type_xiv = 'A9000' array_type_svc = 'SVC' array_type_ds8_k = 'DS8K'
# optimizer optimizer = dict(type="SGD", lr=0.04, momentum=0.9, weight_decay=0.0001) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict(policy="step", warmup="linear", warmup_iters=100, warmup_ratio=0.001, step=[7, 11]) total_epochs = 12
optimizer = dict(type='SGD', lr=0.04, momentum=0.9, weight_decay=0.0001) optimizer_config = dict(grad_clip=None) lr_config = dict(policy='step', warmup='linear', warmup_iters=100, warmup_ratio=0.001, step=[7, 11]) total_epochs = 12
class SplitEnd: """Event used when the separation of a request into several files is completed""" NAME = "SPLIT_END" def __init__(self, directory): self.directory = directory def serialize(self): return { "name": self.NAME, "data": { "direc...
class Splitend: """Event used when the separation of a request into several files is completed""" name = 'SPLIT_END' def __init__(self, directory): self.directory = directory def serialize(self): return {'name': self.NAME, 'data': {'directory': self.directory}} @staticmethod d...
def pattern(n): s = '' for i in range(n): s += str(n) for ni in range(n-1,i,-1): s += str(ni) if n-1 == i: pass else: s += '\n' return s
def pattern(n): s = '' for i in range(n): s += str(n) for ni in range(n - 1, i, -1): s += str(ni) if n - 1 == i: pass else: s += '\n' return s
class AlignmentState(basestring): """ aligned|misaligned|partial-writes|indeterminate Possible values: <ul> <li> "aligned" - All or most of the IO to the LUN is aligned to the underlying file, <li> "misaligned" - A significant amount of IO to the LUN is not aligned to ...
class Alignmentstate(basestring): """ aligned|misaligned|partial-writes|indeterminate Possible values: <ul> <li> "aligned" - All or most of the IO to the LUN is aligned to the underlying file, <li> "misaligned" - A significant amount of IO to the LUN is not aligned to ...
print("/"*20) # lol stlist = ["qwev", "kleb", "lew", "fvb", "eivf", "igsi", "ycgbayg"] for s in stlist: if s.startswith("A"): print("Found!") break else: print("Not found") print("/"*20) answer = 42 guess = 0 while answer != guess: guess = int(input("Guess the number: ")) else: pass...
print('/' * 20) stlist = ['qwev', 'kleb', 'lew', 'fvb', 'eivf', 'igsi', 'ycgbayg'] for s in stlist: if s.startswith('A'): print('Found!') break else: print('Not found') print('/' * 20) answer = 42 guess = 0 while answer != guess: guess = int(input('Guess the number: ')) else: pass print(...
# coding: utf-8 class Task: pass
class Task: pass
class ProtoConverter: @classmethod def proto_to_dict(cls, proto_message): proto_dict = {} desc = proto_message.DESCRIPTOR for field in desc.fields: field_name = field.name proto_dict[field_name] = getattr(proto_message, field_name) return proto_dict
class Protoconverter: @classmethod def proto_to_dict(cls, proto_message): proto_dict = {} desc = proto_message.DESCRIPTOR for field in desc.fields: field_name = field.name proto_dict[field_name] = getattr(proto_message, field_name) return proto_dict
report = [] with open('input') as file: report = list(map(lambda x: x.strip(), file)) gamma = '' epsilon = '' for bits in zip(*report[::1]): zero = 0 one = 0 for bit in bits: if bit == '1': one += 1 else: zero += 1 if one > zero: gamma += '1' ...
report = [] with open('input') as file: report = list(map(lambda x: x.strip(), file)) gamma = '' epsilon = '' for bits in zip(*report[::1]): zero = 0 one = 0 for bit in bits: if bit == '1': one += 1 else: zero += 1 if one > zero: gamma += '1' e...
""" Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Given linked list -- head = [4,5,1,9], which looks like following: 4 -> 5 -> 1 -> 9 Example 1: Input: head = [4,5,1,9], node = 5 Output: [4,1,9] Explanation: You are given the second node with value 5,...
""" Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Given linked list -- head = [4,5,1,9], which looks like following: 4 -> 5 -> 1 -> 9 Example 1: Input: head = [4,5,1,9], node = 5 Output: [4,1,9] Explanation: You are given the second node with value 5,...
# make a player object health = 100 max_health = 100 level = 1 experience = 0 gold = 0 attack = 10 defense = 8 heal = 5
health = 100 max_health = 100 level = 1 experience = 0 gold = 0 attack = 10 defense = 8 heal = 5
"""Mapping of recipe options to celery configuration directives. """ STRING_OPTIONS = { 'broker-url' : 'BROKER_URL', 'broker-password': 'BROKER_PASSWORD', 'broker-transport': 'BROKER_TRANSPORT', 'broker-user': 'BROKER_USER', 'broker-vhost': 'BROKER_VHOST', 'celeryd-log-file': 'CELERYD_LOG_FILE'...
"""Mapping of recipe options to celery configuration directives. """ string_options = {'broker-url': 'BROKER_URL', 'broker-password': 'BROKER_PASSWORD', 'broker-transport': 'BROKER_TRANSPORT', 'broker-user': 'BROKER_USER', 'broker-vhost': 'BROKER_VHOST', 'celeryd-log-file': 'CELERYD_LOG_FILE', 'celeryd-log-level': 'CEL...
f_1 = open("C:/repos/voc2coco/sample/valid.txt", "r") #f_2 = open("sample_ouput.txt", "r") f_3 = open("C:/repos/voc2coco/sample/annpaths_list.txt", "w") for l_1 in f_1: result = "./sample/Annotations/" + l_1.replace("\n", "") + ".xml\n" f_3.writelines(result) f_1.close() #f_2.close() f_3.close()
f_1 = open('C:/repos/voc2coco/sample/valid.txt', 'r') f_3 = open('C:/repos/voc2coco/sample/annpaths_list.txt', 'w') for l_1 in f_1: result = './sample/Annotations/' + l_1.replace('\n', '') + '.xml\n' f_3.writelines(result) f_1.close() f_3.close()
MAGIC = 'NICKNAME' # used for 3 way handshake ENCODING = 'utf-8' """ Localhost and port to be used for testing the server """ HOST_NAME = '127.0.0.1' PORT_NUM = 55555
magic = 'NICKNAME' encoding = 'utf-8' '\nLocalhost and port to be used for testing the server\n' host_name = '127.0.0.1' port_num = 55555
""" General IaC constants """ PARAMETER_OVERRIDES = "parameter_overrides" GLOBAL_PARAMETER_OVERRIDES = "global_parameter_overrides"
""" General IaC constants """ parameter_overrides = 'parameter_overrides' global_parameter_overrides = 'global_parameter_overrides'
#!/usr/bin/env python # -*- coding: utf-8 -*- """ ConsumedThing and related entities. .. autosummary:: :toctree: _consumed wotpy.wot.consumed.interaction_map wotpy.wot.consumed.thing """
""" ConsumedThing and related entities. .. autosummary:: :toctree: _consumed wotpy.wot.consumed.interaction_map wotpy.wot.consumed.thing """
''' 9. Write a Python program to display the examination schedule. (extract the date from exam_st_date). exam_st_date = (11, 12, 2014) Sample Output : The examination will start from : 11 / 12 / 2014 Tools:slicing,indexing ''' #9 exam_st_date = (11, 12, 2014) x = exam_st_date[0] y = exam_st_date[1]...
""" 9. Write a Python program to display the examination schedule. (extract the date from exam_st_date). exam_st_date = (11, 12, 2014) Sample Output : The examination will start from : 11 / 12 / 2014 Tools:slicing,indexing """ exam_st_date = (11, 12, 2014) x = exam_st_date[0] y = exam_st_date[1] z =...
""" Given two strings str1 and str2, find the length of the smallest string which has both, str1 and str2 as its sub-sequences. Example: Input: 2 abcd xycd efgh jghi Output: 6 6 SOLUTION: if str[i] == str[j], then dp[i][j] = dp[i-1][j-1] + 1 else, dp[i][j] = min(dp[i-1][j], dp[i][j-1]) + 1 Be careful when i-1 or j...
""" Given two strings str1 and str2, find the length of the smallest string which has both, str1 and str2 as its sub-sequences. Example: Input: 2 abcd xycd efgh jghi Output: 6 6 SOLUTION: if str[i] == str[j], then dp[i][j] = dp[i-1][j-1] + 1 else, dp[i][j] = min(dp[i-1][j], dp[i][j-1]) + 1 Be careful when i-1 or j...
#!/usr/bin/env python # encoding: utf-8 """ @author:nikan @file: Request.py @time: 28/02/2018 12:19 PM """
""" @author:nikan @file: Request.py @time: 28/02/2018 12:19 PM """
VERSION = 1 SERVICE_URL_BASE = "/api/v" + VERSION + "/" PG_HOST = "localhost" PG_USER = "postgres" PG_PASSWORD = "postgres" PG_DB = "postgres" PG_CONNECTION = "host=" + PG_HOST + " user=" + PG_USER + " password=" + PG_PASSWORD + " dbname=" + PG_DB
version = 1 service_url_base = '/api/v' + VERSION + '/' pg_host = 'localhost' pg_user = 'postgres' pg_password = 'postgres' pg_db = 'postgres' pg_connection = 'host=' + PG_HOST + ' user=' + PG_USER + ' password=' + PG_PASSWORD + ' dbname=' + PG_DB
def findAllSubset(nums): if len(nums) == 0: return [] results = [] cur_num = nums[0] results.append({cur_num}) rest_set = nums[1:] tmp = findAllSubset(rest_set) for ele in tmp: results.append({cur_num} | ele) results = results + tmp return results def findAllSubset_...
def find_all_subset(nums): if len(nums) == 0: return [] results = [] cur_num = nums[0] results.append({cur_num}) rest_set = nums[1:] tmp = find_all_subset(rest_set) for ele in tmp: results.append({cur_num} | ele) results = results + tmp return results def find_all_su...
class Queue: def __init__(self) -> None: self.items = [] def push(self, item): self.items.append(item) def pop(self): if self.size() > 0: return self.items.pop(0) return None def peek(self): if self.size() > 0: return self.items[...
class Queue: def __init__(self) -> None: self.items = [] def push(self, item): self.items.append(item) def pop(self): if self.size() > 0: return self.items.pop(0) return None def peek(self): if self.size() > 0: return self.items[0] ...
class Maths: """Math methods akin to fractions""" def mdc(self, x, y): """Greatest Common Divisor""" while y != 0: resto = x % y x = y y = resto return x def controlador(op,x,y): """controls the calculation based on operator""" if...
class Maths: """Math methods akin to fractions""" def mdc(self, x, y): """Greatest Common Divisor""" while y != 0: resto = x % y x = y y = resto return x def controlador(op, x, y): """controls the calculation based on operator""" ...
t=int(input()) while(t): t-=1 b,s,m=map(int,input().split()) print(b+s-m)
t = int(input()) while t: t -= 1 (b, s, m) = map(int, input().split()) print(b + s - m)
# Example 1 - names.py: Output three names to the console. names = ['Issac Newton', 'Marie Curie', 'Albert Einstein'] for name in names: print(name)
names = ['Issac Newton', 'Marie Curie', 'Albert Einstein'] for name in names: print(name)
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def isPalindrome(self, head: ListNode) -> bool: def reverseList(head: ListNode) -> ListNode: if head == None: return ...
class Solution: def is_palindrome(self, head: ListNode) -> bool: def reverse_list(head: ListNode) -> ListNode: if head == None: return prev = head curr = head.next head.next = None while curr != None: next_node = c...
# Copyright 2021 Edoardo Riggio # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
def sum_a(A, s): return sum_r(A, s, 0, len(A) - 1) def sum_r(A, s, b, e): if b > e and s == 0: return True elif b <= e and sum_r(A, s, b + 1, e): return True elif b <= e and sum_r(A, s - A[b], b + 1, e): return True else: return False arr = [1, 1, 1, 1, 1, 5, 4, 8, 6...
"""External dependencies for Dossier.""" load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:jvm.bzl", "jvm_maven_import_external") def dossier_repositories( omit_aopalliance_aopalliance = False, omit_args4j_args4j = False, omit_com_go...
"""External dependencies for Dossier.""" load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') load('@bazel_tools//tools/build_defs/repo:jvm.bzl', 'jvm_maven_import_external') def dossier_repositories(omit_aopalliance_aopalliance=False, omit_args4j_args4j=False, omit_com_google_auto_auto_common=False, o...
def previously_valid_data(data: list, invalid_data: set): """ Return a list of valid data from a input list. When an element is in the invalid data set, is must be replaced with the previous valid data. >>> previously_valid_data(['0', '2', None, '1', None, '0', None, '2'], {None}) ['0', '2', '2', '...
def previously_valid_data(data: list, invalid_data: set): """ Return a list of valid data from a input list. When an element is in the invalid data set, is must be replaced with the previous valid data. >>> previously_valid_data(['0', '2', None, '1', None, '0', None, '2'], {None}) ['0', '2', '2', '...
class My_Rectangle: def __init__(self, region, is_white=False, model=(None, None)): self.region = region self.is_white = is_white self.model = model def is_white(self): return self.is_white def get_model(self): return self.model
class My_Rectangle: def __init__(self, region, is_white=False, model=(None, None)): self.region = region self.is_white = is_white self.model = model def is_white(self): return self.is_white def get_model(self): return self.model
i=0 arr=[65, 0, 0, 0, 66, 0, 0, 0, 67, 0, 0, 0, 68, 0, 0, 0, 69, 0, 0, 0, 0, 0, 0, 0, 70, 0, 0, 0, 71, 0, 0, 0, 72, 0, 0, 0, 73, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 76, 0, 0, 0, 77, 0, 0, 0, 78, 0, 0, 0, 79, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 81, 0, 0, 0, 82, 0, 0, 0, 83, 0, 0, 0, 84, 0, 0, 0, 85, 0, 0, 0, 0, 0, 0, 0, 86,...
i = 0 arr = [65, 0, 0, 0, 66, 0, 0, 0, 67, 0, 0, 0, 68, 0, 0, 0, 69, 0, 0, 0, 0, 0, 0, 0, 70, 0, 0, 0, 71, 0, 0, 0, 72, 0, 0, 0, 73, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 76, 0, 0, 0, 77, 0, 0, 0, 78, 0, 0, 0, 79, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 81, 0, 0, 0, 82, 0, 0, 0, 83, 0, 0, 0, 84, 0, 0, 0, 85, 0, 0, 0, 0, 0, 0, 0,...
class Hand: # poker hand __POINTS = { '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9, '10': 10, 'J': 11, 'Q': 12, 'K': 13, 'A': 14 } __RANKING = { 'straightflush': 9, 'qu...
class Hand: __points = {'2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9, '10': 10, 'J': 11, 'Q': 12, 'K': 13, 'A': 14} __ranking = {'straightflush': 9, 'quads': 8, 'fullhouse': 7, 'flush': 6, 'straight': 5, 'trips': 4, 'twopair': 3, 'pair': 2, 'highcard': 1} def __init__(self, deck, players)...
# Copyright 2019 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
"""Defines the emulator_toolchain rule to allow configuring emulator binaries to use.""" emulator_info = provider(doc='Information used to launch a specific version of the emulator.', fields={'emulator': 'A label for the emulator launcher executable at stable version.', 'emulator_deps': 'Additional files required to la...
GlobalMarketCommandSchema = """ { "namespace": "confluent.io.examples.serialization.avro", "name": "CBPCommand", "type": "record", "fields": [ {"name": "timestamp", "type": "long", "logicalType": "timestamp-millis"}, {"name": "pair", "type": "string"}...
global_market_command_schema = '\n{\n "namespace": "confluent.io.examples.serialization.avro",\n "name": "CBPCommand",\n "type": "record",\n "fields": [ \n {"name": "timestamp", "type": "long", "logicalType": "timestamp-millis"}, \n {"name": "pair", "type": "...
a = [1, 2, 3] b = [*a, 4, 5, 6] print(b)
a = [1, 2, 3] b = [*a, 4, 5, 6] print(b)
EXPECTED = {'EUTRA-InterNodeDefinitions': {'extensibility-implied': False, 'imports': {'EUTRA-RRC-Definitions': ['ARFCN-ValueEUTRA', 'AntennaInfoCommon', ...
expected = {'EUTRA-InterNodeDefinitions': {'extensibility-implied': False, 'imports': {'EUTRA-RRC-Definitions': ['ARFCN-ValueEUTRA', 'AntennaInfoCommon', 'C-RNTI', 'CellIdentity', 'DL-DCCH-Message', 'MasterInformationBlock', 'MeasConfig', 'PhysCellId', 'RadioResourceConfigDedicated', 'SecurityAlgorithmConfig', 'ShortMA...
#!/usr/bin/python # ============================================================================== # Author: Tao Li (taoli@ucsd.edu) # Date: Jul 7, 2015 # Question: 121-Best-Time-to-Buy-and-Sell-Stock # Link: https://leetcode.com/problems/best-time-to-buy-and-sell-stock/ # ====================================...
class Solution: def max_profit(self, prices): size = len(prices) if size <= 1: return 0 dp = [0] * size min_val = prices[0] for i in xrange(1, size): dp[i] = max(dp[i - 1], prices[i] - minVal) min_val = prices[i] if prices[i] < minVal else...
mandado=["naranja","manzana","pina"] for fruta in mandado: print(fruta) i=1 while i<=15: print(i) i=i+1 a=-3 while a<=3: print(a) a=a+1 #Imprimir los primeros 20 numeros pares iterador=0 print("Tope") #while iterador<40: # iterador+=2 # print(iterador) palabra="el elefante negro" #for ca...
mandado = ['naranja', 'manzana', 'pina'] for fruta in mandado: print(fruta) i = 1 while i <= 15: print(i) i = i + 1 a = -3 while a <= 3: print(a) a = a + 1 iterador = 0 print('Tope') palabra = 'el elefante negro' carros = ['bmw', 'mercedes', 'chevy'] saludo = 'hola' numero = 123456 print(len(str(num...
STATUS_TO_ERROR = { # basic server errors 0: 'AS_OK', 1: 'AS_ERR_UNKNOWN', 2: 'AS_ERR_NOT_FOUND', 3: 'AS_ERR_GENERATION', 4: 'AS_ERR_PARAMETER', 5: 'AS_ERR_RECORD_EXISTS', 6: 'AS_ERR_BIN_EXISTS', 7: 'AS_ERR_CLUSTER_KEY_MISMATCH', 8: 'AS_ERR_OUT_OF_SPACE', 9: 'AS_ERR_TIMEOUT'...
status_to_error = {0: 'AS_OK', 1: 'AS_ERR_UNKNOWN', 2: 'AS_ERR_NOT_FOUND', 3: 'AS_ERR_GENERATION', 4: 'AS_ERR_PARAMETER', 5: 'AS_ERR_RECORD_EXISTS', 6: 'AS_ERR_BIN_EXISTS', 7: 'AS_ERR_CLUSTER_KEY_MISMATCH', 8: 'AS_ERR_OUT_OF_SPACE', 9: 'AS_ERR_TIMEOUT', 10: 'AS_ERR_ALWAYS_FORBIDDEN', 11: 'AS_ERR_UNAVAILABLE', 12: 'AS_E...
"""Handles import of external/third-party repositories. """ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") def optimus_repositories(): maybe( http_archive, name = "bazel_skylib", urls = ["https://github.co...
"""Handles import of external/third-party repositories. """ load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') load('@bazel_tools//tools/build_defs/repo:utils.bzl', 'maybe') def optimus_repositories(): maybe(http_archive, name='bazel_skylib', urls=['https://github.com/bazelbuild/bazel-skylib/rele...
''' 6 kyu Convert string to camel case.py https://www.codewars.com/kata/517abf86da9663f1d2000003/train/python Complete the method/function so that it converts dash/underscore delimited words into camel casing. The first word within the output should be capitalized only if the original word was capitalized (known as Up...
""" 6 kyu Convert string to camel case.py https://www.codewars.com/kata/517abf86da9663f1d2000003/train/python Complete the method/function so that it converts dash/underscore delimited words into camel casing. The first word within the output should be capitalized only if the original word was capitalized (known as Up...
class FrankaArmCommException(Exception): ''' Communication failure. Usually occurs due to timeouts. ''' def __init__(self, message, *args, **kwargs): Exception.__init__(self, *args, **kwargs) self.message = message def __str__(self): return "Communication w/ FrankaInterface ...
class Frankaarmcommexception(Exception): """ Communication failure. Usually occurs due to timeouts. """ def __init__(self, message, *args, **kwargs): Exception.__init__(self, *args, **kwargs) self.message = message def __str__(self): return 'Communication w/ FrankaInterface ran...
""" This module contains all the exceptions that are specific to BGD. """ # errors.py # author : Antoine Passemiers, Robin Petit __all__ = [ 'RequiredComponentError', 'WrongComponentTypeError', 'NonLearnableLayerError' ] class RequiredComponentError(Exception): """ Exception raised when a :class:`bgd.nn....
""" This module contains all the exceptions that are specific to BGD. """ __all__ = ['RequiredComponentError', 'WrongComponentTypeError', 'NonLearnableLayerError'] class Requiredcomponenterror(Exception): """ Exception raised when a :class:`bgd.nn.NeuralStack` hasn't been setup properly and at least a componen...
class Solution(object): def getRow(self, rowIndex): """ :type rowIndex: int :rtype: List[int] """ row = [1] for _ in range(rowIndex): # pad 0, perform element-wise addition row = [x + y for x, y in zip([0] + row, row + [0])] return row ...
class Solution(object): def get_row(self, rowIndex): """ :type rowIndex: int :rtype: List[int] """ row = [1] for _ in range(rowIndex): row = [x + y for (x, y) in zip([0] + row, row + [0])] return row
def created(data_json): # A user creates an issue for a repository. repository = data_json['repository'] # repository_scm = repository['scm'] repository_name = repository['name'] repository_link = repository['links']['html']['href'] # actor = data_json['actor'] # actor_name = actor['display...
def created(data_json): repository = data_json['repository'] repository_name = repository['name'] repository_link = repository['links']['html']['href'] issue = data_json['issue'] issue_title = issue['title'] issue_priority = issue['priority'] if 'assignee' in issue: if issue['assigne...
class CheckPosture: def __init__(self, scale=1, key_points={}): self.key_points = key_points self.scale = scale self.message = "" def set_key_points(self, key_points): self.key_points = key_points def get_key_points(self): return self.key_points def...
class Checkposture: def __init__(self, scale=1, key_points={}): self.key_points = key_points self.scale = scale self.message = '' def set_key_points(self, key_points): self.key_points = key_points def get_key_points(self): return self.key_points def set_messag...
#! python3 # __author__ = "YangJiaHao" # date: 2018/2/23 class Solution: def groupAnagrams(self, strs): """ :type strs: List[str] :rtype: List[List[str]] """ result = {} for s in strs: # key = tuple(sorted(s)) # result[key] = result.get(key, []...
class Solution: def group_anagrams(self, strs): """ :type strs: List[str] :rtype: List[List[str]] """ result = {} for s in strs: if tuple(sorted(s)) in result: result[tuple(sorted(s))].append(s) else: result[tup...
# Defining rule for gdrive command and config. def _gdrive(ctx): gdrive_cmd = ctx.attr.gdrive_cmd gdrive_cfg = ctx.attr.gdrive_config return struct(command=gdrive_cmd, config=gdrive_cfg) gdrive = rule( implementation=_gdrive, attrs={ "gdrive_cmd": attr.string(mandatory=True), ...
def _gdrive(ctx): gdrive_cmd = ctx.attr.gdrive_cmd gdrive_cfg = ctx.attr.gdrive_config return struct(command=gdrive_cmd, config=gdrive_cfg) gdrive = rule(implementation=_gdrive, attrs={'gdrive_cmd': attr.string(mandatory=True), 'gdrive_config': attr.string(mandatory=True)}) def _gdrive_export(ctx): doc...