content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
general_option = ('option MIP = CPLEX;' 'option NLP = IPOPTH;' 'option threads = 1;' 'option optcr = 0.001;' 'option optca = 0.0;' 'GAMS_MODEL.nodLim = 1E8;' 'option domLim = 1E8;' 'option iterL...
general_option = 'option MIP = CPLEX;option NLP = IPOPTH;option threads = 1;option optcr = 0.001;option optca = 0.0;GAMS_MODEL.nodLim = 1E8;option domLim = 1E8;option iterLim = 1E8;option resLim = 900;' gams_optionfile = {'bonminh-B-BB': [general_option + 'GAMS_MODEL.optfile = 1;\n$onecho > bonminh.opt \nbonmin.algorit...
def binary_search(a, val, start, end): mid = (start + end)//2 if start >= end: return val == a[mid] if val == a[mid]: return True elif val < a[mid]: return binary_search(a, val, start, mid - 1) elif val > a[mid]: return binary_search(a, val, mid + 1, end) def main()...
def binary_search(a, val, start, end): mid = (start + end) // 2 if start >= end: return val == a[mid] if val == a[mid]: return True elif val < a[mid]: return binary_search(a, val, start, mid - 1) elif val > a[mid]: return binary_search(a, val, mid + 1, end) def main(...
class HashLinearProbe: def __init__(self): self.hashtable_size = 10 self.hashtable = [0] * self.hashtable_size def hashcode(self, key): return key % self.hashtable_size def lprobe(self, element): i = self.hashcode(element) j = 0 while self.hashtable[(i+j) % ...
class Hashlinearprobe: def __init__(self): self.hashtable_size = 10 self.hashtable = [0] * self.hashtable_size def hashcode(self, key): return key % self.hashtable_size def lprobe(self, element): i = self.hashcode(element) j = 0 while self.hashtable[(i + j)...
noteValues = ['C0', 'Cs0', 'Db0', 'D0', 'Ds0', 'Eb0', 'E0', 'F0', 'Fs0', 'Gb0', 'G0', 'Gs0', 'Ab0', 'A0', 'As0', 'Bb0', 'B0', 'C1', 'Cs1', 'Db1', 'D1', 'Ds1', 'Eb1', 'E1', 'F1', 'Fs1', 'Gb1', 'G1', 'Gs1', 'Ab1', 'A1', 'As1', 'Bb1', 'B1', 'C2', 'Cs2', 'Db2', 'D2'...
note_values = ['C0', 'Cs0', 'Db0', 'D0', 'Ds0', 'Eb0', 'E0', 'F0', 'Fs0', 'Gb0', 'G0', 'Gs0', 'Ab0', 'A0', 'As0', 'Bb0', 'B0', 'C1', 'Cs1', 'Db1', 'D1', 'Ds1', 'Eb1', 'E1', 'F1', 'Fs1', 'Gb1', 'G1', 'Gs1', 'Ab1', 'A1', 'As1', 'Bb1', 'B1', 'C2', 'Cs2', 'Db2', 'D2', 'Ds2', 'Eb2', 'E2', 'F2', 'Fs2', 'Gb2', 'G2', 'Gs2', 'A...
''' Implement int sqrt(int x). Compute and return the square root of x, where x is guaranteed to be a non-negative integer. Since the return type is an integer, the decimal digits are truncated and only the integer part of the result is returned. Example 1: Input: 4 Output: 2 Example 2: Input: 8 Output: 2 Explanatio...
""" Implement int sqrt(int x). Compute and return the square root of x, where x is guaranteed to be a non-negative integer. Since the return type is an integer, the decimal digits are truncated and only the integer part of the result is returned. Example 1: Input: 4 Output: 2 Example 2: Input: 8 Output: 2 Explanatio...
def test_greeter(chain): greeter, _ = chain.provider.get_or_deploy_contract('Greeter') greeting = greeter.call().greet() assert greeting == 'Hello' def test_custom_greeting(chain): greeter, _ = chain.provider.get_or_deploy_contract('Greeter') set_txn_hash = greeter.transact().setGreeting('Guten ...
def test_greeter(chain): (greeter, _) = chain.provider.get_or_deploy_contract('Greeter') greeting = greeter.call().greet() assert greeting == 'Hello' def test_custom_greeting(chain): (greeter, _) = chain.provider.get_or_deploy_contract('Greeter') set_txn_hash = greeter.transact().setGreeting('Guten...
def test_something(setup): assert setup.timecostly == 1 def test_something_more(setup): assert setup.timecostly == 1
def test_something(setup): assert setup.timecostly == 1 def test_something_more(setup): assert setup.timecostly == 1
""" Illustrates various methods of associating multiple types of parents with a particular child object. The examples all use the declarative extension along with declarative mixins. Each one presents the identical use case at the end - two classes, ``Customer`` and ``Supplier``, both subclassing the ``HasAddresse...
""" Illustrates various methods of associating multiple types of parents with a particular child object. The examples all use the declarative extension along with declarative mixins. Each one presents the identical use case at the end - two classes, ``Customer`` and ``Supplier``, both subclassing the ``HasAddresse...
#wapp to find factorial of a number provided by the user num=int(input("enter a number:")) if(num<0): print("enter positive number") elif(num==0): print("ans=",1) else: fact=1 for i in range(1,num+1): fact=fact*i print("ans=",fact)
num = int(input('enter a number:')) if num < 0: print('enter positive number') elif num == 0: print('ans=', 1) else: fact = 1 for i in range(1, num + 1): fact = fact * i print('ans=', fact)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Apr 7 12:46:44 2020 @author: esteban """ pathInformesRegiones='../datos/informes_diarios_regiones/' pathInformesComunas='../datos/informes_diarios_comunas/' formatoArchivoRegiones='-InformeDiarioRegiones-COVID19.csv' formatoArchivoComunas='-InformeDi...
""" Created on Tue Apr 7 12:46:44 2020 @author: esteban """ path_informes_regiones = '../datos/informes_diarios_regiones/' path_informes_comunas = '../datos/informes_diarios_comunas/' formato_archivo_regiones = '-InformeDiarioRegiones-COVID19.csv' formato_archivo_comunas = '-InformeDiarioRegiones-COVID19.csv' url_inf...
''' Tips:1. We don't have to count the lengths of the linked-list. We just need to set the condition of the while loop as (l1 or l2) In the while loop, we need to set the [if l1] and [ if l2] to select that whether the linked-list is vaild or None. 2. We use dummy and set it as the node before th...
""" Tips:1. We don't have to count the lengths of the linked-list. We just need to set the condition of the while loop as (l1 or l2) In the while loop, we need to set the [if l1] and [ if l2] to select that whether the linked-list is vaild or None. 2. We use dummy and set it as the node before th...
def part1(data): coordinateData = {} coordinateData2 = {} coordinates = set() xmin, xmax, ymin, ymax = 1000, 0, 1000, 0 for eachLine in data.splitlines(): splitLine = eachLine.split(', ') coordinates.add((int(splitLine[0]), int(splitLine[1]))) coordinateData[f"{int(splitLine[...
def part1(data): coordinate_data = {} coordinate_data2 = {} coordinates = set() (xmin, xmax, ymin, ymax) = (1000, 0, 1000, 0) for each_line in data.splitlines(): split_line = eachLine.split(', ') coordinates.add((int(splitLine[0]), int(splitLine[1]))) coordinateData[f'{int(sp...
"""Contains material property indices Obtained from: /usr/ansys_inc/v202/ansys/customize/include/mpcom.inc These indices are used when reading in results using ptrMAT from a binary result file. """ # order is critical here mp_keys = ['EX', 'EY', 'EZ', 'NUXY', 'NUYZ', 'NUXZ', 'GXY', 'GYZ', 'GXZ', 'ALPX', ...
"""Contains material property indices Obtained from: /usr/ansys_inc/v202/ansys/customize/include/mpcom.inc These indices are used when reading in results using ptrMAT from a binary result file. """ mp_keys = ['EX', 'EY', 'EZ', 'NUXY', 'NUYZ', 'NUXZ', 'GXY', 'GYZ', 'GXZ', 'ALPX', 'ALPY', 'ALPZ', 'DENS', 'MU', 'DAMP',...
# Copyright (c) 2009 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'includes': [ '../../build/common.gypi', ], 'targets': [ { 'target_name': 'harfbuzz', 'type': '<(library)', 'sources': ...
{'includes': ['../../build/common.gypi'], 'targets': [{'target_name': 'harfbuzz', 'type': '<(library)', 'sources': ['src/harfbuzz-buffer.c', 'src/harfbuzz-stream.c', 'src/harfbuzz-dump.c', 'src/harfbuzz-gdef.c', 'src/harfbuzz-gpos.c', 'src/harfbuzz-gsub.c', 'src/harfbuzz-impl.c', 'src/harfbuzz-open.c', 'src/harfbuzz-sh...
""" https://leetcode.com/problems/combination-sum/ Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target. The same repeated number may be chosen from candidates unlimited number of times. N...
""" https://leetcode.com/problems/combination-sum/ Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target. The same repeated number may be chosen from candidates unlimited number of times. N...
# # Copyright (c) 2020 Idiap Research Institute, http://www.idiap.ch/ # Written by Angelos Katharopoulos <angelos.katharopoulos@idiap.ch> # class Event(object): """The Event is the base class for all events that are dispatched from any transformer module. This class defines only the basic attributes of a...
class Event(object): """The Event is the base class for all events that are dispatched from any transformer module. This class defines only the basic attributes of an event without any payload. Arguments --------- source: torch.nn.Module instance that dispatched this event """ ...
# -*- coding: utf-8 -*- n = float(input()) if (0 <= n <=25): print('Intervalo [0,25]') elif (25 < n <=50): print('Intervalo (25,50]') elif (50 < n <=75): print('Intervalo (50,75]') elif (75 < n <=100): print('Intervalo (75,100]') else: print('Fora de intervalo')
n = float(input()) if 0 <= n <= 25: print('Intervalo [0,25]') elif 25 < n <= 50: print('Intervalo (25,50]') elif 50 < n <= 75: print('Intervalo (50,75]') elif 75 < n <= 100: print('Intervalo (75,100]') else: print('Fora de intervalo')
#!/usr/bin/env python # -*- coding: utf-8 -*- def is_a_invalid_id(feature_id): """ Check if the id of some feature is valid or not. For a id to be valid, it needs to be: (1) not None; (2) a integer (a digit); (3) if is a integer, so different of 0. IDs are integer numbers greater than zero. ...
def is_a_invalid_id(feature_id): """ Check if the id of some feature is valid or not. For a id to be valid, it needs to be: (1) not None; (2) a integer (a digit); (3) if is a integer, so different of 0. IDs are integer numbers greater than zero. :param feature_id: id of a feature in string f...
def get_priorities(client, db_rid=None, priority_name=None, page_size=1000, verbose=False): conditionstring = "" if db_rid: conditionstring = client._add_condition(conditionstring, 'id', db_rid, verbose) if priority_name: conditionstring = client._add_condition(conditionstring, 'name', prio...
def get_priorities(client, db_rid=None, priority_name=None, page_size=1000, verbose=False): conditionstring = '' if db_rid: conditionstring = client._add_condition(conditionstring, 'id', db_rid, verbose) if priority_name: conditionstring = client._add_condition(conditionstring, 'name', prior...
def maior(* num): print('=' * 30) print('Analisando os respectivos valores . . . ') cont = maior = 0 for n in num: print(f'{n} ', end='') if cont == 0: maior = n else: if n > maior: maior = n cont += 1 print(f' Foram digitados {...
def maior(*num): print('=' * 30) print('Analisando os respectivos valores . . . ') cont = maior = 0 for n in num: print(f'{n} ', end='') if cont == 0: maior = n elif n > maior: maior = n cont += 1 print(f' Foram digitados {cont} valores ao todo...
# # Licensed to Big Data Genomics (BDG) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The BDG licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this fil...
chr_prefix = 'chr' def format_contig(contig): """ Returns a formatted tuple of contigs. One has trimmed contig, the other appends a 'chr' prefix. :param contig: contig with or without 'chr' prefix :return: tuple of a trimmed (without 'chr') and full (with 'chr') contig names """ contig_trimmed...
_base_ = [ '../_base_/models/spatialflow_r50_fpn.py', '../_base_/datasets/coco_panoptic.py', '../_base_/schedules/schedule_20e.py', '../_base_/default_runtime.py' ] # optimizer optimizer = dict(type='SGD', lr=0.005, momentum=0.9, weight_decay=0.0001) # panoptic settings segmentations_folder='./work_dirs/spa...
_base_ = ['../_base_/models/spatialflow_r50_fpn.py', '../_base_/datasets/coco_panoptic.py', '../_base_/schedules/schedule_20e.py', '../_base_/default_runtime.py'] optimizer = dict(type='SGD', lr=0.005, momentum=0.9, weight_decay=0.0001) segmentations_folder = './work_dirs/spatialflow_r50_fpn_20e_coco/segmentations_fold...
#!/usr/bin/env python3 # This script is to learn how to manipulate lists my_list = ['192.168.0.5', 5060, 'UP'] print( "THe first item in teh list (IP): " + my_list[0] ) print( "The second item in teh list (state): " + my_list[2] ) new_list = [ 5060, '80', 55, '10.0.0.1', '10.20.30.1', 'ssh' ] #my code to use a single ...
my_list = ['192.168.0.5', 5060, 'UP'] print('THe first item in teh list (IP): ' + my_list[0]) print('The second item in teh list (state): ' + my_list[2]) new_list = [5060, '80', 55, '10.0.0.1', '10.20.30.1', 'ssh'] print('Ip addresses ' + new_list[3] + ' ' + new_list[4] + ' availalbe for ' + new_list[5] + ' at ports ' ...
languages = [ { "Language": "Bengali", "ISO-639-1 Code": "bn" }, { "Language": "Gujarati", "ISO-639-1 Code": "gu" }, { "Language": "Hindi", "ISO-639-1 Code": "hi" }, { "Language": "Malayalam", "ISO-639-1 Code": "ml" }, { "Language": "Marathi", "ISO-639-1 Code": "mr" }, { "Lan...
languages = [{'Language': 'Bengali', 'ISO-639-1 Code': 'bn'}, {'Language': 'Gujarati', 'ISO-639-1 Code': 'gu'}, {'Language': 'Hindi', 'ISO-639-1 Code': 'hi'}, {'Language': 'Malayalam', 'ISO-639-1 Code': 'ml'}, {'Language': 'Marathi', 'ISO-639-1 Code': 'mr'}, {'Language': 'Punjabi', 'ISO-639-1 Code': 'pa'}, {'Language':...
''' isEven takes a single integer parameter a returning true if a is even and false if a is odd ''' def isEven(a): return a % 2 == 0 ''' print(isEven(-1)) print(isEven(-2)) print(isEven(1)) print(isEven(8)) ''' ''' missing_char takes a non-empty string, str, and returns the str without the character at index n '...
""" isEven takes a single integer parameter a returning true if a is even and false if a is odd """ def is_even(a): return a % 2 == 0 '\nprint(isEven(-1))\nprint(isEven(-2))\nprint(isEven(1))\nprint(isEven(8))\n' '\nmissing_char takes a non-empty string, str, and returns\nthe str without the character at index n\n...
# generated from catkin/cmake/template/order_packages.context.py.in source_root_dir = "/home/robotpt/QTRobotTester/src" whitelisted_packages = "".split(';') if "" != "" else [] blacklisted_packages = "".split(';') if "" != "" else [] underlay_workspaces = "/home/robotpt/QTRobotTester/devel;/home/robotpt/HumanProjectorI...
source_root_dir = '/home/robotpt/QTRobotTester/src' whitelisted_packages = ''.split(';') if '' != '' else [] blacklisted_packages = ''.split(';') if '' != '' else [] underlay_workspaces = '/home/robotpt/QTRobotTester/devel;/home/robotpt/HumanProjectorInteration/devel;/home/robotpt/Desktop/catkin_nui/devel;/home/robotpt...
# -*- coding: utf-8 -*- # Copyright 2017, A10 Networks # Author: Mike Thompson: @mike @t @a10@networks!com # image1 = '''Funded By: ``........` `.--:////////...
image1 = 'Funded By:\n ``........`\n `.--:///////////////-`\n `.-://::--..`` ``.:////:...
# network HOST = '127.0.0.1' # or '0:0:0:0:0:0:0:1' PORT = 9999 # UI DEFAULT_POWERED = False # powered off DEFAULT_COLOR = '#000000' # black BACKGROUND_COLOR = '#FFFFFF' # white DIMENSIONS = "200x200" REFRESH_RATE = 100 # UI refresh every 100 milliseconds # misc LOGGING = { 'level': 'INFO', 'handler': '...
host = '127.0.0.1' port = 9999 default_powered = False default_color = '#000000' background_color = '#FFFFFF' dimensions = '200x200' refresh_rate = 100 logging = {'level': 'INFO', 'handler': 'StreamHandler', 'filepath': 'lantern.log'}
""" Questions : EASY 1528. [Shuffle String](https://leetcode.com/problems/shuffle-string/) Given a string s and an integer array indices of the same length. The string s will be shuffled such that the character at the ith position moves to indices[i] in the shuffled string. Return the shuffled string. Example 1: In...
""" Questions : EASY 1528. [Shuffle String](https://leetcode.com/problems/shuffle-string/) Given a string s and an integer array indices of the same length. The string s will be shuffled such that the character at the ith position moves to indices[i] in the shuffled string. Return the shuffled string. Example 1: In...
""" 60 / 60 test cases passed. Runtime: 36 ms Memory Usage: 15 MB """ class Solution: def canReorderDoubled(self, arr: List[int]) -> bool: cnt = Counter(arr) for x in sorted(cnt, key=abs): if cnt[x << 1] < cnt[x]: return False cnt[x << 1] -= cnt[x] ret...
""" 60 / 60 test cases passed. Runtime: 36 ms Memory Usage: 15 MB """ class Solution: def can_reorder_doubled(self, arr: List[int]) -> bool: cnt = counter(arr) for x in sorted(cnt, key=abs): if cnt[x << 1] < cnt[x]: return False cnt[x << 1] -= cnt[x] ...
class RangeStack: def __init__(self) -> None: self.stack = [] self.add = [] self.cursum = 0 def push(self, v : int) -> None: self.cursum += v self.stack.append(v) self.add.append(0) def pop(self) -> int: if not self.add: return -1 ...
class Rangestack: def __init__(self) -> None: self.stack = [] self.add = [] self.cursum = 0 def push(self, v: int) -> None: self.cursum += v self.stack.append(v) self.add.append(0) def pop(self) -> int: if not self.add: return -1 ...
# Copyright 2019 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. DEPS = [ 'cloudbuildhelper', 'recipe_engine/path', ] def RunSteps(api): paths = api.cloudbuildhelper.discover_manifests( root=api.path['cache']...
deps = ['cloudbuildhelper', 'recipe_engine/path'] def run_steps(api): paths = api.cloudbuildhelper.discover_manifests(root=api.path['cache'], dirs=['1', '2']) assert paths == [api.path['cache'].join('1', 'target.yaml'), api.path['cache'].join('2', 'target.yaml')], paths def gen_tests(api): yield api.test(...
# -*- coding: utf-8 -*- """ Created on Wed Sep 30 16:11:31 2020 @author: Abhishek Parashar """ def subsetutil(arr, subset, index,target,ans): if(target<0): return elif(target==0): ans.append(subset[:]) for i in range(index,len(arr)): if (i>index and arr[i]==arr[i-1])...
""" Created on Wed Sep 30 16:11:31 2020 @author: Abhishek Parashar """ def subsetutil(arr, subset, index, target, ans): if target < 0: return elif target == 0: ans.append(subset[:]) for i in range(index, len(arr)): if i > index and arr[i] == arr[i - 1]: continue ...
class Solution: def __init__(self): self.tribo = {0:0,1:1,2:1} def tribonacci(self, n: int) -> int: if(n in self.tribo): return self.tribo[n] else: res = self.tribonacci(n-1)+self.tribonacci(n-2)+self.tribonacci(n-3) self.tribo[n] = res return ...
class Solution: def __init__(self): self.tribo = {0: 0, 1: 1, 2: 1} def tribonacci(self, n: int) -> int: if n in self.tribo: return self.tribo[n] else: res = self.tribonacci(n - 1) + self.tribonacci(n - 2) + self.tribonacci(n - 3) self.tribo[n] = res...
#Exercise 3: Write a program to read through a mail log, build a histogram using a dictionary #to count how many messages have come from each email address, and print the dictionary. #Exercise 5: This program records the domain name (instead of the address) where the message #was sent from instead of who the mail ca...
name = input('Enter file:') if len(name) < 1: name = 'mbox-short.txt' handle = open(name) counts = dict() for line in handle: words = list(line.split()) if not line.startswith('From') or line.startswith('from'): continue emails = words[1] x = emails.find('@') domains = emails[x:] cou...
# output from sgtbx computed on platform win32 on 2010-04-28 sgtbx = { 'p 2 3': [ (1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0) , (0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0) , (0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0) , (0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 1.0, 0.0, 0.0, 0...
sgtbx = {'p 2 3': [(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0), (0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0), (0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0), (0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 1.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0...
# ------------------------------------------------------------ # imaparchiver/config.py # # imap-archiver config object # # This file is part of imaparchiver. # See the LICENSE file for the software license. # (C) Copyright 2015-2019, Oliver Maurhart, dyle71@gmail.com # -------------------------------------------------...
"""This module contains the app wide configuration object.""" class _Singleton(type): """Singleton class instance.""" _instances = {} def __call__(cls, *args, **kwargs): if cls not in cls._instances: cls._instances[cls] = super(_Singleton, cls).__call__(*args, **kwargs) return ...
print('-' * 12) num = int(input('Digite um numero da tabuada: ')) print('{} x 1 = {}'.format(num, num*1)) print('{} x 2 = {}'. format(num, num*2)) print('{} x 3 = {}'.format(num, num*3)) print('{} x 4 = {}'.format(num,num*4)) print('{} x 5 = {}'.format(num, num*5)) print('{} x 6 = {}'.format(num, num*6)) print('{} x 7 ...
print('-' * 12) num = int(input('Digite um numero da tabuada: ')) print('{} x 1 = {}'.format(num, num * 1)) print('{} x 2 = {}'.format(num, num * 2)) print('{} x 3 = {}'.format(num, num * 3)) print('{} x 4 = {}'.format(num, num * 4)) print('{} x 5 = {}'.format(num, num * 5)) print('{} x 6 = {}'.format(num, num * 6)) pr...
"""Template strings to simplify code formatting""" mapfile_layer_template = """ # LAYER: {feature} LEVEL: {layer} LAYER NAME "{feature}_{layer}" GROUP "{group}" METADATA "ows_title" "{feature}" "ows_enable_request" "*" "gml_include_items" "all" "wms_feature_mime_type" "t...
"""Template strings to simplify code formatting""" mapfile_layer_template = '\n# LAYER: {feature} LEVEL: {layer}\n\nLAYER\n NAME "{feature}_{layer}"\n GROUP "{group}"\n METADATA\n "ows_title" "{feature}"\n "ows_enable_request" "*"\n "gml_include_items" "all"\n "wms_feature_mime_t...
T=int(input()) N=int(input()) A=list(map(int,input().split())) M=int(input()) B=list(map(int,input().split())) k=0 for i in range(N): if k!=M and 0<=B[k]-A[i]<=T:k+=1 print("yes" if k==M else "no")
t = int(input()) n = int(input()) a = list(map(int, input().split())) m = int(input()) b = list(map(int, input().split())) k = 0 for i in range(N): if k != M and 0 <= B[k] - A[i] <= T: k += 1 print('yes' if k == M else 'no')
def NX(LENS, X = .50): tot = sum(LENS) for L in LENS: a = sum([x for x in LENS if x >= L]) if a >= tot * X: NX = L return NX if __name__ == "__main__": FASTA_file = open('MRSA_k85/contigs.fasta') LENS = [] for line in FASTA_file: if line.startswith('>'): ...
def nx(LENS, X=0.5): tot = sum(LENS) for l in LENS: a = sum([x for x in LENS if x >= L]) if a >= tot * X: nx = L return NX if __name__ == '__main__': fasta_file = open('MRSA_k85/contigs.fasta') lens = [] for line in FASTA_file: if line.startswith('>'): ...
""" Use recursion to write a function that accepts an array of strings and returns the total number of characters across all the strings. For example, if the input array is ["ab", "c", "def", "ghij"], the output should be 10 since there are 10 characters in total. sub-problem: arr[1:] base cas...
""" Use recursion to write a function that accepts an array of strings and returns the total number of characters across all the strings. For example, if the input array is ["ab", "c", "def", "ghij"], the output should be 10 since there are 10 characters in total. sub-problem: arr[1:] base cas...
"""Constants related to IStorage and related interfaces This file was generated by h2py from d:\msdev\include\objbase.h then hand edited, a few extra constants added, etc. """ STGC_DEFAULT = 0 STGC_OVERWRITE = 1 STGC_ONLYIFCURRENT = 2 STGC_DANGEROUSLYCOMMITMERELYTODISKCACHE = 4 STGC_CONSOLIDATE...
"""Constants related to IStorage and related interfaces This file was generated by h2py from d:\\msdev\\include\\objbase.h then hand edited, a few extra constants added, etc. """ stgc_default = 0 stgc_overwrite = 1 stgc_onlyifcurrent = 2 stgc_dangerouslycommitmerelytodiskcache = 4 stgc_consolidate = 8 stgty_storage = ...
# --- Day 3: Perfectly Spherical Houses in a Vacuum --- f = open("input.txt", "r").read() def getSantasUniquePositions(file, numSantas): x = 0 y = 0 start = [x, y] santaPositions = [start] roboPositions = [start] i = 0 santaX = roboX = x santaY = roboY = y for c in file: if i % numSantas == 0: sant...
f = open('input.txt', 'r').read() def get_santas_unique_positions(file, numSantas): x = 0 y = 0 start = [x, y] santa_positions = [start] robo_positions = [start] i = 0 santa_x = robo_x = x santa_y = robo_y = y for c in file: if i % numSantas == 0: santa_pos = [] ...
total_tickets = 0 student_tickets = 0 standart_tickets = 0 kids_tickets = 0 count_seats = 0 while True: command = input() if command == "Finish": print(f"Total tickets: {total_tickets}") percent_student = student_tickets / total_tickets * 100 percent_standart = standart_ticke...
total_tickets = 0 student_tickets = 0 standart_tickets = 0 kids_tickets = 0 count_seats = 0 while True: command = input() if command == 'Finish': print(f'Total tickets: {total_tickets}') percent_student = student_tickets / total_tickets * 100 percent_standart = standart_tickets / total_t...
class Structure: # Class variable that specifies expected fields _fields= [] def __init__(self, *args): if len(args) != len(self._fields): raise TypeError('Expected {} arguments'.format(len(self._fields))) # Set the arguments for name, value in zip(self._fields, args): ...
class Structure: _fields = [] def __init__(self, *args): if len(args) != len(self._fields): raise type_error('Expected {} arguments'.format(len(self._fields))) for (name, value) in zip(self._fields, args): setattr(self, name, value) if __name__ == '__main__': class ...
def tax_brackets(gross_income, deduc=12700): # married only # deduc is for itemizing in 2017 (majority would be from income tax) brackets_17 = ( (18650, 0.1), (75900-18650, 0.15), (153100-75900, 0.25), (233350-153100, 0.28), (416700-233350, 0.33), (470700-4167...
def tax_brackets(gross_income, deduc=12700): brackets_17 = ((18650, 0.1), (75900 - 18650, 0.15), (153100 - 75900, 0.25), (233350 - 153100, 0.28), (416700 - 233350, 0.33), (470700 - 416700, 0.35), (1e+100, 0.393)) tax_17 = 0.0 gross_income_17 = gross_income - deduc for bracket in brackets_17: if ...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"count_errors": "00_core.ipynb", "map_dtypes_to_choices": "00_core.ipynb", "AsType": "00_core.ipynb", "Row": "00_core.ipynb", "get_smallest_valid_conversion": "00_core.ipyn...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'count_errors': '00_core.ipynb', 'map_dtypes_to_choices': '00_core.ipynb', 'AsType': '00_core.ipynb', 'Row': '00_core.ipynb', 'get_smallest_valid_conversion': '00_core.ipynb', 'get_improvement': '00_core.ipynb', 'report_on_dataframe': '00_core.ipynb...
class Solution: def solve(self, nums): is_strictly_increasing = True for i in range(len(nums)-1): if nums[i+1] <= nums[i]: is_strictly_increasing = False if is_strictly_increasing: return True is_strictly_decreasing = True ...
class Solution: def solve(self, nums): is_strictly_increasing = True for i in range(len(nums) - 1): if nums[i + 1] <= nums[i]: is_strictly_increasing = False if is_strictly_increasing: return True is_strictly_decreasing = True for i in...
# # PySNMP MIB module NETBOTZ-DEVICE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NETBOTZ-DEVICE-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:18:29 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersection, constraints_union, value_range_constraint, single_value_constraint) ...
# Copyright 2019 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
"""Helper methods for assembling the test targets.""" _bundle_attrs = {x: None for x in ['additional_contents', 'deps', 'bundle_id', 'bundle_name', 'families', 'frameworks', 'infoplists', 'linkopts', 'minimum_os_version', 'provisioning_profile', 'resources', 'test_host']} _shared_suite_test_attrs = {x: None for x in ['...
""" Trivial utilities """ def get_metarget_version(): try: with open("VERSION", "r") as f: return f.read().strip() except FileNotFoundError: return "unknown"
""" Trivial utilities """ def get_metarget_version(): try: with open('VERSION', 'r') as f: return f.read().strip() except FileNotFoundError: return 'unknown'
num= 89 cont= 0 while num <= 150: if num % 2 == 0: print('par', num) cont = cont + 1 num = num + 1 print('quantidade= ',cont)
num = 89 cont = 0 while num <= 150: if num % 2 == 0: print('par', num) cont = cont + 1 num = num + 1 print('quantidade= ', cont)
""" Global constants module """ DEFAULT_HOST = "http://localhost:8080/" DEFAULT_USER_NAMESPACE = "kubeflow-user-example-com" DEFAULT_USERNAME = "user@example.com" DEFAULT_PASSWORD = "12341234" KUBEFLOW_GROUP = "kubeflow.org" KUBEFLOW_NAMESPACE = "kubeflow"
""" Global constants module """ default_host = 'http://localhost:8080/' default_user_namespace = 'kubeflow-user-example-com' default_username = 'user@example.com' default_password = '12341234' kubeflow_group = 'kubeflow.org' kubeflow_namespace = 'kubeflow'
# Reference: https://runestone.academy/runestone/books/published/pythonds/Recursion/pythondsConvertinganIntegertoaStringinAnyBase.html # if num < base (2, 8, 10, 16) then we can directly lookup the corresponding # string value # hence base case = if num < base then lookup # To reduce the problem towards base case, we ...
def to_str(num, base): convert_string = '0123456789ABCDEF' if num < base: return convert_string[num] else: digit = num // base remainder = num % base return to_str(digit, base) + convert_string[remainder] def test_base_convertor(): assert to_str(10, 2) == '1010' asse...
# These are local default variables for development # In deployment on Heroku's systems, these variables are changed DEBUG = True SECRET_KEY = "super_secret_key" LILLINK_REDIS_URL = "redis://localhost:6379/0"
debug = True secret_key = 'super_secret_key' lillink_redis_url = 'redis://localhost:6379/0'
numeroA = int(input('Digite um numero...')) outroNumero = int(input('Digite outro numero')) sum = numeroA + outroNumero print('A soma de {} e {} eh igual a {}' .format(numeroA, outroNumero, sum))
numero_a = int(input('Digite um numero...')) outro_numero = int(input('Digite outro numero')) sum = numeroA + outroNumero print('A soma de {} e {} eh igual a {}'.format(numeroA, outroNumero, sum))
file = open('2021\D8\input.txt','r').read().splitlines() s = [] mapcode = { 'a':'', 'b':'', 'c':'', 'd':'', 'e':'', 'f':'', 'g':'' } wirecode = { 0:'', 1:'', 2:'', 3:'', 4:'', 5:'', 6:'', 7:'', 8:'', 9:'' } numcode = { 0:'abcefg', 1:'cf', 2:'ac...
file = open('2021\\D8\\input.txt', 'r').read().splitlines() s = [] mapcode = {'a': '', 'b': '', 'c': '', 'd': '', 'e': '', 'f': '', 'g': ''} wirecode = {0: '', 1: '', 2: '', 3: '', 4: '', 5: '', 6: '', 7: '', 8: '', 9: ''} numcode = {0: 'abcefg', 1: 'cf', 2: 'acdeg', 3: 'acdfg', 4: 'bcdf', 5: 'abdfg', 6: 'abdefg', 7: '...
class TelemetryTCPDialOutServerError(Exception): """Generic Error for TCP Dial out server""" pass class IODefinedError(Exception): """User didn't define an input and output in the configuration file""" pass class DecodeError(Exception): pass class ElasticSearchUploaderError(Exception): pas...
class Telemetrytcpdialoutservererror(Exception): """Generic Error for TCP Dial out server""" pass class Iodefinederror(Exception): """User didn't define an input and output in the configuration file""" pass class Decodeerror(Exception): pass class Elasticsearchuploadererror(Exception): pass ...
#!/usr/bin/env python # -*- coding: utf-8 -*- n = list(map(int, input().split())) def slove1(): ans, tmp = 0, -1 lmax,rmax = [0]*len(n), [0]*len(n) for i in range(1, len(n)): tmp = max(tmp, n[i-1]) lmax[i] = tmp tmp = -1 for i in range(len(n)-2, -1, -1): tmp = max(tmp, n[i+...
n = list(map(int, input().split())) def slove1(): (ans, tmp) = (0, -1) (lmax, rmax) = ([0] * len(n), [0] * len(n)) for i in range(1, len(n)): tmp = max(tmp, n[i - 1]) lmax[i] = tmp tmp = -1 for i in range(len(n) - 2, -1, -1): tmp = max(tmp, n[i + 1]) rmax[i] = tmp ...
# listFunctions.py # Contains basic list manipulation functions # J. Hassler Thurston # 26 November 2013 (Adapted from Mathematica code written in 2010/2011) # Python 2.7.6 # returns a running sum of the elements in ls def cumulativeSum(ls): total = 0 answer = [] for i in ls: total += i ...
def cumulative_sum(ls): total = 0 answer = [] for i in ls: total += i answer.append(total) return answer def cumulative_sum_zero(ls): total = 0 answer = [0] for i in ls: total += i answer.append(total) return answer
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def getDecimalValue(self, head: ListNode) -> int: binary_list = [] current = head while current: ...
class Solution: def get_decimal_value(self, head: ListNode) -> int: binary_list = [] current = head while current: binary_list.append(str(current.val)) current = current.next return int(''.join(binary_list), 2)
# coding: utf-8 # # Copyright 2022 :Barry-Thomas-Paul: Moss # # 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 applicab...
class Shapeanimationsubtype(object): """ Const Class Defines the whole shape or a subitem as a target for an effect. See Also: `API ShapeAnimationSubType <https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1presentation_1_1ShapeAnimationSubType.html>`_ """ __ooo_ns_...
_item_fullname_='Bio.Seq.Seq' def is_biopython_Seq(item): item_fullname = item.__class__.__module__+'.'+item.__class__.__name__ return _item_fullname_==item_fullname
_item_fullname_ = 'Bio.Seq.Seq' def is_biopython__seq(item): item_fullname = item.__class__.__module__ + '.' + item.__class__.__name__ return _item_fullname_ == item_fullname
def ci(A, l, r, k): while r-l > 1: mid = (l + (r-l))//2 if A[mid] >= k: r=mid else: l=mid return r def longestSubsequence(a,n): t = [0 for _ in range(n+1)] l=0 t[0] = a[0] l=1 for i in range(1, n): if a[i] < t[0]: t[0] = a[...
def ci(A, l, r, k): while r - l > 1: mid = (l + (r - l)) // 2 if A[mid] >= k: r = mid else: l = mid return r def longest_subsequence(a, n): t = [0 for _ in range(n + 1)] l = 0 t[0] = a[0] l = 1 for i in range(1, n): if a[i] < t[0]: ...
passmark=0 # declaring variables defer=0 fail=0 all=0 def all(): try: #this won't let strings to pass while True: passmark=int(input("Enter the Pass mark :")) # getting the user's passmark if passmark == 0 or passmark == 20 or passmark == 40 or passmark == ...
passmark = 0 defer = 0 fail = 0 all = 0 def all(): try: while True: passmark = int(input('Enter the Pass mark :')) if passmark == 0 or passmark == 20 or passmark == 40 or (passmark == 60) or (passmark == 80) or (passmark == 100) or (passmark == 120): while True: ...
def extract(graph): ''' Generate a dictionary from a NetworkX Graph. The key is the index (primary node identifier) of the node in the graph. The value is a dict with index, label (original node identifier), room (a node attribute from the source data), and a list of neighbors (by graph index v...
def extract(graph): """ Generate a dictionary from a NetworkX Graph. The key is the index (primary node identifier) of the node in the graph. The value is a dict with index, label (original node identifier), room (a node attribute from the source data), and a list of neighbors (by graph index v...
def dobra_lista(lista): nova_lista = [] for valor in lista: novo_elemento = 2 * valor nova_lista.append(novo_elemento) return nova_lista #---------------------------------------------------------------- numeros = [3, 6, 10] numeros_emdobro = dobra_lista(numeros) print(numeros) print(numeros...
def dobra_lista(lista): nova_lista = [] for valor in lista: novo_elemento = 2 * valor nova_lista.append(novo_elemento) return nova_lista numeros = [3, 6, 10] numeros_emdobro = dobra_lista(numeros) print(numeros) print(numeros_emdobro)
def test_length(devnetwork, chain): assert len(chain) == 1 chain.mine(4) assert len(chain) == 5 def test_length_after_revert(devnetwork, chain): chain.mine(4) chain.snapshot() chain.mine(20) assert len(chain) == 25 chain.revert() assert len(chain) == 5 def test_getitem_negative_...
def test_length(devnetwork, chain): assert len(chain) == 1 chain.mine(4) assert len(chain) == 5 def test_length_after_revert(devnetwork, chain): chain.mine(4) chain.snapshot() chain.mine(20) assert len(chain) == 25 chain.revert() assert len(chain) == 5 def test_getitem_negative_ind...
""" Given k sorted arrays, merge them into a single sorted array eg. merge({{1,4,7}, {2,5,8}, {3,6,9}}) {1,2,3,4,5,6,7,8,9} """ def merge(arrays: list): return _merger(arrays) def _merger(arrays): if len(arrays) == 1: return arrays if len(arrays) == 2: array = merge_2_sorted(arrays[0...
""" Given k sorted arrays, merge them into a single sorted array eg. merge({{1,4,7}, {2,5,8}, {3,6,9}}) {1,2,3,4,5,6,7,8,9} """ def merge(arrays: list): return _merger(arrays) def _merger(arrays): if len(arrays) == 1: return arrays if len(arrays) == 2: array = merge_2_sorted(arrays[0], ar...
input = """ bad :- r1, r2. bad :- g1, g2. bad :- b1, b2. bad :- r2, r3. bad :- g2, g3. bad :- b2, b3. bad :- r3, r1. bad :- g3, g1. bad :- b3, b1. r1 :- not g1, not b1. g1 :- not b1, not r1. b1 :- not r1, not g1. r2 :- not g2, not b2. g2 :- not b2, not r2. b2 :- not r2, not g2. r3 :- not g3, not b3. g3 ...
input = '\nbad :- r1, r2.\nbad :- g1, g2.\nbad :- b1, b2.\nbad :- r2, r3.\nbad :- g2, g3.\nbad :- b2, b3.\nbad :- r3, r1.\nbad :- g3, g1.\nbad :- b3, b1.\nr1 :- not g1, not b1.\ng1 :- not b1, not r1.\nb1 :- not r1, not g1.\nr2 :- not g2, not b2.\ng2 :- not b2, not r2.\nb2 :- not r2, not g2.\nr3 :- not g3, not b3.\ng3 :...
''' Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For example: Given binary tree {3,9,20,#,#,15,7}, 3 / \ 9 20 / \ 15 7 return its bottom-up level order traversal as: [ [15,7], [9,20], [3] ] ''...
""" Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For example: Given binary tree {3,9,20,#,#,15,7}, 3 / 9 20 / 15 7 return its bottom-up level order traversal as: [ [15,7], [9,20], [3] ] """ c...
class Node: __slots__ = ['key','value','prev','next'] def __init__(self, key, value): self.key = key self.value = value self.prev = None self.next = None class LRUCache: def __init__(self, capacity): self.capacity = capacity self.size = 0 self.mapp...
class Node: __slots__ = ['key', 'value', 'prev', 'next'] def __init__(self, key, value): self.key = key self.value = value self.prev = None self.next = None class Lrucache: def __init__(self, capacity): self.capacity = capacity self.size = 0 self.ma...
stype = """ /* === Shared === */ QStackedWidget, QLabel, QPushButton, QRadioButton, QCheckBox, QGroupBox, QStatusBar, QToolButton, QComboBox, QDialog { background-color: #222222; color: #BBBBBB; font-family: "Segoe UI"; } /* === QWidget === */ QWidget:window { background: #222222; colo...
stype = '\n/* === Shared === */\nQStackedWidget, QLabel, QPushButton, QRadioButton, QCheckBox, \nQGroupBox, QStatusBar, QToolButton, QComboBox, QDialog {\n background-color: #222222;\n color: #BBBBBB;\n font-family: "Segoe UI";\n}\n\n/* === QWidget === */\nQWidget:window {\n background: #222222;\n color:...
#!/usr/bin/env python3 # https://abc067.contest.atcoder.jp/tasks/arc078_a n = int(input()) a = [int(x) for x in input().split()] s = sum(a) b = a[0] m = abs(s - 2 * b) for i in range(1, n - 1): b += a[i] m = min(m, abs(s - 2 * b)) print(m)
n = int(input()) a = [int(x) for x in input().split()] s = sum(a) b = a[0] m = abs(s - 2 * b) for i in range(1, n - 1): b += a[i] m = min(m, abs(s - 2 * b)) print(m)
# SPDX-License-Identifier: MIT # # keys.py - includes Discord bot token # # Copyright (c) 2019 Joe Dai. TOKEN = ''
token = ''
class Plugin(object): def __init__(self, dogen, args): self.dogen = dogen self.log = dogen.log self.descriptor = dogen.descriptor self.output = dogen.output self.args = args @staticmethod def inject_args(parser): return parser def prepare(self, **kwargs...
class Plugin(object): def __init__(self, dogen, args): self.dogen = dogen self.log = dogen.log self.descriptor = dogen.descriptor self.output = dogen.output self.args = args @staticmethod def inject_args(parser): return parser def prepare(self, **kwargs...
def generate_images(autoencoder, K, n_images=1): """Generate n_images 'new' images from the decoder part of the given autoencoder. returns (n_images, channels, height, width) tensor of images """ # Concatenate tuples to get (n_images, channels, height, width) output_shape = (n_images,) + data_shape with ...
def generate_images(autoencoder, K, n_images=1): """Generate n_images 'new' images from the decoder part of the given autoencoder. returns (n_images, channels, height, width) tensor of images """ output_shape = (n_images,) + data_shape with torch.no_grad(): z = torch.randn(n_images, K) ...
model = Model() i1 = Input("input", "TENSOR_FLOAT32", "{3,4,2}") perms = Parameter("perms", "TENSOR_INT32", "{3}", [1, 0, 2]) output = Output("output", "TENSOR_FLOAT32", "{4,3,2}") model = model.Operation("TRANSPOSE", i1, perms).To(output) # Example 1. Input in operand 0, input0 = {i1: # input 0 [0, 1, 2, 3...
model = model() i1 = input('input', 'TENSOR_FLOAT32', '{3,4,2}') perms = parameter('perms', 'TENSOR_INT32', '{3}', [1, 0, 2]) output = output('output', 'TENSOR_FLOAT32', '{4,3,2}') model = model.Operation('TRANSPOSE', i1, perms).To(output) input0 = {i1: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,...
description = 'TOF counter devices' group = 'lowlevel' tango_base = 'tango://cpci3.toftof.frm2:10000/' devices = dict( timer = device('nicos.devices.entangle.TimerChannel', description = 'The TOFTOF timer', tangodevice = tango_base + 'toftof/det/timer', fmtstr = '%.1f', visibility...
description = 'TOF counter devices' group = 'lowlevel' tango_base = 'tango://cpci3.toftof.frm2:10000/' devices = dict(timer=device('nicos.devices.entangle.TimerChannel', description='The TOFTOF timer', tangodevice=tango_base + 'toftof/det/timer', fmtstr='%.1f', visibility=()), monitor=device('nicos.devices.entangle.Cou...
def colorify(s, color): color_map = { "grey": "\033[90m", "red": "\033[91m", "green": "\033[92m", "yellow": "\033[93m", "purple": "\033[94m", "pink": "\033[95m", "blue": "\033[96m", } return color_map[color] + s + "\033[0m" def underline(s): ret...
def colorify(s, color): color_map = {'grey': '\x1b[90m', 'red': '\x1b[91m', 'green': '\x1b[92m', 'yellow': '\x1b[93m', 'purple': '\x1b[94m', 'pink': '\x1b[95m', 'blue': '\x1b[96m'} return color_map[color] + s + '\x1b[0m' def underline(s): return '\x1b[4m' + s + '\x1b[0m'
class ItemAlreadyStored(Exception): pass class ItemNotStored(Exception): pass
class Itemalreadystored(Exception): pass class Itemnotstored(Exception): pass
_base_="../base-chexpert-chest_xray_kids-config.py" # epoch related total_iters=5000 checkpoint_config = dict(interval=total_iters) model = dict( pretrained='work_dirs/hpt-pretrain/resisc/moco_v2_800ep_basetrain/50000-iters/moco_v2_800ep_basetrain-resisc_50000it.pth', backbone=dict( norm_train=True, frozen_...
_base_ = '../base-chexpert-chest_xray_kids-config.py' total_iters = 5000 checkpoint_config = dict(interval=total_iters) model = dict(pretrained='work_dirs/hpt-pretrain/resisc/moco_v2_800ep_basetrain/50000-iters/moco_v2_800ep_basetrain-resisc_50000it.pth', backbone=dict(norm_train=True, frozen_stages=4)) optimizer = dic...
def extractHikkinoMoriTranslations(item): """ # 'Hikki no Mori Translations' """ vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol or frag) or 'preview' in item['title'].lower(): return None if item['title'].lower().startswith('chapter') or item['title'].lower().starts...
def extract_hikkino_mori_translations(item): """ # 'Hikki no Mori Translations' """ (vol, chp, frag, postfix) = extract_vol_chapter_fragment_postfix(item['title']) if not (chp or vol or frag) or 'preview' in item['title'].lower(): return None if item['title'].lower().startswith('chapter') or i...
# # Copyright 2021 Splunk Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, so...
dict_datamodel_tag = {'Alerts': ['alert'], 'Authentication': ['authentication'], 'Authentication_Default_Authentication': ['default', 'authentication'], 'Authentication_Insecure_Authentication': ['authentication', 'insecure'], 'Authentication_Insecure_Authentication.2': ['authentication', 'cleartext'], 'Authentication_...
# Python - 3.6.0 Test.describe('thirt') Test.it('Basic tests') Test.assert_equals(thirt(8529), 79) Test.assert_equals(thirt(85299258), 31) Test.assert_equals(thirt(5634), 57) Test.assert_equals(thirt(1111111111), 71) Test.assert_equals(thirt(987654321), 30)
Test.describe('thirt') Test.it('Basic tests') Test.assert_equals(thirt(8529), 79) Test.assert_equals(thirt(85299258), 31) Test.assert_equals(thirt(5634), 57) Test.assert_equals(thirt(1111111111), 71) Test.assert_equals(thirt(987654321), 30)
class HistMovementManager: def __init__(self): self.boards_hist = [] self.cur_board = -1 self.offset = 0 def make_screen(self, board): if self.cur_board != -1 and self.boards_hist[self.cur_board] == board: return self.boards_hist.append(board) self.c...
class Histmovementmanager: def __init__(self): self.boards_hist = [] self.cur_board = -1 self.offset = 0 def make_screen(self, board): if self.cur_board != -1 and self.boards_hist[self.cur_board] == board: return self.boards_hist.append(board) self.c...
""" """ def map_int(to_int) -> int: """Maps value to integer from a string. Parameters ---------- to_int: various (usually str) Value to be converted to integer Returns ------- mapped_int: int Value mapped to integer. Examples -------- >>> number_one = "1" ...
""" """ def map_int(to_int) -> int: """Maps value to integer from a string. Parameters ---------- to_int: various (usually str) Value to be converted to integer Returns ------- mapped_int: int Value mapped to integer. Examples -------- >>> number_one = "1" ...
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- __all__ = [ "functions", "dbcontent", "sqlite_helper", "global_variable" ]
__all__ = ['functions', 'dbcontent', 'sqlite_helper', 'global_variable']
def distributeCoins(self, root: TreeNode) -> int: num_opt = 0 def dfs(node): """ >>> DFS Traverse the tree, for each node, the number of moves is the absolute values between 1 and the left/right node values. Also remember to update...
def distribute_coins(self, root: TreeNode) -> int: num_opt = 0 def dfs(node): """ >>> DFS Traverse the tree, for each node, the number of moves is the absolute values between 1 and the left/right node values. Also remember to update the node ...
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
"""Class that defines custom errors for picatrix.""" class Error(Exception): """Base error class.""" class Argparsernonzerostatus(Error): """Raised when the argument parser has exited with non-zero status."""
float_type = type(1.0) int_type = type(1) string_type = type('') date_type = 'iso8601' unicode_type = type(u'') bool_type = type(True) map_type = type({}) seq_type = type([]) tuple_type = type(()) def is_string(obj): t = type(obj) return t is string_type or t is unicode_type def is_int(obj): return type(o...
float_type = type(1.0) int_type = type(1) string_type = type('') date_type = 'iso8601' unicode_type = type(u'') bool_type = type(True) map_type = type({}) seq_type = type([]) tuple_type = type(()) def is_string(obj): t = type(obj) return t is string_type or t is unicode_type def is_int(obj): return type(o...
class Field(object): sql_type = None py_type = None def __init__(self, name=None, value=None, pk=None, unique=None, not_null=None): self.name = name self.pk = pk self.unique = unique self.not_null = not_null self.value = value def set_name(self, name): ...
class Field(object): sql_type = None py_type = None def __init__(self, name=None, value=None, pk=None, unique=None, not_null=None): self.name = name self.pk = pk self.unique = unique self.not_null = not_null self.value = value def set_name(self, name): s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
"""Rules for generating Protos from Profiles and StructureDefinitions""" stu3_structure_definition_dep = '//testdata/stu3:fhir' proto_generator = '//java:ProtoGenerator' profile_generator = '//java:ProfileGenerator' fhir_proto_root = 'proto/stu3' def zip_file(name, srcs=[]): native.genrule(name=name, srcs=srcs, ou...
# cypher.py - encrypt and decrypt messages def cypher(message, key): result = "" for ch in message: ch = chr(ord(ch) ^ key) result += ch return result def run(): plaintext = input("message? ") key = input("hex number for key? ") key = int(key, 16) cyphertext = cypher(plain...
def cypher(message, key): result = '' for ch in message: ch = chr(ord(ch) ^ key) result += ch return result def run(): plaintext = input('message? ') key = input('hex number for key? ') key = int(key, 16) cyphertext = cypher(plaintext, key) print(cyphertext)
"""Constants for the Automate Pulse Hub v2 integration.""" DOMAIN = "automate" AUTOMATE_HUB_UPDATE = "automate_hub_update_{}" AUTOMATE_ENTITY_REMOVE = "automate_entity_remove_{}"
"""Constants for the Automate Pulse Hub v2 integration.""" domain = 'automate' automate_hub_update = 'automate_hub_update_{}' automate_entity_remove = 'automate_entity_remove_{}'
""" The parsed output of the knowledge,json is used to create the Knowledge object consisting of the target and rules """ class Rule: """ Class to store the rule in the string format Attributes ----------- __rule: str rule for the knowledge """ def __init__(self, rule: str): ...
""" The parsed output of the knowledge,json is used to create the Knowledge object consisting of the target and rules """ class Rule: """ Class to store the rule in the string format Attributes ----------- __rule: str rule for the knowledge """ def __init__(self, rule: str): ...
__all__ = [ 'q1_itertools_product', 'q2_itertools_permutations', 'q3_itertools_combinations', 'q4_itertools_combinations_with_replacement', 'q5_compress_the_string', 'q6_iterables_and_iterators', 'q7_maximize_it' ]
__all__ = ['q1_itertools_product', 'q2_itertools_permutations', 'q3_itertools_combinations', 'q4_itertools_combinations_with_replacement', 'q5_compress_the_string', 'q6_iterables_and_iterators', 'q7_maximize_it']
# This file is part of LibCSS. # Licensed under the MIT License, # http://www.opensource.org/licenses/mit-license.php # Copyright 2017 Lucas Neves <lcneves@gmail.com> # Configuration of CSS values. # The tuples in this set will be unpacked as arguments to the CSSValue # class. # Args: see docstring for class CSSValue ...
values = {('length', 'css_fixed', 4, '0', 'unit', 'css_unit', 5, 'CSS_UNIT_PX'), ('integer', 'int32_t', 4, '0'), ('fixed', 'css_fixed', 4, '0'), ('color', 'css_color', 4, '0'), ('string', 'lwc_string*'), ('string_arr', 'lwc_string**'), ('counter_arr', 'css_computed_counter*'), ('content_item', 'css_computed_content_ite...
class CSharpReference(): def __init__(self,): self.reference_object = None self.line_in_file = -1 self.file_name = ''
class Csharpreference: def __init__(self): self.reference_object = None self.line_in_file = -1 self.file_name = ''