content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# @dependency 001-main/002-createrepository.py
SHA1 = "66f25ae79dcc5e200b136388771b5924a1b5ae56"
with repository.workcopy() as work:
REMOTE_URL = instance.repository_url("alice")
work.run(["checkout", "-b", "008-branch", SHA1])
work.run(["rebase", "--force-rebase", "HEAD~5"])
work.run(["push", REMOTE... | sha1 = '66f25ae79dcc5e200b136388771b5924a1b5ae56'
with repository.workcopy() as work:
remote_url = instance.repository_url('alice')
work.run(['checkout', '-b', '008-branch', SHA1])
work.run(['rebase', '--force-rebase', 'HEAD~5'])
work.run(['push', REMOTE_URL, '008-branch'])
sha1 = work.run(['rev-par... |
# ----------------------------------------------------------------------------
# CLASSES: nightly
#
# Test Case: h5part.py
#
# Programmer: Gunther Weber
# Date: January, 2009
#
# Modifications:
# Mark C. Miller, Wed Jan 21 09:36:13 PST 2009
# Took Gunther's original code and integrated it with test ... | required_database_plugin('H5Part')
turn_off_all_annotations()
open_database(data_path('h5part_test_data/sample.h5part'), 0)
add_plot('Pseudocolor', 'GaussianField', 1, 0)
draw_plots()
test('h5part_01')
change_active_plots_var('LinearField')
view3_d_atts = get_view3_d()
View3DAtts.viewNormal = (1.0, 0.0, 0.0)
View3DAtts... |
def artist():
return "The Hardkiss"
def genre():
return "Pop"
def year():
return 2014
def restrictedContent():
return False
def forGeneralAudiences():
return True
| def artist():
return 'The Hardkiss'
def genre():
return 'Pop'
def year():
return 2014
def restricted_content():
return False
def for_general_audiences():
return True |
class TestErrors:
"""Errors"""
pass
| class Testerrors:
"""Errors"""
pass |
# -*- mode: python; -*-
# Return the pathname of the calling package.
# (This is used to recover the directory name to pass to cc -I<dir>, when
# choosing from among alternative header files for different platforms.)
def pkg_path_name():
return "./" + Label(REPOSITORY_NAME + "//" + PACKAGE_NAME +
... | def pkg_path_name():
return './' + label(REPOSITORY_NAME + '//' + PACKAGE_NAME + ':nsync').workspace_root + '/' + PACKAGE_NAME |
# Play = 'play'
# Pass = 'pass'
Draw = 'draw'
Discard = 'discard'
TutorDeck = 'tutor_deck'
TutorDiscard = 'tutor_discard'
Create = 'create'
Shuffle = 'shuffle'
Mill = 'mill'
Top = 'top'
# Resolve = 'resolve'
# Win = 'win'
# Lose = 'lose'
# Tie = 'tie'
#
# Build = 'build'
# Inspire = 'inspire'
# Nourish = 'nourish'
#
#... | draw = 'draw'
discard = 'discard'
tutor_deck = 'tutor_deck'
tutor_discard = 'tutor_discard'
create = 'create'
shuffle = 'shuffle'
mill = 'mill'
top = 'top' |
# -*- coding:utf8 -*-
"""
common settings
FUTURE: read setting from a json file
"""
"""
path configuration
"""
ICON_PATH = '../icons/'
CACHE_PATH = '../cache/'
DATA_PATH = '../data/'
"""
mode configuration
"""
DEBUG = True # 1 for debug
PRODUCTION = False # 0 for Production Environment
LOGFILE = CACHE_PATH + ... | """
common settings
FUTURE: read setting from a json file
"""
'\npath configuration\n'
icon_path = '../icons/'
cache_path = '../cache/'
data_path = '../data/'
'\nmode configuration\n'
debug = True
production = False
logfile = CACHE_PATH + 'error.log'
mode = DEBUG
'\ntheme configuration\n'
qss_path = 'themes/default.q... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
#
# FreeType high-level python API - Copyright 2011-2012 Nicolas P. Rougier
# Distributed under the terms of the new BSD license.
#
# ----------------------------------------------------------... | """
An enumeration used to specify character sets supported by charmaps. Used in
the FT_Select_Charmap API function.
FT_ENCODING_NONE
The encoding value 0 is reserved.
FT_ENCODING_UNICODE
Corresponds to the Unicode character set. This value covers all versions of
the Unicode repertoire, including ASCII and La... |
def Fibonacci_Tail(n, acc0= 0, acc1= 1):
# Base-Case(s): F(0) = 0, F(1) = 1
if(n == 0):
return acc0
if(n == 1):
return acc1
# Recursion
return Fibonacci_Tail(n-1, acc1, acc1+acc0)
n = 0
while(n <= 10):
get = Fibonacci_Tail(n)
print(f"Fibonacci({n}) = {get}")
... | def fibonacci__tail(n, acc0=0, acc1=1):
if n == 0:
return acc0
if n == 1:
return acc1
return fibonacci__tail(n - 1, acc1, acc1 + acc0)
n = 0
while n <= 10:
get = fibonacci__tail(n)
print(f'Fibonacci({n}) = {get}')
n = n + 1 |
#
# PySNMP MIB module Juniper-Notification-Log-CONF (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-Notification-Log-CONF
# Produced by pysmi-0.3.4 at Mon Apr 29 19:52:48 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ve... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, constraints_union, value_range_constraint, value_size_constraint) ... |
# pylint: skip-file
#- @A defines/binding ClassA
#- @object ref vname("module.object", _, _, "pytd:__builtin__", _)
#- ClassA.node/kind class
class A(object):
pass
#- @B defines/binding ClassB
#- @A ref ClassA
#- ClassB.node/kind class
class B(A):
pass
#- @Foo defines/binding ClassFoo
#- @A ref ClassA
#- @B re... | class A(object):
pass
class B(A):
pass
class Foo(A, B):
pass |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 20 08:50:32 2019
@author: Giles
"""
'''
Question 1
Ask the user for two numbers between 1 and 100. Then count from the
lower number to the higher number. Print the results to the screen.
'''
'''
Question 2
Ask the user to input a string and then ... | """
Created on Sun Oct 20 08:50:32 2019
@author: Giles
"""
'\nQuestion 1\nAsk the user for two numbers between 1 and 100. Then count from the\nlower number to the higher number. Print the results to the screen.\n'
'\nQuestion 2\nAsk the user to input a string and then print it out to the screen in\nreverse order (use ... |
## A note on unneecssary complexity
# We have gone through a few different standards on naming Julia's build artifacts.
# The latest, as of this writing, is the `sf/consistent_distnames` branch on github,
# and simplifies things relative to earlier versions. However, this buildbot needs
# to be able to build/upload Ju... | @util.renderer
def make_julia_version_command(props_obj):
command = ['usr/bin/julia', '-e', 'println("$(VERSION.major).$(VERSION.minor).$(VERSION.patch)\\n$(Base.GIT_VERSION_INFO.commit[1:10])")']
if is_windows(props_obj):
command[0] += '.exe'
return command
def parse_julia_version(return_code, std... |
"""
Creating new user after checking all the input. the user will be added into the remote data source and input the login details into the login window
"""
def makeUser(self,name,pw,pw2,email):
"""Checking input is valid and not already exist in the current database before creating new user instance
... | """
Creating new user after checking all the input. the user will be added into the remote data source and input the login details into the login window
"""
def make_user(self, name, pw, pw2, email):
"""Checking input is valid and not already exist in the current database before creating new user instance
... |
# -*- coding: utf-8 -*-
"""
958. Check Completeness of a Binary Tree
Given a binary tree, determine if it is a complete binary tree.
Definition of a complete binary tree from Wikipedia:
In a complete binary tree every level, except possibly the last, is completely filled,
and all nodes in the last level are as far le... | """
958. Check Completeness of a Binary Tree
Given a binary tree, determine if it is a complete binary tree.
Definition of a complete binary tree from Wikipedia:
In a complete binary tree every level, except possibly the last, is completely filled,
and all nodes in the last level are as far left as possible.
It can h... |
class Scope:
"""
Class to define the Scope object to be used during compilation of the whole program.
"""
def __init__(self, line_number, instructions):
"""
Constructor for the Scope object.
:param line_number: The line the function is defined at
:param instructions: The... | class Scope:
"""
Class to define the Scope object to be used during compilation of the whole program.
"""
def __init__(self, line_number, instructions):
"""
Constructor for the Scope object.
:param line_number: The line the function is defined at
:param instructions: The... |
try:
num = float(input("Enter a number : "))
def real_nums(x):
if x > 0:
return "The number is POSITIVE"
elif x == 0:
return "The number is ZERO"
elif x < 0:
return "The number is NEGATIVE"
else:
return "Enter a valid numb... | try:
num = float(input('Enter a number : '))
def real_nums(x):
if x > 0:
return 'The number is POSITIVE'
elif x == 0:
return 'The number is ZERO'
elif x < 0:
return 'The number is NEGATIVE'
else:
return 'Enter a valid number!'
... |
"""
month picker simple case implementation in python
"""
class Case(object):
"""
class to return a month
"""
def what_month(self, num):
"""
returns the month
Arguments:
num {int} -- month
Returns:
string -- month
"""
method_n... | """
month picker simple case implementation in python
"""
class Case(object):
"""
class to return a month
"""
def what_month(self, num):
"""
returns the month
Arguments:
num {int} -- month
Returns:
string -- month
"""
method_nam... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | class Boolstr(object):
"""A custom boolean/string hybrid type for resource.props.
Translates a given value to the desired type.
"""
def __init__(self, given):
"""A boolean parser.
Interprets the given value as a boolean, ignoring whitespace and case.
A TypeError is raised when... |
"""
Given an array A of non-negative integers, half of the integers in A are
odd, and half of the integers are even.
Sort the array so that whenever A[i] is odd, i is odd; and whenever A[i]
is even, i is even.
You may return any answer array that satisfies this condition.
Example:
Input: ... | """
Given an array A of non-negative integers, half of the integers in A are
odd, and half of the integers are even.
Sort the array so that whenever A[i] is odd, i is odd; and whenever A[i]
is even, i is even.
You may return any answer array that satisfies this condition.
Example:
Input: ... |
#Finding number of hansu which is under n
def number_of_hansu(n):
out = 0
digit_difference = 0
for i in range(1, n + 1):
#Number under 100 is always hansu
if i < 100:
out += 1
else:
#First digit difference
digit_difference = digits(i)[1] - digits... | def number_of_hansu(n):
out = 0
digit_difference = 0
for i in range(1, n + 1):
if i < 100:
out += 1
else:
digit_difference = digits(i)[1] - digits(i)[0]
for j in range(len(digits(i)) - 1):
if digits(i)[j + 1] - digits(i)[j] != digit_differe... |
criteria = [
{
'name': 'Price',
'inc': "Two thousand dollars is a lot of Ramen.",
'just': "A high price tag will be a deal breaker no matter what."
},
{
'name': 'User Rating',
'inc': "User ratings indicate reliability and general satisfaction of previous customers.",
... | criteria = [{'name': 'Price', 'inc': 'Two thousand dollars is a lot of Ramen.', 'just': 'A high price tag will be a deal breaker no matter what.'}, {'name': 'User Rating', 'inc': 'User ratings indicate reliability and general satisfaction of previous customers.', 'just': 'This is the only way to determine quality witho... |
"""
__init__.py
Created by: Martin Sicho
On: 4/27/20, 10:49 AM
"""
| """
__init__.py
Created by: Martin Sicho
On: 4/27/20, 10:49 AM
""" |
#
# PySNMP MIB module A3COM-HUAWEI-DNS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM-HUAWEI-DNS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 16:49:29 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... | (h3c_common,) = mibBuilder.importSymbols('A3COM-HUAWEI-OID-MIB', 'h3cCommon')
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constrain... |
DEBUG = False
PORT = 8080
PROPAGATE_EXCEPTIONS = True
SQLALCHEMY_ECHO = False
SQLALCHEMY_DATABASE_URI = ""
SQLALCHEMY_POOL_SIZE = 15
| debug = False
port = 8080
propagate_exceptions = True
sqlalchemy_echo = False
sqlalchemy_database_uri = ''
sqlalchemy_pool_size = 15 |
class Workpiece:
def __init__(self, id):
self.id = id
# self.status = "awaiting production"
self.status = "awaiting next step"
self.actual_quality = None
self.source = None
self.sink = None
self.location = "wc_0" # Starting point. Location refers to workcell... | class Workpiece:
def __init__(self, id):
self.id = id
self.status = 'awaiting next step'
self.actual_quality = None
self.source = None
self.sink = None
self.location = 'wc_0'
self.step_idx = None
self.pos = None
self.count_down = 0 |
def add_filters_to_legend():
pass
def extend_data_from_recs():
pass
def find_errors():
'''find errors such as restricted works, etc. where data needs to be entered manually'''
pass
| def add_filters_to_legend():
pass
def extend_data_from_recs():
pass
def find_errors():
"""find errors such as restricted works, etc. where data needs to be entered manually"""
pass |
QWERTY_KEYMAP = bytearray.fromhex('000000000000000000000000760f00d4ffffffc7000000782c1e3420212224342627252e362d3738271e1f202122232425263333362e37381f0405060708090a0b0c0d0e0f101112131415161718191a1b1c1d2f3130232d350405060708090a0b0c0d0e0f101112131415161718191a1b1c1d2f313035')
print(QWERTY_KEYMAP)
print(type(QWERTY_KEY... | qwerty_keymap = bytearray.fromhex('000000000000000000000000760f00d4ffffffc7000000782c1e3420212224342627252e362d3738271e1f202122232425263333362e37381f0405060708090a0b0c0d0e0f101112131415161718191a1b1c1d2f3130232d350405060708090a0b0c0d0e0f101112131415161718191a1b1c1d2f313035')
print(QWERTY_KEYMAP)
print(type(QWERTY_KEYMA... |
# MIT License
#
# Copyright (c) [2018] [Victor Manuel Cajes Gonzalez - vcajes@gmail.com]
#
# 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 th... | environment_sandbox = 'sandbox'
environment_production = 'production'
bancard_allowed_currencies = ['PYG']
bancard_base_url_sandbox = 'https://vpos.infonet.com.py:8888'
bancard_base_url_production = 'https://vpos.infonet.com.py'
rollback_key = 'rollback'
charge_token_generator_key = 'single_buy'
payment_web_url_key = '... |
class APIError(Exception):
"""Base exception for errors raised by high-level websocket API."""
class MessageHandlerError(APIError):
"""Decoding or parsing a message failed."""
class RemoteMessageHandlerError(MessageHandlerError):
"""Raised for errors directly caused by messages from the client."""
cla... | class Apierror(Exception):
"""Base exception for errors raised by high-level websocket API."""
class Messagehandlererror(APIError):
"""Decoding or parsing a message failed."""
class Remotemessagehandlererror(MessageHandlerError):
"""Raised for errors directly caused by messages from the client."""
class ... |
def printadj(table,g):
print(" ",end="")
print(" ".join(table))
for i in table:
strout = ""
print(i,end=" : ")
for j in table:
l = g.get(i,None)
if not l :
strout+="0, "
elif j in l:
strout+="1, "
els... | def printadj(table, g):
print(' ', end='')
print(' '.join(table))
for i in table:
strout = ''
print(i, end=' : ')
for j in table:
l = g.get(i, None)
if not l:
strout += '0, '
elif j in l:
strout += '1, '
... |
"""
Created on May 4 - 2019
---Based on the 2-stage stochastic program structure
---Assumption: RHS is random
---read stoc file (.tim)
---save the distributoin of the random variables and return the
---random variables
@author: Siavash Tabrizian - stabrizian@smu.edu
"""
class readtim:
def __init__(self, name):... | """
Created on May 4 - 2019
---Based on the 2-stage stochastic program structure
---Assumption: RHS is random
---read stoc file (.tim)
---save the distributoin of the random variables and return the
---random variables
@author: Siavash Tabrizian - stabrizian@smu.edu
"""
class Readtim:
def __init__(self, name):... |
class Solution:
def twoSum(self, nums, target):
for n in nums:
print("n = {}".format(n))
indexN = nums.index(n)
print("indexN = {}".format(indexN))
for p in nums[1:]:
print("p = {}".format(p))
indexP = nums.index(p)
print("indexP = {}".format(indexP))
if inde... | class Solution:
def two_sum(self, nums, target):
for n in nums:
print('n = {}'.format(n))
index_n = nums.index(n)
print('indexN = {}'.format(indexN))
for p in nums[1:]:
print('p = {}'.format(p))
index_p = nums.index(p)
... |
'''
Binary Seach works on only sorted collection.
Time : O(log n)
Space : O(1)
'''
def binarySearch(arr, target):
left = 0
right = len(arr)-1
while(left <= right):
mid = (left + right) // 2
if(arr[mid] == target):
return mid
#if target is greater th... | """
Binary Seach works on only sorted collection.
Time : O(log n)
Space : O(1)
"""
def binary_search(arr, target):
left = 0
right = len(arr) - 1
while left <= right:
mid = (left + right) // 2
if arr[mid] == target:
return mid
elif arr[mid] < target:
... |
"""
1436. Destination City
You are given the array paths, where paths[i] = [cityAi, cityBi] means there exists a direct path going from cityAi to cityBi. Return the destination city, that is, the city without any path outgoing to another city.
It is guaranteed that the graph of paths forms a line without any loop, the... | """
1436. Destination City
You are given the array paths, where paths[i] = [cityAi, cityBi] means there exists a direct path going from cityAi to cityBi. Return the destination city, that is, the city without any path outgoing to another city.
It is guaranteed that the graph of paths forms a line without any loop, the... |
t=int(input())
for qwerty in range(t):
#n,a,b,c=input().split()
#n,a,b,c=int(n),int(a),int(b),int(c)
#n=int(input())
arr1=list(map(int,input().split()))
arr2=list(map(int,input().split()))
n1,n2=len(arr1),len(arr2)
arr3=[]
i=0
j... | t = int(input())
for qwerty in range(t):
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
(n1, n2) = (len(arr1), len(arr2))
arr3 = []
i = 0
j = 0
k = 0
while i < n1 and j < n2:
if arr1[i] < arr2[j]:
arr3.append(arr1[i])
i += 1
... |
expected_output ={
"vrf": {
"tn-L2-PBR:vrf-L2-PBR": {
"address_family": {
"ipv4": {
"routes": {
"192.168.1.0/24": {
"route": "192.168.1.0/24",
"active": True,
... | expected_output = {'vrf': {'tn-L2-PBR:vrf-L2-PBR': {'address_family': {'ipv4': {'routes': {'192.168.1.0/24': {'route': '192.168.1.0/24', 'active': True, 'ubest': 1, 'mbest': 0, 'attached': True, 'direct': True, 'pervasive': True, 'metric': 0, 'route_preference': 1, 'tag': 4294967294, 'next_hop': {'next_hop_list': {1: {... |
# Week 1 Exercise 1
# Orla Higgins, 2018-02-20
# A program that displays Fibonacci numbers.
def fib(n):
"""This function returns the nth Fibonacci number."""
i = 0
j = 1
n = n - 1
while n >= 0:
i, j = j, i + j
n = n - 1
return i
# Test the function with the following value.
x = 16
ans = fib(x)... | def fib(n):
"""This function returns the nth Fibonacci number."""
i = 0
j = 1
n = n - 1
while n >= 0:
(i, j) = (j, i + j)
n = n - 1
return i
x = 16
ans = fib(x)
print('Fibonacci number', x, 'is', ans)
name = 'Higgins'
first = name[0]
last = name[-1]
firstno = ord(first)
lastno = ... |
'''
Fixed XOR
Write a function that takes two equal-length buffers and produces their XOR combination.
If your function works properly, then when you feed it the string:
1c0111001f010100061a024b53535009181c
... after hex decoding, and when XOR'd against:
686974207468652062756c6c277320657965
... should produce:
7468... | """
Fixed XOR
Write a function that takes two equal-length buffers and produces their XOR combination.
If your function works properly, then when you feed it the string:
1c0111001f010100061a024b53535009181c
... after hex decoding, and when XOR'd against:
686974207468652062756c6c277320657965
... should produce:
7468... |
CAPACITY = 100
class Heap:
def __init__(self):
self.heap_size = 0
self.heap = [0]*CAPACITY
def insert(self, item):
if self.heap_size == CAPACITY:
return
self.heap[self.heap_size] = item
self.heap_size = self.heap_size + 1
self.fix_up(self.heap_si... | capacity = 100
class Heap:
def __init__(self):
self.heap_size = 0
self.heap = [0] * CAPACITY
def insert(self, item):
if self.heap_size == CAPACITY:
return
self.heap[self.heap_size] = item
self.heap_size = self.heap_size + 1
self.fix_up(self.heap_siz... |
"""Class that stores the position information"""
class FlPosition:
"""Stores the position information"""
def __init__(self, position_data, column_labels, timestamps, conversion):
self.position_data = position_data
self.column_labels = column_labels
self.timestamps = timestamps
... | """Class that stores the position information"""
class Flposition:
"""Stores the position information"""
def __init__(self, position_data, column_labels, timestamps, conversion):
self.position_data = position_data
self.column_labels = column_labels
self.timestamps = timestamps
... |
def HI():
print("=======================================")
print("= = = =")
print("= = =")
print("= ====== = =")
print("= = = = =")
print("= = = = =")
p... | def hi():
print('=======================================')
print('= = = =')
print('= = =')
print('= ====== = =')
print('= = = = =')
print('= = = = ... |
def makeminutes(time):
h, m = time.split(':')
return int(h)*60+int(m)
def check_buses(n, m, lines):
cntbuses = [0]*(n+1)
busbalance = [0]*(n+1)
events = []
overnight = 0
for line in lines:
cdep, deptime, carr, arrtime = line.split()
cdep = int(cdep)
carr = int(carr)... | def makeminutes(time):
(h, m) = time.split(':')
return int(h) * 60 + int(m)
def check_buses(n, m, lines):
cntbuses = [0] * (n + 1)
busbalance = [0] * (n + 1)
events = []
overnight = 0
for line in lines:
(cdep, deptime, carr, arrtime) = line.split()
cdep = int(cdep)
c... |
#!/usr/bin/env python
class DataProcessingException(Exception):
pass
| class Dataprocessingexception(Exception):
pass |
class Solution:
def distinctSubseqII(self, S):
res, end = 0, collections.Counter()
for c in S:
res, end[c] = res * 2 + 1 - end[c], res + 1
return res % (10**9 + 7) | class Solution:
def distinct_subseq_ii(self, S):
(res, end) = (0, collections.Counter())
for c in S:
(res, end[c]) = (res * 2 + 1 - end[c], res + 1)
return res % (10 ** 9 + 7) |
inter_,gremio_ = input().split()
inter = int(inter_)
gremio = int(gremio_)
a = 0
contador = 1
v_inter = 0
v_gremio = 0
empate = 0
if inter > gremio:
v_inter += 1
elif inter == gremio:
empate += 1
else:
v_gremio += 1
while a == 0:
print("Novo grenal (1-sim 2-nao)")
cond = int(input())
if co... | (inter_, gremio_) = input().split()
inter = int(inter_)
gremio = int(gremio_)
a = 0
contador = 1
v_inter = 0
v_gremio = 0
empate = 0
if inter > gremio:
v_inter += 1
elif inter == gremio:
empate += 1
else:
v_gremio += 1
while a == 0:
print('Novo grenal (1-sim 2-nao)')
cond = int(input())
if cond ... |
valor1 = float(input("Digite o primeiro valor: "))
dobro = valor1 *2
triplo = valor1 *3
raiz = valor1 **0.5
print("O dobro {} o triplo {} e a raiz quadrada {}".format(dobro,triplo,raiz)) | valor1 = float(input('Digite o primeiro valor: '))
dobro = valor1 * 2
triplo = valor1 * 3
raiz = valor1 ** 0.5
print('O dobro {} o triplo {} e a raiz quadrada {}'.format(dobro, triplo, raiz)) |
#!/usr/bin/env python
#-----------------------------------------------------------------------
# tag.py
# Author: Olivia Zhang, Zoe Barnswell, Lyra Katzman
#-----------------------------------------------------------------------
#-----------------------------------------------------------------------
class Tag:
... | class Tag:
def __init__(self, tagID):
self.tagID = tagID
self.numArticles = 0 |
TARGET_URL = '/{tail:.*}'
EXCLUDED_HEADERS = {
# 'Accept-CH',
# 'Accept-CH-Lifetime',
# 'Cache-Control',
# 'Content-Encoding',
# 'Content-Security-Policy',
# 'Content-Type',
# 'Date',
# 'Expires',
# 'Last-Modified',
# 'P3P',
# 'Set-Cookie',
'Transfer-Encoding',
'X-Tar... | target_url = '/{tail:.*}'
excluded_headers = {'Transfer-Encoding', 'X-Target-Url', 'Content-Length'} |
# author: alex o
def counting_sort_int(array, base, col):
# initialise count array
count_array = [0]*base
# get the digit in position column and add them into "buckets"
for elem in array:
digit = elem // 10 ** (col)
count_array[digit % base] += 1
# initialise position array
po... | def counting_sort_int(array, base, col):
count_array = [0] * base
for elem in array:
digit = elem // 10 ** col
count_array[digit % base] += 1
position = [0] * base
position[0] = 1
for i in range(1, base):
position[i] = position[i - 1] + count_array[i - 1]
output = [0] * l... |
"""
121 / 121 test cases passed.
Runtime: 32 ms
Memory Usage: 14.9 MB
"""
class Solution:
def countHillValley(self, nums: List[int]) -> int:
stk = [nums[0], nums[1]]
ans = 0
for num in nums[2:]:
if num == stk[-1]:
continue
if stk[-2] < stk[-1] and stk[... | """
121 / 121 test cases passed.
Runtime: 32 ms
Memory Usage: 14.9 MB
"""
class Solution:
def count_hill_valley(self, nums: List[int]) -> int:
stk = [nums[0], nums[1]]
ans = 0
for num in nums[2:]:
if num == stk[-1]:
continue
if stk[-2] < stk[-1] and ... |
a = []
b = []
c = a
a.append(1)
b.append(2)
c.append(3)
print(f'{a=}, {b=}, {c=}')
#print(a is c)
| a = []
b = []
c = a
a.append(1)
b.append(2)
c.append(3)
print(f'a={a!r}, b={b!r}, c={c!r}') |
class Element:
mass = 0.0
def __init__(self, params):
self.mass = params["mass"]
def molar_mass_kilograms(self):
return self.mass / 1000
hydrogen = Element({"mass": 1.00794})
| class Element:
mass = 0.0
def __init__(self, params):
self.mass = params['mass']
def molar_mass_kilograms(self):
return self.mass / 1000
hydrogen = element({'mass': 1.00794}) |
# Here I will attempt to count the occurences of a kmer in a patter
def count_kmer(kmer, pattern):
num_matches = 0
for num, _ in enumerate(kmer):
window = kmer[num: (num+len(pattern))]
if window == pattern:
num_matches = num_matches + 1
return num_matches
count_kme... | def count_kmer(kmer, pattern):
num_matches = 0
for (num, _) in enumerate(kmer):
window = kmer[num:num + len(pattern)]
if window == pattern:
num_matches = num_matches + 1
return num_matches
count_kmer('ACAACTATGCATACTATCGGGAACTATCCT', 'ACTAT')
kmer_to_match = 'GGAGGATTCTCCTGAAAAGG... |
"""
Problem Description:
Cody was once understanding numbers, their squares and perfect squares from his teacher.
A perfect square is a number that can be expressed as square of an integer.
To check how much Cody understood the concept his teacher kept a test. He has to find the nearest perfect square of the given num... | """
Problem Description:
Cody was once understanding numbers, their squares and perfect squares from his teacher.
A perfect square is a number that can be expressed as square of an integer.
To check how much Cody understood the concept his teacher kept a test. He has to find the nearest perfect square of the given num... |
#!/usr/bin/python
# -*- coding:utf-8 -*-
#Filename: range.py
for i in [0, 1, 2, 3, 4, 5]:
print (i ** 2)
# >>> 0
# 1
# 4
# 9
# 16
# 25
for i in range(6):
print (i ** 2)
| for i in [0, 1, 2, 3, 4, 5]:
print(i ** 2)
for i in range(6):
print(i ** 2) |
if __name__ == '__main__':
n = int(input())
arr = list(map(int, input().split()))
f = arr[0]
p = -100000
for i in arr:
if i>f:
p=f
f=i;
elif i<f and i>p:
p=i
print(p)
| if __name__ == '__main__':
n = int(input())
arr = list(map(int, input().split()))
f = arr[0]
p = -100000
for i in arr:
if i > f:
p = f
f = i
elif i < f and i > p:
p = i
print(p) |
load(
"//scala:scala_cross_version.bzl",
_default_maven_server_urls = "default_maven_server_urls",
)
load("//third_party/repositories:repositories.bzl", "repositories")
def junit_repositories(
maven_servers = _default_maven_server_urls(),
fetch_sources = True):
repositories(
for_art... | load('//scala:scala_cross_version.bzl', _default_maven_server_urls='default_maven_server_urls')
load('//third_party/repositories:repositories.bzl', 'repositories')
def junit_repositories(maven_servers=_default_maven_server_urls(), fetch_sources=True):
repositories(for_artifact_ids=['io_bazel_rules_scala_junit_juni... |
"""Provide a decorator to register event handlers."""
def socketio_handler(event, namespace=None):
"""Register a socketio handler via decorator."""
def wrapper(func):
"""Decorate a ws event handler."""
# pylint: disable=protected-access
func._ws_event = event
func._ws_namespac... | """Provide a decorator to register event handlers."""
def socketio_handler(event, namespace=None):
"""Register a socketio handler via decorator."""
def wrapper(func):
"""Decorate a ws event handler."""
func._ws_event = event
func._ws_namespace = namespace
return func
return... |
class DynamicalSystem:
def __init__(self, a1, b1, c1, alpha1, beta1, a2, b2, c2, alpha2, beta2):
self.a1 = a1
self.b1 = b1
self.c1 = c1
self.alpha1 = alpha1
self.beta1 = beta1
self.a2 = a2
self.b2 = b2
self.c2 = c2
self.alpha2 = alpha2
... | class Dynamicalsystem:
def __init__(self, a1, b1, c1, alpha1, beta1, a2, b2, c2, alpha2, beta2):
self.a1 = a1
self.b1 = b1
self.c1 = c1
self.alpha1 = alpha1
self.beta1 = beta1
self.a2 = a2
self.b2 = b2
self.c2 = c2
self.alpha2 = alpha2
... |
class Group(object):
def __init__(self, _name):
self.name = _name
self.groups = []
self.users = []
def add_group(self, group):
self.groups.append(group)
def add_user(self, user):
self.users.append(user)
def get_groups(self):
return self.groups
... | class Group(object):
def __init__(self, _name):
self.name = _name
self.groups = []
self.users = []
def add_group(self, group):
self.groups.append(group)
def add_user(self, user):
self.users.append(user)
def get_groups(self):
return self.groups
def... |
#WAP to read two numbers from the keyboard and display the larger one on the screen.
num1 = input("enter the number one")
num2 = input("enter the number two")
if(num1>num2):
largest = num1
print("number is ", largest)
else:
largest = num2
print("number is ",largest)
| num1 = input('enter the number one')
num2 = input('enter the number two')
if num1 > num2:
largest = num1
print('number is ', largest)
else:
largest = num2
print('number is ', largest) |
__all__ = [
"bgl_preprocessor",
"open_source_logs",
]
| __all__ = ['bgl_preprocessor', 'open_source_logs'] |
def minesweeper(matrix):
row = len(matrix)
col = len(matrix[0])
def neighbouring_squares(i, j):
return sum(
matrix[x][y]
for x in range(i - 1, i + 2)
if 0 <= x < row
for y in range(j - 1, j + 2)
if 0 <= y < col
if i != x or j !... | def minesweeper(matrix):
row = len(matrix)
col = len(matrix[0])
def neighbouring_squares(i, j):
return sum((matrix[x][y] for x in range(i - 1, i + 2) if 0 <= x < row for y in range(j - 1, j + 2) if 0 <= y < col if i != x or j != y))
return [[neighbouring_squares(i, j) for j in range(col)] for i... |
ASSEMBLY_HUMAN = "Homo_sapiens.GRCh38.104"
ASSEMBLY_MOUSE = "Mus_musculus.GRCm39.104"
CELLTYPES = ["adventitial cell", "endothelial cell", "acinar cell", "pancreatic PP cell", "type B pancreatic cell"]
CL_VERSION = "v2021-08-10"
| assembly_human = 'Homo_sapiens.GRCh38.104'
assembly_mouse = 'Mus_musculus.GRCm39.104'
celltypes = ['adventitial cell', 'endothelial cell', 'acinar cell', 'pancreatic PP cell', 'type B pancreatic cell']
cl_version = 'v2021-08-10' |
'''https://leetcode.com/problems/design-add-and-search-words-data-structure/
211. Design Add and Search Words Data Structure
Medium
3595
150
Add to List
Share
Design a data structure that supports adding new words and finding if a string matches any previously added string.
Implement the WordDictionary class:
Wor... | """https://leetcode.com/problems/design-add-and-search-words-data-structure/
211. Design Add and Search Words Data Structure
Medium
3595
150
Add to List
Share
Design a data structure that supports adding new words and finding if a string matches any previously added string.
Implement the WordDictionary class:
Wor... |
"""Module that defines varios enums."""
class Enum:
__names = {}
@classmethod
def name(cls, state):
if not cls.__names:
cls.__names = {
value: key
for key, value in cls.__dict__.items()
if isinstance(value, int)
}
r... | """Module that defines varios enums."""
class Enum:
__names = {}
@classmethod
def name(cls, state):
if not cls.__names:
cls.__names = {value: key for (key, value) in cls.__dict__.items() if isinstance(value, int)}
return cls.__names[state]
class Vivintdeviceattributes(Enum):
... |
test = {
'name': 'Question 1',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
>>> read_line('3')
3
>>> read_line('-123')
-123
>>> read_line('1.25')
1.25
>>> read_line('true')
True
>>> read_l... | test = {'name': 'Question 1', 'points': 1, 'suites': [{'cases': [{'code': "\n >>> read_line('3')\n 3\n >>> read_line('-123')\n -123\n >>> read_line('1.25')\n 1.25\n >>> read_line('true')\n True\n >>> read_line('(a)')\n Pair('a', n... |
CONFIG_DIR = '__config__'
DATA_ROOT_DIR = '__data__'
RESULTS_ROOT_DIR = '__results__'
TB_DIR = '__runs__'
WEIGHTS_DIR = '__weights__'
NOISE_ROOT_DIR = "__noise__"
| config_dir = '__config__'
data_root_dir = '__data__'
results_root_dir = '__results__'
tb_dir = '__runs__'
weights_dir = '__weights__'
noise_root_dir = '__noise__' |
# Map source standard name to command code
# Note that the source names may be aliased in the device
# The names that come back from the device in a feedback
# message are the aliases
ROTEL_RSP1570_SOURCES = {
" CD": "SOURCE_CD",
"TUNER": "SOURCE_TUNER",
"TAPE": "SOURCE_TAPE",
"VIDEO 1": "SOURCE_VIDEO_1... | rotel_rsp1570_sources = {' CD': 'SOURCE_CD', 'TUNER': 'SOURCE_TUNER', 'TAPE': 'SOURCE_TAPE', 'VIDEO 1': 'SOURCE_VIDEO_1', 'VIDEO 2': 'SOURCE_VIDEO_2', 'VIDEO 3': 'SOURCE_VIDEO_3', 'VIDEO 4': 'SOURCE_VIDEO_4', 'VIDEO 5': 'SOURCE_VIDEO_5', 'MULTI': 'SOURCE_MULTI_INPUT'} |
class Test(object):
"""
@cvar some: some variable
@type some: C{str}
"""
some = 'hello'
def __init__(self):
self.some1 = 10
def q(self, another):
"""
@param another: another variable
@type another: C{str}
"""
pass | class Test(object):
"""
@cvar some: some variable
@type some: C{str}
"""
some = 'hello'
def __init__(self):
self.some1 = 10
def q(self, another):
"""
@param another: another variable
@type another: C{str}
"""
pass |
"""
Implementation of Bubble Sort
"""
def bubble_sort(arr):
for i in range(len(arr)):
for j in range(len(arr) - i - 1):
if j < arr[j + 1]:
arr[j], arr[j + 1] = arr[j + 1], arr[j]
print(arr)
return arr
test_arr_1 = [14, 78, 2587, 3, 687, 21]
test_arr_2 = [85, 14, ... | """
Implementation of Bubble Sort
"""
def bubble_sort(arr):
for i in range(len(arr)):
for j in range(len(arr) - i - 1):
if j < arr[j + 1]:
(arr[j], arr[j + 1]) = (arr[j + 1], arr[j])
print(arr)
return arr
test_arr_1 = [14, 78, 2587, 3, 687, 21]
test_arr_2 = [85, 14, ... |
#!/usr/bin/env python3
# Print out all the codons for the sequence below in reading frame 1
# Use a 'for' loop
dna = 'ATAGCGAATATCTCTCATGAGAGGGAA'
'''
#for 1 frame
for i in range(0, len(dna), 3): #range(start letter, lenth of seq, print 3 @ a time)
codon = (dna[i:i+3])
print(codon)
#f1
for i in range(1, len(... | dna = 'ATAGCGAATATCTCTCATGAGAGGGAA'
'\n#for 1 frame\nfor i in range(0, len(dna), 3): #range(start letter, lenth of seq, print 3 @ a time)\n codon = (dna[i:i+3])\n print(codon)\n\n#f1\nfor i in range(1, len(dna)-2, 3):\n codon = (dna[i:i+3])\n print(codon)\n'
step = 3
for f in range(46):
print('frame', f... |
""" Leetcode 12 - Interger to Roman
https://leetcode.com/problems/integer-to-roman/
1. Time: O(1) Memory: O(1)
"""
class Solution1:
""" 1. MINE | Straight-Forward """
def int_to_roman(self, num):
if num is None or num == 0:
return ''
int_roman_pairs = [(1000, 'M'), (900, 'CM'),... | """ Leetcode 12 - Interger to Roman
https://leetcode.com/problems/integer-to-roman/
1. Time: O(1) Memory: O(1)
"""
class Solution1:
""" 1. MINE | Straight-Forward """
def int_to_roman(self, num):
if num is None or num == 0:
return ''
int_roman_pairs = [(1000, 'M'), (900, 'CM'), ... |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
DEPS = [
'chromium',
'depot_tools/bot_update',
'depot_tools/gclient',
'file',
'gsutil',
'recipe_engine/path',
'recipe_engine/prop... | deps = ['chromium', 'depot_tools/bot_update', 'depot_tools/gclient', 'file', 'gsutil', 'recipe_engine/path', 'recipe_engine/properties', 'recipe_engine/python', 'recipe_engine/raw_io', 'recipe_engine/step']
def linux_builder_steps(api):
build_properties = api.properties.legacy()
src_cfg = api.gclient.make_conf... |
#!/usr/bin/env python
# Use generators to avoid crashed in memory when needed to interate on large set of data
# Generators can be built with the syntax of list comprehensions but inside ()
names = ['Tim', 'Mark', 'Donna', 'Albert', 'Sara']
gen_a = (len(n) for n in names)
print(next(gen_a))
print(next(gen_a))
# Yo... | names = ['Tim', 'Mark', 'Donna', 'Albert', 'Sara']
gen_a = (len(n) for n in names)
print(next(gen_a))
print(next(gen_a))
def my_generator():
names = ['Gianluca', 'Lisa', 'Sofia', 'Giulia']
for i in names:
yield i
gen = my_generator()
print(next(gen))
print(next(gen))
for val in gen:
print(val) |
def largest_product(a_list):
if len(a_list) == 0:
return False
column = 0
row = 0
big = a_list[0][0] * a_list[0][1]
while column < len(a_list) - 1:
if a_list[column][row] * a_list[column][row + 1] > big:
big = a_list[column][row] * a_list[column][row + 1]
if a_lis... | def largest_product(a_list):
if len(a_list) == 0:
return False
column = 0
row = 0
big = a_list[0][0] * a_list[0][1]
while column < len(a_list) - 1:
if a_list[column][row] * a_list[column][row + 1] > big:
big = a_list[column][row] * a_list[column][row + 1]
if a_lis... |
### Dielectric class
class Dielectric:
## Intialization function with all properties
def __init__(self, pos_x, pos_y, width, height, eps_r):
self.pos_x = pos_x
self.pos_y = pos_y
self.width = width
self.height = height
self.eps_r = eps_r
## String representation func... | class Dielectric:
def __init__(self, pos_x, pos_y, width, height, eps_r):
self.pos_x = pos_x
self.pos_y = pos_y
self.width = width
self.height = height
self.eps_r = eps_r
def __str__(self):
return 'x: {}, y: {}, w: {}, h: {}, eps_r: {}'.format(self.pos_x, self.p... |
def ceaser(message):
ciphered = ""
for c in message:
if c.isalpha():
if c.isupper():
upper = True
else:
upper = False
c = c.upper()
place = ord(c)
if place+13 > 90:
place = (place+13 - 90) + 64... | def ceaser(message):
ciphered = ''
for c in message:
if c.isalpha():
if c.isupper():
upper = True
else:
upper = False
c = c.upper()
place = ord(c)
if place + 13 > 90:
place = place + 13 - 90 + 64
... |
#
# PySNMP MIB module CONV-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CONV-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:11:06 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... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection) ... |
# 268. Missing Number
# Runtime: 132 ms, faster than 76.58% of Python3 online submissions for Missing Number.
# Memory Usage: 15.5 MB, less than 51.40% of Python3 online submissions for Missing Number.
class Solution:
# Gauss' Formula
def missingNumber(self, nums: list[int]) -> int:
expected_sum = l... | class Solution:
def missing_number(self, nums: list[int]) -> int:
expected_sum = len(nums) * (len(nums) + 1) // 2
return expected_sum - sum(nums) |
def redis_key(project_slug, key, *namespaces):
"""
Generates project dependent Redis key
>>> redis_key('a', 'b')
'a:b'
>>> redis_key('a', 'b', 'c', 'd')
'a:c:d:b'
>>> redis_key('a', 1, 'c', None)
'a:c:1'
"""
l = [project_slug]
if namespaces:
l.extend(namespaces)
... | def redis_key(project_slug, key, *namespaces):
"""
Generates project dependent Redis key
>>> redis_key('a', 'b')
'a:b'
>>> redis_key('a', 'b', 'c', 'd')
'a:c:d:b'
>>> redis_key('a', 1, 'c', None)
'a:c:1'
"""
l = [project_slug]
if namespaces:
l.extend(namespaces)
... |
# coding=utf-8
# Author: Jianghan LI
# Question: 094.Binary_Tree_Inorder_Traversal
# Date: 2017-07-03 13:26 - 13:37, 0 wrong try
# Complexity: O(N)
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
... | class Solution(object):
def inorder_traversal(self, root):
"""
:type root: TreeNode
:rtype: List[int]
"""
return self.inorderTraversal(root.left) + [root.val] + self.inorderTraversal(root.right) if root else []
def inorder_traversal(self, root):
stack = []
... |
# -*- coding: utf-8 -*-
def pizza():
print("Pizzaaaaaaa")
def nuggets():
print("Course de poussins!")
def quiche():
print("Qui?")
def croques():
print("Ma machine est partie...")
def courgettes():
print("Non, pas de courgettes :'(")
def choix_repas_moche(num_choix=4):
"""
Choix d... | def pizza():
print('Pizzaaaaaaa')
def nuggets():
print('Course de poussins!')
def quiche():
print('Qui?')
def croques():
print('Ma machine est partie...')
def courgettes():
print("Non, pas de courgettes :'(")
def choix_repas_moche(num_choix=4):
"""
Choix d'un repas en utilisant les if/e... |
class Solution:
def removeOuterParentheses(self, S: str) -> str:
res = ""
level = 0
start = 0
for i, c in enumerate(S):
if c == "(":
level += 1
if c == ")":
level -= 1
if level == 0:
res += S[start... | class Solution:
def remove_outer_parentheses(self, S: str) -> str:
res = ''
level = 0
start = 0
for (i, c) in enumerate(S):
if c == '(':
level += 1
if c == ')':
level -= 1
if level == 0:
res += S[sta... |
class Linked_List:
class __Node:
def __init__(self, val):
# declare and initialize the private attributes
# for objects of the Node class.
# TODO replace pass with your implementation
self.val=val
self.prev=None
self.next=None
def __init__(self):
# declare and initial... | class Linked_List:
class __Node:
def __init__(self, val):
self.val = val
self.prev = None
self.next = None
def __init__(self):
self.__header = self.__Node(None)
self.__trailer = self.__Node(None)
self.__header.next = self.__trailer
s... |
which_one = int(input("What Months (1-12)?"))
months = ['January' , 'February' , 'March' , 'April' , 'May' , 'June' , 'July' , 'August' , 'September' , 'October', 'November' , 'December']
if 1 <= which_one <= 12:
print("Months " , months[which_one - 1]) | which_one = int(input('What Months (1-12)?'))
months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
if 1 <= which_one <= 12:
print('Months ', months[which_one - 1]) |
"""
Shows the mathematical timestable
"""
for i in range(1, 13):
for j in range(1, 13):
print("{0} times {1} is {2}".format(j, i, i * j))
print("--------------------------------")
| """
Shows the mathematical timestable
"""
for i in range(1, 13):
for j in range(1, 13):
print('{0} times {1} is {2}'.format(j, i, i * j))
print('--------------------------------') |
# Example 1
def setup():
# Set to the same size as the source image
# https://unsplash.com/photos/mGy1Jjr2e6M
size(900, 600)
# Load and display and position the image
image(loadImage("file.jpg"), 0, 0)
| def setup():
size(900, 600)
image(load_image('file.jpg'), 0, 0) |
MOUSE_BTN_LEFT = b"\x90"
MOUSE_BTN_RIGHT = b"\x91"
MOUSE_BTN_MIDDLE = b"\x92"
KEY_LEFT_CTRL = b"\xe0"
KEY_LEFT_SHIFT = b"\xe1"
KEY_LEFT_ALT = b"\xe2"
KEY_LEFT_GUI = b"\xe3"
KEY_RIGHT_CTRL = b"\xe4"
KEY_RIGHT_SHIFT = b"\xe5"
KEY_RIGHT_ALT = b"\xe6"
KEY_RIGHT_GUI = b"\xe8"
KEY_A = b"\x04"
KEY_B = b"\x05"
KEY_C = b"\x06... | mouse_btn_left = b'\x90'
mouse_btn_right = b'\x91'
mouse_btn_middle = b'\x92'
key_left_ctrl = b'\xe0'
key_left_shift = b'\xe1'
key_left_alt = b'\xe2'
key_left_gui = b'\xe3'
key_right_ctrl = b'\xe4'
key_right_shift = b'\xe5'
key_right_alt = b'\xe6'
key_right_gui = b'\xe8'
key_a = b'\x04'
key_b = b'\x05'
key_c = b'\x06'
... |
"""
pymake
-------------------------------
- Eugenio Marinetto
- nenetto@gmail.com
-------------------------------
Created 08-08-2019
"""
# __all__ variable
# Fill it in with the packages you want to export in "from project_name import *"
__all__ = [] | """
pymake
-------------------------------
- Eugenio Marinetto
- nenetto@gmail.com
-------------------------------
Created 08-08-2019
"""
__all__ = [] |
x = 6
y = 7
# # Simple if
# if x == y:
# print(f'{x} is equal to {y}')
# else:
# print(f'{x} is not equal to {y}')
# # Elif
# if x > y:
# print(f'{x} is bigger to {y}')
# elif x == y:
# print(f'{x} is equal to {y}')
# else:
# print(f'{x} is not equal to {y}')
# Nested if
# if x > 2:
# if x <=... | x = 6
y = 7
numbers = [1, 2, 3, 4, 5]
if x is y:
print(x is y)
if x is not y:
print(x is y)
if x is not y:
print(x is not y) |
# https://leetcode.com/problems/max-consecutive-ones
class Solution:
def findMaxConsecutiveOnes(self, nums):
is_consec = False
cnt, ans = 0, 0
for i in range(len(nums)):
if (nums[i] == 1) and is_consec:
cnt += 1
ans = max(ans, cnt)
el... | class Solution:
def find_max_consecutive_ones(self, nums):
is_consec = False
(cnt, ans) = (0, 0)
for i in range(len(nums)):
if nums[i] == 1 and is_consec:
cnt += 1
ans = max(ans, cnt)
elif nums[i] == 1 and (not is_consec):
... |
"""
2015 Advent of Code, Day 1
"""
with open("input", "r+") as file:
puzzle_input = file.read()
FLOOR = 0
POSITION = 0
BASEMENT = False
for (index, character) in enumerate(puzzle_input):
if character == "(":
FLOOR += 1
if character == ")":
FLOOR -= 1
if not BASEMENT and FLOOR < 0:
... | """
2015 Advent of Code, Day 1
"""
with open('input', 'r+') as file:
puzzle_input = file.read()
floor = 0
position = 0
basement = False
for (index, character) in enumerate(puzzle_input):
if character == '(':
floor += 1
if character == ')':
floor -= 1
if not BASEMENT and FLOOR < 0:
... |
a = 1
b = 2
print('a = ' + str(a) + ',' + 'b = ' + str(b))
temp = a
a = b
b = temp
print('a = ' + str(a) + ',' + 'b = ' + str(b))
| a = 1
b = 2
print('a = ' + str(a) + ',' + 'b = ' + str(b))
temp = a
a = b
b = temp
print('a = ' + str(a) + ',' + 'b = ' + str(b)) |
THRESHOLD = 4
HEADER = '<?xml version="1.0" encoding="utf-8"?>\n\t<output>\n'
FOOTER = '\t</output>\n'
valMap = {
'<': '',
'>': '',
'&': '',
'\"': ''
}
keyMap = {
'~': '',
'`': '',
'!': '',
'@': '',
'$': '',
'%': '',
'^': '',
'&': '',
'*': '',
'(': '',
')': ... | threshold = 4
header = '<?xml version="1.0" encoding="utf-8"?>\n\t<output>\n'
footer = '\t</output>\n'
val_map = {'<': '', '>': '', '&': '', '"': ''}
key_map = {'~': '', '`': '', '!': '', '@': '', '$': '', '%': '', '^': '', '&': '', '*': '', '(': '', ')': '', '+': '', '=': '', '{': '', '}': '', '[': '', ']': '', "'": '... |
class Solution(object):
def productExceptSelf(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
| class Solution(object):
def product_except_self(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
""" |
# Whitelist of generated features in dev STATUS for quicker execution
TSFRESH_FEATURE_WHITELIST = [
'agg_autocorrelation',
'autocorrelation',
'mean',
'mean_change',
'median',
'standard_deviation',
'variance',
'minimum',
]
# Size of the time-windows used for generating single time-series... | tsfresh_feature_whitelist = ['agg_autocorrelation', 'autocorrelation', 'mean', 'mean_change', 'median', 'standard_deviation', 'variance', 'minimum']
tsfresh_time_windows = 14 |
#
# solver_porting.py
#
# Description:
# Hard code the solution values from the paper
# Sin-Chung Chang,
# "The Method of Space-Time Conservation Element
# and Solution Element - A New Approach for Solving the Navier-Stokes
# and Euler Equations",
# Journal of Computational Physics, Volume 119,
# Issue 2... | def get_specific_solution_for_unit_test():
solution_porting = [(-0.505, 1.0, 0.0, 1.0), (-0.495, 1.0, 0.0, 1.0), (-0.485, 1.0, 0.0, 1.0), (-0.475, 1.0, 0.0, 1.0), (-0.465, 1.0, 0.0, 1.0), (-0.455, 1.0, 0.0, 1.0), (-0.445, 1.0, 0.0, 1.0), (-0.435, 1.0, 0.0, 1.0), (-0.425, 1.0, 0.0, 1.0), (-0.415, 1.0, 0.0, 1.0), (-0... |
# __version__.py
# autogenerated by poetry-hooks 0.1.0
__version__ = "0.1.0a0"
__title__ = "pytorch-caldera"
__authors__ = ["Justin Vrana <justin.vrana@gmail.com>"]
__repository__ = ""
__homepage__ = "http://www.github.com/jvrana/caldera"
__description__ = ""
__maintainers__ = ""
__readme__ = ""
__license__ = ""
| __version__ = '0.1.0a0'
__title__ = 'pytorch-caldera'
__authors__ = ['Justin Vrana <justin.vrana@gmail.com>']
__repository__ = ''
__homepage__ = 'http://www.github.com/jvrana/caldera'
__description__ = ''
__maintainers__ = ''
__readme__ = ''
__license__ = '' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.