content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
DATA_TYPES = { 'AutoField': 'int IDENTITY (1, 1)', 'BooleanField': 'bit', 'CharField': 'varchar(%(maxlength)s)', 'CommaSeparatedIntegerField': 'varchar(%(maxlength)s)', 'DateField': 'smalldatetime', 'DateTimeField': 'smalldatetime', 'DecimalField': 'nume...
data_types = {'AutoField': 'int IDENTITY (1, 1)', 'BooleanField': 'bit', 'CharField': 'varchar(%(maxlength)s)', 'CommaSeparatedIntegerField': 'varchar(%(maxlength)s)', 'DateField': 'smalldatetime', 'DateTimeField': 'smalldatetime', 'DecimalField': 'numeric(%(max_digits)s, %(decimal_places)s)', 'FileField': 'varchar(100...
'''Define terminal escape sequences for color codes. <ESC>[{attr1};...;{attrn}m 0 Reset all attributes 1 Bright 2 Dim 4 Underscore 5 Blink 7 Reverse 8 Hidden Foreground Colours ------------------ 30 Black 31 Red 32 Green 33 Yellow 34 Blue 35 Magenta 36 Cyan 37 White Background Colours ------------------ 40 Black 41...
"""Define terminal escape sequences for color codes. <ESC>[{attr1};...;{attrn}m 0 Reset all attributes 1 Bright 2 Dim 4 Underscore 5 Blink 7 Reverse 8 Hidden Foreground Colours ------------------ 30 Black 31 Red 32 Green 33 Yellow 34 Blue 35 Magenta 36 Cyan 37 White Background Colours ------------------ 40 Black 41...
JOINTS = { "HipCenter": 0, "RHip": 1, "RKnee": 2, "RFoot": 3, "LHip": 4, "LKnee": 5, "LFoot": 6, "Spine": 7, "Thorax": 8, "Neck/Nose": 9, "Head": 10, "LShoulder": 11, "LElbow": 12, "LWrist": 13, "RShoulder": 14, "RElbow": 15, "RWrist": 16, } EDGES = (...
joints = {'HipCenter': 0, 'RHip': 1, 'RKnee': 2, 'RFoot': 3, 'LHip': 4, 'LKnee': 5, 'LFoot': 6, 'Spine': 7, 'Thorax': 8, 'Neck/Nose': 9, 'Head': 10, 'LShoulder': 11, 'LElbow': 12, 'LWrist': 13, 'RShoulder': 14, 'RElbow': 15, 'RWrist': 16} edges = ((0, 1), (1, 2), (2, 3), (0, 4), (4, 5), (5, 6), (0, 7), (7, 8), (8, 9), ...
#!/usr/bin/env python3 # The missing value is always in range 1...len(nums)+1 # linear space and time def find_first_missing(nums): seen = [False] * len(nums) for n in nums: if n >= 1 and n <= len(nums): seen[n-1] = True for i in range(len(nums)): if not seen[i]: ...
def find_first_missing(nums): seen = [False] * len(nums) for n in nums: if n >= 1 and n <= len(nums): seen[n - 1] = True for i in range(len(nums)): if not seen[i]: return i + 1 return len(nums) + 1 def find_first_missing_opt(nums): for i in range(len(nums)): ...
#!/usr/bin/python3 class MyError(Exception): def __init__(self, value): self.value = value def __str__(self): return repr(self.value) try: raise MyError(2 * 2) except MyError as err: print('My Exception occurred, value: ', err.value)
class Myerror(Exception): def __init__(self, value): self.value = value def __str__(self): return repr(self.value) try: raise my_error(2 * 2) except MyError as err: print('My Exception occurred, value: ', err.value)
"""Visit computation pure python version.""" START_EVENT = 1 END_EVENT = 0 def padd(p, q): """Add the probabilities.""" return 1.0 - (1.0 - p) * (1.0 - q) def pmul(p, n): """Return the multiple of the given probabilty.""" return 1.0 - (1.0 - p) ** n def compute_visit_output_py( transmission_p...
"""Visit computation pure python version.""" start_event = 1 end_event = 0 def padd(p, q): """Add the probabilities.""" return 1.0 - (1.0 - p) * (1.0 - q) def pmul(p, n): """Return the multiple of the given probabilty.""" return 1.0 - (1.0 - p) ** n def compute_visit_output_py(transmission_prob, succ...
#!/usr/bin/env python3 # Strings are used to display message's on the screen or to convey instruction to users test = 'This is a testing.' print(test) # Now say for example you want to print 'You're having it' if we write in single quotes then it will show us error # test1 = 'You're having it' # uncomment the line to s...
test = 'This is a testing.' print(test) test2 = "You're having it" print(test2) print('Python Tutorial "Beginners"') print("Python Tutorial Beginner's") python = "Python Tutorial's for beginner's" print(python) multiple_line = '\nThis is first line.\nThis is second line.\nThis is third line.\n' print(multiple_line)
class Laptop: def getTime(self): pass def playWavFile(self, file): pass def wavWasPlayed(self, file): pass def resetWav(self, file): pass
class Laptop: def get_time(self): pass def play_wav_file(self, file): pass def wav_was_played(self, file): pass def reset_wav(self, file): pass
def rowapplymods(transactionrow): value = transactionrow.prevalue for mod in transactionrow.includes_mods: value = mod.apply(transactionrow.amount, value)[0] transactionrow.value = value
def rowapplymods(transactionrow): value = transactionrow.prevalue for mod in transactionrow.includes_mods: value = mod.apply(transactionrow.amount, value)[0] transactionrow.value = value
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@npm//@bazel/protractor:package.bzl", "npm_bazel_protractor_dependencies") load("@npm//@bazel/karma:package.bzl", "npm_bazel_karma_dependencies") load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories") load("@io_bazel_r...
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') load('@npm//@bazel/protractor:package.bzl', 'npm_bazel_protractor_dependencies') load('@npm//@bazel/karma:package.bzl', 'npm_bazel_karma_dependencies') load('@io_bazel_rules_webtesting//web:repositories.bzl', 'web_test_repositories') load('@io_bazel_r...
pares = open('pares.txt', 'w') impares = open('impares.txt', 'w') for t in range(0, 1000): if t % 2 == 0: pares.write(f"{t}\n") else: impares.write(f"{t}\n") pares.close() impares.close()
pares = open('pares.txt', 'w') impares = open('impares.txt', 'w') for t in range(0, 1000): if t % 2 == 0: pares.write(f'{t}\n') else: impares.write(f'{t}\n') pares.close() impares.close()
"""The ywcnvlib package - Link yw-cnv to the UNO API. Modules: yw_cnv_uno -- Provide a converter class for universal import and export. ui_uno -- Provide a UNO user interface facade class. uno_tools -- Provide Python wrappers for UNO widgets. Copyright (c) 2022 Peter Triesberger For further information see...
"""The ywcnvlib package - Link yw-cnv to the UNO API. Modules: yw_cnv_uno -- Provide a converter class for universal import and export. ui_uno -- Provide a UNO user interface facade class. uno_tools -- Provide Python wrappers for UNO widgets. Copyright (c) 2022 Peter Triesberger For further information see https://...
"""Args defining output and networks""" def add_args(parser): parser.add_argument('--log_interval', type=int, default=100, metavar='N', help='how many batches to wait before logging training status') parser.add_argument('--input_size', type=int, default=16, help...
"""Args defining output and networks""" def add_args(parser): parser.add_argument('--log_interval', type=int, default=100, metavar='N', help='how many batches to wait before logging training status') parser.add_argument('--input_size', type=int, default=16, help='input size') parser.add_argument('--train_p...
def luasSegitiga2(a,t): luas = a * t / 2 print('Luas segitiga dengan alas ',alas,'dan tinggi ',tinggi,' adalah ',luas) alas=10 tinggi=20 luasSegitiga2(alas,tinggi)
def luas_segitiga2(a, t): luas = a * t / 2 print('Luas segitiga dengan alas ', alas, 'dan tinggi ', tinggi, ' adalah ', luas) alas = 10 tinggi = 20 luas_segitiga2(alas, tinggi)
CONFIGURATION = "css" WIDTH = 30 HEIGHT = 30
configuration = 'css' width = 30 height = 30
#!/usr/bin/env python def solution(S): stack = [] for char in S: if char == ')': if len(stack) > 0: stack.pop() else: return 0 if char == '(': stack.append(char) if len(stack) != 0: return 0 return 1 def te...
def solution(S): stack = [] for char in S: if char == ')': if len(stack) > 0: stack.pop() else: return 0 if char == '(': stack.append(char) if len(stack) != 0: return 0 return 1 def test(): s = '(()(())())' ...
''' https://www.codingame.com/training/easy/equivalent-resistance-circuit-building ''' # Dictionary that stores the value of each resistance name ohms = {} # Read the inputs n = int(input()) for i in range(n): inputs = input().split() name = inputs[0] value = int(inputs[1]) # Pop...
""" https://www.codingame.com/training/easy/equivalent-resistance-circuit-building """ ohms = {} n = int(input()) for i in range(n): inputs = input().split() name = inputs[0] value = int(inputs[1]) ohms[name] = value circuit = [ohms[e] if e in ohms else e for e in input().split()] opening_characters =...
class Error(Exception): pass class NotFound(Error): pass class Corruption(Error): pass class NotSupported(Error): pass class InvalidArgument(Error): pass class RocksIOError(Error): pass class MergeInProgress(Error): pass class Incomplete(Error): pass
class Error(Exception): pass class Notfound(Error): pass class Corruption(Error): pass class Notsupported(Error): pass class Invalidargument(Error): pass class Rocksioerror(Error): pass class Mergeinprogress(Error): pass class Incomplete(Error): pass
test = { 'name': 'q0_3', 'points': 1, 'suites': [ { 'cases': [{'code': '>>> np.all(flavor_ratings_sorted.take(0).column("Rating list") == [1, 2, 4, 5]) == True\nTrue', 'hidden': False, 'locked': False}], 'scored': True, 'setup': '', 'teardo...
test = {'name': 'q0_3', 'points': 1, 'suites': [{'cases': [{'code': '>>> np.all(flavor_ratings_sorted.take(0).column("Rating list") == [1, 2, 4, 5]) == True\nTrue', 'hidden': False, 'locked': False}], 'scored': True, 'setup': '', 'teardown': '', 'type': 'doctest'}]}
num_waves = 2 num_eqn = 4 num_aux = 2 # Conserved quantities pressure = 0 x_velocity = 1 y_velocity = 2 z_velocity = 3 # Auxiliary variables impedance = 0 sound_speed = 1
num_waves = 2 num_eqn = 4 num_aux = 2 pressure = 0 x_velocity = 1 y_velocity = 2 z_velocity = 3 impedance = 0 sound_speed = 1
# reverse given string # Sample output: # string this reverse def reverse_sentence(sentence): words = sentence.split(" ") reverse = ' '.join(reversed(words)) return reverse sentence = "reverse this string" print (reverse_sentence(sentence))
def reverse_sentence(sentence): words = sentence.split(' ') reverse = ' '.join(reversed(words)) return reverse sentence = 'reverse this string' print(reverse_sentence(sentence))
class HashTable(object): def __init__(self,size): self.size = size self.slots = [None] * self.size self.data = [None] * self.size def put(self,key,data): hashValue = self.hashFunc(key,len(self.slots)) if self.slots[hashValue] == ...
class Hashtable(object): def __init__(self, size): self.size = size self.slots = [None] * self.size self.data = [None] * self.size def put(self, key, data): hash_value = self.hashFunc(key, len(self.slots)) if self.slots[hashValue] == None: self.slots[hashVal...
class PriorityQueue(object): def __init__(self): self.qlist = [] def isEmpty(self): return len(self) == 0 def __len__(self): return len(self.qlist) def enqueue(self, data, priority): entry = _PriorityQEntry(data, priority) self.qlist.append(entry) de...
class Priorityqueue(object): def __init__(self): self.qlist = [] def is_empty(self): return len(self) == 0 def __len__(self): return len(self.qlist) def enqueue(self, data, priority): entry = __priority_q_entry(data, priority) self.qlist.append(entry) def...
if __name__ == '__main__': n = int(input()) arr = map(int, input().split()) total = list() [total.append(i) for i in arr if i not in total] total.sort() print(total[-2])
if __name__ == '__main__': n = int(input()) arr = map(int, input().split()) total = list() [total.append(i) for i in arr if i not in total] total.sort() print(total[-2])
# #Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, find the duplicate one. # #Note: # #You must not modify the array (assume the array is read only). # #You must use only...
class Solution(object): def find_duplicate(self, nums): """ :type nums: List[int] :rtype: int """ for i in range(0, len(nums)): for j in range(i + 1, len(nums)): if nums[i] == nums[j]: return nums[j] nums.sort() ...
""" We copy some functions from the Python 2.7.3 socket module. http://hg.python.org/releasing/2.7.3/file/7bb96963d067/Lib/socket.py """ _GLOBAL_DEFAULT_TIMEOUT = object() def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=None): """Connect to *address* and ret...
""" We copy some functions from the Python 2.7.3 socket module. http://hg.python.org/releasing/2.7.3/file/7bb96963d067/Lib/socket.py """ _global_default_timeout = object() def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=None): """Connect to *address* and return the socket object. ...
""" __author__ = "Patrick Doyle" __license__ = "The Unlicense" __email__ = "me@pcdoyle.com" r/dailyprogrammer: Get the day of the week from a date entered as "YYYY MM DD" (EX: 2017 10 30) https://www.reddit.com/r/dailyprogrammer/comments/79npf9/20171030_challenge_338_easy_what_day_was_it_again/ To solve this ...
""" __author__ = "Patrick Doyle" __license__ = "The Unlicense" __email__ = "me@pcdoyle.com" r/dailyprogrammer: Get the day of the week from a date entered as "YYYY MM DD" (EX: 2017 10 30) https://www.reddit.com/r/dailyprogrammer/comments/79npf9/20171030_challenge_338_easy_what_day_was_it_again/ To solve this ...
# %% [markdown] ''' Logistic Regression Classifier Random forest Classifier Decision Tree Classifier PCA Logistic Regression Classifier Random forest Classifier Decision Tree Classifier Normalization Modeling With PCA Without PCA ''' all_metrics.append(["Logistic Regression", rou...
""" Logistic Regression Classifier Random forest Classifier Decision Tree Classifier PCA Logistic Regression Classifier Random forest Classifier Decision Tree Classifier Normalization Modeling With PCA Without PCA """ all_metrics.append(['Logistic Regression', round(sensitivity, 2), round(specific...
# ldap/util.py # Written by Jeff Kaleshi def get_permissions(query): permissions = [] for item in query: permission = item[3:item.find(',')] if permission != 'ACMPaid' and permission != 'ACMNotPaid': permissions.append(permission) return permissions def get_paid_status(query):...
def get_permissions(query): permissions = [] for item in query: permission = item[3:item.find(',')] if permission != 'ACMPaid' and permission != 'ACMNotPaid': permissions.append(permission) return permissions def get_paid_status(query): result = False permissions = get_p...
NAME = 'Jane P. Roult' # Communication Definitions BAUDRATE = 115200 COMMAND_COMM_LOCATION = "/dev/robot/arduino" # For sending commands SENSORS_COMM_LOCATION = "/dev/robot/sensors" # For receiving sensor telemetry # Physical Definitions WHEEL_BASE_MM = 153.0 # Blue Wheels with geared steppers: STEPS_PER_CM = 132....
name = 'Jane P. Roult' baudrate = 115200 command_comm_location = '/dev/robot/arduino' sensors_comm_location = '/dev/robot/sensors' wheel_base_mm = 153.0 steps_per_cm = 132.0 steps_per_mm = STEPS_PER_CM / 10.0
# -*- coding: utf-8 -*- """ Created on Wed Jan 16 09:07:36 2019 @author: Dell """ #to find th largest and second largest number on the list(sort and second last) L=[] s=int(input("How many numbers you want to add in the list? ")) for i in range(s): x=int(input("Enter element of list: ")) L.append(...
""" Created on Wed Jan 16 09:07:36 2019 @author: Dell """ l = [] s = int(input('How many numbers you want to add in the list? ')) for i in range(s): x = int(input('Enter element of list: ')) L.append(x) print(L) maxim = L[0] for i in range(len(L)): if L[i] > maxim: maxim = L[i] print('Your Largest ...
# -*- coding: utf-8 -*- """ Module that keeps track of library management like version control, release dates etc. """ __version__ = '0.0.2' __release_date__ = '2019-02-10'
""" Module that keeps track of library management like version control, release dates etc. """ __version__ = '0.0.2' __release_date__ = '2019-02-10'
def calculate( time, realtime ): starting = time[6] hhs = int(time[:2]) mms = int(time[3:5]) ending = time[15] hhe = int(time[9:11]) mme = int(time[12:15]) if time[6]== 'A': if time[15] == 'A': if hhs!=12: sum=0 sum = sum + (hh*60)+mm ...
def calculate(time, realtime): starting = time[6] hhs = int(time[:2]) mms = int(time[3:5]) ending = time[15] hhe = int(time[9:11]) mme = int(time[12:15]) if time[6] == 'A': if time[15] == 'A': if hhs != 12: sum = 0 sum = sum + hh * 60 + mm ...
__author__ = 'DWI' class TemplateActionReader(object): def __init__(self, template_action_builder): self.action_builder = template_action_builder def read(self, file_name): """ Reads the given file and returns a template object :param file_name: name of the template file ...
__author__ = 'DWI' class Templateactionreader(object): def __init__(self, template_action_builder): self.action_builder = template_action_builder def read(self, file_name): """ Reads the given file and returns a template object :param file_name: name of the template file ...
""" Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this ...
""" Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this ...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def findLeaves(self, root: TreeNode) -> List[List[int]]: if not root: return [] ...
class Solution: def find_leaves(self, root: TreeNode) -> List[List[int]]: if not root: return [] res = [] while not self.isLeaf(root): res.append(self.getNextLeaves(root)) res.append([root.val]) return res def is_leaf(self, root) -> bool: ...
sheep_size = [5,7,300,90,24,50,75] print("Hello, my name is Duy Anh and these are my sheep sizes") print(sheep_size) biggest_sheep = max(sheep_size) print() print("Now my biggest sheep has size",biggest_sheep,"let's shear it")
sheep_size = [5, 7, 300, 90, 24, 50, 75] print('Hello, my name is Duy Anh and these are my sheep sizes') print(sheep_size) biggest_sheep = max(sheep_size) print() print('Now my biggest sheep has size', biggest_sheep, "let's shear it")
input = """ true. a | b :- true, 1 < 2. :- a. """ output = """ true. a | b :- true, 1 < 2. :- a. """
input = '\ntrue.\na | b :- true, 1 < 2.\n:- a.\n' output = '\ntrue.\na | b :- true, 1 < 2.\n:- a.\n'
# https://app.codesignal.com/arcade/code-arcade/loop-tunnel/7BFPq6TpsNjzgcpXy/ def leastFactorial(n): # What's the highest factorial number that is bigger than n? i, fact = (1, 1) # Keep increasing a cumulative factorial until n can't no longer contain # it. If n becomes 1, then n was a factorial, if n ...
def least_factorial(n): (i, fact) = (1, 1) while n / fact > 1: fact *= i i += 1 return fact
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: node = parent = None def deleteNode(self, root: TreeNode, key: int) -> TreeNode: # search for the node and its parent self.findNodeAndParent(root, key) if s...
class Treenode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: node = parent = None def delete_node(self, root: TreeNode, key: int) -> TreeNode: self.findNodeAndParent(root, key) if self.node == root and (not root.left) and (...
class ResponseFunctionInterface(object): """ This response function interface provides a unique interface for all possible ways to calculate the value and gradient of a response. The interface is designed to be used in e.g. optimization, where the value and gradient of a response is required, howev...
class Responsefunctioninterface(object): """ This response function interface provides a unique interface for all possible ways to calculate the value and gradient of a response. The interface is designed to be used in e.g. optimization, where the value and gradient of a response is required, howev...
student = { "firstName": "Prasad", "lastName": "Honrao", "age": 37 } try: #try to get wrong value from dictionary last_name = student["last_name"] except KeyError as error: print("Exception thrown!") print(error) print("Done!")
student = {'firstName': 'Prasad', 'lastName': 'Honrao', 'age': 37} try: last_name = student['last_name'] except KeyError as error: print('Exception thrown!') print(error) print('Done!')
class Fibonacci(object): """Generate Fibonacci Numbers""" def __init__(self, length, first=0, second=1): """Set length and initials for the series""" if not isinstance(length, int): raise TypeError("Expected length to be 'int' got '%s'" % (length.__class__.__name__, )) if l...
class Fibonacci(object): """Generate Fibonacci Numbers""" def __init__(self, length, first=0, second=1): """Set length and initials for the series""" if not isinstance(length, int): raise type_error("Expected length to be 'int' got '%s'" % (length.__class__.__name__,)) if le...
class BaseAbort(object): def __init__(self, reason): self.reason = reason class PythonAbort(BaseAbort): def __init__(self, reason, pycode, lineno): super(PythonAbort, self).__init__(reason) self.pycode = pycode self.lineno = lineno def visit(self, visitor): return v...
class Baseabort(object): def __init__(self, reason): self.reason = reason class Pythonabort(BaseAbort): def __init__(self, reason, pycode, lineno): super(PythonAbort, self).__init__(reason) self.pycode = pycode self.lineno = lineno def visit(self, visitor): return...
coco_file = 'yolo/darknet/coco.names' yolo_cfg_file = 'yolo/darknet/yolov3-tiny.cfg' yolo_weights_file = 'yolo/darknet/yolov3-tiny.weights' img_size = (320,320) conf_threshold = 0.5 nms_threshold = 0.3
coco_file = 'yolo/darknet/coco.names' yolo_cfg_file = 'yolo/darknet/yolov3-tiny.cfg' yolo_weights_file = 'yolo/darknet/yolov3-tiny.weights' img_size = (320, 320) conf_threshold = 0.5 nms_threshold = 0.3
with open("log.txt", "r") as f: line = f.read() count = int(line) + 1 with open("log.txt", "w") as f: f.write(str(count))
with open('log.txt', 'r') as f: line = f.read() count = int(line) + 1 with open('log.txt', 'w') as f: f.write(str(count))
__title__ = 'grabstats' __description__ = 'Scrape NBA stats from Basketball-Reference' __url__ = 'https://github.com/kndo/grabstats' __version__ = '0.1.0' __author__ = 'Khanh Do' __author_email__ = 'dokhanh@gmail.com' __license__ = 'MIT License'
__title__ = 'grabstats' __description__ = 'Scrape NBA stats from Basketball-Reference' __url__ = 'https://github.com/kndo/grabstats' __version__ = '0.1.0' __author__ = 'Khanh Do' __author_email__ = 'dokhanh@gmail.com' __license__ = 'MIT License'
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def middleNode(self, head): """ :type head: ListNode :rtype: ListNode """ count = 0 tmp = head while tmp is not None...
class Listnode: def __init__(self, x): self.val = x self.next = None class Solution: def middle_node(self, head): """ :type head: ListNode :rtype: ListNode """ count = 0 tmp = head while tmp is not None: tmp = tmp.next ...
class Heap(): """ Min. Heap Class. PARAMETERS ========== arr: list heap array METHODS ======= parent(n): PARAMETERS ========== n: int index position of the child. RETURNS ======= int parent index...
class Heap: """ Min. Heap Class. PARAMETERS ========== arr: list heap array METHODS ======= parent(n): PARAMETERS ========== n: int index position of the child. RETURNS ======= int parent index p...
expected_output = { "ping": { "address": "2001:db8:223c:2c16::2", "data-bytes": 56, "result": [ { "bytes": 16, "from": "2001:db8:223c:2c16::2", "hlim": 64, "icmp-seq": 0, "time": "973.514", ...
expected_output = {'ping': {'address': '2001:db8:223c:2c16::2', 'data-bytes': 56, 'result': [{'bytes': 16, 'from': '2001:db8:223c:2c16::2', 'hlim': 64, 'icmp-seq': 0, 'time': '973.514'}, {'bytes': 16, 'from': '2001:db8:223c:2c16::2', 'hlim': 64, 'icmp-seq': 1, 'time': '0.993'}, {'bytes': 16, 'from': '2001:db8:223c:2c16...
#player class #constructor: player = white or black class Player: def __init__(self, player, username): self.player = player self.username = username def move(self, move): return def print(self): print(self.player) print(self.username) if __name__ == "__main__"...
class Player: def __init__(self, player, username): self.player = player self.username = username def move(self, move): return def print(self): print(self.player) print(self.username) if __name__ == '__main__': a = player('white', 'adarsh') a.print()
""" This class is an unmodified copy of one from a blog post written by Lennart Regebro at: http://regebro.wordpress.com/2010/12/13/python-implementing-rich-comparison-the-correct-way/ No license terms were specified in the blog post. It has been included as a minor convenience. If we ever need to purge our code of ex...
""" This class is an unmodified copy of one from a blog post written by Lennart Regebro at: http://regebro.wordpress.com/2010/12/13/python-implementing-rich-comparison-the-correct-way/ No license terms were specified in the blog post. It has been included as a minor convenience. If we ever need to purge our code of ex...
def joke(): return (u'Wenn ist das Nunst\u00fcck git und Slotermeyer? Ja! ... ' u'Beiherhund das Oder die Flipperwaldt gersput.')
def joke(): return u'Wenn ist das Nunstück git und Slotermeyer? Ja! ... Beiherhund das Oder die Flipperwaldt gersput.'
class HashSetString: _ARR_DEFAULT_LENGTH = 211 def __init__(self, arr_len=_ARR_DEFAULT_LENGTH): self._arr = [None,] * arr_len self._count = 0 def _hash_str_00(self, value): hashv = 0 for c in value: hashv = (hashv * 27 + ord(c)) % len(self._arr) return ha...
class Hashsetstring: _arr_default_length = 211 def __init__(self, arr_len=_ARR_DEFAULT_LENGTH): self._arr = [None] * arr_len self._count = 0 def _hash_str_00(self, value): hashv = 0 for c in value: hashv = (hashv * 27 + ord(c)) % len(self._arr) return ha...
class Solution: def validIPAddress(self, IP: str) -> str: res = 'Neither' if IP.count(".") == 3: for value in IP.split("."): temp_value = re.sub(r'[^0-9]', '', value) if not temp_value or not str(int(temp_value)) == value or...
class Solution: def valid_ip_address(self, IP: str) -> str: res = 'Neither' if IP.count('.') == 3: for value in IP.split('.'): temp_value = re.sub('[^0-9]', '', value) if not temp_value or not str(int(temp_value)) == value or int(temp_value) < 0 or (int(t...
# Escape the ' caracter story_description = 'It\'s a touching story' print(story_description) # Escape the \ caracter story_description = "It\\'s a touching story" print(story_description) # Break Line story_description = 'It\'s a \n touching \n story'
story_description = "It's a touching story" print(story_description) story_description = "It\\'s a touching story" print(story_description) story_description = "It's a \n touching \n story"
class IAsyncResult: """ Represents the status of an asynchronous operation. """ def __init__(self,*args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass AsyncState=property(lambda self: object(),lambda sel...
class Iasyncresult: """ Represents the status of an asynchronous operation. """ def __init__(self, *args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass async_state = property(lambda self...
a = source() b = k if(a == w): b = c elif(a==y): b = d sink(b)
a = source() b = k if a == w: b = c elif a == y: b = d sink(b)
FORMER_TEAM_NAME_MAP = { 'AFC Bournemouth': 'AFC Bournemouth', 'Accrington FC': 'Accrington FC', 'Arsenal FC': 'Arsenal FC', 'Aston Villa': 'Aston Villa', 'Barnsley FC': 'Barnsley FC', 'Birmingham City': 'Birmingham City', 'Birmingham FC': 'Birmingham City', 'Blackburn Rovers': 'Blackbur...
former_team_name_map = {'AFC Bournemouth': 'AFC Bournemouth', 'Accrington FC': 'Accrington FC', 'Arsenal FC': 'Arsenal FC', 'Aston Villa': 'Aston Villa', 'Barnsley FC': 'Barnsley FC', 'Birmingham City': 'Birmingham City', 'Birmingham FC': 'Birmingham City', 'Blackburn Rovers': 'Blackburn Rovers', 'Blackpool FC': 'Black...
class RouteWithTooSmallCapacity(Exception): pass class RebalanceFailure(Exception): pass class NoRouteError(Exception): pass class DryRunException(Exception): pass class PaymentTimeOut(Exception): pass class TooExpensive(Exception): pass
class Routewithtoosmallcapacity(Exception): pass class Rebalancefailure(Exception): pass class Norouteerror(Exception): pass class Dryrunexception(Exception): pass class Paymenttimeout(Exception): pass class Tooexpensive(Exception): pass
"""Meta data for HTTPie options.""" FLAG_OPTIONS = [ ('--body', 'Print only response body'), ('--check-status', 'Check HTTP status code'), ('--continue', 'Resume an interrupted download'), ('--debug', 'Print debug information'), ('--download', 'Download as a file'), ('--follow', 'Allow full red...
"""Meta data for HTTPie options.""" flag_options = [('--body', 'Print only response body'), ('--check-status', 'Check HTTP status code'), ('--continue', 'Resume an interrupted download'), ('--debug', 'Print debug information'), ('--download', 'Download as a file'), ('--follow', 'Allow full redirects'), ('--form', 'Send...
QWORD = 8 DWORD = 4 WORD = 2 BYTE = 1
qword = 8 dword = 4 word = 2 byte = 1
# -*- coding: utf-8 -*- # # IceCream - Never use print() to debug again # # Ansgar Grunseid # grunseid.com # grunseid@gmail.com # # License: MIT # __title__ = 'icecream' __license__ = 'MIT' __version__ = '2.1.1' __author__ = 'Ansgar Grunseid' __contact__ = 'grunseid@gmail.com' __url__ = 'https://github.com/gruns/icec...
__title__ = 'icecream' __license__ = 'MIT' __version__ = '2.1.1' __author__ = 'Ansgar Grunseid' __contact__ = 'grunseid@gmail.com' __url__ = 'https://github.com/gruns/icecream' __description__ = 'Never use print() to debug again; inspect variables, expressions, and program execution with a single, simple function call....
all_datasets = { 'macdebug': 'macdebug', '128leftonly': 'ords062', '128w': 'ords064sc9', '128valsame': 'ords064sc9', }
all_datasets = {'macdebug': 'macdebug', '128leftonly': 'ords062', '128w': 'ords064sc9', '128valsame': 'ords064sc9'}
ternary = [0, 1, 2] ternary[0] = "true" ternary[1] = "maybe" ternary[2] = "false" x = 34 y = 34 if x > y: print(ternary[0]) elif x < y: print(ternary[2]) else: print(ternary[1])
ternary = [0, 1, 2] ternary[0] = 'true' ternary[1] = 'maybe' ternary[2] = 'false' x = 34 y = 34 if x > y: print(ternary[0]) elif x < y: print(ternary[2]) else: print(ternary[1])
# # PySNMP MIB module FDDI-SMT73-MIB (http://pysnmp.sf.net) # ASN.1 source http://mibs.snmplabs.com:80/asn1/FDDI-SMT73-MIB # Produced by pysmi-0.0.7 at Sun Feb 14 00:12:32 2016 # On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose # Using Python version 3.5.0 (default, Jan 5 2016, 17:11:52) # ...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersection, value_range_constraint, single_value_constraint, constraints_union) ...
#/usr/bin/env python """ globifest/globitest/__init__.py - globifest Library Package Copyright 2018, Daniel Kristensen, Garmin Ltd, or its subsidiaries. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following c...
""" globifest/globitest/__init__.py - globifest Library Package Copyright 2018, Daniel Kristensen, Garmin Ltd, or its subsidiaries. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: ...
# Division print(5 / 8) # Addition print(7 + 10)
print(5 / 8) print(7 + 10)
# import os # import pytest def pytest_runtest_setup(item): pass """ if "1" != os.environ.get("PKG_NSF_FACTORY_INSTALL_IN_ENV"): pytest.skip( "Should be run only from build environement. " "See `PKG_NSF_FACTORY_INSTALL_IN_ENV`.") """
def pytest_runtest_setup(item): pass '\n if "1" != os.environ.get("PKG_NSF_FACTORY_INSTALL_IN_ENV"):\n pytest.skip(\n "Should be run only from build environement. "\n "See `PKG_NSF_FACTORY_INSTALL_IN_ENV`.")\n '
# Password validation # https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators AUTH_USER_MODEL = 'users.User' AUTHENTICATION_BACKENDS = [ 'pg_rest_api.backends.PGBackend', 'django.contrib.auth.backends.ModelBackend' ] AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.au...
auth_user_model = 'users.User' authentication_backends = ['pg_rest_api.backends.PGBackend', 'django.contrib.auth.backends.ModelBackend'] auth_password_validators = [{'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'}, {'NAME': 'django.contrib.auth.password_validation.MinimumLengthValida...
def get_fp_addsub(f): return f["addpd"] + f["addsd"] + f["addss"] + f["addps"] + f["subpd"] + f["subsd"] + f["subss"] + f["subps"] def get_fp_muldiv(f): return f["mulpd"] + f["mulsd"] + f["mulss"] + f["mulps"] + f["divpd"] + f["divsd"] + f["divss"] + f["divps"]
def get_fp_addsub(f): return f['addpd'] + f['addsd'] + f['addss'] + f['addps'] + f['subpd'] + f['subsd'] + f['subss'] + f['subps'] def get_fp_muldiv(f): return f['mulpd'] + f['mulsd'] + f['mulss'] + f['mulps'] + f['divpd'] + f['divsd'] + f['divss'] + f['divps']
#!/usr/bin/python3 ## author: jinchoiseoul@gmail.com def parse_io(inp, out): ''' io means input/output for testcases; It splitlines them and strip the elements @param inp: multi-lined str @param out: multi-lined str @return (inp::[str], out::[str]) ''' inp = [i.strip() for i...
def parse_io(inp, out): """ io means input/output for testcases; It splitlines them and strip the elements @param inp: multi-lined str @param out: multi-lined str @return (inp::[str], out::[str]) """ inp = [i.strip() for i in inp.splitlines() if i.strip()] out = [o.strip()...
N = int(input()) A = [0]*N for i in N: A[i] = int(input())
n = int(input()) a = [0] * N for i in N: A[i] = int(input())
class BaseMeta(type): def __new__(cls, name, bases, namespace): return super().__new__(cls, name, bases, namespace) class MyMeta(BaseMeta): def __new__(cls, name, bases, namespace): return super().__new__(cls, name, bases, namespace)
class Basemeta(type): def __new__(cls, name, bases, namespace): return super().__new__(cls, name, bases, namespace) class Mymeta(BaseMeta): def __new__(cls, name, bases, namespace): return super().__new__(cls, name, bases, namespace)
f = open("Writetofile.txt", "a") f.write("Lipika\n") f.write("Ugain\n") f.write("Shivam\n") f.write("Sanjeev\n") print("Data written to the file using append mode") f.close()
f = open('Writetofile.txt', 'a') f.write('Lipika\n') f.write('Ugain\n') f.write('Shivam\n') f.write('Sanjeev\n') print('Data written to the file using append mode') f.close()
class Solution: def findMaxConsecutiveOnes(self, nums): """ :type nums: List[int] :rtype: int """ p1 = 0 p2 = 0 cnt = 0 ret = 0 zeros = 0 while p1 <= p2 and p1 < len(nums) and p2 < len(nums): while zeros < 2 and p2 < len(n...
class Solution: def find_max_consecutive_ones(self, nums): """ :type nums: List[int] :rtype: int """ p1 = 0 p2 = 0 cnt = 0 ret = 0 zeros = 0 while p1 <= p2 and p1 < len(nums) and (p2 < len(nums)): while zeros < 2 and p2 < l...
T = int(input()) def calc_op(l): cnt = 0 for i in range(len(l)): if l[i] % 2 == 0: cnt += l[i]//2 else: cnt += l[i]//2+1 return cnt for _ in range(T): N = int(input()) l = list(map(int, input().split()))[1:-1] if len(l) == 1: if l[0]%2 == 0: ...
t = int(input()) def calc_op(l): cnt = 0 for i in range(len(l)): if l[i] % 2 == 0: cnt += l[i] // 2 else: cnt += l[i] // 2 + 1 return cnt for _ in range(T): n = int(input()) l = list(map(int, input().split()))[1:-1] if len(l) == 1: if l[0] % 2 == ...
''' Represents a single filter on a column. ''' class DrawRequestColumnFilter: ''' Initialize the filter with the column name, filter text, and operation (must be "=", "<=", ">=", "<", ">", or "!="). ''' def __init__(self, column_name, filter_text, operation): self.name = column_name ...
""" Represents a single filter on a column. """ class Drawrequestcolumnfilter: """ Initialize the filter with the column name, filter text, and operation (must be "=", "<=", ">=", "<", ">", or "!="). """ def __init__(self, column_name, filter_text, operation): self.name = column_name ...
# -*- coding: utf-8 -*- __author__ = 'Jonathan Moore' __email__ = 'firstnamelastnamephd@gmail.com' __version__ = '0.1.0'
__author__ = 'Jonathan Moore' __email__ = 'firstnamelastnamephd@gmail.com' __version__ = '0.1.0'
# md5 : b27c56d844ab064547d40bf4f0a96eae # sha1 : c314e447018b0d8711347ee26a5795480837b2d3 # sha256 : c045615fe1b44a6409610e4e94e70f1559325eb55ab1f805b0452e852771c0ae ord_names = { 1: b'SQLAllocConnect', 2: b'SQLAllocEnv', 3: b'SQLAllocStmt', 4: b'SQLBindCol', 5: b'SQLCancel', 6: b'SQLColAttrib...
ord_names = {1: b'SQLAllocConnect', 2: b'SQLAllocEnv', 3: b'SQLAllocStmt', 4: b'SQLBindCol', 5: b'SQLCancel', 6: b'SQLColAttributes', 7: b'SQLConnect', 8: b'SQLDescribeCol', 9: b'SQLDisconnect', 10: b'SQLError', 11: b'SQLExecDirect', 12: b'SQLExecute', 13: b'SQLFetch', 14: b'SQLFreeConnect', 15: b'SQLFreeEnv', 16: b'SQ...
"""Constants for Cloudflare.""" DOMAIN = "cloudflare" # Config CONF_RECORDS = "records" # Defaults DEFAULT_UPDATE_INTERVAL = 60 # in minutes # Services SERVICE_UPDATE_RECORDS = "update_records"
"""Constants for Cloudflare.""" domain = 'cloudflare' conf_records = 'records' default_update_interval = 60 service_update_records = 'update_records'
# part 1 def check_numbers(a,b): print (a+b) check_numbers(2,6) # part 2 def check_numbers_list(a,b): i=0 if len(a)==len(b): while i<len(a): check_numbers(a[i],b[i]) i +=1 else: print ("lists ki len barabar nahi hai") check_numbers_list([10,30,40],[40,20,21])
def check_numbers(a, b): print(a + b) check_numbers(2, 6) def check_numbers_list(a, b): i = 0 if len(a) == len(b): while i < len(a): check_numbers(a[i], b[i]) i += 1 else: print('lists ki len barabar nahi hai') check_numbers_list([10, 30, 40], [40, 20, 21])
num = int(input()) soma2 = 0 soma3 = 0 soma4 = 0 soma5 = 0 lista = [int(i) for i in input().split()] for i in range(num): if(lista[i] % 2 == 0): soma2 = soma2 + 1 if(lista[i] % 3 == 0): soma3 = soma3 + 1 if(lista[i] % 4 == 0): soma4 = soma4 + 1 if(lista[i] % 5 == 0)...
num = int(input()) soma2 = 0 soma3 = 0 soma4 = 0 soma5 = 0 lista = [int(i) for i in input().split()] for i in range(num): if lista[i] % 2 == 0: soma2 = soma2 + 1 if lista[i] % 3 == 0: soma3 = soma3 + 1 if lista[i] % 4 == 0: soma4 = soma4 + 1 if lista[i] % 5 == 0: soma5 = ...
def lambda_handler(event, context): name = event.get("name") if not name: name = "person who does not want to give their name" return { "hello": f"hello {name}"}
def lambda_handler(event, context): name = event.get('name') if not name: name = 'person who does not want to give their name' return {'hello': f'hello {name}'}
# print_squares_upto_limit(30) # //For limit = 30, output would be 1 4 9 16 25 # # print_cubes_upto_limit(30) # //For limit = 30, output would be 1 8 27 def print_squares_upto_limit(limit): i = 1 while i * i < limit: print(i*i, end = " ") i = i + 1 def print_cubes_upto_limit(limit): i = 1 ...
def print_squares_upto_limit(limit): i = 1 while i * i < limit: print(i * i, end=' ') i = i + 1 def print_cubes_upto_limit(limit): i = 1 while i * i * i < limit: print(i * i * i, end=' ') i = i + 1 print_cubes_upto_limit(80)
#!/usr/bin/env python print("test1 -- > 1") print("test1 -- > 2") print("test1 -- > 3")
print('test1 -- > 1') print('test1 -- > 2') print('test1 -- > 3')
MX_ROBOT_MAX_NB_ACCELEROMETERS = 1 MX_DEFAULT_ROBOT_IP = "192.168.0.100" MX_ROBOT_TCP_PORT_CONTROL = 10000 MX_ROBOT_TCP_PORT_FEED = 10001 MX_ROBOT_UDP_PORT_TRACE = 10002 MX_ROBOT_UDP_PORT_RT_CTRL = 10003 MX_CHECKPOINT_ID_MIN = 1 MX_CHECKPOINT_ID_MAX = 8000 MX_ACCELEROMETER_UNIT_PER_G = 16000 MX_GRAVITY_MPS2 = 9.8067 MX...
mx_robot_max_nb_accelerometers = 1 mx_default_robot_ip = '192.168.0.100' mx_robot_tcp_port_control = 10000 mx_robot_tcp_port_feed = 10001 mx_robot_udp_port_trace = 10002 mx_robot_udp_port_rt_ctrl = 10003 mx_checkpoint_id_min = 1 mx_checkpoint_id_max = 8000 mx_accelerometer_unit_per_g = 16000 mx_gravity_mps2 = 9.8067 mx...
flowers = input() qty = int(input()) budget = int(input()) price = 0 Roses = 5 Dahlias = 3.8 Tulips = 2.8 Narcissus = 3 Gladiolus = 2.5 if flowers == "Roses": if qty > 80: price = Roses * qty * 0.9 else: price = Roses * qty elif flowers == "Dahlias": if qty > 90: price = Dahlias *...
flowers = input() qty = int(input()) budget = int(input()) price = 0 roses = 5 dahlias = 3.8 tulips = 2.8 narcissus = 3 gladiolus = 2.5 if flowers == 'Roses': if qty > 80: price = Roses * qty * 0.9 else: price = Roses * qty elif flowers == 'Dahlias': if qty > 90: price = Dahlias * qt...
def get_divisors(n): sum = 1 for i in range(2, int(n ** 0.5 + 1)): if n % i == 0: sum += i sum += n / i return sum def find_amicable_pair(): total = 0 for x in range(1, 10001): a = get_divisors(x) b = get_divisors(a) if b == x and x != a: ...
def get_divisors(n): sum = 1 for i in range(2, int(n ** 0.5 + 1)): if n % i == 0: sum += i sum += n / i return sum def find_amicable_pair(): total = 0 for x in range(1, 10001): a = get_divisors(x) b = get_divisors(a) if b == x and x != a: ...
#sandwiches: def orderedsandwich(items): list_of_items = [] for item in items: list_of_items.append(item) print("This is items you ordered in your sandwich:") for item in list_of_items: print(item) orderedsandwich(['kela','aloo']) orderedsandwich(['cheese','poteto']) orderedsandwich(['...
def orderedsandwich(items): list_of_items = [] for item in items: list_of_items.append(item) print('This is items you ordered in your sandwich:') for item in list_of_items: print(item) orderedsandwich(['kela', 'aloo']) orderedsandwich(['cheese', 'poteto']) orderedsandwich(['uiyer'])
class Player: name: str hp: int mp: int skills: dict def __init__(self, name: str, hp: int, mp: int): self.name = name self.hp = hp self.mp = mp self.skills = {} self.guild = 'Unaffiliated' def add_skill(self, skill_name, mana_cost): skills = [x ...
class Player: name: str hp: int mp: int skills: dict def __init__(self, name: str, hp: int, mp: int): self.name = name self.hp = hp self.mp = mp self.skills = {} self.guild = 'Unaffiliated' def add_skill(self, skill_name, mana_cost): skills = [x ...
students_number=int(input("Enter number of Students :")) per_student_kharcha=int(input("Enter per student expense :")) total_kharcha=students_number*per_student_kharcha if total_kharcha<50000: print ("Ham kharche ke andar hai ") else: print ("kharche se bahar hai ")
students_number = int(input('Enter number of Students :')) per_student_kharcha = int(input('Enter per student expense :')) total_kharcha = students_number * per_student_kharcha if total_kharcha < 50000: print('Ham kharche ke andar hai ') else: print('kharche se bahar hai ')
# # Language constants # WELCOME = " Welcome to arpspoofKicker!" # # Universal # SELECT_AN_OPTION = "Select an option" # # main # MENU = "\n1. ARPSpoof a single device\n" \ "2. ARPSpoof a multiple devices\n" \ "E. Exit" MENU_1 = "\n1. ARPSpoof a single device\n" \ "2. ARPSpoof a multipl...
welcome = ' Welcome to arpspoofKicker!' select_an_option = 'Select an option' menu = '\n1. ARPSpoof a single device\n2. ARPSpoof a multiple devices\nE. Exit' menu_1 = '\n1. ARPSpoof a single device\n2. ARPSpoof a multiple devices\n3. Run thread(s) in queue\n4. Stop running thread(s)\n5. Print thread(s) status\nE. Sto...
class JackTokenizer: def __init__(self, src_file_name): self._line_index = 0 self._line_index = 0 self._lines = [] f = open(src_file_name) # First assesment of the Assembler for line in f.readlines(): strip_line = line.lstrip() # Skipping ...
class Jacktokenizer: def __init__(self, src_file_name): self._line_index = 0 self._line_index = 0 self._lines = [] f = open(src_file_name) for line in f.readlines(): strip_line = line.lstrip() if len(strip_line) == 0 or strip_line[0:2] == '//': ...
jolts = [0] while True: try: a = int(input()) jolts.append(a) except: break jolts.sort() jolts.append(jolts[-1] + 3) diffs = [0, 0] for i in range(1,len(jolts)): if jolts[i] - jolts[i-1] == 1: diffs[0] += 1 elif jolts[i] - jolts[i-1] == 3: diffs[1] += 1 print(di...
jolts = [0] while True: try: a = int(input()) jolts.append(a) except: break jolts.sort() jolts.append(jolts[-1] + 3) diffs = [0, 0] for i in range(1, len(jolts)): if jolts[i] - jolts[i - 1] == 1: diffs[0] += 1 elif jolts[i] - jolts[i - 1] == 3: diffs[1] += 1 print...
def gen_serial(username): log_10 = 0 log_14 = 0 log_15 = 0 eax = '' edx = '' ecx = '' for c in username: hex_symbol = hex(ord(c)) eax = hex_symbol eax = log_15 eax = eax << 2 log_10 = log_10 + eax eax = hex_symbol edx = log_10 edx = edx - int(eax, 16) eax = 0x0fa eax = eax ^ edx log_10 = e...
def gen_serial(username): log_10 = 0 log_14 = 0 log_15 = 0 eax = '' edx = '' ecx = '' for c in username: hex_symbol = hex(ord(c)) eax = hex_symbol eax = log_15 eax = eax << 2 log_10 = log_10 + eax eax = hex_symbol edx = log_10 e...
def clean_t (data): # Select columns to clean df = data # Create dummies using the items in the list of 'safety&security' column ss = df['safety_security'].dropna() df_new = df.join(ss.str.join('|').str.get_dummies().add_prefix('ss_')) # Drop 'safety_security' column df_new.drop('s...
def clean_t(data): df = data ss = df['safety_security'].dropna() df_new = df.join(ss.str.join('|').str.get_dummies().add_prefix('ss_')) df_new.drop('safety_security', axis=1, inplace=True) df_new['model'] = df.model.apply(lambda x: x[1]) df_new['make'] = df.make.str.strip('\n') df_new.drop(c...
def extractDustToRust(item): """ Parser for 'Dust to Rust' """ vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or 'preview' in item['title'].lower(): return None if 'Kyuuketsu Hime' in item['tags']: return buildReleaseMessageWithType(item, 'Kyuuketsu Hime wa Barai...
def extract_dust_to_rust(item): """ Parser for 'Dust to Rust' """ (vol, chp, frag, postfix) = extract_vol_chapter_fragment_postfix(item['title']) if not (chp or vol) or 'preview' in item['title'].lower(): return None if 'Kyuuketsu Hime' in item['tags']: return build_release_message_wit...
#encoding=utf-8 #Manacher is to find the longest Palindrome substring #normally, the time complexity is O(n2) #In order to reduce the time complexity #It tries to use the previous palindrome data #to reduce the time complexsity to O(n) def FindLongestPalindrome(str_line): p = [1]* len(str_line) mx = 1 i...
def find_longest_palindrome(str_line): p = [1] * len(str_line) mx = 1 id = 0 for i in range(1, len(str_line)): if mx > i: p[i] = min(p[2 * id - i], mx - i) idx = p[i] while i + idx < len(str_line) and str_line[i - idx] == str_line[i + idx]: p[i] = p[i] + 1...
# gunicorn config file access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s" "pid=%(p)s"' raw_env = [ 'FLASK_APP=webhook', ] bind="0.0.0.0:5000" workers=5 accesslog="-"
access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s" "pid=%(p)s"' raw_env = ['FLASK_APP=webhook'] bind = '0.0.0.0:5000' workers = 5 accesslog = '-'