content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
npratio = 4
MAX_SENTENCE = 30
MAX_ALL = 50
MAX_SENT_LENGTH=30
MAX_SENTS=50 | npratio = 4
max_sentence = 30
max_all = 50
max_sent_length = 30
max_sents = 50 |
"""
Module: 'upip_utarfile' on esp32 1.13.0-103
"""
# MCU: (sysname='esp32', nodename='esp32', release='1.13.0', version='v1.13-103-gb137d064e on 2020-10-09', machine='ESP32 module (spiram) with ESP32')
# Stubber: 1.3.4
DIRTYPE = 'dir'
class FileSection:
''
def read():
pass
def readinto():
... | """
Module: 'upip_utarfile' on esp32 1.13.0-103
"""
dirtype = 'dir'
class Filesection:
""""""
def read():
pass
def readinto():
pass
def skip():
pass
regtype = 'file'
tar_header = None
class Tarfile:
""""""
def extractfile():
pass
def next():
pas... |
class Solution:
"""
@param scores: two dimensional array
@param K: a integer
@return: return a integer
"""
def FindTheRank(self, scores, K):
# write your code here
tuple_scores = []
for idx, score in enumerate(scores):
tuple_scores.append([score, idx])
... | class Solution:
"""
@param scores: two dimensional array
@param K: a integer
@return: return a integer
"""
def find_the_rank(self, scores, K):
tuple_scores = []
for (idx, score) in enumerate(scores):
tuple_scores.append([score, idx])
sorted_scores = sorted(tu... |
# -*- coding: utf-8 -*-
"""
Common use sicd_elements methods.
"""
def _get_center_frequency(RadarCollection, ImageFormation):
"""
Helper method.
Parameters
----------
RadarCollection : sarpy.io.complex.sicd_elements.RadarCollection.RadarCollectionType
ImageFormation : sarpy.io.complex.sicd_el... | """
Common use sicd_elements methods.
"""
def _get_center_frequency(RadarCollection, ImageFormation):
"""
Helper method.
Parameters
----------
RadarCollection : sarpy.io.complex.sicd_elements.RadarCollection.RadarCollectionType
ImageFormation : sarpy.io.complex.sicd_elements.ImageFormation.Ima... |
# Solution to day 1 of AOC 2015, Not Quite Lisp.
# https://adventofcode.com/2015/day/1
f = open('input.txt')
whole_text = f.read()
f.close()
floor = 0
steps = 0
basement_found = False
for each_char in whole_text:
if not basement_found:
steps += 1
if each_char == '(':
floor += 1
elif each... | f = open('input.txt')
whole_text = f.read()
f.close()
floor = 0
steps = 0
basement_found = False
for each_char in whole_text:
if not basement_found:
steps += 1
if each_char == '(':
floor += 1
elif each_char == ')':
floor -= 1
if floor == -1:
basement_found = True
print('P... |
# coding=utf-8
# Author: Jianghan LI
# Question: 056.Merge_Intervals
# Date: 2017-04-04 10:43 - 10:51
# Complexity: O(NLogN)
# Definition for an interval.
# class Interval(object):
# def __init__(self, s=0, e=0):
# self.start = s
# self.end = e
class Solution(object):
def merge(self, interva... | class Solution(object):
def merge(self, intervals):
"""
:type intervals: List[Interval]
:rtype: List[Interval]
"""
res = []
for i in sorted(intervals, key=lambda i: i.start):
if len(res) == 0 or res[-1].end < i.start:
res.append(i)
... |
String1="Hello World!"
String2="AbCD123!"
"""
This shows the method startswith() and endswith() working.
"""
print(String1.endswith('World!'))
print(String1.startswith('Hell'))
print(String2.endswith('12'))
print(String2.endswith('3'))
print(String1.startswith('Hello '))
print(String2.startswith('A'))
print(Strin... | string1 = 'Hello World!'
string2 = 'AbCD123!'
'\nThis shows the method startswith() and endswith() working.\n'
print(String1.endswith('World!'))
print(String1.startswith('Hell'))
print(String2.endswith('12'))
print(String2.endswith('3'))
print(String1.startswith('Hello '))
print(String2.startswith('A'))
print(String1.e... |
ask = "time is time versus time"
count = 0
for t in ask:
if t == "t":
count += 1
print(count)
number = list(range(5, 20, 2))
print(number) | ask = 'time is time versus time'
count = 0
for t in ask:
if t == 't':
count += 1
print(count)
number = list(range(5, 20, 2))
print(number) |
class CSVEmployeeRepository:
def __init__(self, csv_intepreter):
self._anagraphic = csv_intepreter.employees()
def birthdayFor(self, month, day):
return self._anagraphic.bornOn(Birthday(month, day))
class Anagraphic:
def __init__(self, employees):
self._employees = employees
... | class Csvemployeerepository:
def __init__(self, csv_intepreter):
self._anagraphic = csv_intepreter.employees()
def birthday_for(self, month, day):
return self._anagraphic.bornOn(birthday(month, day))
class Anagraphic:
def __init__(self, employees):
self._employees = employees
... |
PACKAGE_NAME = 'cdeid'
SPACY_PRETRAINED_MODEL_LG = 'en_core_web_lg'
# SPACY_PRETRAINED_MODEL_SM = 'en_core_web_sm'
PROGRESS_STATUS = {
1: 'prepare data sets',
2: 'train spacy on balanced sets',
3: 'train stanza on balanced sets',
4: 'train flair on balanced sets',
5: 'train spacy on imbalanced sets'... | package_name = 'cdeid'
spacy_pretrained_model_lg = 'en_core_web_lg'
progress_status = {1: 'prepare data sets', 2: 'train spacy on balanced sets', 3: 'train stanza on balanced sets', 4: 'train flair on balanced sets', 5: 'train spacy on imbalanced sets', 6: 'train stanza on imbalanced sets', 7: 'train flair on imbalance... |
def handle(event, context):
file = open("dynamicdns/scripts/dynamic-dns-client", "r")
content = file.read()
file.close()
headers = {
"Content-Type": "text/plain"
}
body = content
response = {
"statusCode": 200,
"headers": headers,
"body": body
}
re... | def handle(event, context):
file = open('dynamicdns/scripts/dynamic-dns-client', 'r')
content = file.read()
file.close()
headers = {'Content-Type': 'text/plain'}
body = content
response = {'statusCode': 200, 'headers': headers, 'body': body}
return response |
# Time: O(n)
# Space: O(h)
# Given a binary tree, you need to compute the length of the diameter of the tree.
# The diameter of a binary tree is the length of the longest path between
# any two nodes in a tree. This path may or may not pass through the root.
#
# Example:
# Given a binary tree
# 1
# ... | class Treenode(object):
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution(object):
def diameter_of_binary_tree(self, root):
"""
:type root: TreeNode
:rtype: int
"""
def dfs(root)... |
class Bird():
def __init__(self) :
self.wings = True
self.fur = True
self.fly = True
def isFly(self) :
return self.fly
Parrot = Bird()
if Parrot.isFly() == "fly" :
print("Parrot must be can fly")
else :
print("Why Parrot can't fly ?")
###### Inheritance #####
cla... | class Bird:
def __init__(self):
self.wings = True
self.fur = True
self.fly = True
def is_fly(self):
return self.fly
parrot = bird()
if Parrot.isFly() == 'fly':
print('Parrot must be can fly')
else:
print("Why Parrot can't fly ?")
class Penguin(Bird):
def __init__(... |
class MapMatcher:
def __init__(self, rn, routing_weight='length'):
self.rn = rn
self.routing_weight = routing_weight
def match(self, traj):
pass
def match_to_path(self, traj):
pass
| class Mapmatcher:
def __init__(self, rn, routing_weight='length'):
self.rn = rn
self.routing_weight = routing_weight
def match(self, traj):
pass
def match_to_path(self, traj):
pass |
#-*- coding: utf-8 -*-
# ------ wuage.com testing team ---------
# __author__ : weijx.cpp@gmail.com
def split(word):
return [char for char in word]
def test_crypt2():
letter :str = u"a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z"
let = letter.split("," ,maxsplit=26)
# let = ["X", "Y"]
# print... | def split(word):
return [char for char in word]
def test_crypt2():
letter: str = u'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z'
let = letter.split(',', maxsplit=26)
cypterdata: str = 'yriry gjb cnffjbeq ebggra'
cypterwords = cypterdata.split(' ')
for i in range(1, 26):
print('++... |
def minion_game(string):
# your code goes here
#string = string.lower()
vowel = ['A','E','I','O','U']
kev = 0
stu = 0
n = len(string)
x = n
for i in range(n) :
if string[i] in vowel :
kev += x
else :
stu += x
x -= 1
if kev > stu ... | def minion_game(string):
vowel = ['A', 'E', 'I', 'O', 'U']
kev = 0
stu = 0
n = len(string)
x = n
for i in range(n):
if string[i] in vowel:
kev += x
else:
stu += x
x -= 1
if kev > stu:
print('Kevin', str(kev))
elif kev < stu:
... |
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incor... | def maintenance_public_configuration_list(client):
return client.list()
def maintenance_public_configuration_show(client, resource_name):
return client.get(resource_name=resource_name)
def maintenance_applyupdate_list(client):
return client.list()
def maintenance_applyupdate_show(client, resource_group_n... |
def day5(fileName, part):
niceCount = 0
with open(fileName) as infile:
for line in infile:
vowels = sum(line.count(vowel) for vowel in "aeiou")
if vowels < 3:
continue
foundDouble = any(line[i] == line[i+1] for i in range(len(line) - 1))
if not foundDouble:
continue
foundBadString = any(badSt... | def day5(fileName, part):
nice_count = 0
with open(fileName) as infile:
for line in infile:
vowels = sum((line.count(vowel) for vowel in 'aeiou'))
if vowels < 3:
continue
found_double = any((line[i] == line[i + 1] for i in range(len(line) - 1)))
... |
class Solution:
def subsets(self, nums: List[int]) -> List[List[int]]:
nums.sort()
res = []
self.bt(nums, 0, [], res)
return res
def bt(self, nums, idx, tempList, res):
res.append(tempList)
for i in range(idx, len(nums)):
self.bt(nums, i+1, tempList+[n... | class Solution:
def subsets(self, nums: List[int]) -> List[List[int]]:
nums.sort()
res = []
self.bt(nums, 0, [], res)
return res
def bt(self, nums, idx, tempList, res):
res.append(tempList)
for i in range(idx, len(nums)):
self.bt(nums, i + 1, tempLis... |
''' Exception module '''
class CallGitServerException(Exception):
''' Base Exception for filtering Call Git Server Exceptions '''
STATUS_CODE = 127
class DuplicateRemote(CallGitServerException):
''' Exception throwed when there arent any match with the username '''
STATUS_CODE = 128
def __init_... | """ Exception module """
class Callgitserverexception(Exception):
""" Base Exception for filtering Call Git Server Exceptions """
status_code = 127
class Duplicateremote(CallGitServerException):
""" Exception throwed when there arent any match with the username """
status_code = 128
def __init__(... |
def test(tested_mod, Assert):
test_cases = [
# (expected, input)
([4], [4]),
([9,6], [6,9]),
([4,3,2,1], [4,3,2,1]),
([4,3,2,1], [1,2,3,4]),
([9,5,2,1], [1,5,2,9])
]
return Assert.all(tested_mod.sortierte_zettel, test_cases)
| def test(tested_mod, Assert):
test_cases = [([4], [4]), ([9, 6], [6, 9]), ([4, 3, 2, 1], [4, 3, 2, 1]), ([4, 3, 2, 1], [1, 2, 3, 4]), ([9, 5, 2, 1], [1, 5, 2, 9])]
return Assert.all(tested_mod.sortierte_zettel, test_cases) |
P, Q = map(float, input().split())
p, q = P / 100, Q / 100
a = p * q
b = (1 - p) * (1 - q)
print(a / (a + b) * 100)
| (p, q) = map(float, input().split())
(p, q) = (P / 100, Q / 100)
a = p * q
b = (1 - p) * (1 - q)
print(a / (a + b) * 100) |
# https://leetcode.com/problems/merge-sorted-array/
class Solution:
# Input:
# [1, 2, 2, 3, 5, 6], m = 3
# [2, 5, 6], n = 3
# [2, 0]
# [1]
# [1, 2, 0]
# [4]
def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None:
"""
Do not return anyt... | class Solution:
def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None:
"""
Do not return anything, modify nums1 in-place instead.
"""
if not nums1 or not nums2:
return
while n > 0 and m > 0:
if nums1[m - 1] <= nums2[n - 1]:
... |
##Patterns: E0116
while True:
try:
pass
finally:
##Err: E0116
continue
while True:
try:
pass
finally:
break
while True:
try:
pass
except Exception:
pass
else:
continue
| while True:
try:
pass
finally:
continue
while True:
try:
pass
finally:
break
while True:
try:
pass
except Exception:
pass
else:
continue |
class ESError(Exception):
pass
class ESRegistryError(ESError):
pass
| class Eserror(Exception):
pass
class Esregistryerror(ESError):
pass |
def mobilenet_conv_block(x, kernel_size, output_channels):
"""
Depthwise Conv -> Batch Norm -> ReLU -> Pointwise Conv -> Batch Norm -> ReLU
"""
# assumes BHWC format
input_channel_dim = x.get_shape().as_list()[-1]
W = tf.Variable(tf.truncated_normal((kernel_size, kernel_size, input_channe... | def mobilenet_conv_block(x, kernel_size, output_channels):
"""
Depthwise Conv -> Batch Norm -> ReLU -> Pointwise Conv -> Batch Norm -> ReLU
"""
input_channel_dim = x.get_shape().as_list()[-1]
w = tf.Variable(tf.truncated_normal((kernel_size, kernel_size, input_channel_dim, 1)))
x = tf.nn.depthwi... |
class Solution:
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
maxprofit = 0
if (len(prices) == 0):
return 0
left = 0
right = left + 1
while (right < len(prices)):
... | class Solution:
def max_profit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
maxprofit = 0
if len(prices) == 0:
return 0
left = 0
right = left + 1
while right < len(prices):
diff = prices[right] - prices[le... |
movies = ['The Matrix', 'Fast & Furious',
'Frozen',
'The life of Pi']
for movie in movies: print(movie)
print('We\'re done here!')
| movies = ['The Matrix', 'Fast & Furious', 'Frozen', 'The life of Pi']
for movie in movies:
print(movie)
print("We're done here!") |
# this code is not correct
class Node:
def __init__(self, data, next=None):
self.data=data
self.next = next
def printList(head):
print(head.data)
if head.next == None:
return
return printList(head.next)
def reverseList(head):
if head.next == None:
return head
ne... | class Node:
def __init__(self, data, next=None):
self.data = data
self.next = next
def print_list(head):
print(head.data)
if head.next == None:
return
return print_list(head.next)
def reverse_list(head):
if head.next == None:
return head
nextnext = head.next.ne... |
def rule(event):
return event.get("action") == "Blocked"
def title(event):
return "Access denied to domain " + event.get("domain", "<UNKNOWN_DOMAIN>")
| def rule(event):
return event.get('action') == 'Blocked'
def title(event):
return 'Access denied to domain ' + event.get('domain', '<UNKNOWN_DOMAIN>') |
def static_vars(**kwargs):
"""
Decorates a function with the given attributes
Parameters
----------
**kwargs
a list of attributes and their initial value
"""
def decorate(func):
for k in kwargs:
setattr(func, k, kwargs[k])
return func
return decorate... | def static_vars(**kwargs):
"""
Decorates a function with the given attributes
Parameters
----------
**kwargs
a list of attributes and their initial value
"""
def decorate(func):
for k in kwargs:
setattr(func, k, kwargs[k])
return func
return decorate |
# Config for OpenMX_viewer
# For Gui
fontFamilies=["Segoe UI", "Yu Gothic UI"]
# font sizes are in unit of pixel
fontSize_normal=16
fontSize_large=24
ContentsMargins=[5,5,5,5]
tickLength=-30
sigma_max=5
Eh=27.2114 # (eV)
# Pen for vLine and hLine
pen1=(0, 255, 0)
pen2=(255, 0, 0)
pen3=(255, 255, 0)
gridAlpha=50 # ... | font_families = ['Segoe UI', 'Yu Gothic UI']
font_size_normal = 16
font_size_large = 24
contents_margins = [5, 5, 5, 5]
tick_length = -30
sigma_max = 5
eh = 27.2114
pen1 = (0, 255, 0)
pen2 = (255, 0, 0)
pen3 = (255, 255, 0)
grid_alpha = 50
plot3_d_min_width = 400
plot3_d_min_height = 400 |
# Also used on the Yamaha Reface CS?
def compute_checksum(data):
"""Compute checksum from a list of byte values.
This is appended to the data of the sysex message.
"""
return (128 - (sum(data) & 0x7F)) & 0x7F
| def compute_checksum(data):
"""Compute checksum from a list of byte values.
This is appended to the data of the sysex message.
"""
return 128 - (sum(data) & 127) & 127 |
#!/usr/bin/python3
"""
Module Docstring
"""
__author__ = "Dinesh Tumu"
__version__ = "0.1.0"
__license__ = "MIT"
# imports
# init variables
def main():
""" Main entry point of the app """
# Open a file for writing and create it if it doesn't exist
f = open("textfile.txt","w+")
# Open the file ... | """
Module Docstring
"""
__author__ = 'Dinesh Tumu'
__version__ = '0.1.0'
__license__ = 'MIT'
def main():
""" Main entry point of the app """
f = open('textfile.txt', 'w+')
for i in range(10):
f.write('This is line %d\r\n' % (i + 1))
f.close()
f = open('textfile.txt', 'r')
if f.mode == ... |
destinations = input()
while True:
input_command = input()
if input_command == "Travel":
break
arg = input_command.split(":")
command = arg[0]
if command == "Add Stop":
index = int(arg[1])
string = arg[2]
if 0 <= index < len(destinations):
destination... | destinations = input()
while True:
input_command = input()
if input_command == 'Travel':
break
arg = input_command.split(':')
command = arg[0]
if command == 'Add Stop':
index = int(arg[1])
string = arg[2]
if 0 <= index < len(destinations):
destinations = d... |
def html_tag():
# write body of decorator
pass
@html_tag('p')
def foobar():
return 'foobar'
if __name__ == "__main__":
assert foobar() == '<p>foobar</p>'
| def html_tag():
pass
@html_tag('p')
def foobar():
return 'foobar'
if __name__ == '__main__':
assert foobar() == '<p>foobar</p>' |
def max_power(s: str) -> int:
max_ = 1
curr = 1
for i in range(1, len(s)):
if s[i] == s[i - 1]:
curr += 1
else:
if curr > max_:
max_ = curr
curr = 1
return max(max_, curr)
if __name__ == '__main__':
max_power("ccbccbb") | def max_power(s: str) -> int:
max_ = 1
curr = 1
for i in range(1, len(s)):
if s[i] == s[i - 1]:
curr += 1
else:
if curr > max_:
max_ = curr
curr = 1
return max(max_, curr)
if __name__ == '__main__':
max_power('ccbccbb') |
class TestThruster:
def test_get(self, log_in, test_client):
response = test_client.get('/thruster')
data = response.get_json()[0]
assert response.status_code == 200
assert 1 == data['id']
assert 'T10' == data['name']
assert 10 == data['thrust_power']
| class Testthruster:
def test_get(self, log_in, test_client):
response = test_client.get('/thruster')
data = response.get_json()[0]
assert response.status_code == 200
assert 1 == data['id']
assert 'T10' == data['name']
assert 10 == data['thrust_power'] |
data = {
"last-modified-date": {
"value": 1523547463983
},
"name": {
"created-date": {
"value": 1523547463758
},
"last-modified-date": {
"value": 1523547463983
},
"given-names": {
"value": "Cecilia"
},
"famil... | data = {'last-modified-date': {'value': 1523547463983}, 'name': {'created-date': {'value': 1523547463758}, 'last-modified-date': {'value': 1523547463983}, 'given-names': {'value': 'Cecilia'}, 'family-name': {'value': 'Payne'}, 'credit-name': None, 'source': None, 'visibility': 'PUBLIC', 'path': '0000-0001-8868-9743'}, ... |
a = int(input())
t = input()
b = int(input())
if t == '*':
print(a*b)
elif t == '+':
print(a+b)
| a = int(input())
t = input()
b = int(input())
if t == '*':
print(a * b)
elif t == '+':
print(a + b) |
meta_file = '/mnt/fs4/chengxuz/Dataset/yfcc/meta.txt'
meta_file_dst = '/mnt/fs4/chengxuz/Dataset/yfcc/meta_short.txt'
with open(meta_file, 'r') as fin:
all_jpgs = fin.readlines()
all_jpgs = [_jpg[len('/mnt/fs4/Dataset/YFCC/images/'):] for _jpg in all_jpgs]
with open(meta_file_dst, 'w') as fout:
fout.writelines... | meta_file = '/mnt/fs4/chengxuz/Dataset/yfcc/meta.txt'
meta_file_dst = '/mnt/fs4/chengxuz/Dataset/yfcc/meta_short.txt'
with open(meta_file, 'r') as fin:
all_jpgs = fin.readlines()
all_jpgs = [_jpg[len('/mnt/fs4/Dataset/YFCC/images/'):] for _jpg in all_jpgs]
with open(meta_file_dst, 'w') as fout:
fout.writelines(... |
def longToSizeString(longVal):
if longVal >= 1073741824 :
return str(round(longVal/1073741824,2))+"GB"
elif longVal >= 1048576:
return str(round(longVal/1048576,2)) + "MB"
elif longVal >= 1024:
return str(round(longVal/1024,2))+"KB"
else:
return str(longVal)+"B" | def long_to_size_string(longVal):
if longVal >= 1073741824:
return str(round(longVal / 1073741824, 2)) + 'GB'
elif longVal >= 1048576:
return str(round(longVal / 1048576, 2)) + 'MB'
elif longVal >= 1024:
return str(round(longVal / 1024, 2)) + 'KB'
else:
return str(longVal... |
"""
More info is available here:
https://forums.codemasters.com/topic/54423-f1%C2%AE-2020-udp-specification/
"""
PACKET_MAPPER = {
'PacketCarTelemetryData_V1': 'telemetry',
'PacketLapData_V1': 'lap',
'PacketMotionData_V1': 'motion',
'PacketSessionData_V1': 'session',
'PacketCarStatusData_V1': 'stat... | """
More info is available here:
https://forums.codemasters.com/topic/54423-f1%C2%AE-2020-udp-specification/
"""
packet_mapper = {'PacketCarTelemetryData_V1': 'telemetry', 'PacketLapData_V1': 'lap', 'PacketMotionData_V1': 'motion', 'PacketSessionData_V1': 'session', 'PacketCarStatusData_V1': 'status', 'PacketCarSetupDa... |
input = '361527'
input = int(input)
def walk():
number = 1
sign = 1
while True:
for _ in range(number):
yield sign, 0
for _ in range(number):
yield 0, sign
number += 1
sign = -sign
def calc_position(index):
pos = (0, 0)
for i, (dx, dy) in e... | input = '361527'
input = int(input)
def walk():
number = 1
sign = 1
while True:
for _ in range(number):
yield (sign, 0)
for _ in range(number):
yield (0, sign)
number += 1
sign = -sign
def calc_position(index):
pos = (0, 0)
for (i, (dx, dy)) ... |
class Solution:
def __init__(self, radius: float, x_center: float, y_center: float):
self.radius = radius
self.x_center = x_center
self.y_center = y_center
def randPoint(self) -> List[float]:
length = sqrt(random.uniform(0, 1)) * self.radius
degree = random.uniform(0, 1) * 2 * math.pi
x = s... | class Solution:
def __init__(self, radius: float, x_center: float, y_center: float):
self.radius = radius
self.x_center = x_center
self.y_center = y_center
def rand_point(self) -> List[float]:
length = sqrt(random.uniform(0, 1)) * self.radius
degree = random.uniform(0, ... |
# https://www.geeksforgeeks.org/minimum-of-two-numbers-in-python
"""
Given a list, write a Python code to find the Minimum of these two numbers.
"""
NUMBERS = ( 1, 2, 3, 4, 5, 6, 7, 8 )
if __name__ == "__main__":
# The min() method
print(min(NUMBERS))
| """
Given a list, write a Python code to find the Minimum of these two numbers.
"""
numbers = (1, 2, 3, 4, 5, 6, 7, 8)
if __name__ == '__main__':
print(min(NUMBERS)) |
class MediaState(Enum, IComparable, IFormattable, IConvertible):
"""
Specifies the states that can be applied to a System.Windows.Controls.MediaElement for the System.Windows.Controls.MediaElement.LoadedBehavior and System.Windows.Controls.MediaElement.UnloadedBehavior properties.
enum MediaState,values... | class Mediastate(Enum, IComparable, IFormattable, IConvertible):
"""
Specifies the states that can be applied to a System.Windows.Controls.MediaElement for the System.Windows.Controls.MediaElement.LoadedBehavior and System.Windows.Controls.MediaElement.UnloadedBehavior properties.
enum MediaState,values: Clos... |
# Copyright 2017 Janos Czentye
#
# 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... | """
Contains classes relevant to element management.
"""
class Abstractelementmanager(object):
"""
Abstract class for element management components (EM).
.. warning::
Not implemented yet!
"""
def __init__(self):
"""
Init.
:return: None
"""
pass
class Clickmanager(Abstr... |
class BasisFunctionLike(object):
@classmethod
def derivatives_factory(cls, coef, *args, **kwargs):
raise NotImplementedError
@classmethod
def functions_factory(cls, coef, *args, **kwargs):
raise NotImplementedError
| class Basisfunctionlike(object):
@classmethod
def derivatives_factory(cls, coef, *args, **kwargs):
raise NotImplementedError
@classmethod
def functions_factory(cls, coef, *args, **kwargs):
raise NotImplementedError |
"""
Exceptions
Errors detected during execution are called exceptions.
Examples:
ZeroDivisionError
This error is raised when the second argument of a division or modulo operation is zero.
#>>> a = '1'
#>>> b = '0'
#>>> print int(a) / int(b)
#>>> ZeroDivisionError: integer division or modulo by zero
ValueError
This... | """
Exceptions
Errors detected during execution are called exceptions.
Examples:
ZeroDivisionError
This error is raised when the second argument of a division or modulo operation is zero.
#>>> a = '1'
#>>> b = '0'
#>>> print int(a) / int(b)
#>>> ZeroDivisionError: integer division or modulo by zero
ValueError
This... |
def crop(image, height, width):
'''
Function to crop images
Parameters:
image, a 3d array of the image (can be obtained using plt.imread(image))
height, integer, the desired height of the cropped image
width, integer, the desired width of the cropped image
Returns:
cropped_image, a 3d... | def crop(image, height, width):
"""
Function to crop images
Parameters:
image, a 3d array of the image (can be obtained using plt.imread(image))
height, integer, the desired height of the cropped image
width, integer, the desired width of the cropped image
Returns:
cropped_image, a 3d ... |
entries = [
{
'env-title': 'atari-alien',
'env-variant': 'Human start',
'score': 128.30,
},
{
'env-title': 'atari-amidar',
'env-variant': 'Human start',
'score': 11.80,
},
{
'env-title': 'atari-assault',
'env-variant': 'Human start',
... | entries = [{'env-title': 'atari-alien', 'env-variant': 'Human start', 'score': 128.3}, {'env-title': 'atari-amidar', 'env-variant': 'Human start', 'score': 11.8}, {'env-title': 'atari-assault', 'env-variant': 'Human start', 'score': 166.9}, {'env-title': 'atari-asterix', 'env-variant': 'Human start', 'score': 164.5}, {... |
class BoxField:
BOXES = 'bbox'
KEYPOINTS = 'keypoints'
LABELS = 'label'
MASKS = 'masks'
NUM_BOXES = 'num_boxes'
SCORES = 'scores'
WEIGHTS = 'weights'
class DatasetField:
IMAGES = 'images'
IMAGES_INFO = 'images_information'
IMAGES_PMASK = 'images_padding_mask'
| class Boxfield:
boxes = 'bbox'
keypoints = 'keypoints'
labels = 'label'
masks = 'masks'
num_boxes = 'num_boxes'
scores = 'scores'
weights = 'weights'
class Datasetfield:
images = 'images'
images_info = 'images_information'
images_pmask = 'images_padding_mask' |
#
# PySNMP MIB module HH3C-WAPI-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-WAPI-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:30:34 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_constraint, constraints_union, value_range_constraint, single_value_constraint) ... |
class Solution:
def longestPalindromeSubseq(self, s: str) -> int:
n = len(s)
dp = [[0 for _ in range(n+1) ] for _ in range(n+1)]
for i in range(1,n+1):
for j in range(1,n+1):
if( s[i-1] == s[n-j]):
dp[i][j] = 1+dp[i-1][j-1]
else... | class Solution:
def longest_palindrome_subseq(self, s: str) -> int:
n = len(s)
dp = [[0 for _ in range(n + 1)] for _ in range(n + 1)]
for i in range(1, n + 1):
for j in range(1, n + 1):
if s[i - 1] == s[n - j]:
dp[i][j] = 1 + dp[i - 1][j - 1]
... |
class JsutCounter:
__secretCount = 0
def count(self):
self.__secretCount += 1
print(self.__secretCount)
counter = JustCounter()
counter.count()
counter.count()
# print(counter.__secretCount)
print(counter._JustCounter.__secretCount)
#public:normal variables
#private:__
#protected:_
| class Jsutcounter:
__secret_count = 0
def count(self):
self.__secretCount += 1
print(self.__secretCount)
counter = just_counter()
counter.count()
counter.count()
print(counter._JustCounter.__secretCount) |
class Solution:
def max_dp(self, nums2: List[int]) -> int:
dp=[0,0,nums2[0]]
for num in nums2[1:]:
dp.append(num+max(dp[-2], dp[-3]))
return max(dp[-1], dp[-2])
def rob(self, nums: List[int]) -> int:
if len(nums)<=3:
return max(nums)
e... | class Solution:
def max_dp(self, nums2: List[int]) -> int:
dp = [0, 0, nums2[0]]
for num in nums2[1:]:
dp.append(num + max(dp[-2], dp[-3]))
return max(dp[-1], dp[-2])
def rob(self, nums: List[int]) -> int:
if len(nums) <= 3:
return max(nums)
elif... |
#-*- coding:utf-8 -*-
def display(name,age):
print (name,age)
| def display(name, age):
print(name, age) |
n = int(input("Digite o valor de n: "))
i=0
count = 0
while count<n:
if (i % 2) != 0:
print (i)
count = count + 1
i = i + 1 | n = int(input('Digite o valor de n: '))
i = 0
count = 0
while count < n:
if i % 2 != 0:
print(i)
count = count + 1
i = i + 1 |
# pylint: disable=missing-class-docstring
"""Exception classes for Eddington."""
class EddingtonException(Exception): # noqa: D101
pass
# Interval Errors
class IntervalError(EddingtonException): # noqa: D101
pass
class IntervalIntersectionError(IntervalError): # noqa: D101
def __init__(self, *int... | """Exception classes for Eddington."""
class Eddingtonexception(Exception):
pass
class Intervalerror(EddingtonException):
pass
class Intervalintersectionerror(IntervalError):
def __init__(self, *intervals):
super().__init__(f'The intervals {intervals} do not intersect')
class Fittingfunctionloa... |
#
# PySNMP MIB module WWP-LEOS-BENCHMARK-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WWP-LEOS-BENCHMARK-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:30:56 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, value_range_constraint, constraints_intersection, constraints_union) ... |
# -*- coding: UTF-8 -*-
# Copyright 2013-2017 Luc Saffre
# License: BSD (see file COPYING for details)
"""
Plugins
=======
.. autosummary::
:toctree:
cosi
contacts
b2c
Not used
========
.. autosummary::
:toctree:
orders
delivery
"""
| """
Plugins
=======
.. autosummary::
:toctree:
cosi
contacts
b2c
Not used
========
.. autosummary::
:toctree:
orders
delivery
""" |
"""
SE - number
SE - symbols
SE - (SE SE SE ...)
EXAMPLES:
1 -> 1
ahoj -> ahoj
(a ahoj) -> ( -> a -> ahoj -> )
((ahoj a) (a) a) -> ( -> ( -> ahoj -> a -> ) -> ( -> ) -> )
"""
STR_SURROUND = ["\"", "'"]
ESCAPE_CHAR = "\\"
def lexer(value):
"""Yield token"""
buffer = list()
last = ''
... | """
SE - number
SE - symbols
SE - (SE SE SE ...)
EXAMPLES:
1 -> 1
ahoj -> ahoj
(a ahoj) -> ( -> a -> ahoj -> )
((ahoj a) (a) a) -> ( -> ( -> ahoj -> a -> ) -> ( -> ) -> )
"""
str_surround = ['"', "'"]
escape_char = '\\'
def lexer(value):
"""Yield token"""
buffer = list()
last = ''
sta... |
#
# PySNMP MIB module CISCOSB-CDP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCOSB-CDP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:22:03 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection) ... |
unique_symbols= { 1:'I', 5:'V', 10:'X', 50:'L', 100:'C', 500:'D', 1000:'M' }
def calculateRoman(algarism, place):
if algarism==0: return ''
elif place>=4: return algarism * unique_symbols[1000]
elif algarism>5:
if algarism==9: return unique_symbols[10**(place-1)]+unique_symbols[10**place]
e... | unique_symbols = {1: 'I', 5: 'V', 10: 'X', 50: 'L', 100: 'C', 500: 'D', 1000: 'M'}
def calculate_roman(algarism, place):
if algarism == 0:
return ''
elif place >= 4:
return algarism * unique_symbols[1000]
elif algarism > 5:
if algarism == 9:
return unique_symbols[10 ** (... |
class Solution:
"""
@param grid: a list of lists of integers
@return: An integer, minimizes the sum of all numbers along its path
"""
"""
f[]
"""
def minPathSum(self, grid):
# write your code here
if grid is None or not grid:return 0
m = len(grid)
n... | class Solution:
"""
@param grid: a list of lists of integers
@return: An integer, minimizes the sum of all numbers along its path
"""
'\n \n f[]\n '
def min_path_sum(self, grid):
if grid is None or not grid:
return 0
m = len(grid)
n = len(grid[0])
... |
class MapAsObject:
def __init__(self, wrapped):
self.wrapped = wrapped
def __getattr__(self, key):
try:
return self.wrapped[key]
except KeyError:
raise AttributeError("%r object has no attribute %r" %
(self.__class__.__name__, ke... | class Mapasobject:
def __init__(self, wrapped):
self.wrapped = wrapped
def __getattr__(self, key):
try:
return self.wrapped[key]
except KeyError:
raise attribute_error('%r object has no attribute %r' % (self.__class__.__name__, key))
def get(self, *args, **... |
fhand = open(input('Enter file name: '))
d = dict()
for ln in fhand:
if not ln.startswith('From '): continue
words = ln.split()
time = words[5]
d[time[:2]] = d.get(time[:2],0) + 1
l = list()
for key,val in d.items():
l.append((val,key))
l.sort()
for val,key in l:
print(key,val)
| fhand = open(input('Enter file name: '))
d = dict()
for ln in fhand:
if not ln.startswith('From '):
continue
words = ln.split()
time = words[5]
d[time[:2]] = d.get(time[:2], 0) + 1
l = list()
for (key, val) in d.items():
l.append((val, key))
l.sort()
for (val, key) in l:
print(key, val) |
dbname='postgres'
user='postgres'
password='q1w2e3r4'
host='127.0.0.1'
| dbname = 'postgres'
user = 'postgres'
password = 'q1w2e3r4'
host = '127.0.0.1' |
"""
MIT License
Copyright (c) 2021 Daud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribu... | """
MIT License
Copyright (c) 2021 Daud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribu... |
Blue = 0
Red = 0
Yellow = 0
Green = 0
Gold = 1
Health = 100
Experience = 0
if Gold == 1:
print("The chest opens")
Health += 50
Experience += 100
elif Blue == 1:
print("DEATH Appears")
Health -= 100
elif Red == 1:
print("The chest burns you")
Health -= 50
elif Y... | blue = 0
red = 0
yellow = 0
green = 0
gold = 1
health = 100
experience = 0
if Gold == 1:
print('The chest opens')
health += 50
experience += 100
elif Blue == 1:
print('DEATH Appears')
health -= 100
elif Red == 1:
print('The chest burns you')
health -= 50
elif Yellow == 1:
print('A monste... |
numList = [3, 4, 5, 6, 7]
length = len(numList)
for i in range(length):
print(2 * numList[i])
| num_list = [3, 4, 5, 6, 7]
length = len(numList)
for i in range(length):
print(2 * numList[i]) |
#
# @lc app=leetcode id=273 lang=python3
#
# [273] Integer to English Words
#
# @lc code=start
class Solution:
def numberToWords(self, num: int) -> str:
v0 = ["Thousand", "Million", "Billion"]
v1 = ["", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve... | class Solution:
def number_to_words(self, num: int) -> str:
v0 = ['Thousand', 'Million', 'Billion']
v1 = ['', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Eleven', 'Twelve', 'Thirteen', 'Fourteen', 'Fifteen', 'Sixteen', 'Seventeen', 'Eighteen', 'Nineteen']
... |
class JeevesException(Exception):
"""
Base exception class for jeeves.
"""
pass
class UserNotAdded(JeevesException):
"""
An JeevesException that raises when there is not a user added to the
server or "not found".
Parameters
----------
name : string
... | class Jeevesexception(Exception):
"""
Base exception class for jeeves.
"""
pass
class Usernotadded(JeevesException):
"""
An JeevesException that raises when there is not a user added to the
server or "not found".
Parameters
----------
name : string
... |
'''
IQ test
'''
n = int(input())
numbers = list(map(int, input().split(' ')))
even = 0
odd = 0
first_eve = -1
first_odd = -1
for i in range(n):
if numbers[i] % 2 == 0:
even += 1
if first_eve == -1:
first_eve = i
else:
odd += 1
if first_odd == -1:
first_odd... | """
IQ test
"""
n = int(input())
numbers = list(map(int, input().split(' ')))
even = 0
odd = 0
first_eve = -1
first_odd = -1
for i in range(n):
if numbers[i] % 2 == 0:
even += 1
if first_eve == -1:
first_eve = i
else:
odd += 1
if first_odd == -1:
first_odd... |
class Solution:
def canVisitAllRooms(self, rooms: List[List[int]]) -> bool:
opened = set()
N = len(rooms)
opened.add(0)
toOpen = rooms[0]
while toOpen:
nextRound = set()
for room in toOpen:
for newKey in rooms[room]:
... | class Solution:
def can_visit_all_rooms(self, rooms: List[List[int]]) -> bool:
opened = set()
n = len(rooms)
opened.add(0)
to_open = rooms[0]
while toOpen:
next_round = set()
for room in toOpen:
for new_key in rooms[room]:
... |
class UndoSelectiveEnum(basestring):
"""
all|wrong
Possible values:
<ul>
<li> "all" - Undo all shared data,
<li> "wrong" - Only undo the incorrectly shared data
</ul>
"""
@staticmethod
def get_api_name():
return "undo-selective-enum"
| class Undoselectiveenum(basestring):
"""
all|wrong
Possible values:
<ul>
<li> "all" - Undo all shared data,
<li> "wrong" - Only undo the incorrectly shared data
</ul>
"""
@staticmethod
def get_api_name():
return 'undo-selective-enum' |
'''
Python program to compute the sum of the negative
and positive numbers of an array of integers and display the
largest sum.
Original array elements: {0, 15, 16, 17, -14, -13, -12, -11, -10, 18,
19, 20}
Largest sum - Positive/Negative numbers of the said array: 105
Original array elements: {0, 3, 4, 5, 9, -22, -44,... | """
Python program to compute the sum of the negative
and positive numbers of an array of integers and display the
largest sum.
Original array elements: {0, 15, 16, 17, -14, -13, -12, -11, -10, 18,
19, 20}
Largest sum - Positive/Negative numbers of the said array: 105
Original array elements: {0, 3, 4, 5, 9, -22, -44,... |
'''input
549
817
715
603
1152
600
300
220
420
520
'''
# -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem A
if __name__ == '__main__':
a = int(input())
b = int(input())
c = int(input())
d = int(input())
print(min(a, b) + min(c, d))
| """input
549
817
715
603
1152
600
300
220
420
520
"""
if __name__ == '__main__':
a = int(input())
b = int(input())
c = int(input())
d = int(input())
print(min(a, b) + min(c, d)) |
# -*- coding: utf-8 -*-
"""Main module."""
def silly_sort(unsilly_list):
"""
This function was created in order to arrenge a range of rangers.
Please, move on and don't ask me why.
"""
size = len(unsilly_list)
for i in range(size):
unsilly_list[i], unsilly_list[size-1-i] = \
... | """Main module."""
def silly_sort(unsilly_list):
"""
This function was created in order to arrenge a range of rangers.
Please, move on and don't ask me why.
"""
size = len(unsilly_list)
for i in range(size):
(unsilly_list[i], unsilly_list[size - 1 - i]) = (unsilly_list[size - 1 - i], un... |
list_1 = [2,3,1,4,2,3,5,6,8,5,8,9,10,9,6]
s = set(list_1)
list_2 = list(s)
#print(list_2)
n = 3
l = len(list_1)
#print(l)
b = int((len(list_2)/n))
s1 = list_2.__getslice__(0, b)
s2 = list_2.__getslice__(len(s1), len(s1)+b)
#l1 = list(enumerate(s1, 1))
#l2 = list(enumerate(s2, 1))
print(s1,s2)
#print(l1, l2)
| list_1 = [2, 3, 1, 4, 2, 3, 5, 6, 8, 5, 8, 9, 10, 9, 6]
s = set(list_1)
list_2 = list(s)
n = 3
l = len(list_1)
b = int(len(list_2) / n)
s1 = list_2.__getslice__(0, b)
s2 = list_2.__getslice__(len(s1), len(s1) + b)
print(s1, s2) |
#shape of small b:
def for_b():
"""printing small 'b' using for loop"""
for row in range(7):
for col in range(4):
if col==0 or col in(1,2) and row in(3,6) or col==3 and row in(4,5) :
print("*",end=" ")
else:
print(" ",end=" ")
prin... | def for_b():
"""printing small 'b' using for loop"""
for row in range(7):
for col in range(4):
if col == 0 or (col in (1, 2) and row in (3, 6)) or (col == 3 and row in (4, 5)):
print('*', end=' ')
else:
print(' ', end=' ')
print()
def whil... |
def get_token_files(parser, logic, logging, args=0):
if args:
if "hid" not in args.keys():
parser.print("missing honeypotid")
return
hid = args["hid"]
for h in hid:
r = logic.get_token_files(h)
if r != "":
parser.print("Tokens l... | def get_token_files(parser, logic, logging, args=0):
if args:
if 'hid' not in args.keys():
parser.print('missing honeypotid')
return
hid = args['hid']
for h in hid:
r = logic.get_token_files(h)
if r != '':
parser.print('Tokens l... |
class Queue:
def __init__(self, initial_size=10):
self.arr = [0 for _ in range(initial_size)]
self.next_index = 0
self.front_index = -1
self.queue_size = 0 | class Queue:
def __init__(self, initial_size=10):
self.arr = [0 for _ in range(initial_size)]
self.next_index = 0
self.front_index = -1
self.queue_size = 0 |
def alterarPosicao(changePosition, change):
"""This looks complicated but I'm doing this:
Current_pos == (x, y)
change == (a, b)
new_position == ((x + a), (y + b))
"""
return (changePosition[0] + change[0]), (changePosition[1] + change[1])
posicaoAtual = (10, 1)
posicaoAtual = alterarPosicao(... | def alterar_posicao(changePosition, change):
"""This looks complicated but I'm doing this:
Current_pos == (x, y)
change == (a, b)
new_position == ((x + a), (y + b))
"""
return (changePosition[0] + change[0], changePosition[1] + change[1])
posicao_atual = (10, 1)
posicao_atual = alterar_posicao(p... |
# -*- coding: utf-8 -*-
"""Responses.
responses serve both testing purpose aswell as dynamic docstring replacement.
"""
responses = {
"_v3_Availability": {
"url": "/openapi/root/v1/features/availability",
"response": [
{'Available': True, 'Feature': 'News'},
{'Available': Tr... | """Responses.
responses serve both testing purpose aswell as dynamic docstring replacement.
"""
responses = {'_v3_Availability': {'url': '/openapi/root/v1/features/availability', 'response': [{'Available': True, 'Feature': 'News'}, {'Available': True, 'Feature': 'GainersLosers'}, {'Available': True, 'Feature': 'Calend... |
#reference to https://github.com/matterport/Mask_RCNN.git and mrcnn/utils.py
def download_trained_weights(coco_model_path, verbose=1):
"""Download COCO trained weights from Releases.
coco_model_path: local path of COCO trained weights
"""
if verbose > 0:
print("Downloading pretrained model to ... | def download_trained_weights(coco_model_path, verbose=1):
"""Download COCO trained weights from Releases.
coco_model_path: local path of COCO trained weights
"""
if verbose > 0:
print('Downloading pretrained model to ' + coco_model_path + ' ...')
with urllib.request.urlopen(COCO_MODEL_URL) ... |
def divisores(n):
div=[]
for i in range(1,n-1):
if n % i ==0:
div.append(i)
return div
def amigos(a,b):
div_a = divisores(a)
div_b = divisores(b)
sigma_a = sum(div_a)
sigma_b = sum(div_b)
if sigma_a == b or sigma_b == a:
return True
else:
... | def divisores(n):
div = []
for i in range(1, n - 1):
if n % i == 0:
div.append(i)
return div
def amigos(a, b):
div_a = divisores(a)
div_b = divisores(b)
sigma_a = sum(div_a)
sigma_b = sum(div_b)
if sigma_a == b or sigma_b == a:
return True
else:
r... |
"""
blueberrymath.
Open Source Mathematical Package.
"""
__version__ = "0.1.1"
__author__ = 'Rogger Garcia | Fausto German'
| """
blueberrymath.
Open Source Mathematical Package.
"""
__version__ = '0.1.1'
__author__ = 'Rogger Garcia | Fausto German' |
def print_formatted(number):
width = len(str(bin(number))) # Since the last column is always filled
for i in range(1, number+1):
print(str(i).rjust(width-2, '.') +
oct(i).lstrip("0o").rjust(width-1, '.') +
hex(i).lstrip("0x").upper().rjust(width-1, '.') +
... | def print_formatted(number):
width = len(str(bin(number)))
for i in range(1, number + 1):
print(str(i).rjust(width - 2, '.') + oct(i).lstrip('0o').rjust(width - 1, '.') + hex(i).lstrip('0x').upper().rjust(width - 1, '.') + bin(i).lstrip('0b').rjust(width - 1, '.'))
if __name__ == '__main__':
n = int... |
# Copyright 2014 F5 Networks 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 writi... | min_tmos_major_version = 11
min_tmos_minor_version = 5
min_extra_mb = 500
default_hostname = 'bigip1'
max_hostname_length = 128
default_folder = 'Common'
folder_cache_timeout = 120
connection_timeout = 30
fdb_populate_static_arp = True
device_lock_prefix = 'lock_'
wsdl_cache_dir = ''
ha_vlan_name = 'HA'
ha_selfip_name ... |
# File: crowdstrike_consts.py
#
# Copyright (c) 2016-2020 Splunk 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... | crowdstrike_json_url = 'url'
crowdstrike_filter_request_str = '{0}rest/container?page_size=0&_filter_asset={1}&_filter_name__contains="{2}"&_filter_start_time__gte="{3}"'
crowdstrike_succ_connectivity_test = 'Connectivity test passed'
crowdstrike_err_connectivity_test = 'Connectivity test failed'
crowdstrike_err_connec... |
HANDSHAKING = 0
STATUS = 1
LOGIN = 2
PLAY = 3
| handshaking = 0
status = 1
login = 2
play = 3 |
class Node:
def __init__(self, data):
self.data = data
self.next = None
class Queue:
def __init__(self):
self.head = None
self.last = None
self.l = []
def isEmpty(self):
return self.head == None
# Method to add an item to the queue
def Enqueue(se... | class Node:
def __init__(self, data):
self.data = data
self.next = None
class Queue:
def __init__(self):
self.head = None
self.last = None
self.l = []
def is_empty(self):
return self.head == None
def enqueue(self, item):
temp = node(item)
... |
datasets = {
"cv-corpus-7.0-2021-07-21": {
"directories": ["speakers"],
"audio_extensions": [".wav", ".flac"],
"transcript_extension": ".txt"
},
"LibriTTS": {
"directories": ["train-clean-100", "train-clean-360", "train-other-500"],
"audio_extensions": [".wav", ".flac... | datasets = {'cv-corpus-7.0-2021-07-21': {'directories': ['speakers'], 'audio_extensions': ['.wav', '.flac'], 'transcript_extension': '.txt'}, 'LibriTTS': {'directories': ['train-clean-100', 'train-clean-360', 'train-other-500'], 'audio_extensions': ['.wav', '.flac'], 'transcript_extension': '.original.txt'}, 'TEDLIUM_r... |
# Copyright 2019 DIVERSIS Software. 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 applicable law o... | def network_config(netType):
if netType == 1:
layer_out_dim_size = [16, 32, 64, 128, 256, 64, 10]
kernel_size = [[3, 3], [3, 3], [3, 3], [3, 3], [3, 3], [1], [1]]
stride_size = [2, 2, 2, 2, 2, 1, 1]
pool_kernel_size = [[3, 3], [3, 3], [3, 3], [3, 3], [3, 3], [3, 3], [3, 3]]
p... |
# https://app.codility.com/demo/results/trainingPURU8U-DP4/
def solution(array):
set_array = set()
for val in array:
if val not in set_array :
set_array.add(val)
return len(set_array)
if __name__ == '__main__':
print(solution([0])) | def solution(array):
set_array = set()
for val in array:
if val not in set_array:
set_array.add(val)
return len(set_array)
if __name__ == '__main__':
print(solution([0])) |
# The key 'ICE' is repeated to match the length of the string and later they are xored taking eacg character at a time
def xor(string,key):
length = divmod(len(string),len(key))
key = key*length[0]+key[0:length[1]]
return ''.join([chr(ord(a)^ord(b)) for a,b in zip(string,key)])
if __name__ == "__main__":
... | def xor(string, key):
length = divmod(len(string), len(key))
key = key * length[0] + key[0:length[1]]
return ''.join([chr(ord(a) ^ ord(b)) for (a, b) in zip(string, key)])
if __name__ == '__main__':
print(xor('\n'.join([line.strip() for line in open('5.txt')]), 'ICE')).encode('hex') |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""
Created Date: Wednesday October 23rd 2019
Author: Dmitry Kislov
E-mail: kislov@easydan.com
-----
Last Modified: Wednesday, October 23rd 2019, 9:08:59 am
Modified By: Dmitry Kislov
-----
Copyright (c) 2019
"""
| """
Created Date: Wednesday October 23rd 2019
Author: Dmitry Kislov
E-mail: kislov@easydan.com
-----
Last Modified: Wednesday, October 23rd 2019, 9:08:59 am
Modified By: Dmitry Kislov
-----
Copyright (c) 2019
""" |
Root.default = 'C'
Scale.scale = 'major'
Clock.bpm = 120
notas = [0, 3, 5, 4]
frequencia = var(notas, 4)
d0 >> play(
'<x |o2| ><---{[----]-*}>',
sample=4,
dur=1/2
)
s0 >> space(
notas,
dur=1/4,
apm=3,
pan=[-1, 0, 1]
)
s1 >> bass(
frequencia,
dur=1/4,
oct=4,
)
s2 >> spark(
... | Root.default = 'C'
Scale.scale = 'major'
Clock.bpm = 120
notas = [0, 3, 5, 4]
frequencia = var(notas, 4)
d0 >> play('<x |o2| ><---{[----]-*}>', sample=4, dur=1 / 2)
s0 >> space(notas, dur=1 / 4, apm=3, pan=[-1, 0, 1])
s1 >> bass(frequencia, dur=1 / 4, oct=4)
s2 >> spark(frequencia, dur=[1 / 2, 1 / 4]) + (0, 2, 4)
s3 >>... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.