content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def swap(array, i, j): temp = array[i] array[i] = array[j] array[j] = temp def bubble_sort(array): for i in range(len(array)): for j in range(len(array)-1, i, -1): if array[j-1] > array[j]: swap(array, j-1, j) return array if __name__ == "__main__": print(bubble_sort([5,4,8,10,6,3,2,1]))
def swap(array, i, j): temp = array[i] array[i] = array[j] array[j] = temp def bubble_sort(array): for i in range(len(array)): for j in range(len(array) - 1, i, -1): if array[j - 1] > array[j]: swap(array, j - 1, j) return array if __name__ == '__main__': pri...
""" Sample Python File with No PEP8 Errors. Used for testing the pep8.Tool """ def does_something(thing): """Do a thing and then return.""" return thing.buzz()
""" Sample Python File with No PEP8 Errors. Used for testing the pep8.Tool """ def does_something(thing): """Do a thing and then return.""" return thing.buzz()
__packagename__ = "sira" __description__ = "Systemic Infrastructure Resilience Analysis" __url__ = "https://github.com/GeoscienceAustralia/sira" __version__ = "0.1.0" __author__ = "Geoscience Australia" __email__ = "maruf.rahman@ga.gov.au" __license__ = "Apache License, Version 2.0" __copyright__ = "2020 %s" % __aut...
__packagename__ = 'sira' __description__ = 'Systemic Infrastructure Resilience Analysis' __url__ = 'https://github.com/GeoscienceAustralia/sira' __version__ = '0.1.0' __author__ = 'Geoscience Australia' __email__ = 'maruf.rahman@ga.gov.au' __license__ = 'Apache License, Version 2.0' __copyright__ = '2020 %s' % __author...
def singleton(clazz): assert clazz assert type(clazz) == type clazz.instance = clazz() clazz.INSTANCE = clazz.instance return clazz #
def singleton(clazz): assert clazz assert type(clazz) == type clazz.instance = clazz() clazz.INSTANCE = clazz.instance return clazz
class StartupPlugin: pass class EventHandlerPlugin: pass class TemplatePlugin: pass class SettingsPlugin: pass class SimpleApiPlugin: pass class AssetPlugin: pass
class Startupplugin: pass class Eventhandlerplugin: pass class Templateplugin: pass class Settingsplugin: pass class Simpleapiplugin: pass class Assetplugin: pass
""" # Example: not:10 # Table definition, arity 1. 1=not 0 # Assertion (as documentation/check) 0=not 1 and:0001 # Table definition, arity 2. 0=and 0 0 0=and 0 1 0=and 1 0 1=and 1 1 or:0111 0=or 0 0 1=or 0 1 1=or 1 0 1=or 1 1 mux:00110101 # Table definition, arity 3. t<and 0 0 # Assignm...
""" # Example: not:10 # Table definition, arity 1. 1=not 0 # Assertion (as documentation/check) 0=not 1 and:0001 # Table definition, arity 2. 0=and 0 0 0=and 0 1 0=and 1 0 1=and 1 1 or:0111 0=or 0 0 1=or 0 1 1=or 1 0 1=or 1 1 mux:00110101 # Table definition, arity 3. t<and 0 0 # Assignm...
#!/usr/bin/env python3 -tt print(2+3) print("hello") print("after commit")
print(2 + 3) print('hello') print('after commit')
#start reading file with datarefs file = open("datarefex.txt") line = file.read().replace("\n", "\n") print(len(line)) #end reading file with datarefs #convert into proper amount of parts separated_string = line.splitlines() print(len(separated_string)) #end string2 = '"' string ='": { "prefix": "' strin...
file = open('datarefex.txt') line = file.read().replace('\n', '\n') print(len(line)) separated_string = line.splitlines() print(len(separated_string)) string2 = '"' string = '": { "prefix": "' string4 = '", "body": [ "' string3 = '" ], "description": "WIP" },' my_new_list = [string2 + x + string + x + string4 + x + str...
#!/usr/bin/python class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def addTwoNumbers(self, l1, l2): carry = 0 ret = ListNode(0) curr = ret while l1 != None or l2 != None or carry != 0: if l1 == None...
class Listnode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def add_two_numbers(self, l1, l2): carry = 0 ret = list_node(0) curr = ret while l1 != None or l2 != None or carry != 0: if l1 == None and l2 == Non...
""" 47 / 47 test cases passed. Runtime: 36 ms Memory Usage: 15 MB """ class Solution: def deleteAndEarn(self, nums: List[int]) -> int: freq = [0] * (max(nums) + 1) for num in nums: freq[num] += num last, curr = 0, 0 for cnt in freq: last, curr = curr, max(curr...
""" 47 / 47 test cases passed. Runtime: 36 ms Memory Usage: 15 MB """ class Solution: def delete_and_earn(self, nums: List[int]) -> int: freq = [0] * (max(nums) + 1) for num in nums: freq[num] += num (last, curr) = (0, 0) for cnt in freq: (last, curr) = (cur...
#program to convert a byte string to a list of integers. word = b'Darlington' print() print(list(word)) print() # the reverse operation n = [68,97,114] print(bytes(n))
word = b'Darlington' print() print(list(word)) print() n = [68, 97, 114] print(bytes(n))
class Solution: def addBinary(self, a: str, b: str) -> str: a = int(a, 2) b = int(b, 2) result = a + b result = bin(result) return (result[2:])
class Solution: def add_binary(self, a: str, b: str) -> str: a = int(a, 2) b = int(b, 2) result = a + b result = bin(result) return result[2:]
# ------------------------------------------------------------------------------------ # Tutorial on f-strings # Using f-strings is a simple and fast method for String formatting # ------------------------------------------------------------------------------------ # # Syntax of f-strings: # We start the string with ...
name = 'John' age = 17 print(f'I am {name} and I am {age} years old') name = 'John' age = 32 occupation = 'Web developer' msg = f'Name: {name}\nAge: {age}\nOccupation: {occupation}' print(msg) msg_two = f'\nName: {name}\nAge: {age}\nOccupation: {occupation}\n' print(msg_two)
a=[1,4,5, 67,6] print(a) print(a[3]) print("The index 0 element before changing ", a[0]) a[0]= 7 print("The index 0 element after changing ", a[0]) print(a) # we can create a list with diff data types b=[4,"dishant" , False, 8.7] print(b) # LIST SLICING names=["harry", "dishant", "kanta", 45] print(names[0:2]) ...
a = [1, 4, 5, 67, 6] print(a) print(a[3]) print('The index 0 element before changing ', a[0]) a[0] = 7 print('The index 0 element after changing ', a[0]) print(a) b = [4, 'dishant', False, 8.7] print(b) names = ['harry', 'dishant', 'kanta', 45] print(names[0:2]) print(names[-4:-1]) print(names[4:0:-1]) print(names[4::-...
programs = {} test_amount = 2000 def create_entry(string): number, connections = string.split(" <-> ") number = int(number) connections = list(map(int, connections.split(", "))) programs[number] = [None, connections] def get_group_mem(group): programs[group][0] = group for x in range(0, test_a...
programs = {} test_amount = 2000 def create_entry(string): (number, connections) = string.split(' <-> ') number = int(number) connections = list(map(int, connections.split(', '))) programs[number] = [None, connections] def get_group_mem(group): programs[group][0] = group for x in range(0, test...
""" ========= cysofa ========= Utilities and Python wrappers for sofa module """ __version__ = '0.1'
""" ========= cysofa ========= Utilities and Python wrappers for sofa module """ __version__ = '0.1'
#Dado un string, escribir una funcion que cambie todos los espacios por guiones. string='Hola Mundo hola mundo HOLA MUNDO Hola Mundo hola mundo HOLA MUNDO Hola Mundo hola mundo HOLA MUNDO Hola Mundo hola mundo HOLA MUNDO Hola Mundo hola mundo HOLA MUNDO Hola Mundo hola mundo HOLA MUNDO Hola Mundo hola mundo HOLA MUNDO...
string = 'Hola Mundo hola mundo HOLA MUNDO Hola Mundo hola mundo HOLA MUNDO Hola Mundo hola mundo HOLA MUNDO Hola Mundo hola mundo HOLA MUNDO Hola Mundo hola mundo HOLA MUNDO Hola Mundo hola mundo HOLA MUNDO Hola Mundo hola mundo HOLA MUNDO' mi_string = string.replace(' ', '-') print(mi_string)
class Int64Converter(BaseNumberConverter): """ Provides a type converter to convert 64-bit signed integer objects to and from various other representations. Int64Converter() """
class Int64Converter(BaseNumberConverter): """ Provides a type converter to convert 64-bit signed integer objects to and from various other representations. Int64Converter() """
n=int(input("Enter a Number: ")) p=0 temp=n while(temp > 0): p = p+1 temp = temp // 10 sum=0 temp=n while(temp > 0): rem = temp % 10 sum = sum + (rem**p) temp = temp // 10 if(n==sum): print("Armstrong") else: print("Not Armstrong")
n = int(input('Enter a Number: ')) p = 0 temp = n while temp > 0: p = p + 1 temp = temp // 10 sum = 0 temp = n while temp > 0: rem = temp % 10 sum = sum + rem ** p temp = temp // 10 if n == sum: print('Armstrong') else: print('Not Armstrong')
#!/usr/bin/env python """ @package nilib @file file_store.py @brief Dummy module that indicates that the cache should use all filesystem @brief for both content and metadata. @version $Revision: 1.00 $ $Author: elwynd $ @version Copyright (C) 2012 Trinity College Dublin and Folly Consulting Ltd This is an adjunct...
""" @package nilib @file file_store.py @brief Dummy module that indicates that the cache should use all filesystem @brief for both content and metadata. @version $Revision: 1.00 $ $Author: elwynd $ @version Copyright (C) 2012 Trinity College Dublin and Folly Consulting Ltd This is an adjunct to the NI URI library...
# # Copyright 2020 File Based Test DriverL Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
""" Load dependencies. """ load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') def file_based_test_driver_deps(): """macro to include File Based Test Driver's dependencies in a WORKSPACE. """ if not native.existing_rule('com_google_absl'): http_archive(name='com_google_absl', url='...
# Generated by rpcgen.py at Mon Mar 8 11:09:57 2004 __all__ = ['MNTPATHLEN', 'MNTNAMLEN', 'FHSIZE2', 'FHSIZE3', 'MNT3_OK', 'MNT3ERR_PERM', 'MNT3ERR_NOENT', 'MNT3ERR_IO', 'MNT3ERR_ACCES', 'MNT3ERR_NOTDIR', 'MNT3ERR_INVAL', 'MNT3ERR_NAMETOOLONG', 'MNT3ERR_NOTSUPP', 'MNT3ERR_SERVERFAULT', 'mountstat3_id', 'MOUNTPROC_NUL...
__all__ = ['MNTPATHLEN', 'MNTNAMLEN', 'FHSIZE2', 'FHSIZE3', 'MNT3_OK', 'MNT3ERR_PERM', 'MNT3ERR_NOENT', 'MNT3ERR_IO', 'MNT3ERR_ACCES', 'MNT3ERR_NOTDIR', 'MNT3ERR_INVAL', 'MNT3ERR_NAMETOOLONG', 'MNT3ERR_NOTSUPP', 'MNT3ERR_SERVERFAULT', 'mountstat3_id', 'MOUNTPROC_NULL', 'MOUNTPROC_MNT', 'MOUNTPROC_DUMP', 'MOUNTPROC_UMNT...
for _ in range(int(input())): n = int(input()) s = input() if '.' not in s: print("0") continue if '*' not in s: print("0") continue if s.count('*')==1: print("0") continue count = s.count('*') if count%2==0: mid = count//2 else: ...
for _ in range(int(input())): n = int(input()) s = input() if '.' not in s: print('0') continue if '*' not in s: print('0') continue if s.count('*') == 1: print('0') continue count = s.count('*') if count % 2 == 0: mid = count // 2 ...
""" Copyright (C) 2020 Argonne, Hariharan Devarajan <hdevarajan@anl.gov> This file is part of DLProfile DLIO is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the published by the Free Softw...
""" Copyright (C) 2020 Argonne, Hariharan Devarajan <hdevarajan@anl.gov> This file is part of DLProfile DLIO is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the published by the Free Softw...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"StopExecution": "00_core.ipynb", "skip": "00_core.ipynb", "run_all": "00_core.ipynb", "set_google_application_credentials": "00_core.ipynb", "PROJECT_ID": "01_constants.ip...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'StopExecution': '00_core.ipynb', 'skip': '00_core.ipynb', 'run_all': '00_core.ipynb', 'set_google_application_credentials': '00_core.ipynb', 'PROJECT_ID': '01_constants.ipynb', 'LOCATION': '01_constants.ipynb', 'SERVICE_ACCOUNT_KEY_FILE_NAME': '01_...
if __name__ == '__main__': n = int(input()) result = [] for _ in range(n): operator, *operands = input().split() operands = [int(x) for x in operands] if (operator == 'insert'): result.insert(operands[0], operands[1]) elif (operator == 'remove'): resul...
if __name__ == '__main__': n = int(input()) result = [] for _ in range(n): (operator, *operands) = input().split() operands = [int(x) for x in operands] if operator == 'insert': result.insert(operands[0], operands[1]) elif operator == 'remove': result....
"""A dummy test.""" def test_remove() -> None: """A dummy test.""" assert True
"""A dummy test.""" def test_remove() -> None: """A dummy test.""" assert True
class NumberPowerTwo: """Class to implement an iterator of powers of two """ def __init__(self, max=0): self.max = max def __iter__(self): self.n = 0 return self def __next__(self): if self.n <= self.max: result = 2 ** self.n self.n += 1 ...
class Numberpowertwo: """Class to implement an iterator of powers of two """ def __init__(self, max=0): self.max = max def __iter__(self): self.n = 0 return self def __next__(self): if self.n <= self.max: result = 2 ** self.n self.n += 1 ...
class PointCloudObject(RhinoObject): # no doc def DuplicatePointCloudGeometry(self): """ DuplicatePointCloudGeometry(self: PointCloudObject) -> PointCloud """ pass PointCloudGeometry = property( lambda self: object(), lambda self, v: None, lambda self: None ) """Get...
class Pointcloudobject(RhinoObject): def duplicate_point_cloud_geometry(self): """ DuplicatePointCloudGeometry(self: PointCloudObject) -> PointCloud """ pass point_cloud_geometry = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Get: PointCloudGeometry(self: PointC...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- cornerBuffer = [] cornerSequence = [] class Corner: cornerCount = 0 cornerIndex = [] cornerColor = [] def solveCorner(self,sides,cornerPriority): cornerGoal = (sides['U'][0]=='U' and sides['U'][2]=='U' and sides['U'][6...
corner_buffer = [] corner_sequence = [] class Corner: corner_count = 0 corner_index = [] corner_color = [] def solve_corner(self, sides, cornerPriority): corner_goal = sides['U'][0] == 'U' and sides['U'][2] == 'U' and (sides['U'][6] == 'U') and (sides['U'][8] == 'U') and (sides['F'][0] == 'F')...
# ======================== # Information # ======================== # Direct Link: https://www.hackerrank.com/challenges/30-scope/problem # Difficulty: Easy # Max Score: 30 # Language: Python # ======================== # Solution # ======================== class Difference: def __init__(self, a): ...
class Difference: def __init__(self, a): self.__elements = a self.maximumDifference = 0 def compute_difference(self): l = len(a) for i in range(0, l): for j in range(i + 1, l): difference = abs(a[i] - a[j]) self.maximumDifference = ma...
class Solution: def numsSameConsecDiff(self, N: int, K: int) -> List[int]: ans = [i for i in range(1, 10)] if N == 1: return [0] + ans digits = 10 ** (N-1) while ans[0] / digits < 1: cur = ans.pop(0) last_digit = cur % 10 if K == 0: ...
class Solution: def nums_same_consec_diff(self, N: int, K: int) -> List[int]: ans = [i for i in range(1, 10)] if N == 1: return [0] + ans digits = 10 ** (N - 1) while ans[0] / digits < 1: cur = ans.pop(0) last_digit = cur % 10 if K == ...
class Body: supported_characteristics = ['m', 'mass', 'J', 'inertia'] def __init__(self, options): for key in options.keys(): if key in Body.supported_characteristics: val = options[key] if key in ['m', 'mass']: ...
class Body: supported_characteristics = ['m', 'mass', 'J', 'inertia'] def __init__(self, options): for key in options.keys(): if key in Body.supported_characteristics: val = options[key] if key in ['m', 'mass']: self.mass = val ...
#!/usr/bin/env python3 # ## @file # cache_args.py # # Copyright (c) 2020, Intel Corporation. All rights reserved.<BR> # SPDX-License-Identifier: BSD-2-Clause-Patent # ''' Contains the help and description strings for arguments in the cache command meta data. ''' COMMAND_DESCRIPTION = ('Manages local cachin...
""" Contains the help and description strings for arguments in the cache command meta data. """ command_description = 'Manages local caching support for project repos. The goal of this feature is to improve clone performance' command_enable_help = 'Enables caching support on the system.' command_disable_help = 'Disabl...
# Binary Tree: # 1. Every node has at most two children. # 2. Each child node is labeled as being either a left child or a right child. # 3. A left child precedes a right child in the order of children of a node. # proper binary tree: each node has two or zero child. class Tree: """ Abstract base class representin...
class Tree: """ Abstract base class representing a tree structure. """ class Position: """An abstraction representing the location of a single element.""" def element(self): """ Return the element stored at this Position. """ raise NotImplementedError def __eq_...
class Building(object): lock = MetalKey() def unlock(self): self.lock.attempt_unlock() class KeyCardMixin(object): lock = KeyCard() class ExcellaHQ(KeyCardMixin, Building): pass
class Building(object): lock = metal_key() def unlock(self): self.lock.attempt_unlock() class Keycardmixin(object): lock = key_card() class Excellahq(KeyCardMixin, Building): pass
def fibonacci(n): if n == 0: return 0 elif n==1: return 1 else: return fibonacci(n-1) + fibonacci(n-2) def test(): for i in range(15): print("fib[" + str(i) + "]: " + str(fibonacci(i))) test()
def fibonacci(n): if n == 0: return 0 elif n == 1: return 1 else: return fibonacci(n - 1) + fibonacci(n - 2) def test(): for i in range(15): print('fib[' + str(i) + ']: ' + str(fibonacci(i))) test()
instruct = [] # keeps the splitted version of the instructions filename = input("Enter the filename: ") # gets the filename as the input print("Reading...") with open(filename) as f: # goes through the file line by line, and splits each line from the spaces, and adds them into instruct list for line in f: ...
instruct = [] filename = input('Enter the filename: ') print('Reading...') with open(filename) as f: for line in f: instruct.append(line.split(' ')) f.close() for x in range(len(instruct)): instruct[x][1] = instruct[x][1].split(',') for x in range(len(instruct)): for t in range(len(instruct[x][1])):...
"""A collection of definitions for generated benchmark scenarios. Each generated scenario is defined by the a number of parameters that control the size of the problem (see scenario.generator for more info): There are also some parameters, where default values are used for all scenarios, see DEFAULTS dict. """ # gen...
"""A collection of definitions for generated benchmark scenarios. Each generated scenario is defined by the a number of parameters that control the size of the problem (see scenario.generator for more info): There are also some parameters, where default values are used for all scenarios, see DEFAULTS dict. """ defaul...
# # PySNMP MIB module RBN-ALARM-EXT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RBN-ALARM-EXT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:43:53 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(alarm_clear_date_and_time, alarm_model_entry, alarm_list_name, alarm_clear_index) = mibBuilder.importSymbols('ALARM-MIB', 'alarmClearDateAndTime', 'alarmModelEntry', 'alarmListName', 'alarmClearIndex') (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Int...
"""``utils`` module of ``dataql``. Provide some simple utilities. """ def class_repr(value): """Returns a representation of the value class. Arguments --------- value A class or a class instance Returns ------- str The "module.name" representation of the value class. ...
"""``utils`` module of ``dataql``. Provide some simple utilities. """ def class_repr(value): """Returns a representation of the value class. Arguments --------- value A class or a class instance Returns ------- str The "module.name" representation of the value class. ...
#! /usr/bin/env python class StateUpdate: def __init__( self, position_update=None, phase_update=None, phase_level_update=None, small_phase_update=None, phase_correction_update=None, velocity_update=None, orientation_update=None, angular_spee...
class Stateupdate: def __init__(self, position_update=None, phase_update=None, phase_level_update=None, small_phase_update=None, phase_correction_update=None, velocity_update=None, orientation_update=None, angular_speed_update=None, teleop_update=None): self.position_update = position_update self.p...
#!/usr/bin/env python3 def ntchange( variant_frame ): GC2CG = [] GC2TA = [] GC2AT = [] TA2AT = [] TA2GC = [] TA2CG = [] for ref, alt in zip(variant_frame['REF'], variant_frame['ALT']): ref = ref.upper() alt = alt.upper() if (ref == 'G' an...
def ntchange(variant_frame): gc2_cg = [] gc2_ta = [] gc2_at = [] ta2_at = [] ta2_gc = [] ta2_cg = [] for (ref, alt) in zip(variant_frame['REF'], variant_frame['ALT']): ref = ref.upper() alt = alt.upper() if ref == 'G' and alt == 'C' or (ref == 'C' and alt == 'G'): ...
roster = (('ipns adrres one', 'Name one'), ('ipns adrres two', 'Name two'), ('etc', 'etc'))
roster = (('ipns adrres one', 'Name one'), ('ipns adrres two', 'Name two'), ('etc', 'etc'))
class Config(object): pass class ProdConfig(Config): DEBUG = False SQLALCHEMY_DATABASE_URI = ( "postgresql+psycopg2://test:password@postgres:5432/mex_polit_db" ) SQLALCHEMY_TRACK_MODIFICATIONS = False class DevConfig(Config): DEBUG = True SQLALCHEMY_DATABASE_URI = ( "post...
class Config(object): pass class Prodconfig(Config): debug = False sqlalchemy_database_uri = 'postgresql+psycopg2://test:password@postgres:5432/mex_polit_db' sqlalchemy_track_modifications = False class Devconfig(Config): debug = True sqlalchemy_database_uri = 'postgresql+psycopg2://test:passw...
def test_construction(sm_config): assert True is sm_config.debug viewservice_config = sm_config.serviceconfigs['viewservice'] assert 99 == viewservice_config.flag
def test_construction(sm_config): assert True is sm_config.debug viewservice_config = sm_config.serviceconfigs['viewservice'] assert 99 == viewservice_config.flag
# Module is an abstraction of a candle, which is the data structure returned when requesting price history # data from the API. It also contains methods for analysis. class Candle(object): def __init__(self, json): self.openPrice = json['open'] self.closePrice = json['close'] self.lowPrice = json['low'] se...
class Candle(object): def __init__(self, json): self.openPrice = json['open'] self.closePrice = json['close'] self.lowPrice = json['low'] self.highPrice = json['high'] self.volume = json['volume'] self.datetime = json['datetime'] def print_attributes(self): ...
# deliberatly not in file_dep, so a change to sizes doesn't force rerenders def get_map_size(obj_name): map_size = 512 # maybe let a custom attr raise this sometimes, or determine it from obj size? if obj_name.startswith('gnd.'): if obj_name != 'gnd.023': return None, None map_...
def get_map_size(obj_name): map_size = 512 if obj_name.startswith('gnd.'): if obj_name != 'gnd.023': return (None, None) map_size = 2048 if obj_name in ['building_022.outer.003']: map_size = 2048 if obj_name.startswith('leaf.'): return (None, None) return ...
def find2020(list): for i in range(0, len(list)): for j in range(i+1, len(list)): for k in range(j+1, len(list)): if list[i] + list[j] + list[k] == 2020: print(list[i] * list[j] * list[k]) if __name__ == '__main__': with open("test2.txt") as file: ...
def find2020(list): for i in range(0, len(list)): for j in range(i + 1, len(list)): for k in range(j + 1, len(list)): if list[i] + list[j] + list[k] == 2020: print(list[i] * list[j] * list[k]) if __name__ == '__main__': with open('test2.txt') as file: ...
class MyHashMap: def eval_hash(self, key): return ((key*1031237) & (1<<20) - 1)>>5 def __init__(self): self.arr = [[] for _ in range(1<<15)] def put(self, key, value): t = self.eval_hash(key) for i,(k,v) in enumerate(self.arr[t]): if k == key: ...
class Myhashmap: def eval_hash(self, key): return (key * 1031237 & (1 << 20) - 1) >> 5 def __init__(self): self.arr = [[] for _ in range(1 << 15)] def put(self, key, value): t = self.eval_hash(key) for (i, (k, v)) in enumerate(self.arr[t]): if k == key: ...
numWords = 2 mostCommonWords = ["the","of","to","and","a","in","is","it","you","that"] def addWord(d,group,word): if d.get(group) == None: d[group] = {word : 1} else: if d[group].get(word) == None: d[group][word] = 1 else: d[group][word] = d[group][word] + 1 def...
num_words = 2 most_common_words = ['the', 'of', 'to', 'and', 'a', 'in', 'is', 'it', 'you', 'that'] def add_word(d, group, word): if d.get(group) == None: d[group] = {word: 1} elif d[group].get(word) == None: d[group][word] = 1 else: d[group][word] = d[group][word] + 1 def make_opti...
# -*- encoding: utf-8 -*- class Scene: """ Represents an abstract scene of the game. A scene is a visible part of the game, like a loading screen or an option menu. For creating a working scene the object should be derived from this class. """ def __init__(self, director): self.di...
class Scene: """ Represents an abstract scene of the game. A scene is a visible part of the game, like a loading screen or an option menu. For creating a working scene the object should be derived from this class. """ def __init__(self, director): self.director = director def l...
""" MembershipTookit.com Downloader v1.0.0 ====================================== Software (C) Copyright 2019 Gideon Tong All rights reserved. This piece of software is available to use as "free as in beer", but is not for redistribution, resell, remixing, reusing, or any other type of use other than for personal use...
""" MembershipTookit.com Downloader v1.0.0 ====================================== Software (C) Copyright 2019 Gideon Tong All rights reserved. This piece of software is available to use as "free as in beer", but is not for redistribution, resell, remixing, reusing, or any other type of use other than for personal use...
# Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. # SPDX-License-Identifier: Apache-2.0 load( "@daml//bazel_tools/client_server:client_server_test.bzl", "client_server_test", ) load("//bazel_tools:versions.bzl", "version_to_name", "versions") def daml_script_dar...
load('@daml//bazel_tools/client_server:client_server_test.bzl', 'client_server_test') load('//bazel_tools:versions.bzl', 'version_to_name', 'versions') def daml_script_dar(sdk_version): daml = '@daml-sdk-{sdk_version}//:daml'.format(sdk_version=sdk_version) native.genrule(name='script-example-dar-{sdk_version}...
# An integer has sequential digits # if and only if each digit in the number is one more than the previous digit. # Return a sorted list of all the integers in the range [low, high] inclusive that have sequential digits. # Example 1: # Input: low = 100, high = 300 # Output: [123,234] # Example 2: # Input: low = 1000...
class Solution: def sequential_digits(self, low: int, high: int) -> List[int]: res = [] for i in range(1, 10): num = i for j in range(i + 1, 10): num = num * 10 + j if low <= num <= high: res.append(num) return sort...
#!/usr/bin/python3 with open('05_input', 'r') as f: lines = f.readlines() lines = [r.strip() for r in lines] def get_seat_id(code): row_str = code[0:7] col_str = code[7:10] row_num = row_str.replace('F','0').replace('B','1') col_num = col_str.replace('L','0').replace('R','1') row = int(row_nu...
with open('05_input', 'r') as f: lines = f.readlines() lines = [r.strip() for r in lines] def get_seat_id(code): row_str = code[0:7] col_str = code[7:10] row_num = row_str.replace('F', '0').replace('B', '1') col_num = col_str.replace('L', '0').replace('R', '1') row = int(row_num, 2) col = i...
# pseudo code taken from CLRS book def lcs(X, Y): c = {} # c[(i,j)] represents length of lcs of [x0, x1, ... , xi] and [y0, y1, ... , yj] m = len(X) n = len(Y) for i in range(m): c[(i, -1)] = 0 for j in range(n): c[(-1, j)] = 0 for i in range(m): for j in range(n): ...
def lcs(X, Y): c = {} m = len(X) n = len(Y) for i in range(m): c[i, -1] = 0 for j in range(n): c[-1, j] = 0 for i in range(m): for j in range(n): if X[i] == Y[j]: c[i, j] = 1 + c[i - 1, j - 1] elif c[i - 1, j] >= c[i, j - 1]: ...
class TreeNode: def __init__(self, data): self.data = data self.left = None self.right = None def insert(root, node): if root is None: root = node else: if root.data >= node.data: if root.left == None: root.left = node else: ...
class Treenode: def __init__(self, data): self.data = data self.left = None self.right = None def insert(root, node): if root is None: root = node elif root.data >= node.data: if root.left == None: root.left = node else: insert(root.l...
## <hr>Dummy value. # # No texture, but the value to be used as 'texture semantic' # (#aiMaterialProperty::mSemantic) for all material properties # *not* related to textures. # aiTextureType_NONE = 0x0 ## <hr>The texture is combined with the result of the diffuse # lighting equation. # aiTextureType_DIFFUSE = 0x1 ## ...
ai_texture_type_none = 0 ai_texture_type_diffuse = 1 ai_texture_type_specular = 2 ai_texture_type_ambient = 3 ai_texture_type_emissive = 4 ai_texture_type_height = 5 ai_texture_type_normals = 6 ai_texture_type_shininess = 7 ai_texture_type_opacity = 8 ai_texture_type_displacement = 9 ai_texture_type_lightmap = 10 ai_te...
# -*- coding: cp852 -*- #en_EN Locale class language(): VERSION='Version' CREATING_BACKUP='Creating backup' NO_PERM='No Permission' COPYING_FILES='Copying files' COULD_NOT_COPY='Could not copy files' DONE='Done' REWRITING_FLUXION_BASH='Rewriting fluxion bash' RECONFIGURE_FLUXION_BASH='R...
class Language: version = 'Version' creating_backup = 'Creating backup' no_perm = 'No Permission' copying_files = 'Copying files' could_not_copy = 'Could not copy files' done = 'Done' rewriting_fluxion_bash = 'Rewriting fluxion bash' reconfigure_fluxion_bash = 'Reconfiguring fluxion bash...
def sycl_library_path(name): return "lib/lib{}.so".format(name) def readlink_command(): return "readlink"
def sycl_library_path(name): return 'lib/lib{}.so'.format(name) def readlink_command(): return 'readlink'
class Sources: def __init__(self,id,name,description,language): self.id = id self.name = name self.description = description self.language = language class Articles: def __init__(self,author,title,description,url,publishedAt,urlToImage): self.author = author self...
class Sources: def __init__(self, id, name, description, language): self.id = id self.name = name self.description = description self.language = language class Articles: def __init__(self, author, title, description, url, publishedAt, urlToImage): self.author = author ...
num_list = list(map(int, input().split())) high=max(num_list) low=min(num_list) print(low,sum(num_list),high)
num_list = list(map(int, input().split())) high = max(num_list) low = min(num_list) print(low, sum(num_list), high)
def clock_degree(clock_time): hour, minutes = (int(a) for a in clock_time.split(':')) if not (24 > hour >= 0 and 60 > minutes >= 0): return 'Check your time !' return '{}:{}'.format((hour % 12) * 30 or 360, minutes * 6 or 360)
def clock_degree(clock_time): (hour, minutes) = (int(a) for a in clock_time.split(':')) if not (24 > hour >= 0 and 60 > minutes >= 0): return 'Check your time !' return '{}:{}'.format(hour % 12 * 30 or 360, minutes * 6 or 360)
# def quick_sort(the_list): # # left index # l = 0 # # pivot index # p = len(the_list) # # right index # r = pivot - 1 # if l < r: # # increment l till we have an appropriate value # while the_list[l] <= the_list[p] && l < len(the_list): # l += 1 # # d...
def quick_sort(arr, l, r): if l < r: position = partition(arr, l, r) quick_sort(arr, l, position - 1) quick_sort(arr, position + 1, r) def partition(arr, l, r): p = arr[r]
class ProductionConfig(): DEBUG = False MONGODB_HOST = 'localhost' MONGODB_DBNAME = 'their_tweets' MONGODB_SETTINGS = { 'host' : 'localhost', 'DB' : 'new', 'port' : 27017 } SECRET_KEY = 'thisissecret' MULTIPLE_AUTH_HEADERS = ['access_token', 'device'] PORT = 8...
class Productionconfig: debug = False mongodb_host = 'localhost' mongodb_dbname = 'their_tweets' mongodb_settings = {'host': 'localhost', 'DB': 'new', 'port': 27017} secret_key = 'thisissecret' multiple_auth_headers = ['access_token', 'device'] port = 8000 propogate_exceptions = True ...
__author__ = "" __version__ = "0.0.1" __date__ = "" __all__ = ["__author__", "__version__", "__date__"]
__author__ = '' __version__ = '0.0.1' __date__ = '' __all__ = ['__author__', '__version__', '__date__']
class C: def __init__(self, x, y): """ Args: x: y: """ return None
class C: def __init__(self, x, y): """ Args: x: y: """ return None
def analog_state(analog_input): if analog_input.read(): return 'UP' else: return 'DOWN'
def analog_state(analog_input): if analog_input.read(): return 'UP' else: return 'DOWN'
# # -*- coding: utf-8 -*- # # Copyright 2015-2020 NETCAT (www.netcat.pl) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
class Accountstatus: """ Account status """ def __init__(self): self.uid = None self.type = None self.validTo = None self.billingPlanName = None self.subscriptionPrice = None self.itemPrice = None self.itemPriceStatus = None self.itemPrice...
def getRoot(config): if not config.parent: return config return getRoot(config.parent) root = getRoot(config) if 'libdispatch' in root.available_features: additional_cflags = ' -fblocks ' for index, (template, replacement) in enumerate(config.substitutions): if template in ['%clang_tsan ', '%clangxx_t...
def get_root(config): if not config.parent: return config return get_root(config.parent) root = get_root(config) if 'libdispatch' in root.available_features: additional_cflags = ' -fblocks ' for (index, (template, replacement)) in enumerate(config.substitutions): if template in ['%clang_...
user_modelling_units = { 'item_lookup_field': 'userModellingUnitId', 'item_url': 'regex("[\S]+")', 'item_title': 'league_table', 'resource_methods': ['GET', 'POST', 'DELETE'], 'item_methods': ['GET', 'PATCH', 'DELETE'], 'extra_response_fields': ['userModellingUnitId'], 'doc': { ...
user_modelling_units = {'item_lookup_field': 'userModellingUnitId', 'item_url': 'regex("[\\S]+")', 'item_title': 'league_table', 'resource_methods': ['GET', 'POST', 'DELETE'], 'item_methods': ['GET', 'PATCH', 'DELETE'], 'extra_response_fields': ['userModellingUnitId'], 'doc': {'body': '\n <p>user_modelling_u...
""" 0251. Flatten 2D Vector Medium Design and implement an iterator to flatten a 2d vector. It should support the following operations: next and hasNext. Example: Vector2D iterator = new Vector2D([[1,2],[3],[4]]); iterator.next(); // return 1 iterator.next(); // return 2 iterator.next(); // return 3 iterator.has...
""" 0251. Flatten 2D Vector Medium Design and implement an iterator to flatten a 2d vector. It should support the following operations: next and hasNext. Example: Vector2D iterator = new Vector2D([[1,2],[3],[4]]); iterator.next(); // return 1 iterator.next(); // return 2 iterator.next(); // return 3 iterator.has...
""" This file includes the Quip class. Quips are responses given by NPCs, when responding to a DialogEvent. Classes: Quip """ class Quip: """ Attributes: key: str This is the name of the object when referenced internally by the game. text: str The text printed w...
""" This file includes the Quip class. Quips are responses given by NPCs, when responding to a DialogEvent. Classes: Quip """ class Quip: """ Attributes: key: str This is the name of the object when referenced internally by the game. text: str The text printed wh...
class Currency: """ Simple currency domain model, holds value as string """ s: str def __init__(self, currency: str): if currency == "": raise TypeError("currency cannot be empty") self.s = currency def __str__(self): return self.String() def __eq__(se...
class Currency: """ Simple currency domain model, holds value as string """ s: str def __init__(self, currency: str): if currency == '': raise type_error('currency cannot be empty') self.s = currency def __str__(self): return self.String() def __eq__(se...
""" There are n cities. Some of them are connected, while some are not. If city a is connected directly with city b, and city b is connected directly with city c, then city a is connected indirectly with city c. A province is a group of directly or indirectly connected cities and no other cities outside of the group. ...
""" There are n cities. Some of them are connected, while some are not. If city a is connected directly with city b, and city b is connected directly with city c, then city a is connected indirectly with city c. A province is a group of directly or indirectly connected cities and no other cities outside of the group. ...
feature_funcs = set() def feature(func): """ Feature functions take a request as their single argument. """ feature_funcs.add(func) return func @feature def requirejs(request): return 'requirejs' in request.GET @feature def thread_new(request): return True @feature def lazy_content(request): ...
feature_funcs = set() def feature(func): """ Feature functions take a request as their single argument. """ feature_funcs.add(func) return func @feature def requirejs(request): return 'requirejs' in request.GET @feature def thread_new(request): return True @feature def lazy_content(request): ...
UNBOXED_PRIMITIVE_DEFAULT_EMPTY = "__prim_empty_slot" UNBOXED_PRIMITIVE_DEFAULT_ZERO = "__prim_zero_slot" IO_CLASS = "IO" OBJECT_CLASS = "Object" INTEGER_CLASS = "Int" BOOLEAN_CLASS = "Bool" STRING_CLASS = "String" BUILT_IN_CLASSES = [ IO_CLASS, OBJECT_CLASS, INTEGER_CLASS, BOOLEAN_CLASS, STRING_CLAS...
unboxed_primitive_default_empty = '__prim_empty_slot' unboxed_primitive_default_zero = '__prim_zero_slot' io_class = 'IO' object_class = 'Object' integer_class = 'Int' boolean_class = 'Bool' string_class = 'String' built_in_classes = [IO_CLASS, OBJECT_CLASS, INTEGER_CLASS, BOOLEAN_CLASS, STRING_CLASS] void_type = 'Void...
## gera novo arquivo sped a partir do banco de dados def exec(filename,cursor): arquivo = open("out/" + filename + '_r.txt', 'w') for row in cursor.execute('SELECT * FROM principal order by r0'): line = [i for i in row if i is not None] line = '|' + '|'.join(line[1:]) + '|' + '\n' arqu...
def exec(filename, cursor): arquivo = open('out/' + filename + '_r.txt', 'w') for row in cursor.execute('SELECT * FROM principal order by r0'): line = [i for i in row if i is not None] line = '|' + '|'.join(line[1:]) + '|' + '\n' arquivo.write(line) arquivo.close()
def array123(nums): # Note: iterate with length-2, so can use i+1 and i+2 in the loop for i in range(len(nums)-2): if nums[i]==1 and nums[i+1]==2 and nums[i+2]==3: return True return False
def array123(nums): for i in range(len(nums) - 2): if nums[i] == 1 and nums[i + 1] == 2 and (nums[i + 2] == 3): return True return False
class Solution: def findSwapValues(self,a, n, b, m): summA = sum(a) summB = sum(b) diff = (summA - summB) if diff % 2 != 0 : return -1 diff = diff / 2 # We need to find num1 in a and num2 in b such that # summA - num1 + num2 = summB - num2 + num1 ...
class Solution: def find_swap_values(self, a, n, b, m): summ_a = sum(a) summ_b = sum(b) diff = summA - summB if diff % 2 != 0: return -1 diff = diff / 2 i = 0 j = 0 while i < n and j < m: d = a[i] - b[j] if d == dif...
# Copyright (C) 2019 Project AGI # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
"""HParamMulti class.""" class Hparammulti: """ Static helper methods for managing multiple hyperparam objects. The use case is for Components that have sub components. We cannot maintain state, because the flat tf hyperparam object is selectively overridden outside of the component. """ @staticmethod...
_base_ = ['../../_base_/default_runtime.py'] # dataset settings dataset_type = 'MOTChallengeDataset' img_norm_cfg = dict( mean=[0, 0, 0], std=[255, 255, 255], to_rgb=True) train_pipeline = [ dict(type='LoadMultiImagesFromFile', to_float32=True), dict(type='SeqLoadAnnotations', with_bbox=True, with_track=T...
_base_ = ['../../_base_/default_runtime.py'] dataset_type = 'MOTChallengeDataset' img_norm_cfg = dict(mean=[0, 0, 0], std=[255, 255, 255], to_rgb=True) train_pipeline = [dict(type='LoadMultiImagesFromFile', to_float32=True), dict(type='SeqLoadAnnotations', with_bbox=True, with_track=True), dict(type='SeqResize', img_sc...
def calculate_best_trade(prices): # Check if there are less than two prices in the list # If so, the function cannot calculate max profit # Else, there are at least two prices in the list and so run the function if len(prices) < 2: print("List of prices does not have at least two elements! Cann...
def calculate_best_trade(prices): if len(prices) < 2: print('List of prices does not have at least two elements! Cannot run the function.') else: num_shares = 10000 min_price = 0 max_price = 0 for price in prices: if min_price == 0 and max_price == 0: ...
# # PySNMP MIB module Unisphere-Data-SONET-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-SONET-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:25:48 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7....
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, value_size_constraint, constraints_union, single_value_constraint) ...
""" Tools to create and update EMA models. """ def create_ema_model(model): """ Given a newly made network, detach all its parameters so its parameters can serve as the EMA of another model. """ for param in model.parameters(): param.detach_() return model def update_ema_model(model, ema_mo...
""" Tools to create and update EMA models. """ def create_ema_model(model): """ Given a newly made network, detach all its parameters so its parameters can serve as the EMA of another model. """ for param in model.parameters(): param.detach_() return model def update_ema_model(model, ema_mode...
''' It is often convenient to build a large DataFrame by parsing many files as DataFrames and concatenating them all at once. You'll do this here with three files, but, in principle, this approach can be used to combine data from dozens or hundreds of files. Here, you'll work with DataFrames compiled from The Guardian...
""" It is often convenient to build a large DataFrame by parsing many files as DataFrames and concatenating them all at once. You'll do this here with three files, but, in principle, this approach can be used to combine data from dozens or hundreds of files. Here, you'll work with DataFrames compiled from The Guardian...
''' Many-to-many data merge The final merging scenario occurs when both DataFrames do not have unique keys for a merge. What happens here is that for each duplicated key, every pairwise combination will be created. Two example DataFrames that share common key values have been pre-loaded: df1 and df2. Another DataFram...
""" Many-to-many data merge The final merging scenario occurs when both DataFrames do not have unique keys for a merge. What happens here is that for each duplicated key, every pairwise combination will be created. Two example DataFrames that share common key values have been pre-loaded: df1 and df2. Another DataFram...
boxWidth = 50 # Width of square boxes inside grid margin = 15 # Margin around grid border = 2 # grid thickness steps = 11 # no. of loki movement b/w two maze boxes in animation # COLORS grey = (67,67,67) black = (0,0,0) white = (255,255,255) yellow = (50,226,249) red = (1,23,182) green = (0,114,1)
box_width = 50 margin = 15 border = 2 steps = 11 grey = (67, 67, 67) black = (0, 0, 0) white = (255, 255, 255) yellow = (50, 226, 249) red = (1, 23, 182) green = (0, 114, 1)
#!/usr/bin/env python # encoding: utf-8 version_info = (0, 2, 1) version = ".".join(map(str, version_info))
version_info = (0, 2, 1) version = '.'.join(map(str, version_info))
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'Administrator' class Screen(object): @property def width(self): return self._width @width.setter def width(self, value): if not isinstance(value, int): raise ValueError('width must be an integer!') self....
__author__ = 'Administrator' class Screen(object): @property def width(self): return self._width @width.setter def width(self, value): if not isinstance(value, int): raise value_error('width must be an integer!') self._width = value @property def height(se...
liste = list() liste2 = [1,2,3,4]
liste = list() liste2 = [1, 2, 3, 4]
# # Connection Transport # # Exception classes used by this module. class ExceptionPxTransport(ExceptionPexpect): '''Raised for pxtransport exceptions. ''' class pxtransport(object): '''The carrier of the info.''' def __init__(self, hostname=None, info=None): if hostname is None and info is N...
class Exceptionpxtransport(ExceptionPexpect): """Raised for pxtransport exceptions. """ class Pxtransport(object): """The carrier of the info.""" def __init__(self, hostname=None, info=None): if hostname is None and info is None: raise exception_px_transport('insufficient connectio...
while True: nx, ny, w = input().split() nx = int(nx) ny = int(ny) w = float(w) if nx == ny and ny == w and w == 0: break xs = sorted(map(float, input().split())) ys = sorted(map(float, input().split())) xbroke = xs[0] - w / 2 > 0 or xs[-1] + w / 2 < 75 ybroke = ys[0] - w / ...
while True: (nx, ny, w) = input().split() nx = int(nx) ny = int(ny) w = float(w) if nx == ny and ny == w and (w == 0): break xs = sorted(map(float, input().split())) ys = sorted(map(float, input().split())) xbroke = xs[0] - w / 2 > 0 or xs[-1] + w / 2 < 75 ybroke = ys[0] - w ...
class AttachableVolume: """ Base Mixin for requesting extra disk resources to k8s. Sub classes should implement volume_spec specifiying a kubernetes PVC. - size can be set by overriding volume_size_in_gb - mount point can be set by overriding mount_location """ @property def pvc_name(se...
class Attachablevolume: """ Base Mixin for requesting extra disk resources to k8s. Sub classes should implement volume_spec specifiying a kubernetes PVC. - size can be set by overriding volume_size_in_gb - mount point can be set by overriding mount_location """ @property def pvc_name(se...
# -*- coding: utf-8 -*- # For simplicity, these values are shared among both threads and comments. MAX_THREADS = 1000 MAX_NAME = 50 MAX_DESCRIPTION = 3000 MAX_ADMINS = 2 # status DEAD = 0 ALIVE = 1 STATUS = { DEAD: 'dead', ALIVE: 'alive', } BASE_SUBREDDITS = {'biology': ['biochemistry', ...
max_threads = 1000 max_name = 50 max_description = 3000 max_admins = 2 dead = 0 alive = 1 status = {DEAD: 'dead', ALIVE: 'alive'} base_subreddits = {'biology': ['biochemistry', 'bioengineering', 'bioinformatics', 'biophysics', 'evolution', 'genetics', 'genomics', 'molecular_biology', 'systems_biology', 'software'], 'st...
# directory list DATA_DIR = "./plugins/data/" # cv window MAIN_WINDOW_NAME = 'main' MASK_WINDOW_NAME = 'mask' KEY_WAIT_DURATION = 1
data_dir = './plugins/data/' main_window_name = 'main' mask_window_name = 'mask' key_wait_duration = 1
# Copyright 2014 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
def emit_binary(go, name='', source=None, gc_linkopts=[], linkstamp=None, version_file=None, info_file=None): """See go/toolchains.rst#binary for full documentation.""" if name == '': fail('name is a required parameter') archive = go.archive(go, source) executable = go.declare_file(go, name=name...
def split_tag(tag): if tag == 'O': state = 'O' label = None elif tag == '-X-': state = 'O' label = None else: state, label = tag.split('-') return state, label def iob2bio(tags): processed_tags = [] # should be bio format prev_state = None prev...
def split_tag(tag): if tag == 'O': state = 'O' label = None elif tag == '-X-': state = 'O' label = None else: (state, label) = tag.split('-') return (state, label) def iob2bio(tags): processed_tags = [] prev_state = None prev_label = None for (t, ...
class OnTheFarmDivTwo: def animals(self, heads, legs): if legs < 2 * heads or legs > 4 * heads or legs % 2: return tuple() x = (legs - 2 * heads) / 2 return heads - x, x
class Onthefarmdivtwo: def animals(self, heads, legs): if legs < 2 * heads or legs > 4 * heads or legs % 2: return tuple() x = (legs - 2 * heads) / 2 return (heads - x, x)