content
stringlengths
7
1.05M
expected_output = { 'instance': { 'default': { 'vrf': { 'red': { 'address_family': { '': { 'prefixes': { '11.11.11.11/32': { 'avail...
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode: if not headA or not headB: return None # compute th...
def list_users_in_account(request_ctx, account_id, search_term=None, include=None, per_page=None, **request_kwargs): """ Retrieve the list of users associated with this account. @example_request curl https://<canvas>/api/v1/accounts/self/users?search_term=<search value> \ ...
# Autogenerated file for HID Mouse # Add missing from ... import const _JD_SERVICE_CLASS_HID_MOUSE = const(0x1885dc1c) _JD_HID_MOUSE_BUTTON_LEFT = const(0x1) _JD_HID_MOUSE_BUTTON_RIGHT = const(0x2) _JD_HID_MOUSE_BUTTON_MIDDLE = const(0x4) _JD_HID_MOUSE_BUTTON_EVENT_UP = const(0x1) _JD_HID_MOUSE_BUTTON_EVENT_DOWN = cons...
def is_substitution_cipher(s1, s2): dict1={} dict2={} for i,j in zip(s1, s2): dict1[i]=dict1.get(i, 0)+1 dict2[j]=dict2.get(j, 0)+1 if len(dict1)!=len(dict2): return False return True
"""properties.py module""" DEFAULT_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)" DEFAULT_FILE_NAME = ".secret.txt" DEFAULT_LENGTH_OF_SECRET_KEY = 50
# A program to rearrange array in alternating positive & negative items with O(1) extra space class ArrayRearrange: def __init__(self, arr, n): self.arr = arr self.n = n def rearrange_array(self): arr = self.arr.copy() out_of_place = -1 for i in range(self.n): ...
expected_output = { 'pid': 'WS-C4507R', 'os': 'ios', 'platform': 'cat4k', 'version': '12.2(18)EW5', }
# -*- coding: utf-8 -*- """ Created on Wed Sep 22 17:22:59 2021 Default paths for the different folders. Should be changed priori to any computation. @author: amarmore """ # RWC path_data_persisted_rwc = "C:/Users/amarmore/Desktop/data_persisted" ## Path where pre-computed data on RWC Pop should be stored (spectrogra...
# -*- coding: utf-8 -*- # @Brief: 配置文件 train_data_path = "./Omniglot/images_background/" test_data_path = "./Omniglot/images_evaluation/" summary_path = "./summary" batch_size = 4 val_batch_size = 20 epochs = 10 inner_lr = 0.02 outer_lr = 0.0001 n_way = 5 k_shot = 1 q_query = 1 input_shape = (28, 28, 1)
#!/usr/bin/env python # -*- coding: utf-8 -*- """http://www.testingperspective.com/wiki/doku.php/collaboration/chetan/designpatternsinpython/chain-of-responsibilitypattern""" class Handler: def __init__(self): self._successor = None def successor(self, successor): self._successor = succ...
""" A block cipher is a method of encrypting text, in which a cryptographic key and algorithm are applied to a block of data (for example, 64 contiguous bits) at once as a group rather than to one bit at a time. A block cipher is a deterministic algorithm operating on fixed-length groups of bits, called a block, with ...
_MAJOR = 0 _MINOR = 6 _PATCH = 4 __version__ = str(_MAJOR) + '.' + str(_MINOR) + '.' + str(_PATCH) def version(): ''' Returns a string representation of the version ''' return __version__ def version_tuple(): ''' Returns a 3-tuple of ints that represent the version ''' return (_MAJO...
#!/usr/bin/env python3 # https://www.hackerrank.com/challenges/python-lists/ if __name__ == '__main__': N = int(input()) lst = [] for i in range(N): cmd = input().rstrip().split() if(cmd[0] == 'insert'): lst.insert(int(cmd[1]), int(cmd[2])) elif(cmd[0] == 'print'): ...
class Solution: def minSwap(self, A: List[int], B: List[int]) -> int: n1, s1 = 0, 1 for i in range(1, len(A)): n2 = s2 = float("inf") if A[i - 1] < A[i] and B[i - 1] < B[i]: n2 = min(n2, n1) s2 = min(s2, s1 + 1) if A[i - 1] < B[i] a...
__author__ = 'xelhark' class ErrorWithList(ValueError): def __init__(self, message, errors_list=None): self.errors_list = errors_list super(ErrorWithList, self).__init__(message) class ModelValidationError(ErrorWithList): pass class InstanceValidationError(ErrorWithList): pass
config = { "username": "", "password": "", "phonename": "iPhone", "sms_csv": "" }
# Faça um programa que peça um numero inteiro positivo e em seguida mostre este numero invertido. # Exemplo: # 12376489 # => 98467321 print('Invertendo numeros') nota = input('Informe um numero: ') numeroInvertido = nota[::-1] print(numeroInvertido)
class BitDocument: """Wrapper for Firestore document (https://firebase.google.com/docs/firestore/reference/rest/v1beta1/projects.databases.documents) """ def __init__(self, doc): self.id = doc['id']['stringValue'] self.title = self._get_field(doc, 'title', 'stringValue', '') self.co...
mylist = list() def maior(*lst): m = 0 print(f'Os valores informados foram -> ', end=' ') for i, v in enumerate(lst[0]): print(v, end=' ') if i == 0: m = v else: if v > m: m = v print(f'\nO maior valor informado foi {m}') while True: ...
#This program takes in a postive integer and applies a calculation to it. # It then outputs a sequence that ends in 1 #creates a list called L mylist=[] #take the input for the user value = int(input("Please enter a positive integer: ")) # Adds the input to the list. # The append wouldnt work unless I made i an int ...
class Aritmatika: @staticmethod def tambah(a, b): return a + b @staticmethod def kurang(a, b): return a - b @staticmethod def bagi(a, b): return a / b @staticmethod def bagi_int(a, b): return a // b @staticmethod def pangkat(a, b): ret...
# Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'. # A region is captured by flipping all 'O's into 'X's in that surrounded region. def solve(board): """ Do not return anything, modify board in-place instead. """ if not board: return board nrow = len(bo...
#Exercise 1: Revise a previous program as follows: Read and parse the #“From” lines and pull out the addresses from the line. Count the number of messages from each person using a dictionary. #After all the data has been read, print the person with the most commits #by creating a list of (count, email) tuples from t...
# Aula 7 n1 = int(input('Digite um número inteiro: ')) n2 = int(input('Digite outro número inteiro: ')) s = n1 + n2 sub = n1 - n2 m = n1 * n2 d = n1 / n2 di = n1 // n2 r = n1 % n2 e = n1 ** n2 print('A soma dos números {} e {} é igual a {}.'.format(n1, n2, s), end=' ') # end='' serve para não pular linha. Para pular, u...
def calculate_similarity(my, theirs, tags): similarity = {} for group in ('personal', 'hobbies'): all_names = {tag.code for tag in tags if tag.group == group} my_names = all_names & my their_names = all_names & theirs both = my_names | their_names same = my_names & their_...
""" :copyright: (c) 2020 Yotam Rechnitz :license: MIT, see LICENSE for more details """ class Average: def __init__(self, js: dict): self._allDamageDoneAvgPer10Min = js["allDamageDoneAvgPer10Min"] if "allDamageDoneAvgPer10Min" in js else 0 self._barrierDamageDoneAvgPer10Min = js[ "barr...
# Method 1: using index find the max first, and then process def validMountainArray(self, A): if len(A) < 3: return False index = A.index(max(A)) if index == 0 or index == len(A) -1: return False for i in range(1, len(A)): if i <= index: if A[i] <= A[i - 1]: return False els...
# 69. Sqrt(x) Easy # 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 # Exampl...
class Line(object): """Represents a line on the road, which consists of a list of coordinates. Attributes: line_id: an integer indicating which line this is. coordinates: a list of tuples indicating the coordinates on the line. """ def __init__(self, line_id, coordinates): """I...
class UncleEngineer: ''' test = UncleEngineer() test.art() ''' def __init__(self): self.name = 'Uncle Engineer' def art(self): asciiart = ''' Z Z .,., z ...
class Vscode(): def execute(self): print("code is compiling and code is running") class Pycharm(): def execute(self): print("code is compiling and code is running") class python(): def execute(self): print("python is using") class CPP(): def execute(self): print("C++ is usi...
n = int(input('Digite um número inteiro: ')) print() print('Escolha uma das bases para conversão:') print(' [ 1 ] Converte para BÍNARIO') print(' [ 2 ] Converte para OCTAL') print(' [ 3 ] Converte para HEXADECIMAL') print() opcao = int(input('ESCOLHA SUA OPÇÃO: ')) if (opcao >= 1) and (opcao <= 3): if opcao ==...
#! /usr/bin/python __version__ = "0.1.0" __description__ = "Connection facilitator" __logo__ = """ ___ ____ ____ __ ____ __ __ ___ / __)(_ _)( _ \ /__\ (_ _)( )( )/ __) \__ \ )( ) / /(__)\ )( )(__)( \__ \\ (___/ (__) (_)\_)(__)(__)(__) (______)(___/ """ PORT = 5678 TIME_OUT = 20 BIND_TIME = 0....
# -*- coding: utf-8 -*- """ Created on Wed Dec 4 10:28:28 2019 @author: Paul """ def generate_passwords(start, stop): """ Generates and returns a list strings of all possible passwords in the range start-stop, meeting the following requirements: - Passwords are six digit num...
nums = [2, 3, 4, 5, 7, 10, 12] for n in nums: print(n, end=", ") class CartItem: def __init__(self, name, price) -> None: self.price = price self.name = name def __repr__(self) -> str: return "({0}, ${1})".format(self.name, self.price) class ShoppingCart: def __init__(self) -> None: se...
# Given a non-empty string and an int n, return a new string where the char at index n has been removed. The value of n will be a valid index of a char in the original string (i.e. n will be in the range 0..len(str)-1 inclusive). # missing_char('kitten', 1) → 'ktten' # missing_char('kitten', 0) → 'itten' # missing_ch...
highest_seat_id = 0 with open("input.txt", "r") as f: lines = [line.rstrip() for line in f.readlines()] for line in lines: rows = [0, 127] row = None columns = [0, 7] column = None for command in list(line): if command == "F": rows = [rows[0]...
# -*- coding:utf-8 -*- # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: # 返回对应节点TreeNode def KthNode(self, pRoot, k): # write code here if k ==0 or pRoot is None: return None stack = [...
#! /usr/bin/env python """ Make a small MDV file containing a grid with X and Y axes in degrees. Partial grid is taken from full sized file 000000.mdv which is contained in the 200202.MASTER15.mdv.tar.gz file available online at: http://www2.mmm.ucar.edu/imagearchive/WSI/mdv/ """ # The MDV RLE decoding routine ends at...
class Vertex: def __init__(self, label: str = None, weight: int = float("inf"), key: int = None): self.label: str = label self.weight: int = weight self.key: int = key
class Solution: def dfs(self, s:str, n:int, pos:int, sub_res:list, total_res:list, left:int): if left == 0 and pos >= n: total_res.append(sub_res[:]) return if left == 0 and pos < n: return if pos < n and s[pos] == '0': sub_res.append(s[pos]) ...
collection = ["gold", "silver", "bronze"] # list comprehension new_list = [item.upper for item in collection] # generator expression # it is similar to list comprehension, but use () round brackets my_gen = (item.upper for item in collection)
grader_tools = {} def tool(f): grader_tools[f.__name__] = f return f @tool def percentage(x, y): """ Convert x/y into a percentage. Useful for calculating success rate Args: x (int) y (int) Returns: str: percentage formatted into a string """ return '%.2f%%' %...
# This is where all of our model classes are defined class PhysicalAttributes: def __init__(self, width=None, height=None, depth=None, dimensions=None, mass=None): self.width = width self.height = height self.depth = depth self.dimensions = dimensions self.mass = mass ...
class Identifier(object): def __init__(self, name, value, declared=False, id_type=None, constant=False): self.name = name self.value = value self.declared = declared self.type = id_type self.constant = constant def __str__(self): return self.name
# -*- coding: utf-8 -*- """ Created on Thu Dec 28 21:34:17 2017 @author: chen """ # Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None # class Solution(object): # def hasCycle(self, head): # """ # :type head: ListNod...
def mostra_adicionais(*args): telaProduto = args[0] cursor = args[1] QtWidgets = args[2] telaProduto.frame_adc.show() listaAdc = [] sql1 = ("select * from adcBroto") cursor.execute(sql1) dados1 = cursor.fetchall() sql2 = ("select * from adcSeis ") cursor.execute(sql2) dados...
""" describe all supported datasets. """ DATASET_LSUN = 0x00010000 DATASET_LSUN_BEDROOM_TRAINING = DATASET_LSUN + 0x00000000 DATASET_LSUN_BEDROOM_VALIDATION = DATASET_LSUN + 0x00000001 DATASET_LSUN_BRIDGE_TRAINING = DATASET_LSUN + 0x00000002 DATASET_LSUN_BRIDGE_VALIDATION = DATASET_LSUN + 0x00000003 DATASET_LSUN_CHUR...
n1 = float(input('Primeiro número da subtraçâo:')) n2 = float(input('Segundo número da subtraçâo:')) n3 = float(input('Terceiro número da subtraçâo:')) print('O resultado da subtraçâo é: {}'.format(n1 - n2 - n3))
#!/usr/bin/env pyrate foo_obj = object_file('foo_obj', ['foo.cpp'], compiler_opts = '-O3') executable('example07.bin', ['test.cpp', foo_obj])
#! /usr/bin/python Ada, C, GUI, SIMULINK, VHDL, OG, RTDS, SYSTEM_C, SCADE6, VDM, CPP = range(11) thread, passive, unknown = range(3) PI, RI = range(2) synch, asynch = range(2) param_in, param_out = range(2) UPER, NATIVE, ACN = range(3) cyclic, sporadic, variator, protected, unprotected = range(5) enumerated, sequenceo...
# Copyright 2019 The LUCI Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 # that can be found in the LICENSE file. PYTHON_VERSION_COMPATIBILITY = 'PY2+3' DEPS = [ 'futures', 'step', ] def RunSteps(api): futures = [] for i in range(10): def _runne...
""" hello module """ __version__ = '0.7.0dev'
'''Defines the `google_java_format_toolchain` rule. ''' GoogleJavaFormatToolchainInfo = provider( fields = { "google_java_format_deploy_jar": "A JAR `File` containing Google Java Format and all of its run-time dependencies.", "colordiff_executable": "A `File` pointing to `colordiff` executable (in ...
#!/usr/bin/python # -*- coding: utf-8 -*- DOCUMENTATION = """ --- module: lilatomic.api.http short_description: A nice and friendly HTTP API description: - An easy way to use the [requests](https://docs.python-requests.org/en/master/) library to make HTTP requests - Define connections and re-use them across tasks...
def getScore(savings, monthly, bills, cost, payDay): score = 0 if cost > savings: score = 0 elif savings < 1000: score = savings/pow(cost,1.1) else: a = savings/(cost*1.1) score += (1300*(monthly-bills))/(max(1,a)*pow(cost,1.1)*pow(payDay,0.8)) + (30*savings)/(p...
#!/usr/bin/env python # 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 # #...
# coding: utf-8 ########################################################################## # NSAp - Copyright (C) CEA, 2019 # Distributed under the terms of the CeCILL-B license, as published by # the CEA-CNRS-INRIA. Refer to the LICENSE file or to # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html # for det...
s=input("Enter string: ") word=s.split() word=list(reversed(word)) print("OUTPUT: ",end="") print(" ".join(word))
# encoding: utf-8 __author__ = "Patrick Lampe" __email__ = "uni at lampep.de" class Point: def __init__(self, id, location): self.id = id self.location = location def getId(self): return self.id def get_distance_in_m(self, snd_node): return self.get_distance_in_km(snd_n...
# x_8_6 # # result = 70 if 0 <= result <= 40: print('追試です') elif 40 < result <= 60: print('頑張りましょう') elif 60 < result <= 80: print('まずまずです') elif 85 < result <= 100: print('よくできました')
""" Error and Exceptions in the SciTokens library """ class MissingKeyException(Exception): """ No private key is present. The SciToken required the use of a public or private key, but it was not provided by the caller. """ pass class UnsupportedKeyException(Exception): """ Key is pre...
# Given a linked list, remove the n-th node from the end of list and return its head. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def removeNthFromEnd(self, head: ListNode, n: int): # maintaining dummy to resolve edge cases ...
def write_data_to_es(): df = update_preprocessing_data() try: # df 출력 스키마대로 뽑기 df = df[['timestamp', 'hostname', 'program', 'pid', 'path', 'message', 'score', 'is_anomaly']] df['timestamp'] = pd.to_datetime(df['timestamp']) # df['timestamp'] = datetime.datetime.strptime(df['times...
def bmi_calculator(weight, height): ''' Function calculates bmi according to passed arguments weight (int or float) = weight of the person; ex: 61 or 61.0 kg height (float) = height of the person, in meter; ex: 1.7 m ''' bmi = weight / (height**2) return bmi
class VertexWeightProximityModifier: falloff_type = None mask_constant = None mask_tex_map_object = None mask_tex_mapping = None mask_tex_use_channel = None mask_tex_uv_layer = None mask_texture = None mask_vertex_group = None max_dist = None min_dist = None proximity_geometr...
class Solution: def trimMean(self, arr: List[int]) -> float: count = int(len(arr) * 0.05) arr = sorted(arr)[count:-count] return sum(arr) / len(arr)
class Solution: # @return a list of integers def getRow(self, rowIndex): row = [] for i in range(rowIndex+1): n = i+1 tmp = [1]*n for j in range(1, n-1): tmp[j] = row[j-1] + row[j] row = tmp return row
def get_twos_sum(result, arr): i, k = 0, len(arr) - 1 while i < k: a, b = arr[i], arr[k] res = a + b if res == result: return (a, b) elif res < result: i += 1 else: k -= 1 def get_threes_sum(result, arr): arr.sort() for i in r...
# Skill: Bitwise XOR #Given an array of integers, arr, where all numbers occur twice except one number which occurs once, find the number. Your solution should ideally be O(n) time and use constant extra space. #Example: #Input: arr = [7, 3, 5, 5, 4, 3, 4, 8, 8] #Output: 7 #Analysis # Exploit the question of all numbe...
email = input("What is your email id ").strip() user_name = email[:email.index('@')] domain_name = email[email.index('@')+1:] result = "Your username is '{}' and your domain is '{}'".format(user_name, domain_name) print(result)
def step(part, instruction, pos, dir): c, n = instruction if c in "FNEWS": change = {"N": 1j, "E": 1, "W": -1, "S": -1j, "F": dir}[c] * n if c == "F" or part == 1: return pos + change, dir else: return pos, dir + change else: return pos, dir * (1j - 2j...
#!/usr/bin/env python # coding: utf-8 def mi_funcion(): print("una funcion") class MiClase: def __init__(self): print ("una clase") print ("un modulo")
# url 数据去重 class DistinctPipeline(object): def __init__(self): #set为集合,集合为数据不重复无排序的 self.existedUrls = set() def is_similar(self, sourceUrl, targetUrl): ''' 判断两个 Url 是否相似,如果相似则忽略,否则保留 ''' pass def process_item(self, url): # 如果数据已经存在,则返回 False,忽略 ...
NON_RELATION_TAG = "NonRel" BRAT_REL_TEMPLATE = "R{}\t{} Arg1:{} Arg2:{}" EN1_START = "[s1]" EN1_END = "[e1]" EN2_START = "[s2]" EN2_END = "[e2]" SPEC_TAGS = [EN1_START, EN1_END, EN2_START, EN2_END]
class InvalidEpubException(Exception): '''Exception class to hold errors that occur during processing of an ePub file''' archive = None def __init__(self, *args, **kwargs): if 'archive' in kwargs: self.archive = kwargs['archive'] super(InvalidEpubException, self...
S = input() if S == 'RRR': print(3) elif S.find('RR') != -1: print(2) elif S == 'SSS': print(0) else: print(1)
class SpecialOffer: """ Represents a special offer that can be done by a supermarket. Attributes: count(int): number of items needed to perform the special offer. price(int): new price for the count of items. free_item(<StockKeepingUnit>): the special offer instead of a different price...
#Dette er det Første Kapitelet i boken WIDTH = 800 HEIGHT = 600 player_x = 600 player_y = 350 def draw(): screen.blit(images.backdrop, (0, 0)) screen.blit(images.mars, (50, 50)) screen.blit(images.astronaut, (player_x, player_y)) screen.blit(images.ship, (550, 300)) def game_loop(): global play...
""" Wrappers for the `torch.nn.Module` class, and can be used to parameterize policy functions, value functions, cost functions, etc. for use in reinforcement learning and imitation learning algorithms. To create a custom network, see `BaseNetwork` for more details. """
# These are the compilation flags that will be used in case there's no # compilation database set. flags = [ '-Wall', '-Wextra', '-std=c++14', '-stdlib=libc++', '-x', 'c++', '-I', '.', '-I', 'include', '-isystem', '/usr/include/c++/v1', '-isystem', '/usr/include' ] def FlagsForFile...
# -*- coding: utf-8 -*- # Copyright (C) 2014-2016 Andrey Antukh <niwi@niwi.nz> # Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net> # Copyright (C) 2014-2016 Anler Hernández ...
def test(): assert ( 'spacy.blank("es")' in __solution__ ), "¿Creaste el modelo de español en blanco?" assert ( len(nlp.pipe_names) == 1 and nlp.pipe_names[0] == "ner" ), "¿Añadiste el entity recognizer al pipeline?" assert ( len(ner.labels) == 1 and ner.labels[0] == "ROPA" ...
# Link to the problem: http://www.spoj.com/problems/ANARC09A/ def main(): n = input() count = 1 while n[0] != '-': o, c, ans = 0, 0, 0 for i in n: if i == '{': o += 1 elif i == '}': if o > 0: o -= 1 ...
""" @author Yuto Watanabe @version 1.0.0 Copyright (c) 2020 Yuto Watanabe """
class RunResultError(Exception): """Exception thrown when running a command fails""" def __init__(self, runresult): super(RunResultError, self).__init__(str(runresult)) self.runresult = runresult class MatchError(Exception): """Exception for output match errors""" def __init__(self, ...
# Credits: # 1) https://gist.github.com/evansneath/4650991 # 2) https://www.tutorialspoint.com/How-to-convert-string-to-binary-in-Python def crc(msg, div, code='000'): # Append the code to the message. If no code is given, default to '000' msg = msg + code # Convert msg and div into list form for easier ...
class Employee: """This class represents employees in a company """ num_of_employees = 0 #public static attribute # init method or constructor def __init__(self , first , last , pay): self._first = first #protected Attribute self._last = last #protected Attribute self._pay = pay...
class HDateException(Exception): pass class HMoneyException(Exception): pass class Dict_Exception(Exception): pass
a = float(input('Digite o primeiro valor: ')) b = float(input('Digite o segundo valor: ')) c = 0 while c != 5: c = int(input(''''Escolha uma opção: [1] Somar [2] Multiplicar [3] Maior [4] Novos Números [5] Sair do programa: ''')) if c == 1: print(f'A o resultado da soma de {a} + {b}...
""" **qecsimext** is an example Python 3 package that extends `qecsim`_ with additional components. See the README at `qecsimext`_ for details. .. _qecsim: https://github.com/qecsim/qecsim .. _qecsimext: https://github.com/qecsim/qecsimext """ __version__ = '0.1b9'
# -*- coding: utf-8 -*- __author__ = 'PCPC' sumList = [n for n in range(1000) if n%3==0 or n%5==0] print(sum(sumList))
def factory(x): def fn(): return x return fn a1 = factory("foo") a2 = factory("bar") print(a1()) print(a2())
""" var object this is for storing system variables """ class Var(object): @classmethod def fetch(cls,name): "fetch var with given name" return cls.list(name=name)[0] @classmethod def next(cls,name,advance=True): "give (and, if advance, then increment) a counter variable" v=cls.fetch(name) ...
def find_pivot(arr, low, high): if high < low: return -1 if high == low: return low mid = int((low + high)/2) if mid < high and arr[mid] > arr[mid + 1]: return mid if mid > low and arr[mid] < arr[mid - 1]: return mid-1 if arr[low] >= arr[mid]: return fin...
_base_ = './pascal_voc12.py' # dataset settings data = dict( train=dict( ann_dir='SegmentationClassAug', split=[ 'ImageSets/Segmentation/train.txt', 'ImageSets/Segmentation/aug.txt' ] ), val=dict( ann_dir='SegmentationClassAug', ), test=dict( ...
""" # Useful git config for working with git submodules in this repo ( git config status.submodulesummary 1 git config push.recurseSubmodules check git config diff.submodule log git config checkout.recurseSubmodules 1 git config alias.sdiff '!'"git diff && git submodule foreach 'git diff'" git config alias.spush...
def out(status, message, padding=0, custom=None): if status == '?': return input( ' ' * padding + '\033[1;36m' + '[?]' + '\033[0;0m' + ' ' + message + ': ' ) elif status == 'I': print( ' ' * padding ...
class Animal(object): """docstring for Animal""" def __init__(self): super(Animal, self).__init__() def keu(self): print("I am an animal") class Plant(object): """docstring for Plant""" def __init__(self): super(Plant, self).__init__() def keu(self): print("I am a plant") def qh(self): print("I am...