content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# Linked list operations in Python # Create a node class Node: def __init__(self, data): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None # Insert at the beginning def insertAtBeginning(self, new_data): new_node =...
class Node: def __init__(self, data): self.data = data self.next = None class Linkedlist: def __init__(self): self.head = None def insert_at_beginning(self, new_data): new_node = node(new_data) new_node.next = self.head self.head = new_node def insert...
""" Alias_Map.py Created by amounra on 2012-12-30. Copyright (c) 2010 __artisia__. All rights reserved. This file allows the reassignment of the controls from their default arrangement. The order is from left to right; Buttons are Note #'s and Faders/Rotaries are Controller #'s """ DISABLE_MASTER_VOLUME = False ...
""" Alias_Map.py Created by amounra on 2012-12-30. Copyright (c) 2010 __artisia__. All rights reserved. This file allows the reassignment of the controls from their default arrangement. The order is from left to right; Buttons are Note #'s and Faders/Rotaries are Controller #'s """ disable_master_volume = False cha...
def add(x, y): """Adds x to y""" # Some comment return x + y v = add(1, 7) print(v)
def add(x, y): """Adds x to y""" return x + y v = add(1, 7) print(v)
# -*- coding: utf-8 -*- class BaseCompressor(object): def __init__(self, options): self._options = options def compress(self, value): raise NotImplementedError def decompress(self, value): raise NotImplementedError
class Basecompressor(object): def __init__(self, options): self._options = options def compress(self, value): raise NotImplementedError def decompress(self, value): raise NotImplementedError
n = 10 a = [] s = [[0] * n for i in range(n)] s2 = [[0] * n for i in range(n)] for i in range(n): a.append(list(map(int, input().split()))) s[0][0] = a[0][0] s2[0][0] = a[0][0] for j in range(1, n): s[0][j] = s[0][j - 1] + a[0][j] for i in range(1, n): s[i][0] = s[i - 1][0] + a[i][0] for i in range(n):...
n = 10 a = [] s = [[0] * n for i in range(n)] s2 = [[0] * n for i in range(n)] for i in range(n): a.append(list(map(int, input().split()))) s[0][0] = a[0][0] s2[0][0] = a[0][0] for j in range(1, n): s[0][j] = s[0][j - 1] + a[0][j] for i in range(1, n): s[i][0] = s[i - 1][0] + a[i][0] for i in range(n): ...
#FUNCTION TEXT def AddCharA(char,lista,z): x=0 for y in lista[0]: if y=="|": break else: x+=1 x+=1 if x==len(lista[0]): lista[0]=lista[0][:len(lista[0])-1]+char+"|" elif x==1: lista[0]=char+lista[0][:] else: lista[0]=lista[0][:x-1]+char+lista[0][x-1:] print(char) print(lista) z[0].configure(t...
def add_char_a(char, lista, z): x = 0 for y in lista[0]: if y == '|': break else: x += 1 x += 1 if x == len(lista[0]): lista[0] = lista[0][:len(lista[0]) - 1] + char + '|' elif x == 1: lista[0] = char + lista[0][:] else: lista[0] = ...
"ts_project rule" load("@rules_nodejs//nodejs:providers.bzl", "DeclarationInfo", "declaration_info", "js_module_info") load("@build_bazel_rules_nodejs//:providers.bzl", "ExternalNpmPackageInfo", "run_node") load("@build_bazel_rules_nodejs//internal/linker:link_node_modules.bzl", "module_mappings_aspect") load(":tslib....
"""ts_project rule""" load('@rules_nodejs//nodejs:providers.bzl', 'DeclarationInfo', 'declaration_info', 'js_module_info') load('@build_bazel_rules_nodejs//:providers.bzl', 'ExternalNpmPackageInfo', 'run_node') load('@build_bazel_rules_nodejs//internal/linker:link_node_modules.bzl', 'module_mappings_aspect') load(':tsl...
""" Node is defined as class node: def __init__(self, data): self.data = data self.left = None self.right = None """ def checkBST(root): return(check_in_order(root,[-1])) def check_in_order(root,prev): result = True if root.left is not None: result &= ...
""" Node is defined as class node: def __init__(self, data): self.data = data self.left = None self.right = None """ def check_bst(root): return check_in_order(root, [-1]) def check_in_order(root, prev): result = True if root.left is not None: result &= check_in_order(r...
_base_ = [ '../_base_/datasets/OxfordPet_bs64.py', '../_base_/default_runtime.py', '../_base_/models/resnet50.py', ] # load model pretrained on imagenet model = dict( backbone=dict( init_cfg=dict( type='Pretrained', checkpoint='https://download.openmmlab.com/mmclassifi...
_base_ = ['../_base_/datasets/OxfordPet_bs64.py', '../_base_/default_runtime.py', '../_base_/models/resnet50.py'] model = dict(backbone=dict(init_cfg=dict(type='Pretrained', checkpoint='https://download.openmmlab.com/mmclassification/v0/resnet/resnet50_8xb32_in1k_20210831-ea4938fc.pth', prefix='backbone')), head=dict(n...
def quick_sort(arr,low,high): if len(arr) > 1: if low < high: position = partition(arr,low,high) quick_sort(arr,low,position -1) quick_sort(arr,position +1,high) return arr return arr def partition(arr,low,high): position = low for i in range(low,high...
def quick_sort(arr, low, high): if len(arr) > 1: if low < high: position = partition(arr, low, high) quick_sort(arr, low, position - 1) quick_sort(arr, position + 1, high) return arr return arr def partition(arr, low, high): position = low for i in ra...
name = 'snape' print(name+name+str(7)) age = 11 wizard_age_multiplier = 56 final_age = age * wizard_age_multiplier print(f'You are {age} which means you are {final_age} in wizard years') print('You are ' + str(age) + ' which means you are ' + str(final_age) + ' in wizard years')
name = 'snape' print(name + name + str(7)) age = 11 wizard_age_multiplier = 56 final_age = age * wizard_age_multiplier print(f'You are {age} which means you are {final_age} in wizard years') print('You are ' + str(age) + ' which means you are ' + str(final_age) + ' in wizard years')
# Python program to find the factorial of a number num = int(input("Enter a number: ")) factorial = 1 if num < 0: print("factorial does not exist for negative numbers") elif num == 0: print("The factorial of 0 is 1") else: for i in range(1, num + 1): factorial = factorial*i print("The factor...
num = int(input('Enter a number: ')) factorial = 1 if num < 0: print('factorial does not exist for negative numbers') elif num == 0: print('The factorial of 0 is 1') else: for i in range(1, num + 1): factorial = factorial * i print('The factorial of', num, 'is', factorial)
def wrap_lines(lines, width=80, sep=' ', ellipsis="...", force_ellipsis=False, rjust_ellipsis=False): """ Wraps given list of lines into a single line of specified width while they can fit. Parts are separated with sep string. If first line does not fit and part of it cannot be displayed, or there are other lines t...
def wrap_lines(lines, width=80, sep=' ', ellipsis='...', force_ellipsis=False, rjust_ellipsis=False): """ Wraps given list of lines into a single line of specified width while they can fit. Parts are separated with sep string. If first line does not fit and part of it cannot be displayed, or there are other line...
class InstagramException(Exception): StatusCode = -1 def __init__(self, message="", code=500): super().__init__(f'{message}, Code:{code}') @staticmethod def default(response_text, status_code): StatusCode = status_code return InstagramException( 'Response code i...
class Instagramexception(Exception): status_code = -1 def __init__(self, message='', code=500): super().__init__(f'{message}, Code:{code}') @staticmethod def default(response_text, status_code): status_code = status_code return instagram_exception('Response code is {status_code...
class Spawn: def __init__ (self, width, height): self.width, self.height, self.spacing = self.fill = width, height, 100, d3.scale.category20 () self.svg = d3.select ('body' ) .append ('svg' ) .attr ('width', self.width ) .attr ('height', self.height ) .on ('mousemove', self.mousemove ) .on ('mo...
class Spawn: def __init__(self, width, height): (self.width, self.height, self.spacing) = self.fill = (width, height, 100, d3.scale.category20()) self.svg = d3.select('body').append('svg').attr('width', self.width).attr('height', self.height).on('mousemove', self.mousemove).on('mousedown', self.mou...
class Queue(object): def __init__(self): super(Queue, self).__init__() self.rear = -1 self.front = -1 self.MAX = 10 self.queue = [None]*self.MAX def enqueue(self,element): if(self.rear == self.MAX - 1): print("Error- queue full") else: self.rear += 1 self.queue[self.rear] = element if self.r...
class Queue(object): def __init__(self): super(Queue, self).__init__() self.rear = -1 self.front = -1 self.MAX = 10 self.queue = [None] * self.MAX def enqueue(self, element): if self.rear == self.MAX - 1: print('Error- queue full') else: ...
n=int(input()) arr=[[input(),float(input())] for _ in range(0,n)] arr.sort(key=lambda x: (x[1],x[0])) names = [i[0] for i in arr] marks = [i[1] for i in arr] min_val=min(marks) while marks[0]==min_val: marks.remove(marks[0]) names.remove(names[0]) for x in range(0,len(marks)): if marks[x]==min(marks): ...
n = int(input()) arr = [[input(), float(input())] for _ in range(0, n)] arr.sort(key=lambda x: (x[1], x[0])) names = [i[0] for i in arr] marks = [i[1] for i in arr] min_val = min(marks) while marks[0] == min_val: marks.remove(marks[0]) names.remove(names[0]) for x in range(0, len(marks)): if marks[x] == min...
class Solution: def tree2str(self, t): """ :type t: TreeNode :rtype: str """ if t is None: return '' res = str(t.val) if t.left is not None: res += '(' + self.tree2str(t.left) + ')' else: if t.right is not None: ...
class Solution: def tree2str(self, t): """ :type t: TreeNode :rtype: str """ if t is None: return '' res = str(t.val) if t.left is not None: res += '(' + self.tree2str(t.left) + ')' elif t.right is not None: res += ...
# -*- coding: utf-8 -*- """ @Time: 2021/6/18 15:17 @Author: zzhang zzhang@cenboomh.com @File: Data2ArrayRule.py @desc: """
""" @Time: 2021/6/18 15:17 @Author: zzhang zzhang@cenboomh.com @File: Data2ArrayRule.py @desc: """
sse3=1 debug=0 strict=1 osx_min_ver = '10.7' compiler = 'clang' osx_archs = 'x86_64' cxxstd = 'c++14' ccflags = '-stdlib=libc++ -Wno-unused-local-typedefs' linkflags = '-stdlib=libc++' package_arch = 'x86_64' #disable_local = 'libevent re2' sign_disable = 1 sign_keychain = 'login.keychain' #sign_keychain = 'develope...
sse3 = 1 debug = 0 strict = 1 osx_min_ver = '10.7' compiler = 'clang' osx_archs = 'x86_64' cxxstd = 'c++14' ccflags = '-stdlib=libc++ -Wno-unused-local-typedefs' linkflags = '-stdlib=libc++' package_arch = 'x86_64' sign_disable = 1 sign_keychain = 'login.keychain' sign_id_app = 'Developer ID Application: Jane Doe (C123...
""" Integer Info Create a program that takes an integer as input and creates a list with the following elements: The number of digits The last digit A 'True' boolean value if the number is even, 'False' if odd Print the list. Some examples are given to help check your work. """ # Example 1: The input 12345...
""" Integer Info Create a program that takes an integer as input and creates a list with the following elements: The number of digits The last digit A 'True' boolean value if the number is even, 'False' if odd Print the list. Some examples are given to help check your work. """ num = int(input('Enter an int...
# 99. Recover Binary Search Tree # Runtime: 80 ms, faster than 30.01% of Python3 online submissions for Recover Binary Search Tree. # Memory Usage: 14.7 MB, less than 57.01% of Python3 online submissions for Recover Binary Search Tree. # Definition for a binary tree node. # class TreeNode: # def __init__(self, ...
class Solution: def recover_tree(self, root: TreeNode) -> None: """ Do not return anything, modify root in-place instead. """ def inorder(node: TreeNode) -> list[int]: if node is None: return [] else: return inorder(node.left)...
# -*- coding: utf-8 -*- __author__ = 'lycheng' __email__ = "lycheng997@gmail.com" class Solution(object): ''' https://leetcode.com/problems/delete-node-in-a-linked-list/ ''' def deleteNode(self, node): """ :type node: ListNode :rtype: void Do not return anything, modify node in-p...
__author__ = 'lycheng' __email__ = 'lycheng997@gmail.com' class Solution(object): """ https://leetcode.com/problems/delete-node-in-a-linked-list/ """ def delete_node(self, node): """ :type node: ListNode :rtype: void Do not return anything, modify node in-place instead. """...
#define the main() function def main(): i = 0 #declare interger i x = 119.0 #declare float x for i in range(120): #loop i from 0 to 119, inclusive if((i%2)==0): #if i is even x += 3. #add 3 to x else: #if not true x -= 5. #substract 5 from x s = "%3.2e" % x #make a string containing x with sci...
def main(): i = 0 x = 119.0 for i in range(120): if i % 2 == 0: x += 3.0 else: x -= 5.0 s = '%3.2e' % x print(s) if __name__ == '__main__': main()
# This file is part of spot_motion_monitor. # # Developed for LSST System Integration, Test and Commissioning. # # See the LICENSE file at the top-level directory of this distribution # for details of code ownership. # # Use of this source code is governed by a 3-clause BSD-style # license that can be found in the LICE...
__all__ = ['CameraNotFound', 'FrameCaptureFailed', 'FrameRejected'] class Cameranotfound(Exception): """Exception for a camera startup failure. """ class Framecapturefailed(Exception): """Exception for a frame capture failure """ class Framerejected(Exception): """Exception for rejected frames. ...
# 7. Write a program that takes any two lists L and M of the same size and adds their elements # together to form a new list N whose elements are sums of the corresponding elements in L # and M. For instance, if L=[3,1,4] and M=[1,5,9], then N should equal [4,6,13]. L = input('Enter a list of numbers: ').split() M = i...
l = input('Enter a list of numbers: ').split() m = input('Enter another list of numbers: ').split() n = [] for i in range(len(L)): N.append(int(L[i]) + int(M[i])) print(N)
class Solution: def canConstruct(self, s: str, k: int) -> bool: if len(s) < k: return False if len(s) == k: return True letters = collections.Counter(s) mid = [] for key, val in letters.items(): if val % 2 == 1: mid.append...
class Solution: def can_construct(self, s: str, k: int) -> bool: if len(s) < k: return False if len(s) == k: return True letters = collections.Counter(s) mid = [] for (key, val) in letters.items(): if val % 2 == 1: mid.appe...
class NoChefException(Exception): pass class Chef(object): def make(self, **params): print("I am a chef") class Boost(Chef): def make(self, food=None, **keywords): print("I can cook %s for robots" % food) class Fry(Chef): def make(self, food=None): print("I can fry " + food...
class Nochefexception(Exception): pass class Chef(object): def make(self, **params): print('I am a chef') class Boost(Chef): def make(self, food=None, **keywords): print('I can cook %s for robots' % food) class Fry(Chef): def make(self, food=None): print('I can fry ' + food...
class Range: def __init__(self, left, right, left_inclusive=True, right_inclusive=False): self.left = left self.right = right self.left_inclusive = left_inclusive self.right_inclusive = right_inclusive def __contains__(self, item): if self.left_inclusive and self.left ...
class Range: def __init__(self, left, right, left_inclusive=True, right_inclusive=False): self.left = left self.right = right self.left_inclusive = left_inclusive self.right_inclusive = right_inclusive def __contains__(self, item): if self.left_inclusive and self.left =...
""" Collectible.sol constructor arguments. """ COLLECTIBLE = { "name": "Super Art Collection", # <- "symbol": "SAC", # <- "contract_URI": "", # <- "royalty_receiver": "0x8626f6940e2eb28930efb4cef49b2d1f2c9c1199", # <- "royalty_fraction": 250, # e.g. 100 (1%); 1000 (10%) # <- } """ Is collectio...
""" Collectible.sol constructor arguments. """ collectible = {'name': 'Super Art Collection', 'symbol': 'SAC', 'contract_URI': '', 'royalty_receiver': '0x8626f6940e2eb28930efb4cef49b2d1f2c9c1199', 'royalty_fraction': 250} '\nIs collection considered as a single edition collection?\n - YES: SINGLE_EDITION_COLLECTION[...
alphabet_dict = { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10, 'k': 11, 'l': 12, 'm': 13, 'n': 14, 'o': 15, 'p': 16, 'q': 17, 'r': 18, 's': 19, 't': 20, 'u': 21, 'v': 22, 'w': 23, 'x': 24,...
alphabet_dict = {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10, 'k': 11, 'l': 12, 'm': 13, 'n': 14, 'o': 15, 'p': 16, 'q': 17, 'r': 18, 's': 19, 't': 20, 'u': 21, 'v': 22, 'w': 23, 'x': 24, 'y': 25, 'z': 26, '1': 27, '2': 28, '3': 29, '4': 30, '5': 31, '6': 32, '7': 33, '8': 34, '9': 3...
_base_ = './grid_rcnn_r50_fpn_gn-head_2x_coco.py' model = dict( pretrained='open-mmlab://resnext101_32x4d', backbone=dict( type='ResNeXt', depth=101, groups=32, base_width=4, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, style...
_base_ = './grid_rcnn_r50_fpn_gn-head_2x_coco.py' model = dict(pretrained='open-mmlab://resnext101_32x4d', backbone=dict(type='ResNeXt', depth=101, groups=32, base_width=4, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, style='pytorch')) optimizer = dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001)...
#!/usr/bin/env python # -*- coding: utf-8 -*- #Reference https://ebisuke33.hatenablog.com/entry/abc197c def main(): N = int(input()) array = list(map(int,input().split())) ans = 10**9+7 if N==1: print(array[0]) exit() for i in range(2**(N-1)): base = 0 or_value = ar...
def main(): n = int(input()) array = list(map(int, input().split())) ans = 10 ** 9 + 7 if N == 1: print(array[0]) exit() for i in range(2 ** (N - 1)): base = 0 or_value = array[0] for j in range(1, N): if i >> j - 1 & 1: base ^= or_...
info = """ pylie: a Pandas extension for LIE analysis version: {version} author: {author} """
info = '\npylie: a Pandas extension for LIE analysis\n\nversion: {version}\nauthor: {author}\n'
"""GALINI exceptions module.""" class DomainError(ValueError): """Invalid function domain.""" pass class InvalidFileExtensionError(Exception): """Exception for invalid input file extension.""" pass class InvalidPythonInputError(Exception): """Exception for invalid python input file.""" pas...
"""GALINI exceptions module.""" class Domainerror(ValueError): """Invalid function domain.""" pass class Invalidfileextensionerror(Exception): """Exception for invalid input file extension.""" pass class Invalidpythoninputerror(Exception): """Exception for invalid python input file.""" pass
print("(1, 2, 3) < (1, 2, 4) :", (1, 2, 3) < (1, 2, 4)) print("[1, 2, 3] < [1, 2, 4] :", [1, 2, 3] < [1, 2, 4]) print("'ABC' < 'C' < 'Pascal' < 'Python' :", 'ABC' < 'C' < 'Pascal' < 'Python') print("(1, 2, 3, 4) < (1, 2, 4) :",...
print('(1, 2, 3) < (1, 2, 4) :', (1, 2, 3) < (1, 2, 4)) print('[1, 2, 3] < [1, 2, 4] :', [1, 2, 3] < [1, 2, 4]) print("'ABC' < 'C' < 'Pascal' < 'Python' :", 'ABC' < 'C' < 'Pascal' < 'Python') print('(1, 2, 3, 4) < (1, 2, 4) :',...
#Spiral Traversal def spiralTraverse(array): # Write your code here. result=[] startRow=0 startCol=0 endRow=len(array)-1 endCol=len(array[0])-1 while startRow<=endRow and startCol<=endCol: for col in range(startCol, endCol+1): print(col) result.append(array[startRow][col]) for row in range(startRow...
def spiral_traverse(array): result = [] start_row = 0 start_col = 0 end_row = len(array) - 1 end_col = len(array[0]) - 1 while startRow <= endRow and startCol <= endCol: for col in range(startCol, endCol + 1): print(col) result.append(array[startRow][col]) ...
class TwoSum(object): def __init__(self): """ Initialize your data structure here. """ self.nums = [] self.is_sorted = False def add(self, number): """ Add the number to an internal data structure.. :type number: int :rtype: None ...
class Twosum(object): def __init__(self): """ Initialize your data structure here. """ self.nums = [] self.is_sorted = False def add(self, number): """ Add the number to an internal data structure.. :type number: int :rtype: None ...
# TODO Find a way to actually configure these :D BASE_URL = 'http://localhost:8000/' MAILCATCHER_URL = 'http://localhost:1080/'
base_url = 'http://localhost:8000/' mailcatcher_url = 'http://localhost:1080/'
''' @Author: Yingshi Chen @Date: 2020-03-20 17:39:56 @ # Description: '''
""" @Author: Yingshi Chen @Date: 2020-03-20 17:39:56 @ # Description: """
#Ricky Deegan #check if one number divides another p = 8 m = 2 if (p % m) == 0: print (p, "divided by", m, "leaves a remainder of zero") print ("I'll be run too if the condition is true") else: print (p, "divided by", m, "does not leave leaves a remainder of zero") print ("I'll be run too if the condi...
p = 8 m = 2 if p % m == 0: print(p, 'divided by', m, 'leaves a remainder of zero') print("I'll be run too if the condition is true") else: print(p, 'divided by', m, 'does not leave leaves a remainder of zero') print("I'll be run too if the condition is false") print("I'll run no matter what")
stim_positions = { 'double' : [ [( .4584, .2575, .2038), # 3d location ( .4612, .2690,-.0283)], [( .4601, .1549, .1937), ( .4614, .1660,-.0358)] ], 'double_20070301' : [ [( .4538, .2740, .1994), # top highy ( .4565,...
stim_positions = {'double': [[(0.4584, 0.2575, 0.2038), (0.4612, 0.269, -0.0283)], [(0.4601, 0.1549, 0.1937), (0.4614, 0.166, -0.0358)]], 'double_20070301': [[(0.4538, 0.274, 0.1994), (0.4565, 0.2939, -0.0531)], [(0.4516, 0.1642, 0.1872), (0.4541, 0.1767, -0.0606)]], 'half': [[(0.4567, 0.2029, 0.1958), (0.4581, 0.2166,...
def test_NEQSys(): pass def test_SimpleNEQSys(): pass
def test_neq_sys(): pass def test__simple_neq_sys(): pass
# -*- coding: utf-8 -*- """ Created on Fri Feb 8 18:45:00 2019 @author: positiveoutlier """ s = 'azcbobobegghakl' vowels = 0 for letter in s: if letter in ("aeiou"): vowels += 1 print("Number of vowels: " + str(vowels))
""" Created on Fri Feb 8 18:45:00 2019 @author: positiveoutlier """ s = 'azcbobobegghakl' vowels = 0 for letter in s: if letter in 'aeiou': vowels += 1 print('Number of vowels: ' + str(vowels))
# -*- coding: utf-8 -*- __author__ = """Arya D. McCarthy""" __email__ = 'admccarthy@smu.edu' __version__ = '0.1.0'
__author__ = 'Arya D. McCarthy' __email__ = 'admccarthy@smu.edu' __version__ = '0.1.0'
""" PASSENGERS """ numPassengers = 3219 passenger_arriving = ( (3, 9, 5, 2, 1, 0, 9, 5, 5, 7, 1, 0), # 0 (5, 5, 5, 8, 2, 0, 5, 8, 3, 4, 3, 0), # 1 (5, 12, 6, 3, 0, 0, 9, 6, 3, 9, 3, 0), # 2 (3, 5, 6, 2, 3, 0, 3, 5, 11, 6, 3, 0), # 3 (6, 9, 9, 3, 4, 0, 3, 9, 3, 3, 1, 0), # 4 (5, 7, 9, 6, 4, 0, 5, 8, 6, 7, ...
""" PASSENGERS """ num_passengers = 3219 passenger_arriving = ((3, 9, 5, 2, 1, 0, 9, 5, 5, 7, 1, 0), (5, 5, 5, 8, 2, 0, 5, 8, 3, 4, 3, 0), (5, 12, 6, 3, 0, 0, 9, 6, 3, 9, 3, 0), (3, 5, 6, 2, 3, 0, 3, 5, 11, 6, 3, 0), (6, 9, 9, 3, 4, 0, 3, 9, 3, 3, 1, 0), (5, 7, 9, 6, 4, 0, 5, 8, 6, 7, 3, 0), (3, 5, 4, 1, 2, 0, 4, 4, 6,...
SET = "set" # sets an document's field to a new value UNSET = "unset" # unset a document's field PUSH = "push" # pushes an element into a document's array field POP = "pop" # removes either the first or last element in an array INC = "inc" # increments a document's numerical field class Collection: # constr...
set = 'set' unset = 'unset' push = 'push' pop = 'pop' inc = 'inc' class Collection: def __init__(self, db, document): self._collection = db[document] def find_by_criteria(self, criteria: dict) -> list: """ retrieves every entry in the database based on a criteria dictionary :p...
def str_or_list_to_list(path_or_paths): if isinstance(path_or_paths, str): # parameter is a string, turn it into a list of strings paths = [path_or_paths] else: # parameter is a list paths = path_or_paths return paths
def str_or_list_to_list(path_or_paths): if isinstance(path_or_paths, str): paths = [path_or_paths] else: paths = path_or_paths return paths
""" Basic Math Ops """ # Given the list below, assign the correct values to the variables below. # my_sum = # my_min = # my_max = # my_range = # my_mean = nums = [2, 19, 20, 12, 6, 24, 8, 30, 28, 25] # Once you finish, print out each value **on its own line** in this format: "my_median = " etc.
""" Basic Math Ops """ nums = [2, 19, 20, 12, 6, 24, 8, 30, 28, 25]
def f(a, b): return a + b def g(): i = 0 while i < 10: a = 'foo' i += 1 def h(): [x for x in range(10)]
def f(a, b): return a + b def g(): i = 0 while i < 10: a = 'foo' i += 1 def h(): [x for x in range(10)]
if __name__ == "__main__": count = 0 resolution = 10000 iota = 1 / resolution a = 0 b = 0 while a <= 1: b = 0 while b <= 1: if (pow(a, 2) + pow(b, 2)) <= (2 * min(a, b)): count = count + 1 b += iota a += iota print(f"Count is: {...
if __name__ == '__main__': count = 0 resolution = 10000 iota = 1 / resolution a = 0 b = 0 while a <= 1: b = 0 while b <= 1: if pow(a, 2) + pow(b, 2) <= 2 * min(a, b): count = count + 1 b += iota a += iota print(f'Count is: {coun...
class GradScaler(object): def __init__( self, init_scale, growth_factor, backoff_factor, growth_interval, enabled ): self.scale_factor = init_scale self.growth_factor = growth_factor self.backoff_factor = backoff_factor self.growth_interval = growth_interval self....
class Gradscaler(object): def __init__(self, init_scale, growth_factor, backoff_factor, growth_interval, enabled): self.scale_factor = init_scale self.growth_factor = growth_factor self.backoff_factor = backoff_factor self.growth_interval = growth_interval self.enabled = ena...
# -*- coding: utf-8 -*- __all__ = [] __version__ = '0.0' FONTS = [ { "name": "Roboto", "fn_regular": fonts_path + 'Roboto-Regular.ttf', "fn_bold": fonts_path + 'Roboto-Medium.ttf', "fn_italic": fonts_path + 'Roboto-Italic.ttf', "fn_bolditalic": fonts_path + 'Roboto-MediumIt...
__all__ = [] __version__ = '0.0' fonts = [{'name': 'Roboto', 'fn_regular': fonts_path + 'Roboto-Regular.ttf', 'fn_bold': fonts_path + 'Roboto-Medium.ttf', 'fn_italic': fonts_path + 'Roboto-Italic.ttf', 'fn_bolditalic': fonts_path + 'Roboto-MediumItalic.ttf'}, {'name': 'RobotoLight', 'fn_regular': fonts_path + 'Roboto-T...
# TODO(dragondriver): add more default configs to here class DefaultConfigs: MaxSearchResultSize = 100 * 1024 * 1024 WaitTimeDurationWhenLoad = 0.5 # in seconds
class Defaultconfigs: max_search_result_size = 100 * 1024 * 1024 wait_time_duration_when_load = 0.5
""" Implementation of a binary heap, with the minimum value at root (a min heap). Created during Coursera Algorithm course. Author: Jing Wang """ class BinHeap: def __init__(self): self.heap = [] self.heap_size = 0 self.pos = dict() @staticmethod def parent(idx): return (i...
""" Implementation of a binary heap, with the minimum value at root (a min heap). Created during Coursera Algorithm course. Author: Jing Wang """ class Binheap: def __init__(self): self.heap = [] self.heap_size = 0 self.pos = dict() @staticmethod def parent(idx): return (...
def f(): n = 0 while True: n = yield n + 1 print(n) g = f() try: g.send(1) print("FAIL") raise SystemExit except TypeError: print("caught") print(g.send(None)) print(g.send(100)) print(g.send(200)) def f2(): print("entering") for i in range(3): print(i) ...
def f(): n = 0 while True: n = (yield (n + 1)) print(n) g = f() try: g.send(1) print('FAIL') raise SystemExit except TypeError: print('caught') print(g.send(None)) print(g.send(100)) print(g.send(200)) def f2(): print('entering') for i in range(3): print(i) ...
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution(object): def trimBST(self, root, low, high): """ :type root: TreeNode :type l...
class Solution(object): def trim_bst(self, root, low, high): """ :type root: TreeNode :type low: int :type high: int :rtype: TreeNode """ def trim(node): if node is None: return if node.val < low: retur...
# What substring do hish and fish have in common ? # How about hish and vista ? # Thats what we'll calculate # grid cell = [] word_a = 'fosh' word_b = 'fort' l_c_s = 0 # initiating with 0 values for a in range(0, len(word_a)): cell.append(list(0 for b in word_b)) for i in range(0, len(word_a)): for j i...
cell = [] word_a = 'fosh' word_b = 'fort' l_c_s = 0 for a in range(0, len(word_a)): cell.append(list((0 for b in word_b))) for i in range(0, len(word_a)): for j in range(0, len(word_b)): if word_a[i] == word_b[j]: cell[i][j] = cell[i - 1][j - 1] + 1 l_c_s = max(l_c_s, cell[i][j])...
class Group(object): def __init__(self, id=None, name=None, members=None) -> None: self.id = id self.name = name self.members = [] def setId(self, id): self.id = id def getId(self): return self.id def setName(self, name): self.id = name ...
class Group(object): def __init__(self, id=None, name=None, members=None) -> None: self.id = id self.name = name self.members = [] def set_id(self, id): self.id = id def get_id(self): return self.id def set_name(self, name): self.id = name def get...
""" GetFX base module ================= This module provides base functionality (implemented in :py:class:`GetFX` class) that should be extended by specific implementation for given FX provider. """ class GetFX(object): """Super class for FX object. It is expected this class to be **always extended** by s...
""" GetFX base module ================= This module provides base functionality (implemented in :py:class:`GetFX` class) that should be extended by specific implementation for given FX provider. """ class Getfx(object): """Super class for FX object. It is expected this class to be **always extended** by sp...
# CONFIGURATION # -------------------------------------------------------------------------------------------- y_min = 0 # minimum value displayed on y axis y_max = 100 # maximum value displayed on y axis (maximum must be greater (not greater or equal) than minimum) x_m...
y_min = 0 y_max = 100 x_min = 0 x_max = 100 inputs = ['input1', 'input2'] output = 'output' chart_color = '#2E86C1' chart_height = 500 chart_width = 500 num_y_labels = 4 num_x_labels = 4 label_decimals = 0 graph_name = 'User Segmentation' line_offset = 15 font_size = 12 background_color = '#212F3C' y_range = y_max - y_...
f=open('4.1.2_run_all_randomize_wholebrain.sh','w') for i in range(1000): cmd='python 4.1_randomize_wholebrain.py %d'%i f.write(cmd+'\n') f.close()
f = open('4.1.2_run_all_randomize_wholebrain.sh', 'w') for i in range(1000): cmd = 'python 4.1_randomize_wholebrain.py %d' % i f.write(cmd + '\n') f.close()
#Given an interval, the task is to count numbers which have same first and last digits. #For example, 1231 has same first and last digits def same_1andlast(s,e): out=[] for i in range(s,e+1): num=i nos=[] while(num!=0): nos.append(num%10) num /= 10 if(nos[0]==nos[len(nos)-1]): out....
def same_1andlast(s, e): out = [] for i in range(s, e + 1): num = i nos = [] while num != 0: nos.append(num % 10) num /= 10 if nos[0] == nos[len(nos) - 1]: out.append(i) return (out, len(out)) print(same_1andlast(7, 68))
# Problem: # Write a program for converting money from one currency to another. # The following currencies need to be maintained: BGN, USD, EUR, GBP. # Use the following fixed exchange rates: # BGN = 1.79549 USD / 1.95583 EUR / 2.53405 GBP # The input is a conversion amount + Input Currency + Output Currency. # The o...
amount = float(input()) first_currency = input() second_currency = input() result = 0 if first_currency == 'BGN': if second_currency == 'BGN': result = amount * 1 elif second_currency == 'USD': result = amount / 1.79549 elif second_currency == 'EUR': result = amount / 1.95583 eli...
''' Hyper Paramators ''' LENGTH = 9 WALLS = 10 BREAK = 96 INPUT_SHAPE = (LENGTH, LENGTH, 4 + WALLS * 2) OUTPUT_SHAPE = 8 + 2 * (LENGTH - 1) * (LENGTH - 1) # Train epoch for one cycle. EPOCHS = 200 # Training epoch number BATCH_SIZE = 256 FILTER = 256 KERNEL = 3 STRIDE = 1 INITIALIZER = 'he_normal' REGULARIZER = 0.0005 ...
""" Hyper Paramators """ length = 9 walls = 10 break = 96 input_shape = (LENGTH, LENGTH, 4 + WALLS * 2) output_shape = 8 + 2 * (LENGTH - 1) * (LENGTH - 1) epochs = 200 batch_size = 256 filter = 256 kernel = 3 stride = 1 initializer = 'he_normal' regularizer = 0.0005 res_num = 19 simulations = 300 gamma = 1.0 selfmatch ...
_base_ = '../detectors/detectors_htc_r101_64x4d_1x_coco.py' model = dict( pretrained='open-mmlab://resnext101_64x4d', backbone=dict( type='DetectoRS_ResNeXt', depth=101, groups=64, base_width=4, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, ...
_base_ = '../detectors/detectors_htc_r101_64x4d_1x_coco.py' model = dict(pretrained='open-mmlab://resnext101_64x4d', backbone=dict(type='DetectoRS_ResNeXt', depth=101, groups=64, base_width=4, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=True), norm_eval=True, style='p...
# -*- coding: utf-8 -*- """ Created on Fri Apr 17 15:39:35 2020 @author: rodri """ #https://github.com/Vachik-Dave/Data-Mining/tree/master/Eclat%20Algorithm%20in%20Python
""" Created on Fri Apr 17 15:39:35 2020 @author: rodri """
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # (C) British Crown Copyright 2017-2019 Met Office. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions a...
"""Module to contain generally useful constants.""" tight_tolerance = 1e-05 default_tolerance = 0.0001 loose_tolerance = 0.001 rmdi = -32767.0 default_percentiles = (0, 5, 10, 20, 25, 30, 40, 50, 60, 70, 75, 80, 90, 95, 100) absolute_zero = -273.15 u_absolute_zero = 'celsius' r_dry_air = 287.0 u_r_dry_air = 'J K-1 kg-1...
routers = dict( BASE = dict( routes_onerror = [ ('3muses/*', '3muses/default/handle_error') ] ))
routers = dict(BASE=dict(routes_onerror=[('3muses/*', '3muses/default/handle_error')]))
class Triangulo: def __init__(self): self.lado1 = int(input('Ingrese el primer lado: ')) self.lado2 = int(input('Ingrese el segundo lado: ')) self.lado3 = int(input('Ingrese el tercer lado: ')) def mayor(self): if self.lado1>self.lado2 and self.lado1>self.lado3 : pri...
class Triangulo: def __init__(self): self.lado1 = int(input('Ingrese el primer lado: ')) self.lado2 = int(input('Ingrese el segundo lado: ')) self.lado3 = int(input('Ingrese el tercer lado: ')) def mayor(self): if self.lado1 > self.lado2 and self.lado1 > self.lado3: ...
__all__ = [ "__title__", "__summary__", "__uri__", "__version__", "__author__", "__license__", "__copyright__", ] __title__ = "warzone_map_utils" __summary__ = "Map generation and validation repository" __uri__ = "https://github.com/rmudambi/warlight-maps" __version__ = "1.0.0" __author__ = "Beren Erchamion"...
__all__ = ['__title__', '__summary__', '__uri__', '__version__', '__author__', '__license__', '__copyright__'] __title__ = 'warzone_map_utils' __summary__ = 'Map generation and validation repository' __uri__ = 'https://github.com/rmudambi/warlight-maps' __version__ = '1.0.0' __author__ = 'Beren Erchamion' __license__ =...
def river_travelling(cost_matrix): N = len(cost_matrix) M = [[0 for x in range(N)] for x in range(N)] for steps in range(1, N): for i in range(N - steps): j = i + steps lowest = cost_matrix[i][j] for k in range(i + 1, j): lowest = min(lowest, M[k][...
def river_travelling(cost_matrix): n = len(cost_matrix) m = [[0 for x in range(N)] for x in range(N)] for steps in range(1, N): for i in range(N - steps): j = i + steps lowest = cost_matrix[i][j] for k in range(i + 1, j): lowest = min(lowest, M[k][...
# coding: utf-8 # # Functions (2) - Using Functions # In the last lesson we saw how to create a function using the <code>def</code> keyword. We found out how to pass arguments to a function and how to use these arguments within the function. Finally, we learnt how to return one or many objects from the function, and...
def string_multiply(stringIn, number): return stringIn * number test1 = string_multiply('hi', 5) test2 = string_multiply('one', 2) print(test1, test2) def string_compare(string1, string2): if len(string1) > len(string2): return string1 elif len(string2) > len(string1): return string2 el...
PAGES = { # https://github.com/Redocly/redoc 'redoc': """ <!DOCTYPE html> <html> <head> <title>ReDoc</title> <!-- needed for adaptive design --> <meta charset="utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href= "https://f...
pages = {'redoc': '\n<!DOCTYPE html>\n<html>\n <head>\n <title>ReDoc</title>\n <!-- needed for adaptive design -->\n <meta charset="utf-8"/>\n <meta name="viewport" content="width=device-width, initial-scale=1">\n <link href=\n "https://fonts.googleapis.com/css?family=Montse...
""" .. module:: simlayer2 :platform: Python, Micropython """ #--------------------------------------------------------------------------- #from stats.statsct import Statsct class SimulLayer2: """ The layer 2 of LPWA is not symmetry. The LPWA device must know the devaddr assigned to itself before process...
""" .. module:: simlayer2 :platform: Python, Micropython """ class Simullayer2: """ The layer 2 of LPWA is not symmetry. The LPWA device must know the devaddr assigned to itself before processing the SCHC packet. The SCHC gateway must know the devaddr of the LPWA device before transmitting t...
def example(n): if type(n) in [type(1), type(1.1)]: n = str(n) print() print() print("--------------------------Example {}--------------------------".format(n)) # create an empty dictionary newDict = {} # create an dictionary age = {"Jason": 19, "Tim": 34, "Jeff": 48, "haha": -43} # create a...
def example(n): if type(n) in [type(1), type(1.1)]: n = str(n) print() print() print('--------------------------Example {}--------------------------'.format(n)) new_dict = {} age = {'Jason': 19, 'Tim': 34, 'Jeff': 48, 'haha': -43} age['Sundar Pichai'] = 47 del age['haha'] example(1) print(age['J...
# # Copyright (c) 2022 Airbyte, Inc., all rights reserved. # def test_dummy_test(): """this is the dummy test to pass integration tests step""" pass
def test_dummy_test(): """this is the dummy test to pass integration tests step""" pass
class config(): # env config render_train = True render_test = False env_name = "Pong-v0" overwrite_render = True record = True high = 255. # output config output_path = "results/test/" model_output = output_path + "model.weight...
class Config: render_train = True render_test = False env_name = 'Pong-v0' overwrite_render = True record = True high = 255.0 output_path = 'results/test/' model_output = output_path + 'model.weights/' log_path = output_path + 'log.txt' plot_output = output_path + 'scores.png' ...
""" This module lets you practice various patterns for ITERATING through SEQUENCES, including selections from: -- Beginning to end -- Other ranges (e.g., backwards and every-3rd-item) -- The COUNT/SUM/etc pattern -- The FIND pattern (via LINEAR SEARCH) -- The MAX/MIN pattern -- Looking two places in the seq...
""" This module lets you practice various patterns for ITERATING through SEQUENCES, including selections from: -- Beginning to end -- Other ranges (e.g., backwards and every-3rd-item) -- The COUNT/SUM/etc pattern -- The FIND pattern (via LINEAR SEARCH) -- The MAX/MIN pattern -- Looking two places in the seq...
""" Don't put imports or code here This file is imported by setup.py Adding imports here will break setup.py """ __version__ = '1.9.0'
""" Don't put imports or code here This file is imported by setup.py Adding imports here will break setup.py """ __version__ = '1.9.0'
with open("sleepy.in") as input_file: input_file.readline() cows = list(map(int, input_file.readline().split())) def is_list_sorted(lst): return all(elem >= lst[index] for index, elem in enumerate(lst[1:])) t = 0 sorted_cows = cows.copy() for cow in cows: if is_list_sorted(sorted_cows): break ...
with open('sleepy.in') as input_file: input_file.readline() cows = list(map(int, input_file.readline().split())) def is_list_sorted(lst): return all((elem >= lst[index] for (index, elem) in enumerate(lst[1:]))) t = 0 sorted_cows = cows.copy() for cow in cows: if is_list_sorted(sorted_cows): bre...
# Variable for registering new components # Add a new component here and define a file with the name <component_name>.py and override the main variables COMPONENTS = ["aggregations-spot", "gbdisagg-spot"]
components = ['aggregations-spot', 'gbdisagg-spot']
FEATURES = [ 'Post_Top_comment_Jaccard_sim', 'Post_Top_comment_topic_cosine_similarity', 'Post_text', 'Post_topic0', 'Post_topic1', 'Post_topic10', 'Post_topic11', 'Post_topic12', 'Post_topic13', 'Post_topic14', 'Post_topic15', 'Post_topic16', 'Post_topic17', 'Post_topic18', 'Post_topic2', 'Post_topic3'...
features = ['Post_Top_comment_Jaccard_sim', 'Post_Top_comment_topic_cosine_similarity', 'Post_text', 'Post_topic0', 'Post_topic1', 'Post_topic10', 'Post_topic11', 'Post_topic12', 'Post_topic13', 'Post_topic14', 'Post_topic15', 'Post_topic16', 'Post_topic17', 'Post_topic18', 'Post_topic2', 'Post_topic3', 'Post_topic4', ...
# This file is part of the dune-gdt project: # https://github.com/dune-community/dune-gdt # Copyright 2010-2017 dune-gdt developers and contributors. All rights reserved. # License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause) # or GPL-2.0+ (http://opensource.org/licenses/...
class Grids(object): def __init__(self, cache): try: have_alugrid = cache['dune-alugrid'] except KeyError: have_alugrid = False self.all_parts_fmt = [self.alu_conf_part_fmt, self.alu_cube_part_fmt, self.yasp_part_fmt] if have_alugrid else [self.yasp_part_fmt] ...
# BASE URL = "http://download.geofabrik.de/" suffix = "-latest.osm.pbf" africa_url = "africa/" asia_url = "asia/" australia_oceania_url = "australia-oceania/" central_america_url = "central-america/" europe_url = "europe/" north_america_url = "north-america/" south_america_url = "south-america/" baden_wuerttemberg_url...
url = 'http://download.geofabrik.de/' suffix = '-latest.osm.pbf' africa_url = 'africa/' asia_url = 'asia/' australia_oceania_url = 'australia-oceania/' central_america_url = 'central-america/' europe_url = 'europe/' north_america_url = 'north-america/' south_america_url = 'south-america/' baden_wuerttemberg_url = 'euro...
load( "//rules/common:private/utils.bzl", _safe_name = "safe_name", ) load( "//rules/common:private/utils.bzl", _resolve_execution_reqs = "resolve_execution_reqs", ) scala_proto_library_private_attributes = {} def scala_proto_library_implementation(ctx): protos = [dep[ProtoInfo] for dep in ctx.att...
load('//rules/common:private/utils.bzl', _safe_name='safe_name') load('//rules/common:private/utils.bzl', _resolve_execution_reqs='resolve_execution_reqs') scala_proto_library_private_attributes = {} def scala_proto_library_implementation(ctx): protos = [dep[ProtoInfo] for dep in ctx.attr.deps] sources = depse...
t=int(input()) for sss in range(t): sum=0 n,k=map(int,input().split()) a=[0]*(n+1) for i in range(1,n+1): if k==0 or k==n: break if (sum+1<=i+1 and k>0): a[i]=i sum+=i i+=1 k-=1 continue if sum>...
t = int(input()) for sss in range(t): sum = 0 (n, k) = map(int, input().split()) a = [0] * (n + 1) for i in range(1, n + 1): if k == 0 or k == n: break if sum + 1 <= i + 1 and k > 0: a[i] = i sum += i i += 1 k -= 1 c...
def method1(): def findWater(arr, n): left = [0] * n right = [0] * n water = 0 left[0] = arr[0] for i in range(1, n): left[i] = max(left[i - 1], arr[i]) right[n - 1] = arr[n - 1] for i in range(n - 2, -1, -1): right[i] = max(right[i + 1...
def method1(): def find_water(arr, n): left = [0] * n right = [0] * n water = 0 left[0] = arr[0] for i in range(1, n): left[i] = max(left[i - 1], arr[i]) right[n - 1] = arr[n - 1] for i in range(n - 2, -1, -1): right[i] = max(right[i +...
#!/usr/bin/env python # md5: 30abdfb918f7a6b87bd580600c506058 # coding: utf-8 databasename = 'ml-004_clickstream_video.sqlite' def getDatabaseName(): return databasename
databasename = 'ml-004_clickstream_video.sqlite' def get_database_name(): return databasename
class Proxy(object): response_type = "proxy" def __init__(self, url, client_certificate=None, client_key=None): self.url = url self.certificate = client_certificate self.key = client_key def as_dict(self): proxy = { 'to': self.url } ...
class Proxy(object): response_type = 'proxy' def __init__(self, url, client_certificate=None, client_key=None): self.url = url self.certificate = client_certificate self.key = client_key def as_dict(self): proxy = {'to': self.url} if self.certificate: pr...
''' On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed). Once you pay the cost, you can either climb one or two steps. You need to find minimum cost to reach the top of the floor, and you can either start from the step with index 0, or the step with index 1. Example 1: Input: cost = ...
""" On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed). Once you pay the cost, you can either climb one or two steps. You need to find minimum cost to reach the top of the floor, and you can either start from the step with index 0, or the step with index 1. Example 1: Input: cost = ...
'''Defines the `JavaCompilationInfo` provider. ''' JavaCompilationInfo = provider( doc = "Describes the inputs, outputs, and options of a Java compiler invocation for a particular Java target.", fields = { "srcs": "A depset of the Java source `File`s directly included in a Java target. (This does not i...
"""Defines the `JavaCompilationInfo` provider. """ java_compilation_info = provider(doc='Describes the inputs, outputs, and options of a Java compiler invocation for a particular Java target.', fields={'srcs': 'A depset of the Java source `File`s directly included in a Java target. (This does not include either generat...
def agent_settings(arglist, agent_name): if agent_name[-1] == "1": return arglist.model1 elif agent_name[-1] == "2": return arglist.model2 elif agent_name[-1] == "3": return arglist.model3 elif agent_name[-1] == "4": return arglist.model4 else: raise ValueError("Agent name doesn't follow the right ...
def agent_settings(arglist, agent_name): if agent_name[-1] == '1': return arglist.model1 elif agent_name[-1] == '2': return arglist.model2 elif agent_name[-1] == '3': return arglist.model3 elif agent_name[-1] == '4': return arglist.model4 else: raise value_err...
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license # Copyright (C) 2003-2017 Nominum, Inc. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose with or without fee is hereby granted, # provided that the above copyright notice and this permis...
class Set(object): """A simple set class. This class was originally used to deal with sets being missing in ancient versions of python, but dnspython will continue to use it as these sets are based on lists and are thus indexable, and this ability is widely used in dnspython applications. """ ...
# cp857_7x7.py - CP857 7x7 font file for Python # # Copyright (c) 2019-2022 Ercan Ersoy # This file is written by Ercan Ersoy. # This file is licensed under CC0-1.0 Universal License. cp857_7x7 = [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03...
cp857_7x7 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 3, 0, 3, 0, 0, 20, 20, 127, 20, 127, 20, 20, 4, 42, 42, 127, 42, 42, 16, 67, 35, 16, 8, 4, 98, 97, 48, 74, 69, 42, 16, 40, 64, 0, 0, 4, 3, 0, 0, 0, 0, 0, 62, 65, 0, 0, 0, 0, 0, 0, 65, 62, 0, 0, 0, 0, 10, 7, 10, 0, 0, 0, 8, 8, 62, 8, 8, 0, 0, 0, 64, 48, 0, 0,...
config = { 'bot': { 'username': "", # Robinhood credentials. If you don't want to keep them stored here, launch "./2fa.py" to setup the access token interactively 'password': "", 'trades_enabled': False, # if False, just collect data 'simulate_api_calls': False, # if enabled, just pr...
config = {'bot': {'username': '', 'password': '', 'trades_enabled': False, 'simulate_api_calls': False, 'data_source': 'robinhood', 'minutes_between_updates': 5, 'cancel_pending_after_minutes': 20, 'save_charts': True, 'max_data_rows': 2000}, 'ticker_list': {'XETHZUSD': 'ETH'}, 'trade_signals': {'buy': {'function': 'em...
class DeprecatedLogger(object): def __init__(self): print( "Deprecated logger, please use 'from puts import get_logger; logger = get_logger();' instead" ) def debug(self, msg): print(msg) def info(self, msg): print(msg) def warning(self, msg): print...
class Deprecatedlogger(object): def __init__(self): print("Deprecated logger, please use 'from puts import get_logger; logger = get_logger();' instead") def debug(self, msg): print(msg) def info(self, msg): print(msg) def warning(self, msg): print(msg) def error(...
""" Contains the signatures of each telegram line. Previously contained the channel + obis reference signatures, but has been refactored to full line signatures to maintain backwards compatibility. Might be refactored in a backwards incompatible way as soon as proper telegram objects are introduced. """ P1_MESSAGE_HEA...
""" Contains the signatures of each telegram line. Previously contained the channel + obis reference signatures, but has been refactored to full line signatures to maintain backwards compatibility. Might be refactored in a backwards incompatible way as soon as proper telegram objects are introduced. """ p1_message_hea...
def run_functions(proteins, species): interactions = GetSTRINGInteractions() IDs_df = interactions.map_identifiers_string(list(proteins.values()), species) if IDs_df.empty: return IDs = IDs_df.values.flatten() known_interactions = interactions.get_interactions(IDs, species) known_interactions['Original geneID_...
def run_functions(proteins, species): interactions = get_string_interactions() i_ds_df = interactions.map_identifiers_string(list(proteins.values()), species) if IDs_df.empty: return i_ds = IDs_df.values.flatten() known_interactions = interactions.get_interactions(IDs, species) known_int...
# https://www.codingame.com/training/easy/detective-pikaptcha-ep1 def get_neighbors(row, col, grid): if row > 0: yield row - 1, col if row < len(grid) - 1: yield row + 1, col if col > 0: yield row, col - 1 if col < len(grid[row]) - 1: yield row, col + 1 def solution(): width, height = [int(i) fo...
def get_neighbors(row, col, grid): if row > 0: yield (row - 1, col) if row < len(grid) - 1: yield (row + 1, col) if col > 0: yield (row, col - 1) if col < len(grid[row]) - 1: yield (row, col + 1) def solution(): (width, height) = [int(i) for i in input().split()] ...