content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
num = int(raw_input("Enter a number: "))
fact=1;
for i in range(num ,1,-1):
fact *= i
print(fact)
| num = int(raw_input('Enter a number: '))
fact = 1
for i in range(num, 1, -1):
fact *= i
print(fact) |
n=int(input());r=0;k=2
n*=2
while n>=k:
r+=k*(n//k-n//(2*k))
k*=2
print(r)
| n = int(input())
r = 0
k = 2
n *= 2
while n >= k:
r += k * (n // k - n // (2 * k))
k *= 2
print(r) |
JINJA_FUNCTIONS = []
def add_jinja_global(arg=None):
def decorator(func):
JINJA_FUNCTIONS.append(func)
return func
if callable(arg):
return decorator(arg) # return 'wrapper'
else:
return decorator # ... or 'decorator'
| jinja_functions = []
def add_jinja_global(arg=None):
def decorator(func):
JINJA_FUNCTIONS.append(func)
return func
if callable(arg):
return decorator(arg)
else:
return decorator |
class Solution:
def minPathSum(self, grid):
'''
the first row each column equal the sum of itself with the previous colmuns.
The same applied for the first column, the first column of each row equals the sume of itself with the previous ones in.
'''
rows, cols = len(grid), le... | class Solution:
def min_path_sum(self, grid):
"""
the first row each column equal the sum of itself with the previous colmuns.
The same applied for the first column, the first column of each row equals the sume of itself with the previous ones in.
"""
(rows, cols) = (len(gri... |
class Morton(object):
def __init__(self, dimensions=2, bits=32):
assert dimensions > 0, 'dimensions should be greater than zero'
assert bits > 0, 'bits should be greater than zero'
def flp2(x):
'''Greatest power of 2 less than or equal to x, branch-free.'''
x |= x ... | class Morton(object):
def __init__(self, dimensions=2, bits=32):
assert dimensions > 0, 'dimensions should be greater than zero'
assert bits > 0, 'bits should be greater than zero'
def flp2(x):
"""Greatest power of 2 less than or equal to x, branch-free."""
x |= x >... |
config = {
'http': {
'400': '400 Bad Request',
'401': '401 Unauthorized',
'500': '500 Internal Server Error',
'503': '503 Service Unavailable',
},
}
| config = {'http': {'400': '400 Bad Request', '401': '401 Unauthorized', '500': '500 Internal Server Error', '503': '503 Service Unavailable'}} |
loss_window = vis.line(
Y=torch.zeros((1),device=device),
X=torch.zeros((1),device=device),
opts=dict(xlabel='epoch',ylabel='Loss',title='training loss',legend=['Loss']))
vis.line(X=torch.ones((1,1),device=device)*epoch,Y=torch.Tensor([epoch_loss],device=device).unsqueeze(0),win=loss_window,update='append')
| loss_window = vis.line(Y=torch.zeros(1, device=device), X=torch.zeros(1, device=device), opts=dict(xlabel='epoch', ylabel='Loss', title='training loss', legend=['Loss']))
vis.line(X=torch.ones((1, 1), device=device) * epoch, Y=torch.Tensor([epoch_loss], device=device).unsqueeze(0), win=loss_window, update='append') |
### PRIMITIVE
class fixed2:
def __init__(self, xu = 0.0, yv = 0.0):
self.two = [xu, yv]
def __copy__(self):
return fixed2(*self.two[:])
def __str__(self):
return str(self.two)
@property
def x(self):
return self.two[0]
@x.setter
def x(self, value):
... | class Fixed2:
def __init__(self, xu=0.0, yv=0.0):
self.two = [xu, yv]
def __copy__(self):
return fixed2(*self.two[:])
def __str__(self):
return str(self.two)
@property
def x(self):
return self.two[0]
@x.setter
def x(self, value):
self.two[0] = val... |
def common_function():
print('This is coming from the common function')
return 'Hello Common'
| def common_function():
print('This is coming from the common function')
return 'Hello Common' |
def acos(): pass
def acosh(): pass
def asin(): pass
def asinh(): pass
def atan(): pass
def atanh(): pass
def cos(): pass
def cosh(): pass
def exp(): pass
def isinf(): pass
def isnan(): pass
def log(): pass
def log10(): pass
def phase(): pass
def polar(): pass
def rect(): pass
def sin(): pass
def sinh()... | def acos():
pass
def acosh():
pass
def asin():
pass
def asinh():
pass
def atan():
pass
def atanh():
pass
def cos():
pass
def cosh():
pass
def exp():
pass
def isinf():
pass
def isnan():
pass
def log():
pass
def log10():
pass
def phase():
pass
def pola... |
def sumOfTwo(a, b, v):
# result = {True for x in a for y in b if x + y == v}
# print(type(result))
# print(result)
# return True if True in result else False
for i in a:
for j in b:
if i + j == v:
return True
return False
a = [0, 1, 2, 3]
b = [1... | def sum_of_two(a, b, v):
for i in a:
for j in b:
if i + j == v:
return True
return False
a = [0, 1, 2, 3]
b = [10, 20, 39, 40]
v = 42
print(sum_of_two(a, b, v)) |
class PrefixUnaryExpressionSyntax(object):
def __init__(self, kind, operator_token, operand):
self.kind = kind
self.operator_token = operator_token
self.operand = operand
def __str__(self):
return f"{self.operator_token}{self.operand}"
| class Prefixunaryexpressionsyntax(object):
def __init__(self, kind, operator_token, operand):
self.kind = kind
self.operator_token = operator_token
self.operand = operand
def __str__(self):
return f'{self.operator_token}{self.operand}' |
#
# PySNMP MIB module CISCO-PAE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-PAE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12: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 201... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_intersection, constraints_union, value_range_constraint, single_value_constraint) ... |
arr = list(map(int, input().split()))
flag=True
for i in range(len(arr)):
if arr[i]!=arr[len(arr)-1-i]:
flag=False
break
if flag:
print('symmetric')
else:
print('not symmetric') | arr = list(map(int, input().split()))
flag = True
for i in range(len(arr)):
if arr[i] != arr[len(arr) - 1 - i]:
flag = False
break
if flag:
print('symmetric')
else:
print('not symmetric') |
def selectionSort(lst):
for selectedLocation in range(len(lst)-1,0,-1):
maxPosition=0
for currentindex in range(1,selectedLocation+1): #since range(0,4) is exclusive to 4
if lst[currentindex]>lst[maxPosition]:
maxPosition = currentindex
lst[selectedLocation], lst[ma... | def selection_sort(lst):
for selected_location in range(len(lst) - 1, 0, -1):
max_position = 0
for currentindex in range(1, selectedLocation + 1):
if lst[currentindex] > lst[maxPosition]:
max_position = currentindex
(lst[selectedLocation], lst[maxPosition]) = (lst... |
def get_coupons(self):
return self.handle_response(
self.request("/coupons"),
"coupons"
)
def create_coupon(self, **kwargs):
return self.handle_response(
self.request("/coupons", "POST", kwargs),
"uniqid"
)
def get_coupon(self, uniqid):
return self.handle_response... | def get_coupons(self):
return self.handle_response(self.request('/coupons'), 'coupons')
def create_coupon(self, **kwargs):
return self.handle_response(self.request('/coupons', 'POST', kwargs), 'uniqid')
def get_coupon(self, uniqid):
return self.handle_response(self.request(f'/coupons/{uniqid}'), 'coupon')... |
def main() -> None:
if __name__ == "__main__":
champernownes_constant = ''.join(str(x) for x in range(1, 1_000_000 + 1))
ans = int(champernownes_constant[1 - 1])
ans *= int(champernownes_constant[10 - 1])
ans *= int(champernownes_constant[100 - 1])
ans *= int(champernownes_c... | def main() -> None:
if __name__ == '__main__':
champernownes_constant = ''.join((str(x) for x in range(1, 1000000 + 1)))
ans = int(champernownes_constant[1 - 1])
ans *= int(champernownes_constant[10 - 1])
ans *= int(champernownes_constant[100 - 1])
ans *= int(champernownes_co... |
ies = []
ies.append({ "ie_type" : "Node ID", "ie_value" : "Node ID", "presence" : "M", "instance" : "0", "comment" : "This IE shall contain the unique identifier of the sending Node."})
ies.append({ "ie_type" : "Cause", "ie_value" : "Cause", "presence" : "M", "instance" : "0", "comment" : "This IE shall indicate the ac... | ies = []
ies.append({'ie_type': 'Node ID', 'ie_value': 'Node ID', 'presence': 'M', 'instance': '0', 'comment': 'This IE shall contain the unique identifier of the sending Node.'})
ies.append({'ie_type': 'Cause', 'ie_value': 'Cause', 'presence': 'M', 'instance': '0', 'comment': 'This IE shall indicate the acceptance or ... |
# coding: utf-8
# # Variable Types - Boolean
# In the last lesson we learnt how to index and slice strings. We also learnt how to use some common string functions such as the <code>len()</code> function.
#
# In this lesson, we'll learn about Boolean values. Boolean values evaluate to either True or False and are co... | bool_true = True
bool_false = False
bool(0)
bool(1e-11)
bool(10)
bool('hi')
bool(' ')
bool('')
print(True and True)
print(True and False)
print(True and True and True and True and False)
print(True or False)
print(False or False)
print(False or False or False or False or True)
print(not True)
print(not False)
print(not... |
RAW_PATH = "./data/raw/"
INTERIM_PATH = "./data/interim/"
REFINED_PATH = "./data/refined/"
EXTERNAL_PATH = "./data/external/"
SUBMIT_PATH = "./data/submission/"
MODELS_PATH = "./data/models/"
CAL_DTYPES = {
"event_name_1": "category",
"event_name_2": "category",
"event_type_1": "category",
"event_type... | raw_path = './data/raw/'
interim_path = './data/interim/'
refined_path = './data/refined/'
external_path = './data/external/'
submit_path = './data/submission/'
models_path = './data/models/'
cal_dtypes = {'event_name_1': 'category', 'event_name_2': 'category', 'event_type_1': 'category', 'event_type_2': 'category', 'w... |
# model settings
norm_cfg = dict(type='SyncBN', requires_grad=True)
model = dict(
type='CascadeEncoderDecoder',
num_stages=2,
pretrained='open-mmlab://resnet50_v1c',
backbone=dict(
type='ResNetV1c',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
dilations=(1, 1... | norm_cfg = dict(type='SyncBN', requires_grad=True)
model = dict(type='CascadeEncoderDecoder', num_stages=2, pretrained='open-mmlab://resnet50_v1c', backbone=dict(type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=(1, 2, 1, 1), norm_cfg=norm_cfg, norm_eval=False, style='p... |
{
'variables': {
'chromium_code': 1,
'pdf_engine%': 0, # 0 PDFium
},
'target_defaults': {
'cflags': [
'-fPIC',
],
},
'targets': [
{
'target_name': 'pdf',
'type': 'loadable_module',
'msvs_guid': '647863C0-C7A3-469A-B1ED-AD7283C34BED',
'dependencies': [
... | {'variables': {'chromium_code': 1, 'pdf_engine%': 0}, 'target_defaults': {'cflags': ['-fPIC']}, 'targets': [{'target_name': 'pdf', 'type': 'loadable_module', 'msvs_guid': '647863C0-C7A3-469A-B1ED-AD7283C34BED', 'dependencies': ['../base/base.gyp:base', '../net/net.gyp:net', '../ppapi/ppapi.gyp:ppapi_cpp', '../third_par... |
initials = [
"b",
"c",
"ch",
"d",
"f",
"g",
"h",
"j",
"k",
"l",
"m",
"n",
"p",
"q",
"r",
"s",
"sh",
"t",
"w",
"x",
"y",
"z",
"zh",
]
finals = [
"a1",
"a2",
"a3",
"a4",
"a5",
... | initials = ['b', 'c', 'ch', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 'sh', 't', 'w', 'x', 'y', 'z', 'zh']
finals = ['a1', 'a2', 'a3', 'a4', 'a5', 'ai1', 'ai2', 'ai3', 'ai4', 'ai5', 'an1', 'an2', 'an3', 'an4', 'an5', 'ang1', 'ang2', 'ang3', 'ang4', 'ang5', 'ao1', 'ao2', 'ao3', 'ao4', 'ao5', 'e1',... |
class Programa:
def __init__(self, nome, ano):
self._nome = nome.title()
self.ano = ano
self._likes = 0
@property
def likes(self):
return self.__likes
def dar_like(self):
self._likes += 1
@property
def nome(self):
return self._nome
@nome.se... | class Programa:
def __init__(self, nome, ano):
self._nome = nome.title()
self.ano = ano
self._likes = 0
@property
def likes(self):
return self.__likes
def dar_like(self):
self._likes += 1
@property
def nome(self):
return self._nome
@nome.s... |
# -*- coding: utf-8 -*-
def main():
s = input()
n = len(s)
ans = 0
for i in range(1, n + 1):
cur = s[i - 1]
if cur == 'U':
upper = 1
else:
upper = 2
ans += (n - i) * upper
if cur == 'U':
lower = 2
... | def main():
s = input()
n = len(s)
ans = 0
for i in range(1, n + 1):
cur = s[i - 1]
if cur == 'U':
upper = 1
else:
upper = 2
ans += (n - i) * upper
if cur == 'U':
lower = 2
else:
lower = 1
ans += (i -... |
'''
Given an absolute path for a file (Unix-style), simplify it. Or in other words, convert it to the canonical path.
In a UNIX-style file system, a period . refers to the current directory. Furthermore, a double period .. moves the directory up a level.
Note that the returned canonical path must always begin with a ... | """
Given an absolute path for a file (Unix-style), simplify it. Or in other words, convert it to the canonical path.
In a UNIX-style file system, a period . refers to the current directory. Furthermore, a double period .. moves the directory up a level.
Note that the returned canonical path must always begin with a ... |
#import In.entity
class Thodar(In.entity.Entity):
'''Thodar Entity class.
'''
entity_type = ''
entity_id = 0
#def __init__(self, data = None, items = None, **args):
#super().__init__(data, items, **args)
@IN.register('Thodar', type = 'Entitier')
class ThodarEntitier(In.entity.EntityEntitier):
'''Base T... | class Thodar(In.entity.Entity):
"""Thodar Entity class.
"""
entity_type = ''
entity_id = 0
@IN.register('Thodar', type='Entitier')
class Thodarentitier(In.entity.EntityEntitier):
"""Base Thodar Entitier"""
invoke_entity_hook = True
entity_load_all = False
@IN.register('Thodar', type='Model')
... |
# Given an array of meeting time intervals consisting of start and end times
# [[s1,e1],[s2,e2],...] (si < ei), determine if a person could attend all meetings.
#
# Example 1:
#
# Input: [[0,30],[5,10],[15,20]]
# Output: false
# Example 2:
#
# Input: [[7,10],[2,4]]
# Output: true
class Solution:
def canAttendMeet... | class Solution:
def can_attend_meetings(self, intervals):
intervals.sort(key=lambda x: [x[0]])
for i in range(len(intervals) - 1):
if intervals[i][1] > intervals[i + 1][0]:
return False
return True |
class _Object(object):
def __init__(self, name):
self.name = name
def __str__(self):
return self.name
def __repr__(self):
return "'%s'" % self.name
STRING = 'Hello world!'
INTEGER = 42
FLOAT = -1.2
BOOLEAN = True
NONE_VALUE = None
ESCAPES = 'one \\ two \\\\ ${non_existing}'
NO_VALUE... | class _Object(object):
def __init__(self, name):
self.name = name
def __str__(self):
return self.name
def __repr__(self):
return "'%s'" % self.name
string = 'Hello world!'
integer = 42
float = -1.2
boolean = True
none_value = None
escapes = 'one \\ two \\\\ ${non_existing}'
no_val... |
#!/usr/bin/python3
# iterators.py by Bill Weinman [http://bw.org/]
# This is an exercise file from Python 3 Essential Training on lynda.com
# Copyright 2010 The BearHeart Group, LLC
def main():
fh = open('lines.txt')
for line in fh.readlines():
print(line)
if __name__ == "__main__": main()
| def main():
fh = open('lines.txt')
for line in fh.readlines():
print(line)
if __name__ == '__main__':
main() |
def adder(num1, num2):
return num1 + num2
def main():
print(adder(5, 3))
main()
| def adder(num1, num2):
return num1 + num2
def main():
print(adder(5, 3))
main() |
class RateLimitExceeded(Exception):
def __init__(self, key: str, retry_after: float):
self.key = key
self.retry_after = retry_after
super().__init__()
| class Ratelimitexceeded(Exception):
def __init__(self, key: str, retry_after: float):
self.key = key
self.retry_after = retry_after
super().__init__() |
#DEFINE ALL THE FORMS HERE AS JSON
#DEFINITIONS ARE LOADED AS DIJIT WIDGETS
#VARIABLES LISTED HERE AS DICTIONARY NEEDS TO BE IMPORTED BACK INTO MODELS.PY WHEN FORMS ARE DEFINED
TASK_DETAIL_FORM_CONSTANTS = {
'name':{
'max_length': 30,
"data-dojo-type": "dij... | task_detail_form_constants = {'name': {'max_length': 30, 'data-dojo-type': 'dijit.form.ValidationTextBox', 'data-dojo-props': "'required' :true ,'regExp':'[a-zA-Z\\'-. ]+','invalidMessage':'Invalid Character' "}, 'description': {'max_length': 1000, 'data-dojo-type': 'dijit.form.TextBox', 'data-dojo-props': "'required' ... |
def standard_deviation(x):
n = len(x)
mean = sum(x) / n
ssq = sum((x_i-mean)**2 for x_i in x)
stdev = (ssq/n)**0.5
return(stdev)
| def standard_deviation(x):
n = len(x)
mean = sum(x) / n
ssq = sum(((x_i - mean) ** 2 for x_i in x))
stdev = (ssq / n) ** 0.5
return stdev |
m = int(input())
for i in range(0,m):
n = int(input())
bandera = True
for i in range(0,n):
temp = input()
for j in range(0,n):
if i==int(n/2):
if j==int(n/2):
if temp[j]!='#':
bandera=False
br... | m = int(input())
for i in range(0, m):
n = int(input())
bandera = True
for i in range(0, n):
temp = input()
for j in range(0, n):
if i == int(n / 2):
if j == int(n / 2):
if temp[j] != '#':
bandera = False
... |
# Use the file name mbox-short.txt as the file name
fname = input("Enter file name: ")
fh = open(fname)
avg = 0.0;
count = 0;
for line in fh:
if not line.startswith("X-DSPAM-Confidence:") : continue
pos = line.find(':');
substring = line[pos+1:];
snum = substring.strip();
num = float(snum);
... | fname = input('Enter file name: ')
fh = open(fname)
avg = 0.0
count = 0
for line in fh:
if not line.startswith('X-DSPAM-Confidence:'):
continue
pos = line.find(':')
substring = line[pos + 1:]
snum = substring.strip()
num = float(snum)
avg += num
count = count + 1
favg = avg / count
p... |
def factorial(num: int) -> int:
product = 1
for mult in range(1, num + 1):
product *= mult
return product
algorithm = factorial
name = 'for loop'
| def factorial(num: int) -> int:
product = 1
for mult in range(1, num + 1):
product *= mult
return product
algorithm = factorial
name = 'for loop' |
n = int(input())
for i in range(1, n+1, 2):
for j in range(i):
print("*", end="")
for j in range(n+n-i-i):
print(" ", end="")
for j in range(i):
print("*", end="")
print()
for i in range(n-2, 0, -2):
for j in range(i):
print("*", end="")
for j in range... | n = int(input())
for i in range(1, n + 1, 2):
for j in range(i):
print('*', end='')
for j in range(n + n - i - i):
print(' ', end='')
for j in range(i):
print('*', end='')
print()
for i in range(n - 2, 0, -2):
for j in range(i):
print('*', end='')
for j in range(n... |
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
def __lt__(self, other):
return self.x < other.x
def __str__(self):
return "(" + str(self.x) + "," + str(self.y) + ")"
def test():
points = [Point(2, 1), Point(1, 1)]
points.sort()
for p in points:
... | class Point:
def __init__(self, x, y):
self.x = x
self.y = y
def __lt__(self, other):
return self.x < other.x
def __str__(self):
return '(' + str(self.x) + ',' + str(self.y) + ')'
def test():
points = [point(2, 1), point(1, 1)]
points.sort()
for p in points:
... |
class UI_UL_list:
pass
| class Ui_Ul_List:
pass |
class Solution:
def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]:
curr, pre = head, None
while curr:
temp = curr.next
curr.next = pre
pre = curr
curr = temp
return pre
| class Solution:
def reverse_list(self, head: Optional[ListNode]) -> Optional[ListNode]:
(curr, pre) = (head, None)
while curr:
temp = curr.next
curr.next = pre
pre = curr
curr = temp
return pre |
expected_output = {
'vrf': {
'default': {
'address_family': {
'ipv6': {
'routes': {
'2001:0:10:204:0:30:0:2/128': {
'active': True,
'next_hop': {
... | expected_output = {'vrf': {'default': {'address_family': {'ipv6': {'routes': {'2001:0:10:204:0:30:0:2/128': {'active': True, 'next_hop': {'outgoing_interface': {'Bundle-Ether10': {'outgoing_interface': 'Bundle-Ether10', 'updated': '00:54:06'}}}, 'route': '2001:0:10:204:0:30:0:2/128', 'source_protocol': 'local', 'source... |
# http://www.codewars.com/kata/523b66342d0c301ae400003b/
def multiply(a, b):
return a * b
| def multiply(a, b):
return a * b |
# Author: AKHILESH SANTOSHWAR
# Input: root node, key
#
# Output: predecessor node, successor node
# 1. If root is NULL
# then return
# 2. if key is found then
# a. If its left subtree is not null
# Then predecessor will be the right most
# child of left subtree or left child itself.
# b.... | class Node(object):
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def find_predecessor_and_successor(self, data):
global predecessor, successor
predecessor = None
successor = None
if self is None:
return
... |
bmi = ''
while True:
input_numbers = input()
if ( '-1' == input_numbers ) or ( -1 == input_numbers.find(' ') ):
break
input_numbers = input_numbers.split()
weight = int(input_numbers[0])
height = int(input_numbers[1])
tmp = weight / ( height / 100 ) ** 2
bmi += str(tmp) + "\n"
... | bmi = ''
while True:
input_numbers = input()
if '-1' == input_numbers or -1 == input_numbers.find(' '):
break
input_numbers = input_numbers.split()
weight = int(input_numbers[0])
height = int(input_numbers[1])
tmp = weight / (height / 100) ** 2
bmi += str(tmp) + '\n'
print(bmi.strip(... |
def partition(number):
answer = set()
answer.add((number, ))
for x in range(1, number):
for y in partition(number - x):
answer.add(tuple(sorted((x, ) + y)))
return answer
def euler78():
num = -1
i = 30
while True:
i += 1
print(str(i))
... | def partition(number):
answer = set()
answer.add((number,))
for x in range(1, number):
for y in partition(number - x):
answer.add(tuple(sorted((x,) + y)))
return answer
def euler78():
num = -1
i = 30
while True:
i += 1
print(str(i))
t = len(partit... |
n = 0
row = 5
while n < row:
n += 1
end = row * 2 - 1
right = row - n
left = row + n
l = 1
while l < row * 2:
if l > right and l < left:
print("*", end='')
# print('%')
else:
print(' ', end='')
# print('$')
l += 1
print... | n = 0
row = 5
while n < row:
n += 1
end = row * 2 - 1
right = row - n
left = row + n
l = 1
while l < row * 2:
if l > right and l < left:
print('*', end='')
else:
print(' ', end='')
l += 1
print()
row = 5
for seet in range(row):
for i in ran... |
class localStorage:
def __init__(self, driver) :
self.driver = driver
def __len__(self):
return self.driver.execute_script("return window.localStorage.length;")
def items(self) :
return self.driver.execute_script( \
"var ls = window.localStorage, items = {}; ... | class Localstorage:
def __init__(self, driver):
self.driver = driver
def __len__(self):
return self.driver.execute_script('return window.localStorage.length;')
def items(self):
return self.driver.execute_script('var ls = window.localStorage, items = {}; for (var i = 0, k; i < ls.l... |
__________________________________________________________________________________________________
class Solution:
def twoSumLessThanK(self, A: List[int], K: int) -> int:
maxx = -float('inf')
for i in range(len(A)):
for j in range(i+1, len(A)):
if maxx < A[i] +A[j] and A[... | __________________________________________________________________________________________________
class Solution:
def two_sum_less_than_k(self, A: List[int], K: int) -> int:
maxx = -float('inf')
for i in range(len(A)):
for j in range(i + 1, len(A)):
if maxx < A[i] + A[... |
#!/usr/bin/env python
'''@package docstring
Just a giant list of processes and properties
'''
processes = {
'DY1JetsToLL_M-10to50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8':('DY1JetsToLL_M-10to50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8','MC',729.726349),
'DY2JetsToLL_M-10to50_TuneCUETP8M1_13TeV-madgraphMLM-pyth... | """@package docstring
Just a giant list of processes and properties
"""
processes = {'DY1JetsToLL_M-10to50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8': ('DY1JetsToLL_M-10to50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8', 'MC', 729.726349), 'DY2JetsToLL_M-10to50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8': ('DY2JetsToLL_M-10to50_Tun... |
src = ['board.c']
component = aos_board_component('board_mk3060', 'moc108', src)
aos_global_config.add_ld_files('memory.ld.S')
supported_targets="helloworld linuxapp meshapp uDataapp networkapp linkkitapp"
build_types="release"
| src = ['board.c']
component = aos_board_component('board_mk3060', 'moc108', src)
aos_global_config.add_ld_files('memory.ld.S')
supported_targets = 'helloworld linuxapp meshapp uDataapp networkapp linkkitapp'
build_types = 'release' |
#!/usr/bin/env python3
no_c = __import__('5-no_c').no_c
print(no_c("a software development program"))
print(no_c("Chicago"))
print(no_c("C is fun!"))
| no_c = __import__('5-no_c').no_c
print(no_c('a software development program'))
print(no_c('Chicago'))
print(no_c('C is fun!')) |
{
7 : {
"operator" : "join",
"multimatch" : False,
},
9 : {
"operator" : "selection",
"selectivity" : 0.5
},
10 : {
"operator" : "join",
"multimatch" : False,
"selectivity" : 0.04
},
12 : {
"operator" : "selection",
... | {7: {'operator': 'join', 'multimatch': False}, 9: {'operator': 'selection', 'selectivity': 0.5}, 10: {'operator': 'join', 'multimatch': False, 'selectivity': 0.04}, 12: {'operator': 'selection', 'selectivity': 0.48}, 13: {'operator': 'join', 'multimatch': True, 'selectivity': 0.09}, 3: {'operator': 'selection', 'select... |
class Solution:
# @param num, a list of integer
# @return an integer
def findPeakElement(self, num):
left = 0
right = len(num) - 1
while left <= right:
mid = (left + right) / 2
if not mid:
leftValue = num[mid] - 1
else:... | class Solution:
def find_peak_element(self, num):
left = 0
right = len(num) - 1
while left <= right:
mid = (left + right) / 2
if not mid:
left_value = num[mid] - 1
else:
left_value = num[mid - 1]
if mid + 1 == l... |
#==========================================================================
# this choice mechanism is obviously stupid, but it's here to remind us
# that this is intended as a source of platform-specific data, and so we
# should be making changes to a specific platform's section, rather than
# just adding code all wi... | target_platform = 'ironpython'
source_platform = 'win32'
if TARGET_PLATFORM == 'ironpython' and SOURCE_PLATFORM == 'win32':
ictype_2_mgdtype = {'obj': 'object', 'ptr': 'IntPtr', 'str': 'string', 'void': 'void', 'char': 'byte', 'int': 'int', 'uint': 'uint', 'long': 'int', 'ulong': 'uint', 'llong': 'long', 'ullong': ... |
ten_things = "Apples Oranges Crows Telephone Light Sugar"
print("Wait there are not 10 things in that list. Let's fix that.")
stuff = ten_things.split(' ')
more_stuff = ["Day", "Night", "Song", "Frisbee",
"Corn", "Banana", "Girl", "Boy"]
while len(stuff) != 10:
next_one = more_stuff.pop()
pr... | ten_things = 'Apples Oranges Crows Telephone Light Sugar'
print("Wait there are not 10 things in that list. Let's fix that.")
stuff = ten_things.split(' ')
more_stuff = ['Day', 'Night', 'Song', 'Frisbee', 'Corn', 'Banana', 'Girl', 'Boy']
while len(stuff) != 10:
next_one = more_stuff.pop()
print('Adding: ', next... |
def playerIcons(poi):
if poi['id'] == 'Player':
poi['icon'] = "https://overviewer.org/avatar/%s" % poi['EntityId']
return "Last known location for %s" % poi['EntityId']
def signFilter(poi):
if poi['id'] == 'Sign' or poi['id'] == 'minecraft:sign':
if poi['Text4'] == '-- RENDER --':
... | def player_icons(poi):
if poi['id'] == 'Player':
poi['icon'] = 'https://overviewer.org/avatar/%s' % poi['EntityId']
return 'Last known location for %s' % poi['EntityId']
def sign_filter(poi):
if poi['id'] == 'Sign' or poi['id'] == 'minecraft:sign':
if poi['Text4'] == '-- RENDER --':
... |
def str_to_int(s):
ctr = i = 0
for c in reversed(s):
i += (ord(c) - 48) * (10 ** ctr)
ctr += 1
return i
print()
for s in ('0', '1', '2', '3', '12', '123', '234', '456', '567'):
i = str_to_int(s)
print("s = {}, i = {} |".format(s, i), end=' ')
print()
print()
for i in range(50):
... | def str_to_int(s):
ctr = i = 0
for c in reversed(s):
i += (ord(c) - 48) * 10 ** ctr
ctr += 1
return i
print()
for s in ('0', '1', '2', '3', '12', '123', '234', '456', '567'):
i = str_to_int(s)
print('s = {}, i = {} |'.format(s, i), end=' ')
print()
print()
for i in range(50):
s =... |
# animals = ["Gully", "Rhubarb", "Zephyr", "Henry"]
# for animal in enumerate(animals): # creates a list of Tuples
# print(animal) # (0, 'Gully')
# # (1, 'Rhubarb')
# # (2, 'Zephyr')
# # (3, 'Henry')
# animals = ["Gully", "Rhubarb", "Zephyr", "Henry"... | animals = ['Gully', 'Rhubarb', 'Zephyr', 'Henry']
for (index, animal) in enumerate(animals):
print(f'{index}.\t {animal}') |
def lines(file):
for line in file:
yield line
yield "\n"
def blocks(file):
block = []
for line in lines(file):
if line.strip():
block.append(line)
elif block:
yield "".join(block).strip()
block = []
| def lines(file):
for line in file:
yield line
yield '\n'
def blocks(file):
block = []
for line in lines(file):
if line.strip():
block.append(line)
elif block:
yield ''.join(block).strip()
block = [] |
# coding: utf-8
cry_names = [
'Nidoran_M',
'Nidoran_F',
'Slowpoke',
'Kangaskhan',
'Charmander',
'Grimer',
'Voltorb',
'Muk',
'Oddish',
'Raichu',
'Nidoqueen',
'Diglett',
'Seel',
'Drowzee',
'Pidgey',
'Bulbasaur',
'Spearow',
'Rhydon',
'Golem',
'Blastoise',
'Pidgeotto',
'Weedle',
'Caterpie',
'Ekans'... | cry_names = ['Nidoran_M', 'Nidoran_F', 'Slowpoke', 'Kangaskhan', 'Charmander', 'Grimer', 'Voltorb', 'Muk', 'Oddish', 'Raichu', 'Nidoqueen', 'Diglett', 'Seel', 'Drowzee', 'Pidgey', 'Bulbasaur', 'Spearow', 'Rhydon', 'Golem', 'Blastoise', 'Pidgeotto', 'Weedle', 'Caterpie', 'Ekans', 'Fearow', 'Clefairy', 'Venonat', 'Lapras... |
a = []
b = []
for m in range(101):
a.append(300 - m * 100)
for n in range(101):
b.append(a[n] + 200)
c = 0
for a in b:
if a < 0:
c += 1
print(c) | a = []
b = []
for m in range(101):
a.append(300 - m * 100)
for n in range(101):
b.append(a[n] + 200)
c = 0
for a in b:
if a < 0:
c += 1
print(c) |
def translate_table(line, suite_pos):
fields = line.split("|")
suite_name = fields[suite_pos]
fields = suite_name.split("_")
other = []
if fields[0] == "ade":
template = "thereis"
if fields[1] == "same":
strategy = "ADE-SI"
if fields[-1] == "tisce":
... | def translate_table(line, suite_pos):
fields = line.split('|')
suite_name = fields[suite_pos]
fields = suite_name.split('_')
other = []
if fields[0] == 'ade':
template = 'thereis'
if fields[1] == 'same':
strategy = 'ADE-SI'
if fields[-1] == 'tisce':
... |
firstStep = "1-1"
print(firstStep)
row = 1
column = 1
column += 1
while True:
answer = int(input())
if column > 10:
row += 1
column = 1
response = str(row) + "-" + str(column)
column += 1
print(response)
| first_step = '1-1'
print(firstStep)
row = 1
column = 1
column += 1
while True:
answer = int(input())
if column > 10:
row += 1
column = 1
response = str(row) + '-' + str(column)
column += 1
print(response) |
class node:
def __init__(self, data):
self.data = data
self.next = None
class linkedList:
def __init__(self):
self.head = None
def printList(self):
temp = self.head
while (temp):
print(temp.data, end=' ')
temp = temp.next
if _... | class Node:
def __init__(self, data):
self.data = data
self.next = None
class Linkedlist:
def __init__(self):
self.head = None
def print_list(self):
temp = self.head
while temp:
print(temp.data, end=' ')
temp = temp.next
if __name__ == '__m... |
class Solution:
def minMoves2(self, nums: List[int]) -> int:
temp = []
nums.sort()
medile_p = len(nums) // 2
medile_num = nums[medile_p]
nums.remove(medile_num)
for i in nums:
if medile_num >= i:
step = medile_num - i
temp.a... | class Solution:
def min_moves2(self, nums: List[int]) -> int:
temp = []
nums.sort()
medile_p = len(nums) // 2
medile_num = nums[medile_p]
nums.remove(medile_num)
for i in nums:
if medile_num >= i:
step = medile_num - i
temp... |
class Sms:
def __init__(self, number: str, message: str) -> None:
self.to_phone = number
self.message_body = message
def get(self) -> dict:
return {
"to_phone": self.to_phone,
"message_body": self.message_body,
}
| class Sms:
def __init__(self, number: str, message: str) -> None:
self.to_phone = number
self.message_body = message
def get(self) -> dict:
return {'to_phone': self.to_phone, 'message_body': self.message_body} |
files_c=[
'C/7zBuf2.c',
'C/7zCrc.c',
'C/7zCrcOpt.c',
'C/7zStream.c',
'C/Aes.c',
'C/Alloc.c',
'C/Bcj2.c',
'C/Bcj2Enc.c',
'C/Blake2s.c',
'C/Bra.c',
'C/Bra86.c',
'C/BraIA64.c',
'C/BwtSort.c',
'C/CpuArch.c',
'C/Delta.c',
'C/HuffEnc.c',
'C/LzFind.c',
'C/LzFindMt.c',
'C/Lzma2Dec.c',
'C/Lzma2Enc.c',
'C/L... | files_c = ['C/7zBuf2.c', 'C/7zCrc.c', 'C/7zCrcOpt.c', 'C/7zStream.c', 'C/Aes.c', 'C/Alloc.c', 'C/Bcj2.c', 'C/Bcj2Enc.c', 'C/Blake2s.c', 'C/Bra.c', 'C/Bra86.c', 'C/BraIA64.c', 'C/BwtSort.c', 'C/CpuArch.c', 'C/Delta.c', 'C/HuffEnc.c', 'C/LzFind.c', 'C/LzFindMt.c', 'C/Lzma2Dec.c', 'C/Lzma2Enc.c', 'C/LzmaDec.c', 'C/LzmaEnc... |
# multiple.sequences.while.py
people = ["Conrad", "Deepak", "Heinrich", "Tom"]
ages = [29, 30, 34, 36]
position = 0
while position < len(people):
person = people[position]
age = ages[position]
print(person, age)
position += 1
| people = ['Conrad', 'Deepak', 'Heinrich', 'Tom']
ages = [29, 30, 34, 36]
position = 0
while position < len(people):
person = people[position]
age = ages[position]
print(person, age)
position += 1 |
{
'target_defaults': {
'configurations': {
'Debug': {
'defines': [ 'DEBUG', '_DEBUG' ]
},
'Release': {
'defines': [ 'NDEBUG' ]
}
}
},
'targets': [
{
'target_name': 'mappedbuffer',
'sources': [
'src/mappedbuffer.cc'
]
}
]
}
| {'target_defaults': {'configurations': {'Debug': {'defines': ['DEBUG', '_DEBUG']}, 'Release': {'defines': ['NDEBUG']}}}, 'targets': [{'target_name': 'mappedbuffer', 'sources': ['src/mappedbuffer.cc']}]} |
# Databricks notebook source
# MAGIC %md
# MAGIC # Project Timesheet Source Data
# COMMAND ----------
spark.conf.set(
"fs.azure.account.key.dmstore1.blob.core.windows.net",
"s8aN23JQ1EboPql5lx++0zQOyYrYC2EvT7NbgewR/8yAmQzpPfojntRWrCr4XOuonMowUUXsEzSxP11Jzd3kTg==")
# COMMAND ----------
# MAGIC %sql
# MAGIC creat... | spark.conf.set('fs.azure.account.key.dmstore1.blob.core.windows.net', 's8aN23JQ1EboPql5lx++0zQOyYrYC2EvT7NbgewR/8yAmQzpPfojntRWrCr4XOuonMowUUXsEzSxP11Jzd3kTg==') |
class FormatSingle:
def __init__(self, singleData: dict):
self.data = singleData
def getMonthDay(self):
fullData = self.data["TimePeriod"]["Start"]
return fullData[5:]
def getAmount(self):
stringAmountData = self.data["Total"]["BlendedCost"]["Amount"]
return float(... | class Formatsingle:
def __init__(self, singleData: dict):
self.data = singleData
def get_month_day(self):
full_data = self.data['TimePeriod']['Start']
return fullData[5:]
def get_amount(self):
string_amount_data = self.data['Total']['BlendedCost']['Amount']
return ... |
def login_to_foxford(driver):
'''Foxford login'''
driver.get("about:blank")
driver.switch_to.window(driver.window_handles[0]) # <--- Needed in some cases when something popups
driver.get("https://foxford.ru/user/login/")
| def login_to_foxford(driver):
"""Foxford login"""
driver.get('about:blank')
driver.switch_to.window(driver.window_handles[0])
driver.get('https://foxford.ru/user/login/') |
# -*- coding: utf-8 -*-
LOG_TYPES = {
"s": {"event": "Success Login", "level": 1}, # Info
"seacft": {"event": "Success Exchange", "level": 1}, # Info
"seccft": {"event": "Success Exchange (Client Credentials)", "level": 1}, # Info
"feacft": {"event": "Failed Exchange", "level": 3}, # Error
"fec... | log_types = {'s': {'event': 'Success Login', 'level': 1}, 'seacft': {'event': 'Success Exchange', 'level': 1}, 'seccft': {'event': 'Success Exchange (Client Credentials)', 'level': 1}, 'feacft': {'event': 'Failed Exchange', 'level': 3}, 'feccft': {'event': 'Failed Exchange (Client Credentials)', 'level': 3}, 'f': {'eve... |
# This sample tests error detection for certain cases that
# are explicitly disallowed by PEP 572 for assignment expressions
# when used in context of a list comprehension.
pairs = []
stuff = []
# These should generate an error because assignment
# expressions aren't allowed within an iterator expression
# in a "for"... | pairs = []
stuff = []
[x for (x, y) in (pairs2 := pairs) if x % 2 == 0]
[x for (x, y) in [1, 2, 3, (pairs2 := pairs)] if x % 2 == 0]
{x: y for (x, y) in (pairs2 := pairs) if x % 2 == 0}
{x for (x, y) in (pairs2 := pairs) if x % 2 == 0}
foo = (x for (x, y) in [1, 2, 3, (pairs2 := pairs)] if x % 2 == 0)
[[(j := j) for i ... |
class Component:
def __init__(self, id_, name_):
self.id = id_
self.name = name_
| class Component:
def __init__(self, id_, name_):
self.id = id_
self.name = name_ |
class Mods:
__slots__ = ('map_changing', 'nf', 'ez', 'hd', 'hr', 'dt', 'ht', 'nc',
'fl', 'so', 'speed_changing', 'map_changing')
def __init__(self, mods_str=''):
self.nf = False
self.ez = False
self.hd = False
self.hr = False
self.dt = False
self... | class Mods:
__slots__ = ('map_changing', 'nf', 'ez', 'hd', 'hr', 'dt', 'ht', 'nc', 'fl', 'so', 'speed_changing', 'map_changing')
def __init__(self, mods_str=''):
self.nf = False
self.ez = False
self.hd = False
self.hr = False
self.dt = False
self.ht = False
... |
class Solution:
def maxNumOfSubstrings(self, s: str) -> List[str]:
start, end = {}, {}
for i, c in enumerate(s):
if c not in start:
start[c] = i
end[c] = i
def checkSubstring(i):
curr = i
right = end[s[curr]]
... | class Solution:
def max_num_of_substrings(self, s: str) -> List[str]:
(start, end) = ({}, {})
for (i, c) in enumerate(s):
if c not in start:
start[c] = i
end[c] = i
def check_substring(i):
curr = i
right = end[s[curr]]
... |
'''
this code is for using PySpark to read straight from S3 bucket instead of using the default data source (AWS Glue Data Catalog).
'''
#this is the default line that we will change:
datasource0 = glueContext.create_dynamic_frame.from_catalog(database = "<DATABASE_NAME>", table_name = "<TABLE_NAME>", transformation... | """
this code is for using PySpark to read straight from S3 bucket instead of using the default data source (AWS Glue Data Catalog).
"""
datasource0 = glueContext.create_dynamic_frame.from_catalog(database='<DATABASE_NAME>', table_name='<TABLE_NAME>', transformation_ctx='datasource0')
obj_list = ['s3://<OBJECT_PATH>'... |
class Solution:
def removePalindromeSub(self, s: str) -> int:
if not s or len(s) == 0:
return 0
left, right = 0, len(s) - 1
while left < right and s[left] == s[right]:
left += 1
right -= 1
if left >= right:
return 1... | class Solution:
def remove_palindrome_sub(self, s: str) -> int:
if not s or len(s) == 0:
return 0
(left, right) = (0, len(s) - 1)
while left < right and s[left] == s[right]:
left += 1
right -= 1
if left >= right:
return 1
else:... |
radious=2.5
area=3.14*radious**2
print("area of circle",area)
circum=2*3.14*radious
print("circumof",circum)
| radious = 2.5
area = 3.14 * radious ** 2
print('area of circle', area)
circum = 2 * 3.14 * radious
print('circumof', circum) |
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 09/10/14 #3623 randerso Manually created, do not regenerate
#
class SiteActivationNotification(object):
def __init__(self... | class Siteactivationnotification(object):
def __init__(self):
self.type = None
self.status = None
self.primarySite = None
self.modifiedSite = None
self.runMode = None
self.serverName = None
self.pluginName = None
def get_type(self):
return self.t... |
#!/usr/bin/env python3
# Change the variables and rename this file to secret.py
# add your url here (without trailing / at the end!)
url = "https://home-assistant.duckdns.org"
# get a "Long-Lived Access Token" at YOUR_URL/profile
token = "AJKSDHHASJKDHA871263291873KHGSDKAJSGD"
| url = 'https://home-assistant.duckdns.org'
token = 'AJKSDHHASJKDHA871263291873KHGSDKAJSGD' |
# pylint: skip-file
class OadmPolicyException(Exception):
''' Registry Exception Class '''
pass
class OadmPolicyUserConfig(OpenShiftCLIConfig):
''' RegistryConfig is a DTO for the registry. '''
def __init__(self, namespace, kubeconfig, policy_options):
super(OadmPolicyUserConfig, self).__init... | class Oadmpolicyexception(Exception):
""" Registry Exception Class """
pass
class Oadmpolicyuserconfig(OpenShiftCLIConfig):
""" RegistryConfig is a DTO for the registry. """
def __init__(self, namespace, kubeconfig, policy_options):
super(OadmPolicyUserConfig, self).__init__(policy_options['n... |
# Stage 3/6: More interaction
# Description
# We are going to make our program more complex. As you remember,
# the conicoin rate was fixed in the previous stage. But in the real world,
# things are different. It's time to write a program that takes your
# conicoins and an up-to-date conicoin exchange rate, then count... | class Currencyconverter:
def __init__(self):
self.exchange = 0
self.dollars = 0
self.coins = 0
self.conicoin_question = 'Please, enter the number of conicoins you have: '
self.exchange_question = 'Please, enter the exchange rate: '
self.amount_message = 'The total am... |
class ForkName:
Frontier = 'Frontier'
Homestead = 'Homestead'
EIP150 = 'EIP150'
EIP158 = 'EIP158'
Byzantium = 'Byzantium'
Constantinople = 'Constantinople'
Metropolis = 'Metropolis'
ConstantinopleFix = 'ConstantinopleFix'
Istanbul = 'Istanbul'
Berlin = 'Berlin'
London = 'Lond... | class Forkname:
frontier = 'Frontier'
homestead = 'Homestead'
eip150 = 'EIP150'
eip158 = 'EIP158'
byzantium = 'Byzantium'
constantinople = 'Constantinople'
metropolis = 'Metropolis'
constantinople_fix = 'ConstantinopleFix'
istanbul = 'Istanbul'
berlin = 'Berlin'
london = 'Lon... |
class fruta:
def __init__ (self,nombre, calorias, vitamina_c, porcentaje_fibra, porcentaje_potasio):
self.nombre = nombre
self.calorias = calorias
self.vitamina_c = vitamina_c
self.porcentaje_fibra = porcentaje_fibra
self.porcentaje_potasio = porcentaje_potasio
def ... | class Fruta:
def __init__(self, nombre, calorias, vitamina_c, porcentaje_fibra, porcentaje_potasio):
self.nombre = nombre
self.calorias = calorias
self.vitamina_c = vitamina_c
self.porcentaje_fibra = porcentaje_fibra
self.porcentaje_potasio = porcentaje_potasio
def get_... |
# this is an embedded Python script it's really on GitHub
# and this is only a reference - so when it changes people
# will see the change on the webpage .. GOODTIMES !
pid = Runtime.start("pid","PID") | pid = Runtime.start('pid', 'PID') |
def fram_write8(addr: number, val: number):
pins.digital_write_pin(DigitalPin.P16, 0)
pins.spi_write(OPCODE_WRITE)
pins.spi_write(addr >> 8)
pins.spi_write(addr & 0xff)
pins.spi_write(val)
pins.digital_write_pin(DigitalPin.P16, 1)
def on_button_pressed_a():
fram_write8(0, 10)
basic.paus... | def fram_write8(addr: number, val: number):
pins.digital_write_pin(DigitalPin.P16, 0)
pins.spi_write(OPCODE_WRITE)
pins.spi_write(addr >> 8)
pins.spi_write(addr & 255)
pins.spi_write(val)
pins.digital_write_pin(DigitalPin.P16, 1)
def on_button_pressed_a():
fram_write8(0, 10)
basic.pause... |
class GumoBaseError(RuntimeError):
pass
class ConfigurationError(GumoBaseError):
pass
class ServiceAccountConfigurationError(ConfigurationError):
pass
class ObjectNotoFoundError(GumoBaseError):
pass
| class Gumobaseerror(RuntimeError):
pass
class Configurationerror(GumoBaseError):
pass
class Serviceaccountconfigurationerror(ConfigurationError):
pass
class Objectnotofounderror(GumoBaseError):
pass |
class CrudBackend(object):
def __init__(self):
pass
def create(self, key, data=None):
return NotImplementedError()
def read(self, key):
return NotImplementedError()
def update(self, key, data):
return NotImplementedError()
def delete(self, key):
return Not... | class Crudbackend(object):
def __init__(self):
pass
def create(self, key, data=None):
return not_implemented_error()
def read(self, key):
return not_implemented_error()
def update(self, key, data):
return not_implemented_error()
def delete(self, key):
ret... |
class CommonInfoAdminMixin:
def get_readonly_fields(self, request, obj=None):
return super().get_readonly_fields(request, obj) + ('created_by', 'lastmodified_by', 'created_at',
'lastmodified_at')
def save_form(self, request, form, change):
... | class Commoninfoadminmixin:
def get_readonly_fields(self, request, obj=None):
return super().get_readonly_fields(request, obj) + ('created_by', 'lastmodified_by', 'created_at', 'lastmodified_at')
def save_form(self, request, form, change):
if form.instance and request.user:
if not ... |
# krotki
k = ('a', 1, 'qqq', {1: 'x', 2: 'y'})
print(k)
print(k[0])
print(k[-1])
print(k[1:-1])
print('------operacje ----------')
# k.append('www')
# k.remove('qq')
print(k.index(1))
# print k.index('b')
print(k.count('b'))
print(len(k))
k[-1][1] = 'zzz'
print(k)
print('a' in k, 'z' in k)
# krotka jako lista
l = ... | k = ('a', 1, 'qqq', {1: 'x', 2: 'y'})
print(k)
print(k[0])
print(k[-1])
print(k[1:-1])
print('------operacje ----------')
print(k.index(1))
print(k.count('b'))
print(len(k))
k[-1][1] = 'zzz'
print(k)
print('a' in k, 'z' in k)
l = list(k)
print(l)
l[0] = 'x'
k = tuple(l)
print(k)
print(dir(tuple))
x = []
x.append(x)
l =... |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | def _assemble_versioned_impl(ctx):
if not ctx.attr.version_file:
version_file = ctx.actions.declare_file(ctx.attr.name + '__do_not_reference.version')
version = ctx.var.get('version', '0.0.0')
ctx.actions.run_shell(inputs=[], outputs=[version_file], command='echo {} > {}'.format(version, ver... |
MODAL_REQUEST = {
"callback_id": "change_request_review",
"type": "modal",
"title": {
"type": "plain_text",
"text": "Switcher Change Request"
},
"submit": {
"type": "plain_text",
"text": "Submit"
},
"close": {
"type": "plain_text",
"text": "Cancel"
},
"blocks": [
{
"type": "context",
"eleme... | modal_request = {'callback_id': 'change_request_review', 'type': 'modal', 'title': {'type': 'plain_text', 'text': 'Switcher Change Request'}, 'submit': {'type': 'plain_text', 'text': 'Submit'}, 'close': {'type': 'plain_text', 'text': 'Cancel'}, 'blocks': [{'type': 'context', 'elements': [{'type': 'plain_text', 'text': ... |
# File: wildfire_consts.py
#
# Copyright (c) 2016-2022 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 ap... | wildfire_json_base_url = 'base_url'
wildfire_json_task_id = 'task_id'
wildfire_json_api_key = 'api_key'
wildfire_json_malware = 'malware'
wildfire_json_task_id = 'id'
wildfire_json_url = 'url'
wildfire_json_hash = 'hash'
wildfire_json_platform = 'platform'
wildfire_json_poll_timeout_mins = 'timeout'
wildfire_err_unable... |
birds = ( ('Passerculus sandwichensis','Savannah sparrow',18.7),
('Delichon urbica','House martin',19),
('Junco phaeonotus','Yellow-eyed junco',19.5),
('Junco hyemalis','Dark-eyed junco',19.6),
('Tachycineata bicolor','Tree swallow',20.2),
)
#(1) Write three separate li... | birds = (('Passerculus sandwichensis', 'Savannah sparrow', 18.7), ('Delichon urbica', 'House martin', 19), ('Junco phaeonotus', 'Yellow-eyed junco', 19.5), ('Junco hyemalis', 'Dark-eyed junco', 19.6), ('Tachycineata bicolor', 'Tree swallow', 20.2)) |
COLORS = {
'PROBLEM': 'red',
'RECOVERY': 'green',
'UP': 'green',
'ACKNOWLEDGEMENT': 'purple',
'FLAPPINGSTART': 'yellow',
'WARNING': 'yellow',
'UNKNOWN': 'gray',
'CRITICAL': 'red',
'FLAPPINGEND': 'green',
'FLAPPINGSTOP': 'green',
'FLAPPINGDISABLED': 'purple',
'DOWNTIMESTAR... | colors = {'PROBLEM': 'red', 'RECOVERY': 'green', 'UP': 'green', 'ACKNOWLEDGEMENT': 'purple', 'FLAPPINGSTART': 'yellow', 'WARNING': 'yellow', 'UNKNOWN': 'gray', 'CRITICAL': 'red', 'FLAPPINGEND': 'green', 'FLAPPINGSTOP': 'green', 'FLAPPINGDISABLED': 'purple', 'DOWNTIMESTART': 'red', 'DOWNTIMESTOP': 'green', 'DOWNTIMEEND'... |
def load(h):
return ({'abbr': 0,
'code': 0,
'title': 'Mass density (concentration)',
'units': 'kg m-3'},
{'abbr': 1,
'code': 1,
'title': 'Column-integrated mass density',
'units': 'kg m-2'},
{'abbr': 2,
... | def load(h):
return ({'abbr': 0, 'code': 0, 'title': 'Mass density (concentration)', 'units': 'kg m-3'}, {'abbr': 1, 'code': 1, 'title': 'Column-integrated mass density', 'units': 'kg m-2'}, {'abbr': 2, 'code': 2, 'title': 'Mass mixing ratio (mass fraction in air)', 'units': 'kg/kg'}, {'abbr': 3, 'code': 3, 'title'... |
#===========================================================================
#
# Port to use for the web server. Configure the Eagle to use this
# port as it's 'cloud provider' using http://host:PORT
#
#===========================================================================
httpPort = 22042
#=====================... | http_port = 22042
mqtt_energy = 'power/elec/Home/energy'
mqtt_power = 'power/elec/Home/power'
mqtt_price = 'power/elec/Home/price'
mqtt_rate_label = 'power/elec/Home/ratelabel'
log_file = '/var/log/tHome/eagle.log'
log_level = 20 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.