content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# Definition for a Node.
class Node:
def __init__(self, val, children):
self.val = val
self.children = children
class Solution:
def levelOrder(self, root: 'Node') -> List[List[int]]:
if root is None:
return []
level = [root]
result = []
while level:
... | class Node:
def __init__(self, val, children):
self.val = val
self.children = children
class Solution:
def level_order(self, root: 'Node') -> List[List[int]]:
if root is None:
return []
level = [root]
result = []
while level:
result.appe... |
# question can be found at leetcode.com/problems/number-of-segments-in-a-string/
class Solution:
def countSegments(self, s: str) -> int:
word = 0
count = 1
for char in s:
if char != " " and count:
word += 1
count = 0
if char == " ":
... | class Solution:
def count_segments(self, s: str) -> int:
word = 0
count = 1
for char in s:
if char != ' ' and count:
word += 1
count = 0
if char == ' ':
count = 1
return word |
class bmpReader:
def __init__(self, file_path, brightness = 1, expected_width = None):
self.file_path = file_path
self.BRIGHTNESS = brightness
self.expected_width = expected_width
def read_le(self, s, ignore):
result = 0
shift = 0
for byte in bytearray(s):
... | class Bmpreader:
def __init__(self, file_path, brightness=1, expected_width=None):
self.file_path = file_path
self.BRIGHTNESS = brightness
self.expected_width = expected_width
def read_le(self, s, ignore):
result = 0
shift = 0
for byte in bytearray(s):
... |
def bigger_number(number_1, number_2):
'''
Function that returns the largest number of two numbers
'''
if number_1 > number_2:
return (f" {number_1} the largest number")
elif number_1 < number_2:
return (f" {number_2} the largest number")
else:
return (f"The ... | def bigger_number(number_1, number_2):
"""
Function that returns the largest number of two numbers
"""
if number_1 > number_2:
return f' {number_1} the largest number'
elif number_1 < number_2:
return f' {number_2} the largest number'
else:
return f'The number 1 {numbe... |
ANOMALY_TABLE_COLUMN_NAMES_MAPPER = {
"series_type": "Dimension",
"data_datetime": "Time of Occurrence",
"y": "Value",
"severity": "Severity Score",
"nl_message": "Change"
}
IGNORE_COLUMNS_ANOMALY_TABLE = [
"id",
"index",
"kpi_id",
"is_anomaly"
]
ANOMALY_ALERT_COLUMN_NAMES = [
... | anomaly_table_column_names_mapper = {'series_type': 'Dimension', 'data_datetime': 'Time of Occurrence', 'y': 'Value', 'severity': 'Severity Score', 'nl_message': 'Change'}
ignore_columns_anomaly_table = ['id', 'index', 'kpi_id', 'is_anomaly']
anomaly_alert_column_names = ['Dimension', 'Time of Occurrence', 'Value', 'Ex... |
_base_ = [
'../_base_/models/cascade_mask_rcnn_r50_fpn_fashion.py',
'../_base_/datasets/coco_instance_fashion.py',
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
]
model = dict(
test_cfg=dict(
rcnn=dict(
score_thr=0.001,
nms=dict(type='soft_nms'),
... | _base_ = ['../_base_/models/cascade_mask_rcnn_r50_fpn_fashion.py', '../_base_/datasets/coco_instance_fashion.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py']
model = dict(test_cfg=dict(rcnn=dict(score_thr=0.001, nms=dict(type='soft_nms')))) |
# Telegram options:
TELEGRAM_TOKEN = 'TOKEN_HERE'
# Misc:
WORK_DIR = '/u01/PDFBotFiles/'
LOG_FILE = '/u01/PDFSaveBot/pdfbotlog.txt'
GREETINGS = 'Send me a file and I\'ll convert it into .pdf for you.'
SUPPORTED_MIMES = (
'text/plain',
#'image/bmp'
#'image/jpeg'
#'image/png',
'ap... | telegram_token = 'TOKEN_HERE'
work_dir = '/u01/PDFBotFiles/'
log_file = '/u01/PDFSaveBot/pdfbotlog.txt'
greetings = "Send me a file and I'll convert it into .pdf for you."
supported_mimes = ('text/plain', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedo... |
'''
Given a set of distinct integers, nums, return all possible subsets (the power set).
Note: The solution set must not contain duplicate subsets.
Example:
Input: nums = [1,2,3]
Output:
[
[3],
[1],
[2],
[1,2,3],
[1,3],
[2,3],
[1,2],
[]
]
'''
class Solution:
def subsets(self, nums: List[int]) -... | """
Given a set of distinct integers, nums, return all possible subsets (the power set).
Note: The solution set must not contain duplicate subsets.
Example:
Input: nums = [1,2,3]
Output:
[
[3],
[1],
[2],
[1,2,3],
[1,3],
[2,3],
[1,2],
[]
]
"""
class Solution:
def subsets(self, nums: List[int]) ... |
a=input().split()
if int(a[0]) + int(a[2]) == int(a[4]):
print("YES")
else:
print("NO") | a = input().split()
if int(a[0]) + int(a[2]) == int(a[4]):
print('YES')
else:
print('NO') |
Table(labels=["Name", "Age", "Favorite Teacher"]).with_rows([
["Jessica", 19, "Dr. Clontz"],
["Lynn", 18, "Ms. Gilbreath"],
["Julia", 17, "Mr. Fullinwider"],
]) | table(labels=['Name', 'Age', 'Favorite Teacher']).with_rows([['Jessica', 19, 'Dr. Clontz'], ['Lynn', 18, 'Ms. Gilbreath'], ['Julia', 17, 'Mr. Fullinwider']]) |
# -*- coding: utf-8 -*-
def break_word(w):
return w.split(" ")
def sort_word(w):
ws=break_word(w)
return sorted(ws)
def print_first_word(w):
ws=break_word(w)
return ws.pop(0)
def print_last_word(w):
ws=break_word(w)
return ws.pop(-1)
sentences="All good things come to those who wait."
print(break_wo... | def break_word(w):
return w.split(' ')
def sort_word(w):
ws = break_word(w)
return sorted(ws)
def print_first_word(w):
ws = break_word(w)
return ws.pop(0)
def print_last_word(w):
ws = break_word(w)
return ws.pop(-1)
sentences = 'All good things come to those who wait.'
print(break_word(se... |
print("Challenge 39: WAF to compute the radius and the central coordinate (x, y) of a circle which is constructed by three given points on the plane surface. Go to the editor Input: x1, y1, x2, y2, x3, y3 separated by a single space. Input three coordinate of the circle: 9 3 6 8 3 6 Radius of the said circle: 3.358 Cen... | print('Challenge 39: WAF to compute the radius and the central coordinate (x, y) of a circle which is constructed by three given points on the plane surface. Go to the editor Input: x1, y1, x2, y2, x3, y3 separated by a single space. Input three coordinate of the circle: 9 3 6 8 3 6 Radius of the said circle: 3.358 Cen... |
def foo():
for i in range(100):
yield i
def foo2():
yield from foo()
f = foo()
print(f)
print(iter(f))
for i in f:
print(i)
f = foo2()
for i in f:
print(i) | def foo():
for i in range(100):
yield i
def foo2():
yield from foo()
f = foo()
print(f)
print(iter(f))
for i in f:
print(i)
f = foo2()
for i in f:
print(i) |
# Check if configs has only Prune, Model, Statistics and Prometheus configs
def validate_configs(configs):
supported_configs = ['Prune Configs', 'Model Configs',
'Statistics Configs', 'Prometheus Configs']
configs_keys = list(dict(configs.items()).keys())
configs_keys.pop(0) # to r... | def validate_configs(configs):
supported_configs = ['Prune Configs', 'Model Configs', 'Statistics Configs', 'Prometheus Configs']
configs_keys = list(dict(configs.items()).keys())
configs_keys.pop(0)
for config in configs_keys:
if config not in supported_configs:
raise import_error(f... |
new_side = Sidecar(title="Triple product")
with new_side:
display(interactive_out_example)
| new_side = sidecar(title='Triple product')
with new_side:
display(interactive_out_example) |
def chop(items, size):
buffer = []
for item in items:
buffer.append(item)
if len(buffer) >= size:
yield buffer
buffer = []
if buffer:
yield buffer
| def chop(items, size):
buffer = []
for item in items:
buffer.append(item)
if len(buffer) >= size:
yield buffer
buffer = []
if buffer:
yield buffer |
alert_messages = {
"settingsChanged":{
"version": "0.1",
"sharedSecret": "foo",
"sentAt": "2019-07-19T06:20:39.656975Z",
"organizationId": "00000001",
"organizationName": "Miles Monitoring Inc.",
"organizationUrl": "https://n1.meraki.com/o//manage/organization/overvie... | alert_messages = {'settingsChanged': {'version': '0.1', 'sharedSecret': 'foo', 'sentAt': '2019-07-19T06:20:39.656975Z', 'organizationId': '00000001', 'organizationName': 'Miles Monitoring Inc.', 'organizationUrl': 'https://n1.meraki.com/o//manage/organization/overview', 'networkId': 'N_111111111111', 'networkName': 'Ma... |
# Enter your user information here. It can be email address or userID depending on the website
username = 'email@email.com'
# Enter your password here.
password = 'passwordgoeshere'
# Enter the target website login url here
targetUrl = 'https://targeturl.com/en/login' | username = 'email@email.com'
password = 'passwordgoeshere'
target_url = 'https://targeturl.com/en/login' |
n = int(input())
for _ in range(n):
k = int(input())
for _ in range(k):
l = int(input())
if l == 1:
print('Rolien')
elif l == 2:
print('Naej')
elif l == 3:
print('Elehcim')
elif l == 4:
print('Odranoel')
| n = int(input())
for _ in range(n):
k = int(input())
for _ in range(k):
l = int(input())
if l == 1:
print('Rolien')
elif l == 2:
print('Naej')
elif l == 3:
print('Elehcim')
elif l == 4:
print('Odranoel') |
# Automatically generated
# pylint: disable=all
get = [{'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3, 'DefaultVCpus': 1, 'DefaultCores': 1, 'DefaultThreadsPerCore': 1, 'SizeInMiB': 2048, 'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported', 'EbsOptimizedInfo': {'BaselineBandwidth... | get = [{'SupportedArchitectures': ['arm64'], 'SustainedClockSpeedInGhz': 2.3, 'DefaultVCpus': 1, 'DefaultCores': 1, 'DefaultThreadsPerCore': 1, 'SizeInMiB': 2048, 'EbsOptimizedSupport': 'default', 'EncryptionSupport': 'supported', 'EbsOptimizedInfo': {'BaselineBandwidthInMbps': 300, 'BaselineThroughputInMBps': 37.5, 'B... |
# dataset settings
dataset_type = 'CaptionCocoDataset'
data_root = 'data/caption_coco/'
ann_root = data_root + 'karpathy_captions/'
feat_root = data_root + 'bottomup/up_down_10_100/'
train_pipeline = [
dict(type='LoadCaptionVisuals', with_gv_feat=True, with_att_feat=True, with_bboxes=False),
dict(type=... | dataset_type = 'CaptionCocoDataset'
data_root = 'data/caption_coco/'
ann_root = data_root + 'karpathy_captions/'
feat_root = data_root + 'bottomup/up_down_10_100/'
train_pipeline = [dict(type='LoadCaptionVisuals', with_gv_feat=True, with_att_feat=True, with_bboxes=False), dict(type='LoadCaptionAnnotations', with_input_... |
def SumRange(a, b):
sum = 0
for i in range(a, b):
sum += i
sum += b
return sum
a, b = list(map(int, input().split()))
print(SumRange(a, b))
| def sum_range(a, b):
sum = 0
for i in range(a, b):
sum += i
sum += b
return sum
(a, b) = list(map(int, input().split()))
print(sum_range(a, b)) |
class Solution:
def divisorGame(self, N: int) -> bool:
dp = [False] * (N + 1)
for i in range(2, N + 1):
if i % 2 == 0 and dp[i // 2] == False:
dp[i] = True
continue
for j in range(1, int(math.sqrt(i))):
if i % j == 0 and dp[i ... | class Solution:
def divisor_game(self, N: int) -> bool:
dp = [False] * (N + 1)
for i in range(2, N + 1):
if i % 2 == 0 and dp[i // 2] == False:
dp[i] = True
continue
for j in range(1, int(math.sqrt(i))):
if i % j == 0 and dp[i ... |
# Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.
# Example :
# Given the below binary tree and sum = 22,
# 5
# / \
# 4 8
# / / \
# 11 13 4
# ... | class Solution:
def has_path_sum(self, A, B):
ans = 0
tempsum = B - A.val
if tempsum == 0 and A.left == None and (A.right == None):
return 1
else:
if A.left != None:
ans = ans or self.hasPathSum(A.left, tempsum)
if A.right != None:... |
def swapAdjacentBits(n):
'''
You're given an arbitrary 32-bit integer n.
Take its binary representation, split bits into it in pairs
(bit number 0 and 1, bit number 2 and 3, etc.) and swap bits in each pair.
Then return the result as a decimal number.
'''
return ((0x55555555 & n) << 1) | ... | def swap_adjacent_bits(n):
"""
You're given an arbitrary 32-bit integer n.
Take its binary representation, split bits into it in pairs
(bit number 0 and 1, bit number 2 and 3, etc.) and swap bits in each pair.
Then return the result as a decimal number.
"""
return (1431655765 & n) << 1 | ... |
DB_NAME = "bank.db"
CREATE_TABLES = "sql_CREATE_tables.sql"
DROP_DATABASE = "sql_DROP_DB.sql"
DATABASE = "sqlite:///bank.db"
# DB_SQL_STRUCTURE = "sql_structure_file.sql"
BLOCK_AFTER_N_FAILED_ATTEMPTS = 5
BLOCK_FOR_N_MINUTES = 1
PASSWORD_MIN_LENGTH = 8
| db_name = 'bank.db'
create_tables = 'sql_CREATE_tables.sql'
drop_database = 'sql_DROP_DB.sql'
database = 'sqlite:///bank.db'
block_after_n_failed_attempts = 5
block_for_n_minutes = 1
password_min_length = 8 |
# START LAB EXERCISE 01
print('Lab Exercise 01 \n')
# PROBLEM 1 (5 points)
nq = "North Quad"
# a&ab = "Art & Architecture Building"
dent_central = "Dental Building"
# BAM HALL = "Blanch Anderson Moore Hall, School of Music"
# 1ERB = "Engineering Research Building 1"
# r-bus = "Ross School of Business Building"
# PRO... | print('Lab Exercise 01 \n')
nq = 'North Quad'
dent_central = 'Dental Building'
valid_abbr = [nq, dent_central]
valid_abbr_length = len(valid_abbr)
minimum = 225 // valid_abbr_length |
def main():
print('This program is an implementation of the Rosenberg Self-Esteem Scale. This program will show you ten statements that you could possibly apply to yourself. Please rate how much you agree with each of the statements by responding with one of these four letters:')
print('D means you strongly dis... | def main():
print('This program is an implementation of the Rosenberg Self-Esteem Scale. This program will show you ten statements that you could possibly apply to yourself. Please rate how much you agree with each of the statements by responding with one of these four letters:')
print('D means you strongly dis... |
class Session(dict):
def add_object(self, obj):
self['js_' + id(obj)] = obj
def create_session():
return Session()
| class Session(dict):
def add_object(self, obj):
self['js_' + id(obj)] = obj
def create_session():
return session() |
# Python - 3.6.0
test.describe('Basic Tests')
test.assert_equals(combat(100, 5), 95)
test.assert_equals(combat(83, 16), 67)
test.assert_equals(combat(20, 30), 0)
| test.describe('Basic Tests')
test.assert_equals(combat(100, 5), 95)
test.assert_equals(combat(83, 16), 67)
test.assert_equals(combat(20, 30), 0) |
class Solution:
def dfs(self, grid, source, island_identifier):
row_count, col_count = len(grid), len(grid[0])
grid[source[0]][source[1]] = -1
for row_delta, col_delta, dir_name in [(1, 0, 'd'), (0, -1, 'l'), (-1, 0, 'u'), (0, 1, 'r')]:
new_source = (source[0] + row_delta, source... | class Solution:
def dfs(self, grid, source, island_identifier):
(row_count, col_count) = (len(grid), len(grid[0]))
grid[source[0]][source[1]] = -1
for (row_delta, col_delta, dir_name) in [(1, 0, 'd'), (0, -1, 'l'), (-1, 0, 'u'), (0, 1, 'r')]:
new_source = (source[0] + row_delta,... |
paranoid_android = "Marvin, the paranoid Android"
letters = list(paranoid_android)
for char in letters[:6]:
print ('\t', char)
print()
for char in letters[-7:]:
print ('\t'*2, char)
for char in letters[12:20]:
print ('\t'*3, char)
| paranoid_android = 'Marvin, the paranoid Android'
letters = list(paranoid_android)
for char in letters[:6]:
print('\t', char)
print()
for char in letters[-7:]:
print('\t' * 2, char)
for char in letters[12:20]:
print('\t' * 3, char) |
## Python Crash Course
# Exercise 4.12: More Loops:
# All versions of foods.py in this section have avoided using for loops when printing to save space.
# Choose a version of foods.py, and write two for loops to print each list of foods.
def main():
# My favorite pizzas
myFavo... | def main():
my_favorite_pizzas = ['Veg supreme', "Ultimate cheese lover's pizza", 'Pacific veggie']
print('My favorite pizzas are: ')
for pizza in myFavoritePizzas:
print(pizza)
friend_pizzas = myFavoritePizzas.copy()
myFavoritePizzas.append('Margarita')
friend_pizzas.append('Mexican her... |
class Solution:
def lemonadeChange(self, bills) -> bool:
five, ten = 0, 0
for i in bills:
if i == 5:
five += 1
if i == 10:
ten += 1
five -= 1
elif i == 20:
if ten > 0:
ten -= 1
... | class Solution:
def lemonade_change(self, bills) -> bool:
(five, ten) = (0, 0)
for i in bills:
if i == 5:
five += 1
if i == 10:
ten += 1
five -= 1
elif i == 20:
if ten > 0:
ten -=... |
USER_AGENT_HEADERS = [
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.106 Safari/537.36',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.106 Safari/537.36',
'Mozilla/5.0 (X11; Linux x86_64) AppleWeb... | user_agent_headers = ['Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.106 Safari/537.36', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.106 Safari/537.36', 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (K... |
# Summation
def summation(n):
start = 0
for x in range(1, n + 1):
start = start + x
return start
print(summation(8)) | def summation(n):
start = 0
for x in range(1, n + 1):
start = start + x
return start
print(summation(8)) |
#!/usr/bin/python
# -*- coding:utf-8 -*-
'''
calculator for hex-grids
'''
def MAPBORDER():
'''
return map border'''
# left-up, right-up, left-down, right-down, left-right, up, down
border = [(-6+i, -9, 15-i) for i in range(0, 14)] + \
[(9, 6-i, -15+i) for i in range(0, 14)] +... | """
calculator for hex-grids
"""
def mapborder():
"""
return map border"""
border = [(-6 + i, -9, 15 - i) for i in range(0, 14)] + [(9, 6 - i, -15 + i) for i in range(0, 14)] + [(-9, -6 + i, 15 - i) for i in range(0, 14)] + [(6 - i, 9, -15 + i) for i in range(0, 14)] + [(-7, -8, 15), (-8, -7, 15), (8, 7, -... |
# animals list
animals = ['cat', 'dog', 'rabbit']
# list of wild animals
wild_animals = ['tiger', 'fox']
# appending wild_animals list to the animals list
animals.append(wild_animals)
print('Updated animals list: ', animals)
| animals = ['cat', 'dog', 'rabbit']
wild_animals = ['tiger', 'fox']
animals.append(wild_animals)
print('Updated animals list: ', animals) |
person_1 = input("What is the age of the first person?")
person_2 = input("What is the age of the second person?")
person_1 = int(person_1)
person_2 = int(person_2)
age_difference = person_1 - person_2
age_difference = (abs(age_difference))
print(age_difference)
| person_1 = input('What is the age of the first person?')
person_2 = input('What is the age of the second person?')
person_1 = int(person_1)
person_2 = int(person_2)
age_difference = person_1 - person_2
age_difference = abs(age_difference)
print(age_difference) |
# Definition for polynomial singly-linked list.
# class PolyNode:
# def __init__(self, x=0, y=0, next=None):
# self.coefficient = x
# self.power = y
# self.next = next
class Solution:
def addPoly(self, poly1: 'PolyNode', poly2: 'PolyNode') -> 'PolyNode':
sum_poly = dumm... | class Solution:
def add_poly(self, poly1: 'PolyNode', poly2: 'PolyNode') -> 'PolyNode':
sum_poly = dummy = poly_node()
while poly1 or poly2:
power1 = poly1.power if poly1 else -1
power2 = poly2.power if poly2 else -1
if power1 == power2:
coeff = p... |
def print_n(iter, n):
for _i in range(n):
x = next(iter)
print(x, end=' ')
print("")
return None
# pares: dado um iterator, retorna um iterator com os elementos nas posicoes pares (0,2)
def pares(iter):
i = 0
for x in iter:
if (i % 2 == 0):
yield x
i = i ... | def print_n(iter, n):
for _i in range(n):
x = next(iter)
print(x, end=' ')
print('')
return None
def pares(iter):
i = 0
for x in iter:
if i % 2 == 0:
yield x
i = i + 1
def reverse_iter(i):
l = list(i)
l.reverse()
return iter(l)
def zip(itera... |
characterMapJillian = {
"jillian_base_001": "jillian_base_001", # Auto: Edited
"jillian_base_002": "jillian_base_002", # Auto: Edited
"jillian_base_dom_001": "", # Auto: Delete... | character_map_jillian = {'jillian_base_001': 'jillian_base_001', 'jillian_base_002': 'jillian_base_002', 'jillian_base_dom_001': '', 'jillian_base_dom_002': '', 'jillian_base_dom_opened_001': '', 'jillian_base_dom_opened_002': '', 'jillian_base_full_001': 'jillian_base_full_001', 'jillian_base_full_002': 'jillian_base_... |
def func_args(*args):
print(f'tipo: {type(args)} conteudo: {args}')
for arg in args:
print(f'tipo: {type(arg)} conteudo: {arg}')
func_args(1, 'A', {'valor': 10},2, 'B', {'valor': 22})
def func_kwargs(**kwargs):
print(f'tipo: {type(kwargs)} conteudo: {kwargs}')
for key,value in kwargs.item... | def func_args(*args):
print(f'tipo: {type(args)} conteudo: {args}')
for arg in args:
print(f'tipo: {type(arg)} conteudo: {arg}')
func_args(1, 'A', {'valor': 10}, 2, 'B', {'valor': 22})
def func_kwargs(**kwargs):
print(f'tipo: {type(kwargs)} conteudo: {kwargs}')
for (key, value) in kwargs.items(... |
#
# PySNMP MIB module CISCO-UNIFIED-COMPUTING-FEATURE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-UNIFIED-COMPUTING-FEATURE-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:59:30 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Usi... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, constraints_union, value_size_constraint, single_value_constraint) ... |
#
# Copyright (C) 2020 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | fib_type = ['TENSOR_FLOAT32', [1, 0]]
counter_type = ['TENSOR_INT32', [1]]
bool_type = ['TENSOR_BOOL8', [1]]
quant8_params = ['TENSOR_QUANT8_ASYMM', 1.0, 0]
quant8_signed_params = ['TENSOR_QUANT8_ASYMM_SIGNED', 1.0, 0]
def make_condition_model():
fib = input('fib', FibType)
i = input('i', CounterType)
n = ... |
print('Hello world123')
a = 5
def asd():
global a
a = a + 1
print(a)
for i in range(10):
asd()
| print('Hello world123')
a = 5
def asd():
global a
a = a + 1
print(a)
for i in range(10):
asd() |
class Disassembler(object):
def __init__(self):
self.opcodes = {
0x0: "_rcs",
0x1: "_jp",
0x2: "_call",
0x3: "_se_kk",
0x4: "_sne_kk",
0x5: "_se",
0x6: "_ld_kk",
0x7: "_add",
0x8: "_bitops",
... | class Disassembler(object):
def __init__(self):
self.opcodes = {0: '_rcs', 1: '_jp', 2: '_call', 3: '_se_kk', 4: '_sne_kk', 5: '_se', 6: '_ld_kk', 7: '_add', 8: '_bitops', 9: '_sne', 10: '_ld_i', 11: '_jp_v0', 12: '_rnd', 13: '_draw', 14: '_skip', 15: '_ld'}
self.V = {0: 'V0', 1: 'V1', 2: 'V2', 3: ... |
# Copyright 2018 Netflix, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | tcpstate = {}
tcpstate[1] = 'ESTABLISHED'
tcpstate[2] = 'SYN_SENT'
tcpstate[3] = 'SYN_RECV'
tcpstate[4] = 'FIN_WAIT1'
tcpstate[5] = 'FIN_WAIT2'
tcpstate[6] = 'TIME_WAIT'
tcpstate[7] = 'CLOSE'
tcpstate[8] = 'CLOSE_WAIT'
tcpstate[9] = 'LAST_ACK'
tcpstate[10] = 'LISTEN'
tcpstate[11] = 'CLOSING'
tcpstate[12] = 'NEW_SYN_REC... |
N, M = map(int, input().split())
pods = list(map(int, input().split()))
ans, count = 10**9, 0
cart = [0] * N
l = 0
for r in range(M):
if cart[pods[r]] == 0:
count += 1;
cart[pods[r]] += 1
while count == N:
ans = min(ans, r-l+1);
cart[pods[l]] -= 1
if cart[pods[l]] == 0:
... | (n, m) = map(int, input().split())
pods = list(map(int, input().split()))
(ans, count) = (10 ** 9, 0)
cart = [0] * N
l = 0
for r in range(M):
if cart[pods[r]] == 0:
count += 1
cart[pods[r]] += 1
while count == N:
ans = min(ans, r - l + 1)
cart[pods[l]] -= 1
if cart[pods[l]] =... |
nonvowel_exceptions = {"historic", "honor", "hour", "honest", "habitual", "herb"}
vowel_exceptions = {"union", "united", "unicorn", "used", "one", "university", "unicycle", "universal", "unit", "usuability", "ewe", "used"}
# Return if it needs an or a in front
def iart(word, obj = False):
# Check if it needs ... | nonvowel_exceptions = {'historic', 'honor', 'hour', 'honest', 'habitual', 'herb'}
vowel_exceptions = {'union', 'united', 'unicorn', 'used', 'one', 'university', 'unicycle', 'universal', 'unit', 'usuability', 'ewe', 'used'}
def iart(word, obj=False):
if obj:
word = word.name
if word in vowel_exceptions:... |
PAGINATION_MODEL = {
"list_executions": {
"input_token": "next_token",
"limit_key": "max_results",
"limit_default": 100,
"page_ending_range_keys": ["start_date", "execution_arn"],
},
"list_state_machines": {
"input_token": "next_token",
"limit_key": "max_resul... | pagination_model = {'list_executions': {'input_token': 'next_token', 'limit_key': 'max_results', 'limit_default': 100, 'page_ending_range_keys': ['start_date', 'execution_arn']}, 'list_state_machines': {'input_token': 'next_token', 'limit_key': 'max_results', 'limit_default': 100, 'page_ending_range_keys': ['creation_d... |
num1 = 111
num2 = 222
num3 = 333333333
num3 = 333
num4 = 444
| num1 = 111
num2 = 222
num3 = 333333333
num3 = 333
num4 = 444 |
RES_LABEL_AD_LEGITIMATE = [
"employee",
"manager",
"OSHA",
"license",
"business",
"technician",
"certified",
"degree",
"salary",
"retail",
"401k",
"insurance"
] | res_label_ad_legitimate = ['employee', 'manager', 'OSHA', 'license', 'business', 'technician', 'certified', 'degree', 'salary', 'retail', '401k', 'insurance'] |
'''
Fibonacci Member
Given a number N, figure out if it is a member of fibonacci series or not. Return true if the number is member of fibonacci series else false.
Fibonacci Series is defined by the recurrence
F(n) = F(n-1) + F(n-2)
where F(0) = 0 and F(1) = 1
Input Format :
Integer N
Output Format :
true or fal... | """
Fibonacci Member
Given a number N, figure out if it is a member of fibonacci series or not. Return true if the number is member of fibonacci series else false.
Fibonacci Series is defined by the recurrence
F(n) = F(n-1) + F(n-2)
where F(0) = 0 and F(1) = 1
Input Format :
Integer N
Output Format :
true or fal... |
class Document:
def __init__(self, sentences):
self.sentences = sentences
self.title_string = ''
self.title_tokens = []
self.abstract_string = ''
self.abstract_tokens = []
self.fulltext_string = ''
self.fulltext_tokens = []
self.compute_attributes()
... | class Document:
def __init__(self, sentences):
self.sentences = sentences
self.title_string = ''
self.title_tokens = []
self.abstract_string = ''
self.abstract_tokens = []
self.fulltext_string = ''
self.fulltext_tokens = []
self.compute_attributes()
... |
def main():
# input
N = int(input())
S = input()
# compute
# output
if S.index('1')%2 == 0:
print('Takahashi')
else:
print('Aoki')
if __name__ == '__main__':
main()
| def main():
n = int(input())
s = input()
if S.index('1') % 2 == 0:
print('Takahashi')
else:
print('Aoki')
if __name__ == '__main__':
main() |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | dropbox_edge = {'color': {'color': '#2C6AFB'}, 'title': 'Dropbox Parsing Functions', 'label': 'DB'}
def run(unfurl, node):
if 'dropbox.com' in unfurl.find_preceding_domain(node):
if node.data_type == 'url.path' and node.value.startswith('/home'):
(_, viewed_directory) = node.value.split('/home'... |
# Description
# At the final stage, you will improve your simple bot so that it can
# give you a test and check your answers. The test should be a
# multiple-choice quiz about programming. Your bot has to repeat
# the test until you answer correctly and congratulate you upon
# completion.
# Objective
# Your bot can... | class Bot:
def __init__(self, bot_name, birth_year):
self.bot_name = bot_name
self.birth_year = birth_year
self.name = None
def greet(self):
print(f'Hello! My name is {self.bot_name}')
print(f'I was created in {self.birth_year}')
def ask_creator(self):
self... |
# vim: set et sw=4 ts=4 nu fdm=indent:
# coding: utf8
class Couple:
def __init__(self, index1, index2, J):
self.index1 = index1
self.index2 = index2
self.J = J
class Bridge:
def __init__(self, index1, index2, width, height, J):
self.index1 = index1
self.index2 = index2... | class Couple:
def __init__(self, index1, index2, J):
self.index1 = index1
self.index2 = index2
self.J = J
class Bridge:
def __init__(self, index1, index2, width, height, J):
self.index1 = index1
self.index2 = index2
self.width = width
self.height = heig... |
def task_make_dataset():
cmd = ["bash", "tabular/data/make_dataset.sh"]
return dict(
actions=[cmd],
uptodate=[True],
file_dep=[],
targets=[
"data/raw/titanic/gender_submission.csv",
"data/raw/titanic/train.csv",
"data/raw/titanic/test.csv",
... | def task_make_dataset():
cmd = ['bash', 'tabular/data/make_dataset.sh']
return dict(actions=[cmd], uptodate=[True], file_dep=[], targets=['data/raw/titanic/gender_submission.csv', 'data/raw/titanic/train.csv', 'data/raw/titanic/test.csv'], verbosity=2) |
def get_abstract_pdf(p_text):
#creating the variable to identify the abstract
lower = 0
upper = 0
ab = ''
p_text = p_text.split()
for i in range(len(p_text)):
#changing the lower bound when the word abstract is present
if lower == 0 and p_text[i].lower() == 'abstract':
... | def get_abstract_pdf(p_text):
lower = 0
upper = 0
ab = ''
p_text = p_text.split()
for i in range(len(p_text)):
if lower == 0 and p_text[i].lower() == 'abstract':
lower = i
elif upper == 0 and p_text[i].lower() == 'introduction':
upper = i
elif (lower !... |
class Vector:
def __init__(self,vec):
self.vec = vec
def __str__(self):
return f"{self.vec[0]}i + {self.vec[1]}j + {self.vec[2]}k"
v1 = Vector([1,2,3])
v2 = Vector([5,7,9])
print(v1)
print(v2)
| class Vector:
def __init__(self, vec):
self.vec = vec
def __str__(self):
return f'{self.vec[0]}i + {self.vec[1]}j + {self.vec[2]}k'
v1 = vector([1, 2, 3])
v2 = vector([5, 7, 9])
print(v1)
print(v2) |
# Databricks notebook source
# MAGIC %md
# MAGIC ##<img src="https://databricks.com/wp-content/themes/databricks/assets/images/databricks-logo.png" alt="logo" width="240"/>
# MAGIC ### <img src="https://databricks-knowledge-repo-images.s3.us-east-2.amazonaws.com/HLS/glow/project_glow_logo.png" alt="logo" width="35"/> ... | dbutils.fs.put('dbfs:/tmp/databricks/scripts/install-hail.sh', '\n#!/bin/bash\nset -ex\n\n# Pick up user-provided environment variables, specifically HAIL_VERSION\nsource /databricks/spark/conf/spark-env.sh\n\n/databricks/python/bin/pip install -U hail==$HAIL_VERSION\nhail_jar_path=$(find /databricks/python3 -name \'ha... |
color_schemes = {
'liquid': {
'background': (255, 180, 120, 255),
'particles': (25, 39, 204, 128),
'label': (255, 180, 120, 255),
'boundary': (204, 78, 25, 255),
'liquid': (0, 176, 255, 128)
},
'smoke': {
'background': (255, 180, 120, 255),
'particles'... | color_schemes = {'liquid': {'background': (255, 180, 120, 255), 'particles': (25, 39, 204, 128), 'label': (255, 180, 120, 255), 'boundary': (204, 78, 25, 255), 'liquid': (0, 176, 255, 128)}, 'smoke': {'background': (255, 180, 120, 255), 'particles': (128, 128, 128, 128), 'label': (255, 180, 120, 255), 'boundary': (204,... |
def readGraph():
line = input()
l = line.split()
N = int(l[0])
M = int(l[1])
G = [] # Graph
GR = [] # Graph reversed edges
for i in range(0,N):
G.append([])
GR.append([])
for i in range(0,M):
line = input()
l = line.split()
ls = list(map(int,l))
G[ls[0]].append(ls[1])
GR[ls[1]].append(ls[0])
... | def read_graph():
line = input()
l = line.split()
n = int(l[0])
m = int(l[1])
g = []
gr = []
for i in range(0, N):
G.append([])
GR.append([])
for i in range(0, M):
line = input()
l = line.split()
ls = list(map(int, l))
G[ls[0]].append(ls[1]... |
#!/usr/bin/env python3
with open("input") as file_:
numbers = file_.readlines()
numbers = list(map(int, numbers))
def func(preamble):
index = preamble
while index < len(numbers):
next_value = numbers[index]
sorted_numbers = numbers[index-preamble:index]
sorted_numbers = sorted... | with open('input') as file_:
numbers = file_.readlines()
numbers = list(map(int, numbers))
def func(preamble):
index = preamble
while index < len(numbers):
next_value = numbers[index]
sorted_numbers = numbers[index - preamble:index]
sorted_numbers = sorted(sorted_numbers)
... |
class Diff(object):
def __init__(self, first, second, with_values=False, vice_versa=False):
self.difference = []
self.check(first, second, with_values=with_values)
if vice_versa:
self.check(second, first, with_values=with_values)
def check(self, first, secon... | class Diff(object):
def __init__(self, first, second, with_values=False, vice_versa=False):
self.difference = []
self.check(first, second, with_values=with_values)
if vice_versa:
self.check(second, first, with_values=with_values)
def check(self, first, second, path='', with... |
# Project Euler 2
num0 = 0
num1 = 1
total = 0
while num1 < 4000000:
num0, num1 = num1, num1 + num0
if num1 % 2 == 0:
total += num1
print(total)
| num0 = 0
num1 = 1
total = 0
while num1 < 4000000:
(num0, num1) = (num1, num1 + num0)
if num1 % 2 == 0:
total += num1
print(total) |
runtime_project='commons'
#editor_project='commons-Editor'
runtime_project_file='commons'
#editor_project_file='Assembly-CSharp-Editor'
MONO="/Applications/Unity/MonoDevelop.app/Contents/Frameworks/Mono.framework/Versions/Current/bin/mono"
MDTOOL="/Applications/Unity/MonoDevelop.app/Contents/MacOS/lib/monodevelop/bin/m... | runtime_project = 'commons'
runtime_project_file = 'commons'
mono = '/Applications/Unity/MonoDevelop.app/Contents/Frameworks/Mono.framework/Versions/Current/bin/mono'
mdtool = '/Applications/Unity/MonoDevelop.app/Contents/MacOS/lib/monodevelop/bin/mdtool.exe'
mono_solution = 'commons.sln'
define = '' |
class LinkedListNode:
def __init__(self, data=None, next=None):
self.data = data
self.next = next
class LinkedList:
def __init__(self, head=None):
self.head = head
def append(self, data):
new_node = LinkedListNode(data)
if self.head:
current = self.head... | class Linkedlistnode:
def __init__(self, data=None, next=None):
self.data = data
self.next = next
class Linkedlist:
def __init__(self, head=None):
self.head = head
def append(self, data):
new_node = linked_list_node(data)
if self.head:
current = self.h... |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'conditions': [
['OS=="ios"', {
'exclude_nss_root_certs%': 0,
'exclude_nss_libpkix%': 0,
}, {
... | {'variables': {'conditions': [['OS=="ios"', {'exclude_nss_root_certs%': 0, 'exclude_nss_libpkix%': 0}, {'exclude_nss_root_certs%': 1, 'exclude_nss_libpkix%': 1}]]}, 'target_defaults': {'configurations': {'Debug': {'defines': ['DEBUG', '_DEBUG']}, 'Release': {'defines': ['NDEBUG']}}, 'conditions': [['OS=="win"', {'confi... |
class Singleton(object):
__instance = None
__created = False
def __new__(cls, *args, **kwargs):
if cls.__instance is None:
cls.__instance = object.__new__(cls)
return cls.__instance
@property
def created(cls):
if cls.__created == False:
cls.__created... | class Singleton(object):
__instance = None
__created = False
def __new__(cls, *args, **kwargs):
if cls.__instance is None:
cls.__instance = object.__new__(cls)
return cls.__instance
@property
def created(cls):
if cls.__created == False:
cls.__created... |
module([
puts(concatenateStrings([typeOf(theObject="1"), '""'])),
puts(concatenateStrings([typeOf(theObject='"A string"'), '""']))
])
| module([puts(concatenate_strings([type_of(theObject='1'), '""'])), puts(concatenate_strings([type_of(theObject='"A string"'), '""']))]) |
N, *d = map(int, open(0).read().split())
print(sum(d))
print(max(0, 2 * max(d) - sum(d)))
| (n, *d) = map(int, open(0).read().split())
print(sum(d))
print(max(0, 2 * max(d) - sum(d))) |
def main():
num = int(input('Digite um numero na base binaria: '))
aux = num
cont = 0
dec = 0
while aux != 0:
dec += (aux%10)*(2**cont)
aux = aux//10
cont += 1
print ('O numero {} (base binaria) eh igual a {} (base decimal)'.format(num,dec))
main() | def main():
num = int(input('Digite um numero na base binaria: '))
aux = num
cont = 0
dec = 0
while aux != 0:
dec += aux % 10 * 2 ** cont
aux = aux // 10
cont += 1
print('O numero {} (base binaria) eh igual a {} (base decimal)'.format(num, dec))
main() |
class MyClass(object):
def __init__(self):
self._attr_one = 42
self._attr_two = 42
@property
def prop_one(self):
return self._attr_one
@prop_one.setter
def prop(self, value):
self._attr_one = value
def get_prop_two(self):
return self._attr_two
def ... | class Myclass(object):
def __init__(self):
self._attr_one = 42
self._attr_two = 42
@property
def prop_one(self):
return self._attr_one
@prop_one.setter
def prop(self, value):
self._attr_one = value
def get_prop_two(self):
return self._attr_two
def... |
class TagIdentifierByteRepresentationError(TypeError):
pass
class DataDoesNotMatchTagDefinitionError(TypeError):
pass
class DataShapeError(ValueError):
pass
class CouldNotAcquireFileLockError(OSError):
pass
class DateDataError(ValueError):
pass
class CouldNotCalculateNumBytesError(ValueErr... | class Tagidentifierbyterepresentationerror(TypeError):
pass
class Datadoesnotmatchtagdefinitionerror(TypeError):
pass
class Datashapeerror(ValueError):
pass
class Couldnotacquirefilelockerror(OSError):
pass
class Datedataerror(ValueError):
pass
class Couldnotcalculatenumbyteserror(ValueError):
... |
list1=[1,2,3,4,5]
print(list1)
list1.remove(1)#removing values using values
print(list1)
list1.pop(1)
print(list1)
list1.pop()#removes the end element
print(list1)
list2=[1,2,3,4,5,6,778]
del[list2[2:]]
print(list2) | list1 = [1, 2, 3, 4, 5]
print(list1)
list1.remove(1)
print(list1)
list1.pop(1)
print(list1)
list1.pop()
print(list1)
list2 = [1, 2, 3, 4, 5, 6, 778]
del [list2[2:]]
print(list2) |
for c in range(1, 41):
for b in range(1, c):
for a in range(1, b):
if a * a + b * b == c * c:
print(f'{a}, {b}, {c}')
| for c in range(1, 41):
for b in range(1, c):
for a in range(1, b):
if a * a + b * b == c * c:
print(f'{a}, {b}, {c}') |
def match_limit(offer_book, order):
matching_offers = offer_book.get_offers_by_price(order.price, order.order_type)
matching_offers.sort(key=lambda x: x.base_amount, reverse=True)
amount_left = order.amount
take_offers = list()
for offer in matching_offers:
if amount_left >= offer.base_... | def match_limit(offer_book, order):
matching_offers = offer_book.get_offers_by_price(order.price, order.order_type)
matching_offers.sort(key=lambda x: x.base_amount, reverse=True)
amount_left = order.amount
take_offers = list()
for offer in matching_offers:
if amount_left >= offer.base_amoun... |
'''
Escape Pods
===========
You've blown up the LAMBCHOP doomsday device and broken the bunnies out of Lambda's prison - and now you need to escape from the space station as quickly and as orderly as possible! The bunnies have all gathered in various locations throughout the station, and need to make their way towards... | """
Escape Pods
===========
You've blown up the LAMBCHOP doomsday device and broken the bunnies out of Lambda's prison - and now you need to escape from the space station as quickly and as orderly as possible! The bunnies have all gathered in various locations throughout the station, and need to make their way towards... |
class Solution:
def insert(self, intervals: [[int]], newInterval: [int]) -> [[int]]:
if newInterval == []:
return intervals
res = []
intervals.append(newInterval)
intervals = sorted(intervals)
l = intervals[0][0]
h = intervals[0][-1]
for i in range... | class Solution:
def insert(self, intervals: [[int]], newInterval: [int]) -> [[int]]:
if newInterval == []:
return intervals
res = []
intervals.append(newInterval)
intervals = sorted(intervals)
l = intervals[0][0]
h = intervals[0][-1]
for i in rang... |
class Solution:
def findDisappearedNumbers(self, nums: List[int]) -> List[int]:
length_nums = len(nums)
set_numbers = set(range(1, length_nums + 1))
for num in nums:
if num in set_numbers:
set_numbers.remove(num)
return list(set_numbers)
'''
used set... | class Solution:
def find_disappeared_numbers(self, nums: List[int]) -> List[int]:
length_nums = len(nums)
set_numbers = set(range(1, length_nums + 1))
for num in nums:
if num in set_numbers:
set_numbers.remove(num)
return list(set_numbers)
' \nused set si... |
# Self-link included in ATOM feed
FEED = 'http://ifcb-data.whoi.edu/feed'
# Where the data is mounted
FS_ROOTS = ['/mnt/ifcb_g/IFCB/ifcb_data_MVCO_jun06', '/mnt/ifcb_j/ifcb_data_MVCO_jun06']
# Enable caching
USE_MEMCACHED = True
MEMCACHED_SERVERS = ['127.0.0.1']
URL_BASE = ''
# uncomment for debugging
#URL_BASE = 'h... | feed = 'http://ifcb-data.whoi.edu/feed'
fs_roots = ['/mnt/ifcb_g/IFCB/ifcb_data_MVCO_jun06', '/mnt/ifcb_j/ifcb_data_MVCO_jun06']
use_memcached = True
memcached_servers = ['127.0.0.1']
url_base = '' |
'''
1. Write a Python program to sort a list of elements using Topological sort.
2. Write a Python program to sort a list of elements using Tree sort.
'''
| """
1. Write a Python program to sort a list of elements using Topological sort.
2. Write a Python program to sort a list of elements using Tree sort.
""" |
name__pkl_ext = '.pkl'
name__csv_ext = '.csv'
name__dat_Ext = '.dat'
path__org = '../data/'
path__generated = '../data/generated/'
name__input_train_data = path__org + 'lezhin_dataset_v2_training.tsv'
name__input_test_data = path__org + 'lezhin_dataset_v2_test_without_label.tsv'
name__preprocessed_train = path__gen... | name__pkl_ext = '.pkl'
name__csv_ext = '.csv'
name__dat__ext = '.dat'
path__org = '../data/'
path__generated = '../data/generated/'
name__input_train_data = path__org + 'lezhin_dataset_v2_training.tsv'
name__input_test_data = path__org + 'lezhin_dataset_v2_test_without_label.tsv'
name__preprocessed_train = path__genera... |
def strings(w):
index = 0
c = len(w)
while index < len(w):
letter = w[c-1]
print(letter)
c = c-1
index = index + 1
w = input("Ingrese una palabra:\n")
strings(w)
| def strings(w):
index = 0
c = len(w)
while index < len(w):
letter = w[c - 1]
print(letter)
c = c - 1
index = index + 1
w = input('Ingrese una palabra:\n')
strings(w) |
class Model:
def __init__(self, t, c = ""):
self.tag = t
self.cid = c
self.children = []
self.data = ""
def __str__(self):
op = self.tag
for c in self.children:
op += f"\n {c}"
return op
def add(self, child):
self.... | class Model:
def __init__(self, t, c=''):
self.tag = t
self.cid = c
self.children = []
self.data = ''
def __str__(self):
op = self.tag
for c in self.children:
op += f'\n {c}'
return op
def add(self, child):
self.children.append... |
_base_ = [
'../retinanet_r50_fpn_1x_coco.py',
'../../_base_/datasets/hdr_detection_mantiuk.py'
]
| _base_ = ['../retinanet_r50_fpn_1x_coco.py', '../../_base_/datasets/hdr_detection_mantiuk.py'] |
def abbreviation(a, b):
if len(b) == 0:
return a.lower() == a
elif len(a) < len(b):
return False
elif a[0] == b[0]:
# a_ch and b_ch match
return abbreviation(a[1:], b[1:])
elif a[0].isupper():
# a_ch and b_ch do not match, a_ch is upper case
return False
... | def abbreviation(a, b):
if len(b) == 0:
return a.lower() == a
elif len(a) < len(b):
return False
elif a[0] == b[0]:
return abbreviation(a[1:], b[1:])
elif a[0].isupper():
return False
elif a[0].upper() == b[0]:
return abbreviation(a[1:], b[1:]) or abbreviation... |
#
# PySNMP MIB module RADLAN-Physicaldescription-old-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RADLAN-Physicaldescription-old-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:40:00 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, single_value_constraint, constraints_union, value_size_constraint, constraints_intersection) ... |
class ArrayModifier:
constant_offset_displace = None
count = None
curve = None
end_cap = None
fit_length = None
fit_type = None
merge_threshold = None
offset_object = None
relative_offset_displace = None
start_cap = None
use_constant_offset = None
use_merge_vertices = Non... | class Arraymodifier:
constant_offset_displace = None
count = None
curve = None
end_cap = None
fit_length = None
fit_type = None
merge_threshold = None
offset_object = None
relative_offset_displace = None
start_cap = None
use_constant_offset = None
use_merge_vertices = Non... |
FLArm.moveTo(90)
FRArm.moveTo(90)
sleep(0.3)
BLWrist.moveTo(180)
BRWrist.moveTo(180)
FLWrist.moveTo(180)
FRWrist.moveTo(180)
sleep(0.1)
BLArm.moveTo(100)
BRArm.moveTo(100)
| FLArm.moveTo(90)
FRArm.moveTo(90)
sleep(0.3)
BLWrist.moveTo(180)
BRWrist.moveTo(180)
FLWrist.moveTo(180)
FRWrist.moveTo(180)
sleep(0.1)
BLArm.moveTo(100)
BRArm.moveTo(100) |
CONTAINER_IMAGE = "runner"
CONTAINER_MAX_MEMORY = "64m" # 64 mb
CONTAINER_NETWORKING_ENABLED = False
CONTAINER_RUNTIME = "runsc"
CONTAINER_TERMINAL = "/bin/bash"
UNTRUSTED_CODE_DIRECTORY = "home"
UNTRUSTED_CODE_FILENAME = "untrusted_code"
VALID_LANGUAGES = ["c", "cpp", "js", "py"]
| container_image = 'runner'
container_max_memory = '64m'
container_networking_enabled = False
container_runtime = 'runsc'
container_terminal = '/bin/bash'
untrusted_code_directory = 'home'
untrusted_code_filename = 'untrusted_code'
valid_languages = ['c', 'cpp', 'js', 'py'] |
# Implement a class to hold room information. This should have name and
# description attributes.
class Room:
def __init__(self, name, description):
self.name = name
self.description = description
self.is_lit = False # denote if the room is light enough to see items
self.contents = [... | class Room:
def __init__(self, name, description):
self.name = name
self.description = description
self.is_lit = False
self.contents = [] |
# Programa que quando informado a medida em metros retorne ela em: km, hm, dam, dm, cm, mm
try:
medida = float(input("Informe a medida em Metros: "))
print(f"Em km: {medida/1000}km")
print(f"Em hm: {medida/100}hm")
print(f"Em dam: {medida/10}dam")
print(f"Em dm: {medida*10}dm")
print(f"Em cm: {m... | try:
medida = float(input('Informe a medida em Metros: '))
print(f'Em km: {medida / 1000}km')
print(f'Em hm: {medida / 100}hm')
print(f'Em dam: {medida / 10}dam')
print(f'Em dm: {medida * 10}dm')
print(f'Em cm: {medida * 100}cm')
print(f'Em mm: {medida * 1000}mm')
except Exception as erro:
... |
APPINFO_JSON = {u'sdkVersion': u'3', u'uuid': u'133215f0-cf20-4c05-997b-3c9be5a64e5b', u'appKeys': {}, u'companyName': u'Leeloo Inc.', u'targetPlatforms': [u'aplite', u'basalt', u'chalk'], u'capabilities': [u''], u'versionLabel': u'0.4', u'longName': u'Tennis', u'versionCode': 1, u'shortName': u'Tennis', u'watchapp': {... | appinfo_json = {u'sdkVersion': u'3', u'uuid': u'133215f0-cf20-4c05-997b-3c9be5a64e5b', u'appKeys': {}, u'companyName': u'Leeloo Inc.', u'targetPlatforms': [u'aplite', u'basalt', u'chalk'], u'capabilities': [u''], u'versionLabel': u'0.4', u'longName': u'Tennis', u'versionCode': 1, u'shortName': u'Tennis', u'watchapp': {... |
class Resposta:
def __init__(self, accao, prioridade=0.0):
self._accao = accao
self._prioridade = prioridade
@property
def accao(self):
return self._accao
@property
def prioridade(self):
return self._prioridade
| class Resposta:
def __init__(self, accao, prioridade=0.0):
self._accao = accao
self._prioridade = prioridade
@property
def accao(self):
return self._accao
@property
def prioridade(self):
return self._prioridade |
class InitSettings:
stepdownDelay = 0.175 # Delay for beep during vibration/recovery state.
numberOfSteps = 80 # tempo of steps per minute.
laserToggle = True # Whether laser turns on or off during recovery state.
# Duration of the warning state between walking and recovering states. Time
# i... | class Initsettings:
stepdown_delay = 0.175
number_of_steps = 80
laser_toggle = True
vibration_state__duration = 3
vibration_state_entry_delay = 0.5
walking_state_entry_delay = 0.5
paused_state_entry_delay = 3
check_duration = 2
startup_duration = 5
enable_second_haptic = True
... |
# The API requires specific book codes, so I have to be able to translate all of them. key -> value is the best for this.
def books_dict():
return dict([("GENESIS", "GEN"),
("EXODUS", "EXO"),
("LEVITICUS", "LEV"),
("NUMBERS", "NUM"),
("DEUTERONOMY"... | def books_dict():
return dict([('GENESIS', 'GEN'), ('EXODUS', 'EXO'), ('LEVITICUS', 'LEV'), ('NUMBERS', 'NUM'), ('DEUTERONOMY', 'DEU'), ('JOSHUA', 'JOS'), ('JUDGES', 'JDG'), ('RUTH', 'RUT'), ('1 SAMUEL', '1SA'), ('2 SAMUEL', '2SA'), ('1ST SAMUEL', '1SA'), ('2ND SAMUEL', '2SA'), ('1ST KINGS', '1KI'), ('2ND KINGS', '... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.