content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
IT_RRVV = 0 IT_N = 1 IT_RRVV64 = 2 IT_VIRTUAL = 3 IT_INVALID = 4 class OpCode: def __init__(self, i, itype, iname): self.i = i self.type = itype self.name = iname OPCODES = { "MOV": OpCode(0, IT_RRVV, "MOV"), "MOV8": OpCode(1, IT_RRVV, "MOV8"), "MOV16": OpCode(2, IT_RRVV, "MOV16"), "PUSH"...
it_rrvv = 0 it_n = 1 it_rrvv64 = 2 it_virtual = 3 it_invalid = 4 class Opcode: def __init__(self, i, itype, iname): self.i = i self.type = itype self.name = iname opcodes = {'MOV': op_code(0, IT_RRVV, 'MOV'), 'MOV8': op_code(1, IT_RRVV, 'MOV8'), 'MOV16': op_code(2, IT_RRVV, 'MOV16'), 'PUSH...
# -*- coding: utf-8 -*- # # Copyright 2015-2021 BigML # # 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 ...
"""Options for BigMLer report option """ default_port = 8085 def get_report_options(defaults=None): """Report-related options """ if defaults is None: defaults = {} options = {'--from-dir': {'dest': 'from_dir', 'default': defaults.get('from_dir', None), 'help': 'Retrieves the information from...
lista = list() while True: entrada = input() if entrada == '0 0 0 0': break entrada = entrada.split() for pos, elemento in enumerate(entrada): entrada[pos] = int(elemento) posicaoAtual = entrada[0:2] posicaoFinal = entrada[2:] posicao = [posicaoAtual, posicaoFinal] lista....
lista = list() while True: entrada = input() if entrada == '0 0 0 0': break entrada = entrada.split() for (pos, elemento) in enumerate(entrada): entrada[pos] = int(elemento) posicao_atual = entrada[0:2] posicao_final = entrada[2:] posicao = [posicaoAtual, posicaoFinal] li...
def run(): dev = __proxy__['junos.conn']() op = dev.rpc.get_ospf_interface_information(interface_name="[efgx][et]-*") interface_names = [i.text for i in op.xpath('ospf-interface/interface-name')] ret = [] for interface_name in interface_names: item = __salt__['fpc.get_mapping_from_interface'...
def run(): dev = __proxy__['junos.conn']() op = dev.rpc.get_ospf_interface_information(interface_name='[efgx][et]-*') interface_names = [i.text for i in op.xpath('ospf-interface/interface-name')] ret = [] for interface_name in interface_names: item = __salt__['fpc.get_mapping_from_interface'...
def find_pattern_match_length(input, input_offset, match_offset, max_length): length = 0 while length <= max_length and input_offset + length < len(input) and match_offset + length < len(input) and input[input_offset + length] == input[match_offset + length]: length += 1 return length ...
def find_pattern_match_length(input, input_offset, match_offset, max_length): length = 0 while length <= max_length and input_offset + length < len(input) and (match_offset + length < len(input)) and (input[input_offset + length] == input[match_offset + length]): length += 1 return length def find_...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"save_16bit": "README.ipynb", "distort_coords": "README.ipynb", "undistort_array": "README.ipynb", "get_essential": "README.ipynb", "get_fundamental": "README.ipynb", ...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'save_16bit': 'README.ipynb', 'distort_coords': 'README.ipynb', 'undistort_array': 'README.ipynb', 'get_essential': 'README.ipynb', 'get_fundamental': 'README.ipynb', 'fusi_rigid_rect': 'README.ipynb', 'fusi_cam_rect': 'README.ipynb', 'rect_homograp...
#Write a short Python function that takes a positive integer n and returns #the sum of the squares of all odd positive integers smaller than n. def sumOfSquareN(n): sum=0 for i in range(1,n): if i&1 != 0: sum += i**2 return sum n = int(input('please input an positive integer:')) print(su...
def sum_of_square_n(n): sum = 0 for i in range(1, n): if i & 1 != 0: sum += i ** 2 return sum n = int(input('please input an positive integer:')) print(sum_of_square_n(n))
EMAIL_ERROR_MESSAGES = { "min_length": "Email must be atleast 8 chararcters long", "required": "Email is required", "blank": "Email is required", } PASSWORD_ERROR_MESSAGES = { "min_length": "Password must be atleast 8 chararcters long", "required": "Password is required", "blank": "Password is ...
email_error_messages = {'min_length': 'Email must be atleast 8 chararcters long', 'required': 'Email is required', 'blank': 'Email is required'} password_error_messages = {'min_length': 'Password must be atleast 8 chararcters long', 'required': 'Password is required', 'blank': 'Password is required'} phone_number_error...
# Given 2 strings, a and b, return a string of the form short+long+short, with the # shorter string on the outside and the longer string on the inside. The strings will # not be the same length, but they may be empty ( length 0 ). # For example: # solution("1", "22") # returns "1221" # solution("22", "1") # returns...
def solution(a, b): return a + b + a if len(a) < len(b) else b + a + b def test_solution(): assert solution('45', '1') == '1451' assert solution('13', '200') == '1320013' assert solution('Soon', 'Me') == 'MeSoonMe' assert solution('U', 'False') == 'UFalseU'
def eig(self,curNode): self._CodeGen__emitCode("np.linalg.eig(") self._CodeGen__genExp(curNode.child[0]) self._CodeGen__visitSibling(curNode.child[0],self._CodeGen__genExp,", ") self._CodeGen__emitCode(")")
def eig(self, curNode): self._CodeGen__emitCode('np.linalg.eig(') self._CodeGen__genExp(curNode.child[0]) self._CodeGen__visitSibling(curNode.child[0], self._CodeGen__genExp, ', ') self._CodeGen__emitCode(')')
name = "blosc" version = "1.17.0" authors = [ "Blosc Development Team" ] description = \ """ Blosc is a high performance compressor optimized for binary data. It has been designed to transmit data to the processor cache faster than the traditional, non-compressed, direct memory fetch approach via a m...
name = 'blosc' version = '1.17.0' authors = ['Blosc Development Team'] description = '\n Blosc is a high performance compressor optimized for binary data. It has been designed to transmit data to the\n processor cache faster than the traditional, non-compressed, direct memory fetch approach via a memcpy() OS call...
cache = [0, 1] # Initialize with the first two terms of Fibonacci series. def fibonacci(n): """ Returns the n-th number in the Fibonacci sequence. Parameters ---------- n: int The n-th number in the Fibonacci sequence. """ for i in range(2, n): cache.append(cache[i-1] + cac...
cache = [0, 1] def fibonacci(n): """ Returns the n-th number in the Fibonacci sequence. Parameters ---------- n: int The n-th number in the Fibonacci sequence. """ for i in range(2, n): cache.append(cache[i - 1] + cache[i - 2]) return cache[-1]
cont_feat_events = [ "INVOICE_VALUE_GBP_log", "FEE_INVOICE_ratio", "MARGIN_GBP", ] cont_feat_profiles = ["AGE_YEARS"] discr_feat_events = [ "ACTION_STATE", "ACTION_TYPE", "BALANCE_STEP_TYPE", "BALANCE_TRANSACTION_TYPE", "PRODUCT_TYPE", "SENDER_TYPE", "SOURCE_CURRENCY", "SUCC...
cont_feat_events = ['INVOICE_VALUE_GBP_log', 'FEE_INVOICE_ratio', 'MARGIN_GBP'] cont_feat_profiles = ['AGE_YEARS'] discr_feat_events = ['ACTION_STATE', 'ACTION_TYPE', 'BALANCE_STEP_TYPE', 'BALANCE_TRANSACTION_TYPE', 'PRODUCT_TYPE', 'SENDER_TYPE', 'SOURCE_CURRENCY', 'SUCCESSFUL_ACTION', 'TARGET_CURRENCY'] discr_feat_pro...
# variaveis de classe class A: vc = 123 a1 = A() a2 = A()
class A: vc = 123 a1 = a() a2 = a()
day = "day11" filepath_data = f"input/{day}.txt" filepath_example = f"input/{day}-example.txt" Coordinate = tuple[int, int] CoordList = list[Coordinate] OctopusMap = list[list[int]] class OctopusLevels: def __init__(self, map_str: str) -> None: self.map = map_str @property def map(self) -> Octop...
day = 'day11' filepath_data = f'input/{day}.txt' filepath_example = f'input/{day}-example.txt' coordinate = tuple[int, int] coord_list = list[Coordinate] octopus_map = list[list[int]] class Octopuslevels: def __init__(self, map_str: str) -> None: self.map = map_str @property def map(self) -> Octo...
#Sort Stack: Write a program to sort a stack such that the smallest items are on the top. You can use #an additional temporary stack, but you may not copy the elements into any other data structure #(such as an array). The stack supports the following operations: push, pop, peek, and is Empty. # do I implement inside o...
class Llist: value = None next = None def __init__(self): pass def print_list(self): if self.next is None: print(self.value) return print(self.value, end=' ') return self.next.print_list() class Nclassicstack: def __init__(self): se...
class Link(): def __init__(self): self.id = None self.source = None self.target = None self.quality = None self.type = None class LinkConnector(): def __init__(self): self.id = None self.interface = None def __repr__(self): return "LinkConnector(%d, %s)" % (self.id, self.interfac...
class Link: def __init__(self): self.id = None self.source = None self.target = None self.quality = None self.type = None class Linkconnector: def __init__(self): self.id = None self.interface = None def __repr__(self): return 'LinkConnecto...
# # PySNMP MIB module ChrComPmDs3DS3-Current-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ChrComPmDs3DS3-Current-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:19:49 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version ...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, constraints_union, constraints_intersection, single_value_constraint) ...
""" This file contains TODOs and desired features list For this project we are using: "Make it work then make it good" """ # Features # TODO make combat work # TODO function or class to generate an encounter or event(with or without combat) # TODO Create subClasses for all equipment(weapons with ...
""" This file contains TODOs and desired features list For this project we are using: "Make it work then make it good" """
HEART_BEAT_INTERVAL = 1 SEND_ENTRIES_INTERVAL = 0.1 FOLLOWER_TIMEOUT = 5 CANDIDATE_TIMEOUT = 5
heart_beat_interval = 1 send_entries_interval = 0.1 follower_timeout = 5 candidate_timeout = 5
# -*- coding: utf-8 -*- """ packaging base module. """ class Package: """ package base class. all application python packages should be subclassed from this if you want to load packages respecting package dependencies. """ # the name of the package. # example: `my_app.api`. # should ...
""" packaging base module. """ class Package: """ package base class. all application python packages should be subclassed from this if you want to load packages respecting package dependencies. """ name = None depends = [] enabled = True component_name = None def load_configs...
# -*- coding: utf-8 -*- # Copyright 2019 Cohesity Inc. class AzureCloudCredentials(object): """Implementation of the 'Azure Cloud Credentials.' model. Specifies the cloud credentials to connect to a Microsoft Azure service account. Attributes: storage_access_key (string): Specifies the acce...
class Azurecloudcredentials(object): """Implementation of the 'Azure Cloud Credentials.' model. Specifies the cloud credentials to connect to a Microsoft Azure service account. Attributes: storage_access_key (string): Specifies the access key to use when accessing a storage tier in...
budget = float(input()) price_flour = float(input()) price_eggs = price_flour * 0.75 price_milk = 1.25 * price_flour cozunacs_made = 0 one_cozunac = price_eggs + price_flour + (price_milk / 4) colored_eggs = 0 while True: budget -= one_cozunac cozunacs_made += 1 colored_eggs += 3 if cozunacs_made % 3 ==...
budget = float(input()) price_flour = float(input()) price_eggs = price_flour * 0.75 price_milk = 1.25 * price_flour cozunacs_made = 0 one_cozunac = price_eggs + price_flour + price_milk / 4 colored_eggs = 0 while True: budget -= one_cozunac cozunacs_made += 1 colored_eggs += 3 if cozunacs_made % 3 == 0...
""" Daubechies 12 wavelet """ class Daubechies12: """ Properties ---------- asymmetric, orthogonal, bi-orthogonal All values are from http://wavelets.pybytes.com/wavelet/db12/ """ __name__ = "Daubechies Wavelet 12" __motherWaveletLength__ = 24 # length of the mother wavelet __tra...
""" Daubechies 12 wavelet """ class Daubechies12: """ Properties ---------- asymmetric, orthogonal, bi-orthogonal All values are from http://wavelets.pybytes.com/wavelet/db12/ """ __name__ = 'Daubechies Wavelet 12' __mother_wavelet_length__ = 24 __transform_wavelet_length__ = 2 ...
''' Created on 1.12.2016 @author: Darren '''''' Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set. get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1. set...
""" Created on 1.12.2016 @author: Darren Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set. get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1. set(key, value) - Se...
""" trajectory/utils/common.py Author: Jean Michel Rouly Define a collection of useful utility functions. """ def row2dict(row): """ Convert a SQLAlchemy row to a dictionary. """ return { col.name: getattr(row, col.name) for col in row.__table__.columns }
""" trajectory/utils/common.py Author: Jean Michel Rouly Define a collection of useful utility functions. """ def row2dict(row): """ Convert a SQLAlchemy row to a dictionary. """ return {col.name: getattr(row, col.name) for col in row.__table__.columns}
"""Exceptions for use in exit condition handling.""" class ParseError(Exception): """Errors that occur when tokenizing or parsing.""" def __init__(self, message, location): """ Construct by message and location. location is given as a 2-tuple of a start and end position in the ...
"""Exceptions for use in exit condition handling.""" class Parseerror(Exception): """Errors that occur when tokenizing or parsing.""" def __init__(self, message, location): """ Construct by message and location. location is given as a 2-tuple of a start and end position in the ...
# subplotable.py # by Behnam Heydarshahi, October 2017 # Empirical/Programming Assignment 2 # COMP 135 Machine Learning # # This class models data needed for a single sub plot class SubPlotable: def __init__(self, label, x_values, y_values, y_std_error_values): self.label = label self.x_values...
class Subplotable: def __init__(self, label, x_values, y_values, y_std_error_values): self.label = label self.x_values = x_values self.y_values = y_values self.y_std_err_values = y_std_error_values
''' When all lookups failed. This module provides a last chance to get a config value. i.e. A system level default values for Config variables. If a variable is not defined in this file, it will throw an error if the following checks failed: - a configuration in the default configuration file (in t...
""" When all lookups failed. This module provides a last chance to get a config value. i.e. A system level default values for Config variables. If a variable is not defined in this file, it will throw an error if the following checks failed: - a configuration in the default configuration file (in t...
# Given a list of N positive weights #divide the list into two lists such that the sum of weights in both lists are equal #The problem is solved using dynamic approch #find_subset finds a subset from list weights whoes sum is goal #returns list of subset if found else empty list def find_subset(weight,n,goal): ...
def find_subset(weight, n, goal): table = [[False for i in range(goal + 1)] for i in range(n + 1)] for i in range(n + 1): table[i][0] = True for i in range(1, goal + 1): table[0][i] = False for i in range(1, n + 1): for j in range(1, goal + 1): if j < weight[i - 1]: ...
#!/usr/bin/env python """ Submission strings for running remote commands. """ SCRP_RUNNER = """\ #!/bin/bash {precmd} mkdir -p $LOCAL_SCRATCH > /dev/null 2>/dev/null if [ -f {script} ]; then {command} exit $? else echo "{script} does not exist, make sure you set your filepath to a " echo "directory tha...
""" Submission strings for running remote commands. """ scrp_runner = '#!/bin/bash\n{precmd}\nmkdir -p $LOCAL_SCRATCH > /dev/null 2>/dev/null\nif [ -f {script} ]; then\n {command}\n exit $?\nelse\n echo "{script} does not exist, make sure you set your filepath to a "\n echo "directory that is available to t...
# Copyright 2019 Trend Micro. # # 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,...
def configure_max_sessions(api, configuration, api_version, api_exception, max_allowed, action): """ Configures the maximum number of active sessions allowed for users, and the action to take when the maximum is exceeded. Demonstrates how to configure multiple system properties. :param api: The Deep Securi...
# -*- coding: utf-8 -*- class Session(object): ID = 0 def __init__(self): self.responsed = False # if responsed to client self.client_addr = None # client addr self.req_data = None # client request self.send_ts = 0 # ts to send to ...
class Session(object): id = 0 def __init__(self): self.responsed = False self.client_addr = None self.req_data = None self.send_ts = 0 self.server_resps = {} self.sid = self.__class__.ID self.__class__.ID += 1
class ExternalEvent(object, IDisposable): """ A class that represent an external event. """ @staticmethod def Create(handler): """ Create(handler: IExternalEventHandler) -> ExternalEvent Creates an instance of external event. handler: An instance of IExternalEventHan...
class Externalevent(object, IDisposable): """ A class that represent an external event. """ @staticmethod def create(handler): """ Create(handler: IExternalEventHandler) -> ExternalEvent Creates an instance of external event. handler: An instance of IExternalEventHandler which wil...
with open('input.txt') as file: line = file.readline().split(',') fish = [] for f in line: fish.append(int(f)) for day in range(80): newfish = [] for i in range(len(fish)): fish[i] = fish[i] - 1 if fish[i] == -1: fish[i] = 6 ...
with open('input.txt') as file: line = file.readline().split(',') fish = [] for f in line: fish.append(int(f)) for day in range(80): newfish = [] for i in range(len(fish)): fish[i] = fish[i] - 1 if fish[i] == -1: fish[i] = 6 ...
class IContent: pass class Content(IContent): def __str__(self): return str(vars(self))
class Icontent: pass class Content(IContent): def __str__(self): return str(vars(self))
class ActivationObserver(object): def record(self, activations): pass def record_multiple(self, act_seq): pass class ActivationDistribution(object): def tally(self, activation): pass @staticmethod def load_from_something(foo): pass def compute_prob_of(self, act): pass ""...
class Activationobserver(object): def record(self, activations): pass def record_multiple(self, act_seq): pass class Activationdistribution(object): def tally(self, activation): pass @staticmethod def load_from_something(foo): pass def compute_prob_of(self, ...
class Node: def __init__(self, value): self.value = value self.left = None self.right = None def insert_node(root_node, new_node): if new_node.value > root_node.value: if root_node.right is None: root_node.right = new_node else: insert_node(root_node.right, new_node) else: if root_node.left is Non...
class Node: def __init__(self, value): self.value = value self.left = None self.right = None def insert_node(root_node, new_node): if new_node.value > root_node.value: if root_node.right is None: root_node.right = new_node else: insert_node(root_...
def quickSort(alist): quickSortHelper(alist,0,len(alist)-1) def quickSortHelper(alist, first, last): if first >= last: return splitpoint = partition(alist, first, last) quickSortHelper(alist, first, splitpoint-1) quickSortHelper(alist, splitpoint+1, last) def partition(alist, first, las...
def quick_sort(alist): quick_sort_helper(alist, 0, len(alist) - 1) def quick_sort_helper(alist, first, last): if first >= last: return splitpoint = partition(alist, first, last) quick_sort_helper(alist, first, splitpoint - 1) quick_sort_helper(alist, splitpoint + 1, last) def partition(ali...
class Solution: def reverse(self, x): """ :type x: int :rtype: int """ max_int = 2147483647 min_int = -2147483648 x2 = abs(x) flag = x > 0 result = 0 while x2 > 0: result = result * 10 + x2 % 10 x2 = x2 // 10 ...
class Solution: def reverse(self, x): """ :type x: int :rtype: int """ max_int = 2147483647 min_int = -2147483648 x2 = abs(x) flag = x > 0 result = 0 while x2 > 0: result = result * 10 + x2 % 10 x2 = x2 // 10 ...
class Solution: # 1st solution # O(1) time | O(1) space def tictactoe(self, moves: List[List[int]]) -> str: grid = [[0 for j in range(3)] for i in range(3)] for i, move in enumerate(moves): x, y = move if i & 1 == 0: grid[x][y] = 1 else: ...
class Solution: def tictactoe(self, moves: List[List[int]]) -> str: grid = [[0 for j in range(3)] for i in range(3)] for (i, move) in enumerate(moves): (x, y) = move if i & 1 == 0: grid[x][y] = 1 else: grid[x][y] = -1 retur...
# 101020400 if sm.hasQuest(21201): sm.warpInstanceIn(914021000, 1) sm.addQRValue(21203, "0") sm.setInstanceTime(15*60) if sm.hasQuest(21302): sm.warpInstanceIn(914022100, 0) sm.setQRValue(21203, "1", False) sm.setInstanceTime(20*60)
if sm.hasQuest(21201): sm.warpInstanceIn(914021000, 1) sm.addQRValue(21203, '0') sm.setInstanceTime(15 * 60) if sm.hasQuest(21302): sm.warpInstanceIn(914022100, 0) sm.setQRValue(21203, '1', False) sm.setInstanceTime(20 * 60)
class Packet: def __init__(self): """Creates a class for all packets (IPC2 or ACL2) in the text file, with an added field for validity.. Args: - self: this index, the one to create. mandatory object reference. Returns: None. """ self.count = 0 ...
class Packet: def __init__(self): """Creates a class for all packets (IPC2 or ACL2) in the text file, with an added field for validity.. Args: - self: this index, the one to create. mandatory object reference. Returns: None. """ self.count = 0 self....
A = [1,34,21,3,5,1,2,11] for i in range(0,len(A)-1): minIndex = i for j in range(i+1, len(A)): if A[j] < A[minIndex]: minIndex = j if minIndex != i: A[i],A[minIndex] = A[minIndex],A[i] print(A)
a = [1, 34, 21, 3, 5, 1, 2, 11] for i in range(0, len(A) - 1): min_index = i for j in range(i + 1, len(A)): if A[j] < A[minIndex]: min_index = j if minIndex != i: (A[i], A[minIndex]) = (A[minIndex], A[i]) print(A)
def transform(self, x, y): # return self.transform_2D(x, y) return self.transform_perspective(x, y) def transform_2D(self, x, y): return x, y def transform_perspective(self, pt_x, pt_y): lin_y = pt_y * self.perspective_point_y / self.height if lin_y > self.perspective_point_y: lin_y = se...
def transform(self, x, y): return self.transform_perspective(x, y) def transform_2_d(self, x, y): return (x, y) def transform_perspective(self, pt_x, pt_y): lin_y = pt_y * self.perspective_point_y / self.height if lin_y > self.perspective_point_y: lin_y = self.perspective_point_y diff_x = ...
class Config(object): SECRET_KEY='fdsa' APIKEY='e9dddf3b02c04ac98d341b24036bc18f' LEGACYURL='http://fsg-datahub.azure-api.net/legacy' FLIGTHSTATEURL='https://fsg-datahub.azure-api.net/flightstate/'
class Config(object): secret_key = 'fdsa' apikey = 'e9dddf3b02c04ac98d341b24036bc18f' legacyurl = 'http://fsg-datahub.azure-api.net/legacy' fligthstateurl = 'https://fsg-datahub.azure-api.net/flightstate/'
# Bo Pace, Sep 2016 # Merge sort # Merge sort makes use of an algorithmic principle known as # "divide and conquer." In any case (best, worst, average) the # merge sort will take O(nlogn) time. This is pretty good! The # O(logn) complexity comes from the fact that in each iteration # of our merge, we're splitting the l...
def mergesort(alist): if len(alist) > 1: mid = len(alist) / 2 left = mergesort(alist[:mid]) right = mergesort(alist[mid:]) new_list = [] i = j = 0 while i < len(left) and j < len(right): if left[i] < right[j]: new_list.append(left[i]) ...
__author__ = 'Abdulhafeth' def is_mobile_app(request): user_agent = request.META.get('HTTP_USER_AGENT', '') if user_agent: user_agent = user_agent.lower() if 'dalvik' in user_agent or 'cfnetwork' in user_agent or "alamofire" in user_agent: return True return False
__author__ = 'Abdulhafeth' def is_mobile_app(request): user_agent = request.META.get('HTTP_USER_AGENT', '') if user_agent: user_agent = user_agent.lower() if 'dalvik' in user_agent or 'cfnetwork' in user_agent or 'alamofire' in user_agent: return True return False
class Solution: def flatten(self, root): if not root: return self.flatten(root.left) self.flatten(root.right) t = root.right root.right = root.left root.left = None while root.right: root = root.right root.right = t
class Solution: def flatten(self, root): if not root: return self.flatten(root.left) self.flatten(root.right) t = root.right root.right = root.left root.left = None while root.right: root = root.right root.right = t
# # PySNMP MIB module CISCO-UNIFIED-COMPUTING-CAPABILITY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-UNIFIED-COMPUTING-CAPABILITY-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:58:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, single_value_constraint, constraints_union, value_size_constraint) ...
#@title Set up model training and evaluation { form-width: "30%" } # The model we explore includes three components: # - An "Encoder" graph net, which independently encodes the edge, node, and # global attributes (does not compute relations etc.). # - A "Core" graph net, which performs N rounds of processing (messa...
tf.reset_default_graph() rand = np.random.RandomState(SEED) num_processing_steps_tr = 1 num_processing_steps_ge = 1 num_training_iterations = 100000 batch_size_tr = 256 batch_size_ge = 100 num_time_steps = 50 step_size = 0.1 num_masses_min_max_tr = (5, 9) dist_between_masses_min_max_tr = (0.2, 1.0) model = models.Encod...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu May 23 23:38:39 2019 @author: lamnguyen """ # User input: annual_salary = float(input('enter starting annual salary: ')) semi_annual_raise = float(input('semi annual raise: ')) portion_saved = float(input('portion of salary saved: ')) total_cost = floa...
""" Created on Thu May 23 23:38:39 2019 @author: lamnguyen """ annual_salary = float(input('enter starting annual salary: ')) semi_annual_raise = float(input('semi annual raise: ')) portion_saved = float(input('portion of salary saved: ')) total_cost = float(input('the cost of home: ')) portion_down_payment = 0.25 * t...
#:copyright: Copyright 2009-2010 by the Vesper team, see AUTHORS. #:license: Dual licenced under the GPL or Apache2 licences, see LICENSE. @Action def updateAction(kw, retval): ''' Run this action every request but should only add content the first time ''' pjson = [{ 'id' : 'a_resource', 'label'...
@Action def update_action(kw, retval): """ Run this action every request but should only add content the first time """ pjson = [{'id': 'a_resource', 'label': 'foo', 'comment': 'page content.'}] kw['__server__'].defaultStore.update(pjson) return retval @Action def query_action(kw, retval): ...
class Validator: def __init__(self, rules_dict: dict): """ :param rules_dict: { field: [rule_functions] } """ self.rules = rules_dict def validate(self, dict_to_check: dict, stop_on_exception=False): errors = {} results = True for field in self.rules: ...
class Validator: def __init__(self, rules_dict: dict): """ :param rules_dict: { field: [rule_functions] } """ self.rules = rules_dict def validate(self, dict_to_check: dict, stop_on_exception=False): errors = {} results = True for field in self.rules: ...
def main(): trick.real_time_enable() trick.itimer_enable() trick.exec_set_thread_process_type(1, trick.PROCESS_TYPE_AMF_CHILD) trick.exec_set_thread_amf_cycle_time(1, 10.0) if __name__ == "__main__": main()
def main(): trick.real_time_enable() trick.itimer_enable() trick.exec_set_thread_process_type(1, trick.PROCESS_TYPE_AMF_CHILD) trick.exec_set_thread_amf_cycle_time(1, 10.0) if __name__ == '__main__': main()
""" @author: magician @date: 2019/12/24 @file: happy_number.py """ MAX_COUNT = 100 def is_happy(n: int) -> bool: """ is_happy :param n: :return: """ global happy_flag happy_flag = False total, counter = n, 0 while True: num_list, total= list(str(total)), 0 ...
""" @author: magician @date: 2019/12/24 @file: happy_number.py """ max_count = 100 def is_happy(n: int) -> bool: """ is_happy :param n: :return: """ global happy_flag happy_flag = False (total, counter) = (n, 0) while True: (num_list, total) = (list(str(total)), ...
params = {} # Cutting array parametes params['numX'] = 4 params['numY'] = 1 params['offsetX'] = 2.5 params['offsetY'] = 0.0 params['width'] = 4.5 params['height'] = 4.5 params['radius'] = 0.25 params['thickness'] = 0.514 params['toolDiam'] = 0.25 params['partSepX'] = params['width'] + 4.0*params['toolDiam'] params...
params = {} params['numX'] = 4 params['numY'] = 1 params['offsetX'] = 2.5 params['offsetY'] = 0.0 params['width'] = 4.5 params['height'] = 4.5 params['radius'] = 0.25 params['thickness'] = 0.514 params['toolDiam'] = 0.25 params['partSepX'] = params['width'] + 4.0 * params['toolDiam'] params['partSepY'] = params['height...
CLIENT_ID = "" CLIENT_SECRET = "" USERNAME = "" PASSWORD = "" REDIRECT_URI = "" USER_AGENT = "" REDIS_HOST = "localhost" REDIS_PORT = 6379 SUBREDDIT = "" PERIOD_HOURS = 24 REPORT_ALL = True SEND_MODMAIL = True REPORT_THRESHOLD = 2 REMOVE_THRESHOLD = 3 REPORT_MESSAGE = "Excessive Posting ({num_posts} in {period}h, ma...
client_id = '' client_secret = '' username = '' password = '' redirect_uri = '' user_agent = '' redis_host = 'localhost' redis_port = 6379 subreddit = '' period_hours = 24 report_all = True send_modmail = True report_threshold = 2 remove_threshold = 3 report_message = 'Excessive Posting ({num_posts} in {period}h, max {...
expected_ouptut = { 'interface': { 'TenGigabitEthernet1/0/33': { 'domain': 0, 'state': 'MASTER'}, 'TenGigabitEthernet1/0/34': { 'domain': 0, 'state': 'MASTER'}, 'TenGigabitEthernet1/0/42': { 'domain': 0, 'state': 'MASTER...
expected_ouptut = {'interface': {'TenGigabitEthernet1/0/33': {'domain': 0, 'state': 'MASTER'}, 'TenGigabitEthernet1/0/34': {'domain': 0, 'state': 'MASTER'}, 'TenGigabitEthernet1/0/42': {'domain': 0, 'state': 'MASTER'}, 'TenGigabitEthernet1/0/43': {'domain': 0, 'state': 'MASTER'}, 'TenGigabitEthernet1/0/6': {'domain': 0...
# # PySNMP MIB module BAS-ANALYZER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BAS-ANALYZER-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:33:39 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, constraints_union, value_size_constraint, single_value_constraint) ...
def factorial(n): if n == 1: return n else: return n * factorial(n - 1) def combinatoric_selections(limit): count = 0 for n in range(1, limit + 1): for r in range(1, n): if factorial(n) / (factorial(r) * (factorial(n - r))) > 1000000: cou...
def factorial(n): if n == 1: return n else: return n * factorial(n - 1) def combinatoric_selections(limit): count = 0 for n in range(1, limit + 1): for r in range(1, n): if factorial(n) / (factorial(r) * factorial(n - r)) > 1000000: count += 1 ret...
class Solution: def largeGroupPositions(self, S): res = [] l = r = 0 for i in range(1, len(S)): if S[i] == S[i - 1]: r += 1 if r - l >= 2 and (S[i] != S[i - 1] or i == len(S) - 1): res.append([l, r]) if S[i] != S[i - 1]: l = r = i return res
class Solution: def large_group_positions(self, S): res = [] l = r = 0 for i in range(1, len(S)): if S[i] == S[i - 1]: r += 1 if r - l >= 2 and (S[i] != S[i - 1] or i == len(S) - 1): res.append([l, r]) if S[i] != S[i - 1]: ...
##@namespace stomp.backward3 # Python3-specific versions of various functions used by stomp.py NULL = b'\x00' def input_prompt(prompt): """ Get user input """ return input(prompt) def decode(byte_data): if byte_data is None: return None return byte_data.decode() def encode(char_da...
null = b'\x00' def input_prompt(prompt): """ Get user input """ return input(prompt) def decode(byte_data): if byte_data is None: return None return byte_data.decode() def encode(char_data): if type(char_data) is str: return char_data.encode() elif type(char_data) is b...
""" Class to find the min edit distance """ class EditDistance: def editDistance(self, word1, word2): """ Function to find the min edit distance """ m = len(word1) n = len(word2) # a b c # 0 1 2 3 # d 1 1 2 3 # e 2 2 2 3 # ...
""" Class to find the min edit distance """ class Editdistance: def edit_distance(self, word1, word2): """ Function to find the min edit distance """ m = len(word1) n = len(word2) if m == 0: return n if n == 0: return m t = [0] * (n + 1) ...
def push_dominoes(dominoes): """ Time complexity: O(n) Space complexity: O(n) """ N = len(dominoes) forces = [0] * N # Forces from left to right f = 0 for i in range(N): f = N if dominoes[i] == 'R' and f == 0 else \ 0 if dominoes[i] == 'L' else \ max(f - 1, 0) forc...
def push_dominoes(dominoes): """ Time complexity: O(n) Space complexity: O(n) """ n = len(dominoes) forces = [0] * N f = 0 for i in range(N): f = N if dominoes[i] == 'R' and f == 0 else 0 if dominoes[i] == 'L' else max(f - 1, 0) forces[i] += f f = 0 for i in range(N - 1...
first = int(input("Type first number: ")) second = int(input("Type second number: ")) third = int(input("Type third number: ")) if first >= second and first >= third: print(f"Maximum: {first}") elif second >= first and second >= third: print(f"Maximum: {second}") else: print(f"Maximum: {third}") if first <= sec...
first = int(input('Type first number: ')) second = int(input('Type second number: ')) third = int(input('Type third number: ')) if first >= second and first >= third: print(f'Maximum: {first}') elif second >= first and second >= third: print(f'Maximum: {second}') else: print(f'Maximum: {third}') if first <=...
#!/usr/bin/env python3 """Is the number Prime. Source: https://edabit.com/challenge/G7KG4kaABpeYu2RBR """ def divisors(n: int): """Return list of divisors. Using list comprehension. n : int returns a list of divisor(s). """ return [divisor for divisor in range(1, n+1) if n % divisor == 0] ...
"""Is the number Prime. Source: https://edabit.com/challenge/G7KG4kaABpeYu2RBR """ def divisors(n: int): """Return list of divisors. Using list comprehension. n : int returns a list of divisor(s). """ return [divisor for divisor in range(1, n + 1) if n % divisor == 0] def prime(n: int): ...
# this code checks if a triangle has an angle of 90 degrees (i.e. if the triangle is a right-angled triangle) print("Please input the three sides of the right-angled triangle. Note that a and b are the shorter sides, while c is the longest side (also known as the hypotenuse).") a = float(input("Side a: ")) b = flo...
print('Please input the three sides of the right-angled triangle. Note that a and b are the shorter sides, while c is the longest side (also known as the hypotenuse).') a = float(input('Side a: ')) b = float(input('Side b: ')) c = float(input('Side c: ')) def right__angled__triangle(a, b, c): if a ** 2 + b ** 2 ==...
items = input().split("|") budget = float(input()) virtual_budget = budget profit = 0 for i in items: item = i.split("->") if float(item[1]) <= 50.00 and item[0] == "Clothes": if virtual_budget < float(item[1]): continue else: virtual_budget -= float(item[1]) ...
items = input().split('|') budget = float(input()) virtual_budget = budget profit = 0 for i in items: item = i.split('->') if float(item[1]) <= 50.0 and item[0] == 'Clothes': if virtual_budget < float(item[1]): continue else: virtual_budget -= float(item[1]) p...
GitHubPackage ('kumpera', 'ccache', '3.1.9', revision = '55f1fc61765c96ce5ac90e253bab4d8feddea828', configure = './autogen.sh --prefix="%{package_prefix}"; CC=cc ./configure --prefix="%{package_prefix}"', override_properties = { 'build_dependency' : True } )
git_hub_package('kumpera', 'ccache', '3.1.9', revision='55f1fc61765c96ce5ac90e253bab4d8feddea828', configure='./autogen.sh --prefix="%{package_prefix}"; CC=cc ./configure --prefix="%{package_prefix}"', override_properties={'build_dependency': True})
class TestFullAutoComplete: def test_full_autocomplete(self, client): res = client.get("/autocomplete?q=sci") json_data = res.get_json() first_object = json_data["results"][0] assert first_object["id"] == "https://openalex.org/C41008148" assert first_object["display_name"] ==...
class Testfullautocomplete: def test_full_autocomplete(self, client): res = client.get('/autocomplete?q=sci') json_data = res.get_json() first_object = json_data['results'][0] assert first_object['id'] == 'https://openalex.org/C41008148' assert first_object['display_name'] =...
f=open("dev_trans.txt","r") lines=f.readlines() copylst=[] count=0 l=[] for i,line in enumerate(lines): if i% 9 == 5: count+=1 l+=[count]*len(line.split()) rules=line.split() for rule in rules: if int(rule) > 1000000: copylst.append(1) ...
f = open('dev_trans.txt', 'r') lines = f.readlines() copylst = [] count = 0 l = [] for (i, line) in enumerate(lines): if i % 9 == 5: count += 1 l += [count] * len(line.split()) rules = line.split() for rule in rules: if int(rule) > 1000000: copylst.append(...
#!/usr/bin/env python3 iterables = dict, list, tuple, map nl = "\n" trailing = "," indent = " " # print all elements of give nested data structure to then go over all elements and format them given the data type def main(iterable): return iterable, sum(len(iterable) for x in a) if __name__ == "__main__": ...
iterables = (dict, list, tuple, map) nl = '\n' trailing = ',' indent = ' ' def main(iterable): return (iterable, sum((len(iterable) for x in a))) if __name__ == '__main__': iterable = [a, b, {'a': 1, 'a': 1}] main(iterable)
cfg = { 'host': '127.0.0.1', 'port': 4001, 'base': '/api', 'cloudflare': True, 'oauth2': { 'token_uri': 'https://muck.gg/auth/callback', 'discord': { 'id': '', 'secret': '', 'redirect_uri': 'https://muck.gg/api/bot/discord/oauth2/callback', 'invite': 'https://discord.gg/kcPjgg3' }, 'github': { ...
cfg = {'host': '127.0.0.1', 'port': 4001, 'base': '/api', 'cloudflare': True, 'oauth2': {'token_uri': 'https://muck.gg/auth/callback', 'discord': {'id': '', 'secret': '', 'redirect_uri': 'https://muck.gg/api/bot/discord/oauth2/callback', 'invite': 'https://discord.gg/kcPjgg3'}, 'github': {'url': 'https://github.com/Muc...
#!/bin/python3 class Node: def __init__(self,data): self.data = data self.next = None class Solution: def insert(self,head,data): p = Node(data) if head==None: head=p elif head.next==None: head.next=p ...
class Node: def __init__(self, data): self.data = data self.next = None class Solution: def insert(self, head, data): p = node(data) if head == None: head = p elif head.next == None: head.next = p else: start = head ...
''' Created on 2015.11.30 Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers such that they add up to the target, where index1 must be less than index2. Please note that your returned answers (both index1 and inde...
""" Created on 2015.11.30 Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers such that they add up to the target, where index1 must be less than index2. Please note that your returned answers (both index1 and inde...
def debug(x): print(x) def getStringColumns(df, show=True): df = df.select_dtypes(include='object') if show: display(df) return df def columnNamesByType(df, type='object', show=True): colNames = df.select_dtypes(include=type).columns.values if show: display(colNames) return...
def debug(x): print(x) def get_string_columns(df, show=True): df = df.select_dtypes(include='object') if show: display(df) return df def column_names_by_type(df, type='object', show=True): col_names = df.select_dtypes(include=type).columns.values if show: display(colNames) ...
class Color: def __init__(self, color_id, color_name, color_hexcode): self.id = color_id self.name = color_name self.hexcode = color_hexcode def label(self): # "red (ff0000)" return f"{self.name} ({self.hexcode})" def row(self): return str(self.id).rjust(...
class Color: def __init__(self, color_id, color_name, color_hexcode): self.id = color_id self.name = color_name self.hexcode = color_hexcode def label(self): return f'{self.name} ({self.hexcode})' def row(self): return str(self.id).rjust(2) + ' ' + self.name.ljust(...
def is_valid_number(number_as_string): try: if number_as_string.isnumeric(): return True elif number_as_string[0] == "-": if number_as_string[1:].isnumeric(): return True else: return False elif "." in number_as_string: ...
def is_valid_number(number_as_string): try: if number_as_string.isnumeric(): return True elif number_as_string[0] == '-': if number_as_string[1:].isnumeric(): return True else: return False elif '.' in number_as_string: ...
# From 3.2 text_file.py def readline(self, line): while True: if self.join_lines: if line: continue if self: continue return line while __name__ != '__main__': b = 4
def readline(self, line): while True: if self.join_lines: if line: continue if self: continue return line while __name__ != '__main__': b = 4
TWITTER_CONSUMER_KEY = "" TWITTER_CONSUMER_SECRET = "" SECURITY_CONFIRMABLE = False SECURITY_REGISTERABLE = True SECURITY_SEND_REGISTER_EMAIL = False #SECURITY_PASSWORD_HASH = "bcrypt"
twitter_consumer_key = '' twitter_consumer_secret = '' security_confirmable = False security_registerable = True security_send_register_email = False
class Button(): new_map = None save = None load = None exit = None done = None delete = None class Level(): lock = None unlock = None cleared = None class Terrain(): tile = {} class Unit(): unit = {}
class Button: new_map = None save = None load = None exit = None done = None delete = None class Level: lock = None unlock = None cleared = None class Terrain: tile = {} class Unit: unit = {}
# -*- coding: utf-8 -*- { 'name': "TerraLab", 'summary': """ TerraLab System""", 'description': """ TerraLab extends Odoo by adding laboratory management functions. """, 'author': "TerraLab Oy", 'website': "https://www.terralab.fi", # Categories can be used to filter modu...
{'name': 'TerraLab', 'summary': '\n TerraLab System', 'description': '\n TerraLab extends Odoo by adding laboratory management functions.\n ', 'author': 'TerraLab Oy', 'website': 'https://www.terralab.fi', 'category': 'Specific Industry Applications', 'version': '0.3', 'depends': ['base', 'product', 's...
def includeme(config): config.add_route("index", "/") config.add_route("feature_flags_test", "/flags/test") config.add_route("welcome", "/welcome") config.add_route("assets", "/assets/*subpath") config.add_route("status", "/_status") config.add_route("favicon", "/favicon.ico") config.add_rou...
def includeme(config): config.add_route('index', '/') config.add_route('feature_flags_test', '/flags/test') config.add_route('welcome', '/welcome') config.add_route('assets', '/assets/*subpath') config.add_route('status', '/_status') config.add_route('favicon', '/favicon.ico') config.add_rou...
def maximum(x,y): if (x>y): return x else: return y z=maximum(2,3) print(str(z))
def maximum(x, y): if x > y: return x else: return y z = maximum(2, 3) print(str(z))
def test_migrate_feature_segments_forward(migrator): # Given - the migration state is at 0017 (before the migration we want to test) old_state = migrator.apply_initial_migration(('features', '0017_auto_20200607_1005')) OldFeatureSegment = old_state.apps.get_model('features', 'FeatureSegment') OldFeatu...
def test_migrate_feature_segments_forward(migrator): old_state = migrator.apply_initial_migration(('features', '0017_auto_20200607_1005')) old_feature_segment = old_state.apps.get_model('features', 'FeatureSegment') old_feature_state = old_state.apps.get_model('features', 'FeatureState') feature = old_s...
class ListNode(object): def __init__(self, x): self.val = x self.next = None def insert(head, x): new_node = ListNode(x) last_node = head while last_node.next: last_node = last_node.next last_node.next = new_node def printList(head): curr = head while curr...
class Listnode(object): def __init__(self, x): self.val = x self.next = None def insert(head, x): new_node = list_node(x) last_node = head while last_node.next: last_node = last_node.next last_node.next = new_node def print_list(head): curr = head while curr: ...
speed(0) for i in range(10, 51, 10): left(90) pendown() forward(i) right(90) forward(10) right(90) forward(i) right(90) forward(10) left(180) penup() forward(25)
speed(0) for i in range(10, 51, 10): left(90) pendown() forward(i) right(90) forward(10) right(90) forward(i) right(90) forward(10) left(180) penup() forward(25)
''' Write a function that takes in a string made up of brackets("(","[",""{",")","]","}") and other optional characters. The function should return a boolean representing whether or not the string is balanced in regards to brackets. A string is said to be balanced if it has as many opening brackets of a given type as i...
""" Write a function that takes in a string made up of brackets("(","[",""{",")","]","}") and other optional characters. The function should return a boolean representing whether or not the string is balanced in regards to brackets. A string is said to be balanced if it has as many opening brackets of a given type as i...
class Solution: def islandPerimeter(self, grid: List[List[int]]) -> int: direc = [ [-1, 0], [0, 1], [1, 0], [0, -1] ] ans = 0 n = len(grid) m = len(grid[0]) vis = [ [ False for __ in range(m) ] for _ in range(n) ] q = collections.deque() for i in range(n...
class Solution: def island_perimeter(self, grid: List[List[int]]) -> int: direc = [[-1, 0], [0, 1], [1, 0], [0, -1]] ans = 0 n = len(grid) m = len(grid[0]) vis = [[False for __ in range(m)] for _ in range(n)] q = collections.deque() for i in range(n): ...
"""Cat napping This program prints a message for Alice using a multi-line string with triple quotes. """ def main(): print('''Dear Alice, Eve's cat has been arrested for catnapping, cat burglary, and extortion. Sincerely, Bob''') if __name__ == '__main__': main()
"""Cat napping This program prints a message for Alice using a multi-line string with triple quotes. """ def main(): print("Dear Alice,\n \nEve's cat has been arrested for catnapping, cat burglary, and extortion.\n \nSincerely,\nBob") if __name__ == '__main__': main()
atomic_to_ps = 2.41888E-5 plank_ev = 4.135667696E-15 ps_to_atomic = 1.0 / atomic_to_ps atomic_to_angstrom = 0.529177249 angstrom_to_atomic = 1.0 / atomic_to_angstrom amber_to_angstrom_ps = 20.455 angstrom_ps_to_amber = 1.0 / amber_to_angstrom_ps angstrom_ps_to_atomic = ps_to_atomic / angstrom_to_atomic amber_to_atomic...
atomic_to_ps = 2.41888e-05 plank_ev = 4.135667696e-15 ps_to_atomic = 1.0 / atomic_to_ps atomic_to_angstrom = 0.529177249 angstrom_to_atomic = 1.0 / atomic_to_angstrom amber_to_angstrom_ps = 20.455 angstrom_ps_to_amber = 1.0 / amber_to_angstrom_ps angstrom_ps_to_atomic = ps_to_atomic / angstrom_to_atomic amber_to_atomic...
class classTable: l_k_t_c = {'[128, 128]': [11, 2], '[128, 256]': [15, 2], '[256, 256]': [15, 4], '[256, 512]': [19, 4], '[512, 512]': [19, 8]} even_indexes_0 = [0, 4, 8, 12, 16, 20] even_indexes_2 = [2, 6, 10, 14, 18, 22] even_indexes_3 = [1,...
class Classtable: l_k_t_c = {'[128, 128]': [11, 2], '[128, 256]': [15, 2], '[256, 256]': [15, 4], '[256, 512]': [19, 4], '[512, 512]': [19, 8]} even_indexes_0 = [0, 4, 8, 12, 16, 20] even_indexes_2 = [2, 6, 10, 14, 18, 22] even_indexes_3 = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19] even_indexes = [0, 2, 4,...
#!/usr/bin/env python """ Created by alex on 10/19/17 Docstring information """
""" Created by alex on 10/19/17 Docstring information """
# Time: O(n + n * (log10(9k)/k) + ... + k) # = O((n - (log10(9k)/k)*k)/(1-log10(9k)/k)) # = O(n / (1-log10(9k)/k)) = O(n) for k >= 2 # Space: O(n) # simulation class Solution(object): def digitSum(self, s, k): """ :type s: str :type k: int :rtype: str """ ...
class Solution(object): def digit_sum(self, s, k): """ :type s: str :type k: int :rtype: str """ while len(s) > k: s = ''.join(map(str, (sum(map(int, s[i:i + k])) for i in xrange(0, len(s), k)))) return s
def tags(tag): def decorator(function): def wrapper(*args): res = function(*args) return f"<{tag}>{res}</{tag}>" return wrapper return decorator @tags('p') def join_strings(*args): return "".join(args) print(join_strings("Hello", " you!")) @tags('h1') def to_upper(...
def tags(tag): def decorator(function): def wrapper(*args): res = function(*args) return f'<{tag}>{res}</{tag}>' return wrapper return decorator @tags('p') def join_strings(*args): return ''.join(args) print(join_strings('Hello', ' you!')) @tags('h1') def to_upper...
day_num = 5 file_load = open("input/day5.txt", "r") file_in = file_load.read() file_load.close() file_in = file_in.split("\n") def run(): def find(field_in): id_row = list(range(128)) id_col= list(range(8)) for temp_char in range(7): if field_in[temp_char] == "F": id_row = id_row[:len(i...
day_num = 5 file_load = open('input/day5.txt', 'r') file_in = file_load.read() file_load.close() file_in = file_in.split('\n') def run(): def find(field_in): id_row = list(range(128)) id_col = list(range(8)) for temp_char in range(7): if field_in[temp_char] == 'F': ...
#!/usr/bin/env python3 for _ in range(int(input())): a, b, c = map(int, input().split()) print(a * b % c)
for _ in range(int(input())): (a, b, c) = map(int, input().split()) print(a * b % c)
height = 5 counter = 0 for i in range(0, height): for j in range(0, height + 1): if j == counter or j == height - counter and i <= height // 2: print("*", end="") else: print(end=" ") print() if i < height // 2: counter = counter + 1
height = 5 counter = 0 for i in range(0, height): for j in range(0, height + 1): if j == counter or (j == height - counter and i <= height // 2): print('*', end='') else: print(end=' ') print() if i < height // 2: counter = counter + 1
algorithm = "spawning_nonadiabatic" #algorithm = "hagedorn" potential = "delta_gap" T = 10 dt = 0.01 eps = 0.1 delta = 0.75*eps f = 4.0 ngn = 4096 leading_component = 0 basis_size = 80 P = 1.0j Q = 1.0-5.0j S = 0.0 parameters = [ (P, Q, S, 1.0, -5.0), (P, Q, S, 1.0, -5.0) ] coefficients = [[(0,1.0)], [(0,0.0)]] ...
algorithm = 'spawning_nonadiabatic' potential = 'delta_gap' t = 10 dt = 0.01 eps = 0.1 delta = 0.75 * eps f = 4.0 ngn = 4096 leading_component = 0 basis_size = 80 p = 1j q = 1.0 - 5j s = 0.0 parameters = [(P, Q, S, 1.0, -5.0), (P, Q, S, 1.0, -5.0)] coefficients = [[(0, 1.0)], [(0, 0.0)]] matrix_exponential = 'arnoldi' ...