content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
_base_ = [
'../../_base_/models/detr.py',
'../../_base_/datasets/mot15.py',
'../../_base_/default_runtime.py'
#'../../_base_/datasets/mot_challenge.py',
]
custom_imports = dict(imports=['mmtrack.models.mot.kf'], allow_failed_imports=False)
link = 'https://download.openmmlab.com/mmdetection/v2.0/detr... | _base_ = ['../../_base_/models/detr.py', '../../_base_/datasets/mot15.py', '../../_base_/default_runtime.py']
custom_imports = dict(imports=['mmtrack.models.mot.kf'], allow_failed_imports=False)
link = 'https://download.openmmlab.com/mmdetection/v2.0/detr/detr_r50_8x2_150e_coco/detr_r50_8x2_150e_coco_20201130_194835-2c... |
_base_ = [
'../_base_/default_runtime.py'
]
model = dict(
type='opera.InsPose',
backbone=dict(
type='mmdet.ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_eval=False,
style='pytorch',
init_cfg=dict(type='Pretrai... | _base_ = ['../_base_/default_runtime.py']
model = dict(type='opera.InsPose', backbone=dict(type='mmdet.ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_eval=False, style='pytorch', init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')), neck=dict(type='mmdet.FPN', in_chan... |
class Employee():
def __init__(self, first_name, last_name, money):
self.first_name = first_name
self.last_name = last_name
self.money = money
def give_raise(self, add_money=5000):
self.money += add_money
return self.money
| class Employee:
def __init__(self, first_name, last_name, money):
self.first_name = first_name
self.last_name = last_name
self.money = money
def give_raise(self, add_money=5000):
self.money += add_money
return self.money |
def add(x,y):
return x + y
def multiply(x,y):
return x * y
def subtract(x,y):
return x - y
def divide(x,y):
return y/x
def power(x,y):
return x**y | def add(x, y):
return x + y
def multiply(x, y):
return x * y
def subtract(x, y):
return x - y
def divide(x, y):
return y / x
def power(x, y):
return x ** y |
# EclipseCon Europe Che Challenge
#
# This program prints the numbers from 1 to 100, with every multiple of 3
# replaced by "Fizz", and every multiple of 5 replaced by "Buzz". Numbers
# divisible by both are replaced by "FizzBuzz". Otherwise, the program
# prints the number.
#
# Your mission, if you choose to accept it... | for i in range(1, 101):
num = '%s' % i
if i % 3 == 0:
num = 'Fizz'
if i % 5 == 0:
num = 'Buzz'
print(f'{num}') |
class DataPacker:
#list data type will only write out the values without the key
@staticmethod
def dataTypeList():
return "list"
@staticmethod
def dataTypeObject():
return "object"
def __init__(self, type):
self.type = type
self.data = []
def add_pair(... | class Datapacker:
@staticmethod
def data_type_list():
return 'list'
@staticmethod
def data_type_object():
return 'object'
def __init__(self, type):
self.type = type
self.data = []
def add_pair(self, key, value):
self.data.append([key, value])
def ... |
#! /usr/bin/python
# Filename: object_init
# Description: the constructor in python
class Persion:
def __init__(self, name):
self.name = name
def sayHi(self):
print(self.name)
test = Persion("Hello,world")
test.sayHi()
| class Persion:
def __init__(self, name):
self.name = name
def say_hi(self):
print(self.name)
test = persion('Hello,world')
test.sayHi() |
arr = [-3, 4, 8, -2, -1, 5, 4, 8]
for i in range(0, len(arr)-1):
if(arr[i] > 0):
#num is positive
temp = arr[i]
arr[i] = arr[i+1]
arr[i+1] = temp
print(arr)
| arr = [-3, 4, 8, -2, -1, 5, 4, 8]
for i in range(0, len(arr) - 1):
if arr[i] > 0:
temp = arr[i]
arr[i] = arr[i + 1]
arr[i + 1] = temp
print(arr) |
class Rememberer:
def __init__(self):
self.funcs = []
def register(self, fn):
self.funcs.append(fn)
fn.__conform__ = lambda new: self.recode(fn, new)
return self
def recode(self, fn, new):
if new is None:
self.funcs.remove(fn)
else:
... | class Rememberer:
def __init__(self):
self.funcs = []
def register(self, fn):
self.funcs.append(fn)
fn.__conform__ = lambda new: self.recode(fn, new)
return self
def recode(self, fn, new):
if new is None:
self.funcs.remove(fn)
else:
... |
# Create a program that reads an integer and shows on the screen whether it is even or odd
n = int(input('Type a integer: '))
if n % 2 == 0:
print('The number {} is {} EVEN {}'.format(n, '\033[1;31;40m', '\033[m'))
else:
print('The number {} is {} ODD {}'.format(n, '\033[7;30m', '\033[m'))
| n = int(input('Type a integer: '))
if n % 2 == 0:
print('The number {} is {} EVEN {}'.format(n, '\x1b[1;31;40m', '\x1b[m'))
else:
print('The number {} is {} ODD {}'.format(n, '\x1b[7;30m', '\x1b[m')) |
# Handshake
# Count the number of Handshakes in a board meeting.
#
# https://www.hackerrank.com/challenges/handshake/problem
#
T = int(input())
for a0 in range(T):
N = int(input())
print(N * (N - 1) // 2)
| t = int(input())
for a0 in range(T):
n = int(input())
print(N * (N - 1) // 2) |
inicial = int(input('Qual o numero inicial?'))
final = int(input('Qual o numero final?'))
x = inicial
while( x <= final):
if(x % 2 == 0):
print(x)
x = x + 1 | inicial = int(input('Qual o numero inicial?'))
final = int(input('Qual o numero final?'))
x = inicial
while x <= final:
if x % 2 == 0:
print(x)
x = x + 1 |
def main_screen(calendar):
while True:
print("What would you like to do? ")
print("\ta) Add event")
print("\tb) Delete event")
print("\tc) Print events")
print("\td) Exit")
answer = input(" $ ")
if "a" in answer:
add_event(calendar)
elif "... | def main_screen(calendar):
while True:
print('What would you like to do? ')
print('\ta) Add event')
print('\tb) Delete event')
print('\tc) Print events')
print('\td) Exit')
answer = input(' $ ')
if 'a' in answer:
add_event(calendar)
elif 'b... |
def levenshtein_Distance(word1,word2):
word1="#"+word1
wordTmp="#"+word2
letters1 = list(word1)
letters2 = list(wordTmp)
# Initializing table
table = [ [0 for i in range(len(word1))] for j in range(len(wordTmp))]
for i in range (len(word1)):
table[0][i] = i
fo... | def levenshtein__distance(word1, word2):
word1 = '#' + word1
word_tmp = '#' + word2
letters1 = list(word1)
letters2 = list(wordTmp)
table = [[0 for i in range(len(word1))] for j in range(len(wordTmp))]
for i in range(len(word1)):
table[0][i] = i
for j in range(len(wordTmp)):
... |
#
# PySNMP MIB module ACMEPACKET-PRODUCTS (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ACMEPACKET-PRODUCTS
# Produced by pysmi-0.3.4 at Mon Apr 29 16:57:56 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (acmepacket,) = mibBuilder.importSymbols('ACMEPACKET-SMI', 'acmepacket')
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, s... |
# Feature flag to raise an exception in case of a non existing device feature.
# The flag should be fully removed in a later release.
# It allows dependend libraries to gracefully migrate to the new behaviour
raise_exception_on_not_supported_device_feature = True
# Feature flag to raise exception if rate limit of the ... | raise_exception_on_not_supported_device_feature = True
raise_exception_on_rate_limit = True
raise_exception_on_command_failure = True |
class Solution:
def countOdds(self, low: int, high: int) -> int:
c = high - low + 1
if c % 2 == 1 and low % 2 == 1:
r = 1
else:
r = 0
return r + c // 2
| class Solution:
def count_odds(self, low: int, high: int) -> int:
c = high - low + 1
if c % 2 == 1 and low % 2 == 1:
r = 1
else:
r = 0
return r + c // 2 |
class Solution:
def reverseWords(self, s: str) -> str:
res, blank = '', False
for _ in s[::-1]:
res += _
return ' '.join(res.split()[::-1])
| class Solution:
def reverse_words(self, s: str) -> str:
(res, blank) = ('', False)
for _ in s[::-1]:
res += _
return ' '.join(res.split()[::-1]) |
# -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Crisis Mapping Toolkit (CMT) v1 platform is licensed under the Apache
#... | modis_classifiers = dict()
radar_classifiers = dict()
modis_classifiers['default'] = [(u'dartmouth', 0.30887438055782945, 1.4558371112080295), (u'b2', 2020.1975382568198, 0.9880130793929531), (u'MNDWI', 0.3677501330908955, 0.5140443440746121), (u'b2', 1430.1463073852296, 0.15367606716883875), (u'b1', 1108.5241042345276... |
def N():
for row in range(7):
for col in range(7):
if (col==0 or col==6) or row-col==0:
print("*",end=" ")
else:
print(end=" ")
print()
| def n():
for row in range(7):
for col in range(7):
if (col == 0 or col == 6) or row - col == 0:
print('*', end=' ')
else:
print(end=' ')
print() |
a=list(map(int,input().split(',')))[:4]
x,y,p,q=a[0],a[1],a[2],a[3]
b1,b2,b3=1,1,1
print(b1,'C',x,b2,'H',y,',',b3,',C',p,'H',q)
print((b1*x+b2*y),(b3*(p*q)))
while (b1*x+b2*y)!=(b3*(p*q)):
while b1*x!=b3*p:
print('l1')
if b1*x!=p:
b1+=1
elif x!=b3*p:
b3+=1
... | a = list(map(int, input().split(',')))[:4]
(x, y, p, q) = (a[0], a[1], a[2], a[3])
(b1, b2, b3) = (1, 1, 1)
print(b1, 'C', x, b2, 'H', y, ',', b3, ',C', p, 'H', q)
print(b1 * x + b2 * y, b3 * (p * q))
while b1 * x + b2 * y != b3 * (p * q):
while b1 * x != b3 * p:
print('l1')
if b1 * x != p:
... |
league_schema_name = None
def tn(tablename: str) -> str:
if league_schema_name is not None:
return '`{0}`.`{1}`'.format(league_schema_name, tablename)
else:
return '`{0}`'.format(tablename)
| league_schema_name = None
def tn(tablename: str) -> str:
if league_schema_name is not None:
return '`{0}`.`{1}`'.format(league_schema_name, tablename)
else:
return '`{0}`'.format(tablename) |
A = [1, 2, 3]
for i, x in enumerate(A):
A[i] += x
B = A[0]
C = A[0]
D: int = 3
while C < A[2]:
C += 1
if C == A[2]:
print('True')
def main():
print("Main started")
print(A)
print(B)
print(C)
print(D)
if __name__ == '__main__':
main()
| a = [1, 2, 3]
for (i, x) in enumerate(A):
A[i] += x
b = A[0]
c = A[0]
d: int = 3
while C < A[2]:
c += 1
if C == A[2]:
print('True')
def main():
print('Main started')
print(A)
print(B)
print(C)
print(D)
if __name__ == '__main__':
main() |
# Folders
FOLDER_SCHEMA = "graphql"
# Packages
PACKAGE_RESOLVERS = "resolvers"
# Modules
MODULE_MODELS = "models"
MODULE_DIRECTIVES = "directives"
MODULE_SETTINGS = "settings"
MODULE_PYDANTIC = "pyd_models"
| folder_schema = 'graphql'
package_resolvers = 'resolvers'
module_models = 'models'
module_directives = 'directives'
module_settings = 'settings'
module_pydantic = 'pyd_models' |
# 2. Matching Parentheses
# You are given an algebraic expression with parentheses. Scan through the string and extract each set of parentheses.
# Print the result back on the console.
string = list(input())
stack_index = []
for index in range(len(string)):
if string[index] == "(":
stack_index.append(in... | string = list(input())
stack_index = []
for index in range(len(string)):
if string[index] == '(':
stack_index.append(index)
elif string[index] == ')':
start_index = stack_index.pop()
end_index = index
parentheses_set = string[start_index:end_index + 1]
print(''.join(paren... |
#
# PySNMP MIB module JUNIPER-FABRIC-CHASSIS (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/JUNIPER-FABRIC-CHASSIS
# Produced by pysmi-0.3.4 at Wed May 1 13:59:10 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_constraint, constraints_union, value_range_constraint, single_value_constraint) ... |
class Solution:
def minPathSum(self, grid: List[List[int]]) -> int:
rows=len(grid)
columns=len(grid[0])
for i in range(1,columns):
grid[0][i]+=grid[0][i-1]
for j in range(1,rows):
grid[j][0]+=grid[j-1][0]
for k in range(1,rows):
for l in ra... | class Solution:
def min_path_sum(self, grid: List[List[int]]) -> int:
rows = len(grid)
columns = len(grid[0])
for i in range(1, columns):
grid[0][i] += grid[0][i - 1]
for j in range(1, rows):
grid[j][0] += grid[j - 1][0]
for k in range(1, rows):
... |
'''
Take two sorted linked lists L, R and return the merge of L and R
Notes:
* when declaring a python class, inherit from object if not otherwise specified
* in the python class __init__ function, self is a required first argument
* next is a reserved name (iterator method) in python. use the variable name next_node ... | """
Take two sorted linked lists L, R and return the merge of L and R
Notes:
* when declaring a python class, inherit from object if not otherwise specified
* in the python class __init__ function, self is a required first argument
* next is a reserved name (iterator method) in python. use the variable name next_node ... |
PRED_TYPE = 'Basic'
TTA_PRED_TYPE = 'TTA'
ENS_TYPE = 'Ens'
MEGA_ENS_TYPE = 'MegaEns'
| pred_type = 'Basic'
tta_pred_type = 'TTA'
ens_type = 'Ens'
mega_ens_type = 'MegaEns' |
class Application:
def __init__(self, owner, raw):
self.id = raw['app_id']
self.owner_id = raw['owner_id']
self._update(owner, raw)
def _update(self, owner, raw):
self._raw = raw
self.owner = owner
self.name = raw['name']
self.type = raw['type']
... | class Application:
def __init__(self, owner, raw):
self.id = raw['app_id']
self.owner_id = raw['owner_id']
self._update(owner, raw)
def _update(self, owner, raw):
self._raw = raw
self.owner = owner
self.name = raw['name']
self.type = raw['type']
... |
# AUTOGENERATED! DO NOT EDIT! File to edit: 00_core.ipynb (unless otherwise specified).
__all__ = ['a']
# Cell
def a(b):
"qgerhwtejyrkafher arerhtrw"
return 10 | __all__ = ['a']
def a(b):
"""qgerhwtejyrkafher arerhtrw"""
return 10 |
print ("Hello there welcome to Medieval Village.")
print ("You have a village that you need to take care of. Choose one of the options to keep the village in good shape 1) Plant and harvest the crops 2) Use resources from the forest near the village 3) Get your defenses up")
user_choice = input()
user_choice = int(user... | print('Hello there welcome to Medieval Village.')
print('You have a village that you need to take care of. Choose one of the options to keep the village in good shape 1) Plant and harvest the crops 2) Use resources from the forest near the village 3) Get your defenses up')
user_choice = input()
user_choice = int(user_c... |
def solution(board, moves):
# At first, make stack of each columns
boardStack = [[] for _ in range(len(board[0]))]
for row in board[::-1]:
# Watch out, column index is subtracted by -1
for column, element in enumerate(row):
if element != 0:
boardStack[column].appe... | def solution(board, moves):
board_stack = [[] for _ in range(len(board[0]))]
for row in board[::-1]:
for (column, element) in enumerate(row):
if element != 0:
boardStack[column].append(element)
bucket_stack = []
exploded = 0
for move in moves:
if boardStac... |
repeat = int(input())
for x in range(repeat):
inlist = list(map( int, input().split()))
inlen = inlist.pop(0)
avg = sum(inlist)//inlen
inlist.sort()
for i in range(inlen):
if inlist[i] > avg:
result = (inlen-i)/inlen *100
break
result = 0
print("%.3f"%resu... | repeat = int(input())
for x in range(repeat):
inlist = list(map(int, input().split()))
inlen = inlist.pop(0)
avg = sum(inlist) // inlen
inlist.sort()
for i in range(inlen):
if inlist[i] > avg:
result = (inlen - i) / inlen * 100
break
result = 0
print('%.3f... |
#!/usr/bin/env python
#
# Copyright 2009-2020 NTESS. Under the terms
# of Contract DE-NA0003525 with NTESS, the U.S.
# Government retains certain rights in this software.
#
# Copyright (c) 2009-2020, NTESS
# All rights reserved.
#
# Portions are copyright of other developers:
# See the file CONTRIBUTORS.TXT in the top ... | clock = '100MHz'
memory_clock = '100MHz'
coherence_protocol = 'MSI'
memory_backend = 'timing'
memory_controllers_per_group = 1
groups = 8
memory_capacity = 16384 * 4
cpu_params = {'verbose': 0, 'printStats': 1}
l1cache_params = {'clock': clock, 'coherence_protocol': coherence_protocol, 'cache_frequency': clock, 'replac... |
class TBikeTruck:
def __init__(self, id, capacity, init_location):
self.id = id
self.capacity = capacity
self.location = init_location
self.bikes_count = 0
self.distance = 0
def to_json(self):
return {
'id': self.id,
'location_id': self.lo... | class Tbiketruck:
def __init__(self, id, capacity, init_location):
self.id = id
self.capacity = capacity
self.location = init_location
self.bikes_count = 0
self.distance = 0
def to_json(self):
return {'id': self.id, 'location_id': self.location.id, 'loaded_bikes... |
class Stack:
topIndex = 0
items = [None] * 64
def push(self, item):
self.topIndex += 1
self.items[self.topIndex] = item
def pop(self):
if self.topIndex == 0:
return None
else:
itemToReturn = self.items[self.topIndex]
self.topIndex -= 1
... | class Stack:
top_index = 0
items = [None] * 64
def push(self, item):
self.topIndex += 1
self.items[self.topIndex] = item
def pop(self):
if self.topIndex == 0:
return None
else:
item_to_return = self.items[self.topIndex]
self.topIndex ... |
# Cheering Expression (6510)
rinz = 2012007
scissorhands = 1162003
sweetness = 5160021
sm.setSpeakerID(rinz)
sm.sendNext("Welcome! What can I do for you today? ...A gift? For me? "
"Wow, a customer's never given me a gift before!")
sm.giveItem(sweetness)
sm.completeQuest(parentID)
sm.consumeItem(scissorhands)
sm.s... | rinz = 2012007
scissorhands = 1162003
sweetness = 5160021
sm.setSpeakerID(rinz)
sm.sendNext("Welcome! What can I do for you today? ...A gift? For me? Wow, a customer's never given me a gift before!")
sm.giveItem(sweetness)
sm.completeQuest(parentID)
sm.consumeItem(scissorhands)
sm.sendNext(''.join(['WOW! #t', repr(scis... |
# Copyright 2019 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
config_type='sweetberry'
inas = [
('sweetberry', '0x40:3', 'pp1050_a', 1.05, 0.010, 'j2', True), # R462, SOC
('sweetberry', '0x40:1', '... | config_type = 'sweetberry'
inas = [('sweetberry', '0x40:3', 'pp1050_a', 1.05, 0.01, 'j2', True), ('sweetberry', '0x40:1', 'pp1050_st', 1.05, 0.01, 'j2', True), ('sweetberry', '0x40:2', 'pp1050_stg', 1.05, 0.01, 'j2', True), ('sweetberry', '0x40:0', 'pp1200_dram_u', 1.2, 0.01, 'j2', True), ('sweetberry', '0x41:3', 'pp18... |
def selectionSort(A):
for i in range(len(A) - 1):
index_min = i
value_min = A[i]
for j in range(i + 1, len(A)):
if A[j] < value_min:
index_min = j
value_min = A[j]
A[index_min] = A[i]
A[i] = value_min
return A
def insertionS... | def selection_sort(A):
for i in range(len(A) - 1):
index_min = i
value_min = A[i]
for j in range(i + 1, len(A)):
if A[j] < value_min:
index_min = j
value_min = A[j]
A[index_min] = A[i]
A[i] = value_min
return A
def insertion_so... |
#
# LeetCode
#
# Problem - 386
# URL - https://leetcode.com/problems/lexicographical-numbers/
#
class Solution:
def lexicalOrder(self, n: int) -> List[int]:
ans = []
for i in range(1, n+1):
ans.insert(bisect.bisect_left(ans, str(i)), str(i))
return ans
| class Solution:
def lexical_order(self, n: int) -> List[int]:
ans = []
for i in range(1, n + 1):
ans.insert(bisect.bisect_left(ans, str(i)), str(i))
return ans |
def _method(f): return lambda *l, **d: f(i, *l, **d)
class o:
def __init__(i, **d): i.__dict__.update(**d)
def __repr__(i): return str(
{k: (v.__name__ + "()" if callable(v) else v)
for k, v in sorted(i.__dict__.items()) if k[0] != "_"})
def of(i, **methods):
for k, f in methods.items():
i.__di... | def _method(f):
return lambda *l, **d: f(i, *l, **d)
class O:
def __init__(i, **d):
i.__dict__.update(**d)
def __repr__(i):
return str({k: v.__name__ + '()' if callable(v) else v for (k, v) in sorted(i.__dict__.items()) if k[0] != '_'})
def of(i, **methods):
for (k, f) in methods.ite... |
class Solution:
def romanToInt(self, s: str) -> int:
romanMap = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
result = 0
prev = 1000
for c in s:
curr = romanMap[c]
if curr > prev:
result += curr - prev*2
else:
... | class Solution:
def roman_to_int(self, s: str) -> int:
roman_map = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
result = 0
prev = 1000
for c in s:
curr = romanMap[c]
if curr > prev:
result += curr - prev * 2
el... |
'''
Design a calculator which will solve all the problems correctly except for
1. 45*3 = 555
2. 56+9 = 77
3. 56/6 = 4
Your program should take two numbers, operator as input and show the output.
'''
def add(n1,n2):
''' To add the given numbers '''
result = n1+n2
return result
def sub(n1,n2):
''' To ... | """
Design a calculator which will solve all the problems correctly except for
1. 45*3 = 555
2. 56+9 = 77
3. 56/6 = 4
Your program should take two numbers, operator as input and show the output.
"""
def add(n1, n2):
""" To add the given numbers """
result = n1 + n2
return result
def sub(n1, n2):
"""... |
'''
0: 1: 2: 3: 4:
aaaa .... aaaa aaaa ....
b c . c . c . c b c
b c . c . c . c b c
.... .... dddd dddd dddd
e f . f e . . f . f
e f . f e . . f . f
gggg .... gggg gggg ....
... | """
0: 1: 2: 3: 4:
aaaa .... aaaa aaaa ....
b c . c . c . c b c
b c . c . c . c b c
.... .... dddd dddd dddd
e f . f e . . f . f
e f . f e . . f . f
gggg .... gggg gggg ....
5: ... |
# Convert to str
number = 18
number_string = str(number)
print(type(number_string)) # 'str' | number = 18
number_string = str(number)
print(type(number_string)) |
n = int(input("Informe a quantidade de caracteres: "))
caracteres = []
consoantes = 0
i = 1
while i <= n:
c = input("Informe o %d caracter: " %i)
caracteres.append(c)
i += 1
i = 0
while i < n:
if caracteres[i] not in "aeiou":
consoantes += 1
i += 1
print("O total de consoantes eh: ", consoan... | n = int(input('Informe a quantidade de caracteres: '))
caracteres = []
consoantes = 0
i = 1
while i <= n:
c = input('Informe o %d caracter: ' % i)
caracteres.append(c)
i += 1
i = 0
while i < n:
if caracteres[i] not in 'aeiou':
consoantes += 1
i += 1
print('O total de consoantes eh: ', consoa... |
# Advent of Code 2019 Solutions: Day 2, Puzzle 1
# https://github.com/emddudley/advent-of-code-solutions
with open('input', 'r') as f:
program = [int(x) for x in f.read().strip().split(',')]
program[1] = 12
program[2] = 2
for opcode_index in range(0, len(program), 4):
opcode = program[opcode_index]
if ... | with open('input', 'r') as f:
program = [int(x) for x in f.read().strip().split(',')]
program[1] = 12
program[2] = 2
for opcode_index in range(0, len(program), 4):
opcode = program[opcode_index]
if opcode == 99:
break
addr_a = program[opcode_index + 1]
addr_b = program[opcode_index + 2]
... |
class Solution:
def minDeletionSize(self, A: List[str]) -> int:
minDel = m = len(A[0])
dp = [1] * m
for j in range(m):
for i in range(j):
if all(A[k][i] <= A[k][j] for k in range(len(A))):
dp[j] = max(dp[j], dp[i] + 1)
minDel = min(... | class Solution:
def min_deletion_size(self, A: List[str]) -> int:
min_del = m = len(A[0])
dp = [1] * m
for j in range(m):
for i in range(j):
if all((A[k][i] <= A[k][j] for k in range(len(A)))):
dp[j] = max(dp[j], dp[i] + 1)
min_del... |
key = int(input())
n = int(input())
message = ""
for x in range(n):
letters = input()
message += chr(ord(letters) + key)
print(message) | key = int(input())
n = int(input())
message = ''
for x in range(n):
letters = input()
message += chr(ord(letters) + key)
print(message) |
def action_sanitize():
'''Make action suitable for use as a Pose Library
'''
pass
def apply_pose(pose_index=-1):
'''Apply specified Pose Library pose to the rig
:param pose_index: Pose, Index of the pose to apply (-2 for no change to pose, -1 for poselib active pose)
:type pose_index: in... | def action_sanitize():
"""Make action suitable for use as a Pose Library
"""
pass
def apply_pose(pose_index=-1):
"""Apply specified Pose Library pose to the rig
:param pose_index: Pose, Index of the pose to apply (-2 for no change to pose, -1 for poselib active pose)
:type pose_index: int ... |
class TreeNode:
def __init__(self, val):
self.val = val
self.left = None
self.right = None
class Solution(object):
def is_same_tree(self, p, q):
if p is None or q is None:
if p != q:
return False
return True
if p.val != q.val:
... | class Treenode:
def __init__(self, val):
self.val = val
self.left = None
self.right = None
class Solution(object):
def is_same_tree(self, p, q):
if p is None or q is None:
if p != q:
return False
return True
if p.val != q.val:
... |
#!/usr/bin/env python3
n = int(input())
i = 1
while i < n + 1:
if i % 3 == 0 and i % 5 != 0:
print("fizz")
elif i % 5 == 0 and i % 3 != 0:
print("buzz")
elif i % 5 == 0 and i % 3 == 0:
print("fizz-buzz")
else:
print(i)
i = i + 1
| n = int(input())
i = 1
while i < n + 1:
if i % 3 == 0 and i % 5 != 0:
print('fizz')
elif i % 5 == 0 and i % 3 != 0:
print('buzz')
elif i % 5 == 0 and i % 3 == 0:
print('fizz-buzz')
else:
print(i)
i = i + 1 |
region = 'us-west-2'
vpc = dict(
source='./vpc'
)
inst = dict(
source='./inst',
vpc_id='${module.vpc.vpc_id}'
)
config = dict(
provider=dict(
aws=dict(region=region)
),
module=dict(
vpc=vpc,
inst=inst
)
)
| region = 'us-west-2'
vpc = dict(source='./vpc')
inst = dict(source='./inst', vpc_id='${module.vpc.vpc_id}')
config = dict(provider=dict(aws=dict(region=region)), module=dict(vpc=vpc, inst=inst)) |
{
"targets": [
{
"target_name": "userid",
"sources": [ '<!@(ls -1 src/*.cc)' ],
"include_dirs": ["<!@(node -p \"require('node-addon-api').include\")"],
"dependencies": ["<!(node -p \"require('node-addon-api').gyp\")"],
"cflags!": [ "-fno-exceptions" ],
"cflags_cc!": [ "-fno-exc... | {'targets': [{'target_name': 'userid', 'sources': ['<!@(ls -1 src/*.cc)'], 'include_dirs': ['<!@(node -p "require(\'node-addon-api\').include")'], 'dependencies': ['<!(node -p "require(\'node-addon-api\').gyp")'], 'cflags!': ['-fno-exceptions'], 'cflags_cc!': ['-fno-exceptions'], 'xcode_settings': {'GCC_ENABLE_CPP_EXCE... |
algorithm_defaults = {
'ERM': {
'train_loader': 'standard',
'uniform_over_groups': False,
'eval_loader': 'standard',
'randaugment_n': 2, # When running ERM + data augmentation
},
'groupDRO': {
'train_loader': 'standard',
'uniform_over_groups': True,
... | algorithm_defaults = {'ERM': {'train_loader': 'standard', 'uniform_over_groups': False, 'eval_loader': 'standard', 'randaugment_n': 2}, 'groupDRO': {'train_loader': 'standard', 'uniform_over_groups': True, 'distinct_groups': True, 'eval_loader': 'standard', 'group_dro_step_size': 0.01}, 'deepCORAL': {'train_loader': 'g... |
def isinteger(s):
return s.isdigit() or s[0] == '-' and s[1:].isdigit()
def isfloat(x):
s = x.partition(".")
if s[1]=='.':
if s[0]=='' or s[0]=='-':
if s[2]=='' or s[2][0]=='-':
return False
else:
return isinteger(s[2])
elif isinteger(... | def isinteger(s):
return s.isdigit() or (s[0] == '-' and s[1:].isdigit())
def isfloat(x):
s = x.partition('.')
if s[1] == '.':
if s[0] == '' or s[0] == '-':
if s[2] == '' or s[2][0] == '-':
return False
else:
return isinteger(s[2])
eli... |
class Solution:
def diameterOfBinaryTree(self, root: TreeNode) -> int:
if not root:
return 0
elif not root.right and not root.left:
return 0
elif not root.right:
return max(self.diameterOfBinaryTree(root.left),
1 + self.height(root.l... | class Solution:
def diameter_of_binary_tree(self, root: TreeNode) -> int:
if not root:
return 0
elif not root.right and (not root.left):
return 0
elif not root.right:
return max(self.diameterOfBinaryTree(root.left), 1 + self.height(root.left))
eli... |
arima = {
'order':[(2,1,0),(0,1,2),(1,1,1)],
'seasonal_order':[(0,0,0,0),(0,1,1,12)],
'trend':['n','c','t','ct']
}
elasticnet = {
'alpha':[i/10 for i in range(1,101)],
'l1_ratio':[0,0.25,0.5,0.75,1],
'normalizer':['scale','minmax',None]
}
gbt = {
'max_depth':[2,3],
'n_estimators':[100,500]
}
hwes = {
'trend':... | arima = {'order': [(2, 1, 0), (0, 1, 2), (1, 1, 1)], 'seasonal_order': [(0, 0, 0, 0), (0, 1, 1, 12)], 'trend': ['n', 'c', 't', 'ct']}
elasticnet = {'alpha': [i / 10 for i in range(1, 101)], 'l1_ratio': [0, 0.25, 0.5, 0.75, 1], 'normalizer': ['scale', 'minmax', None]}
gbt = {'max_depth': [2, 3], 'n_estimators': [100, 50... |
# This is a pytest config file
# https://docs.pytest.org/en/2.7.3/plugins.html
# It allows us to tell nbval (the py.text plugin we use to run
# notebooks and check their output is unchanged) to skip comparing
# notebook outputs for particular mimetypes.
def pytest_collectstart(collector):
if (
collector.... | def pytest_collectstart(collector):
if collector.fspath and collector.fspath.ext == '.ipynb' and hasattr(collector, 'skip_compare'):
collector.skip_compare += ('application/vnd.plotly.v1+json',) |
# model
model = Model()
i1 = Input("op1", "TENSOR_FLOAT32", "{2, 2, 2, 2}")
i3 = Output("op3", "TENSOR_FLOAT32", "{2, 2, 2, 2}")
model = model.Operation("RSQRT", i1).To(i3)
# Example 1. Input in operand 0,
input0 = {i1: # input 0
[1.0, 36.0, 2.0, 90, 4.0, 16.0, 25.0, 100.0,
23.0, 19.0, 40.0, 256.0, 4.0,... | model = model()
i1 = input('op1', 'TENSOR_FLOAT32', '{2, 2, 2, 2}')
i3 = output('op3', 'TENSOR_FLOAT32', '{2, 2, 2, 2}')
model = model.Operation('RSQRT', i1).To(i3)
input0 = {i1: [1.0, 36.0, 2.0, 90, 4.0, 16.0, 25.0, 100.0, 23.0, 19.0, 40.0, 256.0, 4.0, 43.0, 8.0, 36.0]}
output0 = {i3: [1.0, 0.166667, 0.70710678118, 0.... |
#It's a simple calculator for doing Addition, Subtraction, Multiplication, Division and Percentage.
first_number = int(input("Enter your first number: "))
operators = input("Enter what you wanna do +,-,*,/,%: ")
second_number = int(input("Enter your second Number: "))
if operators == "+" :
first_number... | first_number = int(input('Enter your first number: '))
operators = input('Enter what you wanna do +,-,*,/,%: ')
second_number = int(input('Enter your second Number: '))
if operators == '+':
first_number += second_number
print(f'Your Addition result is: {first_number}')
elif operators == '-':
first_number -=... |
description = 'system setup'
group = 'lowlevel'
sysconfig = dict(
cache='localhost',
instrument='Fluco',
experiment='Exp',
datasinks=['conssink', 'filesink', 'daemonsink',],
)
modules = ['nicos.commands.standard', 'nicos_ess.commands.epics']
devices = dict(
Fluco=device('nicos.devices.instrument... | description = 'system setup'
group = 'lowlevel'
sysconfig = dict(cache='localhost', instrument='Fluco', experiment='Exp', datasinks=['conssink', 'filesink', 'daemonsink'])
modules = ['nicos.commands.standard', 'nicos_ess.commands.epics']
devices = dict(Fluco=device('nicos.devices.instrument.Instrument', description='in... |
i=2
while i < 10:
j=1
while j < 10:
print(i,"*",j,"=",i*j)
j += 1
i += 1
| i = 2
while i < 10:
j = 1
while j < 10:
print(i, '*', j, '=', i * j)
j += 1
i += 1 |
# Program that asks the user to input any positive integer and
# outputs the successive value of the following calculation.
# It should at each step calculate the next value by taking the current value
# if the it is even, divide it by two, if it is odd, multiply
# it by three and add one
# the program ends if the cur... | n = int(input('please enter a number: '))
while n != 1:
if n <= 0:
print('Please enter a positive number.')
break
elif n % 2 == 0:
n = int(n / 2)
print(n)
else:
n = int(n * 3 + 1)
print(n) |
df =[['4', '1', '2', '7', '2', '5', '1'], ['9', '9', '8', '0', '2', '0', '8', '5', '0', '1', '3']]
str=''
dcf = ''.join(df)
print(dcf)
print() | df = [['4', '1', '2', '7', '2', '5', '1'], ['9', '9', '8', '0', '2', '0', '8', '5', '0', '1', '3']]
str = ''
dcf = ''.join(df)
print(dcf)
print() |
parameters = {
"results": [
{
"type": "max",
"identifier":
{
"symbol": "S22",
"elset": "ALL_ELEMS",
"position": "Element 1 Int Point 1 Sec Pt SPOS, (fraction = 1:0)"
},
"referenceValue": 6... | parameters = {'results': [{'type': 'max', 'identifier': {'symbol': 'S22', 'elset': 'ALL_ELEMS', 'position': 'Element 1 Int Point 1 Sec Pt SPOS, (fraction = 1:0)'}, 'referenceValue': 62.3, 'tolerance': 0.05}, {'type': 'disp_at_zero_y', 'step': 'Step-1', 'identifier': [{'symbol': 'U2', 'nset': 'Y+', 'position': 'Node 3'}... |
class Solution:
def wordBreak(self, s: str, wordDict: List[str]) -> bool:
def check(t, a, dp):
n=len(t)
for k in range(1, n):
if dp[a+0][a+k-1] and dp[a+k][a+n-1]:
return 1
return 0
n=len(s)
dp=[[0 for j in r... | class Solution:
def word_break(self, s: str, wordDict: List[str]) -> bool:
def check(t, a, dp):
n = len(t)
for k in range(1, n):
if dp[a + 0][a + k - 1] and dp[a + k][a + n - 1]:
return 1
return 0
n = len(s)
dp = [[0 f... |
expected_output = {
"clock_state": {
"system_status": {
"associations_address": "10.16.2.2",
"associations_local_mode": "client",
"clock_offset": 27.027,
"clock_refid": "127.127.1.1",
"clock_state": "synchronized",
"clock_stratum": 3,
... | expected_output = {'clock_state': {'system_status': {'associations_address': '10.16.2.2', 'associations_local_mode': 'client', 'clock_offset': 27.027, 'clock_refid': '127.127.1.1', 'clock_state': 'synchronized', 'clock_stratum': 3, 'root_delay': 5.61}}, 'peer': {'10.16.2.2': {'local_mode': {'client': {'delay': 5.61, 'j... |
#!/usr/python3.5
#-*- coding: utf-8 -*-
for row in range(10):
for j in range(row):
print (" ",end=" ")
for i in range(10-row):
print (i,end=" ")
print ()
| for row in range(10):
for j in range(row):
print(' ', end=' ')
for i in range(10 - row):
print(i, end=' ')
print() |
__author__ = 'Aaron Yang'
__email__ = 'byang971@usc.edu'
__date__ = '1/10/2021 10:53 PM'
class Solution:
def smallestStringWithSwaps(self, s: str, pairs) -> str:
chars = list(s)
pairs.sort(key=lambda item: (item[0], item[1]))
for pair in pairs:
a, b = pair[0], pair[1]
... | __author__ = 'Aaron Yang'
__email__ = 'byang971@usc.edu'
__date__ = '1/10/2021 10:53 PM'
class Solution:
def smallest_string_with_swaps(self, s: str, pairs) -> str:
chars = list(s)
pairs.sort(key=lambda item: (item[0], item[1]))
for pair in pairs:
(a, b) = (pair[0], pair[1])
... |
# test bignum unary operations
i = 1 << 65
print(bool(i))
print(+i)
print(-i)
print(~i)
| i = 1 << 65
print(bool(i))
print(+i)
print(-i)
print(~i) |
def zeroes(n, cnt):
if n == 0:
return cnt
elif n % 10 == 0:
return zeroes(n//10, cnt+1)
else:
return zeroes(n//10, cnt)
n = int(input())
print(zeroes(n, 0))
| def zeroes(n, cnt):
if n == 0:
return cnt
elif n % 10 == 0:
return zeroes(n // 10, cnt + 1)
else:
return zeroes(n // 10, cnt)
n = int(input())
print(zeroes(n, 0)) |
req = {
"userId": "admin",
"metadata": {
"@context": [
"https://w3id.org/ro/crate/1.0/context",
{
"@vocab": "https://schema.org/",
"osfcategory": "https://www.research-data-services.org/jsonld/osfcategory",
"zenodocategory": "https:... | req = {'userId': 'admin', 'metadata': {'@context': ['https://w3id.org/ro/crate/1.0/context', {'@vocab': 'https://schema.org/', 'osfcategory': 'https://www.research-data-services.org/jsonld/osfcategory', 'zenodocategory': 'https://www.research-data-services.org/jsonld/zenodocategory'}], '@graph': [{'@id': 'ro-crate-meta... |
class GoogleException(Exception):
def __init__(self, code, message, response):
self.status_code = code
self.error_type = message
self.message = message
self.response = response
self.get_error_type()
def get_error_type(self):
json_response = self.response.json()
... | class Googleexception(Exception):
def __init__(self, code, message, response):
self.status_code = code
self.error_type = message
self.message = message
self.response = response
self.get_error_type()
def get_error_type(self):
json_response = self.response.json()
... |
command = input().lower()
in_progress = True
car_stopped = True
while in_progress:
if command == 'help':
print("start - to start the car")
print("stop - to stop the car")
print("quit - to ext")
elif command == 'start':
if car_stopped:
print("You started the car")
... | command = input().lower()
in_progress = True
car_stopped = True
while in_progress:
if command == 'help':
print('start - to start the car')
print('stop - to stop the car')
print('quit - to ext')
elif command == 'start':
if car_stopped:
print('You started the car')
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2014, Chris Hoffman <choffman@chathamfinancial.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
DOCUMENTATION = r'''
---
module: win_service
short_description: Manage and query Windows services
description:
- M... | documentation = "\n---\nmodule: win_service\nshort_description: Manage and query Windows services\ndescription:\n- Manage and query Windows services.\n- For non-Windows targets, use the M(ansible.builtin.service) module instead.\noptions:\n dependencies:\n description:\n - A list of service dependencies to set f... |
# test exception matching against a tuple
try:
fail
except (Exception,):
print('except 1')
try:
fail
except (Exception, Exception):
print('except 2')
try:
fail
except (TypeError, NameError):
print('except 3')
try:
fail
except (TypeError, ValueError, Exception):
print('except 4')
| try:
fail
except (Exception,):
print('except 1')
try:
fail
except (Exception, Exception):
print('except 2')
try:
fail
except (TypeError, NameError):
print('except 3')
try:
fail
except (TypeError, ValueError, Exception):
print('except 4') |
def printMaximum(num):
d = {}
for i in range(10):
d[i] = 0
for i in str(num):
d[int(i)] += 1
res = 0
m = 1
for i in list(d.keys()):
while d[i] > 0:
res = res + i*m
d[i] -= 1
m *= 10
return res
# Driver co... | def print_maximum(num):
d = {}
for i in range(10):
d[i] = 0
for i in str(num):
d[int(i)] += 1
res = 0
m = 1
for i in list(d.keys()):
while d[i] > 0:
res = res + i * m
d[i] -= 1
m *= 10
return res
num = 38293367
print(print_maximum(n... |
NUMERIC = "numeric"
CATEGORICAL = "categorical"
TEST_MODEL = "test"
SINGLE_MODEL = "single"
MODEL_SEARCH = "search"
SHUTDOWN = "shutdown"
DEFAULT_PORT = 8042
DEFAULT_MAX_JOBS = 4
ERROR = "error"
QUEUED = "queued"
STARTED = "started"
IN_PROGRESS = "in-progress"
FINISHED = "finished"
# This can be any x where np.exp(... | numeric = 'numeric'
categorical = 'categorical'
test_model = 'test'
single_model = 'single'
model_search = 'search'
shutdown = 'shutdown'
default_port = 8042
default_max_jobs = 4
error = 'error'
queued = 'queued'
started = 'started'
in_progress = 'in-progress'
finished = 'finished'
large_exp = 512
epsilon = 0.0001
matr... |
class TopTen:
def __init__(self):
self.num = 1
def __iter__(self):
return self
def __next__(self):
if self.num <= 10:
val = self.num
self.num += 1
return val
else:
raise StopIteration
values = TopTen()
print(next(values))
f... | class Topten:
def __init__(self):
self.num = 1
def __iter__(self):
return self
def __next__(self):
if self.num <= 10:
val = self.num
self.num += 1
return val
else:
raise StopIteration
values = top_ten()
print(next(values))
fo... |
class cached_property:
def __init__(self, func):
self.__doc__ = getattr(func, "__doc__")
self.func = func
def __get__(self, obj, cls):
if obj is None:
return self
value = obj.__dict__[self.func.__name__] = self.func(obj)
return value
| class Cached_Property:
def __init__(self, func):
self.__doc__ = getattr(func, '__doc__')
self.func = func
def __get__(self, obj, cls):
if obj is None:
return self
value = obj.__dict__[self.func.__name__] = self.func(obj)
return value |
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
def tf_pack_ext(pb):
assert (pb.attr["N"].i == len(pb.input))
return {
'axis': pb.attr["axis"].i,
'N': pb.attr["N"].i,
'infer': None
}
| def tf_pack_ext(pb):
assert pb.attr['N'].i == len(pb.input)
return {'axis': pb.attr['axis'].i, 'N': pb.attr['N'].i, 'infer': None} |
#!/usr/bin/python3
ls = [l.strip().split(" ") for l in open("inputs/08.in", "r").readlines()]
def run(sw):
acc,p,ps = 0,0,[]
while p < len(ls):
if p in ps: return acc if sw == -1 else -1
ps.append(p)
acc += int(ls[p][1]) if ls[p][0] == "acc" else 0
p += int(ls[p][1]) if (ls[p][0... | ls = [l.strip().split(' ') for l in open('inputs/08.in', 'r').readlines()]
def run(sw):
(acc, p, ps) = (0, 0, [])
while p < len(ls):
if p in ps:
return acc if sw == -1 else -1
ps.append(p)
acc += int(ls[p][1]) if ls[p][0] == 'acc' else 0
p += int(ls[p][1]) if ls[p][0... |
counter = 0
def merge(array, left, right):
i = j = k = 0
global counter
while i < len(left) and j < len(right):
if left[i] <= right[j]:
array[k] = left[i]
k += 1
i += 1
else:
array[k] = right[j]
counter += len(left) - i
... | counter = 0
def merge(array, left, right):
i = j = k = 0
global counter
while i < len(left) and j < len(right):
if left[i] <= right[j]:
array[k] = left[i]
k += 1
i += 1
else:
array[k] = right[j]
counter += len(left) - i
... |
def fib(n: int) -> int:
if n < 2: # base case
return n
return fib(n - 2) + fib(n - 1)
if __name__ == "__main__":
print(fib(2))
print(fib(10))
| def fib(n: int) -> int:
if n < 2:
return n
return fib(n - 2) + fib(n - 1)
if __name__ == '__main__':
print(fib(2))
print(fib(10)) |
#!/usr/bin/env python3
class ApiDefaults:
url_verify = "/api/verify_api_key"
url_refresh = "/api/import/refresh"
url_add = "/api/import/add"
| class Apidefaults:
url_verify = '/api/verify_api_key'
url_refresh = '/api/import/refresh'
url_add = '/api/import/add' |
words = "sort the inner content in descending order"
result = []
for w in words.split():
if len(w)>3:
result.append(w[0]+''.join(sorted(w[1:-1], reverse=True))+w[-1])
else:
result.append(w)
| words = 'sort the inner content in descending order'
result = []
for w in words.split():
if len(w) > 3:
result.append(w[0] + ''.join(sorted(w[1:-1], reverse=True)) + w[-1])
else:
result.append(w) |
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def __init__(self):
self.total = 0
def sumOfLeftLeaves(self, root: TreeNode) -> int:
if not root:
return 0
... | class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def __init__(self):
self.total = 0
def sum_of_left_leaves(self, root: TreeNode) -> int:
if not root:
return 0
def dfs(node, type):
... |
language_map = {
'ko': 'ko_KR',
'ja': 'ja_JP',
'zh': 'zh_CN'
}
| language_map = {'ko': 'ko_KR', 'ja': 'ja_JP', 'zh': 'zh_CN'} |
global numbering
numbering = [0,1,2,3]
num = 0
filterbegin = '''res(); for (i=0, o=0; i<115; i++){'''
o = ['MSI', 'APPV', 'Citrix MSI', 'Normal','Express','Super Express (BOPO)', 'Simple', 'Medium', 'Complex', 'May', 'June', 'July', 'August']
filterending = '''if (val1 == eq1){ if (val2 == eq2){ if (val3 =... | global numbering
numbering = [0, 1, 2, 3]
num = 0
filterbegin = 'res(); for (i=0, o=0; i<115; i++){'
o = ['MSI', 'APPV', 'Citrix MSI', 'Normal', 'Express', 'Super Express (BOPO)', 'Simple', 'Medium', 'Complex', 'May', 'June', 'July', 'August']
filterending = 'if (val1 == eq1){ if (val2 == eq2){ if (val3 == eq3){ if (va... |
# 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 countUnivalSubtrees(self, root: TreeNode) -> int:
self.count = 0
self.is_uni(root)
... | class Solution:
def count_unival_subtrees(self, root: TreeNode) -> int:
self.count = 0
self.is_uni(root)
return self.count
def is_uni(self, node):
if not node:
return True
if node.left is None and node.right is None:
self.count += 1
r... |
#!/usr/bin/env python3
# Label key for repair state
# (IN_SERVICE, OUT_OF_POOL, READY_FOR_REPAIR, IN_REPAIR, AFTER_REPAIR)
REPAIR_STATE = "REPAIR_STATE"
# Annotation key for the last update time of the repair state
REPAIR_STATE_LAST_UPDATE_TIME = "REPAIR_STATE_LAST_UPDATE_TIME"
# Annotation key for the last email ti... | repair_state = 'REPAIR_STATE'
repair_state_last_update_time = 'REPAIR_STATE_LAST_UPDATE_TIME'
repair_state_last_email_time = 'REPAIR_STATE_LAST_EMAIL_TIME'
repair_unhealthy_rules = 'REPAIR_UNHEALTHY_RULES'
repair_cycle = 'REPAIR_CYCLE'
repair_message = 'REPAIR_MESSAGE' |
######################################################################################################################
# Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... | boolean_false_values = ['false', 'no', 'disabled', 'off', '0']
boolean_true_values = ['true', 'yes', 'enabled', 'on', '1']
env_config_table = 'CONFIG_TABLE'
env_config_bucket = 'CONFIG_BUCKET'
tasks_objects = 'TaskConfigurationObjects'
config_action_name = 'Action'
config_debug = 'Debug'
config_task_notifications = 'Ta... |
{
"targets": [
{
"target_name": "ecdh",
"include_dirs": ["<!(node -e \"require('nan')\")"],
"cflags": ["-Wall", "-O2"],
"sources": ["ecdh.cc"],
"conditions": [
["OS=='win'", {
"conditions": [
[
"target_arch=='x64'", {
"varia... | {'targets': [{'target_name': 'ecdh', 'include_dirs': ['<!(node -e "require(\'nan\')")'], 'cflags': ['-Wall', '-O2'], 'sources': ['ecdh.cc'], 'conditions': [["OS=='win'", {'conditions': [["target_arch=='x64'", {'variables': {'openssl_root%': 'C:/OpenSSL-Win64'}}, {'variables': {'openssl_root%': 'C:/OpenSSL-Win32'}}]], '... |
class Contact:
def __init__(self, name, phone, email):
self.name = name
self.phone = phone
self.email = email
| class Contact:
def __init__(self, name, phone, email):
self.name = name
self.phone = phone
self.email = email |
'''
This module contains some exception classes
'''
class SecondryStructureError(Exception):
'''
Raised when the Secondry structure is not correct
'''
def __init__(self, residue, value):
messgae = '''
ERROR: Secondary Structure Input is not parsed correctly.
Please make sure th... | """
This module contains some exception classes
"""
class Secondrystructureerror(Exception):
"""
Raised when the Secondry structure is not correct
"""
def __init__(self, residue, value):
messgae = '\n ERROR: Secondary Structure Input is not parsed correctly.\n Please make sure th... |
class get_method_name_decorator:
def __init__(self, fn):
self.fn = fn
def __set_name__(self, owner, name):
owner.method_names.add(self.fn)
setattr(owner, name, self.fn)
| class Get_Method_Name_Decorator:
def __init__(self, fn):
self.fn = fn
def __set_name__(self, owner, name):
owner.method_names.add(self.fn)
setattr(owner, name, self.fn) |
# https://www.devdungeon.com/content/colorize-terminal-output-python
# https://www.geeksforgeeks.org/print-colors-python-terminal/
class CONST:
class print_color:
class control:
'''
Full name: Perfect_color_text
'''
reset='\033[0m'
bold='\033[0... | class Const:
class Print_Color:
class Control:
"""
Full name: Perfect_color_text
"""
reset = '\x1b[0m'
bold = '\x1b[01m'
disable = '\x1b[02m'
underline = '\x1b[04m'
reverse = '\x1b[07m'
strikethroug... |
found = False
while not found:
num = float(input())
if 1 <= num <= 100:
print(f"The number {num} is between 1 and 100")
found = True
| found = False
while not found:
num = float(input())
if 1 <= num <= 100:
print(f'The number {num} is between 1 and 100')
found = True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.