content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class SingleConfigs:
def __init__(self, config):
self.attributes = ['n_channels']
self.configs = [config]
def sample(self):
return self.configs[0]
def largest(self):
return self.configs[0]
def smallest(self):
return self.configs[0]
def all_configs(self):
... | class Singleconfigs:
def __init__(self, config):
self.attributes = ['n_channels']
self.configs = [config]
def sample(self):
return self.configs[0]
def largest(self):
return self.configs[0]
def smallest(self):
return self.configs[0]
def all_configs(self):
... |
'''
Pattern
Enter number of rows: 5
2
242
24642
2468642
2468108642
'''
print('Number Pattern: ')
number_rows=int(input('Enter number of rows: '))
for row in range(1,number_rows+1):
for column in range(2,(row*2)+1,2):
print(column,end=' ')
for column in range(((row-1)*2),1,-2):
print(column,end=' ')... | """
Pattern
Enter number of rows: 5
2
242
24642
2468642
2468108642
"""
print('Number Pattern: ')
number_rows = int(input('Enter number of rows: '))
for row in range(1, number_rows + 1):
for column in range(2, row * 2 + 1, 2):
print(column, end=' ')
for column in range((row - 1) * 2, 1, -2):
prin... |
def layer_xy(m, n, e): # creates a list with all the outer x,y of eth layer
xy = []
for i in range(e, m + e):
xy.append([i, e]) # contains x,y of left side of this layer
for j in range(e + 1, n + e - 1):
xy.append([m - 1 + e, j]) # contains x,y of bottom side
for i in range(m - 1, -1, -1):
xy.append... | def layer_xy(m, n, e):
xy = []
for i in range(e, m + e):
xy.append([i, e])
for j in range(e + 1, n + e - 1):
xy.append([m - 1 + e, j])
for i in range(m - 1, -1, -1):
xy.append([i + e, n - 1 + e])
for j in range(n + (e - 1) - 1, e, -1):
xy.append([e, j])
return xy
... |
str1 = open("data/cpbdev.txt").read().splitlines()
str2 = open("data/cpbtest.txt").read().splitlines()+['']
str3 = open("data/cpbdev_answer1.txt").read().splitlines()
str4 = open("data/cpbtest_answer1.txt").read().splitlines()+['']
for i in range(len(str1)):
s1 = str1[i].split(' ')
s3 = str3[i].split(... | str1 = open('data/cpbdev.txt').read().splitlines()
str2 = open('data/cpbtest.txt').read().splitlines() + ['']
str3 = open('data/cpbdev_answer1.txt').read().splitlines()
str4 = open('data/cpbtest_answer1.txt').read().splitlines() + ['']
for i in range(len(str1)):
s1 = str1[i].split(' ')
s3 = str3[i].split(' ') +... |
class PropertyNames:
ID = 'ID'
Status = 'Status'
FileType = 'FileType'
FileName = 'FileName'
TableName = 'TableName'
DatabaseType = 'DatabaseType'
FileHasHeaders = 'FileHasHeaders'
Delimiter = 'Delimiter'
SheetName = 'SheetName'
CellRange = 'CellRange'
CheckTableExists = 'Ch... | class Propertynames:
id = 'ID'
status = 'Status'
file_type = 'FileType'
file_name = 'FileName'
table_name = 'TableName'
database_type = 'DatabaseType'
file_has_headers = 'FileHasHeaders'
delimiter = 'Delimiter'
sheet_name = 'SheetName'
cell_range = 'CellRange'
check_table_exi... |
class Vector:
"""
Constructor
self: a reference to the object we are creating
vals: a list of integers which are the contents of our vector
"""
def __init__(self, vals):
self.vals = (
vals # We're using the keyword self to create a field/property
)
print("A... | class Vector:
"""
Constructor
self: a reference to the object we are creating
vals: a list of integers which are the contents of our vector
"""
def __init__(self, vals):
self.vals = vals
print('Assigned values ', vals, ' to vector.')
'\n String Function\n\n Converts t... |
WAIT = 'wait'
PRESENT = 'present'
NOT_PRESENT = 'not_present'
ENABLED = 'enabled'
DISABLED = 'disabled'
CHECKED = 'checked'
UNCHECKED = 'unchecked'
TEXT = 'text'
CONTAINS = 'contains'
NOT_CONTAINS = 'not_contains'
CLASS = 'class'
DISPLAYED = 'displayed'
NOT_DISPLAYED = 'not_displayed'
EXPECTED_VISIBLE = 'expected_visib... | wait = 'wait'
present = 'present'
not_present = 'not_present'
enabled = 'enabled'
disabled = 'disabled'
checked = 'checked'
unchecked = 'unchecked'
text = 'text'
contains = 'contains'
not_contains = 'not_contains'
class = 'class'
displayed = 'displayed'
not_displayed = 'not_displayed'
expected_visible = 'expected_visib... |
class Node:
def __init__(self, data=None, left=None, right=None):
self.data = data
self.left = left
self.right = right
def __str__(self):
return "\n".join(Node.pretty_string(self, 0))
@staticmethod
def pretty_string(root, depth):
if not root:
return ... | class Node:
def __init__(self, data=None, left=None, right=None):
self.data = data
self.left = left
self.right = right
def __str__(self):
return '\n'.join(Node.pretty_string(self, 0))
@staticmethod
def pretty_string(root, depth):
if not root:
return... |
# model settings
norm_cfg = dict(type='BN', requires_grad=True, momentum=0.01)
model = dict(
type='EncoderDecoder',
backbone=dict(
type='FastSCNN',
downsample_dw_channels=(32, 48),
global_in_channels=64,
global_block_channels=(64, 96, 128),
global_block_strides=(2, 2, 1),... | norm_cfg = dict(type='BN', requires_grad=True, momentum=0.01)
model = dict(type='EncoderDecoder', backbone=dict(type='FastSCNN', downsample_dw_channels=(32, 48), global_in_channels=64, global_block_channels=(64, 96, 128), global_block_strides=(2, 2, 1), global_out_channels=128, higher_in_channels=64, lower_in_channels=... |
class FillPatternElement(Element,IDisposable):
""" An element that represents a fill pattern. """
@staticmethod
def Create(document,fillPattern):
"""
Create(document: Document,fillPattern: FillPattern) -> FillPatternElement
Creates a new FillPatternElement.
document: The document in ... | class Fillpatternelement(Element, IDisposable):
""" An element that represents a fill pattern. """
@staticmethod
def create(document, fillPattern):
"""
Create(document: Document,fillPattern: FillPattern) -> FillPatternElement
Creates a new FillPatternElement.
document: The documen... |
# -*- coding: utf-8 -*-
"""
Create by sandy at 16:57 23/12/2021
Description: ToDo
"""
| """
Create by sandy at 16:57 23/12/2021
Description: ToDo
""" |
class Solution:
def longestPalindrome(self, s):
ans = 0
count = collections.Counter(s)
for v in count.values():
ans += v // 2 * 2
if ans % 2 == 0 and v % 2 == 1:
ans += 1
return ans
| class Solution:
def longest_palindrome(self, s):
ans = 0
count = collections.Counter(s)
for v in count.values():
ans += v // 2 * 2
if ans % 2 == 0 and v % 2 == 1:
ans += 1
return ans |
text = """
//------------------------------------------------------------------------------
// Explicit instantiation.
//------------------------------------------------------------------------------
#include "Geometry/Dimension.hh"
#include "editMultimaterialSurfaceTopology.cc"
namespace Spheral {
template void editM... | text = '\n//------------------------------------------------------------------------------\n// Explicit instantiation.\n//------------------------------------------------------------------------------\n#include "Geometry/Dimension.hh"\n#include "editMultimaterialSurfaceTopology.cc"\n\nnamespace Spheral {\ntemplate void... |
"""Given weights and values of n items, put these items in a knapsack of capacity W to get the maximum total value in the knapsack."""
def MF_knapsack(i, wt, val, j):
'''
This code involves the concept of memory functions. Here we solve the subproblems which are needed
unlike the below example
F is a ... | """Given weights and values of n items, put these items in a knapsack of capacity W to get the maximum total value in the knapsack."""
def mf_knapsack(i, wt, val, j):
"""
This code involves the concept of memory functions. Here we solve the subproblems which are needed
unlike the below example
F is a 2... |
class Credential:
'''
class that generates new instaces of credentials information
'''
credential_list = [] #credential list
def save_credential(self):
'''
save_credential method saves object in credential list
'''
Credential.credential_list.append(self)
def __ini... | class Credential:
"""
class that generates new instaces of credentials information
"""
credential_list = []
def save_credential(self):
"""
save_credential method saves object in credential list
"""
Credential.credential_list.append(self)
def __init__(self, accou... |
class CmdActionResponse:
__status: bool
__msg: str
def __init__(self, status: bool, msg: str):
if isinstance(status, bool):
self.__status = status
else:
self.__status = False
self.__msg = msg
def isSuccess(self) -> bool:
return self... | class Cmdactionresponse:
__status: bool
__msg: str
def __init__(self, status: bool, msg: str):
if isinstance(status, bool):
self.__status = status
else:
self.__status = False
self.__msg = msg
def is_success(self) -> bool:
return self.__status is ... |
# coding: utf-8
"""
Joplin-Web Zi App
"""
__version__ = '2.0.0'
| """
Joplin-Web Zi App
"""
__version__ = '2.0.0' |
"""
Given two strings s and t which consist of only lowercase letters.
String t is generated by random shuffling string s and then add one more letter at a random position.
Find the letter that was added in t.
Example:
Input:
s = "abcd"
t = "abcde"
Output:
e
Explanation:
'e' is the letter that was added.
Your ru... | """
Given two strings s and t which consist of only lowercase letters.
String t is generated by random shuffling string s and then add one more letter at a random position.
Find the letter that was added in t.
Example:
Input:
s = "abcd"
t = "abcde"
Output:
e
Explanation:
'e' is the letter that was added.
Your ru... |
#!/usr/bin/python
class Device:
def __init__(self, uuid, type, ostype, osversion, brandname):
self.UUID = uuid
self.Type = type
self.OSType = ostype
self.OSVersion = osversion
self.BrandName = brandname
| class Device:
def __init__(self, uuid, type, ostype, osversion, brandname):
self.UUID = uuid
self.Type = type
self.OSType = ostype
self.OSVersion = osversion
self.BrandName = brandname |
# Source : https://leetcode.com/problems/peak-index-in-a-mountain-array/
# Author : foxfromworld
# Date : 17/11/2021
# First attempt
class Solution:
def peakIndexInMountainArray(self, arr: List[int]) -> int:
idx, peak = 0, 0
for i, m in enumerate(arr):
if m > peak:
peak... | class Solution:
def peak_index_in_mountain_array(self, arr: List[int]) -> int:
(idx, peak) = (0, 0)
for (i, m) in enumerate(arr):
if m > peak:
peak = m
idx = i
return idx |
def first_recurring(arr):
count = {}
for char in arr:
if char in count:
return char
count[char] = 1 # adding char into hashtable
print(count)
return None
arr = ["a", "b", "c", "d", "a"]
result = first_recurring(arr)
print(result)
| def first_recurring(arr):
count = {}
for char in arr:
if char in count:
return char
count[char] = 1
print(count)
return None
arr = ['a', 'b', 'c', 'd', 'a']
result = first_recurring(arr)
print(result) |
if __name__ == '__main__':
triplets = ((a, b, c)
for c in range(500, 1, -1)
for b in range(c, 1, -1)
for a in range(b, 1, -1))
for a, b, c in triplets:
if a + b + c == 1000 and a ** 2 + b ** 2 == c ** 2:
print(a, b, c, a*b*c)
... | if __name__ == '__main__':
triplets = ((a, b, c) for c in range(500, 1, -1) for b in range(c, 1, -1) for a in range(b, 1, -1))
for (a, b, c) in triplets:
if a + b + c == 1000 and a ** 2 + b ** 2 == c ** 2:
print(a, b, c, a * b * c)
break |
town = {"Acton Town" : ["Ealing Common","South Ealing","Turnham Green","Chiswick Park"],
"Aldgate" : ["Liverpool Street","Tower Hill"],
"Aldgate East" : ["Tower Hill","Whitechapel","Liverpool Street"],
"All Saints" : ["Devons Road","Poplar"],
"Alperton" : ["Park Royal","Sudbury Town"],
"Amersham" : ... | town = {'Acton Town': ['Ealing Common', 'South Ealing', 'Turnham Green', 'Chiswick Park'], 'Aldgate': ['Liverpool Street', 'Tower Hill'], 'Aldgate East': ['Tower Hill', 'Whitechapel', 'Liverpool Street'], 'All Saints': ['Devons Road', 'Poplar'], 'Alperton': ['Park Royal', 'Sudbury Town'], 'Amersham': ['Chalfont & Latim... |
class BittrexError(Exception):
pass
class BittrexRestError(BittrexError):
pass
class BittrexApiError(BittrexRestError):
def __init__(self, message):
self.message = message or 'Unknown error'
class BittrexResponseError(BittrexRestError):
def __init__(self, status: int, content: str):
... | class Bittrexerror(Exception):
pass
class Bittrexresterror(BittrexError):
pass
class Bittrexapierror(BittrexRestError):
def __init__(self, message):
self.message = message or 'Unknown error'
class Bittrexresponseerror(BittrexRestError):
def __init__(self, status: int, content: str):
... |
#!/usr/bin/python
# Filename: ex_if.py
color = 'white'
print("In the beginning, the color is {0}.".format(color))
if color == 'red':
color = 'orange'
elif color == 'orange':
color = 'yellow'
else:
color = 'red'
print("At the end, the color is {0}.".format(color))
| color = 'white'
print('In the beginning, the color is {0}.'.format(color))
if color == 'red':
color = 'orange'
elif color == 'orange':
color = 'yellow'
else:
color = 'red'
print('At the end, the color is {0}.'.format(color)) |
""" Compile is an internal module that compile formulas into Fast C/C++ code.
Options for compiling:
- numba
- C code and OpenMP/pthreads
- C++ code and OpenMP
- Cython code and OpenMP
- Numpy (to solve compatability issue!)
- Python (when the user is forced to use pure python code!)
"""
class ... | """ Compile is an internal module that compile formulas into Fast C/C++ code.
Options for compiling:
- numba
- C code and OpenMP/pthreads
- C++ code and OpenMP
- Cython code and OpenMP
- Numpy (to solve compatability issue!)
- Python (when the user is forced to use pure python code!)
"""
class ... |
def drap_first_last(grades):
first,*middle,last=grades
return print(middle)
record = ('Dave', 'dave@example.com', '773-555-1212', '847-555-1212')
name, email,*phone_numbers=record
print(name, email, phone_numbers)
*trailing, current = [10, 8, 7, 1, 9, 5, 10, 3]
print(sum(trailing)/len(trailing), current)
rec... | def drap_first_last(grades):
(first, *middle, last) = grades
return print(middle)
record = ('Dave', 'dave@example.com', '773-555-1212', '847-555-1212')
(name, email, *phone_numbers) = record
print(name, email, phone_numbers)
(*trailing, current) = [10, 8, 7, 1, 9, 5, 10, 3]
print(sum(trailing) / len(trailing), ... |
# nxpy_ply --------------------------------------------------------------------
# Copyright Nicola Musatti 2011 - 2018
# Use, modification, and distribution are subject to the Boost Software
# License, Version 1.0. (See accompanying file LICENSE.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# See https://git... | """
Wrapper classes for the PLY parser generator.
""" |
# preview of a Python Program
# A Python program that computes a grade-point average(GPA).
print('Welcome to the GPA calculator.')
print('Please enter all your letter grades, one per line.')
print('Enter a blank line to designate the end.')
# map from letter grade to point value
points = {
'A+': 4.0,
'A': 4.... | print('Welcome to the GPA calculator.')
print('Please enter all your letter grades, one per line.')
print('Enter a blank line to designate the end.')
points = {'A+': 4.0, 'A': 4.0, 'A-': 3.67, 'B+': 3.33, 'B': 3.0, 'B-': 2.67, 'C+': 2.33, 'C': 2.0, 'C-': 1.67, 'D+': 1.33, 'D': 1.0, 'F': 0.0}
num_courses = 0
total_point... |
{
"targets": [
{
"target_name": "ShortestPathCalculator",
"cflags!": [ "-fno-exceptions" ],
"cflags_cc!": [ "-fno-exceptions" ],
"sources": [
"addon/shortest_path/shortest_path_addon.cc",
"addon/shortest_path/shortest_path_addon.h",
"addon/shortest_path/shortest_path.cpp",
... | {'targets': [{'target_name': 'ShortestPathCalculator', 'cflags!': ['-fno-exceptions'], 'cflags_cc!': ['-fno-exceptions'], 'sources': ['addon/shortest_path/shortest_path_addon.cc', 'addon/shortest_path/shortest_path_addon.h', 'addon/shortest_path/shortest_path.cpp', 'addon/shortest_path/shortest_path.hpp', 'addon/shorte... |
valor1 = int (input ('Digite o primeiro valor: '))
valor2 = int (input ('Digite o segundo valor: '))
soma = valor1 + valor2
print ('A soma entre {} e {} vale {}'.format(valor1, valor2, soma)) | valor1 = int(input('Digite o primeiro valor: '))
valor2 = int(input('Digite o segundo valor: '))
soma = valor1 + valor2
print('A soma entre {} e {} vale {}'.format(valor1, valor2, soma)) |
render = ez.Node()
aspect2D = ez.Node()
camera = ez.Camera(parent=render)
camera.y = -3
target = ez.Node(parent=render)
#Create a camera for the buffer image:
buff_cam = ez.Camera(parent=target)
buff_cam.y = -5
#Create a texture buffer and assign the camera to it:
buffer = ez.TextureBuffer(256, 256)
buffer.camera ... | render = ez.Node()
aspect2_d = ez.Node()
camera = ez.Camera(parent=render)
camera.y = -3
target = ez.Node(parent=render)
buff_cam = ez.Camera(parent=target)
buff_cam.y = -5
buffer = ez.TextureBuffer(256, 256)
buffer.camera = buff_cam
buffer.background_color = (1, 0, 0, 1)
plane_mesh = ez.load.mesh('plane.bam')
plane = ... |
# the main() function
def main():
# parse argument
parser = argparse.ArgumentParser(description="Runs Conway's Game of Life simulation.")
# add arguments
parser.add_arguments('--grid-size', dest='N', required=False)
parser.add_arguments('--mov-file', dest='movfile', required=False)
parser.ad... | def main():
parser = argparse.ArgumentParser(description="Runs Conway's Game of Life simulation.")
parser.add_arguments('--grid-size', dest='N', required=False)
parser.add_arguments('--mov-file', dest='movfile', required=False)
parser.add_arguments('--interval', dest='interval', required=False)
pars... |
bill_id = 101
c_id = 1001
c_name ="rahul"
if_minor = False
bill_amount = 2000.50
print("bill_id is:", bill_id ,"c_id is:", c_id, "c_name", c_name ,if_minor,bill_amount)
| bill_id = 101
c_id = 1001
c_name = 'rahul'
if_minor = False
bill_amount = 2000.5
print('bill_id is:', bill_id, 'c_id is:', c_id, 'c_name', c_name, if_minor, bill_amount) |
DEVELOPMENT = False
PORT = 5000
| development = False
port = 5000 |
#########################################
# VoiceRss.py
# categories: speech
# more info @: http://myrobotlab.org/service/VoiceRss
#########################################
mouth = Runtime.start("mouth", "VoiceRss")
#possible voices ( selected voice is stored inside config until you change it )
print ("these... | mouth = Runtime.start('mouth', 'VoiceRss')
print('these are the voices I can have', mouth.getVoices())
print('this is the voice I am using', mouth.getVoice())
mouth.setVoice('Sally')
mouth.speakBlocking('it works, yes I believe it does')
mouth.setVolume(0.7)
mouth.speakBlocking('Silent please')
mouth.setVolume(1) |
# Empty list
mapping = dict()
# Charlson score, ICD9
tmpn = "charlson_icd9_quan"
mapping[tmpn] = dict()
mapping[tmpn]["ami"] = (
"410",
"412",
)
mapping[tmpn]["chf"] = (
"39891",
"40201",
"40211",
"40291",
"40401",
"40403",
"40411",
"40413",
"40491",
"40493",
"4254",... | mapping = dict()
tmpn = 'charlson_icd9_quan'
mapping[tmpn] = dict()
mapping[tmpn]['ami'] = ('410', '412')
mapping[tmpn]['chf'] = ('39891', '40201', '40211', '40291', '40401', '40403', '40411', '40413', '40491', '40493', '4254', '4255', '4256', '4257', '4258', '4259', '428')
mapping[tmpn]['pvd'] = ('0930', '4373', '440'... |
#
# PySNMP MIB module BAS-FTD-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BAS-FTD-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:33:53 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 0... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_intersection, constraints_union, single_value_constraint, value_size_constraint) ... |
for i in range(int(input())):
n = int(input())
a = [int(j) for j in input().split()]
print(sum(a)-n+1)
| for i in range(int(input())):
n = int(input())
a = [int(j) for j in input().split()]
print(sum(a) - n + 1) |
valor = float(input('Qual valor do saque? '))
if valor >= 10 and valor <= 600:
unidade = valor % 10
unidadeGuardada = int(unidade)
valor = (valor - unidade) / 10
dezena = valor % 10
dezena = int(dezena)
valor = (valor - dezena) / 10
centena = valor % 10
centena = int(centena)
if cen... | valor = float(input('Qual valor do saque? '))
if valor >= 10 and valor <= 600:
unidade = valor % 10
unidade_guardada = int(unidade)
valor = (valor - unidade) / 10
dezena = valor % 10
dezena = int(dezena)
valor = (valor - dezena) / 10
centena = valor % 10
centena = int(centena)
if cen... |
# Time: O(n)
# Space: O(h)
class Solution(object):
def findTarget(self, root, k):
"""
:type root: TreeNode
:type k: int
:rtype: bool
"""
class BSTIterator(object):
def __init__(self, root, forward):
self.__node = root
... | class Solution(object):
def find_target(self, root, k):
"""
:type root: TreeNode
:type k: int
:rtype: bool
"""
class Bstiterator(object):
def __init__(self, root, forward):
self.__node = root
self.__forward = forward
... |
day = "day12"
filepath_data = f"input/{day}.txt"
filepath_example = f"input/{day}-example.txt"
Connections = dict[str, set[str]]
NODE_START = "start"
NODE_END = "end"
def data_from_file(filename: str) -> Connections:
with open(filename) as f:
conns: Connections = dict()
for line in f:
... | day = 'day12'
filepath_data = f'input/{day}.txt'
filepath_example = f'input/{day}-example.txt'
connections = dict[str, set[str]]
node_start = 'start'
node_end = 'end'
def data_from_file(filename: str) -> Connections:
with open(filename) as f:
conns: Connections = dict()
for line in f:
(... |
class Descriptor(object):
def __init__(self, name=None, **opts):
self.name = name
for key, value in opts.items():
setattr(self, key, value)
if 'default' in opts:
self.__dict__.update({self.name: opts.get('default')})
def __set__(self, instance, value):
... | class Descriptor(object):
def __init__(self, name=None, **opts):
self.name = name
for (key, value) in opts.items():
setattr(self, key, value)
if 'default' in opts:
self.__dict__.update({self.name: opts.get('default')})
def __set__(self, instance, value):
... |
USER = 'bopjiang'
PASSWORD = 'MY PASSWORD'
DEFAULT_SSH_PORT = 22
## ip address and port
HOSTS = [
"10.10.30.194", ## equal to "10.10.30.194:$DEFAULT_SSH_PORT"
"10.10.30.195",
]
| user = 'bopjiang'
password = 'MY PASSWORD'
default_ssh_port = 22
hosts = ['10.10.30.194', '10.10.30.195'] |
MAX_GOAL = "MAXIMIZE"
MIN_GOAL = "MINIMIZE"
INTEGER = "INTEGER"
DOUBLE = "DOUBLE"
CATEGORICAL = "CATEGORICAL"
DISCRETE = "DISCRETE"
| max_goal = 'MAXIMIZE'
min_goal = 'MINIMIZE'
integer = 'INTEGER'
double = 'DOUBLE'
categorical = 'CATEGORICAL'
discrete = 'DISCRETE' |
# -*- coding=utf-8 -*-
class Desconto_Cinco_Items(object):
def __init__(self, proximo):
self.__proximo = proximo
def calcular(self, orcamento):
if orcamento.total_items > 5:
return orcamento.valor * 0.1
else:
return self.__proximo.calcular(or... | class Desconto_Cinco_Items(object):
def __init__(self, proximo):
self.__proximo = proximo
def calcular(self, orcamento):
if orcamento.total_items > 5:
return orcamento.valor * 0.1
else:
return self.__proximo.calcular(orcamento)
class Desconto_Quinhentos_Reais(o... |
"""
Python Tuple [ 24 exercises]
1. Write a Python program to create a tuple.
2. Write a Python program to create a tuple with different data types.
3. Write a Python program to create a tuple with numbers and print one item.
4. Write a Python program to unpack a tuple in several variables.
5. Write a Python ... | """
Python Tuple [ 24 exercises]
1. Write a Python program to create a tuple.
2. Write a Python program to create a tuple with different data types.
3. Write a Python program to create a tuple with numbers and print one item.
4. Write a Python program to unpack a tuple in several variables.
5. Write a Python ... |
'''
Write a Python program to calculate the sum of
the positive integers of n+(n-2)+(n-4)... (until n-x =< 0).
sum_series(6) -> 12
sum_series(10) -> 30
'''
class Solution:
def sum_digits(self, num):
if num-2 < 0:
return 0
else:
return num + self.sum_digits(num-2)
if __n... | """
Write a Python program to calculate the sum of
the positive integers of n+(n-2)+(n-4)... (until n-x =< 0).
sum_series(6) -> 12
sum_series(10) -> 30
"""
class Solution:
def sum_digits(self, num):
if num - 2 < 0:
return 0
else:
return num + self.sum_digits(num - 2)
if _... |
npp_Ahmad = {
"Name" : "Ahmad",
"Car" : "Tesla"
}
print(npp_Ahmad["Name"], 'owns a', npp_Ahmad["Car"] )
npp_Billy = {
"Name" : "Billy",
"Car" : "Toyota 1998"
}
print(npp_Billy["Name"], "owns a", npp_Billy["Car"])
npp_Chris = {
"Name" : "Chris",
"Car" : "Honda Cvic"
}
print(npp_Chris["... | npp__ahmad = {'Name': 'Ahmad', 'Car': 'Tesla'}
print(npp_Ahmad['Name'], 'owns a', npp_Ahmad['Car'])
npp__billy = {'Name': 'Billy', 'Car': 'Toyota 1998'}
print(npp_Billy['Name'], 'owns a', npp_Billy['Car'])
npp__chris = {'Name': 'Chris', 'Car': 'Honda Cvic'}
print(npp_Chris['Name'], 'owns a', npp_Chris['Car']) |
# coding: utf-8
"""
This module provides the base class for a Flask app decorator.
"""
class Decorator:
'''
A base class for decorating a Flask app with additional features.
Some basic decorators are provided. To add more, you must sub-class this
class.
'''
def decorate(self, a... | """
This module provides the base class for a Flask app decorator.
"""
class Decorator:
"""
A base class for decorating a Flask app with additional features.
Some basic decorators are provided. To add more, you must sub-class this
class.
"""
def decorate(self, app):
"""
Concre... |
# Copyright 2017 ZTE Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | class Catalogexception(Exception):
pass
class Badrequestexception(CatalogException):
pass
class Resourcenotfoundexception(CatalogException):
pass
class Packagenotfoundexception(CatalogException):
pass
class Packagehasexistsexception(CatalogException):
pass
class Vnfpkgsubscriptionexception(Cata... |
#!/usr/bin/env python
def solution(A, K):
n = len(A)
if n == 0:
return A
K %= n
if K == 0:
return A
return A[-K:] + A[:n-K]
def test():
a = [3, 8, 9, 7, 6]
assert solution(a, 1) == [6, 3, 8, 9, 7]
assert solution(a, 6) == [6, 3, 8, 9, 7]
assert solution(a, 3) == ... | def solution(A, K):
n = len(A)
if n == 0:
return A
k %= n
if K == 0:
return A
return A[-K:] + A[:n - K]
def test():
a = [3, 8, 9, 7, 6]
assert solution(a, 1) == [6, 3, 8, 9, 7]
assert solution(a, 6) == [6, 3, 8, 9, 7]
assert solution(a, 3) == [9, 7, 6, 3, 8]
asse... |
# The MIT License (MIT)
#
# Copyright (C) 2020 - Ericsson
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify... | """Output Style classes file."""
parentkey_key = 'parentKey'
sytle_values_key = 'styleValues'
styles_key = 'styles'
class Outputelementstyle:
"""
Output element style object for one style key. It supports style
inheritance. To avoid creating new styles the element style can have a parent
style and will... |
# 29/06/2017
# inspired by /u/Toctave's solution
def talking_clock(time):
h, m = map(int, time.split(':'))
gt12, h = divmod(h, 12)
s = "It's "
s += ["twelve", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven"][h] + ' '
s += ["", "oh "][m > 0 and m < 10]
s ... | def talking_clock(time):
(h, m) = map(int, time.split(':'))
(gt12, h) = divmod(h, 12)
s = "It's "
s += ['twelve', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven'][h] + ' '
s += ['', 'oh '][m > 0 and m < 10]
s += ['\x08', 'twenty', 'thirty', 'forty', 'fifty... |
metadata = {
"name": "",
"description": "",
"image": "",
"attributes": [
{"att_name": "max-speed", "value": 210},
{"att_name": "color", "value": "#550045"},
{"att_name": "price", "value": 294000},
{"att_name": "manufacture_date", "value": "01-12-2014"},
{"att_name... | metadata = {'name': '', 'description': '', 'image': '', 'attributes': [{'att_name': 'max-speed', 'value': 210}, {'att_name': 'color', 'value': '#550045'}, {'att_name': 'price', 'value': 294000}, {'att_name': 'manufacture_date', 'value': '01-12-2014'}, {'att_name': '0-60mph', 'value': 3.4}, {'att_name': 'engine', 'value... |
s, t = input().split()
a, b = map(int, input().split())
u = input()
if u == s:
print(a - 1, b)
else:
print(a, b - 1)
| (s, t) = input().split()
(a, b) = map(int, input().split())
u = input()
if u == s:
print(a - 1, b)
else:
print(a, b - 1) |
def findDecision(obj): #obj[0]: Passanger, obj[1]: Time, obj[2]: Coupon, obj[3]: Gender, obj[4]: Age, obj[5]: Education, obj[6]: Occupation, obj[7]: Bar, obj[8]: Coffeehouse, obj[9]: Restaurant20to50, obj[10]: Direction_same, obj[11]: Distance
# {"feature": "Occupation", "instances": 23, "metric_value": 0.9656, "depth... | def find_decision(obj):
if obj[6] > 2:
if obj[4] <= 3:
if obj[9] <= 1.0:
if obj[10] <= 0:
return 'False'
elif obj[10] > 0:
return 'True'
else:
return 'True'
elif obj[9] > 1.0:
... |
class Solution:
def kClosest(self, points: List[List[int]], k: int) -> List[List[int]]:
# Find euclidean distances
distance_points = [(self.find_euclidean(point, [0, 0]), point[0], point[1]) for point in points]
# Quickselect to sort the distance points
self.quickselect(dist... | class Solution:
def k_closest(self, points: List[List[int]], k: int) -> List[List[int]]:
distance_points = [(self.find_euclidean(point, [0, 0]), point[0], point[1]) for point in points]
self.quickselect(distance_points, 0, len(distance_points) - 1, k)
return [[i[1], i[2]] for i in distance_... |
decr = 7
for x in range(4,0,-1):
for y in range(x,5):
print(" ",end="")
print(str(decr)*decr)
decr-=2 | decr = 7
for x in range(4, 0, -1):
for y in range(x, 5):
print(' ', end='')
print(str(decr) * decr)
decr -= 2 |
# Property example
class Person:
first_name = property()
@first_name.getter
def first_name(self):
return self._first_name
@first_name.setter
def first_name(self, value):
if not isinstance(value, str):
raise TypeError('Expected a string')
self._first_name = value... | class Person:
first_name = property()
@first_name.getter
def first_name(self):
return self._first_name
@first_name.setter
def first_name(self, value):
if not isinstance(value, str):
raise type_error('Expected a string')
self._first_name = value
p = person()
p.fi... |
#Make a script that prints out numbers from 1 to 10
for i in range(1,11):
print(i)
| for i in range(1, 11):
print(i) |
#accuracy
p = clf.predict([xtest])
count = 0
for i in range(0,21000):
count += 1
if p[i]:
print(actual_label[i])
else:
print("0")
print("ACCURACY", (count/21000)*100) | p = clf.predict([xtest])
count = 0
for i in range(0, 21000):
count += 1
if p[i]:
print(actual_label[i])
else:
print('0')
print('ACCURACY', count / 21000 * 100) |
def isPrime(N):
if N == 1:
return False
for i in range(2, N):
if N % i == 0:
return False
return True
def isPrimeBetter(N):
if N <= 1:
return False
if N <= 3:
return True
if N % 2 == 0 or N % 3 == 0:
return False
... | def is_prime(N):
if N == 1:
return False
for i in range(2, N):
if N % i == 0:
return False
return True
def is_prime_better(N):
if N <= 1:
return False
if N <= 3:
return True
if N % 2 == 0 or N % 3 == 0:
return False
i = 5
while i * i <... |
##
# Portions Copyright (c) Microsoft Corporation. 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
#
# THIS CODE IS PROVIDED... | {'targets': [{'target_name': 'edge_coreclr', 'win_delay_load_hook': 'false', 'include_dirs': ['<!(node -e "require(\'nan\')")'], 'cflags+': ['-DHAVE_CORECLR -D_NO_ASYNCRTIMP -std=c++14 -Wno-reorder -Wno-sign-compare -Wno-mismatched-tags -Wno-missing-braces -Wno-redundant-move -Wno-deprecated-declarations -Wno-unused-pr... |
def bonAppetit(bill, k, b):
shares_brian = (sum(bill)+bill[k])/2
shares_anna = (sum(bill) - bill[k])/2
if shares_anna == b:
return print('Bon Appetit')
else:
return print(int(bill[k]/2))
bill = [3, 10, 2, 9]
n = 4
k = 1
b = 12
bonAppetit(bill, k, b)
| def bon_appetit(bill, k, b):
shares_brian = (sum(bill) + bill[k]) / 2
shares_anna = (sum(bill) - bill[k]) / 2
if shares_anna == b:
return print('Bon Appetit')
else:
return print(int(bill[k] / 2))
bill = [3, 10, 2, 9]
n = 4
k = 1
b = 12
bon_appetit(bill, k, b) |
def get_age(name):
# if name == "Fuck":
# print("Mat day")
# return 1
# else
print("Khong mat day")
return 19
#1
age = get_age("Tam")
#2
xxx = input("> ")
get_age(xxx)
#3
get_age(xxx + "Tam")
#4
def cheese_and_crackers(cheese_count, boxes_of_crackers):
print(f"You have {cheese_count} cheeses!")
print(f"Y... | def get_age(name):
print('Khong mat day')
return 19
age = get_age('Tam')
xxx = input('> ')
get_age(xxx)
get_age(xxx + 'Tam')
def cheese_and_crackers(cheese_count, boxes_of_crackers):
print(f'You have {cheese_count} cheeses!')
print(f'You have {boxes_of_crackers} boxes of crackers!')
print("Man that... |
# used for module loading
class NagoyaRouter:
def db_for_read(self, model, **hints):
"""
Attempts to read nagoya models from nagoyadb.
"""
if model._meta.app_label == 'nagoya':
return 'nagoya'
return 'default'
| class Nagoyarouter:
def db_for_read(self, model, **hints):
"""
Attempts to read nagoya models from nagoyadb.
"""
if model._meta.app_label == 'nagoya':
return 'nagoya'
return 'default' |
"""
Custom exception classes for the ZAP CLI.
.. moduleauthor:: Daniel Grunwell (grunny)
"""
class ZAPError(Exception):
"""
Generic exception for ZAP CLI.
"""
def __init__(self, message, extra=None):
super(ZAPError, self).__init__(message)
self.extra = extra
| """
Custom exception classes for the ZAP CLI.
.. moduleauthor:: Daniel Grunwell (grunny)
"""
class Zaperror(Exception):
"""
Generic exception for ZAP CLI.
"""
def __init__(self, message, extra=None):
super(ZAPError, self).__init__(message)
self.extra = extra |
# Create a Multinomial Naive Bayes classifier: nb_classifier
nb_classifier = MultinomialNB()
# Fit the classifier to the training data
nb_classifier.fit(tfidf_train, y_train)
# Create the predicted tags: pred
pred = nb_classifier.predict(tfidf_test)
# Calculate the accuracy score: score
score = metrics.accuracy_scor... | nb_classifier = multinomial_nb()
nb_classifier.fit(tfidf_train, y_train)
pred = nb_classifier.predict(tfidf_test)
score = metrics.accuracy_score(y_test, pred)
print(score)
cm = metrics.confusion_matrix(y_test, pred, labels=['FAKE', 'REAL'])
print(cm) |
"""Animals module."""
class Animal:
"""Animal class."""
# Class object attributes apply to all instances (go before __init__)
is_alive = True
def __init__(self):
"""__init__ is used to initialize the attributes of an object."""
print("Animal created")
def whoAmI(self):
"... | """Animals module."""
class Animal:
"""Animal class."""
is_alive = True
def __init__(self):
"""__init__ is used to initialize the attributes of an object."""
print('Animal created')
def who_am_i(self):
"""Public method (docstring)."""
print('Animal')
def eat(self)... |
# calculate the supereffect of the attacker against defender
# part of the pokemon database website written by Ross Grogan-Kaylor and Jimmy Zhong
word_maps_col_row_num = {
"fire":0,
"water":1,
"bug":2,
"poison":3,
"electric":4,
"fairy":5,
"fighting":6,
"psychic":7,
"ground":8,
... | word_maps_col_row_num = {'fire': 0, 'water': 1, 'bug': 2, 'poison': 3, 'electric': 4, 'fairy': 5, 'fighting': 6, 'psychic': 7, 'ground': 8, 'normal': 9, 'grass': 10, 'dragon': 11, 'rock': 12, 'dark': 13, 'ghost': 14, 'ice': 15, 'steel': 16, 'flying': 17}
effect_matrix = [[0.5, 2, 0.5, 1, 1, 0.5, 1, 1, 2, 1, 0.5, 1, 2, ... |
class VariantStats:
def __init__(self, stats, total_count):
self.total_count = total_count
self.stats = stats # {field: {value: count}, field: {min:min,max:max}, ...}
def __getitem__(self, filter_name):
return self.stats[filter_name]
def get(self, filter_name):
return se... | class Variantstats:
def __init__(self, stats, total_count):
self.total_count = total_count
self.stats = stats
def __getitem__(self, filter_name):
return self.stats[filter_name]
def get(self, filter_name):
return self.stats.get(filter_name)
def expose(self):
re... |
a = float(input())
if a < 100:
print('Less than 100')
elif a <= 200:
print('Between 100 and 200')
elif a > 200:
print('Greater than 200')
| a = float(input())
if a < 100:
print('Less than 100')
elif a <= 200:
print('Between 100 and 200')
elif a > 200:
print('Greater than 200') |
# Prints visualisation of the sequences.
for t in range(500):
if t % 5 == 0:
a = 'D'
else:
a = '-'
if t % 7 == 0:
b = 'D'
else:
b = '-'
if t % 13 == 0:
c = 'D'
else:
c = '-'
print(t, a, b, c)
| for t in range(500):
if t % 5 == 0:
a = 'D'
else:
a = '-'
if t % 7 == 0:
b = 'D'
else:
b = '-'
if t % 13 == 0:
c = 'D'
else:
c = '-'
print(t, a, b, c) |
def add_parser(subparsers):
parser = subparsers.add_parser(
"thingpedia",
help="Work with thingpedia-common-devices",
)
parser.add_children(__name__, __path__)
| def add_parser(subparsers):
parser = subparsers.add_parser('thingpedia', help='Work with thingpedia-common-devices')
parser.add_children(__name__, __path__) |
class Classe:
def __init__(self, attr):
self.atributo = attr
def metodo(self):
self.atributo += 1
print(self.atributo)
a = Classe(0)
a.metodo()
a.metodo()
| class Classe:
def __init__(self, attr):
self.atributo = attr
def metodo(self):
self.atributo += 1
print(self.atributo)
a = classe(0)
a.metodo()
a.metodo() |
#!/usr/bin/python
# configuration for syndicatelib
SYNDICATE_SMI_URL="http://localhost:8080"
SYNDICATE_OPENID_TRUSTROOT="http://localhost:8081"
SYNDICATE_OPENCLOUD_USER="jcnelson@cs.princeton.edu"
SYNDICATE_OPENCLOUD_PASSWORD=None
SYNDICATE_OPENCLOUD_PKEY="/home/jude/Desktop/research/git/syndicate/ms/tests/user_test... | syndicate_smi_url = 'http://localhost:8080'
syndicate_openid_trustroot = 'http://localhost:8081'
syndicate_opencloud_user = 'jcnelson@cs.princeton.edu'
syndicate_opencloud_password = None
syndicate_opencloud_pkey = '/home/jude/Desktop/research/git/syndicate/ms/tests/user_test_key.pem'
syndicate_pythonpath = '/home/jude... |
{
5 : {
"operator" : "selection",
"numgroups" : 100
}
}
| {5: {'operator': 'selection', 'numgroups': 100}} |
def MergeSortRecusive(arr):
'''
Time complexity: O(n * log n)
'''
m = len(arr) // 2
if len(arr) <= 1:
return arr
else:
LS = []
RS = []
M = [arr[m]]
for i in range(len(arr)):
if i == m:
continue
... | def merge_sort_recusive(arr):
"""
Time complexity: O(n * log n)
"""
m = len(arr) // 2
if len(arr) <= 1:
return arr
else:
ls = []
rs = []
m = [arr[m]]
for i in range(len(arr)):
if i == m:
continue
if arr[i] > arr... |
# -*- coding: utf-8 -*-
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
### Alias : BridgeServer.update_distributor & Last Modded : 2022.02.27. ###
Coded with Python 3.10 Grammar by purplepig4657
Description : PosServer Update Distributor (with git)
Use linux crontab to run t... | """""
### Alias : BridgeServer.update_distributor & Last Modded : 2022.02.27. ###
Coded with Python 3.10 Grammar by purplepig4657
Description : PosServer Update Distributor (with git)
Use linux crontab to run this script every hour.
"""
if __name__ == '__main__':
pass |
class ConfigSections:
"""
Container including enums for sections that can be used in config file.
"""
PROJECT = "PROJECT"
CPU_TARGET = "CPU_TARGET"
FPGA_TARGET = "FPGA_TARGET"
PLUGIN = "PLUGIN"
STRUCTURE = "STRUCTURE"
FPGASIM = "FPGASIM"
class BoardNames:
"""
... | class Configsections:
"""
Container including enums for sections that can be used in config file.
"""
project = 'PROJECT'
cpu_target = 'CPU_TARGET'
fpga_target = 'FPGA_TARGET'
plugin = 'PLUGIN'
structure = 'STRUCTURE'
fpgasim = 'FPGASIM'
class Boardnames:
"""
Container inclu... |
__author__ = 'sulantha'
class SortingObject:
def __init__(self, values):
self.record_id = 0 if 'record_id' not in values else values['record_id']
self.study = values['study']
self.rid = values['rid']
self.scan_type = values['scan_type']
self.scan_date = values['scan_date']
... | __author__ = 'sulantha'
class Sortingobject:
def __init__(self, values):
self.record_id = 0 if 'record_id' not in values else values['record_id']
self.study = values['study']
self.rid = values['rid']
self.scan_type = values['scan_type']
self.scan_date = values['scan_date']
... |
class Robot:
def __init__(self, name):
self.__name = name
def __eq__(self, other):
return isinstance(other, Robot) and self.get_name() == other.get_name()
def get_name(self):
return self.__name
def __repr__(self):
return self.get_name()
ro = Robot("ro")
print(str(... | class Robot:
def __init__(self, name):
self.__name = name
def __eq__(self, other):
return isinstance(other, Robot) and self.get_name() == other.get_name()
def get_name(self):
return self.__name
def __repr__(self):
return self.get_name()
ro = robot('ro')
print(str(ro)) |
# -*- coding: utf-8 -*-
# Copyright 2021 Cohesity Inc.
class ServiceProcessEntry(object):
"""Implementation of the 'ServiceProcessEntry' model.
Specifies the name of a Service running on the Cluster as well as a list
of process IDs associated with that service.
Attributes:
process_ids (list... | class Serviceprocessentry(object):
"""Implementation of the 'ServiceProcessEntry' model.
Specifies the name of a Service running on the Cluster as well as a list
of process IDs associated with that service.
Attributes:
process_ids (list of long|int): Specifies the list of process IDs
... |
# Generated file, do not modify by hand
# Generated by 'rbe_autoconfig_autogen_ubuntu1604' rbe_autoconfig rule
"""Definitions to be used in rbe_repo attr of an rbe_autoconf rule """
toolchain_config_spec0 = struct(config_repos = [], create_cc_configs = True, create_java_configs = True, env = {"ABI_LIBC_VERSION": "glib... | """Definitions to be used in rbe_repo attr of an rbe_autoconf rule """
toolchain_config_spec0 = struct(config_repos=[], create_cc_configs=True, create_java_configs=True, env={'ABI_LIBC_VERSION': 'glibc_2.19', 'ABI_VERSION': 'clang', 'BAZEL_COMPILER': 'clang', 'BAZEL_HOST_SYSTEM': 'i686-unknown-linux-gnu', 'BAZEL_TARGE... |
# Paths
SMPL_MODEL_DIR = './smpl' # Path to SMPL model directory
SSP_3D_PATH = './ssp_3d' # Path to SSP-3D dataset root directory
# Constants
FOCAL_LENGTH = 5000.
| smpl_model_dir = './smpl'
ssp_3_d_path = './ssp_3d'
focal_length = 5000.0 |
#
# PySNMP MIB module ONEACCESS-GLOBAL-REG (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ONEACCESS-GLOBAL-REG
# Produced by pysmi-0.3.4 at Mon Apr 29 20:22:42 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, single_value_constraint, value_range_constraint, constraints_intersection) ... |
# *-* coding:utf-8 *-*
"""Module states Paraiba"""
def start(st_reg_number):
"""Checks the number valiaty for the Paraiba state"""
#st_reg_number = str(st_reg_number)
weights = [9, 8, 7, 6, 5, 4, 3, 2]
digit_state_registration = st_reg_number[-1]
if len(st_reg_number) != 9:
return False
... | """Module states Paraiba"""
def start(st_reg_number):
"""Checks the number valiaty for the Paraiba state"""
weights = [9, 8, 7, 6, 5, 4, 3, 2]
digit_state_registration = st_reg_number[-1]
if len(st_reg_number) != 9:
return False
sum_total = 0
for i in range(0, 8):
sum_total = su... |
def load(h):
return ({'abbr': 1, 'code': 1, 'title': 'first'},
{'abbr': 2, 'code': 2, 'title': 'second'},
{'abbr': 3, 'code': 3, 'title': 'third'},
{'abbr': 4, 'code': 4, 'title': 'fourth'})
| def load(h):
return ({'abbr': 1, 'code': 1, 'title': 'first'}, {'abbr': 2, 'code': 2, 'title': 'second'}, {'abbr': 3, 'code': 3, 'title': 'third'}, {'abbr': 4, 'code': 4, 'title': 'fourth'}) |
#
# Copyright (c) 2017 Joy Diamond. All rights reserved.
#
@gem('Sapphire.Priority')
def gem():
share(
'PRIORITY_ATOM', 1, # atom
'PRIORITY_TUPLE', 2, # tuple
'PRIORITY_POSTFIX', 3, # . () and []
'PRIORITY_P... | @gem('Sapphire.Priority')
def gem():
share('PRIORITY_ATOM', 1, 'PRIORITY_TUPLE', 2, 'PRIORITY_POSTFIX', 3, 'PRIORITY_POWER', 4, 'PRIORITY_UNARY', 5, 'PRIORITY_MULTIPLY', 6, 'PRIORITY_ARITHMETIC', 7, 'PRIORITY_SHIFT', 8, 'PRIORITY_LOGICAL_AND', 9, 'PRIORITY_LOGICAL_EXCLUSIVE_OR', 10, 'PRIORITY_LOGICAL_OR', 11, 'PRIO... |
# coding: utf8
{
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" est une expression en option tels que "field1 = \'newvalue\'". Vous ne pouvez pas mettre \xc3\xa0 jour ou supprimer les r\xc3\xa9sultats d\'une jointure "a JOIN"',
'%Y-%m-%d': '... | {'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" est une expression en option tels que "field1 = \'newvalue\'". Vous ne pouvez pas mettre Ã\xa0 jour ou supprimer les résultats d\'une jointure "a JOIN"', '%Y-%m-%d': '%d-%m-%Y', '%Y-%m-%d %H:%... |
'''
Given an input of a 2D array of integers, removes all duplicates from the array.
Empty sub-arrays are removed.
'''
map = {}
def remove_duplicates(all_nums):
end_index = len(all_nums) #length of all_nums
i = 0 #current index of all_nums
while(i < end_index):
j = 0 #current index of sub-array
... | """
Given an input of a 2D array of integers, removes all duplicates from the array.
Empty sub-arrays are removed.
"""
map = {}
def remove_duplicates(all_nums):
end_index = len(all_nums)
i = 0
while i < end_index:
j = 0
sub_arr = all_nums[i]
sub_end = len(sub_arr)
while j < ... |
#--------------------------------------------------------------------------
# Scrapy Settings
#--------------------------------------------------------------------------
BOT_NAME = 'scrapy_frontier'
SPIDER_MODULES = ['scrapy_recording.spiders']
NEWSPIDER_MODULE = 'scrapy_recording.spiders'
HTTPCACHE_ENABLED = True
RE... | bot_name = 'scrapy_frontier'
spider_modules = ['scrapy_recording.spiders']
newspider_module = 'scrapy_recording.spiders'
httpcache_enabled = True
redirect_enabled = True
cookies_enabled = False
download_timeout = 20
retry_enabled = False
concurrent_requests = 256
concurrent_requests_per_domain = 2
logstats_interval = 1... |
BLOCK_SIZE = 1024
SERVER_IP = None
BACKING_FNs = ['../songs/lamprey/drums.wav', '../songs/lamprey/bass.wav',
'../songs/lamprey/piano.wav', '../songs/lamprey/violin.wav']
STARTUP_DELAY = 1.0
MAX_AUDIO_OUTPUT_QUEUE_LENGTH = 10
| block_size = 1024
server_ip = None
backing_f_ns = ['../songs/lamprey/drums.wav', '../songs/lamprey/bass.wav', '../songs/lamprey/piano.wav', '../songs/lamprey/violin.wav']
startup_delay = 1.0
max_audio_output_queue_length = 10 |
class MockReader(object):
"""
Class for unit testing to record all actions taken to the reader and
report them to the tests.
"""
def __init__(self):
self.recorded_actions = list()
self.mock_results = list()
self.mock_result_index = 0
self.raise_exception_on = None
... | class Mockreader(object):
"""
Class for unit testing to record all actions taken to the reader and
report them to the tests.
"""
def __init__(self):
self.recorded_actions = list()
self.mock_results = list()
self.mock_result_index = 0
self.raise_exception_on = None
... |
PUZZLE_PRICE = 2.60
TALKING_DOLL_PRICE = 3
TEDDY_BEAR_PRICE = 4.10
MINION_PRICE = 8.20
TRUCK_PRICE = 2
trip_price = float(input())
puzzles_count = int(input())
talking_dolls_count = int(input())
teddy_bears_count = int(input())
minions_count = int(input())
trucks_count = int(input())
total_count = puzzles_count + ta... | puzzle_price = 2.6
talking_doll_price = 3
teddy_bear_price = 4.1
minion_price = 8.2
truck_price = 2
trip_price = float(input())
puzzles_count = int(input())
talking_dolls_count = int(input())
teddy_bears_count = int(input())
minions_count = int(input())
trucks_count = int(input())
total_count = puzzles_count + talking_... |
ATArticle = 0
ATString = 1
ATBasePrice = 2
ATReleased = 3
ATEmblemPrices = 4
AHat = 0
AGlasses = 1
ABackpack = 2
AShoes = 3
ABoysHat = 4
ABoysGlasses = 5
ABoysBackpack = 6
ABoysShoes = 7
AGirlsHat = 8
AGirlsGlasses = 9
AGirlsBackpack = 10
AGirlsShoes = 11
APriceTest = 5
APriceBasic = 250
APriceBasicPlus = 400
APriceCoo... | at_article = 0
at_string = 1
at_base_price = 2
at_released = 3
at_emblem_prices = 4
a_hat = 0
a_glasses = 1
a_backpack = 2
a_shoes = 3
a_boys_hat = 4
a_boys_glasses = 5
a_boys_backpack = 6
a_boys_shoes = 7
a_girls_hat = 8
a_girls_glasses = 9
a_girls_backpack = 10
a_girls_shoes = 11
a_price_test = 5
a_price_basic = 250
... |
def setup():
size(500,500)
smooth()
noLoop()
def draw():
background(100)
stroke(136, 29, 203)
strokeWeight(110)
line(100,150,400,150)
stroke(203, 29, 163)
strokeWeight(60)
line(100,250,400,250)
stroke(203, 29, 29)
strokeWeight(110)
line(100,350,400... | def setup():
size(500, 500)
smooth()
no_loop()
def draw():
background(100)
stroke(136, 29, 203)
stroke_weight(110)
line(100, 150, 400, 150)
stroke(203, 29, 163)
stroke_weight(60)
line(100, 250, 400, 250)
stroke(203, 29, 29)
stroke_weight(110)
line(100, 350, 400, 350) |
load("//:import_external.bzl", import_external = "safe_wix_scala_maven_import_external")
def dependencies():
import_external(
name = "com_google_errorprone_error_prone_annotations",
artifact = "com.google.errorprone:error_prone_annotations:2.2.0",
artifact_sha256 = "6ebd22ca1b9d8ec06d41de8d64e0596... | load('//:import_external.bzl', import_external='safe_wix_scala_maven_import_external')
def dependencies():
import_external(name='com_google_errorprone_error_prone_annotations', artifact='com.google.errorprone:error_prone_annotations:2.2.0', artifact_sha256='6ebd22ca1b9d8ec06d41de8d64e0596981d9607b42035f9ed374f9de2... |
def get_collocated_senses(input_offset):
"""
Find collacated senese for a given offset.
"""
# syntagnet sense id length is 9. Add paddings to the front
if len(input_offset) <9:
padding = '0' * (9 - len(input_offset))
sense_id_pos = padding + input_offset
synta... | def get_collocated_senses(input_offset):
"""
Find collacated senese for a given offset.
"""
if len(input_offset) < 9:
padding = '0' * (9 - len(input_offset))
sense_id_pos = padding + input_offset
syntag_senseid = input_offset.replace('-', '')
collocated_senses = []
with open(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.