content
stringlengths
7
1.05M
ledger = {n: idx + 1 for idx, n in enumerate([1, 17, 0, 10, 18, 11, 6])} spoken_number = list(ledger)[-1] for turn in range(len(ledger), 30000000): ledger[spoken_number], spoken_number = turn, turn - ledger.get(spoken_number, turn) if turn == 2020 - 1: print(f"Part 1: {spoken_number}") # 595 print(f"P...
error_map = { 0: None, -1: "连接服务失败", -2: "链路认证失败", -3: "主机地址不可用", -4: "发送数据错误", -5: "测试编号不合法", -6: "没准备好测试网络", -7: "当前网络测试还没结束", -8: "没用可用的接入前置", -9: "数据路径不可用", -10: "重复登录", -11: "内部错误", -12: "上一次请求还没有结束", -13: "输入参数非法", -14: "授权码不合法", -15: "授权码超期", -1...
n = int(input()) arr = map(int, input().split()) list1 = list(arr) print(list1) new_list = set(list1) print(new_list) new_list.remove(max(new_list)) print(max(new_list))
MODEL_FOLDER_NAME = 'models' FASTTEXT_MODEL_NAME = 'fasttext.magnitude' GLOVE_MODEL_NAME = 'glove.magnitude' WORD2VEC_MODEL_NAME = 'word2vec.magnitude' ELMO_MODEL_NAME = 'elmo.magnitude' BERT_MODEL_NAME = '' FLAIR_MODEL_NAME = 'news-forward' COVE_MODEL_NAME = '' UNIVERSAL_SENTENCE_ENCODER_MODEL_NAME = 'https://tfhub.de...
# coding=utf-8 class App: TESTING = True HOST_URL = "http://pay.lvye.com" PAYEE = '169658002' class PayClientConfig: CHANNEL_NAME = 'lvye_pay_test' ROOT_URL = "http://pay.lvye.com/api/__" CHECKOUT_URL = 'http://pay.lvye.com/__/checkout/{sn}'
def calc_gc(sequence): sequence = sequence.upper() # make all chars uppercase n = sequence.count('T') + sequence.count('A') # count only A, T, m = sequence.count('G') + sequence.count('C') # C, and G -- nothing else (no Ns, Rs, Ws, etc.) return float(m) / float(n + m) if n+m else 0 ...
# Use this to take notes on the Edpuzzle video. Try each example rather than just watching it - you will get much more out of it! # student = {'name': 'John', 'age': 25, 'courses': ['math', 'CompSci']} for key, value in student.items(): print(key, value)
# 比較演算子 def operate_compare(num): if num >= 100: # numが100以上(100を含む) print(f' 100 <= num({num})') elif num >= 50: # numが50より大きい(50を含む) print(f' 50 <= num({num}) < 100') elif num > 0: # numが0より大きい(0を含まない) print(f' 0 < num({num}) <= 50') elif num == 0: # numが0である pri...
PARSING_SCHEME = { 'name': 'a', 'games_played': 'td[data-stat="g"]:first', 'minutes_played': 'td[data-stat="mp"]:first', 'field_goals': 'td[data-stat="fg"]:first', 'field_goal_attempts': 'td[data-stat="fga"]:first', 'field_goal_percentage': 'td[data-stat="fg_pct"]:first', 'three_point_field_...
class NuGetPackage(GitHubTarballPackage): def __init__(self): GitHubTarballPackage.__init__(self, 'mono', 'nuget', '2.8.5', 'ea1d244b066338c9408646afdcf8acae6299f7fb', configure = '') def build(self): self.sh ('%{make} PREFIX=%{package_prefix}') def install(self): self.sh ('%{makeinstall} PREFIX...
def test(): assert ( "doc1.similarity(doc2)" in __solution__ or "doc2.similarity(doc1)" in __solution__ ), "你有计算两个doc之间的相似度吗?" assert ( 0 <= float(similarity) <= 1 ), "相似度分数是一个浮点数。你确定你计算正确了吗?" __msg__.good("棒棒哒!")
class Cat: def __init__(self, name, age): self.name = name self.age = age def info(self): print(f"I am a cat. My name is {self.name}. I am {self.age} years old.") def make_sound(self): print("Meow") class Dog: def __init__(self, name, age): self.name = name ...
#!/usr/bin/python # Copyright 2015 Neuhold Markus and Kleinsasser Mario # # 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 ...
class DistributedRouter: def allow_migrate(self, db, app_label, model_name=None, **hints): if model_name in ['user', 'settings']: return db == 'parser' if model_name in ['search', 'betdata']: return db == 'betdata' return True
contador_externo = 0 contador_interno = 0 while contador_externo < 5: while contador_interno < 6: print(contador_externo, contador_interno) contador_interno += 1 contador_externo += 1 contador_interno = 0
# Python: QuickSort def quick_sort(arr): start = 0 end = len(arr) - 1 __quick_sort(arr, start, end) def __quick_sort(arr, start, end): if start < end: pertition_index = __pertition(arr, start, end) __quick_sort(arr, start, pertition_index - 1) __quick_sort(arr, pertition_inde...
def heapify(array, size, index): largest = index left = 2 * index + 1 right = 2 * index + 2 if left < size and array[index] < array[left]: largest = left if right < size and array[largest] < array[right]: largest = right if largest != index: array[index], array[largest] ...
''' Description : Use Of Local Scope Function Date : 05 Feb 2021 Function Author : Prasad Dangare Input : Int Output : Int ''' x = 50 def func(x): print ('x is', x) x = 2 print ('Changed local x to', x) func(x) print ('x is still', x)
""" 321. Create Maximum Number Given two arrays of length m and n with digits 0-9 representing two numbers. Create the maximum number of length k <= m + n from digits of the two. The relative order of the digits from the same array must be preserved. Return an array of the k digits. Note: You should try to optimize yo...
catName1 = input() print('Enter the name of cat 2:') catName2 = input() print('Enter the name of cat 3:') catName3 = input() print('Enter the name of cat 4:') catName4 = input() print('Enter the name of cat 5:') catName5 = input() print('Enter the name of cat 6:') catName6 = input() print(catName1 + ' ' + catName2 + ' ...
# -*- coding: utf-8 -*- # # __init__.py # # This module is part of skxtend. # """ Initializer of skxtend tests. """ __author__ = 'Severin E. R. Langberg' __email__ = 'Langberg91@gmail.no' __status__ = 'Operational'
TYPE_NAME = "mock" def handler(value, **kwargs): return "mock"
# ETA represents the learning rate. Higher values penalize feature weights more strongly # Create your housing DMatrix: housing_dmatrix housing_dmatrix = xgb.DMatrix(data=X, label=y) # Create the parameter dictionary for each tree (boosting round) params = {"objective":"reg:linear", "max_depth":3} # Create list of e...
class ProjectAttributes: def __init__(self, project_instance): self.project_instance = project_instance self.proj_name = project_instance.get_project_name() self.proj_loc = project_instance.get_project_loc() self.source_file_count = len(project_instance.get_project_source_files().g...
""" Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ # Solution1: No more to say. class Solution: """ @param inorder: A list of integers that inorder traversal of a tree @param postorder: A list of integers that posto...
# GB :国家标准的缩写 def make_page_type(txt,doc_type): if "目次" in txt: return "GB_ML" if "术语" in txt and "条文说明" not in txt: return "GB_SY" else: return "GB_ZW"
# # PySNMP MIB module NBASE-EXP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NBASE-EXP-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:17:07 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
# # PySNMP MIB module EXTREME-LACP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EXTREME-LACP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:54:07 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
# Copyright (c) 2012 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. # This is used as the top-level gyp file for building WebView in the Android # tree. It should depend only on native code, as we cannot currently generat...
class Solution: # @param {integer[]} nums # @return {integer} def majorityElement(self, nums): candidate = None count = 0 for num in nums: if num == candidate: count += 1 elif count == 0: candidate = num count = ...
class Sql: custlist = "SELECT * FROM cust"; custlistone = "SELECT * FROM cust WHERE id= '%s' "; custinsert = "INSERT INTO cust VALUES ('%s','%s','%s')"; custdelete = "DELETE FROM cust WHERE id= '%s' "; custupdate = "UPDATE cust SET pwd='%s',name='%s' WHERE id='%s' "; itemlist = "SELECT * FROM i...
''' @author: Tibor Hercz // Tiboonn @Link: https://github.com/Tiboonn/AWS-DeepRacer @License: N/D ''' def reward_function(params): ''' Example of rewarding the agent to follow center line ''' # Read input parameters track_width = params['track_width'] distance_from_center = params[...
vowels = set(['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']) punc = set(['.', '!', '?', ' ']) while True: sIn = input().strip() lis = [] last = 0 for i, char in enumerate(sIn): if char in punc: if i - last > 0: lis.append(sIn[last: i]) last =...
""" Defines two dictionaries for converting between text and integer sequences. """ char_map_str = """ ' 0 <SPACE> 1 a 2 b 3 c 4 d 5 e 6 f 7 g 8 h 9 i 10 j 11 k 12 l 13 m 14 n 15 o 16 p 17 q 18 r 19 s 20 t 21 u 22 v 23 w 24 x 25 y 26 z 27 """ # the "blank" character is mapped to 28 char_map = {} index_map = {} for l...
# -*- coding: utf-8 -*- """ Escribir SCRIPT que pregunte el nombre del usuario en la consola y un numero entero e imprima por pantalla en lineas distintas el nombre del usuario tantas veces como el numero """ name = input("¿Como te llamas? ") # input campo de entrada de datos, en python no se pone el punto y com...
@graph def context_from_path(): sg = Shotgun() sgfs = SGFS(root=sandbox, shotgun=sg) fix = Fixture(sg) proj = fix.Project('Example Project') seq = proj.Sequence("AA") shot = seq.Shot('AA_001') step = fix.Step('Anm') task = shot.Task('Do Work', id=123, step=step) task2 = sho...
# -*- coding: utf-8 -*- def command(): return "create-farm" def init_argument(parser): parser.add_argument("--farm-name", required=True) parser.add_argument("--template-no", required=True) parser.add_argument("--comment") def execute(requester, args): farm_name = args.farm_name template_no = ...
#!/usr/bin/env python print("This is example file 3")
#!/usr/bin/env python ##################################### # Installation module for empire ##################################### # AUTHOR OF MODULE NAME AUTHOR="Ian Smith" # DESCRIPTION OF THE MODULE DESCRIPTION="This module will install/update Empire - post exploitation python/powershell for windows and nix/os...
def imosh_test( name, srcs=[], data=[], **kargs): if len(srcs) != 1: fail("Exactly one source file must be given.") native.genrule( name = name + "_genrule_sh", srcs = ["//bin:imosh_test_generate"], outs = [name + "_genrule.sh"], cmd = "$(BINDIR)/bin/imosh_test_generate "...
# -*- coding: utf-8 -*- name = 'usdview' version = '20.05' requires = [ 'pyside-1.2', 'usd-20.05', 'ocio_configs', 'turret_usd' ] def commands(): env.DEFAULT_USD.set('{root}/bin/DefaultUSD.usda')
'''5.10 Modifique o programa da listagem para que aceite respostas com letras maiúsculas e minúsculas em todas as questões. Listagem 5.10 – Contagem de questões corretas pontos = 0 questão = 1 while questão <= 3: resposta = input(f"Resposta da questão {questão}: ") if questão == 1 and resposta == "b": ...
def make_ends(nums): first = nums[0] last = nums[len(nums)-1] newArr = [] newArr.append(first) newArr.append(last) return newArr
class EnumBase(object): class Meta: allowed_types = tuple() zero_value = None @classmethod def names(klass, with_zero_value=True): def _get_names(): names = [] for n in dir(klass): if '__' not in n and n != 'Meta': value = getattr(klass, n) if isinstance(value,...
# intro to function def my_function(): print("Hello, this is function") # calling function my_function()
class Solution: def numDifferentIntegers(self, word: str) -> int: stripped = {} i = 0 for c in word: if c in {"0":1, "1":1, "2":1, "3":1, "4":1, "5":1, "6":1, "7":1, "8":1, "9":1}: if i in stripped: if stripped[i] == "0": ...
# -*- coding: utf-8 -*- # 定义函数 def my_abs(x): if x >= 0: return x else: return -x print('end.') #永远也不会执行 print(my_abs(-10)) def nop(): pass def my_opt_abs(x): if not isinstance(x, (int, float)): raise TypeError('bad operand type for my_opt_abs(): %s' % type(x)) if x >= 0: return x else: return -x ...
""" Illustrates how to embed Beaker cache functionality within the Query object, allowing full cache control as well as the ability to pull "lazy loaded" attributes from long term cache as well. In this demo, the following techniques are illustrated: * Using custom subclasses of Query * Basic technique of circumvent...
## @package serde # Module caffe2.python.predictor.serde def serialize_protobuf_struct(protobuf_struct): return protobuf_struct.SerializeToString() def deserialize_protobuf_struct(serialized_protobuf, struct_type): deser = struct_type() deser.ParseFromString(serialized_protobuf) r...
# You can import and use this in a DAG in the parent folder like usual in # Python, i.e. `import python_callables.compliance` def check_port_22_open(): pass
#!/usr/bin/python with open("vita.md") as fp: lines = fp.readlines() lines2 = lines[6:] lines3 = lines[8:] # print lines2 with open("vita_noyaml.md", "w") as fp: fp.writelines(lines2) # print lines3 with open("vita_noyaml_nocvaspdf.md", "w") as fp: fp.writelines(lines3) # onepage with open("vita_onepa...
__author__ = 'nikaashpuri' ''' TCP_SERVER_IP = '162.251.84.104' SYSTEM_PATH_TO_APPEND = '/public_html/aquabrim_project' LOG_FILE_LOCATION = '/logs/django_log' TCP_SERVER_FILE_PATH = '/public_html/aquabrim_project/machine/tcp_ip_server.py' DATABASE_PATH = '/sites_database/dev.db' ''' TCP_SERVER_IP = 'localhost' LOG_FI...
class Solution: # @param candidates, a list of integers # @param target, integer # @return a list of lists of integers def combinationSum(self, candidates, target): if not candidates: return [] candidates.sort() n = len(candidates) res = [] def solve...
# Unless explicitly stated otherwise all files in this repository are licensed # under the Apache License Version 2.0. # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2018 Datadog, Inc. # (C) Datadog, Inc. 2010-2016 # All rights reserved # Licensed under Simplified BSD L...
# !/usr/bin/env python3 # -*- cosing: utf-8 -*- fileptr = open("file2.txt", "a") fileptr.write("Python has an easy syntax and user-friendly interaction.") fileptr.close()
main_menu = [ ["1", "Spam Tools", "Amino-Tools"], ["2", "Chat Tools"], ["3", "Activity Tools"], ["4", "profile Tools"], ["5", "raid Tools"], ["0", "Exit"] ] spam_tools_menu = [ ["1", "Spam Bot", "Amino-Tools"], ["2", "Wiki Spam Bot"], ["3", "Wall Spam Bot"], ["4", "Blog Spam Bot"] ] chat_tools_menu = [ [...
#Faça um programa com uma função chamada somaImposto. A função possui dois parâmetros formais: taxaImposto, que é a quantia de imposto sobre vendas expressa em porcentagem e custo, que é o custo de um item antes do imposto. A função “altera” o valor de custo para incluir o imposto sobre vendas. def somaImposto(taxaImp...
# Good morning! Here's your coding interview problem for today. # This problem was asked by Google. # A unival tree (which stands for "universal value") is a tree where all nodes under it have the same value. # Given the root to a binary tree, count the number of unival subtrees. # For example, the following tree has 5...
""" By default, Disco looks at an input URL and extracts its scheme in order to figure out which input stream to use. When Disco determines the URL scheme, it tries to import the name `input_stream` from `disco.schemes.scheme_[SCHEME]`, where `[SCHEME]` is replaced by the scheme identified. For instance, an input URL ...
# -*- coding: utf-8 -*- # 声明字典 dict1 = {'key1': 'value1', 'key2': 1} print("字典示例:" + str(dict1)) # 添加键值对 dict1['key3'] = 'value3' print("添加键值对后:" + str(dict1)) # 修改键对应的值 dict1['key1'] = 'new_value1' print("修改键对应值后:" + str(dict1)) # 删除键值对 del dict1['key1'] print("删除键值对后:" + str(dict1)) # 遍历字典 for key, value in dict...
# Natural Language Toolkit: Shoebox Errors # # Copyright (C) 2001-2006 NLTK Project # Author: Stuart Robinson <Stuart.Robinson@mpi.nl> # URL: <http://www.nltk.org/> # For license information, see LICENSE.TXT """ This module provides Shoebox exceptions. """ # -----------------------------------------------------------...
#Declare variables to hold the file name and access mode fileName = "GuestList.txt" accessMode = "w" #Open the file for writing myFile = open(fileName, accessMode) #Write the guest names and ages to the file #I can write an entire record in one write statement myFile.write("Doyle McCarty,27\n") myFile.write("Jodi M...
""" fizzbuzz for 1 to 100 fizz on 3 buzz on 5 fiizzbuzz on 15 """ for i in range(1, 101): if i % 15 == 0: print("fizzbuzz") continue if i % 3 == 0: print('fizz') continue if i % 5 == 0: print('buzz') continue print(i)
################################################## # This script was written to present informations and conditionals about my hometown, Goiânia, # as the second submission for the pre-course of Programming at IAAC, by professor Diego Pajarito. ################################################## # ######################...
#Date: 033122 #Difficulty: Medium class Solution(object): def longestPalindrome(self, s): """ :type s: str :rtype: str """ start=end=0 for i in range(len(s)): length1=self.expandFromMiddle(s,i,i) length2=self.expandFromMiddle(s,i,i+1) ...
def set_dimensions(dimensions): """ Set properly dimensions that we want to load @dimensions: list """ result = [] for i in dimensions: d = { 'name': i } result.append(d) return result def set_metrics(metrics): """ Set properly metrics that we wa...
# based on: https://github.com/tigertv/secretpy/blob/master/secretpy/ciphers/autokey.py class cipher_autokey: def process(self, alphabet, key, text, isEncrypt): ans = "" for i in range(len(text)): m = text[i] if i < len(key): k = key[i] else: ...
class Settings: """ The Settings class offer a convenient method to child class to attribute values from a dictionary to the class variables for which name and key match """ def setProperties(self, settings: dict): """ set variable value with dictionary value if the key is the same ...
""" Note: V 1.0.0 Originally, filling data methods was developed by Eric Alfaro and Javier Soley in SCILAB Python version was developed by Rolando Duarte and Erick Rivera Centro de Investigaciones Geofísicas (CIGEFI) Universidad de Costa Rica (UCR) """ """ MIT License Copyright 2021 Rolando Jesus Dua...
class User: user_list =[] user_list = [] def __init__(self, user_name, email, password): ''' saving user credentials into user_list for login ''' self.user_name = user_name self.email = email self.password = password def sav...
# @Fábio C Nunes - 19.06.20 pessoa = {} grupo = [] media = 0 lista_mulheres = [] while True: #Entrada de dados. print('-' * 20) print('Cadastro de pessoas') pessoa['nome'] = str(input('Nome: ')) pessoa['idade'] = int(input('Idade: ')) sexo = ' ' while sexo not in 'MF': sexo = str(inp...
init_config = { 'username': 'email@gmail.com', 'pwd': 'password', 'mongodb': { 'host': 'mongodb://localhost:27017/' } }
#!/usr/bin/env python __all__ = ["dendrogram", "dotplot", "drawable", "letter", "logo"] __copyright__ = "Copyright 2007-2020, The Cogent Project" __contributors__ = [ "Peter Maxwell", "Gavin Huttley", "Rob Knight", "Zongzhi Liu", "Matthew Wakefield", "Stephanie Wilson", "Rahul Ghangas", ...
# # PySNMP MIB module Dell-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Dell-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:55:18 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:1...
description = 'setup for the cache server' group = 'special' devices = dict( DB=device('nicos.services.cache.server.FlatfileCacheDatabase', description='On disk storage for Cache Server', storepath=configdata('config.DATA_PATH') + 'cache', loglevel='info', ), Server=de...
# 1.5 Find One Missing Number from 1 to 10 def find_missing_number(list_numbers): list_sum = 0 for number in list_numbers: list_sum += number return 55 - list_sum
# -*- coding: utf-8 -*- # Copyright: (c) 2016 Michael Gruener <michael.gruener@chaosmoon.net> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) class ModuleDocFragment(object): # Standard files documentation fragment DOCUMENTATION = r''' notes: - "If a new enough...
## Prime number is divide by 1 and itself ## Display 50 prime numbers in 5 lines, each containing 10 numbers NUMBER_OF_PRIMES = 50 # Number of primes to display NUMBER_OF_PRIMES_PER_LINE = 10 # Display 10 per line count = 0 # Count number of prime numbers number = 2 # a number to test prime number while count < NUMB...
""" C++ FOREVER """ def hello(): """ UNREACHABLE GNU Lesser General Public License v3.0 http://opensource.org/licenses/MIT-LICENSE """ print("Haskell TOP")
"""Arbre binaire - Application""" # Fonctions utilitaires # fonction 'arbre_binaire(r)' : construit un arbre sous forme de liste qui contient un noeud racine avec 2 sous-arbres vides (valeur à None) def arbre_binaire(r): return [r, [None], [None]] # fonction 'change_racine(arbre, valeur)' : change l...
""" 🚧 About -------- dev is a collection of Python developer tools presented as a modest alternative to the standard library's offering. .. warning:: dev is a work in progress Testing ------- :py:mod`dev.libtest` is a protocol driven testing library. Users need not import libtest in order to define their tests, o...
a =[72,73,75,84,85,87,104,105,107,116,117,119] b =[97,98,99,100,101,102,103] c =[97,98,99,100,101,103,106] d =[65,72,74,75,77,79,90,97,104,106,107,109,111,122] e =[66,67,78,79,84,85,88,89,98,99,110,111,116,117,120,121] f =[104,105,106,107,108,109,110,111] g =[112,113,114,117,118,119] res = [bytearray([a1, b1, ...
try: a = int(input('Numerador: ')) b = int(input('Denominador: ')) r = a / b except Exception as erro: print(f'Problema encontrado foi {erro}') else: print(f'O resultado é {r}') finally: print('O comando foi executado!')
class AttnDecoderRNN(nn.Module): def __init__(self, dec_hidden_size, enc_hidden_size, dec_output_size, dropout_p=0): super(AttnDecoderRNN, self).__init__() self.hidden_size = dec_hidden_size self.output_size = dec_output_size self.dropout_p = dropout_p self.lin_decoder = nn...
class FailureMessageAccessor(object,IDisposable): """ Restricted accessor for FailureMessage. """ def CloneFailureMessage(self): """ CloneFailureMessage(self: FailureMessageAccessor) -> FailureMessage Creates a copy of the FailureMessage. Returns: Copy of the FailureMesassge. """ pass d...
""" This module provides the Status class, which encapsulates a status code for Icinga. """ class Status(object): """ Encapsulates an Icinga status, which holds a name and an exit code. """ def __init__(self, name, exit_code): """ Creates a new status object for Icinga with the gi...
_base_ = [ '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] model = dict( type='FasterRCNN', backbone=dict( type='SwinTransformer', embed_dims=128, depths=[2, 2, 18, 2], num_heads=[4, 8, 16, 32], window_size=7, mlp_ratio=4, qkv_bias=True, ...
#!/usr/bin/env python3 # '+=' for variables, this operator adds a value to, # then sets variable name to new value. # this formula shortcut can be used with any # mathmatical operator. # string example y = 'one' y += 'two' # adding to and equaling print(y) # int example x = 1 # x has value of one x += 2 # same as x...
class SimpleButton(object): """Represents a single button that is connected to the ESP32""" def __init__(self, pin): self.pin = pin def read_pressed(self): print("Reading button on pin {}".format(self.pin)) # TODO: Actually call MicroPython code to get the value return Fa...
def execute(fn, *args): return fn(*args) def say_hello(name, my_name): print(f"Hello, {name}, I am {my_name}") def say_bye(name): print(f"Bye, {name}") execute(say_hello, "Peter", "George") execute(say_bye, "Peter")
# -*- coding: utf-8 -*- """ Created on Mon Oct 25 11:35:11 2021 @author: shangfr """ def ui_prediction(): pass if __name__ == "__main__": ui_prediction()
#Write a function that finds if a given string argument is Palindrome. A Palindrome string is equal to its reverse, that is its reading is the same backward as forward. #For example: efe, hannah, ava, anna are palindromes. #Test your function with above examples and test with at least 3 different # non-Palindrome exa...
CATEGORIES = [ ('SOLUTIONS', 'SOLUTIONS'), ('PRODUITS', 'PRODUITS'), ('PARTENAIRES', 'PARTENAIRES'), ('INVESTISSEURS', 'INVESTISSEURS'), ] SECTEUR_ENTREPRISES = [ ('Agroalimentaire', 'Agroalimentaire'), ('Banque / Assurance', 'Banque / Assurance'), ('Bois / Papier / Carton / Imprimerie', '...
c_keyword_set = { 'auto', 'break', 'case', 'char', 'const', 'continue', 'default', 'define', 'do', 'double', 'elif', 'else', 'endif', 'enum', 'error', 'extern', 'float', 'for', 'goto', 'if', 'ifdef', 'ifndef', 'include', 'in...
# Copyright 2017 The Forseti Security 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 ap...
__version_tuple__ = (0, 6, 0, 'alpha.5') __version__ = '0.6.0-alpha.5' __version_tuple_js__ = (0, 6, 0, 'alpha.4') __version_js__ = '0.6.0-alpha.4' # kept for embedding in offline mode, we don't care about the patch version since it should be compatible __version_threejs__ = '0.97'
def read(): for dx in [1, 3, 5, 7]: x = 0 tree = 0 with open('input.txt') as fh: first_line = True for line in fh.readlines(): if first_line: first_line = False continue x = (x + dx) % len(line.s...
""" dict functions """ def flatten_dict(nested: dict) -> dict: """Take a nested dictionary and flatten it. For example: {'a': {'b': 'c'}} will be flattened to {'a_b': c} Args: nested: a dictionary to be flattened Returns: Dict. flattened version of the original dictionary """ ...
class Solution: def dfs(self, s): if(s == len(self.graph) - 1): self.path.append(len(self.graph)-1) self.res.append(self.path[::]) self.path.pop() return; self.path.append(s) for i in range(len(self.graph[s])): sel...
""" # REPEATED DNA SEQUENCES All DNA is composed of a series of nucleotides abbreviated as 'A', 'C', 'G', and 'T', for example: "ACGAATTCCG". When studying DNA, it is sometimes useful to identify repeated sequences within the DNA. Write a function to find all the 10-letter-long sequences (substrings) that occur more...