content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def some_method(some_number): a = 2 b = 3 result = a + b + some_number return result # x = some_method(1) # print(x)
def some_method(some_number): a = 2 b = 3 result = a + b + some_number return result
E_INT, E_FLOAT, E_STR = "INT", "FLOAT", "STR" class EventGet: def __init__(self, prop): self.kind = {int:E_INT, float:E_FLOAT, str:E_STR}[prop]; self.prop = None; class EventSet: def __init__(self, prop): self.kind = {int:E_INT, float:E_FLOAT, str:E_STR}[type(prop)]; self.pro...
(e_int, e_float, e_str) = ('INT', 'FLOAT', 'STR') class Eventget: def __init__(self, prop): self.kind = {int: E_INT, float: E_FLOAT, str: E_STR}[prop] self.prop = None class Eventset: def __init__(self, prop): self.kind = {int: E_INT, float: E_FLOAT, str: E_STR}[type(prop)] s...
#!/usr/bin/python # -*- coding: utf-8 -*- #http://stackoverflow.com/questions/1964934/what-is-contains-do-which-one-can-call-contains-function class a(object): d='ddd' def __contains__(self, m): if self.d: return True b=a() ''' >>> 'd' in b True '''
class A(object): d = 'ddd' def __contains__(self, m): if self.d: return True b = a() "\n>>> 'd' in b\nTrue\n"
def build_base_fn(name): base_fn = name.replace(' ', '-').replace('.', '') base_fn = base_fn.replace('--', '-').lower() return base_fn
def build_base_fn(name): base_fn = name.replace(' ', '-').replace('.', '') base_fn = base_fn.replace('--', '-').lower() return base_fn
class Solution: def checkRecord(self, s: str) -> bool: if not s: return True flag = 0 flag1 = 0 for i in range(len(s)): if s[i] == 'A': flag += 1 if flag > 1: return False if s[i...
class Solution: def check_record(self, s: str) -> bool: if not s: return True flag = 0 flag1 = 0 for i in range(len(s)): if s[i] == 'A': flag += 1 if flag > 1: return False if s[i] == 'L': ...
{ "targets": [ { "target_name": "fdf", "sources": [ "fdf.cpp" ], "cflags": [ "-std=c++11" ] } ] }
{'targets': [{'target_name': 'fdf', 'sources': ['fdf.cpp'], 'cflags': ['-std=c++11']}]}
# Sieve of Eratosthenes def sieve(n): l = [True for i in range(n)] for i in range(3, int(n ** .5) + 1, 2): # only sieving out odd numbers since there's no need to test for primality of even numbers if l[i]: for j in range(i * i, n, i): l[j] = False return l n = 2000000 primes = sieve(n) print(sum(i for...
def sieve(n): l = [True for i in range(n)] for i in range(3, int(n ** 0.5) + 1, 2): if l[i]: for j in range(i * i, n, i): l[j] = False return l n = 2000000 primes = sieve(n) print(sum((i for i in range(3, n, 2) if primes[i])) + 2)
# # PySNMP MIB module ELSA-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ELSA-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:45: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, 09:23:1...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, constraints_union, value_range_constraint, value_size_constraint) ...
#!/usr/bin/env python3 def find_distance(n): x, y = 0, 0 val = 1 dir = 'e' toMove = 1 while val <= n: if dir == 'e': if val + toMove >= n: x += n - val return abs(x) + abs(y) x += toMove val += toMove dir = 'n' ...
def find_distance(n): (x, y) = (0, 0) val = 1 dir = 'e' to_move = 1 while val <= n: if dir == 'e': if val + toMove >= n: x += n - val return abs(x) + abs(y) x += toMove val += toMove dir = 'n' elif dir ==...
#this program prints the datatypes of several variables, including a list and a tuple s = "I am a string." print(type(s)) #prints datatype of s (string) yes = True print(type(yes)) #prints datatype of yes (boolean) no = False print(type(no)) #prints datatype of no (boolean) alpha_list = ["a...
s = 'I am a string.' print(type(s)) yes = True print(type(yes)) no = False print(type(no)) alpha_list = ['a', 'b', 'c'] print(type(alpha_list)) print(type(alpha_list[0])) alpha_list.append('d') print(alpha_list) alpha_tuple = ('a', 'b', 'c') print(type(alpha_tuple)) try: alpha_tuple[2] = 'd' except TypeError: p...
def sumar(lista): return sum(lista) def min_com_multip(lista): return 3
def sumar(lista): return sum(lista) def min_com_multip(lista): return 3
class Intersection(chainer.Link): def __init__(self, outdim, numnet): super(Intersection, self).__init__() self.outdim = outdim self.numnet = numnet with self.init_scope(): W = chainer.initializers.One() self.W = variable.Parameter(W) self.W.init...
class Intersection(chainer.Link): def __init__(self, outdim, numnet): super(Intersection, self).__init__() self.outdim = outdim self.numnet = numnet with self.init_scope(): w = chainer.initializers.One() self.W = variable.Parameter(W) self.W.initi...
# test scoping rules that involve a class # the inner A.method should be independent to the local function called method def test1(): def method(): pass class A: def method(): pass print(hasattr(A, "method")) print(hasattr(A(), "method")) test1() # the inner A.method i...
def test1(): def method(): pass class A: def method(): pass print(hasattr(A, 'method')) print(hasattr(a(), 'method')) test1() def test2(): def method(): return 'outer' class A: nonlocal method def method(): return 'inner' ...
#---------------------------------------------------------------------------------------------------------- # # AUTOMATICALLY GENERATED FILE TO BE USED BY W_HOTBOX # # NAME: auto-rec... by title toggle # COLOR: #000000 # #--------------------------------------------------------------------------------------------------...
ns = [n for n in nuke.selectedNodes() if n.knob('auto_reconnect_by_title')] if any([not n.knob('auto_reconnect_by_title').value() for n in ns]): if nuke.ask('Are you sure you want to set <b>auto-reconnect by title</b> True on all the selected stamps?'): count = 0 for n in ns: n.knob('aut...
# Copyright 2020 Google LLC # # 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 writing, ...
t = '<?xml version="1.0" encoding="UTF-8"?>\n<svg width="{{ width }}px" height="{{ height }}px" viewBox="0 0 {{ width }} {{ height }}" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <style>\n .dcb-chart text, .dcb-title { font-family: sans-serif; }\n .dcb-chart tex...
# def swap(a,x,y): # 'swapping of a[x] and a[y]' # a[x],a[y]=a[y],a[x] def ShellSort(a): "perform Shell sort on array a" n = len(a) gap = n // 2 # print("gap=",gap) while gap > 0: for i in range(gap, n): temp = a[i] j = i while ((j >= gap) and (a...
def shell_sort(a): """perform Shell sort on array a""" n = len(a) gap = n // 2 while gap > 0: for i in range(gap, n): temp = a[i] j = i while j >= gap and a[j - gap] > temp: a[j] = a[j - gap] j -= gap a[j] = temp ...
################################################################## # Traversal... # Call this routine on nodes being visited for the first time def mark_component(G, node, marked): marked[node] = True total_marked = 1 for neighbor in G[node]: if neighbor not in marked: total_marked += ma...
def mark_component(G, node, marked): marked[node] = True total_marked = 1 for neighbor in G[node]: if neighbor not in marked: total_marked += mark_component(G, neighbor, marked) return total_marked def traverse(G, node, target, visited): edges = G[node] if len(edges) == 0: ...
#!/usr/bin/env python domain_name = os.environ['DOMAIN_NAME'] admin_server_listen_address = os.environ['ADMIN_SERVER_LISTEN_ADDRESS'] admin_server_listen_port = os.environ['ADMIN_SERVER_LISTEN_PORT'] admin_username = os.environ['ADMIN_USERNAME'] admin_password = os.environ['ADMIN_PASSWORD'] connection_filter = os.env...
domain_name = os.environ['DOMAIN_NAME'] admin_server_listen_address = os.environ['ADMIN_SERVER_LISTEN_ADDRESS'] admin_server_listen_port = os.environ['ADMIN_SERVER_LISTEN_PORT'] admin_username = os.environ['ADMIN_USERNAME'] admin_password = os.environ['ADMIN_PASSWORD'] connection_filter = os.environ['CONNECTION_FILTER'...
OPERATORS_INFO = { '*': 3, '/': 3, '+': 2, '-': 2, } OPERATORS = OPERATORS_INFO.keys() OPERATORS_STRING = ''.join(OPERATORS)
operators_info = {'*': 3, '/': 3, '+': 2, '-': 2} operators = OPERATORS_INFO.keys() operators_string = ''.join(OPERATORS)
x = input() s = 0 while x is not "": s += int(x) x = input() print(s)
x = input() s = 0 while x is not '': s += int(x) x = input() print(s)
small = [i for i in range(50)] big= [i for i in range(100)] alloted_big = {} alloted_small = {}
small = [i for i in range(50)] big = [i for i in range(100)] alloted_big = {} alloted_small = {}
[ { 'inputs': ['formula'], 'output': 'Property Band gap' }, { 'inputs': ['formula', 'Temperature (Property Band gap)'], 'output': 'Property Band gap' }, { 'inputs': ['formula'], 'output': 'Property Color' },{ 'inputs': ['formula', 'Property Band ga...
[{'inputs': ['formula'], 'output': 'Property Band gap'}, {'inputs': ['formula', 'Temperature (Property Band gap)'], 'output': 'Property Band gap'}, {'inputs': ['formula'], 'output': 'Property Color'}, {'inputs': ['formula', 'Property Band gap'], 'output': 'Property Color'}]
# # PySNMP MIB module CISCOSB-WBA-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCOSB-WBA-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:08:06 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, single_value_constraint, constraints_intersection, value_size_constraint) ...
class Vector2D: def __init__(self, x, y): self.coords = (x, y) def __add__(self, other): return Vector2D(self.coords[0]+other.coords[0], self.coords[1]+other.coords[1]) def __repr__(self): return "Vector2D(%s, %s)" %self.coords a = Vector2D(1, 2) b = Vector2D(3, 4) print(a + b) # ...
class Vector2D: def __init__(self, x, y): self.coords = (x, y) def __add__(self, other): return vector2_d(self.coords[0] + other.coords[0], self.coords[1] + other.coords[1]) def __repr__(self): return 'Vector2D(%s, %s)' % self.coords a = vector2_d(1, 2) b = vector2_d(3, 4) print(a...
@profile def my_func(): a = [1] * (10 ** 6) b = [2] * (2 * 10 ** 7) del b return a if __name__ == '__main__': my_func()
@profile def my_func(): a = [1] * 10 ** 6 b = [2] * (2 * 10 ** 7) del b return a if __name__ == '__main__': my_func()
def ubbi_dubbi( word: str ) -> str: if len(word) == 0: return word vowels = {'a', 'e', 'i', 'o', 'u'} translated_word_letters = [] for letter in word: if letter.lower() in vowels: prefix_to_add = 'ub' translated_word_letters.append(prefix_to_add) tra...
def ubbi_dubbi(word: str) -> str: if len(word) == 0: return word vowels = {'a', 'e', 'i', 'o', 'u'} translated_word_letters = [] for letter in word: if letter.lower() in vowels: prefix_to_add = 'ub' translated_word_letters.append(prefix_to_add) translated_...
#!/usr/bin/env python def find_min_max_dvq(array: list) -> (int, int): def __minmax(low: int, high: int) -> (int, int): if high - low == 1: low_v, high_v = array[low], array[high] return (low_v, high_v) if low_v < high_v else (high_v, low_v) else: mid = (low + hi...
def find_min_max_dvq(array: list) -> (int, int): def __minmax(low: int, high: int) -> (int, int): if high - low == 1: (low_v, high_v) = (array[low], array[high]) return (low_v, high_v) if low_v < high_v else (high_v, low_v) else: mid = (low + high) // 2 ...
# Task 05. Even Numbers numbers = list(map(lambda x: int(x), input().split(", "))) print([x for x in range(len(numbers)) if numbers[x] % 2 == 0])
numbers = list(map(lambda x: int(x), input().split(', '))) print([x for x in range(len(numbers)) if numbers[x] % 2 == 0])
class Solution: def maxArea(self, height: List[int]) -> int: # Two points left, right = 0, len(height) - 1 result = 0 while left < right: result = max(min(height[left], height[right]) * (right - left), result) if height[left] > height[right]: #...
class Solution: def max_area(self, height: List[int]) -> int: (left, right) = (0, len(height) - 1) result = 0 while left < right: result = max(min(height[left], height[right]) * (right - left), result) if height[left] > height[right]: right -= 1 ...
word_of_calculate = str(input("Enter world:")) result_of_count = {} for i in word_of_calculate: if i in result_of_count: result_of_count[i] = result_of_count[i] + 1 else: result_of_count[i] = 1 print(result_of_count)
word_of_calculate = str(input('Enter world:')) result_of_count = {} for i in word_of_calculate: if i in result_of_count: result_of_count[i] = result_of_count[i] + 1 else: result_of_count[i] = 1 print(result_of_count)
json_data = [] with open('the json file path after the download.json')as fp: for i in fp: json_data.append(json.loads(i)) data = [] for i in json_data: data.append(i['Text'])
json_data = [] with open('the json file path after the download.json') as fp: for i in fp: json_data.append(json.loads(i)) data = [] for i in json_data: data.append(i['Text'])
class ProjectTemplate: @classmethod def name(cls, deployer, project): return f"{deployer['name']}-deployer-project-{project}" @classmethod def get(cls, project, branches, deployer, config): cloud = deployer.get("cloud", None) if cloud == "AWS": return cls.aws(project...
class Projecttemplate: @classmethod def name(cls, deployer, project): return f"{deployer['name']}-deployer-project-{project}" @classmethod def get(cls, project, branches, deployer, config): cloud = deployer.get('cloud', None) if cloud == 'AWS': return cls.aws(projec...
# # TRACKER SCHEMA # # Class automatically gets these properties: # creation = Date() # activity = Date() # creator = Link('user') # actor = Link('user') # This is the repository class, then you can see/edit repositories in pages like # "http://tracker/url/vcs_repo1" vcs_repo = Class(db, "vcs_repo", name=St...
vcs_repo = class(db, 'vcs_repo', name=string(), host=string(), path=string(), webview_url=string()) vcs_repo.setkey('name') vcs_rev = class(db, 'vcs_rev', repository=link('vcs_repo'), revision=string()) component = class(db, 'component', name=string(), description=string(), order=number(), assign_to=link('user')) compo...
# custom-functions/my_functions.py def celsius_to_fahrenheit(celsius_temp): return (celsius_temp*9/5) + 32 # TODO: define gradebook function here def numeric_to_letter_grade (i): if i >= 93: return "A" elif i >= 90: return "A-" elif i >= 87.5: return "B+" elif i >=...
def celsius_to_fahrenheit(celsius_temp): return celsius_temp * 9 / 5 + 32 def numeric_to_letter_grade(i): if i >= 93: return 'A' elif i >= 90: return 'A-' elif i >= 87.5: return 'B+' elif i >= 84: return 'B' elif i >= 80: return 'B-' else: ret...
n = int(input()) # Unfinished mas = input().split() cnt = 0 for i in range(n): curstr = str(*mas[:n] + mas[n:]) if curstr == curstr[::-1]: cnt += 1 print(cnt)
n = int(input()) mas = input().split() cnt = 0 for i in range(n): curstr = str(*mas[:n] + mas[n:]) if curstr == curstr[::-1]: cnt += 1 print(cnt)
class Solution: def complexNumberMultiply(self, num1: str, num2: str) -> str: [r1, i1] = num1.split('+') [r2, i2] = num2.split('+') nr1 = int(r1) nr2 = int(r2) ni1 = int(i1[:-1]) ni2 = int(i2[:-1]) rr = str(nr1 * nr2 - ni1 * ni2) ri = str(nr1 * ni2 + n...
class Solution: def complex_number_multiply(self, num1: str, num2: str) -> str: [r1, i1] = num1.split('+') [r2, i2] = num2.split('+') nr1 = int(r1) nr2 = int(r2) ni1 = int(i1[:-1]) ni2 = int(i2[:-1]) rr = str(nr1 * nr2 - ni1 * ni2) ri = str(nr1 * ni2 ...
# Read in the input n = int(input()) dictl = {} # Solve the problem, good luck! for i in range(n): lista= list(input().split()) dictl[lista[0]] = lista[1] inp = input() hi = [] a = list(dictl.keys()) k =0 for i in range (len(inp)): for j in range(len(a)): if inp[k:(i+1)] == a[j]: hi.append(dictl[a[j]]) k = i...
n = int(input()) dictl = {} for i in range(n): lista = list(input().split()) dictl[lista[0]] = lista[1] inp = input() hi = [] a = list(dictl.keys()) k = 0 for i in range(len(inp)): for j in range(len(a)): if inp[k:i + 1] == a[j]: hi.append(dictl[a[j]]) k = i + 1 print(*hi)
# Copyright 2015-2016 HyperBit developers class Serializer: def __init__(self): self.data = b'' def uint(self, value, size): self.data += value.to_bytes(size, byteorder='big', signed=False) def int(self, value, size): self.data += value.to_bytes(size, byteorder='big', signed=True...
class Serializer: def __init__(self): self.data = b'' def uint(self, value, size): self.data += value.to_bytes(size, byteorder='big', signed=False) def int(self, value, size): self.data += value.to_bytes(size, byteorder='big', signed=True) def bytes(self, value): self...
#GME = Generic Mana Equivilent #attempts to take into account factors such as {W}{W} being harder to cast than {2} def manaCostToGME(cost, xMultiplier = 1): parts = cost.split("}") parts.pop() gme = 0 pips = 0 for part in parts: if part.find("/") != -1: pips += 0.833 elif part == "{W": pips += 1 elif...
def mana_cost_to_gme(cost, xMultiplier=1): parts = cost.split('}') parts.pop() gme = 0 pips = 0 for part in parts: if part.find('/') != -1: pips += 0.833 elif part == '{W': pips += 1 elif part == '{U': pips += 1 elif part == '{B': ...
# how far in the past do we fetch the log to compute the stats. STATS_INTERVAL_S = 10 # how fare in the past do we check the requests threshold. ISSUE_INTERVAL_S = 120 STATS_TASK_SCHEDULE_S = 10 # arbitrary choice, which should be tuned according to expected # log size and memory consumption. QUEUE_SIZE = 1000 MAX_ST...
stats_interval_s = 10 issue_interval_s = 120 stats_task_schedule_s = 10 queue_size = 1000 max_stats_list_size = ISSUE_INTERVAL_S // STATS_INTERVAL_S
class Cipher(): def __init__(self): self.keyMatrix = [[0] * 3 for i in range(3)] # Generate vector for the message self.messageVector = [[0] for i in range(3)] # Generate vector for the cipher self.cipherMatrix = [[0] for i in range(3)] # Following function generates the ...
class Cipher: def __init__(self): self.keyMatrix = [[0] * 3 for i in range(3)] self.messageVector = [[0] for i in range(3)] self.cipherMatrix = [[0] for i in range(3)] def get_key_matrix(self, key): k = 0 for i in range(3): for j in range(3): ...
# Graphics colors = { -1: (255, 255, 255), 0: (0, 0, 0), 1: (255, 128, 0), 2: (255, 128, 128), 3: (255, 0, 128), 4: (0, 128, 255), 5: (128, 0, 255), 6: (0, 255, 128), 7: (128, 255, 0), 8: (128, 128, 128), 'red': (255, 0, 0), 'black': (0, 0, 0), 'white': (255, 255, 255...
colors = {-1: (255, 255, 255), 0: (0, 0, 0), 1: (255, 128, 0), 2: (255, 128, 128), 3: (255, 0, 128), 4: (0, 128, 255), 5: (128, 0, 255), 6: (0, 255, 128), 7: (128, 255, 0), 8: (128, 128, 128), 'red': (255, 0, 0), 'black': (0, 0, 0), 'white': (255, 255, 255), 'blue': (0, 0, 255), 'grey': (128, 128, 128)} menu_anchor = (...
# coding: utf-8 # file generated by setuptools_scm # don't change, don't track in version control version = u'1.1.0'
version = u'1.1.0'
# Copyright 2016 IBM Corp. # 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 app...
dev_model_svc = '2145' dev_model_storwize = '2076' dev_model_storwize_v3500 = '2071' dev_model_storwize_v3700 = '2072' dev_model_storwize_v7000 = '2076' dev_model_storwize_v5000 = '2078' dev_model_storwize_v5000_1_yr = '2077' dev_model_flash_v9000 = '9846' dev_model_flex = '4939' rep_cap_devs = (DEV_MODEL_SVC, DEV_MODE...
ModuleCompileInfo = provider(doc = "", fields = [ "module_name", "module_file", "module_dependencies", ]) ModuleCompilationContext = provider( doc = "", fields = [ "compilation_context", "module_mapper", "module_inputs", ], )
module_compile_info = provider(doc='', fields=['module_name', 'module_file', 'module_dependencies']) module_compilation_context = provider(doc='', fields=['compilation_context', 'module_mapper', 'module_inputs'])
subject_paths = [ "nsubj", "agent>pobj", "agent>pobj>compound" ] verb_paths = [ 'aux', 'ROOT' ] object_paths = [ 'nobj', 'dobj', 'dobj>det', 'attr', 'attr>det', 'attr>amod', 'attr>conj>amod', 'attr>conj', 'attr>cc', 'attr>det', 'attr>prep', 'attr>pre...
subject_paths = ['nsubj', 'agent>pobj', 'agent>pobj>compound'] verb_paths = ['aux', 'ROOT'] object_paths = ['nobj', 'dobj', 'dobj>det', 'attr', 'attr>det', 'attr>amod', 'attr>conj>amod', 'attr>conj', 'attr>cc', 'attr>det', 'attr>prep', 'attr>prep>pobj', 'attr>prep>pobj>det', 'attr>prep>pobj>compound', 'attr>prep>pobj>c...
# list all fans res = client.get_hardware(filter='type=\'fan\'') print(res) if type(res) == pypureclient.responses.ValidResponse: print(list(res.items)) # list all XFMs res = client.get_hardware(filter='type=\'xfm\'') print(res) if type(res) == pypureclient.responses.ValidResponse: print(list(res.items)) # Othe...
res = client.get_hardware(filter="type='fan'") print(res) if type(res) == pypureclient.responses.ValidResponse: print(list(res.items)) res = client.get_hardware(filter="type='xfm'") print(res) if type(res) == pypureclient.responses.ValidResponse: print(list(res.items))
psk = { " " :"1", "!" :"111111111", '"' :"101011111", '#' :"111110101", '$' :"111011011", '%' :"1011010101", '&' :"1010111011", "'" :"101111111", '(' :"11111011", ')' :"11110111", '*' :"101101111", '+' :"111011111", ',' :"1110101", '-' :"110101", '.' :"1010111", '/' :"110101111", '0' :"1011...
psk = {' ': '1', '!': '111111111', '"': '101011111', '#': '111110101', '$': '111011011', '%': '1011010101', '&': '1010111011', "'": '101111111', '(': '11111011', ')': '11110111', '*': '101101111', '+': '111011111', ',': '1110101', '-': '110101', '.': '1010111', '/': '110101111', '0': '10110111', '1': '10111101', '2': '...
def init_app(app): app.config["SQLALCHEMY_DATABASE_URI"] = 'sqlite:///clinica.db' app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False app.config["SECRET_KEY"] = 'secret'
def init_app(app): app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///clinica.db' app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False app.config['SECRET_KEY'] = 'secret'
c = 0 # global variable def add(): global c c = c + 2 # increment by 2 print("Inside add():", c) add() print("In main:", c)
c = 0 def add(): global c c = c + 2 print('Inside add():', c) add() print('In main:', c)
''' Default Parameters ''' # FILTERS = [ # [4, 1, 2], # [2, 2, 4], # [1, 4, 4], # [1, 4, 1] # ] CHAR_SET = [1,-1] NO_CUDA = True MSG_LEN = 16 KEY_LEN = 16 BATCH_SIZE = 512 NUM_EPOCHS = 60 LEARNING_RATE = 0.0008 MANUAL_SEED = 42 LOG_INTERVAL = 10
""" Default Parameters """ char_set = [1, -1] no_cuda = True msg_len = 16 key_len = 16 batch_size = 512 num_epochs = 60 learning_rate = 0.0008 manual_seed = 42 log_interval = 10
def test_socfaker_vulnerability(socfaker_fixture): assert socfaker_fixture.vulnerability() def test_socfaker_vulnerability_host(socfaker_fixture): assert socfaker_fixture.vulnerability().host def test_socfaker_vulnerability_scan(socfaker_fixture): assert socfaker_fixture.vulnerability().scan def test_soc...
def test_socfaker_vulnerability(socfaker_fixture): assert socfaker_fixture.vulnerability() def test_socfaker_vulnerability_host(socfaker_fixture): assert socfaker_fixture.vulnerability().host def test_socfaker_vulnerability_scan(socfaker_fixture): assert socfaker_fixture.vulnerability().scan def test_soc...
columns = ["TESTId", "Code", "Native_Heap", "System", "Private_Others", "Graphics", "Java_Heap", "Stack"] test_rows = {"PinScreen": 2, "HomeScreen": 3, "DetailScreen": 4, "PlayerScreen": 5, "Scrolling": 6, "SearchScreen": 7} train_rows = {"Netflix_PinScreen": 2, "Netflix_HomeScreen": 3, "Netflix_DetailScreen"...
columns = ['TESTId', 'Code', 'Native_Heap', 'System', 'Private_Others', 'Graphics', 'Java_Heap', 'Stack'] test_rows = {'PinScreen': 2, 'HomeScreen': 3, 'DetailScreen': 4, 'PlayerScreen': 5, 'Scrolling': 6, 'SearchScreen': 7} train_rows = {'Netflix_PinScreen': 2, 'Netflix_HomeScreen': 3, 'Netflix_DetailScreen': 4, 'Netf...
list1 = [5, 10, 15, 20, 25, 50, 20] my_index = 0 for i in list1: if i == 20: list1[my_index] = 200 my_index = my_index + 1 print('Replaced nums = 20 for 200', list1) print(list1[2:6])
list1 = [5, 10, 15, 20, 25, 50, 20] my_index = 0 for i in list1: if i == 20: list1[my_index] = 200 my_index = my_index + 1 print('Replaced nums = 20 for 200', list1) print(list1[2:6])
# -*- coding: utf-8 -*- class EscapeAlEscape(object): def solve(self, input_log): all_ones = all([bool(int(i)) for i in input_log]) all_zeroes = all([not bool(int(i)) for i in input_log]) if all_ones or all_zeroes: sep_long = 1 else: sep_long = ((len(input_...
class Escapealescape(object): def solve(self, input_log): all_ones = all([bool(int(i)) for i in input_log]) all_zeroes = all([not bool(int(i)) for i in input_log]) if all_ones or all_zeroes: sep_long = 1 else: sep_long = len(input_log) // 2 // 2 + 1 r...
class Category: general = 0 artist = 1 copyright = 3 character = 4 meta = 5 def __init__(self): self.__tags = { "artist": 1, "copyright": 3, "character": 4, "meta": 5 } self.__sgat = { 0: "general", ...
class Category: general = 0 artist = 1 copyright = 3 character = 4 meta = 5 def __init__(self): self.__tags = {'artist': 1, 'copyright': 3, 'character': 4, 'meta': 5} self.__sgat = {0: 'general', 1: 'artist', 3: 'copyright', 4: 'character', 5: 'meta'} def get_category(self,...
# RL config ENV_NAME = "CartPole-v0" ITERATIONS = 2000 GAMMA = 0.95 STEPS_PER_EPOCH = 200 STATS_FREQ = 20 TEST_EPISODES = None RETURN_DONE = None LOG_DIR = None USE_GPU = False TENSORBOARD_DIR = None TENSORBOARD_COMMENT = "" VERBOSE = 1 RENDER = False DEBUG_MODE = True # A2C config A_LR = 3e-3 C_LR = 3e-4 NUM_TARGET_U...
env_name = 'CartPole-v0' iterations = 2000 gamma = 0.95 steps_per_epoch = 200 stats_freq = 20 test_episodes = None return_done = None log_dir = None use_gpu = False tensorboard_dir = None tensorboard_comment = '' verbose = 1 render = False debug_mode = True a_lr = 0.003 c_lr = 0.0003 num_target_updates = 10 num_critic_...
def sockMerchant(n, ar): ar.sort() pairs = 0 while len(ar) > 1: if ar[0] == ar[1]: ar.pop(0) ar.pop(0) pairs += 1 else: ar.pop(0) return pairs count = 15 lst2 = [6, 5, 2, 3, 5, 2, 2, 1, 1, 5, 1, 3, 3, 3, 5] sockMerchant(count, lst2)
def sock_merchant(n, ar): ar.sort() pairs = 0 while len(ar) > 1: if ar[0] == ar[1]: ar.pop(0) ar.pop(0) pairs += 1 else: ar.pop(0) return pairs count = 15 lst2 = [6, 5, 2, 3, 5, 2, 2, 1, 1, 5, 1, 3, 3, 3, 5] sock_merchant(count, lst2)
class OCG: class Node: def __init__(self, oid, cstep, rtype,di): #constructor to set Node instance variables self.__oid = oid self.__cstep = cstep self.__rtype = rtype self.__di = di def set_oid(self,oid): #operation id of an operation self.__oid = oid def set...
class Ocg: class Node: def __init__(self, oid, cstep, rtype, di): self.__oid = oid self.__cstep = cstep self.__rtype = rtype self.__di = di def set_oid(self, oid): self.__oid = oid def set_cstep(self, cstep): self.__...
#!/usr/bin/env python3 __package_name__ = 'cm_microtissue_struct' __description__ = 'Toolbox for assessing microtissue structure in CM aggregates' __url__ = 'https://github.com/david-a-joy/cm-microtissue-struct' __author__ = 'David Joy' __author_email__ = 'david.joy@gladstone.ucsf.edu' __copyright__ = '2018-2020, Dav...
__package_name__ = 'cm_microtissue_struct' __description__ = 'Toolbox for assessing microtissue structure in CM aggregates' __url__ = 'https://github.com/david-a-joy/cm-microtissue-struct' __author__ = 'David Joy' __author_email__ = 'david.joy@gladstone.ucsf.edu' __copyright__ = '2018-2020, David Joy' __version_info__ ...
x, y = [float(x) for x in input().split()] if x == 0 and y == 0: print('Origem') elif y == 0: print('Eixo X') elif x == 0: print('Eixo Y') elif x > 0 and y > 0: print('Q1') elif x < 0 and y > 0: print('Q2') elif x < 0 and y < 0: print('Q3') elif x > 0 and y < 0: print('Q4')
(x, y) = [float(x) for x in input().split()] if x == 0 and y == 0: print('Origem') elif y == 0: print('Eixo X') elif x == 0: print('Eixo Y') elif x > 0 and y > 0: print('Q1') elif x < 0 and y > 0: print('Q2') elif x < 0 and y < 0: print('Q3') elif x > 0 and y < 0: print('Q4')
#!/usr/bin/env python NODE_VERSION = 'v0.11.10' BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' LIBCHROMIUMCONTENT_COMMIT = '276722e68bb643e3ae3b468b701c276aeb884838'
node_version = 'v0.11.10' base_url = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' libchromiumcontent_commit = '276722e68bb643e3ae3b468b701c276aeb884838'
with pd.option_context('max.rows', 15): print(dta.query("risk == 'Risk 1 (High)'") .groupby(('address', 'dba_name')) .size() .rename('n_visits') .reset_index() .query("n_visits >= 4") .merge(dta) .groupby(('results', 'address', 'dba_name')) ...
with pd.option_context('max.rows', 15): print(dta.query("risk == 'Risk 1 (High)'").groupby(('address', 'dba_name')).size().rename('n_visits').reset_index().query('n_visits >= 4').merge(dta).groupby(('results', 'address', 'dba_name')).size().pipe(lambda df: df['Fail'].div(df['Pass'])).dropna().sort_values(ascending=...
def dictionary3(): # using dict() phone_no = dict({ 'sam': 1234567890, 'ram': 9876543212, }) print(phone_no) students = dict([(1, 'sam'), (2, 'ram')]) print(students) dictionary3()
def dictionary3(): phone_no = dict({'sam': 1234567890, 'ram': 9876543212}) print(phone_no) students = dict([(1, 'sam'), (2, 'ram')]) print(students) dictionary3()
def partition(arr, low, high): pivot_value = arr[high] pindex = low for i in range(pindex, high): if arr[i] < pivot_value: arr[i], arr[pindex] = arr[pindex], arr[i] pindex += 1 arr[pindex], arr[high] = arr[high], arr[pindex] print(arr) return pindex def qui...
def partition(arr, low, high): pivot_value = arr[high] pindex = low for i in range(pindex, high): if arr[i] < pivot_value: (arr[i], arr[pindex]) = (arr[pindex], arr[i]) pindex += 1 (arr[pindex], arr[high]) = (arr[high], arr[pindex]) print(arr) return pindex def q...
a = [1, 2, 3, 1, 2, 3, 1, 2, 3] c = [1, 2, 3, 1, 2, 3, 1, 2, 3] def callme(): for i in range(3): for j in range(3): c[i*3 + j] = a[i*3+j] * 2 callme() print(c)
a = [1, 2, 3, 1, 2, 3, 1, 2, 3] c = [1, 2, 3, 1, 2, 3, 1, 2, 3] def callme(): for i in range(3): for j in range(3): c[i * 3 + j] = a[i * 3 + j] * 2 callme() print(c)
class Argument: def __init__(self, arg_id, descriptive_text): self.arg_id = arg_id self.descriptive_text = descriptive_text self.framework = None self.evidence = [] self.verifier_function = None def id(self): return self.arg_id def set_framework(self, frame...
class Argument: def __init__(self, arg_id, descriptive_text): self.arg_id = arg_id self.descriptive_text = descriptive_text self.framework = None self.evidence = [] self.verifier_function = None def id(self): return self.arg_id def set_framework(self, frame...
# 169. Majority Element class Solution: # Brute Force def majorityElement(self, nums: list[int]) -> int: majority_count = len(nums) // 2 for num in nums: count = sum(1 for elem in nums if elem == num) if count > majority_count: return num assert...
class Solution: def majority_element(self, nums: list[int]) -> int: majority_count = len(nums) // 2 for num in nums: count = sum((1 for elem in nums if elem == num)) if count > majority_count: return num assert False, 'No solution'
# Lists # Problem Link: https://www.hackerrank.com/challenges/python-lists/problem if __name__ == "__main__": l = [] n = int(input()) for i in range(0, n): tokens = input().split() if tokens[0] == "insert": l.insert(int(tokens[1]), int(tokens[2])) elif tokens[0] == "print": print(l) ...
if __name__ == '__main__': l = [] n = int(input()) for i in range(0, n): tokens = input().split() if tokens[0] == 'insert': l.insert(int(tokens[1]), int(tokens[2])) elif tokens[0] == 'print': print(l) elif tokens[0] == 'remove': l.remove(int(tokens[1])) elif tokens[0] == ...
load("@build_bazel_rules_nodejs//internal/common:node_module_info.bzl", "NodeModuleInfo") def _collect_sources(ctx): es5_sources = depset(ctx.files.srcs) transitive_es5_sources = depset() transitive_es6_sources = depset() for dep in ctx.attr.deps: # print("ctx.attr.name:", ctx.attr.name, "dep.label.name:"...
load('@build_bazel_rules_nodejs//internal/common:node_module_info.bzl', 'NodeModuleInfo') def _collect_sources(ctx): es5_sources = depset(ctx.files.srcs) transitive_es5_sources = depset() transitive_es6_sources = depset() for dep in ctx.attr.deps: if hasattr(dep, 'typescript'): tran...
class AppTypes(object): web = "web" db = "db" cache = "cache" worker = "worker"
class Apptypes(object): web = 'web' db = 'db' cache = 'cache' worker = 'worker'
def count(n, k): seq = k*[0] + [1] for i in range(0, n): elem = sum(seq[-k:]) seq.append(elem) return seq[-1] print(count(7, 5))
def count(n, k): seq = k * [0] + [1] for i in range(0, n): elem = sum(seq[-k:]) seq.append(elem) return seq[-1] print(count(7, 5))
class SmoothStreamsConstants(object): __slots__ = [] DB_FILE_NAME = 'smoothstreams.db' DEFAULT_EPG_SOURCE = 'fog' DEFAULT_PLAYLIST_PROTOCOL = 'hls' DEFAULT_PLAYLIST_TYPE = 'dynamic' EPG_BASE_URL = 'https://guide.smoothstreams.tv/' EPG_FILE_NAME = 'feed-new-full.json' EPG_TIME_DELTA_HOUR...
class Smoothstreamsconstants(object): __slots__ = [] db_file_name = 'smoothstreams.db' default_epg_source = 'fog' default_playlist_protocol = 'hls' default_playlist_type = 'dynamic' epg_base_url = 'https://guide.smoothstreams.tv/' epg_file_name = 'feed-new-full.json' epg_time_delta_hours...
a = np.array([[2, 3, 4]]) b = np.ones(a.shape) C = a.T @ b C + np.eye(3)
a = np.array([[2, 3, 4]]) b = np.ones(a.shape) c = a.T @ b C + np.eye(3)
#!/usr/bin/env python f = open('test_format.out','w') #i = 1 #r = 1.23456789e-8 # #for k in range(20): # f.write(f"{i:8d} {r:8.3f}\n") # i *= 10 # r *= 10 # #f.write("\n") # r = 1.23456789e-8 for k in range(20): f.write(f"{r:12.6g}\n") f.write(f"{-r:12.6g}\n") r *= 10
f = open('test_format.out', 'w') r = 1.23456789e-08 for k in range(20): f.write(f'{r:12.6g}\n') f.write(f'{-r:12.6g}\n') r *= 10
#!/usr/bin/env python def _orbreapthr_new2(orbname, select, reject, tafter, timeout, queuesize): return object() def _orbreapthr_set_to_stop(thread): return 0 def _orbreapthr_is_stopped(thread): return 1 def _orbreapthr_get(thread): # rc, pktid, srcname, pkttime, pkt, nbytes return 0, 0, '', 0, ...
def _orbreapthr_new2(orbname, select, reject, tafter, timeout, queuesize): return object() def _orbreapthr_set_to_stop(thread): return 0 def _orbreapthr_is_stopped(thread): return 1 def _orbreapthr_get(thread): return (0, 0, '', 0, '', 0) def _orbreapthr_destroy(thread): return 0
# # PySNMP MIB module CTRON-Q-BRIDGE-MIB-EXT (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CTRON-Q-BRIDGE-MIB-EXT # Produced by pysmi-0.3.4 at Mon Apr 29 18:14:57 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, value_size_constraint, constraints_union, value_range_constraint) ...
P = {'B': -0.26268660809250016, 'E': -3.14e+100, 'M': -3.14e+100, 'S': -1.4652633398537678}
p = {'B': -0.26268660809250016, 'E': -3.14e+100, 'M': -3.14e+100, 'S': -1.4652633398537678}
def val(a,b,msg): if a!=b: print(f'{msg} ... Value left: {a}, value right: {b}') else: print(f'{msg} ... OK') def nval(a,b,msg): if a==b: print(f'{msg} ... Value left: {a}, value right: {b}') else: print(f'{msg} ... OK') def info(str): print(f'--- {str} ---') def m...
def val(a, b, msg): if a != b: print(f'{msg} ... Value left: {a}, value right: {b}') else: print(f'{msg} ... OK') def nval(a, b, msg): if a == b: print(f'{msg} ... Value left: {a}, value right: {b}') else: print(f'{msg} ... OK') def info(str): print(f'--- {str} ---'...
def parse(inFileName, silence=False): orig_init() result = parseSub(inFileName, silence) new_init() return result def new_init(): def ArrayType_init(self, content=None, n=None, type_=None, mixedclass_=None): self.original_tagname_ = None self.n = supermod._cast(None, n) ...
def parse(inFileName, silence=False): orig_init() result = parse_sub(inFileName, silence) new_init() return result def new_init(): def array_type_init(self, content=None, n=None, type_=None, mixedclass_=None): self.original_tagname_ = None self.n = supermod._cast(None, n) s...
n = int(input("")) arr = list(map(int, input("").split(" "))) s,d=0,0 li,ri=0,len(arr)-1 for i in range(len(arr)): if li > ri: break if (i%2) == 0: if arr[li] >= arr[ri]: s += arr[li] li += 1 else: s += arr[ri] ri -= 1 else: i...
n = int(input('')) arr = list(map(int, input('').split(' '))) (s, d) = (0, 0) (li, ri) = (0, len(arr) - 1) for i in range(len(arr)): if li > ri: break if i % 2 == 0: if arr[li] >= arr[ri]: s += arr[li] li += 1 else: s += arr[ri] ri -= 1 ...
class BaseGraphCheck: def __init__(self): self.id = '' self.name = '' self.resource_types = [] self.connected_resources_types = [] self.operator = '' self.attribute = '' self.attribute_value = '' self.sub_checks = [] self.type = None se...
class Basegraphcheck: def __init__(self): self.id = '' self.name = '' self.resource_types = [] self.connected_resources_types = [] self.operator = '' self.attribute = '' self.attribute_value = '' self.sub_checks = [] self.type = None s...
inputList, inputString = [], open("Input/Day 11.txt", "r").read().splitlines() for line in inputString: inputList.append([int(x) for x in list(line)]) def solveBoth(): octopusEnergy, totalFlashes, currentStep, hasFlashed = inputList[:], 0, 0, [] while len(hasFlashed) < len(octopusEnergy[0])*len(octopusEne...
(input_list, input_string) = ([], open('Input/Day 11.txt', 'r').read().splitlines()) for line in inputString: inputList.append([int(x) for x in list(line)]) def solve_both(): (octopus_energy, total_flashes, current_step, has_flashed) = (inputList[:], 0, 0, []) while len(hasFlashed) < len(octopusEnergy[0]) ...
class Person: def __init__(self, fname, lname): self.firstname = fname self.lastname = lname print(self) def printname(self): print(self.firstname) print(self) class Student(Person): def __init__(self, fname, lname): print(self) Person.__init__(self, fname, lname) self.printname() x = Student("jo...
class Person: def __init__(self, fname, lname): self.firstname = fname self.lastname = lname print(self) def printname(self): print(self.firstname) print(self) class Student(Person): def __init__(self, fname, lname): print(self) Person.__init__(sel...
ix.enable_command_history() ix.application.get_selection().select_all() ix.disable_command_history()
ix.enable_command_history() ix.application.get_selection().select_all() ix.disable_command_history()
# Created by MechAviv # Graffiti Damage Skin | (2438467) if sm.addDamageSkin(2438467): sm.chat("'Graffiti Damage Skin' Damage Skin has been added to your account's damage skin collection.") sm.consumeItem()
if sm.addDamageSkin(2438467): sm.chat("'Graffiti Damage Skin' Damage Skin has been added to your account's damage skin collection.") sm.consumeItem()
''' https://www.codingame.com/training/easy/may-the-triforce-be-with-you ''' n = int(input()) width = (2 * n) - 1 # Construct the stared triangle as a building block triangle = [] for i in range(n): spaces = ' ' * i stars = '*' * (width - (i * 2)) line = spaces + stars + spaces # Th...
""" https://www.codingame.com/training/easy/may-the-triforce-be-with-you """ n = int(input()) width = 2 * n - 1 triangle = [] for i in range(n): spaces = ' ' * i stars = '*' * (width - i * 2) line = spaces + stars + spaces triangle.insert(0, line) for i in range(n): spaces = ' ' * n stars = tr...
# # John # print('Take the ingredients') # print('Mix the ingredients') # print('Pour on pan') # print('bake one side properly') # print('flip dosa') # print('Bake other side') # print('Serve dosa to John') # print("================") # # Mary # print('Take the ingredients') # print('Mix the ingredients') # print('...
def make_dosas(name): print('Take the flour') dosa_process() print('Serve dosa to ' + name) def make_masala_dosas(name): print('Take the masala') dosa_process() print('Serve dosa to ' + name) def make_onion_dosas(name): print('Take the onion') dosa_process() print('Serve dosa to ' ...
#!/usr/bin/env python3 class UnionFindSets: def __init__(self, n: int): self.payload = [-1] * n def union(self, lhs: int, rhs: int) -> int: if lhs == rhs: return lhs self.payload[lhs] += self.payload[rhs] self.payload[rhs] = lhs return lhs def ...
class Unionfindsets: def __init__(self, n: int): self.payload = [-1] * n def union(self, lhs: int, rhs: int) -> int: if lhs == rhs: return lhs self.payload[lhs] += self.payload[rhs] self.payload[rhs] = lhs return lhs def find(self, elem: int) -> int: ...
SSH_USER = 'SSH_USER' SSH_HOST = 'SSH_HOST' RL_USER = 'RL_USER' RL_PASS = 'RL_PASS' RL_DATADIR = 'RL_DATADIR' RL_LICENSE = 'RL_LICENSE' PEM_FILE = 'SSH_PEM' rlec_uid = 'redislabs' host = None user = 'ubuntu' rlec_user = None rlec_password = None rlec_datadir = None
ssh_user = 'SSH_USER' ssh_host = 'SSH_HOST' rl_user = 'RL_USER' rl_pass = 'RL_PASS' rl_datadir = 'RL_DATADIR' rl_license = 'RL_LICENSE' pem_file = 'SSH_PEM' rlec_uid = 'redislabs' host = None user = 'ubuntu' rlec_user = None rlec_password = None rlec_datadir = None
def main(request, response): if request.auth.username == 'usr' and request.auth.password == 'secret': response.headers.set('Content-type', 'text/plain') content = "" else: response.status = 401 response.headers.set('Status', '401 Authorization required') response.headers....
def main(request, response): if request.auth.username == 'usr' and request.auth.password == 'secret': response.headers.set('Content-type', 'text/plain') content = '' else: response.status = 401 response.headers.set('Status', '401 Authorization required') response.headers....
# Settings for the nlp_emerging_technologies project # /!\ added to .gitignore # postgresql location PASTAT_location = 'postgresql://postgres:postgres2020@127.0.0.1:5432/patstat2018a' # google cloud information google_project_id = 'rock-brand-270215' google_cloud_key_json = 'settings-921b0e2dfa16.json' # patstat inf...
pastat_location = 'postgresql://postgres:postgres2020@127.0.0.1:5432/patstat2018a' google_project_id = 'rock-brand-270215' google_cloud_key_json = 'settings-921b0e2dfa16.json' example_patstat_file = 'gs://epo-public/EP-fulltext-for-text- analytics_2019week31/EP1400000.txt' local_storage_destination = '~/nlp_emerging_te...
class EveryStepReward(): def __init__(self, value): self.value = value def reset(self, env): pass def __call__(self, env, observations, action_dict, rewards, dones): for handle in rewards.keys(): if not dones[handle]: rewards[handle] += self.value ...
class Everystepreward: def __init__(self, value): self.value = value def reset(self, env): pass def __call__(self, env, observations, action_dict, rewards, dones): for handle in rewards.keys(): if not dones[handle]: rewards[handle] += self.value ...
def join_name(*args,join_str='_'): return join_str.join([x for x in args if x is not None])
def join_name(*args, join_str='_'): return join_str.join([x for x in args if x is not None])
__version__ = '0.4.2' __author__ = 'matteo vezzola <matteo@studioripiu.it>' default_app_config = 'ripiu.cmsplugin_articles.apps.ArticlesConfig'
__version__ = '0.4.2' __author__ = 'matteo vezzola <matteo@studioripiu.it>' default_app_config = 'ripiu.cmsplugin_articles.apps.ArticlesConfig'
def inc(x: int) -> int: return x + 1 def greet(name: str) -> str: return f'Hello, {name}!'
def inc(x: int) -> int: return x + 1 def greet(name: str) -> str: return f'Hello, {name}!'
# $Header: /nfs/slac/g/glast/ground/cvs/GlastRelease-scons/gui/guiLib.py,v 1.5 2011/09/16 04:15:02 heather Exp $ def generate(env, **kw): if not kw.get('depsOnly', 0): env.Tool('addLibrary', library = ['gui']) env.Tool('addLibrary', library = ['guisystem']) if env['PLATFORM'] == "win32" and ...
def generate(env, **kw): if not kw.get('depsOnly', 0): env.Tool('addLibrary', library=['gui']) env.Tool('addLibrary', library=['guisystem']) if env['PLATFORM'] == 'win32' and env.get('CONTAINERNAME', '') == 'GlastRelease': env.Tool('findPkgPath', package='gui') if env['PLATFO...
def lcs(S,T): dp=[[0]*(len(T)+1)for _ in[0]*(len(S)+1)] for i in range(1,len(S)+1): for j in range(1,len(T)+1): if S[i-1]==T[j-1]: dp[i][j]=dp[i-1][j-1]+1 else: dp[i][j]=max(dp[i-1][j],dp[i][j-1]) length=dp[len(S)][len(T)] i=len(S) j=len(T) ans="" while length>0...
def lcs(S, T): dp = [[0] * (len(T) + 1) for _ in [0] * (len(S) + 1)] for i in range(1, len(S) + 1): for j in range(1, len(T) + 1): if S[i - 1] == T[j - 1]: dp[i][j] = dp[i - 1][j - 1] + 1 else: dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]) length ...
class Solution: ''' Solution using Floyd's cycle-finding algorithm (tortoise and hare) ''' def hasCycle(self, head: ListNode) -> bool: if not head or not head.next: return False fast = slow = head while fast and fast.next: slow = slow.next fa...
class Solution: """ Solution using Floyd's cycle-finding algorithm (tortoise and hare) """ def has_cycle(self, head: ListNode) -> bool: if not head or not head.next: return False fast = slow = head while fast and fast.next: slow = slow.next fa...
def client_hints_list(): return [b"device-memory", b"dpr", # b"width", (Only available for images) b"viewport-width", b"rtt", b"downlink", b"ect", b"sec-ch-ua", b"sec-ch-ua-arch", b"sec-ch-ua-platform", b"sec-ch-ua-model...
def client_hints_list(): return [b'device-memory', b'dpr', b'viewport-width', b'rtt', b'downlink', b'ect', b'sec-ch-ua', b'sec-ch-ua-arch', b'sec-ch-ua-platform', b'sec-ch-ua-model', b'sec-ch-ua-mobile', b'sec-ch-ua-full-version', b'sec-ch-ua-platform-version', b'sec-ch-prefers-color-scheme', b'sec-ch-ua-bitness', ...