content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# -*- coding: utf-8 -*-
__author__ = 'Daniel Williams'
__email__ = 'd.williams.2@research.gla.ac.uk'
__version__ = '0.2.1'
| __author__ = 'Daniel Williams'
__email__ = 'd.williams.2@research.gla.ac.uk'
__version__ = '0.2.1' |
# Two Sum
# Given an array of integers, return indices of the two numbers such that they add up to a specific target.
# You may assume that each input would have exactly one solution, and you may not use the same element twice.
# Example:
# Given nums = [2, 7, 11, 15], target = 9,
# Because nums[0] + nums[1] = 2 + ... | """
The first solution is 0(NlogN) as we start by sorting the list
Start with two pointers left and right as the extremes of the list
Add left and right and compare with target
if target is greater than the sum it would make sense to decrease the sum ==> by going lower on the upper bound as it represents the higher wei... |
def stdout_handler(config):
def handle(event):
print('>', event._formatted)
print(event.message.strip())
return handle
| def stdout_handler(config):
def handle(event):
print('>', event._formatted)
print(event.message.strip())
return handle |
# Created from VeraMono.ttf with freetype-generator.
# freetype-generator created by Meurisse D ( MCHobby.be ).
VeraMono_14 = {
'width' : 0x9,
'height' : 0xf,
32:(),
33:( 0xe7e0,),
34:( 0xf800, 0x8000, 0xf800),
35:( 0x8800, 0xe900, 0x9f00, 0x89e0, 0xf900, 0x8f80, 0x89e0, 0x8100),
36:( 0x88e0, 0x9190, 0x9110, 0xfffc,... | vera_mono_14 = {'width': 9, 'height': 15, 32: (), 33: (59360,), 34: (63488, 32768, 63488), 35: (34816, 59648, 40704, 35296, 63744, 36736, 35296, 33024), 36: (35040, 37264, 37136, 65532, 37136, 37648, 36384), 37: (32960, 35104, 34080, 33984, 45568, 51712, 51456, 45056), 38: (48128, 58304, 49952, 50208, 55328, 40960, 563... |
def main():
f1, f2, limit, s = 1, 2, 4000000, 2
while True:
f = f1 + f2
if f > limit:
break
if not f & 1:
s += f
f1 = f2
f2 = f
return s
if __name__ == '__main__':
print(main())
| def main():
(f1, f2, limit, s) = (1, 2, 4000000, 2)
while True:
f = f1 + f2
if f > limit:
break
if not f & 1:
s += f
f1 = f2
f2 = f
return s
if __name__ == '__main__':
print(main()) |
tot = soma = 0
while True:
num = int(input('Digite um numero [999 para parar]: '))
if num == 999:
break
tot += 1
soma += num
print(f'A soma dos valores foi {soma} e voce digitou {tot} numeros')
| tot = soma = 0
while True:
num = int(input('Digite um numero [999 para parar]: '))
if num == 999:
break
tot += 1
soma += num
print(f'A soma dos valores foi {soma} e voce digitou {tot} numeros') |
TARGET_PAGE = {
'CONFIG_PATH': 'system files/config',
'NUMBER_OF_PAGES' : 2, ### update number of pages
'TITLE' : 'Job Listings - ML',
'URL' : '' ## add URL
}
TARGET_URL = TARGET_PAGE['URL']
CONFIG_FILE = TARGET_PAGE['CONFIG_PATH']
EXCEL_TITLE = TARGET_PAGE['TITLE']
NUM_PAGES = TARGET_PAGE['NUMBER_OF_PAGES'... | target_page = {'CONFIG_PATH': 'system files/config', 'NUMBER_OF_PAGES': 2, 'TITLE': 'Job Listings - ML', 'URL': ''}
target_url = TARGET_PAGE['URL']
config_file = TARGET_PAGE['CONFIG_PATH']
excel_title = TARGET_PAGE['TITLE']
num_pages = TARGET_PAGE['NUMBER_OF_PAGES'] + 2
login_url = 'https://www.linkedin.com/uas/login'
... |
class Solution(object):
def maxCoins(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if not nums:
return 0
nums.insert(0, 1)
nums.append(1)
memo = dict()
def burst(left, right):
if left + 1 >= right:
... | class Solution(object):
def max_coins(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if not nums:
return 0
nums.insert(0, 1)
nums.append(1)
memo = dict()
def burst(left, right):
if left + 1 >= right:
... |
gsCP437 = (
"\u0000"
"\u263A"
"\u263B"
"\u2665"
"\u2666"
"\u2663"
"\u2660"
"\u2022"
"\u25D8"
"\u25CB"
"\u25D9"
"\u2642"
"\u2640"
"\u266A"
"\u266B"
"\u263C"
"\u25BA"
"\u25C4"
"\u2195"
"\u203C"
"\u00B6"
"\u00A7"
"\u25AC"
"\u21A8"
"\u2191"
"\u2193"
"\u2192"
"\u2190"
... | gs_cp437 = '\x00☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\xa0'
def fs_cp437_from_bytes_string(sbData):
... |
class Cyclist:
def __init__(self, name, nationality, nickname):
self._name = name
self._nationality = nationality
self._nickname = nickname
@property
def name(self):
return self._name
@name.setter
def name(self, new_name):
self._name = new_name
@property
def nationality(self):
... | class Cyclist:
def __init__(self, name, nationality, nickname):
self._name = name
self._nationality = nationality
self._nickname = nickname
@property
def name(self):
return self._name
@name.setter
def name(self, new_name):
self._name = new_name
@proper... |
def add(x,y):
"""Add Function
"""
return x + y
def subtract(x,y):
"""Subtract Function
"""
return x - y
def multiply(x,y):
"""Multiply Function
"""
return x * y
def divide(x,y):
"""Divide Function
"""
return x / y
| def add(x, y):
"""Add Function
"""
return x + y
def subtract(x, y):
"""Subtract Function
"""
return x - y
def multiply(x, y):
"""Multiply Function
"""
return x * y
def divide(x, y):
"""Divide Function
"""
return x / y |
class Ala:
def __init__(self):
print('a')
class Bob(Ala):
def __init__(self, var):
Ala.__init__(self)
self.var = var
print('b')
class Cecylia(Bob):
def __init__(self, vara, var2):
Bob.__init__(self, vara)
self.var = var2
print('c')
c = Cecylia(3, 5... | class Ala:
def __init__(self):
print('a')
class Bob(Ala):
def __init__(self, var):
Ala.__init__(self)
self.var = var
print('b')
class Cecylia(Bob):
def __init__(self, vara, var2):
Bob.__init__(self, vara)
self.var = var2
print('c')
c = cecylia(3, ... |
"""
Default static settings for the controlled_vocabulary app
All settings variables can be overridden in your django project settings.py
See controlled_vocabulary/settings.py for dynamic settings.
"""
# List of import paths to vocabularies lookup classes
CONTROLLED_VOCABULARY_VOCABULARIES = [
"controlled_vocabul... | """
Default static settings for the controlled_vocabulary app
All settings variables can be overridden in your django project settings.py
See controlled_vocabulary/settings.py for dynamic settings.
"""
controlled_vocabulary_vocabularies = ['controlled_vocabulary.vocabularies.iso639_2', 'controlled_vocabulary.vocabular... |
def quadrado_de_pares(numero):
for num in range(2, numero + 1, 2):
print(f'{num}^2 = {num ** 2}')
n = int(input())
quadrado_de_pares(n)
| def quadrado_de_pares(numero):
for num in range(2, numero + 1, 2):
print(f'{num}^2 = {num ** 2}')
n = int(input())
quadrado_de_pares(n) |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Doubly linked list. The main purpose is torepresent incidence at each node.
It is used to manage an ordered list of elements for:
- dynamic insertion and deletion of elements at specific point in O(|1|).
- iteration in both forwards and backwards.
- desctuctive iterati... | """
Doubly linked list. The main purpose is torepresent incidence at each node.
It is used to manage an ordered list of elements for:
- dynamic insertion and deletion of elements at specific point in O(|1|).
- iteration in both forwards and backwards.
- desctuctive iteration where some elements are removed or inserted ... |
def uppercase(func):
def wrapper():
originalResult = func()
modifiedResult = originalResult.upper()
return modifiedResult
return wrapper
@uppercase
def greet():
return 'Hello World!'
print(greet())
# OUTPUT
# HELLO WORLD! | def uppercase(func):
def wrapper():
original_result = func()
modified_result = originalResult.upper()
return modifiedResult
return wrapper
@uppercase
def greet():
return 'Hello World!'
print(greet()) |
# coding=utf-8
"""OSM Reporter exceptions.
:copyright: (c) 2016 by Etienne Trimaille
:license: GPLv3, see LICENSE for more details.
"""
class OverpassTimeoutException(Exception):
pass
class OverpassBadRequestException(Exception):
pass
class OverpassConcurrentRequestException(Exception):
pass
class O... | """OSM Reporter exceptions.
:copyright: (c) 2016 by Etienne Trimaille
:license: GPLv3, see LICENSE for more details.
"""
class Overpasstimeoutexception(Exception):
pass
class Overpassbadrequestexception(Exception):
pass
class Overpassconcurrentrequestexception(Exception):
pass
class Overpassdoesnotretur... |
LongName = raw_input("Enter Class Name... ")
ShortName = raw_input("Enter Short Name... ")
hcontents = """#pragma once
#include "./Component.h"
namespace audio
{
class %s : public Component
{
public:
%s();
virtual void CalcSample(double& dSample) override;
};
}
""" % (LongName, LongName)
f=open("../src/Com... | long_name = raw_input('Enter Class Name... ')
short_name = raw_input('Enter Short Name... ')
hcontents = '#pragma once\n\n#include "./Component.h"\n\nnamespace audio\n{\n\tclass %s : public Component\n\t{\n\tpublic:\n\t\t%s();\n\t\tvirtual void CalcSample(double& dSample) override;\n\t};\n\n}\n' % (LongName, LongName)
... |
panel = pm.getPanel(wf=True)
qtpanel = panel.asQtObject()
sew = qtpanel.children()[-1]
sewl = sew.layout()
seww = sewl.itemAt(1).widget()
sewww = seww.children()[-1]
splitter = sewww.children()[1]
splitter.setOrientation(QtCore.Qt.Orientation.Horizontal)
sc = splitter.widget(0)
se = splitter.widget(1)
splitter.in... | panel = pm.getPanel(wf=True)
qtpanel = panel.asQtObject()
sew = qtpanel.children()[-1]
sewl = sew.layout()
seww = sewl.itemAt(1).widget()
sewww = seww.children()[-1]
splitter = sewww.children()[1]
splitter.setOrientation(QtCore.Qt.Orientation.Horizontal)
sc = splitter.widget(0)
se = splitter.widget(1)
splitter.insertWi... |
#
# PySNMP MIB module P-BRIDGE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/P-BRIDGE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:05:00 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,... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, single_value_constraint, value_range_constraint, constraints_intersection) ... |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def not_null(self, head: ListNode) -> bool:
return head is not None
def hasCycle(self, head: ListNode) -> bool:
if head is None:
return Fal... | class Listnode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def not_null(self, head: ListNode) -> bool:
return head is not None
def has_cycle(self, head: ListNode) -> bool:
if head is None:
return False
(slow, fast) = (head, he... |
input = """
x(X) :- X > 1, X < 3.%, #int(X).
"""
output = """
x(X) :- X > 1, X < 3.%, #int(X).
"""
| input = '\nx(X) :- X > 1, X < 3.%, #int(X).\n'
output = '\nx(X) :- X > 1, X < 3.%, #int(X).\n' |
def setup():
size(800, 400)
desenha_retangulos(0, 0, 399, 10)
def desenha_retangulos(x, y, tam, level):
rect(x, y, tam, tam)
if level > 1:
level = level -1
desenha_retangulos(x, y, tam/2, level)
desenha_retangulos(x + tam, y, tam/2, level)
| def setup():
size(800, 400)
desenha_retangulos(0, 0, 399, 10)
def desenha_retangulos(x, y, tam, level):
rect(x, y, tam, tam)
if level > 1:
level = level - 1
desenha_retangulos(x, y, tam / 2, level)
desenha_retangulos(x + tam, y, tam / 2, level) |
class Calculadora:
def soma(self, num1, num2):
return num1 + num2
def subtracao(self, num1, num2):
return num1 - num2
def multiplicacao(self, num1, num2):
return num1 * num2
def divisao(self, num1, num2):
return num1 / num2
calculadora = Calculadora()
print(calcula... | class Calculadora:
def soma(self, num1, num2):
return num1 + num2
def subtracao(self, num1, num2):
return num1 - num2
def multiplicacao(self, num1, num2):
return num1 * num2
def divisao(self, num1, num2):
return num1 / num2
calculadora = calculadora()
print(calculador... |
#!/usr/bin/python
#
# Locates SEH try blocks, exception filters and handlers for x64 Windows files.
#
# Author: Satoshi Tanda
#
################################################################################
# The MIT License (MIT)
#
# Copyright (c) 2015 tandasat
#
# Permission is hereby granted, free of charge, to an... | class Runtimefuncton(object):
"""Represents RUNTIME_FUNCTION"""
def __init__(self, address):
self.begin_address = dword(address) + idaapi.get_imagebase()
self.unwind_info = dword(address + 8)
make_struct_ex(address, -1, 'RUNTIME_FUNCTION')
def get_unwind_info(self):
name = ... |
class Node:
def __init__(self, data):
self.data = data
self.left = self.right = None
def leafTraversal(node, lst):
if node is None:
return
if node is not None:
leafTraversal(node.left, lst)
if node.left is not None and node.right is not None:
lst.append(... | class Node:
def __init__(self, data):
self.data = data
self.left = self.right = None
def leaf_traversal(node, lst):
if node is None:
return
if node is not None:
leaf_traversal(node.left, lst)
if node.left is not None and node.right is not None:
lst.appen... |
# In this challenge, we'll work with lists
# Remember to make sure the tests pass
# count the number of 1s in the given list
def list_count_ones():
a = [1, 8, 6, 7, 5, 3, 0, 9, 1]
# we have not covered the list method with this functionality
return None
# calculate the average value of the given list
def... | def list_count_ones():
a = [1, 8, 6, 7, 5, 3, 0, 9, 1]
return None
def list_mean():
b = [0, 3, 4, 7]
return None
def list_lt3():
c = [5, 9, 0, -1, 6, 3, 2, 1]
return None |
def partition(a,l,h):
p = h
i = l-1
for j in range(l,h):
if a[j] <= a[p]:
i+=1
a[i],a[j]=a[j],a[i]
a[i+1],a[h]=a[h],a[i+1]
return i+1
def quickSort(a,l,h):
if l<h:
x=partition(a,l,h)
quickSort(a,l,x-1)
quickSort(a,x+1,h)
a = [97, 42, 1, 24, 63, 94, 2]
quickSort(a,0,len(a)-1)
print(a)
| def partition(a, l, h):
p = h
i = l - 1
for j in range(l, h):
if a[j] <= a[p]:
i += 1
(a[i], a[j]) = (a[j], a[i])
(a[i + 1], a[h]) = (a[h], a[i + 1])
return i + 1
def quick_sort(a, l, h):
if l < h:
x = partition(a, l, h)
quick_sort(a, l, x - 1)
... |
def mergesort(array, byfunc=None):
pass
class Stack:
pass
class EvaluateExpression:
pass
def get_smallest_three(challenge):
records = challenge.records
times = [r for r in records]
mergesort(times, lambda x: x.elapsed_time)
return times[:3]
| def mergesort(array, byfunc=None):
pass
class Stack:
pass
class Evaluateexpression:
pass
def get_smallest_three(challenge):
records = challenge.records
times = [r for r in records]
mergesort(times, lambda x: x.elapsed_time)
return times[:3] |
authType = {
"access_token": str,
"token_type": str,
}
| auth_type = {'access_token': str, 'token_type': str} |
# 8. Print an array - Given an array of integers prints all the elements one per line. This
# is a little bit dierent as there is no need for a 'return' statement just to print and recurse.
# Define the function
def print_array(array):
# Set the base case, in this case, when the length of the array is 0.
... | def print_array(array):
base_case = len(array)
if base_case == 0:
return 0
else:
print(array[0])
print_array(array[1:])
array = [3, 4, 5, 6, 7, 8, 10, 12, 13]
print_array(array) |
# Copyright (c) 2018 European Organization for Nuclear Research.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LIC... | class Baseobject(object):
def __init__(self, *args, **kwargs):
pass
class Placementobject(BaseObject):
def __init__(self, *args, **kwargs):
pass
class Persistentobject(object):
"""Base class for all objects stored in aardvark DB"""
fields = []
enum_fields = {}
db_map = {}
... |
user_password = 's3cr3t!P@ssw0rd'
input_password = input()
if input_password == user_password:
print('Welcome')
else:
print('Wrong password!')
| user_password = 's3cr3t!P@ssw0rd'
input_password = input()
if input_password == user_password:
print('Welcome')
else:
print('Wrong password!') |
def sum_fucntion(arr, i, N):
if i > N - 1:
return 0
return int(arr[i]) + sum_fucntion(arr, i + 1, N)
def main():
N = int(input())
arr = input()
print(sum_fucntion(arr, 0, N))
if __name__ == "__main__":
main()
| def sum_fucntion(arr, i, N):
if i > N - 1:
return 0
return int(arr[i]) + sum_fucntion(arr, i + 1, N)
def main():
n = int(input())
arr = input()
print(sum_fucntion(arr, 0, N))
if __name__ == '__main__':
main() |
# to convert list to dictionary
x="SecondName FirstName Intials "
y= x.split(" ") #this will create list "y"
print("Type yourname with Firstname Secondname Intials")
a=input()
b = a.split(" ") #this will create input to list
resultdict = {}
for index in y:
for value in b:
resultdict[index] = value
b... | x = 'SecondName FirstName Intials '
y = x.split(' ')
print('Type yourname with Firstname Secondname Intials')
a = input()
b = a.split(' ')
resultdict = {}
for index in y:
for value in b:
resultdict[index] = value
break
print(resultdict) |
# Given a set of non-overlapping intervals, insert a new interval into the
# intervals (merge if necessary).
# You may assume that the intervals were initially sorted according to their
# start times.
# Example 1:
# Input: intervals = [[1,3],[6,9]], newInterval = [2,5]
# Output: [[1,5],[6,9]]
# Example 2:
# Input: in... | class Solution_1:
def insert(intervals, newInterval):
intervals.append(newInterval)
intervals.sort()
merge = []
for ele in intervals:
if not merge or merge[-1][1] < ele[0]:
merge.append(ele)
else:
merge[-1][1] = max(merge[-1][1... |
# Interview Question 3.3
class SetOfStacks(object):
def __init__(self, threshold):
if threshold <= 0:
raise ValueError('Invalid threshold value')
self._threshold = threshold
self._stacks = []
def __len__(self):
return len(self._stacks)
def push(self, item):
... | class Setofstacks(object):
def __init__(self, threshold):
if threshold <= 0:
raise value_error('Invalid threshold value')
self._threshold = threshold
self._stacks = []
def __len__(self):
return len(self._stacks)
def push(self, item):
if not self._stacks... |
#!/usr/bin/python3.5
# import time
def kosaraju_strongly_connected_components():
# input_file_name = 'kosaraju_SCC_test_result_is_3_3_3_0_0.txt'
# input_file_name = 'kosaraju_SCC_test_result_is_6_3_2_1_0.txt'
input_file_name = 'kosaraju_SCC_input.txt'
print('Creating adjacency lists')
adjacency_list = []
... | def kosaraju_strongly_connected_components():
input_file_name = 'kosaraju_SCC_input.txt'
print('Creating adjacency lists')
adjacency_list = []
reversed_adjacency_list = []
n = 0
rn = 0
with open(input_file_name) as f:
for line in f:
uv = line[:-1].strip().split(' ')
... |
"""MCAS Exceptions."""
class FormatCEFError(Exception):
"""CEF Format Error class."""
pass
class Error(Exception):
"""Base class for exceptions in this module."""
pass
class CEFValueError(FormatCEFError, ValueError):
"""Exception raised for invalid value mappings.
:attribute: message --... | """MCAS Exceptions."""
class Formatceferror(Exception):
"""CEF Format Error class."""
pass
class Error(Exception):
"""Base class for exceptions in this module."""
pass
class Cefvalueerror(FormatCEFError, ValueError):
"""Exception raised for invalid value mappings.
:attribute: message -- expl... |
def debug_input_output(function):
def wrapper(*args, **kwargs):
print(f"[INPUT] ARGS: {args}")
print(f"[INPUT] KWARGS: {kwargs}")
output = function(*args, **kwargs)
print(f"[OUTPUT]: {output}")
return output
return wrapper
@debug_input_output
de... | def debug_input_output(function):
def wrapper(*args, **kwargs):
print(f'[INPUT] ARGS: {args}')
print(f'[INPUT] KWARGS: {kwargs}')
output = function(*args, **kwargs)
print(f'[OUTPUT]: {output}')
return output
return wrapper
@debug_input_output
def say_something(word):
... |
class Solution:
def stoneGame(self, piles: List[int]) -> bool:
# dp = [[0]*len(piles) for _ in range(len(piles))]
# for i in range(len(piles)-2,-1,-1):
# for j in range(i,len((piles))):
# dp[i][j] = max(piles[i]-dp[i+1][j],piles[j]-dp[i][j-1])
# return dp[0][len(p... | class Solution:
def stone_game(self, piles: List[int]) -> bool:
dp = [0] * len(piles)
for i in range(len(piles) - 2, -1, -1):
for j in range(i, len(piles)):
dp[j] = max(piles[i] - dp[j], piles[j] - dp[max(0, j - 1)])
return dp[len(piles) - 1] > 0 |
# k_configfile = "configFileName"
# dev keys
packageName = "infobot"
socialModule = "social."
storageModule = "storage."
# storage keys
dataDirectoryKey = "directory"
counterKey = "counterfile"
indexFileFormatKey = "indexformat"
pickleFileKey = "picklefile"
downloadUrlKey = "downloadurl"
# index related keys
startKe... | package_name = 'infobot'
social_module = 'social.'
storage_module = 'storage.'
data_directory_key = 'directory'
counter_key = 'counterfile'
index_file_format_key = 'indexformat'
pickle_file_key = 'picklefile'
download_url_key = 'downloadurl'
start_key = 'start'
last_key = 'last'
previous_key = 'previous'
footer_key = '... |
#generar tuplas
tupla1=(1,2,3)
tupla2_=(1,) #sirve para crear una tupla con un solo componente
| tupla1 = (1, 2, 3)
tupla2_ = (1,) |
# Copyright (c) 2012 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.
{
'conditions': [
# In component mode (shared_lib), we build all of skia as a single DLL.
# However, in the static mode, we need to build skia ... | {'conditions': [['component=="static_library"', {'targets': [{'target_name': 'skia_library', 'type': 'static_library', 'variables': {'optimize': 'max'}, 'includes': ['skia_common.gypi', 'skia_library.gypi']}]}], ['component=="static_library"', {'targets': [{'target_name': 'skia', 'variables': {'optimize': 'max'}, 'type... |
RAW_PATH="./data/PeMS_04/PeMS04.npz"
SCAL_PATH='./scal/standard_scal.pkl'
HISTORY_WINDOW=50
PROCESS_PATH='./processed/process_data.csv'
LSTM_RE_PATH='./re/LSTM_re.csv'
GRU_RE_PATH='./re/GRU_re.csv'
GRU_ATTENTION_RE_PATH='./re/GRU_attention_re.csv'
GRU_DUAL_STAGE_ATTENTION_RE_PATH='./re/gru_dual_stage_attention_re.c... | raw_path = './data/PeMS_04/PeMS04.npz'
scal_path = './scal/standard_scal.pkl'
history_window = 50
process_path = './processed/process_data.csv'
lstm_re_path = './re/LSTM_re.csv'
gru_re_path = './re/GRU_re.csv'
gru_attention_re_path = './re/GRU_attention_re.csv'
gru_dual_stage_attention_re_path = './re/gru_dual_stage_at... |
# This script is dynamically added as a subclass in tool_dock_examples.py
def main():
print("This is a script that prints when evaluated")
if __name__ == "__main__":
main()
| def main():
print('This is a script that prints when evaluated')
if __name__ == '__main__':
main() |
myList = [16, 1, 10, 31, 15, 11, 47, 23, 47, 3, 29, 23, 44, 27, 10, 14, 17, 15, 1, 38, 7, 7, 25, 1, 8, 15, 16, 20, 12,
14, 6, 10, 39, 42, 33, 26, 30, 27, 25, 13, 11, 26, 39, 19, 15, 21, 22]
starting_index = int(input("Please enter the starting index: "))
if 0 <= starting_index <= len(myList):
stopping... | my_list = [16, 1, 10, 31, 15, 11, 47, 23, 47, 3, 29, 23, 44, 27, 10, 14, 17, 15, 1, 38, 7, 7, 25, 1, 8, 15, 16, 20, 12, 14, 6, 10, 39, 42, 33, 26, 30, 27, 25, 13, 11, 26, 39, 19, 15, 21, 22]
starting_index = int(input('Please enter the starting index: '))
if 0 <= starting_index <= len(myList):
stopping_index = int(... |
class Solution:
def minDistance(self, word1: str, word2: str) -> int:
n1 = len(word1)
n2 = len(word2)
dp = []
for i in range(n1+1):
dp.append([0]*(n2+1))
for i in range(1, n1+1):
for j in range(1, n2+1):
if(word1[i-1] == word2[j-1]):
... | class Solution:
def min_distance(self, word1: str, word2: str) -> int:
n1 = len(word1)
n2 = len(word2)
dp = []
for i in range(n1 + 1):
dp.append([0] * (n2 + 1))
for i in range(1, n1 + 1):
for j in range(1, n2 + 1):
if word1[i - 1] == w... |
"Install toolchain dependencies"
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install")
load(":mock_io_bazel_rules_closure.bzl", "mock_io_bazel_rules_closure")
def npm_bazel_labs_dependencies():
"""
Fetch our transitive dependencies.
... | """Install toolchain dependencies"""
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
load('@build_bazel_rules_nodejs//:index.bzl', 'yarn_install')
load(':mock_io_bazel_rules_closure.bzl', 'mock_io_bazel_rules_closure')
def npm_bazel_labs_dependencies():
"""
Fetch our transitive dependencie... |
def solution(n):
largest = 1
div = 2
while n > 1:
while n % div == 0:
if div > largest: largest = div;
n /= div
div += 1
if div * div > n:
if n > 1 and n > largest: largest = n
break
return largest
def test_LargestPrimeFactor():
... | def solution(n):
largest = 1
div = 2
while n > 1:
while n % div == 0:
if div > largest:
largest = div
n /= div
div += 1
if div * div > n:
if n > 1 and n > largest:
largest = n
break
return largest
de... |
class Pile:
def __init__(self, *args):
self.__valeur = list(args)
def __str__(self):
return str(self.__valeur)
def __repr__(self):
return self.__str__()
def empiler(self, valeur):
self.__valeur.append(valeur)
def depiler(self):
return self.__... | class Pile:
def __init__(self, *args):
self.__valeur = list(args)
def __str__(self):
return str(self.__valeur)
def __repr__(self):
return self.__str__()
def empiler(self, valeur):
self.__valeur.append(valeur)
def depiler(self):
return self.__valeur.pop() |
text = input("Text to translate to Roachanese: ")
words = text.split(" ")
special_chars = ['.', ',', ';', ':', '-', '_', '\'', '\"', '?', '!', '$', '%', '&', '*', '(', ')', '/', '\\']
translated = []
for word in words:
if "brother" in word:
translated.append(word)
else:
newWord = word
... | text = input('Text to translate to Roachanese: ')
words = text.split(' ')
special_chars = ['.', ',', ';', ':', '-', '_', "'", '"', '?', '!', '$', '%', '&', '*', '(', ')', '/', '\\']
translated = []
for word in words:
if 'brother' in word:
translated.append(word)
else:
new_word = word
no_... |
# Author: Kirill Leontyev (DC)
# These exceptions can be raised by frt_bootstrap.boot_starter.boot.
class Boot_attempt_failure(Exception):
pass
class System_corruption(Exception):
pass
class Localization_loss(Exception):
pass
class CodePage_loss(Exception):
pass
| class Boot_Attempt_Failure(Exception):
pass
class System_Corruption(Exception):
pass
class Localization_Loss(Exception):
pass
class Codepage_Loss(Exception):
pass |
#!/usr/bin/python
#
# Copyright 2018-2022 Polyaxon, Inc.
#
# 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 ... | class Polyaxonserviceheaders:
cli_version = 'X_POLYAXON_CLI_VERSION'
client_version = 'X_POLYAXON_CLIENT_VERSION'
internal = 'X_POLYAXON_INTERNAL'
service = 'X_POLYAXON_SERVICE'
values = {CLIENT_VERSION, CLIENT_VERSION, INTERNAL, SERVICE}
@staticmethod
def get_header(header):
return... |
class Scheduler:
"""
Class to represent to Traffic Scheduler that manages the traffic signal
at a particular intersection.
"""
def __init__(self, n_roads, n_lanes, k_c, k_a, k_w, thresh=10, current=-1):
"""
Constructs the Traffic Scheduler object.
:param n_roads: Number of independent roads at this interse... | class Scheduler:
"""
Class to represent to Traffic Scheduler that manages the traffic signal
at a particular intersection.
"""
def __init__(self, n_roads, n_lanes, k_c, k_a, k_w, thresh=10, current=-1):
"""
Constructs the Traffic Scheduler object.
:param n_roads: Number of independent roads at ... |
#!/usr/bin/env python3
#
# # Copyright (c) 2021 Facebook, inc. and its affiliates. All Rights Reserved
#
#
if __name__ == '__main__':
pass
| if __name__ == '__main__':
pass |
'''
Wifi Facade.
=============
The :class:`Wifi` is to provide access to the wifi of your mobile/ desktop
devices.
It currently supports `connecting`, `disconnecting`, `scanning`, `getting
available wifi network list` and `getting network information`.
Simple examples
---------------
To enable/ turn on wifi scannin... | """
Wifi Facade.
=============
The :class:`Wifi` is to provide access to the wifi of your mobile/ desktop
devices.
It currently supports `connecting`, `disconnecting`, `scanning`, `getting
available wifi network list` and `getting network information`.
Simple examples
---------------
To enable/ turn on wifi scannin... |
def get_encoder_decoder_hp(model='gin', decoder=None):
if model == 'gin':
model_hp = {
# hp from model
"num_layers": 5,
"hidden": [64,64,64,64],
"dropout": 0.5,
"act": "relu",
"eps": "False",
"mlp_layers": 2
}
i... | def get_encoder_decoder_hp(model='gin', decoder=None):
if model == 'gin':
model_hp = {'num_layers': 5, 'hidden': [64, 64, 64, 64], 'dropout': 0.5, 'act': 'relu', 'eps': 'False', 'mlp_layers': 2}
if model == 'gat':
model_hp = {'num_layers': 2, 'hidden': [8], 'num_hidden_heads': 8, 'num_output_hea... |
Experiment(description='Trying latest code on classic data sets',
data_dir='../data/tsdlr-renamed/',
max_depth=10,
random_order=False,
k=1,
debug=False,
local_computation=False,
n_rand=9,
sd=2,
jitter_sd=0.1,
... | experiment(description='Trying latest code on classic data sets', data_dir='../data/tsdlr-renamed/', max_depth=10, random_order=False, k=1, debug=False, local_computation=False, n_rand=9, sd=2, jitter_sd=0.1, max_jobs=400, verbose=False, make_predictions=False, skip_complete=True, results_dir='../results/2014-01-15-GPS... |
#!/usr/bin/env python3
total_sum = 0
def calculate_fuel(mass: int) -> int:
part = int((mass/3)-2)
if part <= 0:
return 0
print(part)
return part + calculate_fuel(part)
with open("input.txt", "r") as f:
for line in f.readlines():
value = int(line.strip())
total_sum += calcul... | total_sum = 0
def calculate_fuel(mass: int) -> int:
part = int(mass / 3 - 2)
if part <= 0:
return 0
print(part)
return part + calculate_fuel(part)
with open('input.txt', 'r') as f:
for line in f.readlines():
value = int(line.strip())
total_sum += calculate_fuel(value)
print(... |
# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations
#########################################################################
## Customize your APP title, subtitle and menus here
#########################################################################
response.logo... | response.logo = a(b('Slug', span('IOT')), _class='navbar-brand', _href=url('default', 'index'), _id='web2py-logo')
response.title = request.application.replace('_', ' ').title()
response.subtitle = ''
response.meta.author = myconf.get('app.author')
response.meta.description = myconf.get('app.description')
response.meta... |
with open('day08.input') as f:
data = [int(x) for x in f.read().split()]
class Node:
def __init__(self):
self.metadata = []
self.children = []
def add_child(self, obj):
self.children.append(obj)
def set_metadata(self, obj):
self.metadata = obj
def build_node(current... | with open('day08.input') as f:
data = [int(x) for x in f.read().split()]
class Node:
def __init__(self):
self.metadata = []
self.children = []
def add_child(self, obj):
self.children.append(obj)
def set_metadata(self, obj):
self.metadata = obj
def build_node(current_... |
__all__ = ['MAJOR_VERSION', 'MINOR_VERSION', 'PATCH', 'TAG', \
'VERSION', 'TEXT_VERSION',
'JSONSCHEMA_SPECIFICATION']
JSONSCHEMA_SPECIFICATION = 'draft-07'
MAJOR_VERSION = 2
MINOR_VERSION = 2
PATCH = 0
TAG = 'master'
VERSION = (MAJOR_VERSION,
MINOR_VERSION,
PATCH,
... | __all__ = ['MAJOR_VERSION', 'MINOR_VERSION', 'PATCH', 'TAG', 'VERSION', 'TEXT_VERSION', 'JSONSCHEMA_SPECIFICATION']
jsonschema_specification = 'draft-07'
major_version = 2
minor_version = 2
patch = 0
tag = 'master'
version = (MAJOR_VERSION, MINOR_VERSION, PATCH, TAG)
text_version = '{}.{}.{}#{}'.format(*list(VERSION)) |
# HEAD
# Python Basics - Creating variables
# DESCRIPTION
# Describes how variables throws error
# without any assignation
#
# RESOURCES
#
# STRUCTURE
# variable_target_name | equal_to_assignment_operator | target_value
var = 10
# # COMPULSORY DECLARATION
# A variable cannot just be declared and left. It has to ... | var = 10
var = None |
headers = {
'accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'accept-encoding':'gzip, deflate, br',
'accept-language':'zh-CN,zh;q=0.9',
'cookie':'cna=gY5GE8vPMGACASvgLWesBpgg; _med=dw:1440&dh:900&pw:1440&ph:900&ist:0; l=bBgQUK1lvHlc2bE_BOCg5uI81fb9kIRPguPRwGoei_5Q-1T-JB_... | headers = {'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8', 'accept-encoding': 'gzip, deflate, br', 'accept-language': 'zh-CN,zh;q=0.9', 'cookie': 'cna=gY5GE8vPMGACASvgLWesBpgg; _med=dw:1440&dh:900&pw:1440&ph:900&ist:0; l=bBgQUK1lvHlc2bE_BOCg5uI81fb9kIRPguPRwGoei_5Q-1T-... |
#
# PySNMP MIB module INT-SERV-GUARANTEED-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/INT-SERV-GUARANTEED-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:42:35 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint) ... |
bestbot_wieght_layer_one = [[0.5083356940068343, 0.6413884327387512, 0.12597500318803512, 0.409734240278669, 0.5238183286955302, 0.24756818387086588, 0.07996951671732211, 0.8661360538895999, 0.021330280161349524, 0.48867128687465466, 0.7091463179823605, 0.5510191844939321, 0.1511562255369685, 0.9902045558754771, 0.5598... | bestbot_wieght_layer_one = [[0.5083356940068343, 0.6413884327387512, 0.12597500318803512, 0.409734240278669, 0.5238183286955302, 0.24756818387086588, 0.07996951671732211, 0.8661360538895999, 0.021330280161349524, 0.48867128687465466, 0.7091463179823605, 0.5510191844939321, 0.1511562255369685, 0.9902045558754771, 0.5598... |
def mergeSort(arr):
# allow condition, if size of array is 1 (as one element in array is already sorted)
if len(arr)>1:
mid = len(arr)//2
#initializing the left and right array
left = arr[:mid]
right = arr[mid:]
mergeSort(left) #sorting the left array (... | def merge_sort(arr):
if len(arr) > 1:
mid = len(arr) // 2
left = arr[:mid]
right = arr[mid:]
merge_sort(left)
merge_sort(right)
merge(left, right, arr)
def merge(left, right, arr):
i = j = k = 0
while i < len(left) and j < len(right):
if left[i] <= ri... |
S = input()
T = input()
cnt = 0
if S[0] == T[0]:
cnt += 1
if S[1] == T[1]:
cnt += 1
if S[2] == T[2]:
cnt += 1
print(cnt)
| s = input()
t = input()
cnt = 0
if S[0] == T[0]:
cnt += 1
if S[1] == T[1]:
cnt += 1
if S[2] == T[2]:
cnt += 1
print(cnt) |
# config.py
DEBUG = False
TESTING = False
SQLALCHEMY_ECHO = False
SQLALCHEMY_TRACK_MODIFICATIONS = False | debug = False
testing = False
sqlalchemy_echo = False
sqlalchemy_track_modifications = False |
_EVE_SKIN_SERVER_URL = "https://eveskinserver.kalkoken.net"
_DEFAULT_IMAGE_SIZE = 32
def type_icon_url(type_id: int, size: int = _DEFAULT_IMAGE_SIZE) -> str:
"""icon image URL for the given SKIN type ID"""
if not size or size < 32 or size > 1024 or (size & (size - 1) != 0):
raise ValueError(f"Invalid ... | _eve_skin_server_url = 'https://eveskinserver.kalkoken.net'
_default_image_size = 32
def type_icon_url(type_id: int, size: int=_DEFAULT_IMAGE_SIZE) -> str:
"""icon image URL for the given SKIN type ID"""
if not size or size < 32 or size > 1024 or (size & size - 1 != 0):
raise value_error(f'Invalid size... |
#
# PySNMP MIB module NETASQ-ALARM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NETASQ-ALARM-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:08:27 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, value_size_constraint, constraints_union, constraints_intersection) ... |
# encoding: utf-8
"""Controller tests probably shouldn't use mocking.
.. todo::
Write the tests for one controller, figuring out the best way to write
controller tests. Then fill in this guidelines section, using the first set
of controller tests as an example.
Some things have been decided already:
... | """Controller tests probably shouldn't use mocking.
.. todo::
Write the tests for one controller, figuring out the best way to write
controller tests. Then fill in this guidelines section, using the first set
of controller tests as an example.
Some things have been decided already:
* All controller m... |
class OutputsBuilder:
"""
This class is not specific to Covid, so should be moved out of this file - but not sure whether to move it to
somewhere in autumn or in summer.
"""
def __init__(self, model, compartments):
self.model = model
self.model.request_output_for_compartments(
... | class Outputsbuilder:
"""
This class is not specific to Covid, so should be moved out of this file - but not sure whether to move it to
somewhere in autumn or in summer.
"""
def __init__(self, model, compartments):
self.model = model
self.model.request_output_for_compartments(name='... |
# This Algorithm prints all prime numbers based on user input.
# Requesting user input for starting Number and ending Number
start = int(input("Enter starting number: "))
end = int(input("Enter end number: "))
# For loop to loop through numbers from the inputted start and end numbers
for i in range(start, end + 1):
... | start = int(input('Enter starting number: '))
end = int(input('Enter end number: '))
for i in range(start, end + 1):
if i > 1:
for j in range(2, i):
if i % j == 0:
break
else:
print(i) |
class Solution:
def climbStairs(self, n: int) -> int:
if n == 1:
return 1
first = 1
second = 1
for i in range(1, n):
first, second = second, first + second
return second | class Solution:
def climb_stairs(self, n: int) -> int:
if n == 1:
return 1
first = 1
second = 1
for i in range(1, n):
(first, second) = (second, first + second)
return second |
class Carro:
def __init__(self, motor, direcao):
self.motor = motor
self.direcao = direcao
def calcular_velocidade(self):
return self.motor.velocidade
def acelerar(self):
self.motor.acelerar()
def frear(self):
self.motor.frear()
def calcular_direcao(self):... | class Carro:
def __init__(self, motor, direcao):
self.motor = motor
self.direcao = direcao
def calcular_velocidade(self):
return self.motor.velocidade
def acelerar(self):
self.motor.acelerar()
def frear(self):
self.motor.frear()
def calcular_direcao(self)... |
class TableNotFoundError(Exception):
def __init__(self, msg, table_name=None):
self.msg = msg
self.table_name = table_name
def __str__(self):
msg = self.msg
if self.table_name:
msg += ' Table path: ' + self.table_name
return msg
| class Tablenotfounderror(Exception):
def __init__(self, msg, table_name=None):
self.msg = msg
self.table_name = table_name
def __str__(self):
msg = self.msg
if self.table_name:
msg += ' Table path: ' + self.table_name
return msg |
# vim:fenc=utf-8
#
"""A healthchecker for Anycasted services."""
__title__ = 'anycast_healthchecker'
__author__ = 'Pavlos Parissis'
__license__ = 'Apache 2.0'
__version__ = '0.9.1'
__copyright__ = 'Copyright 2015-2020 Pavlos Parissis'
PROGRAM_NAME = __title__.replace('_', '-')
DEFAULT_OPTIONS = {
'DEFAULT': {
... | """A healthchecker for Anycasted services."""
__title__ = 'anycast_healthchecker'
__author__ = 'Pavlos Parissis'
__license__ = 'Apache 2.0'
__version__ = '0.9.1'
__copyright__ = 'Copyright 2015-2020 Pavlos Parissis'
program_name = __title__.replace('_', '-')
default_options = {'DEFAULT': {'interface': 'lo', 'check_inte... |
class Solution:
def findNumbers(self, nums: List[int]) -> int:
"""
Plan:
1. Iterate through nums using a for loop
2. For each iteration, find the number of digits for integer
3. If digits is even, add to counter
4. Return counter
"""
counter = 0
... | class Solution:
def find_numbers(self, nums: List[int]) -> int:
"""
Plan:
1. Iterate through nums using a for loop
2. For each iteration, find the number of digits for integer
3. If digits is even, add to counter
4. Return counter
"""
counter = 0
... |
# -*- coding: utf-8 -*-
SHAPE_SPHERE = 0
SHAPE_BOX = 1
SHAPE_CAPSULE = 2
MODE_STATIC = 0
MODE_DYNAMIC = 1
MODE_DYNAMIC_BONE = 2
| shape_sphere = 0
shape_box = 1
shape_capsule = 2
mode_static = 0
mode_dynamic = 1
mode_dynamic_bone = 2 |
"""
591. Tag Validator
Input: "<DIV>This is the first line <![CDATA[<div>]]></DIV>"
Output: True
Explanation:
The code is wrapped in a closed tag : <DIV> and </DIV>.
The TAG_NAME is valid, the TAG_CONTENT consists of some characters and cdata.
Although CDATA_CONTENT has unmatched start tag with in... | """
591. Tag Validator
Input: "<DIV>This is the first line <![CDATA[<div>]]></DIV>"
Output: True
Explanation:
The code is wrapped in a closed tag : <DIV> and </DIV>.
The TAG_NAME is valid, the TAG_CONTENT consists of some characters and cdata.
Although CDATA_CONTENT has unmatched start tag with invalid TAG_NAME... |
#
# Copyright (c) 2017, Massachusetts Institute of Technology All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright notice, this
# list o... | mc = __import__('MARTE2_COMPONENT', globals())
@MC.BUILDER('EquinoxGAM', MC.MARTE2_COMPONENT.MODE_GAM)
class Equinox_Gam(MC.MARTE2_COMPONENT):
inputs = [{'name': 'ip', 'type': 'float64', 'dimensions': 0, 'parameters': []}, {'name': 'btvac0', 'type': 'float64', 'dimensions': 0, 'parameters': []}, {'name': 'psi', 't... |
def normalize_scheme(scheme=None, default='//'):
if scheme is None:
scheme = default
elif scheme.endswith(':'):
scheme = '%s//' % scheme
elif '//' not in scheme:
scheme = '%s://' % scheme
return scheme
def normalize_port(port=None):
if port is None:
port = ''
e... | def normalize_scheme(scheme=None, default='//'):
if scheme is None:
scheme = default
elif scheme.endswith(':'):
scheme = '%s//' % scheme
elif '//' not in scheme:
scheme = '%s://' % scheme
return scheme
def normalize_port(port=None):
if port is None:
port = ''
eli... |
load("@bazel_gazelle//:deps.bzl", "go_repository")
def go_repositories():
go_repository(
name = "com_github_google_uuid",
importpath = "github.com/google/uuid",
sum = "h1:kxhtnfFVi+rYdOALN0B3k9UT86zVJKfBimRaciULW4I=",
version = "v1.1.5",
)
| load('@bazel_gazelle//:deps.bzl', 'go_repository')
def go_repositories():
go_repository(name='com_github_google_uuid', importpath='github.com/google/uuid', sum='h1:kxhtnfFVi+rYdOALN0B3k9UT86zVJKfBimRaciULW4I=', version='v1.1.5') |
class NoneChecker:
def __init__(self, function):
self.function = function
self.obj = None
def __call__(self, *args, **kwargs):
try:
self.obj = self.function(*args, **kwargs)
func_dict = self.obj.__dict__
[self.obj.__setattr__(_var, None) for _var in f... | class Nonechecker:
def __init__(self, function):
self.function = function
self.obj = None
def __call__(self, *args, **kwargs):
try:
self.obj = self.function(*args, **kwargs)
func_dict = self.obj.__dict__
[self.obj.__setattr__(_var, None) for _var in ... |
# https://www.youtube.com/watch?v=zwZXiutgrUE
class Solution(object):
def myAtoi(self, str):
"""
:type s: str
:rtype: int
"""
"""
:type str: str
:rtype: int
"""
'''
Valid
'42' -> 42
' -42' -> -42
'9999999999999... | class Solution(object):
def my_atoi(self, str):
"""
:type s: str
:rtype: int
"""
'\n :type str: str\n :rtype: int\n '
"\n Valid\n '42' -> 42\n ' -42' -> -42\n '99999999999999' -> MAX_INT\n '1312zcxvzc' -> 1312... |
class Person:
def __init__(self, firstName, lastName, idNumber):
self.firstName = firstName
self.lastName = lastName
self.idNumber = idNumber
def printPerson(self):
print("Name:", self.lastName + ",", self.firstName)
print("ID:", self.idNumber)
class Student(Person):
# Class Constructor
#
... | class Person:
def __init__(self, firstName, lastName, idNumber):
self.firstName = firstName
self.lastName = lastName
self.idNumber = idNumber
def print_person(self):
print('Name:', self.lastName + ',', self.firstName)
print('ID:', self.idNumber)
class Student(Person):
... |
# -*- coding: utf-8 -*-
"""
[greet.py]
Greet Plugin
[Author]
Abdur-Rahmaan Janhangeer, pythonmembers.club
[About]
responds to .hi, demo of a basic plugin
[Commands]
>>> .hi
returns hoo
"""
class Plugin:
def __init__(self):
pass
def run(self, incoming, methods, info, bot_info):
try:
... | """
[greet.py]
Greet Plugin
[Author]
Abdur-Rahmaan Janhangeer, pythonmembers.club
[About]
responds to .hi, demo of a basic plugin
[Commands]
>>> .hi
returns hoo
"""
class Plugin:
def __init__(self):
pass
def run(self, incoming, methods, info, bot_info):
try:
if info['command'] ... |
class Image:
"""
Image class for holding image data and metadata
"""
def __init__(self, im_data, filename):
"""Initialize image object
:param im_data: mxn array of image pixel data
:param filename: str, name of file
"""
self.image = im_data
self.name =... | class Image:
"""
Image class for holding image data and metadata
"""
def __init__(self, im_data, filename):
"""Initialize image object
:param im_data: mxn array of image pixel data
:param filename: str, name of file
"""
self.image = im_data
self.name = f... |
__author__ = 'Owen'
infnames = {0: 'Rifle Infantry', 1: 'Trencher Infantry', 2: 'Assault Infantry'}
armnames = {0: 'Autocar Divisions', 1: 'Lt-Armor Divisions', 2: 'Md-Armor Divisions'}
desnames = {0: 'Gunboats', 1: 'Destroyers', 2: 'Submarines'}
crunames = {0: 'Lt-Cruisers', 1: 'Hv-Cruisers', 2: 'Battlecruisers'}
bat... | __author__ = 'Owen'
infnames = {0: 'Rifle Infantry', 1: 'Trencher Infantry', 2: 'Assault Infantry'}
armnames = {0: 'Autocar Divisions', 1: 'Lt-Armor Divisions', 2: 'Md-Armor Divisions'}
desnames = {0: 'Gunboats', 1: 'Destroyers', 2: 'Submarines'}
crunames = {0: 'Lt-Cruisers', 1: 'Hv-Cruisers', 2: 'Battlecruisers'}
batn... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Sales Expense',
'version': '1.0',
'category': 'Sales',
'summary': 'Quotation, Sale Orders, Delivery & Invoicing Control',
'description': """
Module used for demo data
======================... | {'name': 'Sales Expense', 'version': '1.0', 'category': 'Sales', 'summary': 'Quotation, Sale Orders, Delivery & Invoicing Control', 'description': '\nModule used for demo data\n=========================\n\nCreate some products for which you can re-invoice the costs.\nThis module does not add any feature, despite a few ... |
"""
File: tokens.py
Description: Contains all the type of tokens
Author: Louis Albert Apas (louisalbertapas25@gmail.com)
Copyright 2020
"""
# Data types tokens
INT = 'INT'
CHAR = 'CHAR'
BOOL = 'BOOL'
FLOAT = 'FLOAT'
# Operator tokens
# Arithmetic operators
PLUS = 'PLUS' # could be a unary opera... | """
File: tokens.py
Description: Contains all the type of tokens
Author: Louis Albert Apas (louisalbertapas25@gmail.com)
Copyright 2020
"""
int = 'INT'
char = 'CHAR'
bool = 'BOOL'
float = 'FLOAT'
plus = 'PLUS'
minus = 'MINUS'
mul = 'MUL'
div = 'DIV'
mod = 'MOD'
greater_than = 'GREATER_THAN'
lesser... |
class baz:
A = 8
class bar(baz):
x = 0
def test(self):
return 'test in bar'
def test1(self, x):
return x * 'test1'
class truc:
machin = 99
class foo(bar,truc):
def test(self):
return 'test in foo'
def test2(self):
return 'test2'
obj = foo()
#ass... | class Baz:
a = 8
class Bar(baz):
x = 0
def test(self):
return 'test in bar'
def test1(self, x):
return x * 'test1'
class Truc:
machin = 99
class Foo(bar, truc):
def test(self):
return 'test in foo'
def test2(self):
return 'test2'
obj = foo()
assert obj.... |
'''
Created on Jun 3, 2017
@author: Jose
'''
class Issue:
'''
classdocs
'''
def __init__(self, id, rawData):
'''
Constructor
'''
self.ID = id
self.__rawData = rawData | """
Created on Jun 3, 2017
@author: Jose
"""
class Issue:
"""
classdocs
"""
def __init__(self, id, rawData):
"""
Constructor
"""
self.ID = id
self.__rawData = rawData |
def funcao(n,m):
c = []
i = 0
cont=m
while(len(c)<n):
i=i%n
try:
c.index(i)
except:
if(cont==m):
c.append(i)
cont=1
else:
cont=cont+1
i=i+1
return i;
while(1):
inp=input()
if(int(inp)==0):
break;
n=int(inp)
t=1
while(funcao(n,t)!=13):
t=t+1
print(t) | def funcao(n, m):
c = []
i = 0
cont = m
while len(c) < n:
i = i % n
try:
c.index(i)
except:
if cont == m:
c.append(i)
cont = 1
else:
cont = cont + 1
i = i + 1
return i
while 1:
inp... |
# Copyright (c) 2009 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
__all__ = [
'adduser',
'apt',
'base',
'base64',
'busybox',
'cat',
'curl',
'dd',
'env',
'ethtool',
'free',
'fs',
'ftpget',
'gcc',
'ifconfig',
'iptables',
... | __all__ = ['adduser', 'apt', 'base', 'base64', 'busybox', 'cat', 'curl', 'dd', 'env', 'ethtool', 'free', 'fs', 'ftpget', 'gcc', 'ifconfig', 'iptables', 'last', 'ls', 'nc', 'netstat', 'nohup', 'ping', 'scp', 'service', 'sleep', 'ssh', 'sudo', 'tar', 'uname', 'ulimit', 'wget', 'which', 'perl', 'uptime', 'python', 'tftp',... |
def func(x):
return x+1
def test_func():
assert func(3) == 4 | def func(x):
return x + 1
def test_func():
assert func(3) == 4 |
class Error(Exception):
pass
class ArgumentError(Error):
def __init__(self, message):
self.message = message
| class Error(Exception):
pass
class Argumenterror(Error):
def __init__(self, message):
self.message = message |
# -*- coding: utf-8 -*-
n1 = int(input())
n2 = int(input())
x = n1 + n2
print("X =", x) | n1 = int(input())
n2 = int(input())
x = n1 + n2
print('X =', x) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.