content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class Solution: def naive(self,root): self.count = Counter() self.nodes = {} def recur(tree): if tree==None: return (None,) left = recur(tree.left) right = recur(tree.right) branch = (tree.val,)+left+right self.count...
class Solution: def naive(self, root): self.count = counter() self.nodes = {} def recur(tree): if tree == None: return (None,) left = recur(tree.left) right = recur(tree.right) branch = (tree.val,) + left + right s...
''' @author: Dallas Fraser @date: 2016-04-12 @organization: MLSB API @summary: The package containing all the basic methods '''
""" @author: Dallas Fraser @date: 2016-04-12 @organization: MLSB API @summary: The package containing all the basic methods """
# Consonant Count # Have the function ConsonantCount(str) take the str string parameter being passed and return the number of consonants the string contains. # Examples # Input: "Hello World" # Output: 7 # Input: "Alphabets" # Output: 6 def ConsonantCount(strParam): array = ["b", "c", "d", "f", "g", "h", "j", "k",...
def consonant_count(strParam): array = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z'] count = 0 for i in strParam: if i.lower() in array: count = count + 1 return count print(consonant_count('Alphabets'))
# Generated by gencrud # field role_access.RA_CREATE constants C_RA_CREATE_MAPPING = {True: 'Yes', False: 'No'} # field role_access.RA_READ constants C_RA_READ_MAPPING = {True: 'Yes', False: 'No'} # field role_access.RA_UPDATE constants C_RA_UPDATE_MAPPING = {True: 'Yes', False: 'No'} # field role_access.RA_DE...
c_ra_create_mapping = {True: 'Yes', False: 'No'} c_ra_read_mapping = {True: 'Yes', False: 'No'} c_ra_update_mapping = {True: 'Yes', False: 'No'} c_ra_delete_mapping = {True: 'Yes', False: 'No'}
num1 = 10 num2 = 20 num3 = 30 num4 = 40
num1 = 10 num2 = 20 num3 = 30 num4 = 40
# define x to the power of p def iterativePower(x, p): result = 1 for a in range(p): result = result * x return result
def iterative_power(x, p): result = 1 for a in range(p): result = result * x return result
OCI_IMAGE_MANIFEST_CONTENT_TYPE = "application/vnd.oci.image.manifest.v1+json" OCI_IMAGE_INDEX_CONTENT_TYPE = "application/vnd.oci.image.index.v1+json" OCI_IMAGE_CONFIG_CONTENT_TYPE = "application/vnd.oci.image.config.v1+json" OCI_IMAGE_TAR_LAYER_CONTENT_TYPE = "application/vnd.oci.image.layer.v1.tar" OCI_IMAGE_TAR_GZ...
oci_image_manifest_content_type = 'application/vnd.oci.image.manifest.v1+json' oci_image_index_content_type = 'application/vnd.oci.image.index.v1+json' oci_image_config_content_type = 'application/vnd.oci.image.config.v1+json' oci_image_tar_layer_content_type = 'application/vnd.oci.image.layer.v1.tar' oci_image_tar_gzi...
def Mideng(li): if(type(li)!=list): return if(len(li)==1): return [li] result=[] for i in range(0,len(li[:])): bak=li[:] head=bak.pop(i) #head of the recursive-produced value for j in Mideng(bak): j.insert(0,head) result.append(j) return result def MM(n): if(type(n)!=int or n...
def mideng(li): if type(li) != list: return if len(li) == 1: return [li] result = [] for i in range(0, len(li[:])): bak = li[:] head = bak.pop(i) for j in mideng(bak): j.insert(0, head) result.append(j) return result def mm(n): if ...
# Determine if String Halves Are Alike ''' You are given a string s of even length. Split this string into two halves of equal lengths, and let a be the first half and b be the second half. Two strings are alike if they have the same number of vowels ('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'). Notice that s c...
""" You are given a string s of even length. Split this string into two halves of equal lengths, and let a be the first half and b be the second half. Two strings are alike if they have the same number of vowels ('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'). Notice that s contains uppercase and lowercase letters....
#!/usr/bin/python # https://practice.geeksforgeeks.org/problems/count-ways-to-reach-the-nth-stair/0 def cal(): """ Trick is to calculate all in one go for the given limit of n """ dp = [0 for i in range(100001)] dp[0] = 1 dp[1] = 1 for i in range(2, 100001): dp[i] = (dp[i-1] + ...
def cal(): """ Trick is to calculate all in one go for the given limit of n """ dp = [0 for i in range(100001)] dp[0] = 1 dp[1] = 1 for i in range(2, 100001): dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007 return dp
lista = set() iloscPrzed = 0 with open('lista_zrobionych.txt', 'r', encoding='UTF-8') as plik: for nazwisko in plik: iloscPrzed += 1 lista.add(nazwisko.strip()) iloscPo = 0 with open('lista_zrobionych.txt', 'w', encoding='UTF-8') as plik: for nazwisko in lista: iloscPo += 1 plik....
lista = set() ilosc_przed = 0 with open('lista_zrobionych.txt', 'r', encoding='UTF-8') as plik: for nazwisko in plik: ilosc_przed += 1 lista.add(nazwisko.strip()) ilosc_po = 0 with open('lista_zrobionych.txt', 'w', encoding='UTF-8') as plik: for nazwisko in lista: ilosc_po += 1 p...
# parsetab_re.py # This file is automatically generated. Do not edit. _tabversion = '3.2' _lr_method = 'LALR' _lr_signature = b'\xe3\xf7\x1b^\x13\xcdAc\xfa\xaan\xef\x88\x91db' _lr_action_items = {'STAR':([3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20,21,22,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,],[-7,...
_tabversion = '3.2' _lr_method = 'LALR' _lr_signature = b'\xe3\xf7\x1b^\x13\xcdAc\xfa\xaan\xef\x88\x91db' _lr_action_items = {'STAR': ([3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40], [-7, -33, -5, 14, -19, -4, -21, -20, -6, 32, -...
def is_leap_year(year): return True if y % 4 != 0 or (y % 100 == 0 and y % 400 != 0) else False def correct(day, month, year): the_31_days = (1, 3, 5, 7, 8, 10, 12) if month < 13: if month in the_31_days: return True elif day > 29 and month != 2: return True ...
def is_leap_year(year): return True if y % 4 != 0 or (y % 100 == 0 and y % 400 != 0) else False def correct(day, month, year): the_31_days = (1, 3, 5, 7, 8, 10, 12) if month < 13: if month in the_31_days: return True elif day > 29 and month != 2: return True ...
# -*- coding: utf-8 -*- # # This file is part of the ska-tmc-common project # # # # Distributed under the terms of the BSD-3-Clause license. # See LICENSE.txt for more info. """ ska-tmc-common """ # TODO: Work out imports and __all__ # from . import release # from tango_client import TangoClient # from tango_group_cl...
""" ska-tmc-common """
"""Tokens used by the lexer to tokenize LookML.""" class Token: """Base class for LookML tokens, lexed from LookML strings.""" id: str = "<base token>" value: str def __init__(self, line_number: int): """Initializes a Token. Args: line_number: The corresponding line in t...
"""Tokens used by the lexer to tokenize LookML.""" class Token: """Base class for LookML tokens, lexed from LookML strings.""" id: str = '<base token>' value: str def __init__(self, line_number: int): """Initializes a Token. Args: line_number: The corresponding line in the...
house={'ling':{'chair':3,'desk':1,'pot':4}, 'jiamin':{'chair':5,'book':18,'cup':20}, 'soo':{'car':1,'chair':9,'desk':1}} def allHouse(houses,item): numItems=0 for p,i in houses.items(): numItems+=i.get(item,0) # print(p+str(i.get(item,0))) return numItems print('Number of prop...
house = {'ling': {'chair': 3, 'desk': 1, 'pot': 4}, 'jiamin': {'chair': 5, 'book': 18, 'cup': 20}, 'soo': {'car': 1, 'chair': 9, 'desk': 1}} def all_house(houses, item): num_items = 0 for (p, i) in houses.items(): num_items += i.get(item, 0) return numItems print('Number of properties:') print('-ch...
# https://stackoverflow.com/questions/458550/standard-way-to-embed-version-into-python-package # Store the version here so: # 1) we don't load dependencies by storing it in __init__.py # 2) we can import it in setup.py for the same reason # 3) we can import it into your module module __version__ = '1.0'
__version__ = '1.0'
""" Multiple-method notifier :author: Matthew Farrugia-Roberts """ class MultiNotifier: def __init__(self, notifiers=None): if notifiers is not None: self.notifiers = notifiers else: self.notifiers = [] def add_notifier(self, notifier): self.notifiers.append(no...
""" Multiple-method notifier :author: Matthew Farrugia-Roberts """ class Multinotifier: def __init__(self, notifiers=None): if notifiers is not None: self.notifiers = notifiers else: self.notifiers = [] def add_notifier(self, notifier): self.notifiers.append(n...
""" Shared default parameters across the modules """ SIGNAL_TYPE = 'F/F0' # F-F0, F/F0, F-F0/F0 LINEAR_MODEL = 'ransac' # 'least_squares' or 'ransac' or 'exp_ransac' DATA_TYPE = 'ca' # one of 'ca', 'ephys' FILTER_ORDER = 1 # Order of the butterworth filter FILTER_CUTOFF = 4 # Hz cutoff for the filter MIN_STATS...
""" Shared default parameters across the modules """ signal_type = 'F/F0' linear_model = 'ransac' data_type = 'ca' filter_order = 1 filter_cutoff = 4 min_stats_score = 0.2 figsize = 8 plot_suffix = '.png' samples_around_peak = 25 time_scale = 1000 debug_optimizer = False
def get_api_params(): TwitterApiParams.__init__(TwitterApiParams,'x','xx','xx') return TwitterApiParams class TwitterApiParams(): def __init__( self,api_key,api_secret_key,bearer_token): self.api_key=api_key self.api_secret_key=api_secret_key self.bearer_token=bearer_token ...
def get_api_params(): TwitterApiParams.__init__(TwitterApiParams, 'x', 'xx', 'xx') return TwitterApiParams class Twitterapiparams: def __init__(self, api_key, api_secret_key, bearer_token): self.api_key = api_key self.api_secret_key = api_secret_key self.bearer_token = bearer_token...
class Solution: def romanToInt(self, s: str) -> int: mydict = { "I":1, "IV":4, "V":5, "IX":9, "X":10, "XL":40, "L":50, "XC":90, "C":100, "CD":400, "D":500, "CM":900...
class Solution: def roman_to_int(self, s: str) -> int: mydict = {'I': 1, 'IV': 4, 'V': 5, 'IX': 9, 'X': 10, 'XL': 40, 'L': 50, 'XC': 90, 'C': 100, 'CD': 400, 'D': 500, 'CM': 900, 'M': 1000} n = len(s) i = 0 num = 0 while i < n: if i < n - 1: ts = ...
IDLE = 0 OFFLINE = 1 INGAME = 2 class User(object): def __init__(self, username, uid, point=0, status=IDLE): self.username = username self.uid = uid self.point = point self.status = status def ___str__(self): return '{} {} {} {}'.format(self.username, self.uid, self....
idle = 0 offline = 1 ingame = 2 class User(object): def __init__(self, username, uid, point=0, status=IDLE): self.username = username self.uid = uid self.point = point self.status = status def ___str__(self): return '{} {} {} {}'.format(self.username, self.uid, self.po...
# Copyright (c) 2009 Twisted Matrix Laboratories. # See LICENSE for details. """ Unit tests for L{twisted.protocols}. """
""" Unit tests for L{twisted.protocols}. """
#!/usr/bin/python3 """Ultron - An EVE Online Discord Bot. Ultron is a Discord bot for EVE Online communities. Ultron is written in python, using v1.0.0 of the discord.py library.""" __version__ = "1.0.0a0" __author__ = "Sheppard" __maintainer__ = "Sheppard" __status__ = "Development"
"""Ultron - An EVE Online Discord Bot. Ultron is a Discord bot for EVE Online communities. Ultron is written in python, using v1.0.0 of the discord.py library.""" __version__ = '1.0.0a0' __author__ = 'Sheppard' __maintainer__ = 'Sheppard' __status__ = 'Development'
""" Backup a DynamoDB to an Avro Container """ version = '1.0.0'
""" Backup a DynamoDB to an Avro Container """ version = '1.0.0'
c = get_config() # noqa: F821 c.FileContentsManager.delete_to_trash = False # switch off CPU reporting c.NotebookApp.ResourceUseDisplay.track_cpu_percent = False # set a memory limit: 200MB c.NotebookApp.ResourceUseDisplay.mem_limit = 246579200 # set a disk limit: 500MB c.NotebookApp.ResourceUseDisplay.disk_limit ...
c = get_config() c.FileContentsManager.delete_to_trash = False c.NotebookApp.ResourceUseDisplay.track_cpu_percent = False c.NotebookApp.ResourceUseDisplay.mem_limit = 246579200 c.NotebookApp.ResourceUseDisplay.disk_limit = 536870912
AUTHOR = 'Will Sorenson' # Location of the pelican Blog BLOG_DIR = '/Users/Will/Devel/tec_blog/' # Directory that posted notebooks should be moved to POSTED_DIR = '/Users/Will/Devel/blog_posts/posted/'
author = 'Will Sorenson' blog_dir = '/Users/Will/Devel/tec_blog/' posted_dir = '/Users/Will/Devel/blog_posts/posted/'
class AccuracyMetric: def __init__(self): self._good = 0 self._total = 0 def clear(self): self._good = 0 self._total = 0 def add(self, predicted_class_scores, target_classes): predicted_classes = predicted_class_scores.argmax(dim=1) self._good += (predicted...
class Accuracymetric: def __init__(self): self._good = 0 self._total = 0 def clear(self): self._good = 0 self._total = 0 def add(self, predicted_class_scores, target_classes): predicted_classes = predicted_class_scores.argmax(dim=1) self._good += (predicted...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # 'args' at sumIntNumbers() is just a name (a tuple! Immutable), it can be anything else (ex: def sumIntNumbers(*numbers)) def sumIntNumbers(*args): ret = 0 #Erro #args[2] = 10 for i in args: ret += i return ret # 'kwargs' at concatenate() is just a name (a dic...
def sum_int_numbers(*args): ret = 0 for i in args: ret += i return ret def concatenate(**kwargs): ret = 'Name: ' ret += kwargs['name'] birth = kwargs['birth'] bbirth = birth[0] mbirth = birth[1] ybirth = birth[2] ret += f', Birth: {bbirth}/{mbirth}/{ybirth}, ' kwargs...
# create blank class print("creating empty class object") print() class A(object): pass # create hypothetical constructor print("defining class constructor") print("will set instance attribute \"a\"") print() def init(cls, a): print("initializing the instance") print() cls.__setattr__("a",a) # create new meth...
print('creating empty class object') print() class A(object): pass print('defining class constructor') print('will set instance attribute "a"') print() def init(cls, a): print('initializing the instance') print() cls.__setattr__('a', a) print('defining method "show" that takes one argument, a class. ...
class AffineCipher: def __init__(self): """This is a python implementation of Affine Cipher""" pass @staticmethod def modinv(a: int, m: int): for x in range(1, m): if (((a%m) * (x%m)) % m == 1): return x return -1 @staticmethod def encryp...
class Affinecipher: def __init__(self): """This is a python implementation of Affine Cipher""" pass @staticmethod def modinv(a: int, m: int): for x in range(1, m): if a % m * (x % m) % m == 1: return x return -1 @staticmethod def encrypt...
def func(nums, target): length = len(nums) for i in range(length): j = i + 1 while j < length: if nums[i] + nums[j] == target: print("{}, {}".format(nums[i], nums[j])) j += 1 def find_insert(nums, target): length = len(nums) for i in range(length...
def func(nums, target): length = len(nums) for i in range(length): j = i + 1 while j < length: if nums[i] + nums[j] == target: print('{}, {}'.format(nums[i], nums[j])) j += 1 def find_insert(nums, target): length = len(nums) for i in range(length)...
def Function(fun): def fun2(): print("start") fun() print("end") return fun2 @Function def fun3(): print("this is a arg function") fun3()
def function(fun): def fun2(): print('start') fun() print('end') return fun2 @Function def fun3(): print('this is a arg function') fun3()
# MEDIUM # 1. count every node # 2. binary Search # class Solution: # def countNodes(self, root: TreeNode) -> int: # return self.dfs(root) # def dfs(self,root): # if not root: # return 0 # return self.dfs(root.left)+self.dfs(root.right) +1 clas...
class Solution: def compute_depth(self, node: TreeNode) -> int: """ Return tree depth in O(d) time. """ d = 0 while node.left: node = node.left d += 1 return d def exists(self, idx: int, d: int, node: TreeNode) -> bool: """ ...
a = [19.310344827586206, 19.597989949748744] b = [24.796747967479675, 9.0, 9.276018099547512, 6.329113924050633, 21.145374449339208, 19.615384615384617] c = a + b print(max(c)) print(min(c))
a = [19.310344827586206, 19.597989949748744] b = [24.796747967479675, 9.0, 9.276018099547512, 6.329113924050633, 21.145374449339208, 19.615384615384617] c = a + b print(max(c)) print(min(c))
'''dado un numero entero, la funcion lo convierte a string luego recorre el string elemento a elemento sumando el cuadrado de este a s, al final retorna s ''' def sD(n): ns = str(n) s = 0 for i in range(len(ns)): s += int(ns[i])**2 return(s) # forma recursiva de la cadena de digitos cuadrados '''para mejorar el ...
"""dado un numero entero, la funcion lo convierte a string luego recorre el string elemento a elemento sumando el cuadrado de este a s, al final retorna s """ def s_d(n): ns = str(n) s = 0 for i in range(len(ns)): s += int(ns[i]) ** 2 return s 'para mejorar el algoritmo en el caso que se analic...
strN = input("Please enter a number:") N = int(strN) #N = 10 total = 0 for current in range(N+1): if current % 2 == 0: total = total + current print("summation 1..",N," for even numbers is",total)
str_n = input('Please enter a number:') n = int(strN) total = 0 for current in range(N + 1): if current % 2 == 0: total = total + current print('summation 1..', N, ' for even numbers is', total)
def maxj(lista): nlista = [[0 for lat in elem] for elem in lista] n = len(lista) for i in range(n): m = len(lista[i]) for j in range(m): nlista[i][j] += lista[i][j] war2 = lista[i][j] / 2 war3 = lista[i][j] /3 if i - 1 in range(n):...
def maxj(lista): nlista = [[0 for lat in elem] for elem in lista] n = len(lista) for i in range(n): m = len(lista[i]) for j in range(m): nlista[i][j] += lista[i][j] war2 = lista[i][j] / 2 war3 = lista[i][j] / 3 if i - 1 in range(n): ...
def most_popular_tags(*args, **kwargs): return """SELECT tags.ROWID, tags.tag, count(tid_tag.tag) FROM tid_tag JOIN tags ON tid_tag.tag = tags.ROWID GROUP BY tags.tag ORDER BY count(tid_tag.tag) DESC LIMIT {n};""".format(**kwargs) d...
def most_popular_tags(*args, **kwargs): return 'SELECT tags.ROWID, tags.tag, count(tid_tag.tag)\n FROM tid_tag\n JOIN tags\n ON tid_tag.tag = tags.ROWID\n GROUP BY tags.tag\n ORDER BY count(tid_tag.tag) DESC\n LIMIT {n};'.format(**kwargs) ...
""" https://leetcode.com/problems/degree-of-an-array/ Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements. Your task is to find the smallest possible length of a (contiguous) subarray of nums, that has the same degree as nums. ...
""" https://leetcode.com/problems/degree-of-an-array/ Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements. Your task is to find the smallest possible length of a (contiguous) subarray of nums, that has the same degree as nums. ...
# Multiple servers "should" work but actually totally don't. # port, username, password, and channels are optional # username will use defaults if not defined here servers = [ dict( network='FreeNode', server='chat.freenode.net', #port=6665, #password='SuperSecretPassword', #...
servers = [dict(network='FreeNode', server='chat.freenode.net')] username = '' nicknames = [username, username + '_', username + '`', username + '|'] realname = 'Flying on a paperplane!' highlight = nicknames + [] quit_message = "Oh, so THAT's what that button does." font = 'sans 9' bold_font = 'sans 9 bold' colors = [...
def wifi_deal_ap_info(info): res = [] for ap_str in info: ap_str = ap_str.split(",") info_one = [] for node in ap_str: if node.startswith('"'): info_one.append(node[1:-1]) else: info_one.append(int(node)) res.append(info_on...
def wifi_deal_ap_info(info): res = [] for ap_str in info: ap_str = ap_str.split(',') info_one = [] for node in ap_str: if node.startswith('"'): info_one.append(node[1:-1]) else: info_one.append(int(node)) res.append(info_one...
""" GameBoy Emulator Written in Python MIT License Copyright (c) 2017 Ryan Sheffer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to...
""" GameBoy Emulator Written in Python MIT License Copyright (c) 2017 Ryan Sheffer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to...
""" This is a module in a separate package """ def hello_stranger(): """ hello """ print("pylint does not like empty modules")
""" This is a module in a separate package """ def hello_stranger(): """ hello """ print('pylint does not like empty modules')
""" Classifiers predict the class of an example. Most of the Classifier classes are wrappers for external, publicly available classifier implementations. They are used to predict the classes of examples generated by ExampleBuilders. The correctness of these predictions can then be measured with Evaluators. """
""" Classifiers predict the class of an example. Most of the Classifier classes are wrappers for external, publicly available classifier implementations. They are used to predict the classes of examples generated by ExampleBuilders. The correctness of these predictions can then be measured with Evaluators. """
class Winratio: def __init__(self, **kwargs): self.losses = kwargs.get("Losses", kwargs.get("losses", 0)) or 0 self.wins = kwargs.get("Wins", kwargs.get("wins", 0)) or 0 @property def winratio(self): _w = self.wins /(self.matches_played if self.matches_played > 1 else 1) * 100.0 return int(_w) if _w % 2 == 0...
class Winratio: def __init__(self, **kwargs): self.losses = kwargs.get('Losses', kwargs.get('losses', 0)) or 0 self.wins = kwargs.get('Wins', kwargs.get('wins', 0)) or 0 @property def winratio(self): _w = self.wins / (self.matches_played if self.matches_played > 1 else 1) * 100.0 ...
# Balanced binary search tree (AVL tree) implementation class Node: def __init__(self, key, value=None, parent=None, left=None, right=None): self.key, self.value, self.parent = key, value, parent self.child = [left, right] self.balance, self.height = 0, 1 def __str__(self) -> str: ...
class Node: def __init__(self, key, value=None, parent=None, left=None, right=None): (self.key, self.value, self.parent) = (key, value, parent) self.child = [left, right] (self.balance, self.height) = (0, 1) def __str__(self) -> str: return f'{self.key}:{self.value}:{self.balan...
def input_to_int(value): """ Checks that user (string) input is an integer. Parameters ---------- value : user input to check Returns ------- integer : n cast to an integer Raises ------ ValueError : if n is not an integer """ if str(value).isdigit(): retur...
def input_to_int(value): """ Checks that user (string) input is an integer. Parameters ---------- value : user input to check Returns ------- integer : n cast to an integer Raises ------ ValueError : if n is not an integer """ if str(value).isdigit(): retur...
class Solution: def carPooling(self, trips: List[List[int]], capacity: int) -> bool: stops = [] for n, s, e in trips: stops.append((s, n, 's')) stops.append((e, n, 'e')) stops.sort() p = 0 for i in range(len(stops)): stop, n, c = stops[i] ...
class Solution: def car_pooling(self, trips: List[List[int]], capacity: int) -> bool: stops = [] for (n, s, e) in trips: stops.append((s, n, 's')) stops.append((e, n, 'e')) stops.sort() p = 0 for i in range(len(stops)): (stop, n, c) = stop...
data = ( 'Ruo ', # 0x00 'Bei ', # 0x01 'E ', # 0x02 'Yu ', # 0x03 'Juan ', # 0x04 'Yu ', # 0x05 'Yun ', # 0x06 'Hou ', # 0x07 'Kui ', # 0x08 'Xiang ', # 0x09 'Xiang ', # 0x0a 'Sou ', # 0x0b 'Tang ', # 0x0c 'Ming ', # 0x0d 'Xi ', # 0x0e 'Ru ', # 0x0f 'Chu ', # 0x10 'Zi ...
data = ('Ruo ', 'Bei ', 'E ', 'Yu ', 'Juan ', 'Yu ', 'Yun ', 'Hou ', 'Kui ', 'Xiang ', 'Xiang ', 'Sou ', 'Tang ', 'Ming ', 'Xi ', 'Ru ', 'Chu ', 'Zi ', 'Zou ', 'Ju ', 'Wu ', 'Xiang ', 'Yun ', 'Hao ', 'Yong ', 'Bi ', 'Mo ', 'Chao ', 'Fu ', 'Liao ', 'Yin ', 'Zhuan ', 'Hu ', 'Qiao ', 'Yan ', 'Zhang ', 'Fan ', 'Qiao ', 'Xu...
class NotIndicPythonFileException(Exception): """ Raised when a file is not in Indic Python format. """ def __init__(self, file_path) -> None: super().__init__(f"File {file_path} is not a indic python file.") self.file_path = file_path class UnknownLanguageException(Exception): """ Raised when a IndicPy file...
class Notindicpythonfileexception(Exception): """ Raised when a file is not in Indic Python format. """ def __init__(self, file_path) -> None: super().__init__(f'File {file_path} is not a indic python file.') self.file_path = file_path class Unknownlanguageexception(Exception): """ Rais...
data = { "color": { "black": "30", "red": "31", "green": "32", "yellow": "33", "blue": "34", "magenta": "35", "cyan": "36", "white": "37" }, "bgcolor": { "black": "40", "red": "41", "green": "42", ...
data = {'color': {'black': '30', 'red': '31', 'green': '32', 'yellow': '33', 'blue': '34', 'magenta': '35', 'cyan': '36', 'white': '37'}, 'bgcolor': {'black': '40', 'red': '41', 'green': '42', 'yellow': '43', 'blue': '44', 'magenta': '45', 'cyan': '46', 'white': '47'}, 'style': {'normal': 0, 'bold': 1, 'faint': 2, 'ita...
load("//:compile.bzl", "proto_compile") def gateway_swagger_compile(**kwargs): proto_compile( plugins = [ str(Label("//github.com/grpc-ecosystem/grpc-gateway:swagger")), ], **kwargs )
load('//:compile.bzl', 'proto_compile') def gateway_swagger_compile(**kwargs): proto_compile(plugins=[str(label('//github.com/grpc-ecosystem/grpc-gateway:swagger'))], **kwargs)
__all__ = [ 'q1_exceptions', 'q2_incorrect_regex' ]
__all__ = ['q1_exceptions', 'q2_incorrect_regex']
output_colors = { "white":(255, 255, 255) } chat_prefix = "[c/00cc00:<python>] " console_chat_prefix = "<python> " default_color = (150, 150, 255) def puts(*args): SendMessage(", ".join([str(arg) for arg in args]), default_color[0], default_color[1], default_color[2]) def putsc(color, *args): SendMessage(", ".join...
output_colors = {'white': (255, 255, 255)} chat_prefix = '[c/00cc00:<python>] ' console_chat_prefix = '<python> ' default_color = (150, 150, 255) def puts(*args): send_message(', '.join([str(arg) for arg in args]), default_color[0], default_color[1], default_color[2]) def putsc(color, *args): send_message(', ...
""" Includes a unified framework for representation and learning of coreference resolution approaches.""" __author__ = 'martscsn'
""" Includes a unified framework for representation and learning of coreference resolution approaches.""" __author__ = 'martscsn'
# Celery CELERY_RESULT_SERIALIZER = 'json' CELERY_TASK_SERIALIZER = 'json' CELERYD_MAX_TASKS_PER_CHILD = 100 CELERY_BEAT_SCHEDULER = 'django_celery_beat.schedulers:DatabaseScheduler'
celery_result_serializer = 'json' celery_task_serializer = 'json' celeryd_max_tasks_per_child = 100 celery_beat_scheduler = 'django_celery_beat.schedulers:DatabaseScheduler'
# filename Specifies that a FileHandler be created, using the specified # filename, rather than a StreamHandler. # filemode Specifies the mode to open the file, if filename is specified # (if filemode is unspecified, it defaults to 'a'). # format Use the specified format string for the handler...
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) logging.basicConfig(stream=sys.stdout, level=logging.DEBUG, format='[%(asctime)s,%(process)d-%(thread)d,%(filename)s,%(lineno)d,%(levelname)s] %(message)s')
# BinGrep, version 1.0.0 # Copyright 2017 Hiroki Hada # coding:UTF-8 class Node(object): def __init__(self, label): (self.label, self.children) = (label, list()) @staticmethod def get_children(node): return node.children @staticmethod def get_label(node): return node.label ...
class Node(object): def __init__(self, label): (self.label, self.children) = (label, list()) @staticmethod def get_children(node): return node.children @staticmethod def get_label(node): return node.label def addkid(self, node): self.children.append(node) ...
def bytes_to_int(bytes_string): ''' pack of the int.from_bytes ''' return int.from_bytes(bytes_string, byteorder="big")
def bytes_to_int(bytes_string): """ pack of the int.from_bytes """ return int.from_bytes(bytes_string, byteorder='big')
""" The :mod:`fatf.fairness.models` module holds fairness algorithms for models. """ # Author: Kacper Sokol <k.sokol@bristol.ac.uk> # License: new BSD
""" The :mod:`fatf.fairness.models` module holds fairness algorithms for models. """
number_to_factorial = int(input("Enter a number:")) factorial = 1 if number_to_factorial < 0: print("The factorial isn't exist") elif number_to_factorial == 0: print("The factorial of 0 is 1") else: for i in range(1,number_to_factorial + 1): factorial = factorial*i print ("The factorial...
number_to_factorial = int(input('Enter a number:')) factorial = 1 if number_to_factorial < 0: print("The factorial isn't exist") elif number_to_factorial == 0: print('The factorial of 0 is 1') else: for i in range(1, number_to_factorial + 1): factorial = factorial * i print('The factorial of', n...
class Solution(object): def adder(self, a, b): cin, sum_out = 0, 0 for i in range(32): a_bit = (a & (1 << i)) >> i b_bit = (b & (1 << i)) >> i s = b_bit ^ a_bit ^ cin sum_out |= (s << i) cin = ((a_bit | b_bit | cin) & ~s) | (cin & a_bit & b...
class Solution(object): def adder(self, a, b): (cin, sum_out) = (0, 0) for i in range(32): a_bit = (a & 1 << i) >> i b_bit = (b & 1 << i) >> i s = b_bit ^ a_bit ^ cin sum_out |= s << i cin = (a_bit | b_bit | cin) & ~s | cin & a_bit & b_bit...
class InertiaExpansionBehavior(object): """ Controls the deceleration of a resizing manipulation during inertia. InertiaExpansionBehavior() """ DesiredDeceleration=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets the rate that resizing slows in device-independent un...
class Inertiaexpansionbehavior(object): """ Controls the deceleration of a resizing manipulation during inertia. InertiaExpansionBehavior() """ desired_deceleration = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Gets or sets the rate that resizing slows in device-independ...
# Is This a Binary Search Tree? # Developer: Murillo Grubler # https://www.hackerrank.com/challenges/is-binary-search-tree/problem # Time complexity: O(n) # Rules: # The inOrder function must return an ordered list # No duplication def in_order(root, arr): if root.left is not None: in_order(root.left, arr...
def in_order(root, arr): if root.left is not None: in_order(root.left, arr) arr.append(root.data) if root.right is not None: in_order(root.right, arr) return arr def check_binary_search_tree_(root): tree_in_list = in_order(root, []) for i in range(1, len(tree_in_list)): ...
# Autor: Abdel G. Martinez L. # # Instrucciones: Simular un directorio telefonico def imprimirNumero(numeros): print("Numeros Telefonicos:") for k, v in numeros.items(): print("Nombre:", k, "\tNumero:", v) print() def agregarNumero(numeros, nombre, numero): numeros[nombre] = numero def buscar...
def imprimir_numero(numeros): print('Numeros Telefonicos:') for (k, v) in numeros.items(): print('Nombre:', k, '\tNumero:', v) print() def agregar_numero(numeros, nombre, numero): numeros[nombre] = numero def buscar_numero(numeros, nombre): if nombre in numeros: return 'El numero e...
# Testing basic features expected_results = { "test_target": { "desc": "test basic features", "expected_features": ["IPV4"] } }
expected_results = {'test_target': {'desc': 'test basic features', 'expected_features': ['IPV4']}}
with open('advent_of_code/03_toboggan_trajectory/input.txt', 'r') as f: lines = [l[:-1] for l in f.readlines()] length = len(lines) indices = [i*3 for i in range(length)] modulo = len(lines[0]) moduled_indices = [i % modulo for i in indices] counts = [1 if lines[x][y] == '#' else 0 for x, y in zip(range(length), ...
with open('advent_of_code/03_toboggan_trajectory/input.txt', 'r') as f: lines = [l[:-1] for l in f.readlines()] length = len(lines) indices = [i * 3 for i in range(length)] modulo = len(lines[0]) moduled_indices = [i % modulo for i in indices] counts = [1 if lines[x][y] == '#' else 0 for (x, y) in zip(range(length)...
# @Sk70249 TwoSum solution in Python ''' Example 1: Input: nums = [2,7,11,15], target = 9 Output: [0,1] Output: Because nums[0] + nums[1] == 9, we return [0, 1]. Example 2: Input: nums = [3,2,4], target = 6 Output: [1,2] ''' class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: a = ...
""" Example 1: Input: nums = [2,7,11,15], target = 9 Output: [0,1] Output: Because nums[0] + nums[1] == 9, we return [0, 1]. Example 2: Input: nums = [3,2,4], target = 6 Output: [1,2] """ class Solution: def two_sum(self, nums: List[int], target: int) -> List[int]: a = {} for (i, j) in enumerate...
####################################################### some combinatoric first def genPerm(n): if n==0: return [[]] res=[] prev=genPerm(n-1) for p in prev: for i in range(n-1): k=p[i] tmp=p+[k] tmp[i]=n res.append(tmp) res.appen...
def gen_perm(n): if n == 0: return [[]] res = [] prev = gen_perm(n - 1) for p in prev: for i in range(n - 1): k = p[i] tmp = p + [k] tmp[i] = n res.append(tmp) res.append(p + [n]) return res def gen_perm_elem(elem): if not ...
#!/usr/bin/env python # coding: utf8 """ Browser error pages package. """ __author__ = 'fv' __version__ = '1.0.0'
""" Browser error pages package. """ __author__ = 'fv' __version__ = '1.0.0'
class LinkedNode(object): def __init__(self, val): self.val = val self.next = None class BinaryNode(object): def __init__(self, val, left=None, right=None): self.val, self.left, self.right = val, left, right class DoublyLinkedNode(object): def __init__(self, val, prev=None, next...
class Linkednode(object): def __init__(self, val): self.val = val self.next = None class Binarynode(object): def __init__(self, val, left=None, right=None): (self.val, self.left, self.right) = (val, left, right) class Doublylinkednode(object): def __init__(self, val, prev=None, ...
# An example util module that we want to test. # `reverse` takes a list and returns a new list with the same # elements, but with their order reversed. def reverse(l): return [element for element in reversed(l)]
def reverse(l): return [element for element in reversed(l)]
n=int(input('How many numbers: ')) k=[] for i in range(n): x=int(input('Enter number ')) k.append(x) print('Maximum element in the list is :',max(k),'') print('Minimum element in the list is :',min(k)) sum=0 for i in k: sum+=i print('Average = ',sum/len(k))
n = int(input('How many numbers: ')) k = [] for i in range(n): x = int(input('Enter number ')) k.append(x) print('Maximum element in the list is :', max(k), '') print('Minimum element in the list is :', min(k)) sum = 0 for i in k: sum += i print('Average = ', sum / len(k))
class Token: def __init__(self, value = None, type = None) -> None: self.type = type self.value = value def __repr__(self) -> str: if self.type: return f'{self.type} : {self.value}' return f'{self.value}'
class Token: def __init__(self, value=None, type=None) -> None: self.type = type self.value = value def __repr__(self) -> str: if self.type: return f'{self.type} : {self.value}' return f'{self.value}'
#!/usr/bin/env python """ This module contains various exceptions raised by agate. """ class NullCalculationError(Exception): # pragma: no cover """ Exception raised if a calculation which can not logically account for null values is attempted on a :class:`Column` containing nulls. """ pass ...
""" This module contains various exceptions raised by agate. """ class Nullcalculationerror(Exception): """ Exception raised if a calculation which can not logically account for null values is attempted on a :class:`Column` containing nulls. """ pass class Unsupportedaggregationerror(Exception...
#***Max-Out Memory** giant_string = '' while True: with open('long_file.txt', 'r') as f: for line in f: giant_string += line
giant_string = '' while True: with open('long_file.txt', 'r') as f: for line in f: giant_string += line
USERNAME_MAX_LENGTH = 30 EMAIL_TO_USERNAME_HASH_LENGTH = USERNAME_MAX_LENGTH EMAIL_ACTIVATION_KEY_EXPIRATION_HOURS = 48 EMAIL_ACTIVATION_KEY_REUSE_THRESHOLD_HOURS = EMAIL_ACTIVATION_KEY_EXPIRATION_HOURS - 1 SOCIAL_AUTH_PROVIDER_FACEBOOK = 'facebook' SOCIAL_AUTH_PROVIDER_LINKEDIN = 'linkedin' SOCIAL_AUTH_PROVIDER_TWIT...
username_max_length = 30 email_to_username_hash_length = USERNAME_MAX_LENGTH email_activation_key_expiration_hours = 48 email_activation_key_reuse_threshold_hours = EMAIL_ACTIVATION_KEY_EXPIRATION_HOURS - 1 social_auth_provider_facebook = 'facebook' social_auth_provider_linkedin = 'linkedin' social_auth_provider_twitte...
# # ktool | kmacho # structs.py # # Custom Struct implementation reflecting behavior of named tuples while also handling behind-the-scenes packing/unpacking. # # This file is part of ktool. ktool is free software that # is made available under the MIT license. Consult the # file "LICENSE" that is distribu...
type_mask = 4294901760 size_mask = 65535 type_uint = 0 type_sint = 65536 type_str = 131072 type_bytes = 196608 uint8_t = 1 uint16_t = 2 uint32_t = 4 uint64_t = 8 int8_t = type_sint | 1 int16_t = type_sint | 2 int32_t = type_sint | 4 int64_t = type_sint | 8 char_t = [type_str | i for i in range(17)] def _bytes_to_hex(d...
while True: n = int(input('Quer ver a tabuada de qual numero? ')) if n <= 0: break for c in range(1, 11): print(f'\033[1;31m{n}\033[m x \033[1;32m{c}\033[m = \033[1;33m{n*c}\033[m') print('Fim do progama, obrigado por utilizar!')
while True: n = int(input('Quer ver a tabuada de qual numero? ')) if n <= 0: break for c in range(1, 11): print(f'\x1b[1;31m{n}\x1b[m x \x1b[1;32m{c}\x1b[m = \x1b[1;33m{n * c}\x1b[m') print('Fim do progama, obrigado por utilizar!')
def Dragon_and_cow(thoughts, eyes, eye, tongue): return f""" {thoughts} ^ /^ {thoughts} / \\ // \\ {thoughts} |\\___/| / \\// .\\ {thoughts}"""+""" /O O \\__ / // ...
def dragon_and_cow(thoughts, eyes, eye, tongue): return f'\n {thoughts} ^ /^\n {thoughts} / \\ // \\\n {thoughts} |\\___/| / \\// .\\\n {thoughts}' + ' /O O \\__ / /...
#!/usr/bin/env python #conding:utf-8 print('Hello world')
print('Hello world')
"""This problem was asked by Netflix. Given a sorted list of integers of length N, determine if an element x is in the list without performing any multiplication, division, or bit-shift operations. Do this in O(log N) time """
"""This problem was asked by Netflix. Given a sorted list of integers of length N, determine if an element x is in the list without performing any multiplication, division, or bit-shift operations. Do this in O(log N) time """
__author__ = 'Dani' class Deal(object): #Negotiation status INTENDED = "Intended" CONCLUDED = "Concluded" FAILED = "Failed" #Sectors AGRICULTURE = "Agriculture" CONSERVATION = "Conservation" FORESTRY = "Forestry" INDUSTRY = "Industry" RENEWABLE_ENERGY = "RenewableEnergy" ...
__author__ = 'Dani' class Deal(object): intended = 'Intended' concluded = 'Concluded' failed = 'Failed' agriculture = 'Agriculture' conservation = 'Conservation' forestry = 'Forestry' industry = 'Industry' renewable_energy = 'RenewableEnergy' tourism = 'Tourism' other = 'Other' ...
list_number = [386, 462, 47, 418, 907, 344, 236, 375, 823, 566, 597, 978, 328, 615, 953, 345, 399, 162, 758, 219, 918, 237, 412, 566, 826, 248, 866, 950, 626, 949, 687, 217, 815, 67, 104, 58, 512, 24, 892, 894, 767, 553, 81, 379, 843, 831, 445, 742, 717, 958, 743, 527] for ...
list_number = [386, 462, 47, 418, 907, 344, 236, 375, 823, 566, 597, 978, 328, 615, 953, 345, 399, 162, 758, 219, 918, 237, 412, 566, 826, 248, 866, 950, 626, 949, 687, 217, 815, 67, 104, 58, 512, 24, 892, 894, 767, 553, 81, 379, 843, 831, 445, 742, 717, 958, 743, 527] for number in list_number: if number == 237: ...
# -*- coding: utf-8 -*- """ Created on Sat Jun 19 00:31:06 2021 @author: Benjamin """ class Abis(object): def __init__(self): self.test = 'sksisj' print("Instantiate class A") def printA(self): print("AAAAAAAAAAAAAA")
""" Created on Sat Jun 19 00:31:06 2021 @author: Benjamin """ class Abis(object): def __init__(self): self.test = 'sksisj' print('Instantiate class A') def print_a(self): print('AAAAAAAAAAAAAA')
class UserModel(Tower): @model_property def inference(self): assert self.input_shape[0]==224, 'Input shape should be 224 pixels' assert self.input_shape[1]==224, 'Input shape should be 224 pixels' # Create some wrappers for simplicity def conv2d(x, W, b, s, padding='SAME'): ...
class Usermodel(Tower): @model_property def inference(self): assert self.input_shape[0] == 224, 'Input shape should be 224 pixels' assert self.input_shape[1] == 224, 'Input shape should be 224 pixels' def conv2d(x, W, b, s, padding='SAME'): x = tf.nn.conv2d(x, W, strides=[1...
job_freqs = { "clk": 286, "lab": 269, "stenog": 68, "salesman": 66, "machinist": 58, "carp": 57, "teamster": 57, "mngr": 43, "bkpr": 34, "engineer": 32, "driver": 32, "painter": 31, "grocer": 31, "pres": 30, "foreman": 29, "teacher": 27, "sec": 26, ...
job_freqs = {'clk': 286, 'lab': 269, 'stenog': 68, 'salesman': 66, 'machinist': 58, 'carp': 57, 'teamster': 57, 'mngr': 43, 'bkpr': 34, 'engineer': 32, 'driver': 32, 'painter': 31, 'grocer': 31, 'pres': 30, 'foreman': 29, 'teacher': 27, 'sec': 26, 'tailor': 24, 'opr': 22, 'cash': 20, 'police': 19, 'electrician': 19, 'a...
result = [] for x in range(1, 201): if x % 5 == 0 and x % 7 == 0: result.append(x) print(result)
result = [] for x in range(1, 201): if x % 5 == 0 and x % 7 == 0: result.append(x) print(result)
"""solved, easy""" class Solution: def sortArrayByParityII(self, A): """ :type A: List[int] :rtype: List[int] """ mid = len(A) // 2 A.sort(key=lambda x: x % 2) return [item for sub in zip(A[:mid], A[mid:]) for item in sub] if __name__ == "__main__": ass...
"""solved, easy""" class Solution: def sort_array_by_parity_ii(self, A): """ :type A: List[int] :rtype: List[int] """ mid = len(A) // 2 A.sort(key=lambda x: x % 2) return [item for sub in zip(A[:mid], A[mid:]) for item in sub] if __name__ == '__main__': ...
# class Solution: # def findRestaurant(self, list1: List[str], list2: List[str]) -> List[str]: # # build lookup table # tb1 = {v:i for i,v in enumerate(list1)} # tb2 = {v:i for i,v in enumerate(list2)} # # traverse list1 # leastSum = len(list1) + len(list2) - 2 # ...
class Solution: def find_restaurant(self, list1: List[str], list2: List[str]) -> List[str]: tb1 = {v: i for (i, v) in enumerate(list1)} least_sum = len(list1) + len(list2) - 2 output = [] for (i, v) in enumerate(list2): if v in tb1: if tb1[v] + i < leastS...
""" Calm-DSL constants """ class CACHE: """Cache constants""" class ENTITY: AHV_SUBNET = "ahv_subnet" AHV_DISK_IMAGE = "ahv_disk_image" ACCOUNT = "account" PROJECT = "project" USER = "user" ROLE = "role" DIRECTORY_SERVICE = "directory_service" ...
""" Calm-DSL constants """ class Cache: """Cache constants""" class Entity: ahv_subnet = 'ahv_subnet' ahv_disk_image = 'ahv_disk_image' account = 'account' project = 'project' user = 'user' role = 'role' directory_service = 'directory_service' ...
# -*- coding: utf-8 -*- """ Created on Sun Jan 23 10:38:08 2022 @author: danie """ common = '''{ return ( <div> <header>navbar</header> <main>page content</main> <footer>footer</footer> </div> ); }; ''' def get_template(file_name): template = f'export interface {file_name}Props' template += '...
""" Created on Sun Jan 23 10:38:08 2022 @author: danie """ common = '{\n\treturn (\n\t\t<div>\n\t\t\t<header>navbar</header>\n\t\t\t<main>page content</main>\n\t\t\t<footer>footer</footer>\n\t\t</div>\n\t);\n};\n\n' def get_template(file_name): template = f'export interface {file_name}Props' template += ' {}\...
''' This example shows how to colorize atoms based on their position (x, y, or z) see: https://documentation.samson-connect.net/scripting-guide/colorization/ Open any molecule in SAMSON ''' class HaltException(Exception): pass indexer = SAMSON.getNodes('n.t atom') # get all atom nodes if indexer....
""" This example shows how to colorize atoms based on their position (x, y, or z) see: https://documentation.samson-connect.net/scripting-guide/colorization/ Open any molecule in SAMSON """ class Haltexception(Exception): pass indexer = SAMSON.getNodes('n.t atom') if indexer.size == 0: halt_exception('No ato...
# Angelas solution print("Welcome to the tip calculator!") total = float(input("What was the total bill? $")) tip = int(input("How much tip would you like to give? 10, 12, or 15? ")) people = int(input("How many people to split the bill? ")) tip_calculation = tip / 100 * total + total split_total = tip_calculation / ...
print('Welcome to the tip calculator!') total = float(input('What was the total bill? $')) tip = int(input('How much tip would you like to give? 10, 12, or 15? ')) people = int(input('How many people to split the bill? ')) tip_calculation = tip / 100 * total + total split_total = tip_calculation / people rounded = roun...
__all__ = ["ActorDeadError", "Timeout"] class ActorDeadError(Exception): """Exception raised when trying to use a dead or unavailable actor.""" pass class Timeout(Exception): """Exception raised at future timeout.""" pass
__all__ = ['ActorDeadError', 'Timeout'] class Actordeaderror(Exception): """Exception raised when trying to use a dead or unavailable actor.""" pass class Timeout(Exception): """Exception raised at future timeout.""" pass
class BranchAgent(object): """Branch Agent class for LTD""" def __init__(self, mirror, area, newBranch): # mirror Reference self.mirror = mirror self.Area = area self.Ck = str(newBranch.Ck) # string self.Id = self.Ck # used in __repr__ self.ScanBus = int(newBranc...
class Branchagent(object): """Branch Agent class for LTD""" def __init__(self, mirror, area, newBranch): self.mirror = mirror self.Area = area self.Ck = str(newBranch.Ck) self.Id = self.Ck self.ScanBus = int(newBranch.GetScanBusIndex()) self.Sec = int(newBranch.G...
# -*- coding: utf-8 -*- ''' File name: code\gathering_the_beans\sol_335.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x ''' # Solution to Project Euler Problem #335 :: Gathering the beans # # For more information see: # https://projecteuler.net/problem=335 # Problem Statement ...
""" File name: code\\gathering_the_beans\\sol_335.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x """ '\nWhenever Peter feels bored, he places some bowls, containing one bean each, in a circle. After this, he takes all the beans out of a certain bowl and drops them one by one in t...
""" Replacement for the scikit-learn single channel pipeline. """ __all__ = ['Pipeline'] class Pipeline(Clonable, Saveable): pass
""" Replacement for the scikit-learn single channel pipeline. """ __all__ = ['Pipeline'] class Pipeline(Clonable, Saveable): pass
# -*- coding: utf-8 -*- """ Incident Reporting System - Controllers @author: Sahana Taiwan Team """ module = request.controller if module not in deployment_settings.modules: session.error = T("Module disabled!") redirect(URL(r=request, c="default", f="index")) # Options Menu (available in all Function...
""" Incident Reporting System - Controllers @author: Sahana Taiwan Team """ module = request.controller if module not in deployment_settings.modules: session.error = t('Module disabled!') redirect(url(r=request, c='default', f='index')) response.menu_options = [[t('Incident Reports'), False, url(r=request...