content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
"""
Copyright (C) 2020 Shandong University
This program is licensed under the GNU General Public License 3.0
(https://www.gnu.org/licenses/gpl-3.0.html).
Any derivative work obtained under this license must be licensed
under the GNU General Public License as published by the Free
Software F... | """
Copyright (C) 2020 Shandong University
This program is licensed under the GNU General Public License 3.0
(https://www.gnu.org/licenses/gpl-3.0.html).
Any derivative work obtained under this license must be licensed
under the GNU General Public License as published by the Free
Software F... |
__all__ = ["directory"]
def package_name() -> str:
return "timer-for-python"
def package_install_name() -> str:
return "timer-for-python"
| __all__ = ['directory']
def package_name() -> str:
return 'timer-for-python'
def package_install_name() -> str:
return 'timer-for-python' |
{
"targets": [
{
"target_name": "storm-replay",
"sources": [
"src/storm-replay.cpp",
"src/StormLib/src/adpcm/adpcm.cpp",
"src/StormLib/src/huffman/huff.cpp",
"src/StormLib/src/sparse/sparse.cpp",
"src/StormLib/src/FileStream.cpp",
"src/StormLib/src/SBas... | {'targets': [{'target_name': 'storm-replay', 'sources': ['src/storm-replay.cpp', 'src/StormLib/src/adpcm/adpcm.cpp', 'src/StormLib/src/huffman/huff.cpp', 'src/StormLib/src/sparse/sparse.cpp', 'src/StormLib/src/FileStream.cpp', 'src/StormLib/src/SBaseCommon.cpp', 'src/StormLib/src/SBaseDumpData.cpp', 'src/StormLib/src/S... |
#!/usr/bin/env python
tableData = [['apples', 'oranges', 'cherries', 'banana'],
['Alice', 'Bob', 'Carol', 'David'],
['dogs', 'cats', 'moose', 'goose']]
widthTable = [0] * len(tableData)
def getMaxWidth():
for i in range(len(tableData)):
maxLen = -1
for j in range(len(tabl... | table_data = [['apples', 'oranges', 'cherries', 'banana'], ['Alice', 'Bob', 'Carol', 'David'], ['dogs', 'cats', 'moose', 'goose']]
width_table = [0] * len(tableData)
def get_max_width():
for i in range(len(tableData)):
max_len = -1
for j in range(len(tableData[i])):
if len(tableData[i][... |
# coding: utf-8
n = int(input())
if n%2==1:
print(-1)
else:
print(' '.join([str(i+1) if i%2==1 else str(i-1) for i in range(1,n+1)]))
| n = int(input())
if n % 2 == 1:
print(-1)
else:
print(' '.join([str(i + 1) if i % 2 == 1 else str(i - 1) for i in range(1, n + 1)])) |
a, b = map(int,input().split())
while a > 0 and b > 0:
if a > b:
a, b = b, a
seq = ' '.join(str(c) for c in range(a, b+1))
print("{} Sum={}".format(seq, sum(range(a,b+1))))
a, b = map(int, input().split())
| (a, b) = map(int, input().split())
while a > 0 and b > 0:
if a > b:
(a, b) = (b, a)
seq = ' '.join((str(c) for c in range(a, b + 1)))
print('{} Sum={}'.format(seq, sum(range(a, b + 1))))
(a, b) = map(int, input().split()) |
# Day 0: Weighted Mean
# Enter your code here. Read input from STDIN. Print output to STDOUT
__author__ = "Sanju Sci"
__email__ = "sanju.sci9@gmail.com"
__copyright__ = "Copyright 2019"
class Day0(object):
def __init__(self):
pass
def mean(self, values: list, n) -> int:
result = 0
... | __author__ = 'Sanju Sci'
__email__ = 'sanju.sci9@gmail.com'
__copyright__ = 'Copyright 2019'
class Day0(object):
def __init__(self):
pass
def mean(self, values: list, n) -> int:
result = 0
for value in values:
result += value
result /= n
return result
... |
bedroom_choices = {
'1': 1,
'2': 2,
'3': 3,
'4': 4,
'5': 5,
'6': 6,
'7': 7,
'8': 8,
'9': 9,
'10': 10
}
price_choices = {
'10000': "kshs10,000",
'25000': "kshs25,000",
'50000': "kshs50,000",
'75000': "kshs75,000",
'100000': "kshs100,000",
'150000': "kshs15... | bedroom_choices = {'1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9, '10': 10}
price_choices = {'10000': 'kshs10,000', '25000': 'kshs25,000', '50000': 'kshs50,000', '75000': 'kshs75,000', '100000': 'kshs100,000', '150000': 'kshs150,000', '200000': 'kshs200,000', '300000': 'kshs300,000', '400000': ... |
"""
332. Reconstruct Itinerary
Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order. All of the tickets belong to a man who departs from JFK. Thus, the itinerary must begin with JFK.
Note:
If there are multiple valid itineraries, you sho... | """
332. Reconstruct Itinerary
Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order. All of the tickets belong to a man who departs from JFK. Thus, the itinerary must begin with JFK.
Note:
If there are multiple valid itineraries, you sho... |
emotions = {
0: 'angry',
1: 'calm',
2 : 'fearful',
3 : 'happy',
4 : 'sad'
} | emotions = {0: 'angry', 1: 'calm', 2: 'fearful', 3: 'happy', 4: 'sad'} |
currencies = {
"AUD": "Australian dollar",
"BGN": "Bulgarian lev",
"BRL": "Brazilian real",
"CAD": "Canadian dollar",
"CHF": "Swiss franc",
"CNY": "Chinese yuan",
"CZK": "Czech koruna",
"DKK": "Danish krone",
"EUR": "Euro",
"GBP": "British pound",
"HKD": "Hong Kong dollar",
... | currencies = {'AUD': 'Australian dollar', 'BGN': 'Bulgarian lev', 'BRL': 'Brazilian real', 'CAD': 'Canadian dollar', 'CHF': 'Swiss franc', 'CNY': 'Chinese yuan', 'CZK': 'Czech koruna', 'DKK': 'Danish krone', 'EUR': 'Euro', 'GBP': 'British pound', 'HKD': 'Hong Kong dollar', 'HRK': 'Croatian kuna', 'HUF': 'Hungarian fori... |
gsr_samples_number = 10 #Wait 10 samples of GSR to filter average
gsr_samples_delay = 0.02 #Time between samples equals to 20ms
gsr_channel = 1 #ADS1115 Channel for the GSR sensor
GAIN = 1 #ADS1115 Gain for values between +/- 4.096V
#-------------------------------GRSensor()----------------------------------------#
#... | gsr_samples_number = 10
gsr_samples_delay = 0.02
gsr_channel = 1
gain = 1
def gr_sensor():
gsr_sum = 0.0
for i in range(0, gsr_samples_number):
gsr_adc_read = Adafruit_ADS1x15.ADS1115()
gsr_value = gsr_adc_read.read_adc(gsr_channel, gain=GAIN) / 100
gsr_sum += gsr_value
time.sle... |
"""OpenGL debugging utility functions/classes
This package provides various debugging mechanisms
for use particularly with more involved OpenGL
projects.
""" | """OpenGL debugging utility functions/classes
This package provides various debugging mechanisms
for use particularly with more involved OpenGL
projects.
""" |
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
"""
- not stable
- input is mutable
- Intuition:
... | class Listnode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def merge_two_lists(self, l1: ListNode, l2: ListNode) -> ListNode:
"""
- not stable
- input is mutable
- Intuition:
2 pointers "battle" for the ne... |
#!/usr/bin/env python
# encoding: utf-8
"""Implements a container for parsed snippets."""
class SnippetDictionary(object):
"""See module docstring."""
def __init__(self):
self._snippets = []
self._cleared = {}
self._clear_priority = float("-inf")
def add_snippet(self, snippet):
... | """Implements a container for parsed snippets."""
class Snippetdictionary(object):
"""See module docstring."""
def __init__(self):
self._snippets = []
self._cleared = {}
self._clear_priority = float('-inf')
def add_snippet(self, snippet):
"""Add 'snippet' to this dictionar... |
#
class Direction (object):
'''
A list of direction types, as used in Busiest Travel Period
.. code-block:: python
from amadeus import Direction
client.travel.analytics.air_traffic.busiest_period.get(
cityCode = 'MAD',
period = '2017',
direction = Dire... | class Direction(object):
"""
A list of direction types, as used in Busiest Travel Period
.. code-block:: python
from amadeus import Direction
client.travel.analytics.air_traffic.busiest_period.get(
cityCode = 'MAD',
period = '2017',
direction = Directi... |
num1 = 15
num2 = 20
sum = num1 + num2
print("sum of {0} and {1} is {2}".format(num1,num2,sum)) | num1 = 15
num2 = 20
sum = num1 + num2
print('sum of {0} and {1} is {2}'.format(num1, num2, sum)) |
def exchange(a, i, j):
temp = a[i]
a[i] = a[j]
a[j] = temp
class MinPQ(object):
s = None
N = 0
compare = None
def __init__(self, compare=None):
self.s = [0] * 10
self.N = 0
if compare is None:
compare = lambda x, y: x - y
self.compare = compare
... | def exchange(a, i, j):
temp = a[i]
a[i] = a[j]
a[j] = temp
class Minpq(object):
s = None
n = 0
compare = None
def __init__(self, compare=None):
self.s = [0] * 10
self.N = 0
if compare is None:
compare = lambda x, y: x - y
self.compare = compare
... |
# Generated from 'Lists.h'
def FOUR_CHAR_CODE(x): return x
listNotifyNothing = FOUR_CHAR_CODE('nada')
listNotifyClick = FOUR_CHAR_CODE('clik')
listNotifyDoubleClick = FOUR_CHAR_CODE('dblc')
listNotifyPreClick = FOUR_CHAR_CODE('pclk')
lDrawingModeOffBit = 3
lDoVAutoscrollBit = 1
lDoHAutoscrollBit = 0
lDrawingModeOff =... | def four_char_code(x):
return x
list_notify_nothing = four_char_code('nada')
list_notify_click = four_char_code('clik')
list_notify_double_click = four_char_code('dblc')
list_notify_pre_click = four_char_code('pclk')
l_drawing_mode_off_bit = 3
l_do_v_autoscroll_bit = 1
l_do_h_autoscroll_bit = 0
l_drawing_mode_off =... |
"""
Module Docstring
Docstrings: http://www.python.org/dev/peps/pep-0257/
"""
__author__ = 'ButenkoMS <gtalk@butenkoms.space>'
MESSAGE_SIZE_LEN = 4
class ThereIsNoMessages(Exception):
pass
def get_message(data: bytes)->tuple:
'''
Retrieves message from bytes data
:param data: input data
:retu... | """
Module Docstring
Docstrings: http://www.python.org/dev/peps/pep-0257/
"""
__author__ = 'ButenkoMS <gtalk@butenkoms.space>'
message_size_len = 4
class Thereisnomessages(Exception):
pass
def get_message(data: bytes) -> tuple:
"""
Retrieves message from bytes data
:param data: input data
:return:... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# created by Lipson on 19-12-2.
# email to LipsonChan@yahoo.com
#
class Config(object):
DEBUG = True
TESTTING = False
DB_URI = 'mysql+pymysql://xxx:xxxx@127.0.0.1:3306/flask_test'
| class Config(object):
debug = True
testting = False
db_uri = 'mysql+pymysql://xxx:xxxx@127.0.0.1:3306/flask_test' |
my_kustomization = {
'commonLabels': {
'app': 'hello',
},
'resources': [
'deployment:my_deployment',
'service:my_service',
'configMap:my_config_map',
],
}
| my_kustomization = {'commonLabels': {'app': 'hello'}, 'resources': ['deployment:my_deployment', 'service:my_service', 'configMap:my_config_map']} |
# This macro uses the native genrule which is a lot shorter
def archive2(name, files, out):
native.genrule(
name = name,
outs = [out],
srcs = files,
cmd = "zip $(OUTS) $(SRCS)",
)
| def archive2(name, files, out):
native.genrule(name=name, outs=[out], srcs=files, cmd='zip $(OUTS) $(SRCS)') |
#!/usr/bin/env python3
#this program will write
#Thura Dwe He/Him/His
print("Thura Dwe He/Him/His") # print out Thura Dwe He/Him/His
| print('Thura Dwe He/Him/His') |
#
# This file contains the Python code from Program 14.17 of
# "Data Structures and Algorithms
# with Object-Oriented Design Patterns in Python"
# by Bruno R. Preiss.
#
# Copyright (c) 2003 by Bruno R. Preiss, P.Eng. All rights reserved.
#
# http://www.brpreiss.com/books/opus7/programs/pgm14_17.txt
#
def pi(trials):
... | def pi(trials):
hits = 0
for i in xrange(trials):
x = RandomNumberGenerator.next
y = RandomNumberGenerator.next
if x * x + y * y < 1.0:
hits += 1
return 4.0 * hits / trials |
###############################################################################
# This module exposes LITMUS APIs
#
__all__ = ["config", "litmus_mixing"]
name = "litmus"
| __all__ = ['config', 'litmus_mixing']
name = 'litmus' |
'''
167. Two Sum II - Input array is sorted
Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.
The function twoSum should return indices of the two numbers such that they add up to the target, where index1 must be less than index2.... | """
167. Two Sum II - Input array is sorted
Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.
The function twoSum should return indices of the two numbers such that they add up to the target, where index1 must be less than index2.... |
input = """
1 2 0 0
1 3 0 0
1 4 0 0
1 5 0 0
1 6 0 0
1 7 0 0
1 8 0 0
1 9 0 0
1 10 0 0
1 11 0 0
1 12 0 0
1 13 0 0
1 14 0 0
1 15 0 0
1 16 0 0
1 17 0 0
1 18 0 0
1 19 0 0
1 20 0 0
1 21 0 0
1 22 0 0
1 23 0 0
1 24 0 0
1 25 0 0
1 26 0 0
1 27 0 0
1 28 0 0
1 29 0 0
1 30 0 0
1 31 0 0
1 32 0 0
1 33 0 0
1 34 0 0
1 35 0 0
1 36 0 0
1... | input = '\n1 2 0 0\n1 3 0 0\n1 4 0 0\n1 5 0 0\n1 6 0 0\n1 7 0 0\n1 8 0 0\n1 9 0 0\n1 10 0 0\n1 11 0 0\n1 12 0 0\n1 13 0 0\n1 14 0 0\n1 15 0 0\n1 16 0 0\n1 17 0 0\n1 18 0 0\n1 19 0 0\n1 20 0 0\n1 21 0 0\n1 22 0 0\n1 23 0 0\n1 24 0 0\n1 25 0 0\n1 26 0 0\n1 27 0 0\n1 28 0 0\n1 29 0 0\n1 30 0 0\n1 31 0 0\n1 32 0 0\n1 33 0 ... |
class ArgumentTypeError(Exception):
"""Exception raised for errant argument types."""
def __init__(self, value):
self.value = value
self.message = "Provided argument(s) inavlid. Expected: main.py <int> <float>"
super().__init__(self.message)
class IterationRangeError(Exception):
"""... | class Argumenttypeerror(Exception):
"""Exception raised for errant argument types."""
def __init__(self, value):
self.value = value
self.message = 'Provided argument(s) inavlid. Expected: main.py <int> <float>'
super().__init__(self.message)
class Iterationrangeerror(Exception):
""... |
num = int(input())
partner_one = input().split()
partner_two = input().split()
if len(partner_one) != len(set(partner_one)) or len(partner_two) != len(set(partner_two)):
exit('bad')
d = {partner_one[q]:partner_two[q] for q in range(num)}
for q in range(num):
if d[partner_two[q]] != partner_one[q]... | num = int(input())
partner_one = input().split()
partner_two = input().split()
if len(partner_one) != len(set(partner_one)) or len(partner_two) != len(set(partner_two)):
exit('bad')
d = {partner_one[q]: partner_two[q] for q in range(num)}
for q in range(num):
if d[partner_two[q]] != partner_one[q]:
exit... |
# coding: utf-8
a = 2
b = 3
c = 2.3
d = a + b
print(d) # 5
print(a+b) # 5
print(a+c) # 4.3
print (b/a) # 1.5
print(b//a) # ! 1 floor division
print (a*c) # 4.6
print (a ** b ) # ! 8 power
print (17 % 3) # Modulus 17 = 3*5+2
| a = 2
b = 3
c = 2.3
d = a + b
print(d)
print(a + b)
print(a + c)
print(b / a)
print(b // a)
print(a * c)
print(a ** b)
print(17 % 3) |
"""
String literals used within CanvasSync
"""
# general
DISPLAY_NAME = u'display_name'
ID = u'id'
NAME = u'name'
TITLE = u'title'
UPDATED_AT = u'updated_at'
# history
HISTORY_ID = u'id'
HISTORY_MODIFIED_AT = u'modified_at'
HISTORY_PATH = u'path'
HISTORY_TYPE = u'type'
# special folder names
FOLDER_ASSIGNMENTS = u"A... | """
String literals used within CanvasSync
"""
display_name = u'display_name'
id = u'id'
name = u'name'
title = u'title'
updated_at = u'updated_at'
history_id = u'id'
history_modified_at = u'modified_at'
history_path = u'path'
history_type = u'type'
folder_assignments = u'Assignments'
folder_others = u'Other Files'
ent... |
def insertionSort(A):
valueIndex = 0
value = 0
for i in range(1, len(A)):
valueIndex = i
value = A[i]
while valueIndex > 0 and A[valueIndex - 1] > value:
A[valueIndex] = A[valueIndex - 1];
valueIndex = valueIndex - 1;
A[valueIndex] = value
return ... | def insertion_sort(A):
value_index = 0
value = 0
for i in range(1, len(A)):
value_index = i
value = A[i]
while valueIndex > 0 and A[valueIndex - 1] > value:
A[valueIndex] = A[valueIndex - 1]
value_index = valueIndex - 1
A[valueIndex] = value
return... |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2016+ Buro Petr van Blokland + Claudia Mens
# www.pagebot.io
#
# P A G E B O T
#
# Licensed under MIT conditions
#
# Supporting DrawBot, www.drawbot.com
# ... | class Pagebotosxerror(TypeError):
pass
class Pagebotosxfileformaterror(Exception):
def __init__(self, msg):
super().__init__()
self.msg = msg
def __str__(self):
return '! PageBot OSX file format error: %s' % self.msg |
"""Hackerrank Problem: https://www.hackerrank.com/challenges/ginorts/problem
You are given a string S.
S contains alphanumeric characters only.
Your task is to sort the string S in the following manner:
- All sorted lowercase letters are ahead of uppercase letters.
- All sorted uppercase letters are ahead of digits.... | """Hackerrank Problem: https://www.hackerrank.com/challenges/ginorts/problem
You are given a string S.
S contains alphanumeric characters only.
Your task is to sort the string S in the following manner:
- All sorted lowercase letters are ahead of uppercase letters.
- All sorted uppercase letters are ahead of digits.... |
"""Provides a generic and slightly-smarter minimal cover algorithm."""
def minimal_cover(
elements_set, subsets, max_subsets=None, heuristic="default", selected=(), depth=0
):
"""Generic method to find minimal subset covers.
Parameters
----------
elements_set
The set of all elements to cove... | """Provides a generic and slightly-smarter minimal cover algorithm."""
def minimal_cover(elements_set, subsets, max_subsets=None, heuristic='default', selected=(), depth=0):
"""Generic method to find minimal subset covers.
Parameters
----------
elements_set
The set of all elements to cover.
... |
#!/usr/bin/env python
#
# This code is part of the interface classifier tool distribution
# and governed by its license. Please see the LICENSE file that should
# have been included as part of this package.
#
"""
Interface classification methods developed by the Bonvin Lab.
"""
| """
Interface classification methods developed by the Bonvin Lab.
""" |
__version__ = "1.1.17"
__version_info__ = VersionInfo._from_version_string(__version__)
__title__ = "django-materializecss-form"
__description__ = "A simple Django form template tag to work with Materializecss"
__url__ = "https://github.com/kalwalkden/django-materializecss-form"
__uri__ = "https://github.com/kalwalk... | __version__ = '1.1.17'
__version_info__ = VersionInfo._from_version_string(__version__)
__title__ = 'django-materializecss-form'
__description__ = 'A simple Django form template tag to work with Materializecss'
__url__ = 'https://github.com/kalwalkden/django-materializecss-form'
__uri__ = 'https://github.com/kalwalkden... |
name = input('Please enter your name >')
print('type(name):' , type(name))
print('your name is ' + name.upper())
| name = input('Please enter your name >')
print('type(name):', type(name))
print('your name is ' + name.upper()) |
class iron_ore_mining():
SCRIPT_NAME = "IRON ORE MINING SCRIPT 0.2v";
BUTTON = [
];
CHATBOX = [
];
FUNCTION = [
];
INTERFACE = [
];
ITEM = [
".\\resources\\item\\inventor\\iron_ore.png",
".\\resources\\item\\inventor\\uncut_sapphire... | class Iron_Ore_Mining:
script_name = 'IRON ORE MINING SCRIPT 0.2v'
button = []
chatbox = []
function = []
interface = []
item = ['.\\resources\\item\\inventor\\iron_ore.png', '.\\resources\\item\\inventor\\uncut_sapphire.png', '.\\resources\\item\\inventor\\uncut_emerald.png']
npc = []
m... |
n = int(input())
a = list(map(int, input().split()))
stack = []
stack.extend([(each,) for each in range(len(a))])
diff = {} # {node: value}
while stack:
node = stack.pop()
if len(node) > 1:
value = abs(a[node[-2]]-a[node[-1]])
diff.update({node: diff.get(node[:-1], 0) + value})
for index ... | n = int(input())
a = list(map(int, input().split()))
stack = []
stack.extend([(each,) for each in range(len(a))])
diff = {}
while stack:
node = stack.pop()
if len(node) > 1:
value = abs(a[node[-2]] - a[node[-1]])
diff.update({node: diff.get(node[:-1], 0) + value})
for index in range(len(a)):... |
def binary_search(arr, elem):
lo = 0
hi = len(arr) - 1
res = -1
while lo <= hi:
mid = (lo + hi) // 2
if arr[mid] == elem:
res = mid
return res
if arr[mid] > elem:
hi = mid - 1
else:
lo = mid + 1
return res
arr = [1, ... | def binary_search(arr, elem):
lo = 0
hi = len(arr) - 1
res = -1
while lo <= hi:
mid = (lo + hi) // 2
if arr[mid] == elem:
res = mid
return res
if arr[mid] > elem:
hi = mid - 1
else:
lo = mid + 1
return res
arr = [1, 2, 3... |
# The Solution here assumes that all elements in the input list are distinct
def rotated_array_search(input_list, number):
"""
Find the index by searching in a rotated sorted array
Args:
input_list(array), number(int): Input array to search and the target
Returns:
int: Index or -1... | def rotated_array_search(input_list, number):
"""
Find the index by searching in a rotated sorted array
Args:
input_list(array), number(int): Input array to search and the target
Returns:
int: Index or -1
"""
return recursive_search_func(input_list, number, 0, len(input_list) - 1)
... |
class WordFrequencies(object):
def __init__(self, ddi_frequencies, random_articles_frequencies):
self.ddi_frequencies = ddi_frequencies
self.random_articles_frequencies = random_articles_frequencies
| class Wordfrequencies(object):
def __init__(self, ddi_frequencies, random_articles_frequencies):
self.ddi_frequencies = ddi_frequencies
self.random_articles_frequencies = random_articles_frequencies |
a, b = map(int, input().split())
result = 0
if a > b:
result += a
a -= 1
else:
result += b
b -= 1
if a > b:
result += a
else:
result += b
print(result)
| (a, b) = map(int, input().split())
result = 0
if a > b:
result += a
a -= 1
else:
result += b
b -= 1
if a > b:
result += a
else:
result += b
print(result) |
# these functions are called in main.py
print("This is a calculator powered by TMath Module by Trevlin Morris")
print("Avaliable commands are:\nDiv\nMult\nAdd\nSub\nRound\nCompare")
def Div():
A = float(input())
B = float(input())
C = A / B
print(C)
def Mult():
A = float(input())
B = float(input... | print('This is a calculator powered by TMath Module by Trevlin Morris')
print('Avaliable commands are:\nDiv\nMult\nAdd\nSub\nRound\nCompare')
def div():
a = float(input())
b = float(input())
c = A / B
print(C)
def mult():
a = float(input())
b = float(input())
c = A * B
print(C)
def ad... |
# setup.py needs to import this without worrying about required packages being
# installed. So if you add imports here, you may need to do something like:
# https://github.com/mitsuhiko/click/blob/da080dd2de1a116fc5789ffdc1ec6ffb864f2044/setup.py#L1-L11
__version__ = '0.8.0'
| __version__ = '0.8.0' |
# -*- coding: utf-8 -*-
def factorial(number):
if number == 0:
return 1
return number * factorial(number - 1)
if __name__ == '__main__':
numero = int(input('\nFactorial de : '))
result = factorial(numero)
print(result)
| def factorial(number):
if number == 0:
return 1
return number * factorial(number - 1)
if __name__ == '__main__':
numero = int(input('\nFactorial de : '))
result = factorial(numero)
print(result) |
# Example - Rewrite star gazing show
# print menu function
def print_menu():
print("------------------------------------------------")
print(" Welcome to Science Park! ")
print()
print("Admission Charges: Adult $35, Child $20 ")
print("Stargazing Show: $10/person ... | def print_menu():
print('------------------------------------------------')
print(' Welcome to Science Park! ')
print()
print('Admission Charges: Adult $35, Child $20 ')
print('Stargazing Show: $10/person ')
print()
print('Free Science Park H... |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 25 14:33:06 2017
@author: James Jiang
"""
with open('Data.txt') as f:
for line in f:
string = line
all_instructions = string.split(', ')
x_position = 0
y_position = 0
direction = 'north'
def turn_left(string):
if string == 'north':
retu... | """
Created on Mon Dec 25 14:33:06 2017
@author: James Jiang
"""
with open('Data.txt') as f:
for line in f:
string = line
all_instructions = string.split(', ')
x_position = 0
y_position = 0
direction = 'north'
def turn_left(string):
if string == 'north':
return 'west'
if string == 'east':
... |
def base_tech_tree():
return Tech('Agriculture', 'agriculture', 0, 1.0,
[
Tech('Stone Working', 'material', 400, 1.1,
[
Tech('Copper', 'material', 1600, 1.5,
[
... | def base_tech_tree():
return tech('Agriculture', 'agriculture', 0, 1.0, [tech('Stone Working', 'material', 400, 1.1, [tech('Copper', 'material', 1600, 1.5, [tech('Bronze', 'material', 3200, 2.0, [tech('Iron', 'material', 6400, 2.5, [tech('Steel', 'material', 12800, 3.0, [tech('Refined Steel', 'material', 12800 * (3... |
class Solution:
"""
@param A: an integer ratated sorted array and duplicates are allowed
@param target: An integer
@return: a boolean
"""
def search(self, A, target):
# write your code here
if A is None or len(A) == 0:
return False
start, end = 0, len(A) - 1
... | class Solution:
"""
@param A: an integer ratated sorted array and duplicates are allowed
@param target: An integer
@return: a boolean
"""
def search(self, A, target):
if A is None or len(A) == 0:
return False
(start, end) = (0, len(A) - 1)
while start + 1 < e... |
# we identified: Phrag, MrFlesh, thetimeisnow, MyaloMark, mexicodoug
author_list = ["MrFlesh","oddmanout","Phrag","NoMoreNicksLeft","permaculture",
"aletoledo","thetimeisnow","MyaloMark","mexicodoug","rainman_104","mutatron",
"otakucode","cuteman","donh","nixonrichard","garyp714","Stormflux","seeker135",
"dirtymoney","... | author_list = ['MrFlesh', 'oddmanout', 'Phrag', 'NoMoreNicksLeft', 'permaculture', 'aletoledo', 'thetimeisnow', 'MyaloMark', 'mexicodoug', 'rainman_104', 'mutatron', 'otakucode', 'cuteman', 'donh', 'nixonrichard', 'garyp714', 'Stormflux', 'seeker135', 'dirtymoney', 'folderol']
sample_num = 5
author_counts = {i: [] for ... |
# python3
def anticlockwise_area(x1, y1, x2, y2, x3, y3):
return (x2-x1)*(y3-y1) - (x3-x1)*(y2-y1)
def solve(Ax, Ay, Bx, By, P):
n = len(P)
for i in range(n):
px, py = P[i]
area = anticlockwise_area(Ax, Ay, Bx, By, px, py)
if area > 0:
print("LEFT")
elif area < ... | def anticlockwise_area(x1, y1, x2, y2, x3, y3):
return (x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1)
def solve(Ax, Ay, Bx, By, P):
n = len(P)
for i in range(n):
(px, py) = P[i]
area = anticlockwise_area(Ax, Ay, Bx, By, px, py)
if area > 0:
print('LEFT')
elif area... |
def est_paire(n):
if n%2 == 0:
print(str(n)+" est pair")
else:
print(str(n)+" n'est pas pair")
a=[2,4,3,7]
for i in range(4):
est_paire(a[i]) | def est_paire(n):
if n % 2 == 0:
print(str(n) + ' est pair')
else:
print(str(n) + " n'est pas pair")
a = [2, 4, 3, 7]
for i in range(4):
est_paire(a[i]) |
"""This test the homepage"""
def test_request_main_menu_links(client):
"""This makes the index page"""
response = client.get("/")
assert response.status_code == 200
assert b'href="/about"' in response.data
assert b'href="/welcome"' in response.data
assert b'href="/login"' in response.data
a... | """This test the homepage"""
def test_request_main_menu_links(client):
"""This makes the index page"""
response = client.get('/')
assert response.status_code == 200
assert b'href="/about"' in response.data
assert b'href="/welcome"' in response.data
assert b'href="/login"' in response.data
a... |
modulename = "RocketLeague"
sd_structure = {
"activated": True
}
| modulename = 'RocketLeague'
sd_structure = {'activated': True} |
A, B = map(int, input().split())
if 1 <= A <= 9 and 1 <= B <= 9:
print(A * B)
else:
print(-1)
| (a, b) = map(int, input().split())
if 1 <= A <= 9 and 1 <= B <= 9:
print(A * B)
else:
print(-1) |
def last_neuron(self):
labels = list(set(self.y.flatten('F')))
try:
last_neuron = self.y.shape[1]
except IndexError:
if len(labels) == 2 and max(labels) == 1:
last_neuron = 1
elif len(labels) == 2 and max(labels) > 1:
last_neuron = 3
elif len(labels)... | def last_neuron(self):
labels = list(set(self.y.flatten('F')))
try:
last_neuron = self.y.shape[1]
except IndexError:
if len(labels) == 2 and max(labels) == 1:
last_neuron = 1
elif len(labels) == 2 and max(labels) > 1:
last_neuron = 3
elif len(labels) >... |
#!/usr/bin/env python
# Define a filename.
filename = "input.txt"
def count_depth_changes(depths):
depth_counts = {}
depth_counts["increased"] = 0
depth_counts["decreased"] = 0
depth_counts["no_change"] = 0
for index, depth in enumerate(depths):
if index == 0:
continue
... | filename = 'input.txt'
def count_depth_changes(depths):
depth_counts = {}
depth_counts['increased'] = 0
depth_counts['decreased'] = 0
depth_counts['no_change'] = 0
for (index, depth) in enumerate(depths):
if index == 0:
continue
change = int(depth) - int(depths[index - 1... |
if __name__ == '__main__':
with open('chapter.txt') as f:
chapter = f.readlines()
chapter_set = set(chapter)
with open('byterun/pyvm2.py') as g:
source = g.readlines()
source_set = set(source)
zero_missing = True
for line in source:
if line and line not in chapter_set:
if zero_missing:
print("Mi... | if __name__ == '__main__':
with open('chapter.txt') as f:
chapter = f.readlines()
chapter_set = set(chapter)
with open('byterun/pyvm2.py') as g:
source = g.readlines()
source_set = set(source)
zero_missing = True
for line in source:
if line and line not in chapter... |
class NotFound(Exception):
pass
class PlayerNotFound(NotFound):
""" Raised When Player Is Not Found"""
class GamePassNotFound(NotFound):
""" Raised When GamePass Is Not Found"""
class GroupNotFound(NotFound):
""" Raised When Group Is Not Found"""
class BundleNotFound(NotFound):
... | class Notfound(Exception):
pass
class Playernotfound(NotFound):
""" Raised When Player Is Not Found"""
class Gamepassnotfound(NotFound):
""" Raised When GamePass Is Not Found"""
class Groupnotfound(NotFound):
""" Raised When Group Is Not Found"""
class Bundlenotfound(NotFound):
""" Raised When B... |
"""
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their
nodes contain a single digit. Add the two numbers and return it as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 itself.
Ex:
... | """
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their
nodes contain a single digit. Add the two numbers and return it as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 itself.
Ex:
... |
# -*- coding: utf-8 -*-
class MissingField(Exception):
TEMPLATE = "[!] WARNING: mandatory field %s missing from capture"
def __init__(self, value):
super().__init__(self.TEMPLATE % value)
class XmlWrapper(object):
def __init__(self, layer):
self.layer = layer
@property
def ty... | class Missingfield(Exception):
template = '[!] WARNING: mandatory field %s missing from capture'
def __init__(self, value):
super().__init__(self.TEMPLATE % value)
class Xmlwrapper(object):
def __init__(self, layer):
self.layer = layer
@property
def type(self):
return sel... |
#!/usr/bin/env python
nodes = {}
with open('file2.txt', 'r') as file:
for line in file:
parent = line.split(')')[0].strip()
children = []
try:
children = line.split('->')[1].strip().split(', ')
nodes[parent] = children
except:
nodes[parent] = chil... | nodes = {}
with open('file2.txt', 'r') as file:
for line in file:
parent = line.split(')')[0].strip()
children = []
try:
children = line.split('->')[1].strip().split(', ')
nodes[parent] = children
except:
nodes[parent] = children
node_weights = {}
... |
a = []
n = int(input())
for i in range(n):
temp = input()
if temp not in a:
a.append(temp)
print(len(a)) | a = []
n = int(input())
for i in range(n):
temp = input()
if temp not in a:
a.append(temp)
print(len(a)) |
class Store:
def __init__(self):
self.init()
def add(self, target):
self.targets.append(target)
self.look_up_by_output[target.output] = target
def init(self):
self.targets = []
self.look_up_by_output = {}
self.intermediate_targets = []
STORE = Store()
| class Store:
def __init__(self):
self.init()
def add(self, target):
self.targets.append(target)
self.look_up_by_output[target.output] = target
def init(self):
self.targets = []
self.look_up_by_output = {}
self.intermediate_targets = []
store = store() |
wort = deltat*UA/M/Cp
glycol = deltat*UA/mj/cpj
A = np.array([[1 - wort, wort],
[glycol,1 - glycol]]) | wort = deltat * UA / M / Cp
glycol = deltat * UA / mj / cpj
a = np.array([[1 - wort, wort], [glycol, 1 - glycol]]) |
def result(num):
if num % 3 == 0 and num % 5 == 0:
return 'FizzBuzz'
elif num % 3 == 0:
return 'Fizz'
elif num % 5 == 0:
return 'Buzz'
else:
return num
for n in range(1,100):
print(result(n))
| def result(num):
if num % 3 == 0 and num % 5 == 0:
return 'FizzBuzz'
elif num % 3 == 0:
return 'Fizz'
elif num % 5 == 0:
return 'Buzz'
else:
return num
for n in range(1, 100):
print(result(n)) |
population = 100
# car
car_sizes = [40, 80]
car_color = (50, 50, 0)
car_frame = 6 | population = 100
car_sizes = [40, 80]
car_color = (50, 50, 0)
car_frame = 6 |
device = ['RTR02']
mode = 'jsnapy_pre'
playbook_summary = 'Jsnapy pre'
custom_def = False
jsnapy_test = ['test_rsvp','test_bgp'] | device = ['RTR02']
mode = 'jsnapy_pre'
playbook_summary = 'Jsnapy pre'
custom_def = False
jsnapy_test = ['test_rsvp', 'test_bgp'] |
__version__ = '0.0.1'
# Version synonym
VERSION = __version__
| __version__ = '0.0.1'
version = __version__ |
def extractSilentfishHomeBlog(item):
'''
Parser for 'silentfish.home.blog'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('RMS', 'Reincarnation of Master Su', ... | def extract_silentfish_home_blog(item):
"""
Parser for 'silentfish.home.blog'
"""
(vol, chp, frag, postfix) = extract_vol_chapter_fragment_postfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
tagmap = [('RMS', 'Reincarnation of Master Su', 'translated')... |
x = 10
print(x == 2) # prints out false since 10 is not equal to 2
print(x == 3) # prints out False since 10 is not equal to 3
print(x < 3) # prints out false since 10 is not less than 3
print(x>3) # prints out true since 10 is greater than 3
| x = 10
print(x == 2)
print(x == 3)
print(x < 3)
print(x > 3) |
List1 = [[0,1,2,3,4,5,6,7,8,9],[0,1,2,3,4,5,6,7,8,9]]
print (List1[1],[1])
List2 = [1,1]
print (List1[List2])
# Does not work | list1 = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]
print(List1[1], [1])
list2 = [1, 1]
print(List1[List2]) |
# Author: btjanaka (Bryon Tjanaka)
# Problem: (UVa) 787
while True:
try:
line = input()
except:
break
nums = list(map(int, line.split()[:-1]))
mx = nums[0]
for i in range(len(nums)):
for j in range(i, len(nums)):
prod = 1
for k in range(i, j + 1):
... | while True:
try:
line = input()
except:
break
nums = list(map(int, line.split()[:-1]))
mx = nums[0]
for i in range(len(nums)):
for j in range(i, len(nums)):
prod = 1
for k in range(i, j + 1):
prod *= nums[k]
if prod > mx:
... |
print ('-=-' * 10)
print (' \033[1mWelcome to text analyzer\033[m')
print ('-=-' * 10)
phrase = str(input('\033[1;37mType a phrase\033[m: ' )).strip()
print ('\033[1;37mThe phrase that was written was\033[m \033[1;32m{}\033[m'.format(phrase))
print ('-=-' * 13)
print ('\033[1mThe number of words are\033[m \033[1;32m... | print('-=-' * 10)
print(' \x1b[1mWelcome to text analyzer\x1b[m')
print('-=-' * 10)
phrase = str(input('\x1b[1;37mType a phrase\x1b[m: ')).strip()
print('\x1b[1;37mThe phrase that was written was\x1b[m \x1b[1;32m{}\x1b[m'.format(phrase))
print('-=-' * 13)
print('\x1b[1mThe number of words are\x1b[m \x1b[1;32m \x1b[1;... |
class box:
def __init__(self,lst):
self.height = lst[0]
self.width = lst[1]
self.breadth = lst[2]
print("Creating a Box!")
sum1 = self.height * self.width * self.breadth
print(f"Volume of the box is {sum1} cubic units.")
print("Box 1")
b1 = box([10,10,10])
... | class Box:
def __init__(self, lst):
self.height = lst[0]
self.width = lst[1]
self.breadth = lst[2]
print('Creating a Box!')
sum1 = self.height * self.width * self.breadth
print(f'Volume of the box is {sum1} cubic units.')
print('Box 1')
b1 = box([10, 10, 10])
print('... |
"""Global mapping of repository:tag to image digests used by the container_pull macro
This mapping is intended to protect against the container_pull upstream API deficiency
where when a tag AND a digest are specified, the tag is ignored. It is easy to trip
over updating the tag and forgetting to updatee the digest and... | """Global mapping of repository:tag to image digests used by the container_pull macro
This mapping is intended to protect against the container_pull upstream API deficiency
where when a tag AND a digest are specified, the tag is ignored. It is easy to trip
over updating the tag and forgetting to updatee the digest and... |
#Input a variable x and check for Negative, Positive or Zero Number
x = int(input("Enter a number: "))
if x < 0:
print("Negative")
elif x == 0:
print("Zero")
elif x > 0:
print("Positive")
| x = int(input('Enter a number: '))
if x < 0:
print('Negative')
elif x == 0:
print('Zero')
elif x > 0:
print('Positive') |
# part of requirement 1
# Asks for a file name and tries to find it and adds a file extention to the
# input name. If it is not found, tell and try again untill it is found
def enterFile():
# initialisation
notFound = True
# while the file isn't found, keep asking for a filename
while notFound:
... | def enter_file():
not_found = True
while notFound:
file_name = input('Enter the filename here, without the suffux(".txt"): ')
file_name += str('.txt')
try:
open(fileName)
except FileNotFoundError:
print('')
print('File not found, please try aga... |
expected_output = {
"instance_id": {
4100: {"lisp": 0},
8188: {
"lisp": 0,
"site_name": {
"site_uci": {
"any-mac": {
"last_register": "never",
"up": "no",
"who_last_reg... | expected_output = {'instance_id': {4100: {'lisp': 0}, 8188: {'lisp': 0, 'site_name': {'site_uci': {'any-mac': {'last_register': 'never', 'up': 'no', 'who_last_registered': '--', 'inst_id': 8188}, '1416.9dff.e928/48': {'last_register': '2w1d', 'up': 'yes#', 'who_last_registered': '10.8.130.4:61275', 'inst_id': 8188}, '1... |
load(
"@io_bazel_rules_dotnet//dotnet/private:context.bzl",
"dotnet_context",
)
load(
"@io_bazel_rules_dotnet//dotnet/private:providers.bzl",
"DotnetLibrary",
"DotnetResource",
)
load(
"@io_bazel_rules_dotnet//dotnet/private:rules/runfiles.bzl",
"CopyRunfiles",
)
def _unit_test(ctx):
do... | load('@io_bazel_rules_dotnet//dotnet/private:context.bzl', 'dotnet_context')
load('@io_bazel_rules_dotnet//dotnet/private:providers.bzl', 'DotnetLibrary', 'DotnetResource')
load('@io_bazel_rules_dotnet//dotnet/private:rules/runfiles.bzl', 'CopyRunfiles')
def _unit_test(ctx):
dotnet = dotnet_context(ctx)
name =... |
# -*- python -*-
load(
"@local_config_cuda//cuda:build_defs.bzl",
"cuda_default_copts",
"if_cuda",
"if_cuda_is_configured",
)
def register_extension_info(**kwargs):
pass
def _make_search_paths(prefix, levels_to_root):
return ",".join(
[
"-rpath,%s/%s" % (prefix, "/".join(... | load('@local_config_cuda//cuda:build_defs.bzl', 'cuda_default_copts', 'if_cuda', 'if_cuda_is_configured')
def register_extension_info(**kwargs):
pass
def _make_search_paths(prefix, levels_to_root):
return ','.join(['-rpath,%s/%s' % (prefix, '/'.join(['..'] * search_level)) for search_level in range(levels_to_... |
WORD = 0
CLASSIFICATION = 1
LINE = 2
MARK = '$'
TOP = -1
SUBTOP = -2
class Syntactic:
def __init__(self, lexical_input=['token', 'classification', 1]):
self.lexical_input = lexical_input[::-1]
self.success = False
self._last_read = []
self._symbols_table = []
self._symbol_a... | word = 0
classification = 1
line = 2
mark = '$'
top = -1
subtop = -2
class Syntactic:
def __init__(self, lexical_input=['token', 'classification', 1]):
self.lexical_input = lexical_input[::-1]
self.success = False
self._last_read = []
self._symbols_table = []
self._symbol_a... |
"""
Polimorfizm.
"""
class Zwierz:
def __init__(self, nazwa, dzwiek):
self.nazwa = nazwa
self.dzwiek = dzwiek
def __repr__(self):
return "nazwa : %s dzwiek : %s" % (self.nazwa, self.dzwiek)
def get_dzwiek(self):
return self.dzwiek
def get_typ(self):
print("Z... | """
Polimorfizm.
"""
class Zwierz:
def __init__(self, nazwa, dzwiek):
self.nazwa = nazwa
self.dzwiek = dzwiek
def __repr__(self):
return 'nazwa : %s dzwiek : %s' % (self.nazwa, self.dzwiek)
def get_dzwiek(self):
return self.dzwiek
def get_typ(self):
print('Z... |
load("@bazel_skylib//lib:paths.bzl", "paths")
load(
"//ruby/private:providers.bzl",
"RubyLibrary",
)
def _transitive_srcs(deps):
return struct(
srcs = [
d[RubyLibrary].transitive_ruby_srcs for d in deps if RubyLibrary in d
],
incpaths = [
d[RubyLibrary].ruby_incpaths for... | load('@bazel_skylib//lib:paths.bzl', 'paths')
load('//ruby/private:providers.bzl', 'RubyLibrary')
def _transitive_srcs(deps):
return struct(srcs=[d[RubyLibrary].transitive_ruby_srcs for d in deps if RubyLibrary in d], incpaths=[d[RubyLibrary].ruby_incpaths for d in deps if RubyLibrary in d], rubyopt=[d[RubyLibrary... |
'''
The MIT License (MIT)
Copyright (c) 2016 WavyCloud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, p... | """
The MIT License (MIT)
Copyright (c) 2016 WavyCloud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, p... |
# 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... | """
Managing rds
"""
def list_rds_instances(conn):
for i in conn.rds.os_instances():
print(i)
def create_instance(conn):
instance_dict = {'name': 'trove-instance-rep2', 'datastore': {'type': 'MySQL', 'version': '5.6.30'}, 'flavorRef': 'bf07a6d4-844a-4023-a776-fc5c5fb71fb4', 'volume': {'type': 'COMMON... |
n = int(input("Enter a number: "))
statement = "is a prime number."
for x in range(2,n):
if n%x == 0:
statement = 'is not a prime number.'
print(n,statement)
| n = int(input('Enter a number: '))
statement = 'is a prime number.'
for x in range(2, n):
if n % x == 0:
statement = 'is not a prime number.'
print(n, statement) |
def main():
a, b = map(int, input().split())
if 1 <= a and a <= 9 and 1 <= b and b <= 9:
print(a * b)
else:
print(-1)
if __name__ == '__main__':
main()
| def main():
(a, b) = map(int, input().split())
if 1 <= a and a <= 9 and (1 <= b) and (b <= 9):
print(a * b)
else:
print(-1)
if __name__ == '__main__':
main() |
#
# PySNMP MIB module Nortel-Magellan-Passport-DataIsdnMIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-DataIsdnMIB
# Produced by pysmi-0.3.4 at Wed May 1 14:26:48 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# U... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, single_value_constraint, constraints_intersection, constraints_union) ... |
# Similar to test1, but this time B2 attempt to define base1_1. Since base1_1
# is already defined in B1 and F derives from both B1 and B2, this results
# in an error. However, when building for B2 instead of F, defining base1_1
# should be OK.
expected_results = {
"f": {
"desc": "attempt to redefine param... | expected_results = {'f': {'desc': 'attempt to redefine parameter in target inheritance tree', 'exception_msg': "Parameter name 'base1_1' defined in both 'target:b2' and 'target:b1'"}, 'b2': {'desc': 'it should be OK to define parameters with the same name in non-related targets', 'target.base2_1': 'v_base2_1_b2', 'targ... |
#!/usr/bin/env python
# Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
""" This module defines constants used for the sumo-carla co-simulation. """
... | """ This module defines constants used for the sumo-carla co-simulation. """
invalid_actor_id = -1
spawn_offset_z = 5.0 |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: MNN
class STORAGE_TYPE(object):
BUFFER = 0
UNIFORM = 1
IMAGE = 2
| class Storage_Type(object):
buffer = 0
uniform = 1
image = 2 |
def drop_duplicates_in_input(untokenized_dataset):
indices_to_keep = []
id_to_idx = {}
outputs = []
for i, (id_, output) in enumerate(zip(untokenized_dataset["id"], untokenized_dataset["output"])):
if id_ in id_to_idx:
outputs[id_to_idx[id_]].append(output)
continue
... | def drop_duplicates_in_input(untokenized_dataset):
indices_to_keep = []
id_to_idx = {}
outputs = []
for (i, (id_, output)) in enumerate(zip(untokenized_dataset['id'], untokenized_dataset['output'])):
if id_ in id_to_idx:
outputs[id_to_idx[id_]].append(output)
continue
... |
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
# class Solution:
# def preorderTraversal(self, root: TreeNode) -> List[int]:
# return [root.val] + self.preorderTraversal(root.left) + self.preorderTraver... | class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def preorder_traversal(self, root: TreeNode) -> list:
ans = []
self.helper(root, ans)
return ans
def helper(self, root: TreeNode, ans: list):
if ... |
class Solution:
def findLucky(self, arr: List[int]) -> int:
"""Hash table.
Running time: O(n) where n is the length of arr.
"""
d = {}
for a in arr:
d[a] = d.get(a, 0) + 1
res = -1
m = 0
for k, v in d.items():
if k == v and k >... | class Solution:
def find_lucky(self, arr: List[int]) -> int:
"""Hash table.
Running time: O(n) where n is the length of arr.
"""
d = {}
for a in arr:
d[a] = d.get(a, 0) + 1
res = -1
m = 0
for (k, v) in d.items():
if k == v and... |
# There is only data available for one day.
def run_SC(args):
raise Exception()
if __name__ == '__main__':
run_SC({})
| def run_sc(args):
raise exception()
if __name__ == '__main__':
run_sc({}) |
def min(a, b):
if a > b:
return b
elif b > a:
return a
else:
return a
print(min(2, 2))
def max(a, b):
if a >= b:
return a
elif b > a:
return b
def test1(a,b,c):
if a == b:
print("a is equal to b")
elif b == c:
print("a is not e... | def min(a, b):
if a > b:
return b
elif b > a:
return a
else:
return a
print(min(2, 2))
def max(a, b):
if a >= b:
return a
elif b > a:
return b
def test1(a, b, c):
if a == b:
print('a is equal to b')
elif b == c:
print('a is not equal ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.