content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
def print_separator():
#print('--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------')
print('')
def print_components_menu(generate, download, convert, c... | def print_separator():
print('')
def print_components_menu(generate, download, convert, clean, windows):
print_separator()
print_separator()
print(' * Active components')
print(' -> Generator: ', generate)
print(' -> Downloader: ', download)
print(' -> Converter: ', convert)
... |
def validate_morph(morph):
if not "key" in morph:
print(" - key is missing")
return False
if not "type" in morph:
print(" - type is missing")
return False
if not "origin" in morph:
print(" - origin is missing")
return False
morph_type = morph["type"]
... | def validate_morph(morph):
if not 'key' in morph:
print(' - key is missing')
return False
if not 'type' in morph:
print(' - type is missing')
return False
if not 'origin' in morph:
print(' - origin is missing')
return False
morph_type = morph['type']
i... |
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) |
CMD_GROUP_CONFIG = {
"auth": "Command group for generating authorization tokens",
"sys": "Command group for Mix API system scope",
"ns": "Command group for Mix namespace",
'project': "Command group for Mix API project scope",
'channel': "Command group for Mix API (project) channel scope",
'job':... | cmd_group_config = {'auth': 'Command group for generating authorization tokens', 'sys': 'Command group for Mix API system scope', 'ns': 'Command group for Mix namespace', 'project': 'Command group for Mix API project scope', 'channel': 'Command group for Mix API (project) channel scope', 'job': 'Command group for Mix A... |
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) |
# -*- coding: utf-8 -*-
"""Pystapler: application server framework for Python.
This framework is inspired by Kohsuke Kawaguchi's Stapler framework for Java
(stapler.kohsuke.org), but obviously adapted to Python. It implements WSGI
support using the popular Werkzeug utility library.
See the README.md file for more inf... | """Pystapler: application server framework for Python.
This framework is inspired by Kohsuke Kawaguchi's Stapler framework for Java
(stapler.kohsuke.org), but obviously adapted to Python. It implements WSGI
support using the popular Werkzeug utility library.
See the README.md file for more information.
Example Usage... |
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 |
'''
Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the image below.
American keyboard
Example 1:
Input: ["Hello", "Alaska", "Dad", "Peace"]
Output: ["Alaska", "Dad"]
'''
class Solution(object):
def findWords(self, words):
... | """
Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the image below.
American keyboard
Example 1:
Input: ["Hello", "Alaska", "Dad", "Peace"]
Output: ["Alaska", "Dad"]
"""
class Solution(object):
def find_words(self, words):
... |
ALL_EVENTS = """
query (
$studyId: String,
$fileId: String,
$versionId: String,
$createdAt_Gt: DateTime,
$createdAt_Lt: DateTime,
$username: String,
$eventType: String,
) {
allEvents(
studyKfId: $studyId,
fileKfId: $fileId,
versionKfId: $versionId,
created... | all_events = '\nquery (\n $studyId: String,\n $fileId: String,\n $versionId: String,\n $createdAt_Gt: DateTime,\n $createdAt_Lt: DateTime,\n $username: String,\n $eventType: String,\n) {\n allEvents(\n studyKfId: $studyId,\n fileKfId: $fileId,\n versionKfId: $versionId,\n ... |
"""
Given an array S of n integers, are there elements a, b, c in S
such that a + b + c = 0?
Find all unique triplets in the array which gives the sum of zero.
Note: The solution set must not contain duplicate triplets.
For example, given array S = [-1, 0, 1, 2, -1, -4],
A solution set is:
[
[-1, 0, 1],
[-1, -1,... | """
Given an array S of n integers, are there elements a, b, c in S
such that a + b + c = 0?
Find all unique triplets in the array which gives the sum of zero.
Note: The solution set must not contain duplicate triplets.
For example, given array S = [-1, 0, 1, 2, -1, -4],
A solution set is:
[
[-1, 0, 1],
[-1, -1,... |
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... |
# Modified from: https://github.com/junit-team/junit5-samples/tree/master/junit5-jupiter-starter-bazel
load("@rules_jvm_external//:defs.bzl", "DEFAULT_REPOSITORY_NAME")
load("@rules_jvm_external//:specs.bzl", "maven")
load("//tools:maven_utils.bzl", "format_maven_jar_dep_name", "format_maven_jar_name")
"""External de... | load('@rules_jvm_external//:defs.bzl', 'DEFAULT_REPOSITORY_NAME')
load('@rules_jvm_external//:specs.bzl', 'maven')
load('//tools:maven_utils.bzl', 'format_maven_jar_dep_name', 'format_maven_jar_name')
'External dependencies & java_junit5_test rule'
junit_jupiter_group_id = 'org.junit.jupiter'
junit_jupiter_artifact_id_... |
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... |
def remove_every_other(lst):
"""Return a new list of other item.
>>> lst = [1, 2, 3, 4, 5]
>>> remove_every_other(lst)
[1, 3, 5]
This should return a list, not mutate the original:
>>> lst
[1, 2, 3, 4, 5]
"""
return lst[::2]
lst = [1, 2, 3, 4, 5]
print(F"remo... | def remove_every_other(lst):
"""Return a new list of other item.
>>> lst = [1, 2, 3, 4, 5]
>>> remove_every_other(lst)
[1, 3, 5]
This should return a list, not mutate the original:
>>> lst
[1, 2, 3, 4, 5]
"""
return lst[::2]
lst = [1, 2, 3, 4, 5]
print(f'remov... |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 applicab... | intent_dict = {'book': 0, 'change': 1, 'cancel': 2, 0: 'book', 1: 'change', 2: 'cancel'}
status_dict = {'book': 0, 'no_flight': 1, 'no_reservation': 2, 'cancel': 3, 0: 'book', 1: 'no_flight', 2: 'no_reservation', 3: 'cancel'}
def intent_to_status(flight, res, intent):
"""
return status, flight
"""
if i... |
"""
PASSENGERS
"""
numPassengers = 3168
passenger_arriving = (
(3, 6, 9, 6, 1, 0, 8, 5, 3, 4, 5, 0), # 0
(4, 10, 5, 4, 2, 0, 4, 5, 6, 5, 3, 0), # 1
(4, 6, 6, 4, 2, 0, 6, 12, 3, 6, 1, 0), # 2
(3, 6, 9, 1, 2, 0, 2, 10, 1, 5, 0, 0), # 3
(5, 6, 8, 6, 3, 0, 2, 7, 9, 4, 1, 0), # 4
(4, 5, 6, 2, 2, 0, 4, 8, 3, 4,... | """
PASSENGERS
"""
num_passengers = 3168
passenger_arriving = ((3, 6, 9, 6, 1, 0, 8, 5, 3, 4, 5, 0), (4, 10, 5, 4, 2, 0, 4, 5, 6, 5, 3, 0), (4, 6, 6, 4, 2, 0, 6, 12, 3, 6, 1, 0), (3, 6, 9, 1, 2, 0, 2, 10, 1, 5, 0, 0), (5, 6, 8, 6, 3, 0, 2, 7, 9, 4, 1, 0), (4, 5, 6, 2, 2, 0, 4, 8, 3, 4, 2, 0), (6, 5, 5, 5, 2, 0, 7, 11, ... |
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... |
# HEADER: graph-level graphviz/dot attributes, including
# - default node style (e.g. rounded boxes, ovals, etc)
# - default edge style
HEADER = """
digraph{
rankdir=LR
//ranksep=0.3
node[shape=box
style="rounded,filled"
fillcolor="#FFFFCC"
fontname=helvetica fontsize=12]
edge[fontname=cour... | header = '\ndigraph{\n rankdir=LR \n //ranksep=0.3\n\n node[shape=box \n style="rounded,filled" \n fillcolor="#FFFFCC" \n fontname=helvetica fontsize=12]\n\n edge[fontname=courier fontsize=10]\n'
block = 'shape=box3d fontname=courier fillcolor="#CCFFCC"'
inedge = 'style=dashed label=in'
outedge = 'label=... |
{
'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... |
"""
Basic Heapsort program.
"""
def heapify(arr, n, i):
"""
Heapifies subtree rooted at index i
n - size of the heap
"""
largest = i
l = 2 * i + 1
r = 2 * i + 2
# see if left child of root exists and is
# greater than root
if l < n and arr[largest] < arr[l]:
largest =... | """
Basic Heapsort program.
"""
def heapify(arr, n, i):
"""
Heapifies subtree rooted at index i
n - size of the heap
"""
largest = i
l = 2 * i + 1
r = 2 * i + 2
if l < n and arr[largest] < arr[l]:
largest = l
if r < n and arr[largest] < arr[r]:
largest = r
if lar... |
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',... |
## -*- encoding: utf-8 -*-
"""
This file (./numbertheory_doctest.sage) was *autogenerated* from ./numbertheory.tex,
with sagetex.sty version 2011/05/27 v2.3.1.
It contains the contents of all the sageexample environments from this file.
You should be able to doctest this file with:
sage -t ./numbertheory_doctest.sage
I... | """
This file (./numbertheory_doctest.sage) was *autogenerated* from ./numbertheory.tex,
with sagetex.sty version 2011/05/27 v2.3.1.
It contains the contents of all the sageexample environments from this file.
You should be able to doctest this file with:
sage -t ./numbertheory_doctest.sage
It is always safe to delete ... |
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')
... |
""" Unification in SymPy
See sympy.unify.core docstring for algorithmic details
See http://matthewrocklin.com/blog/work/2012/11/01/Unification/ for discussion
"""
# from .usympy import unify, rebuild
# from .rewrite import rewriterule
| """ Unification in SymPy
See sympy.unify.core docstring for algorithmic details
See http://matthewrocklin.com/blog/work/2012/11/01/Unification/ for discussion
""" |
# 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 |
# Copyright 2015 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | def _impl(ctx):
test_code = ' \'\nload("//:compare_ids_test.bzl", "compare_ids_test")\n\ncompare_ids_test(\n name = "test_for_failure",\n id = {id},\n images = {tars},\n)\n\'\n '.format(id=repr(ctx.attr.id), tars=repr([str(i) + '.tar' for i in range(len(ctx.attr.images))]))
tar_files = []
for ta... |
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() |
def _create(src, out):
"""Creates a `struct` specifying a source file and an output file that should be used to update it.
Args:
src: A `File` designating a file in the workspace.
out: A `File` designating a file in the output directory.
Returns:
A `struct`.
"""
return stru... | def _create(src, out):
"""Creates a `struct` specifying a source file and an output file that should be used to update it.
Args:
src: A `File` designating a file in the workspace.
out: A `File` designating a file in the output directory.
Returns:
A `struct`.
"""
return stru... |
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... |
"""
Implement a function that removes all the even elements from a given list.
Name it remove_even(list).
Input:
- A list with random integers.
Output:
- A list with only odd integers
Sample Input:
- my_list = [1,2,4,5,10,6,3]
Sample Output:
- my_list = [1,5,3]
"""
def remove_even(list):
return [x for x in list... | """
Implement a function that removes all the even elements from a given list.
Name it remove_even(list).
Input:
- A list with random integers.
Output:
- A list with only odd integers
Sample Input:
- my_list = [1,2,4,5,10,6,3]
Sample Output:
- my_list = [1,5,3]
"""
def remove_even(list):
return [x for x in list ... |
# 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 BetweenRadiusFilterCriteria(object):
"""
Filter criteria for distance between two radius
"""
def __init__(self, radius1, radius2):
self._radius1 = radius1
self._radius2 = radius2
@property
def radius1(self):
return self._radius1
@property
def radius2(self... | class Betweenradiusfiltercriteria(object):
"""
Filter criteria for distance between two radius
"""
def __init__(self, radius1, radius2):
self._radius1 = radius1
self._radius2 = radius2
@property
def radius1(self):
return self._radius1
@property
def radius2(self... |
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[... |
class Command(object):
"""
This class is used to generate SQL commands. It must be the only place where
SQL commands are defined and created. If new commands must be created, it
must be added in this class.
"""
def insert(self, table: str, values: list):
"""
This method returns ... | class Command(object):
"""
This class is used to generate SQL commands. It must be the only place where
SQL commands are defined and created. If new commands must be created, it
must be added in this class.
"""
def insert(self, table: str, values: list):
"""
This method returns ... |
#!/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' |
# coding=utf-8
__all__ = ["slack_username", ]
def slack_username(user_id: str) -> str:
""" Generate a slack username macro """
return "<@{}>".format(user_id)
| __all__ = ['slack_username']
def slack_username(user_id: str) -> str:
""" Generate a slack username macro """
return '<@{}>'.format(user_id) |
#!/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... |
class Solution(object):
def fullJustify(self, words, maxWidth):
"""
:type words: List[str]
:type maxWidth: int
:rtype: List[str]
"""
lines = []
i = 0
while i < len(words):
llen = 0
cur = i
while i < len(words):
... | class Solution(object):
def full_justify(self, words, maxWidth):
"""
:type words: List[str]
:type maxWidth: int
:rtype: List[str]
"""
lines = []
i = 0
while i < len(words):
llen = 0
cur = i
while i < len(words):
... |
#==========================================================================
# 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 --':
... |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def mergeTrees(self, t1, t2):
"""
:type t1: TreeNode
:type t2: TreeNode
:rtype: TreeNode
... | class Solution(object):
def merge_trees(self, t1, t2):
"""
:type t1: TreeNode
:type t2: TreeNode
:rtype: TreeNode
"""
if t1 == None and t2 == None:
return None
if t1 == None:
return t2
if t2 == None:
return t1
... |
"""Get data from csv file"""
data = open('Real_Final_database_02.csv') #Open file database that use
alldata = data.readlines()
listdata = []
for i in alldata:
listdata.append(i.strip().split(',')) #Add data form database file into list
| """Get data from csv file"""
data = open('Real_Final_database_02.csv')
alldata = data.readlines()
listdata = []
for i in alldata:
listdata.append(i.strip().split(',')) |
# initial data input
infilename = "./day9.txt"
def readfile() -> list:
with open(infilename, "rt", encoding="utf-8") as file:
inlist = [line.strip() for line in file]
return inlist
def parse_input(inlist=readfile()) -> list:
return list(map(int, inlist))
# --- Part One ---
"""
Upon connection... | infilename = './day9.txt'
def readfile() -> list:
with open(infilename, 'rt', encoding='utf-8') as file:
inlist = [line.strip() for line in file]
return inlist
def parse_input(inlist=readfile()) -> list:
return list(map(int, inlist))
'\nUpon connection, the port outputs a series of numbers (your p... |
"""
---> Merge Sorted Array
---> Medium
"""
class Solution:
def merge(self, nums1, m: int, nums2, n: int) -> None:
p1 = m - 1
p2 = n - 1
p = n + m - 1
while p2 >= 0:
if p1 >= 0 and nums1[p1] > nums2[p2]:
nums1[p] = nums1[p1]
p1 -= 1
... | """
---> Merge Sorted Array
---> Medium
"""
class Solution:
def merge(self, nums1, m: int, nums2, n: int) -> None:
p1 = m - 1
p2 = n - 1
p = n + m - 1
while p2 >= 0:
if p1 >= 0 and nums1[p1] > nums2[p2]:
nums1[p] = nums1[p1]
p1 -= 1
... |
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 =... |
def __logging(visited, rest=[]):
if rest:
print("visited:%s\n rest:%s\n" % (visited, rest))
else:
print("visited:%s" % (visited))
is_found = False
def dfs_rec(graph, start, end, visited=[]):
global is_found
if is_found:
return visited
if start == end:
is_found =... | def __logging(visited, rest=[]):
if rest:
print('visited:%s\n rest:%s\n' % (visited, rest))
else:
print('visited:%s' % visited)
is_found = False
def dfs_rec(graph, start, end, visited=[]):
global is_found
if is_found:
return visited
if start == end:
is_found = True... |
# 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 = [] |
"""
Traduce texto de entrada en valores operables o texto
txt_hex = "C8"
txt_dec = "200"
txt_bin = "11001000"
mat_bin = [0,0,0,1,0,0,1,1]
"""
def hex_a_bin(txt_hex):
num_bin = bin(int(txt_hex,16))
txt_bin = num_bin.split("b")[1]
txt_bin = txt_bin.zfill(8)
txt_bin = txt_bin.upper()
return txt_bin
... | """
Traduce texto de entrada en valores operables o texto
txt_hex = "C8"
txt_dec = "200"
txt_bin = "11001000"
mat_bin = [0,0,0,1,0,0,1,1]
"""
def hex_a_bin(txt_hex):
num_bin = bin(int(txt_hex, 16))
txt_bin = num_bin.split('b')[1]
txt_bin = txt_bin.zfill(8)
txt_bin = txt_bin.upper()
return txt_bin
... |
# 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... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 12 14:52:40 2017
@author: Nadiar
"""
def f(a,b):
return a + b
def union(l1,l2):
temp = []
if len(l1) > len(l2):
for l in l2:
if l in l1:
temp.append(l)
else:
for l in l1:
if l ... | """
Created on Sun Feb 12 14:52:40 2017
@author: Nadiar
"""
def f(a, b):
return a + b
def union(l1, l2):
temp = []
if len(l1) > len(l2):
for l in l2:
if l in l1:
temp.append(l)
else:
for l in l1:
if l in l2:
temp.append(l)
re... |
"""
Sponge Knowledge Base
Used for testing a gRPC API server and clients.
"""
def onBeforeLoad():
sponge.addEventType("notification", RecordType().withFields([
StringType("source").withLabel("Source"),
IntegerType("severity").withLabel("Severity").withNullable(),
sponge.getType("Person", "p... | """
Sponge Knowledge Base
Used for testing a gRPC API server and clients.
"""
def on_before_load():
sponge.addEventType('notification', record_type().withFields([string_type('source').withLabel('Source'), integer_type('severity').withLabel('Severity').withNullable(), sponge.getType('Person', 'person').withNullable... |
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']}]} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.