content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
def analyze(vw):
for fva in vw.getFunctions():
analyzeFunction(vw, fva)
def analyzeFunction(vw, fva):
fakename = vw.getName(fva+1)
if fakename is not None:
vw.makeName(fva+1, None)
vw.makeName(fva, fakename)
| def analyze(vw):
for fva in vw.getFunctions():
analyze_function(vw, fva)
def analyze_function(vw, fva):
fakename = vw.getName(fva + 1)
if fakename is not None:
vw.makeName(fva + 1, None)
vw.makeName(fva, fakename) |
"""exercism bob module."""
def response(hey_bob):
"""
Model responses for input text.
:param hey_bob string - The input provided.
:return string - The respons.
"""
answer = 'Whatever.'
hey_bob = hey_bob.strip()
yelling = hey_bob.isupper()
asking_question = len(hey_bob) > 0 and he... | """exercism bob module."""
def response(hey_bob):
"""
Model responses for input text.
:param hey_bob string - The input provided.
:return string - The respons.
"""
answer = 'Whatever.'
hey_bob = hey_bob.strip()
yelling = hey_bob.isupper()
asking_question = len(hey_bob) > 0 and hey_... |
# problem : https://leetcode.com/problems/first-missing-positive/
# time complexity : O(N)
class Solution:
def firstMissingPositive(self, nums: List[int]) -> int:
s = set(nums)
ans = 1
for num in nums:
if(ans in s):
ans += 1
else:
brea... | class Solution:
def first_missing_positive(self, nums: List[int]) -> int:
s = set(nums)
ans = 1
for num in nums:
if ans in s:
ans += 1
else:
break
return ans |
M = []
Schedule = []
def maximum(a,b):
if a > b :
return a
else:
return b
def calculate_predecessor(jobs,n):
p = [0 for i in range(n+1)]
cur_job = n
chosen_job = cur_job - 1
while cur_job > 1 :
if chosen_job <= 0 :
p[cur_job] = 0
cur_job=cur_job-1
... | m = []
schedule = []
def maximum(a, b):
if a > b:
return a
else:
return b
def calculate_predecessor(jobs, n):
p = [0 for i in range(n + 1)]
cur_job = n
chosen_job = cur_job - 1
while cur_job > 1:
if chosen_job <= 0:
p[cur_job] = 0
cur_job = cur_j... |
# This file defines the board layout, as well as some other information
# about the bitmaps.
BaseName = '@/usr/home/srn/work/scrabble/bitmaps/'
Bitmaps = {
'D':{'bitmap':BaseName + 'DW.xbm', 'background':'pink'},
'd':{'bitmap':BaseName + 'DL.xbm', 'background':'sky blue'},
'T':{'bitmap':BaseName + 'TW.xbm', 'backgr... | base_name = '@/usr/home/srn/work/scrabble/bitmaps/'
bitmaps = {'D': {'bitmap': BaseName + 'DW.xbm', 'background': 'pink'}, 'd': {'bitmap': BaseName + 'DL.xbm', 'background': 'sky blue'}, 'T': {'bitmap': BaseName + 'TW.xbm', 'background': 'red'}, 't': {'bitmap': BaseName + 'TL.xbm', 'background': 'blue'}, ' ': {'bitmap'... |
def je_prastevilo(n):
if n < 2 or n % 2 == 0:
return n == 2
i = 3
while i * i <= n:
if n % i == 0:
return False
i += 2
return True
def poljuben_krog(n):
return ( 2 * n - 1 ) ** 2 - ( 2 * ( n - 1 ) - 1 ) ** 2 if n != 1 else 1
def je_lih_kvadrat(n):
return n *... | def je_prastevilo(n):
if n < 2 or n % 2 == 0:
return n == 2
i = 3
while i * i <= n:
if n % i == 0:
return False
i += 2
return True
def poljuben_krog(n):
return (2 * n - 1) ** 2 - (2 * (n - 1) - 1) ** 2 if n != 1 else 1
def je_lih_kvadrat(n):
return n ** (1 /... |
#
# PySNMP MIB module ASYNCOS-MAIL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASYNCOS-MAIL-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:13:32 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, value_range_constraint, constraints_intersection, single_value_constraint) ... |
def bytes_to_iso(i):
numbers = [(1000, 'k'), (1000000, 'M'), (1000000000, 'G'),
(1000000000000, 'T')]
if i < 1000:
return '{} B'.format(i)
for n in numbers:
if i < n[0] * 1000:
return '{:.1f} {}B'.format(i / n[0], n[1])
return '{:.1f} PB'.format(i)
def iso_to... | def bytes_to_iso(i):
numbers = [(1000, 'k'), (1000000, 'M'), (1000000000, 'G'), (1000000000000, 'T')]
if i < 1000:
return '{} B'.format(i)
for n in numbers:
if i < n[0] * 1000:
return '{:.1f} {}B'.format(i / n[0], n[1])
return '{:.1f} PB'.format(i)
def iso_to_bytes(i):
n... |
"""
basic box type follow:
"""
BOX_TYPE_FTYP="FTYP"
BOX_TYPE_MDAT="MDAT"
BOX_TYPE_MOOV="MOOV"
BOX_TYPE_UDTA="UDTA"
BOX_HEADER_SIZE =8
| """
basic box type follow:
"""
box_type_ftyp = 'FTYP'
box_type_mdat = 'MDAT'
box_type_moov = 'MOOV'
box_type_udta = 'UDTA'
box_header_size = 8 |
dataset_type = 'SUNRGBDDataset'
data_root = 'data/sunrgbd/'
class_names = ('bed', 'table', 'sofa', 'chair', 'toilet', 'desk', 'dresser',
'night_stand', 'bookshelf', 'bathtub')
train_pipeline = [
dict(
type='LoadPointsFromFile',
coord_type='DEPTH',
shift_height=True,
lo... | dataset_type = 'SUNRGBDDataset'
data_root = 'data/sunrgbd/'
class_names = ('bed', 'table', 'sofa', 'chair', 'toilet', 'desk', 'dresser', 'night_stand', 'bookshelf', 'bathtub')
train_pipeline = [dict(type='LoadPointsFromFile', coord_type='DEPTH', shift_height=True, load_dim=6, use_dim=[0, 1, 2]), dict(type='LoadAnnotati... |
n = int(input())
while n != 0:
db = {}
for i in range(n):
name = input()
color_size = input()
if color_size in db:
aux = db[color_size]
aux.append(name)
db[color_size] = aux
else:
db[color_size] = [name]
print('')
if ... | n = int(input())
while n != 0:
db = {}
for i in range(n):
name = input()
color_size = input()
if color_size in db:
aux = db[color_size]
aux.append(name)
db[color_size] = aux
else:
db[color_size] = [name]
print('')
if 'white ... |
"""
Contains defintions for all custom exceptions raised.
"""
class ConfigError(Exception):
"""
Indicates an error with the specified configuration file.
"""
def __init__(self, message, response=({"status": "Config File Error"}, 500)):
super().__init__(message)
self.response = response... | """
Contains defintions for all custom exceptions raised.
"""
class Configerror(Exception):
"""
Indicates an error with the specified configuration file.
"""
def __init__(self, message, response=({'status': 'Config File Error'}, 500)):
super().__init__(message)
self.response = response... |
"""Production settings unique to the remote gradebook plugin."""
def plugin_settings(settings):
"""Settings for the canvas integration plugin."""
settings.CANVAS_ACCESS_TOKEN = settings.AUTH_TOKENS.get(
"CANVAS_ACCESS_TOKEN", settings.CANVAS_ACCESS_TOKEN
)
settings.CANVAS_BASE_URL = settings.E... | """Production settings unique to the remote gradebook plugin."""
def plugin_settings(settings):
"""Settings for the canvas integration plugin."""
settings.CANVAS_ACCESS_TOKEN = settings.AUTH_TOKENS.get('CANVAS_ACCESS_TOKEN', settings.CANVAS_ACCESS_TOKEN)
settings.CANVAS_BASE_URL = settings.ENV_TOKENS.get('... |
"""
Design a Tic-tac-toe game that is played between two players on a n x n grid.
You may assume the following rules:
A move is guaranteed to be valid and is placed on an empty block.
Once a winning condition is reached, no more moves is allowed.
A player who succeeds in placing n of their marks in a horizontal, vert... | """
Design a Tic-tac-toe game that is played between two players on a n x n grid.
You may assume the following rules:
A move is guaranteed to be valid and is placed on an empty block.
Once a winning condition is reached, no more moves is allowed.
A player who succeeds in placing n of their marks in a horizontal, vert... |
#intitial Variable setup
List_Base = []
Image_Scale = []
Image=[]
def Input(): # Gets the users input values for the image, makes sure input is exactly 100 characters and only includes 1 and 0
User_Input = str(input("Enter values here: \n"))
while any(c.isalpha() for c in User_Input) is True:
print("\... | list__base = []
image__scale = []
image = []
def input():
user__input = str(input('Enter values here: \n'))
while any((c.isalpha() for c in User_Input)) is True:
print("\nERROR: Input can only contain 1's and 0's.\n")
user__input = str(input('Enter values here: \n'))
while len(User_Input) !... |
def detail_samtools(Regions, Read_depth):
# create a detailed list with all depth values from the same region in a sub list. From samtools depth calculations
# samtools generates a depth file with: chr, position and coverage depth value
# Regeions comes from the bed file with chr, start, stop, region name
... | def detail_samtools(Regions, Read_depth):
detailed = []
list_temp = []
previous_chr = Read_depth[0][0]
region_row = 0
count = 0
index = 0
size_list = len(Read_depth)
for line in Read_depth:
region_row = Regions[index]
if str(line[0]) == str(previous_chr) and int(line[1]) ... |
"""Demonstrate docstrings and does nothing really."""
def myfunc():
"""Simple function to demonstrate circleci."""
return 1
print(myfunc())
| """Demonstrate docstrings and does nothing really."""
def myfunc():
"""Simple function to demonstrate circleci."""
return 1
print(myfunc()) |
# -*- coding: utf-8 -*-
"""All tests for the project."""
| """All tests for the project.""" |
target_prime = 10000
current_num = 2
current_denominator = current_num - 1
while True:
if current_denominator == 1:
# this is a prime number
# print(current_num)
target_prime = target_prime - 1
if target_prime == 0:
print("Prime number is " + str(current_num))
break
current_num = curr... | target_prime = 10000
current_num = 2
current_denominator = current_num - 1
while True:
if current_denominator == 1:
target_prime = target_prime - 1
if target_prime == 0:
print('Prime number is ' + str(current_num))
break
current_num = current_num + 1
current_d... |
s = open('day01.txt', 'r').read()
left = 0
right = 0
for i in range(len(s)):
if s[i] == '(':
left += 1
else:
right += 1
if left - right == -1:
print(i)
break
| s = open('day01.txt', 'r').read()
left = 0
right = 0
for i in range(len(s)):
if s[i] == '(':
left += 1
else:
right += 1
if left - right == -1:
print(i)
break |
N = int(input()) # input() gets the whole line, int() converts from string to int
dictionary = {} # dictionaries appear to work the same as objects in javascript
for i in range(0, N):
inputArray = input().split()
# okay this line is cool, converts indices 1->end of inputArray to floats, puts them in a list
... | n = int(input())
dictionary = {}
for i in range(0, N):
input_array = input().split()
marks = list(map(float, inputArray[1:]))
dictionary[inputArray[0]] = sum(marks) / float(len(marks))
print('%.2f' % dictionary[input()]) |
# Bo Pace, Oct 2016
# Quicksort
# Quicksort has a similar divide-and-conquer strategy to that
# of merge sort, but has a space advantage of doing all of the
# sorting in place. The worst case complexity is worse than
# merge sort, however. Quicksort has a best and average case
# complexity of O(nlogn), with a worst cas... | def quicksort(arr, first=0, last=None):
if last == None:
last = len(arr) - 1
if first < last:
split_index = partition(arr, first, last)
quicksort(arr, first, split_index - 1)
quicksort(arr, split_index + 1, last)
return arr
def partition(arr, first, last):
pivot_val = ar... |
# This file is part of the pylint-ignore project
# https://github.com/mbarkhau/pylint-ignore
#
# Copyright (c) 2020 Manuel Barkhau (mbarkhau@gmail.com) - MIT License
# SPDX-License-Identifier: MIT
__version__ = "2020.1017"
| __version__ = '2020.1017' |
#Kunal Gautam
#Codewars : @Kunalpod
#Problem name: CamelCase Method
#Problem level: 6 kyu
def camel_case(string): return ''.join([x[0].upper()+x[1:] for x in string.lower().split()])
| def camel_case(string):
return ''.join([x[0].upper() + x[1:] for x in string.lower().split()]) |
RUN_TEST = False
TEST_SOLUTION = 26
TEST_INPUT_FILE = 'test_input_day_11.txt'
INPUT_FILE = 'input_day_11.txt'
MIN_NUM_SEATS_TO_MAKE_EMPTY = 5
ARGS = [MIN_NUM_SEATS_TO_MAKE_EMPTY]
def main_part2(input_file, min_num_seats_to_make_empty):
with open(input_file) as file:
seat_occupations = list(map(lambda li... | run_test = False
test_solution = 26
test_input_file = 'test_input_day_11.txt'
input_file = 'input_day_11.txt'
min_num_seats_to_make_empty = 5
args = [MIN_NUM_SEATS_TO_MAKE_EMPTY]
def main_part2(input_file, min_num_seats_to_make_empty):
with open(input_file) as file:
seat_occupations = list(map(lambda line:... |
# Problem 1: What will be the output of the following code
x = 1
def f():
return x
print (x) # Ans-1
print (f()) # Ans-1
#Problem 2: What will be the output of the following program?
x = 1
def f():
x = 2
return x
print (x) # Ans-1
print (f()) # Ans-2
print (x) # Ans-1
#Problem 3: What wi... | x = 1
def f():
return x
print(x)
print(f())
x = 1
def f():
x = 2
return x
print(x)
print(f())
print(x)
x = 1
def f():
x = 2
y = 1
return x + y
print(x)
print(f())
print(x)
x = 2
def f(a):
x = a * a
return x
y = f(3)
print(x, y)
def difference(x, y):
return x - y
difference(5, 2)... |
# https://leetcode.com/submissions/detail/433325047/?from=explore&item_id=3577
# Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def isBalanced(self, root: TreeNode) ->... | class Treenode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def is_balanced(self, root: TreeNode) -> bool:
def helper(node):
if not node:
return (0, True)
(l_heigh... |
'''
Given a list of positive integers, the adjacent integers will perform the float division. For example, [2,3,4] -> 2 / 3 / 4.
However, you can add any number of parenthesis at any position to change the priority of operations. You should find out how to add parenthesis to get the maximum result, and return the corr... | """
Given a list of positive integers, the adjacent integers will perform the float division. For example, [2,3,4] -> 2 / 3 / 4.
However, you can add any number of parenthesis at any position to change the priority of operations. You should find out how to add parenthesis to get the maximum result, and return the corr... |
class constants:
# username, Type: String
# this email id shouldn't have 2 factor authentication
username = "<enter a valid email id>"
# password, Type: String
password = "<enter the appropriate password>"
# to email addresses => Enter a valid to email address and this email id need not disable the... | class Constants:
username = '<enter a valid email id>'
password = '<enter the appropriate password>'
to_addresses = ['<--to email address-->']
req_age = 18
req_slot = 1
pincode = [530040]
pin_code_url = 'api/v2/appointment/sessions/public/findByPin'
day_check_count = 3
sleep_peak_tim... |
# Time: O(n)
# Space: O(1)
# Given two integers n and k,
# you need to construct a list which contains n different positive integers ranging
# from 1 to n and obeys the following requirement:
# Suppose this list is [a1, a2, a3, ... , an],
# then the list [|a1 - a2|, |a2 - a3|, |a3 - a4|, ... , |an-1 - an|] has exact... | class Solution(object):
def construct_array(self, n, k):
"""
:type n: int
:type k: int
:rtype: List[int]
"""
result = []
(left, right) = (1, n)
while left <= right:
if k % 2:
result.append(left)
left += 1
... |
class Solution:
def countStudents(self, students: List[int], sandwiches: List[int]) -> int:
sandwiches = deque(sandwiches)
students = deque(students)
while not (all(a!=sandwiches[0] for a in students)):
if students[0] == sandwiches[0]:
students.popleft()
... | class Solution:
def count_students(self, students: List[int], sandwiches: List[int]) -> int:
sandwiches = deque(sandwiches)
students = deque(students)
while not all((a != sandwiches[0] for a in students)):
if students[0] == sandwiches[0]:
students.popleft()
... |
class DictX(dict):
def __getattr__(self, key):
try:
return self[key]
except KeyError as k:
raise AttributeError(k)
def __setattr__(self, key, value):
self[key] = value
def __delattr__(self, key):
try:
del self[key]
ex... | class Dictx(dict):
def __getattr__(self, key):
try:
return self[key]
except KeyError as k:
raise attribute_error(k)
def __setattr__(self, key, value):
self[key] = value
def __delattr__(self, key):
try:
del self[key]
except KeyErr... |
class Model:
def __init__(self, model, feature_names):
self.model = model
self.feature_names = feature_names
self.ID = ""
def get_ID(self):
return self.ID
def fit(self, X, y):
self.model.fit(X, y)
def predict(self, X):
return self.model.predict(X)
... | class Model:
def __init__(self, model, feature_names):
self.model = model
self.feature_names = feature_names
self.ID = ''
def get_id(self):
return self.ID
def fit(self, X, y):
self.model.fit(X, y)
def predict(self, X):
return self.model.predict(X)
... |
#input={'names_raw':names_raw,'orders_raw':orders_raw,'phones_raw':phones_raw,'emails_raw':emails_raw,'start_index':0,'limit':500,'length':1251}
start_index = int(float(input['start_index']))
limit = int(input['limit'])
length = int(float(input['length']))
if (start_index+limit) >= length:
end_index = length
... | start_index = int(float(input['start_index']))
limit = int(input['limit'])
length = int(float(input['length']))
if start_index + limit >= length:
end_index = length
finished = True
else:
end_index = start_index + limit
finished = False
names = input['names_raw'].split('*')[start_index:end_index]
orders ... |
"""
Utility functions for canary tests
"""
CANARY_TYPES = ["cpu_noise", "fio", "iperf"]
def should_run(config):
"""
Checks if canary tests should run.
"""
if "canaries" in config["bootstrap"] and config["bootstrap"]["canaries"] == "none":
return False
if "canaries" in config["test_control... | """
Utility functions for canary tests
"""
canary_types = ['cpu_noise', 'fio', 'iperf']
def should_run(config):
"""
Checks if canary tests should run.
"""
if 'canaries' in config['bootstrap'] and config['bootstrap']['canaries'] == 'none':
return False
if 'canaries' in config['test_control']... |
'''
def find( element, list):
for i, j in enumerate( list):
if( j == element):
return i;
return -1
data_path = "../data/data_uci.pgn"
fd = open( data_path)
'''
def find( element, list):
for i, j in enumerate( list):
if( j[0:2] == element):
return i;
return -1
data_path = "../data/data_uci.pgn"
... | """
def find( element, list):
for i, j in enumerate( list):
if( j == element):
return i;
return -1
data_path = "../data/data_uci.pgn"
fd = open( data_path)
"""
def find(element, list):
for (i, j) in enumerate(list):
if j[0:2] == element:
return i
return -1
data_path = '../data/d... |
power = {'BUSES': {'Area': 1.33155,
'Bus/Area': 1.33155,
'Bus/Gate Leakage': 0.00662954,
'Bus/Peak Dynamic': 0.0,
'Bus/Runtime Dynamic': 0.0,
'Bus/Subthreshold Leakage': 0.0691322,
'Bus/Subthreshold Leakage with power gating': 0.0259246,
'Gate... | power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate Leakage': 0.00662954, 'Peak Dynamic': 0.0, 'Runtime Dynamic': 0.0, 'Subthres... |
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 2 13:17:03 2018
@author: michaelek
"""
#####################################
### Misc parameters for the various functions
hydro_server = 'edwprod01'
hydro_database = 'hydro'
crc_server = 'edwdev01'
crc_database = 'ConsentsReporting'
allo_table = 'reporting.CrcAlloSite... | """
Created on Tue Oct 2 13:17:03 2018
@author: michaelek
"""
hydro_server = 'edwprod01'
hydro_database = 'hydro'
crc_server = 'edwdev01'
crc_database = 'ConsentsReporting'
allo_table = 'reporting.CrcAlloSiteSumm'
site_table = 'ExternalSite'
ts_summ_table = 'TSDataNumericDailySumm'
ts_table = 'TSDataNumericDaily'
lf_... |
"""Internal utilities (not exposed to the API)."""
def pop(obj, *args, **kwargs):
"""Safe pop for list or dict.
Parameters
----------
obj : list or dict
Input collection.
elem : default=-1 fot lists, mandatory for dicts
Element to pop.
default : optional
Default value.... | """Internal utilities (not exposed to the API)."""
def pop(obj, *args, **kwargs):
"""Safe pop for list or dict.
Parameters
----------
obj : list or dict
Input collection.
elem : default=-1 fot lists, mandatory for dicts
Element to pop.
default : optional
Default value.
... |
numbers = [1,3,5,4,6,2,8,9,7]
prime_numbers = []
non_prime_numbers = []
i = 0
while i < len(numbers):
if numbers[i] % 2 == 0:
prime_numbers.append(numbers[i])
else:
non_prime_numbers.append(numbers[i])
i += 1
print(f'Obshii spisok {numbers}')
print(f'4etnye 4islami: {prime_numbers}')
print... | numbers = [1, 3, 5, 4, 6, 2, 8, 9, 7]
prime_numbers = []
non_prime_numbers = []
i = 0
while i < len(numbers):
if numbers[i] % 2 == 0:
prime_numbers.append(numbers[i])
else:
non_prime_numbers.append(numbers[i])
i += 1
print(f'Obshii spisok {numbers}')
print(f'4etnye 4islami: {prime_numbers}')... |
#
# PySNMP MIB module TRAPEZE-NETWORKS-INFO-RF-DETECT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TRAPEZE-NETWORKS-INFO-RF-DETECT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:27:18 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Usi... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_union, value_range_constraint, constraints_intersection, single_value_constraint) ... |
# Created by MechAviv
# Kinesis Introduction
# Map ID :: 331001000
# Hideout :: HQ
JAY = 1531001
sm.setNpcOverrideBoxChat(JAY)
if sm.sendAskYesNo("You lost your gear? Ugh, dude! Don't trash my stuff! It takes time to hack those things together. Here, I have backups of your primary and secondary, but only the basic mo... | jay = 1531001
sm.setNpcOverrideBoxChat(JAY)
if sm.sendAskYesNo("You lost your gear? Ugh, dude! Don't trash my stuff! It takes time to hack those things together. Here, I have backups of your primary and secondary, but only the basic models. TRY to respect these, hmm?"):
sm.giveItem(1353200)
sm.giveItem(1262000) |
class RealtimeException(Exception):
pass
class ParseFailureException(Exception):
"""Failure to parse a logical replication test_decoding message"""
| class Realtimeexception(Exception):
pass
class Parsefailureexception(Exception):
"""Failure to parse a logical replication test_decoding message""" |
users = []
class User():
def __init__(self, username, pin, balance=0):
self.username = username
self.pin = pin
self.balance = balance
def deposit(self, amount):
self.balance += amount
print(f"Deposited ${amount} into account {self.username}")
self.print_balance(... | users = []
class User:
def __init__(self, username, pin, balance=0):
self.username = username
self.pin = pin
self.balance = balance
def deposit(self, amount):
self.balance += amount
print(f'Deposited ${amount} into account {self.username}')
self.print_balance()... |
def is_it_true(anything):
if anything:
print('yes, it is true')
else:
print('no, it is false')
| def is_it_true(anything):
if anything:
print('yes, it is true')
else:
print('no, it is false') |
# -*- coding: utf-8 -*-
def split_data(filename):
data = {}
with open(filename, 'r') as openFile:
f = openFile.readlines()[1:]
for line in f:
line_elements = line.rstrip('\r\n').split(',')
key = line_elements[1]
if key in data:
data[key].appen... | def split_data(filename):
data = {}
with open(filename, 'r') as open_file:
f = openFile.readlines()[1:]
for line in f:
line_elements = line.rstrip('\r\n').split(',')
key = line_elements[1]
if key in data:
data[key].append([line_elements[0], lin... |
"""
Created by Epic at 9/1/20
"""
class HTTPException(Exception):
"""Exception that's thrown when an HTTP request operation fails."""
def __init__(self, request, data):
self.request = request
self.data = data
super().__init__(data)
class Forbidden(HTTPException):
"""Exception tha... | """
Created by Epic at 9/1/20
"""
class Httpexception(Exception):
"""Exception that's thrown when an HTTP request operation fails."""
def __init__(self, request, data):
self.request = request
self.data = data
super().__init__(data)
class Forbidden(HTTPException):
"""Exception that... |
# Duolingo username and password
USERNAME = 'username'
PASSWORD = 'password'
# Locations
# Production
# DB_FILE = r"db/personal.db"
# LOG_DIR = 'path to logging directory'
# WEB_PAGE = 'path to destination web page'
# TEMPLATE_PAGE = 'path to template for web page'
# Development & Test
DB_FILE = r"db/personal.db"
L... | username = 'username'
password = 'password'
db_file = 'db/personal.db'
log_dir = './example/logs/'
web_page = './example/duo.html'
template_page = './templates/duo_template.html' |
print("Question 1:")
'''
Use for, .split(), and if to create a Statement that will print out words that start with 's':
st = 'Print only the words that start with s in this sentence'
'''
st = 'Print only the words that start with s in this sentence'
list_worlds = st.split(' ')
for word in list_worlds:
if word[0] ... | print('Question 1:')
"\nUse for, .split(), and if to create a Statement that will print out words that start with 's':\n\nst = 'Print only the words that start with s in this sentence'\n"
st = 'Print only the words that start with s in this sentence'
list_worlds = st.split(' ')
for word in list_worlds:
if word[0] =... |
print('Digite seu nome:')
nome = input()
print('Digite sua idade:')
idade = int(input())
podeVotar = idade>=16
print(nome,'tem',idade,'anos:',podeVotar)
| print('Digite seu nome:')
nome = input()
print('Digite sua idade:')
idade = int(input())
pode_votar = idade >= 16
print(nome, 'tem', idade, 'anos:', podeVotar) |
OK = '+OK\r\n'
def reply(v):
'''
formats the value as a redis reply
'''
return '$%s\r\n%s\r\n' % (len(v), v) | ok = '+OK\r\n'
def reply(v):
"""
formats the value as a redis reply
"""
return '$%s\r\n%s\r\n' % (len(v), v) |
lost_fights = int(input())
helmet_price = float(input())
sword_price = float(input())
shield_price = float(input())
armor_price = float(input())
shield_repair_count = 0
total_cost = 0
for i in range(1, lost_fights+1):
if i % 2 == 0:
total_cost += helmet_price
if i % 3 == 0:
total_co... | lost_fights = int(input())
helmet_price = float(input())
sword_price = float(input())
shield_price = float(input())
armor_price = float(input())
shield_repair_count = 0
total_cost = 0
for i in range(1, lost_fights + 1):
if i % 2 == 0:
total_cost += helmet_price
if i % 3 == 0:
total_cost += sword... |
# -*- coding: utf-8 -*-
def get_version_info():
"""Provide the package version"""
VERSION = '0.0.2'
return VERSION
__version__ = get_version_info()
| def get_version_info():
"""Provide the package version"""
version = '0.0.2'
return VERSION
__version__ = get_version_info() |
def end_other(a, b):
a = a.lower()
b = b.lower()
if a[-(len(b)):] == b or a == b[-(len(a)):]:
return True
return False
| def end_other(a, b):
a = a.lower()
b = b.lower()
if a[-len(b):] == b or a == b[-len(a):]:
return True
return False |
"""
This module contains the result sentences and intents for the German version
of the Assistant information app.
"""
# Result sentences
RESULT_ASSISTANT_APPS = "Ich habe {} apps: {}."
RESULT_ASSISTANT_ID = "Meine ID ist {}."
RESULT_ASSISTANT_INTENTS = "Ich kenne {} Befehle."
RESULT_ASSISTANT_NAME = "Mein Name ist {}... | """
This module contains the result sentences and intents for the German version
of the Assistant information app.
"""
result_assistant_apps = 'Ich habe {} apps: {}.'
result_assistant_id = 'Meine ID ist {}.'
result_assistant_intents = 'Ich kenne {} Befehle.'
result_assistant_name = 'Mein Name ist {}.'
result_assistant_... |
class ParameterTypeError(Exception):
"""Exception raised for errors in the input parameter.
Attributes:
parameter -- input parameter which caused the error
message -- explanation of the error
"""
def __init__(self, parameter, parameter_name, parameter_type, message="The parameter can only be of type {}!"):
... | class Parametertypeerror(Exception):
"""Exception raised for errors in the input parameter.
Attributes:
parameter -- input parameter which caused the error
message -- explanation of the error
"""
def __init__(self, parameter, parameter_name, parameter_type, message='The parameter can only be of type {}!... |
"""
Given a binary tree, check whether it is a mirror of itself (ie, symmetric
around its center).
For example, this binary tree is symmetric:
1
/ \
2 2
/ \ / \
3 4 4 3
But the following is not:
1
/ \
2 2
\ \
3 3
"""
# Definition for a binary tree node.
# class TreeNode(object):
#... | """
Given a binary tree, check whether it is a mirror of itself (ie, symmetric
around its center).
For example, this binary tree is symmetric:
1
/ 2 2
/ \\ / 3 4 4 3
But the following is not:
1
/ 2 2
\\ 3 3
"""
class Solution(object):
def is_symmetric(self, root):
"""... |
"""
The Zen of SymPy.
"""
s = """The Zen of SymPy
Unevaluated is better than evaluated.
The user interface matters.
Printing matters.
Pure Python can be fast enough.
If it's too slow, it's (probably) your fault.
Documentation matters.
Correctness is more important than speed.
Push it in now and improve u... | """
The Zen of SymPy.
"""
s = "The Zen of SymPy\n\nUnevaluated is better than evaluated.\nThe user interface matters.\nPrinting matters.\nPure Python can be fast enough.\nIf it's too slow, it's (probably) your fault.\nDocumentation matters.\nCorrectness is more important than speed.\nPush it in now and improve upon it ... |
class PermissionBackend(object):
supports_object_permissions = True
supports_anonymous_user = True
def authenticate(self, **kwargs):
# always return a None user
return None
def has_perm(self, user, perm, obj=None):
if user.is_anonymous():
return False
if pe... | class Permissionbackend(object):
supports_object_permissions = True
supports_anonymous_user = True
def authenticate(self, **kwargs):
return None
def has_perm(self, user, perm, obj=None):
if user.is_anonymous():
return False
if perm in ['forums.add_forumthread', 'for... |
class A:
def m():
pass
def f():
pass
| class A:
def m():
pass
def f():
pass |
# -*- encoding: utf-8 -*-
class KlotskiBoardException(Exception):
def __init__(self, piece, kind_message):
message = "Wrong board configuration: {} '{}'".format(kind_message, piece)
super().__init__(message)
class WrongPieceValue(KlotskiBoardException):
def __init__(self, x):
super()... | class Klotskiboardexception(Exception):
def __init__(self, piece, kind_message):
message = "Wrong board configuration: {} '{}'".format(kind_message, piece)
super().__init__(message)
class Wrongpiecevalue(KlotskiBoardException):
def __init__(self, x):
super().__init__(x, 'wrong piece v... |
'''
A curious problem that involves 'rotating' a number and solving a number of contraints
Author: Daniel Haberstock
Date: 05/26/2018
Sources used:
https://stackoverflow.com/questions/19463556/string-contains-any-character-in-group
'''
def rotate(x):
# split up the integer into a list of single digit strings
... | """
A curious problem that involves 'rotating' a number and solving a number of contraints
Author: Daniel Haberstock
Date: 05/26/2018
Sources used:
https://stackoverflow.com/questions/19463556/string-contains-any-character-in-group
"""
def rotate(x):
splitx = [i for i in str(x)]
splitx.reverse()
y = ''
... |
def extractAlpenGlowTranslations(item):
"""
'Alpen Glow Translations'
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
tagmap = {
'Shu Nv Minglan' : 'The Legend of t... | def extract_alpen_glow_translations(item):
"""
'Alpen Glow Translations'
"""
(vol, chp, frag, postfix) = extract_vol_chapter_fragment_postfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
tagmap = {'Shu Nv Minglan': "The Legend of the Concubine's... |
S = input()
ans = (
'YES' if S.count('x') <= 7 else
'NO'
)
print(ans)
| s = input()
ans = 'YES' if S.count('x') <= 7 else 'NO'
print(ans) |
{
"targets": [
{
"target_name": "node-hide-console-window",
"sources": [ "node-hide-console-window.cc" ]
}
]
} | {'targets': [{'target_name': 'node-hide-console-window', 'sources': ['node-hide-console-window.cc']}]} |
class Node():
left = None
right = None
def __init__(self, element):
self.element = element
def __str__(self):
return "\t\t{}\n{}\t\t{}".format(self.element, self.left, self.right)
class BinaryTree():
head = None
def __init__(self, head):
self.head = Node(head... | class Node:
left = None
right = None
def __init__(self, element):
self.element = element
def __str__(self):
return '\t\t{}\n{}\t\t{}'.format(self.element, self.left, self.right)
class Binarytree:
head = None
def __init__(self, head):
self.head = node(head)
def __... |
# n=int(input())
# n2=input()
# ar=str(n2)
# ar=ar.split()
# pair={}
# total=0
# for i in ar:
# if i not in pair:
# pair[i]=1
# else:
# pair[i]+=1
# for j in pair:
# store=pair[j]//2
# total+=store
# print (total)
n=int(input("number of socks :"))
ar=input("colors of socks :").split()... | n = int(input('number of socks :'))
ar = input('colors of socks :').split()
pair = {}
total = 0
for i in ar:
if i not in pair:
pair[i] = 1
else:
pair[i] += 1
for j in pair:
store = pair[j] // 2
total += store
print(total) |
class Solution:
def trap(self, height: List[int]) -> int:
lmax,rmax = 0,0
l,r = 0,len(height)-1
ans = 0
while l<r:
if height[l]<height[r]:
if height[l]>=lmax:
... | class Solution:
def trap(self, height: List[int]) -> int:
(lmax, rmax) = (0, 0)
(l, r) = (0, len(height) - 1)
ans = 0
while l < r:
if height[l] < height[r]:
if height[l] >= lmax:
lmax = height[l]
else:
... |
lanjut = 'Y'
kumpulan_luas_segitiga = []
while lanjut == 'Y':
alas = float(input("Masukkan panjang alas (cm) : "))
tinggi = float(input("Masukkan tinggi segitiga (cm) : "))
luas = alas * tinggi * 0.5 # / 2
print("Luas segitiganya adalah :", luas)
kumpulan_luas_segitiga.append(luas)
lanjut = input("\nMau... | lanjut = 'Y'
kumpulan_luas_segitiga = []
while lanjut == 'Y':
alas = float(input('Masukkan panjang alas (cm) : '))
tinggi = float(input('Masukkan tinggi segitiga (cm) : '))
luas = alas * tinggi * 0.5
print('Luas segitiganya adalah :', luas)
kumpulan_luas_segitiga.append(luas)
lanjut = input('\nM... |
class StringFormatter(object):
def __init__(self):
pass
def justify(self, text, width=21):
'''
Inserts spaces between ':' and the remaining of the text to make
sure 'text' is 'width' characters in length.
'''
if len(text) < width:
index = text.find... | class Stringformatter(object):
def __init__(self):
pass
def justify(self, text, width=21):
"""
Inserts spaces between ':' and the remaining of the text to make
sure 'text' is 'width' characters in length.
"""
if len(text) < width:
index = text.find('... |
input_str = "12233221"
middle_size = int(round(len(input_str) / 2) )
print(f"middle_size: {middle_size}")
end_index = -1
start_index = 0
while start_index < middle_size:
char_from_start = input_str[start_index]
char_from_end = input_str[end_index]
end_index = end_index - 1
start_index = start_index... | input_str = '12233221'
middle_size = int(round(len(input_str) / 2))
print(f'middle_size: {middle_size}')
end_index = -1
start_index = 0
while start_index < middle_size:
char_from_start = input_str[start_index]
char_from_end = input_str[end_index]
end_index = end_index - 1
start_index = start_index + 1
... |
def main(self):
def handler(message):
if message["channel"] == "/service/player" and message.get("data") and message["data"].get("id") == 5:
self._emit("GameReset")
self.handlers["gameReset"] = handler
| def main(self):
def handler(message):
if message['channel'] == '/service/player' and message.get('data') and (message['data'].get('id') == 5):
self._emit('GameReset')
self.handlers['gameReset'] = handler |
# MQTT certificates
CA_CERT = "./../keys/ca/ca.crt"
CLIENT_CERT = "./../keys/client/client.crt"
CLIENT_KEY = "./../keys/client/client.key"
TLS_VERSION = 2
# MQTT broker options
TOPIC_NAME = "sensors/Temp"
HOSTNAME = "mqtt.sandyuraz.com"
PORT = 8883
# MQTT user options
CLIENT_ID = "sandissa-secret-me"
USERNAME = "kit... | ca_cert = './../keys/ca/ca.crt'
client_cert = './../keys/client/client.crt'
client_key = './../keys/client/client.key'
tls_version = 2
topic_name = 'sensors/Temp'
hostname = 'mqtt.sandyuraz.com'
port = 8883
client_id = 'sandissa-secret-me'
username = 'kitty'
password = None
qos_publish = 2
qos_subscribe = 2 |
class AccessStruct(object):
_size_to_width = [None, 0, 1, None, 2]
def __init__(self, mem, struct_def, struct_addr):
self.mem = mem
self.struct = struct_def(mem, struct_addr)
self.trace_mgr = getattr(self.mem, "trace_mgr", None)
def w_s(self, name, val):
struct, field = se... | class Accessstruct(object):
_size_to_width = [None, 0, 1, None, 2]
def __init__(self, mem, struct_def, struct_addr):
self.mem = mem
self.struct = struct_def(mem, struct_addr)
self.trace_mgr = getattr(self.mem, 'trace_mgr', None)
def w_s(self, name, val):
(struct, field) = s... |
x,y = input().split()
a = int(x)
b = int(y)
if a < b and (b-a) == 1:
print("Dr. Chaz will have " + str(b-a) + " piece of chicken left over!")
elif a < b:
print("Dr. Chaz will have " + str(b - a) + " pieces of chicken left over!")
elif a > b and (a-b) == 1:
print("Dr. Chaz needs " + str(a - b) + " ... | (x, y) = input().split()
a = int(x)
b = int(y)
if a < b and b - a == 1:
print('Dr. Chaz will have ' + str(b - a) + ' piece of chicken left over!')
elif a < b:
print('Dr. Chaz will have ' + str(b - a) + ' pieces of chicken left over!')
elif a > b and a - b == 1:
print('Dr. Chaz needs ' + str(a - b) + ' more ... |
n=int(input())
sh=5
li=0
cum=0
for i in range(n):
li = sh // 2
sh=(li*3)
cum+=li
print(cum) | n = int(input())
sh = 5
li = 0
cum = 0
for i in range(n):
li = sh // 2
sh = li * 3
cum += li
print(cum) |
n=1
s=0
while(n<50):
cn=n
mdx=0
mposfl=0
pos=0
nod=0
while(cn>0):
ld=cn%10
nod=nod+1
if(ld>mdx):
mdx=ld
mposfl=pos
cn=cn/10
pos=pos+1
apos=nod-mposfl
i=0
sr=0
while(n>0):
if(i==apos):
contin... | n = 1
s = 0
while n < 50:
cn = n
mdx = 0
mposfl = 0
pos = 0
nod = 0
while cn > 0:
ld = cn % 10
nod = nod + 1
if ld > mdx:
mdx = ld
mposfl = pos
cn = cn / 10
pos = pos + 1
apos = nod - mposfl
i = 0
sr = 0
while n > 0:... |
class Solution:
def romanToInt(self, s: str) -> int:
num = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
val, pre = 0, 0
for key in s:
n = num[key] if key in num else 0
val += -pre if n > pre else pre
pre = n
val += pre
... | class Solution:
def roman_to_int(self, s: str) -> int:
num = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
(val, pre) = (0, 0)
for key in s:
n = num[key] if key in num else 0
val += -pre if n > pre else pre
pre = n
val += pre
... |
lb = {
"loadBalancer": {
"name": "mani-test-lb",
"port": 80,
"protocol": "HTTP",
"virtualIps": [
{
"type": "PUBLIC"
}
]
}
}
nodes = {
"nodes": [
{
... | lb = {'loadBalancer': {'name': 'mani-test-lb', 'port': 80, 'protocol': 'HTTP', 'virtualIps': [{'type': 'PUBLIC'}]}}
nodes = {'nodes': [{'address': '10.2.2.3', 'port': 80, 'condition': 'ENABLED', 'type': 'PRIMARY'}]}
metadata = {'metadata': [{'key': 'color', 'value': 'red'}]}
config = {'name': 'lbaas', 'description': 'R... |
def includeme(config):
config.add_static_view('js', 'static/js', cache_max_age=3600)
config.add_static_view('css', 'static/css', cache_max_age=3600)
config.add_static_view('static', 'static', cache_max_age=3600)
config.add_static_view('dz', 'static/dropzone', cache_max_age=3600)
config.add_route('ad... | def includeme(config):
config.add_static_view('js', 'static/js', cache_max_age=3600)
config.add_static_view('css', 'static/css', cache_max_age=3600)
config.add_static_view('static', 'static', cache_max_age=3600)
config.add_static_view('dz', 'static/dropzone', cache_max_age=3600)
config.add_route('ad... |
def last_minute_enhancements(nodes):
count = 0
current_node = 0
for node in nodes:
if node > current_node:
count += 1
current_node = node
elif node == current_node:
count += 1
current_node = node + 1
return count
if __name__ == "__main__"... | def last_minute_enhancements(nodes):
count = 0
current_node = 0
for node in nodes:
if node > current_node:
count += 1
current_node = node
elif node == current_node:
count += 1
current_node = node + 1
return count
if __name__ == '__main__':
... |
# Opencast server address and credentials for api user
OPENCAST_URL = 'OPENCAST_URL'
OPENCAST_USER = 'OPENCAST_API_USER'
OPENCAST_PASSWD = 'OPENCAST_PASSWORD_USER'
# Timezone for the messages and from the XML file
MESSAGES_TIMEZONE = 'Europe/Berlin'
# Capture agent Klips dictionary
#
# Here you have to put the dic... | opencast_url = 'OPENCAST_URL'
opencast_user = 'OPENCAST_API_USER'
opencast_passwd = 'OPENCAST_PASSWORD_USER'
messages_timezone = 'Europe/Berlin'
capture_agent_dict = {} |
#
# PySNMP MIB module NHRP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NHRP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:51:40 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:1... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_union, value_size_constraint, constraints_intersection, value_range_constraint) ... |
env_name = 'BreakoutDeterministic-v4'
input_shape = [84, 84, 4]
output_size = 4
'''
env_name = 'SeaquestDeterministic-v4'
input_shape = [84, 84, 4]
output_size = 18
'''
'''
env_name = 'PongDeterministic-v4
input_shape = [84, 84, 4]
output_size = 6
''' | env_name = 'BreakoutDeterministic-v4'
input_shape = [84, 84, 4]
output_size = 4
"\nenv_name = 'SeaquestDeterministic-v4'\ninput_shape = [84, 84, 4]\noutput_size = 18\n"
"\nenv_name = 'PongDeterministic-v4\ninput_shape = [84, 84, 4]\noutput_size = 6\n" |
""" Geometry settings """
"""Stack Settings"""
# number of cells in the stack
cell_number = 1
""""Cell Geometry """
# length of the cell, a side of the active area [m]
cell_length = 0.5
# height of the cell, b side of the active area [m]
cell_width = 0.1
# thickness of the bipolar plate [m]
cathode_bipolar_plate_thic... | """ Geometry settings """
'Stack Settings'
cell_number = 1
'"Cell Geometry '
cell_length = 0.5
cell_width = 0.1
cathode_bipolar_plate_thickness = 0.002
anode_bipolar_plate_thickness = 0.002
membrane_thickness = 1.5e-05
cathode_catalyst_layer_thickness = 1e-05
anode_catalyst_layer_thickness = 1e-05
cathode_catalyst_laye... |
# Leetcode 200. Number of Islands
#
# Link: https://leetcode.com/problems/number-of-islands/
# Difficulty: Medium
# Solution using BFS and visited set.
# Complexity:
# O(M*N) time | where M and N represent the rows and cols of the input matrix
# O(M*N) space | where M and N represent the rows and cols of the input... | class Solution:
def num_islands(self, grid: List[List[str]]) -> int:
(rows, cols) = (len(grid), len(grid[0]))
directions = ((0, 1), (0, -1), (1, 0), (-1, 0))
count = 0
visited = set()
def bfs(r, c):
q = deque()
q.append((r, c))
while q:
... |
BUNDLES = [
#! if api:
'flask_unchained.bundles.api',
#! endif
#! if mail:
'flask_unchained.bundles.mail',
#! endif
#! if celery:
'flask_unchained.bundles.celery', # move before mail to send emails synchronously
#! endif
#! if oauth:
'flask_unchained.bundles.oauth',
#! e... | bundles = ['flask_unchained.bundles.api', 'flask_unchained.bundles.mail', 'flask_unchained.bundles.celery', 'flask_unchained.bundles.oauth', 'flask_unchained.bundles.security', 'flask_unchained.bundles.session', 'flask_unchained.bundles.sqlalchemy', 'flask_unchained.bundles.webpack', 'app'] |
class RequestFailedError(Exception):
pass
class DOIFormatIncorrect(Exception):
pass
| class Requestfailederror(Exception):
pass
class Doiformatincorrect(Exception):
pass |
N, M, P, Q = map(int, input().split())
result = (N // (M * (12 + Q))) * 12
N %= M * (12 + Q)
if N <= M * (P - 1):
result += (N + (M - 1)) // M
else:
result += P - 1
N -= M * (P - 1)
if N <= 2 * M * Q:
result += (N + (2 * M - 1)) // (2 * M)
else:
result += Q
N -= 2 * M * Q
... | (n, m, p, q) = map(int, input().split())
result = N // (M * (12 + Q)) * 12
n %= M * (12 + Q)
if N <= M * (P - 1):
result += (N + (M - 1)) // M
else:
result += P - 1
n -= M * (P - 1)
if N <= 2 * M * Q:
result += (N + (2 * M - 1)) // (2 * M)
else:
result += Q
n -= 2 * M * Q
... |
# This is a line comment
'''
This is a block comment
'''
def main():
print("Hello world!\n");
main()
| """
This is a block comment
"""
def main():
print('Hello world!\n')
main() |
# global progViewWidth
ProgEntryFieldW=10
ProgButX=160
progViewWidth=60
stopProgButX=200
comportlabelx=270
comPortEntryFieldX=390
comPortEntryFieldw=12
comPortButx=495
calibration_entryjoinx=520
calibration_entrydhx=745
calibration_joinx=600
calibration_alphax=800
calibrate_buttoncol2x=210
tab1_instructionbuttonw=16
... | prog_entry_field_w = 10
prog_but_x = 160
prog_view_width = 60
stop_prog_but_x = 200
comportlabelx = 270
com_port_entry_field_x = 390
com_port_entry_fieldw = 12
com_port_butx = 495
calibration_entryjoinx = 520
calibration_entrydhx = 745
calibration_joinx = 600
calibration_alphax = 800
calibrate_buttoncol2x = 210
tab1_in... |
#########################################################################
# #
# C R A N F I E L D U N I V E R S I T Y #
# 2 0 1 9 / 2 0 2 0 #
# ... | class Gencuttingplanefile:
def __init__(self, fileName, planeName, point, normal, fields):
self.fileName = fileName
self.planeName = planeName
self.point = point
self.normal = normal
self.fields = fields
def write_cutting_plane_file(self):
cutting_plane_file = o... |
N_FEATURES = 5
def filter_on_geolocation(df_in, ne_lat, ne_lng, sw_lat, sw_lng):
return df_in.loc[lambda df: (df["lat"] >= sw_lat) & (df["lat"] < ne_lat)].loc[
lambda df: (df["lng"] >= sw_lng) & (df["lng"] < ne_lng)
]
def select_top_features(place_id, df_in, top_x=N_FEATURES):
"""
Selects to... | n_features = 5
def filter_on_geolocation(df_in, ne_lat, ne_lng, sw_lat, sw_lng):
return df_in.loc[lambda df: (df['lat'] >= sw_lat) & (df['lat'] < ne_lat)].loc[lambda df: (df['lng'] >= sw_lng) & (df['lng'] < ne_lng)]
def select_top_features(place_id, df_in, top_x=N_FEATURES):
"""
Selects top X features wit... |
# Strings with apostrophes and new lines
# If you want to include apostrophes in your string,
# it's easiest to wrap it in double quotes.
niceday = "It's a nice day!"
print(niceday)
| niceday = "It's a nice day!"
print(niceday) |
#encoding:utf-8
subreddit = 'chessmemes'
t_channel = '@chessmemesenglish'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| subreddit = 'chessmemes'
t_channel = '@chessmemesenglish'
def send_post(submission, r2t):
return r2t.send_simple(submission) |
def decodeRules(string):
rules = []
# Remove comments
while string.find('%') != -1:
subStringBeforeComment = string[:string.find('%')]
subStringAfterComment = string[string.find('%'):]
if subStringAfterComment.find('\n') != -1:
string = subStringBeforeComment + subString... | def decode_rules(string):
rules = []
while string.find('%') != -1:
sub_string_before_comment = string[:string.find('%')]
sub_string_after_comment = string[string.find('%'):]
if subStringAfterComment.find('\n') != -1:
string = subStringBeforeComment + subStringAfterComment[sub... |
APPLICATION_ID = "vvMc0yrmqU1kbU2nOieYTQGV0QzzfVQg4kHhQWWL"
REST_API_KEY = "waZK2MtE4TMszpU0mYSbkB9VmgLdLxfYf8XCuN7D"
MASTER_KEY = "YPyRj37OFlUjHmmpE8YY3pfbZs7FqnBngxX4tezk"
TWILIO_SID = "AC5e947e28bfef48a9859c33fec7278ee8"
TWILIO_AUTH_TOKEN = "02c707399042a867303928beb261e990" | application_id = 'vvMc0yrmqU1kbU2nOieYTQGV0QzzfVQg4kHhQWWL'
rest_api_key = 'waZK2MtE4TMszpU0mYSbkB9VmgLdLxfYf8XCuN7D'
master_key = 'YPyRj37OFlUjHmmpE8YY3pfbZs7FqnBngxX4tezk'
twilio_sid = 'AC5e947e28bfef48a9859c33fec7278ee8'
twilio_auth_token = '02c707399042a867303928beb261e990' |
#Assume hot dogs come in packages of 10, and hot dog buns come in packages of 8.
hotdogs_perpack = 10
hotdogs_bunsperpack = 8
#program should ask the user for the number of people attending the cookout and the number of hot dogs each person will be given.
ppl_attending = int(input('Enter the number of people atte... | hotdogs_perpack = 10
hotdogs_bunsperpack = 8
ppl_attending = int(input('Enter the number of people attending the cookout: '))
hotdogs_pp = int(input('Enter the number of hot dogs for each person: '))
hotdog_total = ppl_attending * hotdogs_pp
hotdog_packs_needed = hotdog_total / hotdogs_perpack
hotdog_bun_packs_needed =... |
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'solo-tests.db',
}
}
INSTALLED_APPS = (
'solo',
'solo.tests',
)
SECRET_KEY = 'any-key'
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'LOCATION': '127.0.... | databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'solo-tests.db'}}
installed_apps = ('solo', 'solo.tests')
secret_key = 'any-key'
caches = {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'LOCATION': '127.0.0.1:11211'}}
solo_cache = 'default' |
#Author : 5hifaT
#Github : https://github.com/jspw
#Gists : https://gist.github.com/jspw
#linkedin : https://www.linkedin.com/in/mehedi-hasan-shifat-2b10a4172/
#Stackoverflow : https://stackoverflow.com/story/jspw
#Dev community : https://dev.to/mhshifat
def binary_search(ar, value):
s... | def binary_search(ar, value):
start = 0
end = len(ar) - 1
while start <= end:
mid = (start + end) // 2
if ar[mid] == value:
return mid
if ar[mid] > value:
end = mid - 1
else:
start = mid + 1
return -1
def main():
for _ in range(int... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.