content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# 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 convertBST(self, root: Optional[TreeNode]) -> Optional[TreeNode]:
prev = 0
def ... | class Solution:
def convert_bst(self, root: Optional[TreeNode]) -> Optional[TreeNode]:
prev = 0
def inorder_traversal(root):
nonlocal prev
if not root:
return
inorder_traversal(root.right)
root.val += prev
prev = root.val
... |
all_boards = {
'sysop': 1,
'vote': 2,
'bbslists': 3,
'notepad': 6,
'Test': 7,
'Dance': 8,
'Board': 9,
'Wisdom': 10,
'Science': 12,
'Linux': 13,
'IBMThinkPad': 14,
'LifeScience': 15,
'BBShelp': 16,
'Mechanics': 17,
'Emprise': 18,
'Philosophy': 20,
'Lite... | all_boards = {'sysop': 1, 'vote': 2, 'bbslists': 3, 'notepad': 6, 'Test': 7, 'Dance': 8, 'Board': 9, 'Wisdom': 10, 'Science': 12, 'Linux': 13, 'IBMThinkPad': 14, 'LifeScience': 15, 'BBShelp': 16, 'Mechanics': 17, 'Emprise': 18, 'Philosophy': 20, 'Literature': 21, 'Triangle': 22, 'GSM': 23, 'CS': 24, 'PKULibrary': 25, '... |
class RequestSourceValidator(object):
REQUIRED_AUTHENTICATIONS = ["manager", "host"]
SUPPORTED_TRANSPORT_METHODS = ['vddk', 'ssh']
def __init__(self, request):
self._request = request
self._errors = []
def validate(self):
for auth in self.REQUIRED_AUTHENTICATIONS:
... | class Requestsourcevalidator(object):
required_authentications = ['manager', 'host']
supported_transport_methods = ['vddk', 'ssh']
def __init__(self, request):
self._request = request
self._errors = []
def validate(self):
for auth in self.REQUIRED_AUTHENTICATIONS:
i... |
string = input()
result = []
for index in range(len(string)):
if string[index].isupper():
result.append(index)
print(result)
| string = input()
result = []
for index in range(len(string)):
if string[index].isupper():
result.append(index)
print(result) |
x = 10
if (x % 2) == 0 and (x % 5) == 0:
print(x)
A1 = "ostrich"
print('o' in A1)
print('r' not in A1)
| x = 10
if x % 2 == 0 and x % 5 == 0:
print(x)
a1 = 'ostrich'
print('o' in A1)
print('r' not in A1) |
class Solution:
def XXX(self, nums: List[int]) -> bool:
length = len(nums)
global tag
tag = False
def dfs(idx):
if idx == length - 1:
global tag
tag = True
return
if idx >= length or nums[idx] < 1:
... | class Solution:
def xxx(self, nums: List[int]) -> bool:
length = len(nums)
global tag
tag = False
def dfs(idx):
if idx == length - 1:
global tag
tag = True
return
if idx >= length or nums[idx] < 1:
... |
# https://www.youtube.com/watch?v=fFVZt-6sgyo
# broute force
def subarraySum(nums, k):
count = 0
for i in range(len(nums)):
sub_sum = 0
for j in range(i, len(nums)):
sub_sum += nums[j]
if sub_sum == k:
count += 1
return count
# sliding window, only... | def subarray_sum(nums, k):
count = 0
for i in range(len(nums)):
sub_sum = 0
for j in range(i, len(nums)):
sub_sum += nums[j]
if sub_sum == k:
count += 1
return count
def subarray_sum(arr, k):
if k < arr[0]:
return 0
(count, sub_sum) = ... |
# -*- coding: utf-8 -*-
'''
Management of Open vSwitch ports.
'''
def __virtual__():
'''
Only make these states available if Open vSwitch module is available.
'''
return 'openvswitch.port_add' in __salt__
def present(name, bridge):
'''
Ensures that the named port exists on bridge, eventually... | """
Management of Open vSwitch ports.
"""
def __virtual__():
"""
Only make these states available if Open vSwitch module is available.
"""
return 'openvswitch.port_add' in __salt__
def present(name, bridge):
"""
Ensures that the named port exists on bridge, eventually creates it.
Args:
... |
# Copyright 2014 Dave Kludt
#
# 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, s... | auth_return = {'access': {'token': {'RAX-AUTH:authenticatedBy': ['APIKEY'], 'expires': '2015-06-23T12:44:18.758Z', 'id': '183e2f66535d4e03a04b2a91cf4a4f83', 'tenant': {'id': '123456', 'name': '123456'}}, 'serviceCatalog': [{'endpoints': [{'region': 'IAD', 'publicURL': 'https://cdn5.clouddrive.com/v1/MossoCloudFS_123456... |
'''P36 (**) Determine the prime factors of a given positive integer (2).
Construct a list containing the prime factors and their multiplicity.
Example:
* (prime-factors-mult 315)
((3 2) (5 1) (7 1))'''
base_divident=int(input('Enter number to find prime factors = '))
final_out=[]
original=base_divident #save... | """P36 (**) Determine the prime factors of a given positive integer (2).
Construct a list containing the prime factors and their multiplicity.
Example:
* (prime-factors-mult 315)
((3 2) (5 1) (7 1))"""
base_divident = int(input('Enter number to find prime factors = '))
final_out = []
original = base_divident
def prime... |
# This module contains a function to print Hello, World!
# Prints Hello, World!
def hello():
print("Hello, World!")
| def hello():
print('Hello, World!') |
class Difference:
def __init__(self, a):
self.__elements = a
def computeDifference(self):
result = []
data_len = len(self.__elements)
for i in range(data_len):
for n in range(i, data_len):
if i == n:
continue
x = ... | class Difference:
def __init__(self, a):
self.__elements = a
def compute_difference(self):
result = []
data_len = len(self.__elements)
for i in range(data_len):
for n in range(i, data_len):
if i == n:
continue
x = ... |
"""
The overridden attribute manager is a singleton that observes the scene to
react to attribute changes. If the attribute change is on an attribute
that is overridden by render setup, the attribute manager will attempt to
take the value change and reproduce it on the override itself.
This allows for convenient work... | """
The overridden attribute manager is a singleton that observes the scene to
react to attribute changes. If the attribute change is on an attribute
that is overridden by render setup, the attribute manager will attempt to
take the value change and reproduce it on the override itself.
This allows for convenient work... |
class notifyException(Exception):
"""Base class for other exceptions."""
code: int = None
payload: str = None
def __init__(self, message: str = None, *args, code: int = None, payload: str = None, **kwargs):
super(notifyException, self).__init__(*args, **kwargs)
self.args = (
... | class Notifyexception(Exception):
"""Base class for other exceptions."""
code: int = None
payload: str = None
def __init__(self, message: str=None, *args, code: int=None, payload: str=None, **kwargs):
super(notifyException, self).__init__(*args, **kwargs)
self.args = (message, code)
... |
# https://leetcode.com/problems/minimum-moves-to-equal-array-elements-ii
class Solution:
def minMoves2(self, nums: List[int]) -> int:
nums = sorted(nums)
if len(nums) % 2 == 1:
mid = nums[len(nums) // 2]
else:
mid = (nums[len(nums) // 2] + nums[len(nums) // 2 - 1]) ... | class Solution:
def min_moves2(self, nums: List[int]) -> int:
nums = sorted(nums)
if len(nums) % 2 == 1:
mid = nums[len(nums) // 2]
else:
mid = (nums[len(nums) // 2] + nums[len(nums) // 2 - 1]) // 2
res = 0
for num in nums:
res += abs(num ... |
guests = ["sam","mike","darren"]
for i in range(len(guests)):
print("Hello, "+guests[i].title()+" you are invited to dinner")
print(" ")
print(guests[0]+" cant make it to dinner unfortunately")
guests[0] = "alicia"
for i in range(len(guests)):
print("Hello, "+guests[i].title()+" you are invited to di... | guests = ['sam', 'mike', 'darren']
for i in range(len(guests)):
print('Hello, ' + guests[i].title() + ' you are invited to dinner')
print(' ')
print(guests[0] + ' cant make it to dinner unfortunately')
guests[0] = 'alicia'
for i in range(len(guests)):
print('Hello, ' + guests[i].title() + ' you are invited to d... |
__all__=[
'SG_disease',
'SG_weather',
'MY_dengue',
'MY_malaria',
'BN_disease',
'ID_malaria',
'PH_malaria',
'TH_disease',
'apps_who_int',
'wunderground'
] | __all__ = ['SG_disease', 'SG_weather', 'MY_dengue', 'MY_malaria', 'BN_disease', 'ID_malaria', 'PH_malaria', 'TH_disease', 'apps_who_int', 'wunderground'] |
while True:
usr = input("Enter username: ")
with open("users.txt", "r") as file:
users = file.readlines()
users = [i.strip("\n") for i in users]
if usr in users:
print("Username exists")
continue
else:
print("Username is fine")
break
while Tru... | while True:
usr = input('Enter username: ')
with open('users.txt', 'r') as file:
users = file.readlines()
users = [i.strip('\n') for i in users]
if usr in users:
print('Username exists')
continue
else:
print('Username is fine')
break
while True:
notes ... |
class ServiceUnavailable(Exception):
"""Raised when you try to send a request to a service that is
unavailable.
"""
class ServiceError(Exception):
"""Raised when a service failed to fulfill your request."""
class UnknownRejection(Exception):
"""Raised when a service rejects your request, and you haven't
regis... | class Serviceunavailable(Exception):
"""Raised when you try to send a request to a service that is
unavailable.
"""
class Serviceerror(Exception):
"""Raised when a service failed to fulfill your request."""
class Unknownrejection(Exception):
"""Raised when a service rejects your request, and you haven't... |
# Atharv Kolhar
# Python Bytes
"""
Question:
1. Create a list 'solar_system' of Planets in the Solar System and
print the 4th planet.
Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune, Pluto
2. Print the length of the 'solar_system'.
3. Remove the last planet Pluto from the list.
4. Reverse the list solar_... | """
Question:
1. Create a list 'solar_system' of Planets in the Solar System and
print the 4th planet.
Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune, Pluto
2. Print the length of the 'solar_system'.
3. Remove the last planet Pluto from the list.
4. Reverse the list solar_system
""" |
#!/usr/bin/env python
# encoding: utf-8
"""
Created by 'bens3' on 2013-06-21.
Copyright (c) 2013 'bens3'. All rights reserved.
""" | """
Created by 'bens3' on 2013-06-21.
Copyright (c) 2013 'bens3'. All rights reserved.
""" |
def set_default_values(args, also_hyper_params=True):
# -set default-values for certain arguments based on chosen scenario & experiment
if args.tasks is None:
if args.experiment=='splitMNIST':
args.num_classes = 10
if args.experiment=='splitMNISToneclass':
args.num_class... | def set_default_values(args, also_hyper_params=True):
if args.tasks is None:
if args.experiment == 'splitMNIST':
args.num_classes = 10
if args.experiment == 'splitMNISToneclass':
args.num_classes = 10
elif args.experiment == 'permMNIST':
args.num_classes =... |
# coding: utf-8
class DataBatch:
def __init__(self, mxnet_module):
self._data = []
self._label = []
self.mxnet_module = mxnet_module
def append_data(self, new_data):
self._data.append(self.__as_ndarray(new_data))
def append_label(self, new_label):
self._label.appe... | class Databatch:
def __init__(self, mxnet_module):
self._data = []
self._label = []
self.mxnet_module = mxnet_module
def append_data(self, new_data):
self._data.append(self.__as_ndarray(new_data))
def append_label(self, new_label):
self._label.append(self.__as_ndar... |
"""
File: weather_master.py
Name: DiCheng
-----------------------
This program should implement a console program
that asks weather data from user to compute the
average, highest, lowest, cold days among the inputs.
Output format should match what is shown in the sample
run in the Assignment 2 Handout.
"""
# enter EX... | """
File: weather_master.py
Name: DiCheng
-----------------------
This program should implement a console program
that asks weather data from user to compute the
average, highest, lowest, cold days among the inputs.
Output format should match what is shown in the sample
run in the Assignment 2 Handout.
"""
exit_code =... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def maxLevelSum(self, root: TreeNode) -> int:
if root is None:
return 0
result, current = [], [root]
... | class Solution:
def max_level_sum(self, root: TreeNode) -> int:
if root is None:
return 0
(result, current) = ([], [root])
while current:
(next_level, vals) = ([], [])
for node in current:
vals.append(node.val)
if node.left... |
test = {
'name': 'Question 4',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
>>> is_swap(19, 91)
False
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> is_swap(19, 19)
True... | test = {'name': 'Question 4', 'points': 1, 'suites': [{'cases': [{'code': '\n >>> is_swap(19, 91)\n False\n ', 'hidden': False, 'locked': False}, {'code': '\n >>> is_swap(19, 19)\n True\n ', 'hidden': False, 'locked': False}, {'code': '\n >>> is_swap(123, 1... |
class Registry(dict):
def __init__(self, *args, **kwargs):
super(Registry, self).__init__(*args, **kwargs)
def register(self, module_name):
def register_fn(module):
assert module_name not in self
self[module_name] = module
return module
return regist... | class Registry(dict):
def __init__(self, *args, **kwargs):
super(Registry, self).__init__(*args, **kwargs)
def register(self, module_name):
def register_fn(module):
assert module_name not in self
self[module_name] = module
return module
return regis... |
def findCandidate(A):
maj_index = 0
count = 1
for i in range(len(A)):
if A[maj_index] == A[i]: count += 1
else: count -= 1
if count == 0: maj_index, count = i, 1
return A[maj_index]
def isMajority(A, cand, k):
count = 0
for i in range(len(A)):
if A[i] == ... | def find_candidate(A):
maj_index = 0
count = 1
for i in range(len(A)):
if A[maj_index] == A[i]:
count += 1
else:
count -= 1
if count == 0:
(maj_index, count) = (i, 1)
return A[maj_index]
def is_majority(A, cand, k):
count = 0
for i in ... |
# unihernandez22
# https://atcoder.jp/contests/abc159/tasks/abc159_a
# math
print(sum(map(lambda i: int(i)*(int(i)-1)//2, input().split())))
| print(sum(map(lambda i: int(i) * (int(i) - 1) // 2, input().split()))) |
# define a function that display the output heading
def output_heading():
print('Programmer: Emily')
print('Course: COSC146')
print('Lab#: 0')
print('Due Date: 02-19-2019')
#define a function that takes a number and returns that number + 10
def plus10(value):
... | def output_heading():
print('Programmer: Emily')
print('Course: COSC146')
print('Lab#: 0')
print('Due Date: 02-19-2019')
def plus10(value):
value = value + 10
return value
output_heading()
print(plus10(1000))
def sumoftwo(x, y):
return x + y
print(su... |
class Codec:
url_list = []
def encode(self, longUrl):
self.url_list.append(longUrl)
return len(self.url_list) - 1
def decode(self, shortUrl):
return self.url_list[shortUrl]
if __name__ == '__main__':
codec = Codec()
print(codec.decode(codec.encode('xxxxx')))
print(c... | class Codec:
url_list = []
def encode(self, longUrl):
self.url_list.append(longUrl)
return len(self.url_list) - 1
def decode(self, shortUrl):
return self.url_list[shortUrl]
if __name__ == '__main__':
codec = codec()
print(codec.decode(codec.encode('xxxxx')))
print(codec... |
class BaseEndpoint():
def __repr__(self):
return f'<metrics.tools Endpoint [{self.endpoint}]>'
if __name__ == '__main__':
pass | class Baseendpoint:
def __repr__(self):
return f'<metrics.tools Endpoint [{self.endpoint}]>'
if __name__ == '__main__':
pass |
"""
Given a pattern and a string str, find if str follows the same pattern.
Here follow means a full match, such that there is a bijection between a
letter in pattern and a non-empty word in str.
Example:
Input: pattern = "abba", str = "dog cat cat dog"
Output: true
Example:
Input:pa... | """
Given a pattern and a string str, find if str follows the same pattern.
Here follow means a full match, such that there is a bijection between a
letter in pattern and a non-empty word in str.
Example:
Input: pattern = "abba", str = "dog cat cat dog"
Output: true
Example:
Input:pa... |
s = input()
start = s.find('A')
stop = s.rfind('Z')
print(stop - start + 1)
| s = input()
start = s.find('A')
stop = s.rfind('Z')
print(stop - start + 1) |
# ~autogen spec_version
spec_version = "spec: 0.9.3-pre-r2, kernel: v3.16.7-ckt16-7-ev3dev-ev3"
# ~autogen
| spec_version = 'spec: 0.9.3-pre-r2, kernel: v3.16.7-ckt16-7-ev3dev-ev3' |
def sol():
N = int(input())
string = input()
count = 0
while N > 0:
count += int(string[N - 1])
N -= 1
print(count)
if __name__ == "__main__":
sol()
| def sol():
n = int(input())
string = input()
count = 0
while N > 0:
count += int(string[N - 1])
n -= 1
print(count)
if __name__ == '__main__':
sol() |
# list
a = 'orange'
print(a[::-1])
print(a[1:4:2])
b = [1,2,3,34,5, 1]
print(b.count(1))
| a = 'orange'
print(a[::-1])
print(a[1:4:2])
b = [1, 2, 3, 34, 5, 1]
print(b.count(1)) |
N = int(input())
A, B = map(int, input().split())
counts = [0, 0, 0]
P = map(int, input().split())
for p in P:
if p <= A:
counts[0] += 1
elif p <= B:
counts[1] += 1
else:
counts[2] += 1
print(min(counts))
| n = int(input())
(a, b) = map(int, input().split())
counts = [0, 0, 0]
p = map(int, input().split())
for p in P:
if p <= A:
counts[0] += 1
elif p <= B:
counts[1] += 1
else:
counts[2] += 1
print(min(counts)) |
#!/bin/python3
print("Status: 200")
print("Content-Type: text/plain")
print()
print("Hello World!")
| print('Status: 200')
print('Content-Type: text/plain')
print()
print('Hello World!') |
color = {
"black":(0, 0, 0, 255), "white":(255, 255, 255, 255),
"red":(255, 0, 0, 255), "green":(0, 255, 0, 255),
"blue":(0, 0, 255, 255), "yellow":(255, 255, 0, 255),
"cyan":(0, 255, 255, 255), "magenta":(255, 0, 255, 255),
"silver":(192, 192, 192, 255), "gray":(128, 128, 128, 255),
"maroon":(1... | color = {'black': (0, 0, 0, 255), 'white': (255, 255, 255, 255), 'red': (255, 0, 0, 255), 'green': (0, 255, 0, 255), 'blue': (0, 0, 255, 255), 'yellow': (255, 255, 0, 255), 'cyan': (0, 255, 255, 255), 'magenta': (255, 0, 255, 255), 'silver': (192, 192, 192, 255), 'gray': (128, 128, 128, 255), 'maroon': (128, 0, 0, 255)... |
_base_ = [
'../_base_/models/fast_scnn.py', '../_base_/datasets/pascal_escroom.py',
'../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py'
]
# Re-config the data sampler.
data = dict(samples_per_gpu=2, workers_per_gpu=4)
# Re-config the optimizer.
optimizer = dict(type='SGD', lr=0.12, momentum... | _base_ = ['../_base_/models/fast_scnn.py', '../_base_/datasets/pascal_escroom.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py']
data = dict(samples_per_gpu=2, workers_per_gpu=4)
optimizer = dict(type='SGD', lr=0.12, momentum=0.9, weight_decay=4e-05)
checkpoint_config = dict(by_epoch=False, in... |
NBA_GAME_TIME = 48
def nba_extrap(points_per_game: float, minutes_per_game: float) -> float:
if minutes_per_game < 0.001:
return 0.0
else:
return round(points_per_game/minutes_per_game * NBA_GAME_TIME, 1) | nba_game_time = 48
def nba_extrap(points_per_game: float, minutes_per_game: float) -> float:
if minutes_per_game < 0.001:
return 0.0
else:
return round(points_per_game / minutes_per_game * NBA_GAME_TIME, 1) |
#!/usr/bin/env python3
# Common physical "constants"
# Universal gas constant (J/K/mol)
R_gas = 8.3144598
# "Standard gravity": rate of gravitational acceleration at Earth's surface (m/s2)
g0 = 9.80665
# Avogadro's number (molec/mol)
avog = 6.022140857e23
# Molar mass of dry air (g/mol)
MW_air = 28.97
# Radius o... | r_gas = 8.3144598
g0 = 9.80665
avog = 6.022140857e+23
mw_air = 28.97
r_earth = 6375000.0 |
def check_palindrome(str):
return str == str[::-1]
print(check_palindrome('palpa'))
print(check_palindrome('radar')) | def check_palindrome(str):
return str == str[::-1]
print(check_palindrome('palpa'))
print(check_palindrome('radar')) |
# Copyright 2017 The Forseti Security Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | """Test data for Cloud Resource Manager GCP api responses."""
fake_project_number = '1111111'
fake_project_id = 'forseti-system-test'
fake_org_id = '2222222'
fake_folder_id = '3333333'
get_project_response = '\n{\n "projectNumber": "1111111",\n "projectId": "forseti-system-test",\n "lifecycleState": "ACTIVE",\n "name":... |
def write(_text):
return 0
def flush():
pass
def _emit_ansi_escape(_=''):
def inner(_=None):
pass
return inner
clear_line = _emit_ansi_escape()
clear_end = _emit_ansi_escape()
hide_cursor = _emit_ansi_escape()
show_cursor = _emit_ansi_escape()
factory_cursor_up = lambda _: _emit_ansi_esca... | def write(_text):
return 0
def flush():
pass
def _emit_ansi_escape(_=''):
def inner(_=None):
pass
return inner
clear_line = _emit_ansi_escape()
clear_end = _emit_ansi_escape()
hide_cursor = _emit_ansi_escape()
show_cursor = _emit_ansi_escape()
factory_cursor_up = lambda _: _emit_ansi_escape()... |
class Solution(object):
def computeArea(self, A, B, C, D, E, F, G, H):
"""
:type A: int
:type B: int
:type C: int
:type D: int
:type E: int
:type F: int
:type G: int
:type H: int
:rtype: int
"""
rec1 = (C - A) * (D - B)
... | class Solution(object):
def compute_area(self, A, B, C, D, E, F, G, H):
"""
:type A: int
:type B: int
:type C: int
:type D: int
:type E: int
:type F: int
:type G: int
:type H: int
:rtype: int
"""
rec1 = (C - A) * (D - B... |
fibona = 89
anterior = 34
while fibona > 0:
print(fibona)
fibona -= anterior
anterior = fibona - anterior
if fibona == 0:
print(fibona) | fibona = 89
anterior = 34
while fibona > 0:
print(fibona)
fibona -= anterior
anterior = fibona - anterior
if fibona == 0:
print(fibona) |
def search(blocking, requester, task, keyword, tty_mode):
# the result of the task the hub thread submitted to us
# will not be available right now
task.set_async()
blocking.search_image(requester, task.return_result, keyword, tty_mode)
| def search(blocking, requester, task, keyword, tty_mode):
task.set_async()
blocking.search_image(requester, task.return_result, keyword, tty_mode) |
class Solution:
def getRow(self, rowIndex: int) -> List[int]:
n=rowIndex
if n==0:
return [1]
if n==1:
return [1,1]
arr=[[1],[1,1]]
k=1
for i in range(2,n+1):
arr.append([])
arr[i].append(1)
for j in range(1,k... | class Solution:
def get_row(self, rowIndex: int) -> List[int]:
n = rowIndex
if n == 0:
return [1]
if n == 1:
return [1, 1]
arr = [[1], [1, 1]]
k = 1
for i in range(2, n + 1):
arr.append([])
arr[i].append(1)
... |
class Solution:
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
if x < 0:
return False
y = 0
xx = x
while x != 0:
t = x % 10
y = y * 10 + t
x = x // 10
return y == xx
| class Solution:
def is_palindrome(self, x):
"""
:type x: int
:rtype: bool
"""
if x < 0:
return False
y = 0
xx = x
while x != 0:
t = x % 10
y = y * 10 + t
x = x // 10
return y == xx |
def kangaroo(x1, v1, x2, v2):
while (True):
if (x2 > x1 and v2 >= v1) or (x2 < x1 and v2 <= v1):
print('NO')
return 'NO'
x1 += v1
x2 += v2
if x1 == x2:
print('YES')
return 'YES' | def kangaroo(x1, v1, x2, v2):
while True:
if x2 > x1 and v2 >= v1 or (x2 < x1 and v2 <= v1):
print('NO')
return 'NO'
x1 += v1
x2 += v2
if x1 == x2:
print('YES')
return 'YES' |
class Solution:
def threeSumClosest(self, nums: List[int], target: int) -> int:
nums.sort()
result = float("inf")
for i in range(len(nums) - 2):
l, r = i + 1, len(nums) - 1
while l < r:
s = nums[i] + nums[l] + nums[r]
if s == target:
... | class Solution:
def three_sum_closest(self, nums: List[int], target: int) -> int:
nums.sort()
result = float('inf')
for i in range(len(nums) - 2):
(l, r) = (i + 1, len(nums) - 1)
while l < r:
s = nums[i] + nums[l] + nums[r]
if s == tar... |
print("Hours in a year =")
print(24*365)
print("Minutes in a decade =")
print(60*24*365*10)
print("My age in seconds =")
print((365*27+6+2+31+30+31+30+16)*24*1440)
print("Andreea's age =")
print(48618000/(365*24*1440))
print("?!")
print(1<<2)
# ** = ^
# << = bitshift
# % = modulus
print('Hello world')
print('')
p... | print('Hours in a year =')
print(24 * 365)
print('Minutes in a decade =')
print(60 * 24 * 365 * 10)
print('My age in seconds =')
print((365 * 27 + 6 + 2 + 31 + 30 + 31 + 30 + 16) * 24 * 1440)
print("Andreea's age =")
print(48618000 / (365 * 24 * 1440))
print('?!')
print(1 << 2)
print('Hello world')
print('')
print('Goo... |
terminalfont = {
"width": 6,
"height": 8,
"start": 32,
"end": 127,
"data": bytearray([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x06, 0x5F, 0x06, 0x00,
0x00, 0x07, 0x03, 0x00, 0x07, 0x03,
0x00, 0x24, 0x7E, 0x24, 0x7E, 0x24,
0x00, 0x24, 0x2B, 0x6A, 0x12, 0x00,
0x00, 0x63, 0x13, 0x08, 0x64, 0x63,
0x00, 0x36, 0x49,... | terminalfont = {'width': 6, 'height': 8, 'start': 32, 'end': 127, 'data': bytearray([0, 0, 0, 0, 0, 0, 0, 0, 6, 95, 6, 0, 0, 7, 3, 0, 7, 3, 0, 36, 126, 36, 126, 36, 0, 36, 43, 106, 18, 0, 0, 99, 19, 8, 100, 99, 0, 54, 73, 86, 32, 80, 0, 0, 7, 3, 0, 0, 0, 0, 62, 65, 0, 0, 0, 0, 65, 62, 0, 0, 0, 8, 62, 28, 62, 8, 0, 8, 8... |
# Einfache Rechenoperationen
# Addition und Subtraktion
1 + 2
1 - 2
# Multiplikation und Division
1 * 2
1 / 2
# Rechenregeln
(1 + 2) * 3
1 + 2 * 3
print("Hello World!") | 1 + 2
1 - 2
1 * 2
1 / 2
(1 + 2) * 3
1 + 2 * 3
print('Hello World!') |
def build_model_filters(model, query, field):
filters = []
if query:
# The field exists as an exposed column
if model.__mapper__.has_property(field):
filters.append(getattr(model, field).like("%{}%".format(query)))
return filters
| def build_model_filters(model, query, field):
filters = []
if query:
if model.__mapper__.has_property(field):
filters.append(getattr(model, field).like('%{}%'.format(query)))
return filters |
test = {
'name': 'Problem 9',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
scm> (lambda (x y) (+ x y))
d579a305762000c8ae036c510fb2baf6
# locked
""",
'hidden': False,
'locked': True
},
{
'code... | test = {'name': 'Problem 9', 'points': 1, 'suites': [{'cases': [{'code': '\n scm> (lambda (x y) (+ x y))\n d579a305762000c8ae036c510fb2baf6\n # locked\n ', 'hidden': False, 'locked': True}, {'code': '\n scm> (lambda (x) (+ x) (+ x x))\n (lambda (x) (+ x) (+ x x))\n ... |
"""
Codemonk link: https://www.hackerearth.com/problem/algorithm/little-monk-and-goblet-of-fire-3c1c6865/
Albus Dumbledore announced that the school will host the legendary event known as Wizard Tournament where four magical
schools are going to compete against each other in a very deadly competition by facing some da... | """
Codemonk link: https://www.hackerearth.com/problem/algorithm/little-monk-and-goblet-of-fire-3c1c6865/
Albus Dumbledore announced that the school will host the legendary event known as Wizard Tournament where four magical
schools are going to compete against each other in a very deadly competition by facing some da... |
count=0
num=336
for i in range(2,num+1):
while num%i==0:
num=num//i
if i == 2:
count=count+1
print(count)
'''
num=32546845
count=0
while num>0:
digit=num%10
num=num//10
if digit%2==0:
count=count+1
print(count)
'''
'''
count=0
for i in range(1,101):
while i%5==... | count = 0
num = 336
for i in range(2, num + 1):
while num % i == 0:
num = num // i
if i == 2:
count = count + 1
print(count)
'\nnum=32546845\ncount=0\nwhile num>0:\n digit=num%10\n num=num//10\n if digit%2==0:\n count=count+1\nprint(count)\n'
'\ncount=0\nfor i in range(1,... |
n=int(input())
for i in range(n):
D = dict()
for j in range(ord('a'),ord('z')+1):
D[j] = 0
a=input()
a=a.lower()
for j in a:
if ord('a') <= ord(j) <=ord('z'):
D[ord(j)] += 1
num = min(D.values())
print("Case {}:".format(i+1),end=" ")
if num == 0:
... | n = int(input())
for i in range(n):
d = dict()
for j in range(ord('a'), ord('z') + 1):
D[j] = 0
a = input()
a = a.lower()
for j in a:
if ord('a') <= ord(j) <= ord('z'):
D[ord(j)] += 1
num = min(D.values())
print('Case {}:'.format(i + 1), end=' ')
if num == 0:
... |
GAME_RESET = "on_reset"
GOAL_SCORED = "on_goal_scored"
START_PENALTY = "on_penalty_start"
END_PENALTY = "on_penalty_end"
| game_reset = 'on_reset'
goal_scored = 'on_goal_scored'
start_penalty = 'on_penalty_start'
end_penalty = 'on_penalty_end' |
#!/bin/python3
__author__ = "Adam Karl"
"""Find the sum of all numbers below N which divide the sum of the factorial of their digits"""
#https://projecteuler.net/problem=34
digitFactorials = []
def sumCuriousNumbersUnderN(n):
"""Return a sum of all numbers that evenly divide the sum of the factorial of their dig... | __author__ = 'Adam Karl'
'Find the sum of all numbers below N which divide the sum of the factorial of their digits'
digit_factorials = []
def sum_curious_numbers_under_n(n):
"""Return a sum of all numbers that evenly divide the sum of the factorial of their digits"""
sum_curious = 0
for i in range(10, n):... |
array = [1,2,3,4]
result = [24,12,8,6]
def product_except_itself_2(nums):
output = []
L = []
R = []
temp = 1
for x in nums:
L.append(temp)
temp = temp * x
temp = 1
for y in nums[::-1]:
R.append(temp)
temp = temp * y
for i in range(len(R)):
ou... | array = [1, 2, 3, 4]
result = [24, 12, 8, 6]
def product_except_itself_2(nums):
output = []
l = []
r = []
temp = 1
for x in nums:
L.append(temp)
temp = temp * x
temp = 1
for y in nums[::-1]:
R.append(temp)
temp = temp * y
for i in range(len(R)):
o... |
# UUU F CUU L AUU I GUU V
# UUC F CUC L AUC I GUC V
# UUA L CUA L AUA I GUA V
# UUG L CUG L AUG M GUG V
# UCU S CCU P ACU T GCU A
# UCC S CCC P ACC T GCC A
# UCA S CCA P ACA T GCA A
# UCG S CCG P ACG T ... | lookup = {'UUU': 'F', 'CUU': 'L', 'AUU': 'I', 'GUU': 'V', 'UUC': 'F', 'CUC': 'L', 'AUC': 'I', 'GUC': 'V', 'UUA': 'L', 'CUA': 'L', 'AUA': 'I', 'GUA': 'V', 'UUG': 'L', 'CUG': 'L', 'AUG': 'M', 'GUG': 'V', 'UCU': 'S', 'CCU': 'P', 'ACU': 'T', 'GCU': 'A', 'UCC': 'S', 'CCC': 'P', 'ACC': 'T', 'GCC': 'A', 'UCA': 'S', 'CCA': 'P'... |
DB_PATH = 'assets/survey_data.db'
REVIEWS_PATH = 'static/files/reviews.csv'
QUESTIONS_PATH = 'static/files/questions.csv'
USER_TABLE = 'users'
STMT_USER_TABLE = f'''CREATE TABLE IF NOT EXISTS {USER_TABLE}
(netid int PRIMARY KEY, age int, internet_use int)'''
REVIEWS_TABLE = 'reviews'
STMT_REVIEWS_TA... | db_path = 'assets/survey_data.db'
reviews_path = 'static/files/reviews.csv'
questions_path = 'static/files/questions.csv'
user_table = 'users'
stmt_user_table = f'CREATE TABLE IF NOT EXISTS {USER_TABLE}\n (netid int PRIMARY KEY, age int, internet_use int)'
reviews_table = 'reviews'
stmt_reviews_table = f... |
# 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 isBalanced(self, root: TreeNode) -> bool:
if self.height(root) is None:
return False... | class Solution:
def is_balanced(self, root: TreeNode) -> bool:
if self.height(root) is None:
return False
else:
return True
def height(self, node):
if node is None:
return 0
left = self.height(node.left)
right = self.height(node.right... |
# Do not edit this file directly.
# It was auto-generated by: code/programs/reflexivity/reflexive_refresh
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def cloc():
http_archive(
name="cloc" ,
build_file="//bazel/deps/cloc:build.BUILD" ,
sha256="da1a0de6d8ce2f4e80fa7... | load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
def cloc():
http_archive(name='cloc', build_file='//bazel/deps/cloc:build.BUILD', sha256='da1a0de6d8ce2f4e80fa7554cf605f86d97d761b4ffd647df9b01c4658107dba', strip_prefix='cloc-90070481081b6decd9446d57a35176da3a6d8fbc', urls=['https://github.com/U... |
valid_names = ["Danilo", "Daniel", "Dani"]
class NameError(Exception): pass
def handler(event, context):
name = event.get("name",None)
if name:
if name in valid_names:
return event
else:
raise NameError("WrongName")
else:
raise NameError("NoName")
| valid_names = ['Danilo', 'Daniel', 'Dani']
class Nameerror(Exception):
pass
def handler(event, context):
name = event.get('name', None)
if name:
if name in valid_names:
return event
else:
raise name_error('WrongName')
else:
raise name_error('NoName') |
class SparseTable:
def __init__(self,array,func):
self.array = array
self.func = func
self._log = self._logPreprocess()
self.sparseTable = self._preprocess()
def _logPreprocess(self):
n = len(self.array);
_log = [0] * (n+1)
for i in range(2,n+1):
_log[i] = _log[n//2] + 1
return _log
def _pre... | class Sparsetable:
def __init__(self, array, func):
self.array = array
self.func = func
self._log = self._logPreprocess()
self.sparseTable = self._preprocess()
def _log_preprocess(self):
n = len(self.array)
_log = [0] * (n + 1)
for i in range(2, n + 1):
... |
class SampleNotMatchedError(Exception):
pass
class InvalidRangeError(Exception):
pass
| class Samplenotmatchederror(Exception):
pass
class Invalidrangeerror(Exception):
pass |
cat=int(input("Ingrese la categoria del trbajdor: "))
suel=int(input("Ingrese el sueldo bruto del trabajador: "))
if(cat==1):
suelt1=suel* 0.10
suelt= suelt1+suel
print("Categoria: " +str(cat))
print("Susueldo bruto con aumento es de: ""{:.0f}".format(suelt)," COP")
elif(cat==2):
suelt1=suel* 0.15
... | cat = int(input('Ingrese la categoria del trbajdor: '))
suel = int(input('Ingrese el sueldo bruto del trabajador: '))
if cat == 1:
suelt1 = suel * 0.1
suelt = suelt1 + suel
print('Categoria: ' + str(cat))
print('Susueldo bruto con aumento es de: {:.0f}'.format(suelt), ' COP')
elif cat == 2:
suelt1 =... |
Train_0 = ['P26', 'P183', 'P89', 'P123', 'P61', 'P112', 'P63', 'P184', 'P100', 'P11', 'P111', 'P28', 'P192', 'P35',
'P27', 'P113', 'P33', 'P17', 'P126', 'P176', 'P46', 'P44', 'P137', 'P13', 'P74', 'P134', 'P128', 'P0',
'P157', 'P161', 'P163', 'P38', 'P190', 'P12', 'P115', 'P122', 'P144', 'P15', 'P... | train_0 = ['P26', 'P183', 'P89', 'P123', 'P61', 'P112', 'P63', 'P184', 'P100', 'P11', 'P111', 'P28', 'P192', 'P35', 'P27', 'P113', 'P33', 'P17', 'P126', 'P176', 'P46', 'P44', 'P137', 'P13', 'P74', 'P134', 'P128', 'P0', 'P157', 'P161', 'P163', 'P38', 'P190', 'P12', 'P115', 'P122', 'P144', 'P15', 'P154', 'P48', 'P187', '... |
def registry_metaclass(storage):
class RegistryMeta(type):
def __init__(cls, name, bases, attrs):
super(RegistryMeta, cls).__init__(name, bases, attrs)
id = getattr(cls, 'id', None)
if not id:
return
if id in storage:
raise Ke... | def registry_metaclass(storage):
class Registrymeta(type):
def __init__(cls, name, bases, attrs):
super(RegistryMeta, cls).__init__(name, bases, attrs)
id = getattr(cls, 'id', None)
if not id:
return
if id in storage:
raise ke... |
class Solution:
def findSubstringInWraproundString(self, p):
res, l = {i: 1 for i in p}, 1
for i, j in zip(p, p[1:]):
l = l + 1 if (ord(j) - ord(i)) % 26 == 1 else 1
res[j] = max(res[j], l)
return sum(res.values()) | class Solution:
def find_substring_in_wrapround_string(self, p):
(res, l) = ({i: 1 for i in p}, 1)
for (i, j) in zip(p, p[1:]):
l = l + 1 if (ord(j) - ord(i)) % 26 == 1 else 1
res[j] = max(res[j], l)
return sum(res.values()) |
# TODO: Turn this into a generator?
def get_tiles(image, tile_size):
"""Splits an image into multiple tiles of a certain size"""
tile_images = []
x = 0
y = 0
while y < image.height:
im_tile = image.crop((x, y, x+tile_size, y+tile_size))
tile_images.append(im_tile)
if x < i... | def get_tiles(image, tile_size):
"""Splits an image into multiple tiles of a certain size"""
tile_images = []
x = 0
y = 0
while y < image.height:
im_tile = image.crop((x, y, x + tile_size, y + tile_size))
tile_images.append(im_tile)
if x < image.width - tile_size:
... |
# day_1/vars.py
# <-- This symbol makes a line a comment
""" <-- These make a multi line comment. Both typs of comments are ignored by
python. But you need to close multiline comments --> """
"""
The first thing we should talk about is how to get output out of your program.
In python we use the print function. Yo... | """ <-- These make a multi line comment. Both typs of comments are ignored by
python. But you need to close multiline comments --> """
'\nThe first thing we should talk about is how to get output out of your program.\nIn python we use the print function. You do this by typing:\n\nprint(10) # This will print 10 to the t... |
def return_decoded_value(value):
if type(value) is bytes:
value = value.decode('utf-8')
elif type(value) is not str:
value = value.decode("ascii", "ignore")
else:
value = value
return value.strip('\r\n')
| def return_decoded_value(value):
if type(value) is bytes:
value = value.decode('utf-8')
elif type(value) is not str:
value = value.decode('ascii', 'ignore')
else:
value = value
return value.strip('\r\n') |
f=open("input.txt")
Input = f.read().split("\n")
f.close()
x=0
y=0
count=0
while(y < len(Input)):
count += Input[y][x%len(Input[0])] == "#"
x += 3
y += 1
print(count)
| f = open('input.txt')
input = f.read().split('\n')
f.close()
x = 0
y = 0
count = 0
while y < len(Input):
count += Input[y][x % len(Input[0])] == '#'
x += 3
y += 1
print(count) |
# https://www.codewars.com/kata/52fba66badcd10859f00097e
def disemvowel(str):
return "".join(filter(lambda c: c not in "aeiouAEIOU", str))
print(disemvowel("This website is for losers LOL!"))
| def disemvowel(str):
return ''.join(filter(lambda c: c not in 'aeiouAEIOU', str))
print(disemvowel('This website is for losers LOL!')) |
def doSomethingWithString(str):
print(" Input is "+str, end = '\n')
split = str.split(" ")
print(split)
split.pop(2)
print(split)
def secondFun():
s = [10,20]
x = [20,30]
return s, x
x = 10
y = 11.2
dict = {1:'Alfa', 2:'Beta'}
k = "A sample approach"
doSomethingWithString(k)
x, y = s... | def do_something_with_string(str):
print(' Input is ' + str, end='\n')
split = str.split(' ')
print(split)
split.pop(2)
print(split)
def second_fun():
s = [10, 20]
x = [20, 30]
return (s, x)
x = 10
y = 11.2
dict = {1: 'Alfa', 2: 'Beta'}
k = 'A sample approach'
do_something_with_string(k... |
# If you want to print something customized in your terminal
# Use my custom color and fonts styles in order to print wyw
# Refer to it with this kind of formation and formulation:
# Example:
# customization.color.BOLD + "String" + customization.color.END
class Colors:
# String to purple color
PURPLE = '\033[9... | class Colors:
purple = '\x1b[95m'
cyan = '\x1b[96m'
darkcyan = '\x1b[36m'
blue = '\x1b[94m'
green = '\x1b[92m'
yellow = '\x1b[93m'
red = '\x1b[91m'
bold = '\x1b[1m'
underline = '\x1b[4m'
end = '\x1b[0m' |
with open('DOCKER_VERSION') as f:
version = f.read()
with open('DOCKER_VERSION', 'w') as f:
major, minor, patch = version.split('.')
patch = int(patch) + 1
f.write('{}.{}.{}\n'.format(major, minor, patch))
| with open('DOCKER_VERSION') as f:
version = f.read()
with open('DOCKER_VERSION', 'w') as f:
(major, minor, patch) = version.split('.')
patch = int(patch) + 1
f.write('{}.{}.{}\n'.format(major, minor, patch)) |
'''
Created on Feb 8, 2017
@author: PJ
'''
class TempRetrofillSrFromOfficialResults:
def populate_sr(self, **kargs):
return kargs
def save_sr(self, score_result_type, match, team, **kargs):
sr_search = score_result_type.objects.filter(match=match, team=team)
if len(sr_search) == 0... | """
Created on Feb 8, 2017
@author: PJ
"""
class Tempretrofillsrfromofficialresults:
def populate_sr(self, **kargs):
return kargs
def save_sr(self, score_result_type, match, team, **kargs):
sr_search = score_result_type.objects.filter(match=match, team=team)
if len(sr_search) == 0:
... |
lista = []
pares = []
impar = []
for i in range(20):
lista.append(int(input("Digite um numero: ")))
for i in lista:
if i % 2 == 0:
pares.append(i)
else:
impar.append(i)
print(f"Lista = {lista}")
print(f"Pares = {pares}")
print(f"impar = {impar}") | lista = []
pares = []
impar = []
for i in range(20):
lista.append(int(input('Digite um numero: ')))
for i in lista:
if i % 2 == 0:
pares.append(i)
else:
impar.append(i)
print(f'Lista = {lista}')
print(f'Pares = {pares}')
print(f'impar = {impar}') |
class HxCType(object):
"""
Enum and static methods for manipulating the C type defined by
HexRays. This is a wrapper on top of the ``ctype_t`` enum: ``cot_*``
are for the expresion (``cexpr_t`` in ida, :class:`HxCExpr` in bip )
and ``cit_*`` are for the statement (``cinsn_t`` in ida... | class Hxctype(object):
"""
Enum and static methods for manipulating the C type defined by
HexRays. This is a wrapper on top of the ``ctype_t`` enum: ``cot_*``
are for the expresion (``cexpr_t`` in ida, :class:`HxCExpr` in bip )
and ``cit_*`` are for the statement (``cinsn_t`` in ida,... |
#list of group members
#MATSIKO BRUNO 2020/BSE/165/PS
#DAVID NYAMUTALE 2020/BSE/057/PS
#MAWANDA DENNIS 2020/BSE/155/PS
#AKANDWANAHO NICKSON 2020/BSE/006/PS
# strt with an empty list
list_of_items_to_capture = []
#create a loop for capturing values
random_number = 1
while random_number == 1:
inputedV... | list_of_items_to_capture = []
random_number = 1
while random_number == 1:
inputed_value = input('enter values, else enter done\n')
if len(inputedValue) == 0:
print('bad data')
elif inputedValue.lower() == 'done':
random_number = 2
else:
try:
inputed_value = float(inp... |
class TrieNode:
def __init__(self):
self.val = None
self.children = [None] * 26
class MapSum:
def __init__(self):
self.root = TrieNode()
def insert(self, key: str, val: int) -> None:
p = self.root
for c in key:
offset_c = ord(c) - 97
... | class Trienode:
def __init__(self):
self.val = None
self.children = [None] * 26
class Mapsum:
def __init__(self):
self.root = trie_node()
def insert(self, key: str, val: int) -> None:
p = self.root
for c in key:
offset_c = ord(c) - 97
if no... |
# -*- python -*-
"""@file
@brief crc8 calculator for Pato packets
Copyright (c) 2014-2015 Dimitry Kloper <kloper@users.sf.net>.
All rights reserved.
@page License
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redist... | """@file
@brief crc8 calculator for Pato packets
Copyright (c) 2014-2015 Dimitry Kloper <kloper@users.sf.net>.
All rights reserved.
@page License
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of sour... |
__all__ = ('InvalidOption')
class InvalidOption(Exception):
"""
Raises when user call methods
with incorrect arguments.
"""
| __all__ = 'InvalidOption'
class Invalidoption(Exception):
"""
Raises when user call methods
with incorrect arguments.
""" |
class PolydatumException(Exception):
pass
class ServiceError(PolydatumException):
code = 500
class NotFound(ServiceError):
code = 404
class ErrorsOnClose(PolydatumException):
"""
Deprecated 0.8.4 as Resources errors on exit
are suppressed
"""
def __init__(self, message, exceptions)... | class Polydatumexception(Exception):
pass
class Serviceerror(PolydatumException):
code = 500
class Notfound(ServiceError):
code = 404
class Errorsonclose(PolydatumException):
"""
Deprecated 0.8.4 as Resources errors on exit
are suppressed
"""
def __init__(self, message, exceptions):
... |
# Created from ttf-fonts/Entypo.otf with freetype-generator.
# freetype-generator created by Meurisse D ( MCHobby.be ).
Entypo_23 = {
'width' : 0x16,
'height' : 0x17,
33:( 0x800000, 0x980000, 0xbc0000, 0xbe0000, 0xbe0000, 0xbc0000, 0xbc0000, 0x9c0000, 0x9e0000, 0x8f0000, 0x8f8000, 0x87c600, 0x83ef00, 0x81ff80, 0x807f8... | entypo_23 = {'width': 22, 'height': 23, 33: (8388608, 9961472, 12320768, 12451840, 12451840, 12320768, 12320768, 10223616, 10354688, 9371648, 9404416, 8898048, 8646400, 8519552, 8421248, 8404864, 8392448, 8388608), 34: (12582904, 16777212, 16252956, 16252956, 16252956, 13107228, 13107228, 16252956, 16252956, 16252956, ... |
class AndroidKey:
# Key code constant: Unknown key code.
UNKNOWN = 0
# Key code constant: Soft Left key.
# Usually situated below the display on phones and used as a multi-function
# feature key for selecting a software defined function shown on the bottom left
# of the display.
SOFT_LEFT =... | class Androidkey:
unknown = 0
soft_left = 1
soft_right = 2
home = 3
back = 4
call = 5
endcall = 6
digit_0 = 7
digit_1 = 8
digit_2 = 9
digit_3 = 10
digit_4 = 11
digit_5 = 12
digit_6 = 13
digit_7 = 14
digit_8 = 15
digit_9 = 16
star = 17
pound = 1... |
def value_matcher(value):
if value.type.tag == "rat64": return Rat64Printer(value)
return None
class Rat64Printer(object):
def __init__(self, value):
self.value = value
def to_string(self):
numerator = self.value["numerator"]
denominator = self.value["denominator"]
return str(numerator) + "/" +... | def value_matcher(value):
if value.type.tag == 'rat64':
return rat64_printer(value)
return None
class Rat64Printer(object):
def __init__(self, value):
self.value = value
def to_string(self):
numerator = self.value['numerator']
denominator = self.value['denominator']
... |
def fn():
print('Generate cache')
cache = {}
def get_from_cache(key):
res = cache.get(key)
if res:
print('From cache')
return res
else:
print('Calculate and save')
res = 'value ' + str(key)
cache[key] = res
return get_fr... | def fn():
print('Generate cache')
cache = {}
def get_from_cache(key):
res = cache.get(key)
if res:
print('From cache')
return res
else:
print('Calculate and save')
res = 'value ' + str(key)
cache[key] = res
return get_f... |
def __get_ints(line: str) -> list[int]:
strings = line.strip().split(' ')
return list(map(lambda x: int(x), strings))
def read_case_from_file(file_path: str) -> tuple[list[int], list[int]]:
with open(file_path, 'r') as file:
lines = file.readlines()
assert len(lines) == 4
ranks = ... | def __get_ints(line: str) -> list[int]:
strings = line.strip().split(' ')
return list(map(lambda x: int(x), strings))
def read_case_from_file(file_path: str) -> tuple[list[int], list[int]]:
with open(file_path, 'r') as file:
lines = file.readlines()
assert len(lines) == 4
ranks = __... |
#
# PySNMP MIB module CMM4-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CMM4-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:09:18 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:1... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, value_size_constraint, constraints_union, constraints_intersection) ... |
class SampleSheetError(Exception):
"""An exception raised when errors are encountered with a sample sheet.
Examples include when a sample sheet can't be parsed because it's garbled, or
if IRIDA rejects the creation of a run because fields are missing or invalid
from the sample sheet.
"""
def __... | class Samplesheeterror(Exception):
"""An exception raised when errors are encountered with a sample sheet.
Examples include when a sample sheet can't be parsed because it's garbled, or
if IRIDA rejects the creation of a run because fields are missing or invalid
from the sample sheet.
"""
def _... |
# Copyright (C) 2020 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""File's labels and properties."""
class TransformationCSVFields(object):
"""To transformation fields of CSV files."""
# pylint: disable=too-few-public-methods
REVISION_DATE = "Revision Date"
| """File's labels and properties."""
class Transformationcsvfields(object):
"""To transformation fields of CSV files."""
revision_date = 'Revision Date' |
class Container:
"""A container that holds objects.
This is an abstract class. Only child classes should be instantiated.
"""
def add(self, item):
"""Add <item> to this Container.
@type self: Container
@type item: Object
@rtype: None
"""
raise NotImple... | class Container:
"""A container that holds objects.
This is an abstract class. Only child classes should be instantiated.
"""
def add(self, item):
"""Add <item> to this Container.
@type self: Container
@type item: Object
@rtype: None
"""
raise not_impl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.