content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class LexStatusCodes:
LA_OK = 0
LA_FAIL = 1
LA_EXPIRED = 20
LA_SUSPENDED = 21
LA_GRACE_PERIOD_OVER = 22
LA_TRIAL_EXPIRED = 25
LA_LOCAL_TRIAL_EXPIRED = 26
LA_RELEASE_UPDATE_AVAILABLE = 30
LA_RELEASE_NO_UPDATE_AVAILABLE = 31
LA_E_FILE_PATH = 40
LA_E_PRODUCT_FILE = 41
... | class Lexstatuscodes:
la_ok = 0
la_fail = 1
la_expired = 20
la_suspended = 21
la_grace_period_over = 22
la_trial_expired = 25
la_local_trial_expired = 26
la_release_update_available = 30
la_release_no_update_available = 31
la_e_file_path = 40
la_e_product_file = 41
la_e_p... |
DEBUG=True
DEBUG_EXTRACT=True
DEBUG_ROOIBOS=True
DEBUG_PATCH_LOCATIONS=True
DEBUG_RESOLVE_DYNLIB=True
DEBUG_ADDR2LINE=True
DEBUG_PATCHING=True
DEBUG_LTRACE=False
DEBUG_FIND=True
TEST=True
| debug = True
debug_extract = True
debug_rooibos = True
debug_patch_locations = True
debug_resolve_dynlib = True
debug_addr2_line = True
debug_patching = True
debug_ltrace = False
debug_find = True
test = True |
# -----------------------------------------------------------------------------
# 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
# ... | class Console:
"""
A class that represents the EV3 LCD console, which implements ANSI codes
for cursor positioning, text color, and resetting the screen. Supports changing
the console font using standard system fonts.
"""
def __init__(self, font='Lat15-TerminusBold24x12'):
"""
C... |
class GuacamoleConfiguration(object):
def __init__(self, protocol=None):
self.connectionID = None
self.protocol = protocol
self.parameters = {}
@property
def connectionID(self):
return self._connectionID
@connectionID.setter
def connectionID(self, connectionID):
... | class Guacamoleconfiguration(object):
def __init__(self, protocol=None):
self.connectionID = None
self.protocol = protocol
self.parameters = {}
@property
def connection_id(self):
return self._connectionID
@connectionID.setter
def connection_id(self, connectionID):
... |
a, b, c = input().split(" ")
a = float(a)
b = float(b)
c = float(c)
if a >= b and a >= c:
n1 = a
if b >= c:
n2 = b
n3 = c
else:
n2 = c
n3 = b
if b >= a and b >= c:
n1 = b
if a >= c:
n2 = a
n3 = c
else:
n2 = c
n3 = a
if c >= a and c... | (a, b, c) = input().split(' ')
a = float(a)
b = float(b)
c = float(c)
if a >= b and a >= c:
n1 = a
if b >= c:
n2 = b
n3 = c
else:
n2 = c
n3 = b
if b >= a and b >= c:
n1 = b
if a >= c:
n2 = a
n3 = c
else:
n2 = c
n3 = a
if c >= a and ... |
def only_numbers(input_list):
integers_list = [list_entry for list_entry in input_list if type(list_entry) == int]
return integers_list
print(only_numbers([99, 'no data', 95, 93, 'no data']))
def only_numbers_greater_zero(input_list):
integers_list = [list_entry for list_entry in input_list if list_entry... | def only_numbers(input_list):
integers_list = [list_entry for list_entry in input_list if type(list_entry) == int]
return integers_list
print(only_numbers([99, 'no data', 95, 93, 'no data']))
def only_numbers_greater_zero(input_list):
integers_list = [list_entry for list_entry in input_list if list_entry >... |
## https://docs.python.org/3/howto/logging-cookbook.html#an-example-dictionary-based-configuration
## https://docs.djangoproject.com/en/1.9/topics/logging/#configuring-logging
logcfg = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '%(levelname)... | logcfg = {'version': 1, 'disable_existing_loggers': False, 'formatters': {'verbose': {'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'}, 'simple': {'format': '[%(levelname)s]:[%(filename)s:%(lineno)d - %(funcName)20s() ]: %(message)s'}, 'standard': {'format': '%(asctime)s:[%(levelname... |
#! /usr/bin/env python3
#Aleksandra Rzepka
#Calculate the square root of a number
def sqrt(x):
"""
Calculate the square root of argument x.
"""
#Check that x is positive.
if x < 0:
print("Error: negative value supplied")
return -1
else:
print("Here we go...")
#Initial guess for the square root... | def sqrt(x):
"""
Calculate the square root of argument x.
"""
if x < 0:
print('Error: negative value supplied')
return -1
else:
print('Here we go...')
z = x / 2.0
while abs(x - z * z) > 1e-06:
z = z - (z * z - x) / (2 * z)
return z
myval = 63.0
print('The squa... |
class Solution(object):
def maxDistance(self, nums):
"""
:type arrays: List[List[int]]
:rtype: int
"""
low = float('inf')
high = float('-inf')
res = 0
for num in nums:
# We can use num[0] && num[-1] only because these lists are sorted
... | class Solution(object):
def max_distance(self, nums):
"""
:type arrays: List[List[int]]
:rtype: int
"""
low = float('inf')
high = float('-inf')
res = 0
for num in nums:
res = max(res, max(high - num[0], num[-1] - low))
low = mi... |
"""Constants and allowed parameter values specified in the Userlist API."""
PUSH_URL = 'https://push.userlist.com/'
# Date formats
VALID_DATE_FORMATS = ['%Y-%m-%dT%H:%M:%S%z', '%Y-%m-%dT%H:%M:%S'] | """Constants and allowed parameter values specified in the Userlist API."""
push_url = 'https://push.userlist.com/'
valid_date_formats = ['%Y-%m-%dT%H:%M:%S%z', '%Y-%m-%dT%H:%M:%S'] |
# Rolling hash usage of a multiply accumlate unit with multiplier from the FNV hash, but linear style like the Ghash of AES-GCM
def rolling_hash_by_mac(list):
hash = 0
for byte in list:
hash += byte
hash *= 0x01000193
hash %= 2**32
return(hash)
#powers of the multiplier o... | def rolling_hash_by_mac(list):
hash = 0
for byte in list:
hash += byte
hash *= 16777619
hash %= 2 ** 32
return hash
list1 = [88, 118, 84, 58, 190, 205]
list2 = [88, 103, 84, 58, 235, 205]
x = rolling_hash_by_mac(list1)
y = rolling_hash_by_mac(list2)
print('1st hash:', x)
print('2nd h... |
# OpenWeatherMap API Key
weather_api_key = "bfabad3eec079b77cd6e28110d3ad22f"
# Google API Key
g_key = "AIzaSyBKZyrmnIxatibyVFhiPyCHD87TQW0ulAA"
| weather_api_key = 'bfabad3eec079b77cd6e28110d3ad22f'
g_key = 'AIzaSyBKZyrmnIxatibyVFhiPyCHD87TQW0ulAA' |
target = 1000000
for i in range(1,500001):
if target % i != 0: continue
if '0' in str(i): continue
j = int(target / i)
if '0' in str(j): continue
print ('Factors: ' + str(i) + ' : ' + str(j))
exit
| target = 1000000
for i in range(1, 500001):
if target % i != 0:
continue
if '0' in str(i):
continue
j = int(target / i)
if '0' in str(j):
continue
print('Factors: ' + str(i) + ' : ' + str(j))
exit |
# Databricks notebook source
# MAGIC %run ./_utility-methods $lesson="12.1"
# COMMAND ----------
DA.cleanup()
DA.init(create_db=False)
DA.conclude_setup()
# COMMAND ----------
def print_sql(rows, sql):
html = f"<textarea style=\"width:100%\" rows={rows}> \n{sql.strip()}</textarea>"
displayHTML(html)
# COMM... | DA.cleanup()
DA.init(create_db=False)
DA.conclude_setup()
def print_sql(rows, sql):
html = f'<textarea style="width:100%" rows={rows}> \n{sql.strip()}</textarea>'
display_html(html)
def _generate_config():
print_sql(33, f"""\nCREATE DATABASE IF NOT EXISTS {DA.db_name}\nLOCATION '{DA.paths.working_dir}';\n... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__all__ = ["test_bettersis", "test_siscompleter", "test_texteditor", "test_update_checker"]
| __all__ = ['test_bettersis', 'test_siscompleter', 'test_texteditor', 'test_update_checker'] |
'''
Dataset information
'''
coco_classes = [
'person',
'bicycle',
'car',
'motorcycle',
'airplane',
'bus',
'train',
'truck',
'boat',
'traffic_light',
'fire_hydrant',
'stop_sign',
'parking_meter',
'bench',
'bird',
'cat',
'dog',
'horse',
'sheep',... | """
Dataset information
"""
coco_classes = ['person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic_light', 'fire_hydrant', 'stop_sign', 'parking_meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow', 'elephant', 'bear', 'zebra', 'giraffe', 'backpack', 'umbrella', 'handb... |
line = input().split()
n = int(line[0])
t = int(line[1])
visited = {0}
line = [int(i) for i in input().split()]
current = 1
while(current != t):
if(current in visited or current > len(line)):
print("NO")
break
else:
visited.add(current)
current += line[current - 1]
if(current == ... | line = input().split()
n = int(line[0])
t = int(line[1])
visited = {0}
line = [int(i) for i in input().split()]
current = 1
while current != t:
if current in visited or current > len(line):
print('NO')
break
else:
visited.add(current)
current += line[current - 1]
if current == t:... |
"""Default reserved words that should not be anonymized by sensitive word anonymization."""
# Copyright 2018 Intentionet
#
# 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... | """Default reserved words that should not be anonymized by sensitive word anonymization."""
default_reserved_words = {'!', '"', '#', '$', '%', '&', '&&', '(', ')', '*', '+', ',', '-', '-h', '.', '/', '1', '10000full', '10000half', '1000full', '1000half', '1000m/full', '100full', '100g', '100gfull', '100ghalf', '100half... |
# Create a task list. A user is presented with the text below.
# Let them select an option to list all of their tasks, add a task to their list, delete a task, or quit the program.
# Make each option a different function in your program.
# Do NOT use Google.
# Do NOT use other students.
# Try to do this on your own.
... | def main():
problem1()
def problem1():
user = ''
things_to_do = ['dishes', 'cut grass', 'cook']
while thingsToDo != '0':
things_to_do = input(' Enter a task:')
print(Task1='List all task', Task2='Add a task to the list', Task3='Delete a task', Task4='To quit the program:')
if __name__ =... |
class StringFormat(object):
def format_string(self, pattern, *args, **kwargs):
return pattern.format(*args, **kwargs)
# To create distributable package:
#
# python3 setup.py bdist_wheel --universal
#
# Upload the package to pypi:
#
# twine upload dist/* | class Stringformat(object):
def format_string(self, pattern, *args, **kwargs):
return pattern.format(*args, **kwargs) |
# function to check string is
# palindrome or not
def isPalindrome(str):
# Run loop from 0 to len/2
for i in xrange(0, len(str)/2):
if str[i] != str[len(str)-i-1]:
return False
return True
# main function
s = "malayalam"
ans = isPalindrome(s)
if (ans):
print("Yes")
else:
print("No")
| def is_palindrome(str):
for i in xrange(0, len(str) / 2):
if str[i] != str[len(str) - i - 1]:
return False
return True
s = 'malayalam'
ans = is_palindrome(s)
if ans:
print('Yes')
else:
print('No') |
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("@bazel_tools//tools/build_defs/repo:jvm.bzl", "jvm_maven_import_external")
def rules_mybuilder_dependencies(
maven_servers = ["https://repo1.maven.org/maven2/"]... | load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive', 'http_file')
load('@bazel_tools//tools/build_defs/repo:utils.bzl', 'maybe')
load('@bazel_tools//tools/build_defs/repo:jvm.bzl', 'jvm_maven_import_external')
def rules_mybuilder_dependencies(maven_servers=['https://repo1.maven.org/maven2/']):
"""
... |
class FileHelper:
"""description of class"""
file = "";
def __init__(self, filename):
self.file = filename;
def ReadFile(self):
fileStream = open(self.file);
lines = fileStream.readlines();
fileStream.close();
return lines;
| class Filehelper:
"""description of class"""
file = ''
def __init__(self, filename):
self.file = filename
def read_file(self):
file_stream = open(self.file)
lines = fileStream.readlines()
fileStream.close()
return lines |
"""
PRACTICE ON BOOLEAN LOGIC!!!!
"""
"""
1) what will be displayed?
"""
# print(True) # True
# print(type(True)) # bool
# print(1 == 1) # True
# print(1 == 2) # False
# print(1 != 1) # False
# print(1 < 2) # True
# print(not (-1 <= 1)) # False
# print(1 > 2 and 2 < 5) # short-circuit --> False
# print(1 > 2 ... | """
PRACTICE ON BOOLEAN LOGIC!!!!
"""
'\n1) what will be displayed?\n'
'\n2) what will be displayed?\n'
'\n3) what will be displayed?\n' |
n = int(input())
s = [input().split() for _ in [0] * n]
c = 0
for i in s:
if i[1] == "JPY":
c += int(i[0])
else:
c += float(i[0]) * 380000
print(c)
| n = int(input())
s = [input().split() for _ in [0] * n]
c = 0
for i in s:
if i[1] == 'JPY':
c += int(i[0])
else:
c += float(i[0]) * 380000
print(c) |
# -*- coding: utf-8 -*-
"""\
This is a python port of "Goose" orignialy licensed to Gravity.com
under one or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.
Python port was written by Xavier Grangier for Recrutae
Gravity.co... | """This is a python port of "Goose" orignialy licensed to Gravity.com
under one or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.
Python port was written by Xavier Grangier for Recrutae
Gravity.com licenses this file
to yo... |
# PingPong_Calculator.py
def convert_in2cm(inches):
return inches * 2.54
def convert_lb2kg(pounds):
return pounds / 2.2
height_in = int(input("Enter your height in inches: "))
weight_lb = int(input("Enter your weight in pounds: "))
height_cm = convert_in2cm(height_in)
weight_kg = convert_lb2kg(weight_lb)
ping_p... | def convert_in2cm(inches):
return inches * 2.54
def convert_lb2kg(pounds):
return pounds / 2.2
height_in = int(input('Enter your height in inches: '))
weight_lb = int(input('Enter your weight in pounds: '))
height_cm = convert_in2cm(height_in)
weight_kg = convert_lb2kg(weight_lb)
ping_pong_tall = round(height_... |
n = int(input())
count = [0]*5
for _ in range(n):
s = list(input())
if s[0] == "M":
count[0] += 1
if s[0] == "A":
count[1] += 1
if s[0] == "R":
count[2] += 1
if s[0] == "C":
count[3] += 1
if s[0] == "H":
count[4] += 1
ans = 0
for i in range(3):
for j ... | n = int(input())
count = [0] * 5
for _ in range(n):
s = list(input())
if s[0] == 'M':
count[0] += 1
if s[0] == 'A':
count[1] += 1
if s[0] == 'R':
count[2] += 1
if s[0] == 'C':
count[3] += 1
if s[0] == 'H':
count[4] += 1
ans = 0
for i in range(3):
for j... |
class MemLog:
""" In-memory Raft log (for testing) """
def __init__(self):
self.log = [(0, None)]
def get_term(self, index):
if index < len(self.log):
return self.log[index][0]
def append(self, entries):
pass
def last(self):
log_index = len(self.log) -... | class Memlog:
""" In-memory Raft log (for testing) """
def __init__(self):
self.log = [(0, None)]
def get_term(self, index):
if index < len(self.log):
return self.log[index][0]
def append(self, entries):
pass
def last(self):
log_index = len(self.log) -... |
#
# PySNMP MIB module TRUNK-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TRUNK-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:27:43 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_union, value_range_constraint, constraints_intersection, value_size_constraint) ... |
"""Statistics"""
def counter(li,number):
num = 0
for c in li:
if c == number:
num += 1
return num
def occurance_dic(li):
dic = {}
for number in li:
dic[number] = counter(li,number)
return dic
def mean(li):
"""Avearage or mean of elements - shaonutil.stats.mean(list of numbers)"""
return sum(li)/len(li)... | """Statistics"""
def counter(li, number):
num = 0
for c in li:
if c == number:
num += 1
return num
def occurance_dic(li):
dic = {}
for number in li:
dic[number] = counter(li, number)
return dic
def mean(li):
"""Avearage or mean of elements - shaonutil.stats.mea... |
problem_string = '73167176531330624919225119674426574742355349194934'\
'96983520312774506326239578318016984801869478851843'\
'85861560789112949495459501737958331952853208805511'\
'12540698747158523863050715693290963295227443043557'\
'668966489504452445... | problem_string = '73167176531330624919225119674426574742355349194934969835203127745063262395783180169848018694788518438586156078911294949545950173795833195285320880551112540698747158523863050715693290963295227443043557668966489504452445231617318564030987111217223831136222989342338030813533627661428280644448664523874930... |
class Solution:
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
if len(prices) <= 1:
return 0
ans = 0
for key in range(1, len(prices)):
ans += prices[key] - prices[key-1] if prices[key]-prices[key-1]>0 else 0
... | class Solution:
def max_profit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
if len(prices) <= 1:
return 0
ans = 0
for key in range(1, len(prices)):
ans += prices[key] - prices[key - 1] if prices[key] - prices[key - 1] > 0... |
def genesis_block_generation():
print("\nGenesis Block is generated. The Blockchain system is up...!")
print("Miners will now collect transactions from memPool and start building blocks...\n\n")
def block_info(block, consensus_algorithm):
print("The following block has been proposed by " + block['ge... | def genesis_block_generation():
print('\nGenesis Block is generated. The Blockchain system is up...!')
print('Miners will now collect transactions from memPool and start building blocks...\n\n')
def block_info(block, consensus_algorithm):
print('The following block has been proposed by ' + block['generator... |
# encoding: utf-8
# Versioning convention
# https://www.python.org/dev/peps/pep-0440/
__version__ = "0.4.0"
| __version__ = '0.4.0' |
def get_price(auction_id):
return 0
def make_bid(bid, auction_id):
auction_price = get_price(auction_id)
if bid <= auction_price:
return False
auction_price = bid
return True | def get_price(auction_id):
return 0
def make_bid(bid, auction_id):
auction_price = get_price(auction_id)
if bid <= auction_price:
return False
auction_price = bid
return True |
add_location_schema = {
"type": "object",
"properties": {
"state": {"type": "string"},
"capital": {"type": "string"}
},
"required": ["state", "capital"]
}
update_capital_schema = {
"type": "object",
"properties": {
"capital": {"type": "string"}
},
"required": ["c... | add_location_schema = {'type': 'object', 'properties': {'state': {'type': 'string'}, 'capital': {'type': 'string'}}, 'required': ['state', 'capital']}
update_capital_schema = {'type': 'object', 'properties': {'capital': {'type': 'string'}}, 'required': ['capital']} |
def AppendFIFO(list, value, max_values):
list.append(value)
while len(list) > max_values:
list.pop(0)
return list
def clamp(v, low, high):
"""clamp v to the range of [low, high]"""
return max(low, min(v, high))
| def append_fifo(list, value, max_values):
list.append(value)
while len(list) > max_values:
list.pop(0)
return list
def clamp(v, low, high):
"""clamp v to the range of [low, high]"""
return max(low, min(v, high)) |
class Parentheses(object):
def find_pair(self, num_pairs):
if num_pairs is None:
raise TypeError('num_pairs cannot be None')
if num_pairs < 0:
raise ValueError('num_pairs cannot be < 0')
if not num_pairs:
return []
results = []
curr_result... | class Parentheses(object):
def find_pair(self, num_pairs):
if num_pairs is None:
raise type_error('num_pairs cannot be None')
if num_pairs < 0:
raise value_error('num_pairs cannot be < 0')
if not num_pairs:
return []
results = []
curr_resu... |
'''
* @Author: csy
* @Date: 2019-04-28 13:48:03
* @Last Modified by: csy
* @Last Modified time: 2019-04-28 13:48:03
'''
age = 12
if age < 4:
print("Your admission cost is $0.")
elif age < 18:
print("Your admission cost is $5.")
else:
print("Your admission cost is $10.")
age = 12
if age < 4:
price... | """
* @Author: csy
* @Date: 2019-04-28 13:48:03
* @Last Modified by: csy
* @Last Modified time: 2019-04-28 13:48:03
"""
age = 12
if age < 4:
print('Your admission cost is $0.')
elif age < 18:
print('Your admission cost is $5.')
else:
print('Your admission cost is $10.')
age = 12
if age < 4:
price ... |
def test_task_names_endpoint(client):
tasks_json = client.get(f'api/meta/tasks').json
tasks = [task['task_name'] for task in tasks_json]
assert {'classification',
'regression',
'ts_forecasting',
'clustering'} == set(tasks)
def test_metric_names_classification_endpoint(c... | def test_task_names_endpoint(client):
tasks_json = client.get(f'api/meta/tasks').json
tasks = [task['task_name'] for task in tasks_json]
assert {'classification', 'regression', 'ts_forecasting', 'clustering'} == set(tasks)
def test_metric_names_classification_endpoint(client):
classification_metrics_js... |
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def closestValue(self, root: TreeNode, target: float) -> int:
result = root.val
while root:
if abs(root.val - target) <... | class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def closest_value(self, root: TreeNode, target: float) -> int:
result = root.val
while root:
if abs(root.val - target) < abs(result - target):
... |
"""
Compatibility layer for Python 3/Python 2 single codebase
"""
try:
_basestring = basestring
_bytes_or_unicode = (str, unicode)
except NameError:
_basestring = str
_bytes_or_unicode = (bytes, str) | """
Compatibility layer for Python 3/Python 2 single codebase
"""
try:
_basestring = basestring
_bytes_or_unicode = (str, unicode)
except NameError:
_basestring = str
_bytes_or_unicode = (bytes, str) |
cooling_type_limits = {
'PASSIVE_COOLING': {'low': 0, 'high':35 },
'HI_ACTIVE_COOLING': {'low': 0, 'high':45 },
'MED_ACTIVE_COOLING': {'low': 0, 'high':40 }
}
boundary_constants_text = {'TOO_LOW':'too low', 'TOO_HIGH':'too high', 'NORMAL': 'normal'}
boundary_constants = {'low':'TOO_LOW', 'high': 'TOO_HIGH', 'normal' :... | cooling_type_limits = {'PASSIVE_COOLING': {'low': 0, 'high': 35}, 'HI_ACTIVE_COOLING': {'low': 0, 'high': 45}, 'MED_ACTIVE_COOLING': {'low': 0, 'high': 40}}
boundary_constants_text = {'TOO_LOW': 'too low', 'TOO_HIGH': 'too high', 'NORMAL': 'normal'}
boundary_constants = {'low': 'TOO_LOW', 'high': 'TOO_HIGH', 'normal': ... |
class SilverbachConjecture:
def solve(self, n):
ls = [True] * 2001
for i in xrange(2, 2001):
if ls[i]:
for j in xrange(2 * i, 2001, i):
ls[j] = False
for i in xrange(2, n - 1):
if not ls[i] and not ls[n - i]:
return ... | class Silverbachconjecture:
def solve(self, n):
ls = [True] * 2001
for i in xrange(2, 2001):
if ls[i]:
for j in xrange(2 * i, 2001, i):
ls[j] = False
for i in xrange(2, n - 1):
if not ls[i] and (not ls[n - i]):
retu... |
# Advent of Code - Davertical 2 - Part One
def result(data):
horizontal, vertical = 0, 0
for line in data:
direction, i = line.split(' ')
i = int(i)
if direction == 'forward':
horizontal += i
if direction == 'up':
vertical -= i
if direction == '... | def result(data):
(horizontal, vertical) = (0, 0)
for line in data:
(direction, i) = line.split(' ')
i = int(i)
if direction == 'forward':
horizontal += i
if direction == 'up':
vertical -= i
if direction == 'down':
vertical += i
ret... |
"""
Lester Interpretor
"""
class parser( object ):
def __init__( self ):
self.comment = '#'
self.escape = '\\'
self.group = '()[]{}'
self.string = '"\''
self.token = ' '
self._stack = []
self._text = ''
def is_open( self ):
return l... | """
Lester Interpretor
"""
class Parser(object):
def __init__(self):
self.comment = '#'
self.escape = '\\'
self.group = '()[]{}'
self.string = '"\''
self.token = ' '
self._stack = []
self._text = ''
def is_open(self):
return len(self._text) > 0
... |
# Codecademy's training document works with Markov_chains.py
# Inna I. Ivanova
training_doc2 = """
"Papa Don't Preach"
Madonna Lyrics
Papa, I know you're going to be upset
'Cause I was always your little girl
But you should know by now, I'm not a baby
You always taught me right from wrong
I need your help, daddy, ple... | training_doc2 = '\n"Papa Don\'t Preach"\nMadonna Lyrics\n\nPapa, I know you\'re going to be upset\n\'Cause I was always your little girl\nBut you should know by now, I\'m not a baby\nYou always taught me right from wrong\nI need your help, daddy, please be strong\nI may be young at heart, but I know what I\'m saying\n\... |
#
# @lc app=leetcode.cn id=277 lang=python3
#
# [277] find-the-celebrity
#
None
# @lc code=end | None |
#
# PySNMP MIB module E7-Notifications-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/E7-Notifications-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:58:58 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection) ... |
config = {
"domain": "example.com",
"ruleset": "autoses",
"s3bucket": "autoses-incoming",
"sidprefix": "sid-autoses",
"awsaccountid": "<FILL ME>",
"region": "us-east-1",
"sqs": {
"message_retention_period": 14 * 24 * 3600,
"visibility_timeout": 60,
},
"lambda": {
... | config = {'domain': 'example.com', 'ruleset': 'autoses', 's3bucket': 'autoses-incoming', 'sidprefix': 'sid-autoses', 'awsaccountid': '<FILL ME>', 'region': 'us-east-1', 'sqs': {'message_retention_period': 14 * 24 * 3600, 'visibility_timeout': 60}, 'lambda': {'file_name': 'lambda_function.py', 'handler': 'lambda_handler... |
# Lab 01 - Exercise 01
# First Number
print("Please insert a first number: ", end='')
try:
a = int(input())
except ValueError:
print("That didn't seem a number!")
quit()
# Second Number
print("Please now insert a second number: ", end='')
try:
b = int(input())
except ValueError:
print("That didn't... | print('Please insert a first number: ', end='')
try:
a = int(input())
except ValueError:
print("That didn't seem a number!")
quit()
print('Please now insert a second number: ', end='')
try:
b = int(input())
except ValueError:
print("That didn't seem a number!")
quit()
print('\nTheir sum is: ' + ... |
class Router(object):
def db_for_read(self, model, **hints):
if model._meta.model_name == 'articleotherdb':
return 'other'
return None
def db_for_write(self, model, **hints):
if model._meta.model_name == 'articleotherdb':
return 'other'
return None
d... | class Router(object):
def db_for_read(self, model, **hints):
if model._meta.model_name == 'articleotherdb':
return 'other'
return None
def db_for_write(self, model, **hints):
if model._meta.model_name == 'articleotherdb':
return 'other'
return None
... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Delivery Costs',
'version': '1.0',
'category': 'Inventory/Delivery',
'description': """
Allows you to add delivery methods in sale orders and picking.
=========================================... | {'name': 'Delivery Costs', 'version': '1.0', 'category': 'Inventory/Delivery', 'description': '\nAllows you to add delivery methods in sale orders and picking.\n==============================================================\n\nYou can define your own carrier for prices. When creating\ninvoices from picking, the system ... |
{
'targets': [
{
'target_name': 'DTraceProviderBindings',
'conditions': [
['OS=="mac" or OS=="solaris" or OS=="freebsd"', {
'sources': [
'dtrace_provider.cc',
'dtrace_probe.cc',
],
... | {'targets': [{'target_name': 'DTraceProviderBindings', 'conditions': [['OS=="mac" or OS=="solaris" or OS=="freebsd"', {'sources': ['dtrace_provider.cc', 'dtrace_probe.cc'], 'include_dirs': ['libusdt'], 'dependencies': ['libusdt'], 'libraries': ['-L<(module_root_dir)/libusdt -l usdt']}]]}, {'target_name': 'libusdt', 'ty... |
"""
Given a non-negative integer num, repeatedly add all its digits
until the result has only one digit.
Example:
Input: 38
Output: 2
Explanation: The process is like: 3 + 8 = 11, 1 + 1 = 2.
Since 2 has only one digit, return it.
Follow up:
Could you do it without any loop/recursion in O(1) runtime?
"""
... | """
Given a non-negative integer num, repeatedly add all its digits
until the result has only one digit.
Example:
Input: 38
Output: 2
Explanation: The process is like: 3 + 8 = 11, 1 + 1 = 2.
Since 2 has only one digit, return it.
Follow up:
Could you do it without any loop/recursion in O(1) runtime?
"""
... |
# coding:utf-8
'''
@Copyright:LintCode
@Author: taoleetju
@Problem: http://www.lintcode.com/problem/construct-binary-tree-from-preorder-and-inorder-traversal
@Language: Python
@Datetime: 16-02-18 17:13
'''
"""
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
s... | """
@Copyright:LintCode
@Author: taoleetju
@Problem: http://www.lintcode.com/problem/construct-binary-tree-from-preorder-and-inorder-traversal
@Language: Python
@Datetime: 16-02-18 17:13
"""
'\nDefinition of TreeNode:\nclass TreeNode:\n def __init__(self, val):\n self.val = val\n self.left, self.rig... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"GaborLayer": "00_core.ipynb",
"GaborLayer.create_xy_grid": "00_core.ipynb",
"GaborLayer.build": "00_core.ipynb",
"GaborLayer.create_kernel": "00_core.ipynb",
"GaborLayer.c... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'GaborLayer': '00_core.ipynb', 'GaborLayer.create_xy_grid': '00_core.ipynb', 'GaborLayer.build': '00_core.ipynb', 'GaborLayer.create_kernel': '00_core.ipynb', 'GaborLayer.call': '00_core.ipynb', 'GaborLayer.get_config': '00_core.ipynb', 'SigmaRegula... |
def word_lengths(
file_path: str
) -> set:
return {
len(token)
for line in open(file_path)
for token in line.split()
}
def main():
file_path = 'comprehensions/file.txt'
result = word_lengths(file_path)
print(result)
if __name__ == '__main__':
main()
| def word_lengths(file_path: str) -> set:
return {len(token) for line in open(file_path) for token in line.split()}
def main():
file_path = 'comprehensions/file.txt'
result = word_lengths(file_path)
print(result)
if __name__ == '__main__':
main() |
# This file is executed on every boot (including wake-boot from deepsleep)
# notify
print('RUN: boot.py')
| print('RUN: boot.py') |
class EndnoteObject:
supported_cff_versions = ['1.0.3', '1.1.0']
supported_endnote_props = ['author', 'year', 'keyword', 'doi', 'name', 'url']
def __init__(self, cff_object, initialize_empty=False):
self.cff_object = cff_object
self.author = None
self.doi = None
self.keywor... | class Endnoteobject:
supported_cff_versions = ['1.0.3', '1.1.0']
supported_endnote_props = ['author', 'year', 'keyword', 'doi', 'name', 'url']
def __init__(self, cff_object, initialize_empty=False):
self.cff_object = cff_object
self.author = None
self.doi = None
self.keyword... |
class CoordinatesAreNotGiven(Exception):
def __init__(self, lon=1, lat=1, alt=1) -> None:
self.message = ""
if not lon:
self.message += "Lon can't be None\n"
if not lat:
self.message += "Lat can't be None\n"
if not alt:
self.message += "Alt can't ... | class Coordinatesarenotgiven(Exception):
def __init__(self, lon=1, lat=1, alt=1) -> None:
self.message = ''
if not lon:
self.message += "Lon can't be None\n"
if not lat:
self.message += "Lat can't be None\n"
if not alt:
self.message += "Alt can't ... |
def minRemoveToMakeValid(s):
# O(n) time and space
# doesn't use stack
s = list(s)
open_count = 0
for ind, c in enumerate(s):
if c == "(":
open_count += 1
elif c == ")":
if not open_count: # if open_count is 0
s[ind] = ""
... | def min_remove_to_make_valid(s):
s = list(s)
open_count = 0
for (ind, c) in enumerate(s):
if c == '(':
open_count += 1
elif c == ')':
if not open_count:
s[ind] = ''
else:
open_count -= 1
for i in range(len(s) - 1, -1, -1... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 Graz University of Technology.
#
# invenio-campusonline is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see LICENSE file for more
# details.
"""This module is used to import/export from/to the CampusOnline System."""
| """This module is used to import/export from/to the CampusOnline System.""" |
def nonify(func):
def newAnB(*args, **arg):
res = func(*args, **arg)
return None if not res else res
return newAnB
| def nonify(func):
def new_an_b(*args, **arg):
res = func(*args, **arg)
return None if not res else res
return newAnB |
# [Required] Hero's Succession (22300)
echo = 20011005
successor = 1142158
mir = 1013000
sm.setSpeakerID(mir)
sm.sendNext("Master, master, look at this. There's something wrong with one of my scales!")
sm.setPlayerAsSpeaker()
sm.sendSay("That's...?! \r\n\r\n"
"Mir, one of your scales is showing the #bOnyx Dragon's ... | echo = 20011005
successor = 1142158
mir = 1013000
sm.setSpeakerID(mir)
sm.sendNext("Master, master, look at this. There's something wrong with one of my scales!")
sm.setPlayerAsSpeaker()
sm.sendSay("That's...?! \r\n\r\nMir, one of your scales is showing the #bOnyx Dragon's Symbol#k!")
sm.setSpeakerID(mir)
sm.sendSay("R... |
"""
https://www.freecodecamp.org/learn/scientific-computing-with-python/python-for-everybody/iterations-more-patterns
Which of these evaluates to False?
0 == 0.0
0 is 0.0
0 is not 0.0
0 = 0.0
"""
print(0 == 0.0)
print(0 is 0.0)
print(0 is not 0.0)
| """
https://www.freecodecamp.org/learn/scientific-computing-with-python/python-for-everybody/iterations-more-patterns
Which of these evaluates to False?
0 == 0.0
0 is 0.0
0 is not 0.0
0 = 0.0
"""
print(0 == 0.0)
print(0 is 0.0)
print(0 is not 0.0) |
"""
*
* Author: Juarez Paulino(coderemite)
* Email: juarez.paulino@gmail.com
*
"""
a=''.join([input()for _ in[0]*4])
print('YNEOS'[all([a[x],a[x+1],a[x+4],a[x+5]].count('.')==2 for x in[0,1,2,4,5,6,8,9,10])::2]) | """
*
* Author: Juarez Paulino(coderemite)
* Email: juarez.paulino@gmail.com
*
"""
a = ''.join([input() for _ in [0] * 4])
print('YNEOS'[all(([a[x], a[x + 1], a[x + 4], a[x + 5]].count('.') == 2 for x in [0, 1, 2, 4, 5, 6, 8, 9, 10]))::2]) |
#from coustmer import formate_coustmer
def formate_coustmer(first, last ,location):
full_name = '%s' '%s' %(first,last)
if location:
return '%s (%s)' %(full_name,location)
else:
return full_name
if __name__ == '__main__':
print(formate_coustmer('Lilly ', 'jokowich',location = 'california'))
... | def formate_coustmer(first, last, location):
full_name = '%s%s' % (first, last)
if location:
return '%s (%s)' % (full_name, location)
else:
return full_name
if __name__ == '__main__':
print(formate_coustmer('Lilly ', 'jokowich', location='california')) |
# dashboard_generator.py
print("-----------------------")
print("MONTH: March 2018")
print("-----------------------")
print("CRUNCHING THE DATA...")
print("-----------------------")
print("TOTAL MONTHLY SALES: $12,000.71")
print("-----------------------")
print("TOP SELLING PRODUCTS:")
print(" 1) Button-Down Shirt... | print('-----------------------')
print('MONTH: March 2018')
print('-----------------------')
print('CRUNCHING THE DATA...')
print('-----------------------')
print('TOTAL MONTHLY SALES: $12,000.71')
print('-----------------------')
print('TOP SELLING PRODUCTS:')
print(' 1) Button-Down Shirt: $6,960.35')
print(' 2) Sup... |
class MulticastDelegate(object):
def __init__(self):
self.delegates = []
def __iadd__(self, delegate):
self.add(delegate)
return self
def add(self, delegate):
self.delegates.append(delegate)
def __isub__(self, delegate):
self.delegates.remove(delegate)
... | class Multicastdelegate(object):
def __init__(self):
self.delegates = []
def __iadd__(self, delegate):
self.add(delegate)
return self
def add(self, delegate):
self.delegates.append(delegate)
def __isub__(self, delegate):
self.delegates.remove(delegate)
... |
class Exceptions:
class NetworkError(Exception):
def __str__(self):
return "Network Error"
class FileSystemError(Exception):
def __str__(self):
return "File System Error" | class Exceptions:
class Networkerror(Exception):
def __str__(self):
return 'Network Error'
class Filesystemerror(Exception):
def __str__(self):
return 'File System Error' |
#!/usr/bin/env python3
l = ''
with open('input') as f:
l = [int(x) for x in f.read().split(',')]
s = sorted(l)[len(l)//2]
d = 0
for i in l:
d += abs(s - i)
print(d)
| l = ''
with open('input') as f:
l = [int(x) for x in f.read().split(',')]
s = sorted(l)[len(l) // 2]
d = 0
for i in l:
d += abs(s - i)
print(d) |
class UserDomain:
def is_active(self, user):
return user.email_confirmed
user_domain = UserDomain()
| class Userdomain:
def is_active(self, user):
return user.email_confirmed
user_domain = user_domain() |
FILTERS = []
ENDP_COUNT = 0
class Filter(object):
def __init__(self):
self.urls = []
self.filter_all = False
self.order = 0
def filter(self, request, response): pass
def _continue(self, request, response):
return {"request": request, "response": response} | filters = []
endp_count = 0
class Filter(object):
def __init__(self):
self.urls = []
self.filter_all = False
self.order = 0
def filter(self, request, response):
pass
def _continue(self, request, response):
return {'request': request, 'response': response} |
"""
Challenge #2
Write a function that takes an integer 'minutes' and converts it to seconds.
Examples:
- convert(5) -> 300
- convert(3) -> 180
- convert(2) -> 120
"""
def convert(minutes):
return minutes * 60
print(convert(5)) #300
print(convert(3)) #180
| """
Challenge #2
Write a function that takes an integer 'minutes' and converts it to seconds.
Examples:
- convert(5) -> 300
- convert(3) -> 180
- convert(2) -> 120
"""
def convert(minutes):
return minutes * 60
print(convert(5))
print(convert(3)) |
"""
Implement atoi to convert a string to an integer.
Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself
what are the possible input cases.
Notes: It is intended for this problem to be specified vaguely (ie, no given input specs). You are respons... | """
Implement atoi to convert a string to an integer.
Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself
what are the possible input cases.
Notes: It is intended for this problem to be specified vaguely (ie, no given input specs). You are responsible t... |
class LaneFitter():
def __init__(self, camera):
if camera is None:
raise Exception("Lane fitter needs a camera to undistort and warp")
self.camera = camera
def getfit(self, img, prev_left_fit=None, prev_right_fit=None):
undistorted = self.camera.undistort(img)
binary... | class Lanefitter:
def __init__(self, camera):
if camera is None:
raise exception('Lane fitter needs a camera to undistort and warp')
self.camera = camera
def getfit(self, img, prev_left_fit=None, prev_right_fit=None):
undistorted = self.camera.undistort(img)
binary_... |
#raspberry pi GPIO pin definitions
#using physical pin #'s, not GPIO #'s
class GpioPins:
LEFT_MOTOR_FORWARD = 31
LEFT_MOTOR_BACKWARD = 33
RIGHT_MOTOR_FORWARD = 35
RIGHT_MOTOR_BACKWARD = 37
ULTRASONIC_SENSOR_TRIG = 7
ULTRASONIC_SENSOR_ECHO = 12
IR_SENSOR_LEFT = 24
IR_SENSOR_RIGHT = 26
... | class Gpiopins:
left_motor_forward = 31
left_motor_backward = 33
right_motor_forward = 35
right_motor_backward = 37
ultrasonic_sensor_trig = 7
ultrasonic_sensor_echo = 12
ir_sensor_left = 24
ir_sensor_right = 26
servo_ultrasonic_sensor = 19
servo_horizontal_camera = 0
servo_v... |
"""986. Interval List Intersections"""
class Solution(object):
def intervalIntersection(self, A, B):
"""
:type A: List[List[int]]
:type B: List[List[int]]
:rtype: List[List[int]]
"""
p1 = 0
p2 = 0
res = []
while p1 < len(A) and p2 < len(B): # ... | """986. Interval List Intersections"""
class Solution(object):
def interval_intersection(self, A, B):
"""
:type A: List[List[int]]
:type B: List[List[int]]
:rtype: List[List[int]]
"""
p1 = 0
p2 = 0
res = []
while p1 < len(A) and p2 < len(B):
... |
n=int(input())
ans=0
fac=1
for i in range(1,n+1):
fac*=i
ans+=fac
print(ans) | n = int(input())
ans = 0
fac = 1
for i in range(1, n + 1):
fac *= i
ans += fac
print(ans) |
# Copyright 2014-2018 The PySCF Developers. 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 appl... | """
NIST physical constants
https://physics.nist.gov/cuu/Constants/
https://physics.nist.gov/cuu/Constants/Table/allascii.txt
"""
light_speed = 137.03599967994
bohr = 0.52917721092
alpha = 0.0072973525664
g_electron = 2.00231930436182
e_mass = 9.10938356e-31
proton_mass = 1.672621898e-27
bohr_magneton = 9.274009994e-2... |
des = 'Desafio-025 strings-004'
print ('{}'.format(des))
#Crie um programa que leia o nome de uma pessoa e diga se ela tem "silva" no seu nome.
nome = str(input('Digite um nome: ')).strip()
print ('Seu nome tem Silva? {}'.format('silva' in nome.lower()))
| des = 'Desafio-025 strings-004'
print('{}'.format(des))
nome = str(input('Digite um nome: ')).strip()
print('Seu nome tem Silva? {}'.format('silva' in nome.lower())) |
def is_armstrong_number(number):
number_string = str(number)
digits = len(number_string)
if digits == 1:
return True
else:
armstrong = sum([int(digit) ** digits for digit in number_string])
return number == armstrong
| def is_armstrong_number(number):
number_string = str(number)
digits = len(number_string)
if digits == 1:
return True
else:
armstrong = sum([int(digit) ** digits for digit in number_string])
return number == armstrong |
class Error(Exception):
"""Base class for exceptions in this module."""
def __str__(self):
return self.message
class EmptyUrlFieldError(Error):
def __init__(self):
self.message = "URL field cannot be empty."
class InvalidUrlError(Error):
def __init__(self, url):
self.message... | class Error(Exception):
"""Base class for exceptions in this module."""
def __str__(self):
return self.message
class Emptyurlfielderror(Error):
def __init__(self):
self.message = 'URL field cannot be empty.'
class Invalidurlerror(Error):
def __init__(self, url):
self.message... |
REPORT_CASE_INDEX="report_cases_czei39du507m9mmpqk3y01x72a3ux4p0"
REPORT_CASE_MAPPING={'_meta': {'comment': '2013-11-05 dmyung',
'created': None},
'date_detection': False,
'date_formats': ['yyyy-MM-dd',
"yyyy-MM-dd'T'HH:mm:ssZZ",
"yyyy-MM-dd'T'HH:mm:ss.SSSSSS",
... | report_case_index = 'report_cases_czei39du507m9mmpqk3y01x72a3ux4p0'
report_case_mapping = {'_meta': {'comment': '2013-11-05 dmyung', 'created': None}, 'date_detection': False, 'date_formats': ['yyyy-MM-dd', "yyyy-MM-dd'T'HH:mm:ssZZ", "yyyy-MM-dd'T'HH:mm:ss.SSSSSS", "yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'", "yyyy-MM-dd'T'HH:mm... |
class Result:
pass
class CombingResult(Result):
def __init__(self, elapsed_time_preprocess: int, elapsed_time_algo: int, hash: int, size_a: int, size_b: int,
name_a, name_b):
self.hash = hash
self.elapsed_time_algo = elapsed_time_algo
self.elapsed_time_preprocess = ela... | class Result:
pass
class Combingresult(Result):
def __init__(self, elapsed_time_preprocess: int, elapsed_time_algo: int, hash: int, size_a: int, size_b: int, name_a, name_b):
self.hash = hash
self.elapsed_time_algo = elapsed_time_algo
self.elapsed_time_preprocess = elapsed_time_preproc... |
# Defining constants
# TODO: add all species and experiments
# TODO mapping
RNA_SEQ_LIST = ['files/Caenorhabditis_elegans_RNA-Seq_read_counts_TPM_FPKM_GSE16552.tsv']
AFF_LIST = ['files/Caenorhabditis_elegans_probesets_GSE19972_A-AFFY-60_gcRMA.tsv']
exp_dict = {}
for file in RNA_SEQ_LIST:
# Opening the library fil... | rna_seq_list = ['files/Caenorhabditis_elegans_RNA-Seq_read_counts_TPM_FPKM_GSE16552.tsv']
aff_list = ['files/Caenorhabditis_elegans_probesets_GSE19972_A-AFFY-60_gcRMA.tsv']
exp_dict = {}
for file in RNA_SEQ_LIST:
with open(file) as lib_file:
lib_file.readline()
for line in lib_file:
line... |
s= raw_input()
if s=="yes" or s=="YES" or s=="Yes":
print ("Yes")
else:
print ("No") | s = raw_input()
if s == 'yes' or s == 'YES' or s == 'Yes':
print('Yes')
else:
print('No') |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: io
class DriverType(object):
UNDEFINED = 0
LIBHDFS = 1
LIBHDFS3 = 2
| class Drivertype(object):
undefined = 0
libhdfs = 1
libhdfs3 = 2 |
'''
Created on 1.11.2016
@author: Samuli Rahkonen
'''
def kbinterrupt_decorate(func):
'''
Decorator.
Adds KeyboardInterrupt handling to ControllerBase methods.
'''
def func_wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
except KeyboardInterrupt:
... | """
Created on 1.11.2016
@author: Samuli Rahkonen
"""
def kbinterrupt_decorate(func):
"""
Decorator.
Adds KeyboardInterrupt handling to ControllerBase methods.
"""
def func_wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
except KeyboardInterrupt:
... |
class BaseLayout(object):
@classmethod
def render(cls, items):
raise NotImplementedError
| class Baselayout(object):
@classmethod
def render(cls, items):
raise NotImplementedError |
# THIS FILE IS GENERATED FROM THEANO SETUP.PY
short_version = '0.9.0beta1'
version = '0.9.0beta1'
git_revision = 'RELEASE'
full_version = '0.9.0beta1.dev-%(git_revision)s' % {
'git_revision': git_revision}
release = False
if not release:
version = full_version
| short_version = '0.9.0beta1'
version = '0.9.0beta1'
git_revision = 'RELEASE'
full_version = '0.9.0beta1.dev-%(git_revision)s' % {'git_revision': git_revision}
release = False
if not release:
version = full_version |
"""
Custom path converters for urls
https://docs.djangoproject.com/en/dev/topics/http/urls/#registering-custom-path-converters
"""
# Match a hexcolor in the url.
# Must start with a # and contain 6 hexidecimal characters (0-9 and A-F),
# in either lower or upper case.
class HexColorConverter:
regex = '([A-Fa-f0-9... | """
Custom path converters for urls
https://docs.djangoproject.com/en/dev/topics/http/urls/#registering-custom-path-converters
"""
class Hexcolorconverter:
regex = '([A-Fa-f0-9]{6})'
def to_python(self, value):
return value
def to_url(self, value):
return value
class Fileformatconverter:... |
#!/usr/bin/env python3
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
BUCKET_NAME_BKT = "aws-saas-s3"
BUCKET_NAME_PFX = "aws-saas-s3-prefix"
BUCKET_NAME_TAG = "aws-saas-s3-tag"
BUCKET_NAME_AP = "aws-saas-s3-ap"
BUCKET_NAME_NSDB = "aws-saas-s3-dbns"
| bucket_name_bkt = 'aws-saas-s3'
bucket_name_pfx = 'aws-saas-s3-prefix'
bucket_name_tag = 'aws-saas-s3-tag'
bucket_name_ap = 'aws-saas-s3-ap'
bucket_name_nsdb = 'aws-saas-s3-dbns' |
'''
The provided code stub reads and integer, n, from STDIN.
For all non-negative integers i<n, print i^2.
'''
if __name__ == '__main__':
n = int(input())
for i in range(n):
print(i**2)
| """
The provided code stub reads and integer, n, from STDIN.
For all non-negative integers i<n, print i^2.
"""
if __name__ == '__main__':
n = int(input())
for i in range(n):
print(i ** 2) |
#
# PySNMP MIB module CISCO-SYSLOG-CAPABILITY (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-SYSLOG-CAPABILITY
# Produced by pysmi-0.3.4 at Wed May 1 12:13:49 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, single_value_constraint, constraints_union, constraints_intersection) ... |
princ_amount = float(input(" Please Enter the Principal Amount : "))
rate_of_int = float(input(" Please Enter the Rate Of Interest : "))
time_period = float(input(" Please Enter Time period in Years : "))
simple_interest = (princ_amount * rate_of_int * time_period) / 100
print("\nSimple Interest for Principal Amo... | princ_amount = float(input(' Please Enter the Principal Amount : '))
rate_of_int = float(input(' Please Enter the Rate Of Interest : '))
time_period = float(input(' Please Enter Time period in Years : '))
simple_interest = princ_amount * rate_of_int * time_period / 100
print('\nSimple Interest for Principal Amount ... |
M = int(input())
a = {int(i) for i in input().split()}
N = int(input())
b = {int(i) for i in input().split()}
c = sorted(a.symmetric_difference(b))
[print(i) for i in c]
| m = int(input())
a = {int(i) for i in input().split()}
n = int(input())
b = {int(i) for i in input().split()}
c = sorted(a.symmetric_difference(b))
[print(i) for i in c] |
class Solution:
def totalNQueens(self, n: int) -> int:
path = [-1] * n
used = [False] * n
cnt = 0
def backtrack(k):
'''
k is the current level, 0-idexed
'''
nonlocal path, used, cnt
if k == n:
cnt +=... | class Solution:
def total_n_queens(self, n: int) -> int:
path = [-1] * n
used = [False] * n
cnt = 0
def backtrack(k):
"""
k is the current level, 0-idexed
"""
nonlocal path, used, cnt
if k == n:
cnt += 1
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.