content
stringlengths 7
1.05M
|
|---|
'''
Created on Jan 19, 2016
@author: elefebvre
'''
|
a=int(input())
b=int(input())
if a>b:a,b=b,a
for i in range(a+1,b):
if i%5==2 or i%5==3:print(i)
|
class Solution:
def permute(self, nums: List[int]) -> List[List[int]]:
res = []
def backtrack(nums, temp):
if not nums:
res.append(temp)
return
for i in range(len(nums)):
backtrack(nums[:i]+nums[i+1:], temp+[nums[i]])
backtrack(nums, [])
return res
|
class LibTiffPackage (Package):
def __init__(self):
Package.__init__(self, 'tiff', '4.0.9',
configure_flags=[
],
sources=[
'http://download.osgeo.org/libtiff/tiff-%{version}.tar.gz',
])
self.needs_lipo = True
LibTiffPackage()
|
''' Encapsulation : Part 1
Encapsulation is the process of restricting access to methods and variables in a class in order to prevent direct data modification so that it prevents accidental data modification.
Encapsulation basically allows the internal representation of an object to be hidden from the view outside of the objects definition.
Public methods and variables can be accessed from anywhere within the program.
Private methods and variables are accessible from their own class.
Double underscore prefix before object name makes it private'
Encapsulation Part 2: 40
Encapsulation Part: 3 70
'''
# class Cars:
# def __init__(self,speed, color):
# self.speed = speed
# self.color = color
# def set_speed(self,value):
# self.speed = value
# def get_speed(self):
# return self.speed
# Encapsulation Part 2: 40
# class Cars:
# def __init__(self,speed, color):
# self.speed = speed
# self.color = color
# def set_speed(self,value):
# self.speed = value
# def get_speed(self):
# return self.speed
# ford = Cars(250,"green")
# nissan = Cars(300,"red")
# toyota = Cars(350, "blue")
# # ford.set_speed(450) # If I wanted to chang he value of the speed after the instantiantion, I can do that by using the name of the instance and the method.
# ford.speed = 500 # I can also access the speed variable directly without the method and change the value. I'm able to do this because there is no encapsulation in place.
# print(ford.get_speed()) # 500
# print(ford) # <__main__.Cars object at 0x000002AA04FC60A0>
# print(ford.color) # green
# Encapsulation Part: 3 70
class Cars:
def __init__(self,speed, color):
self.__speed = speed # The double underscore makes the variable 'speed' private. It is now difficult to change the value of the variable directly from outside the methods in the class.
self.__color = color
def set_speed(self,value):
self.__speed = value
def get_speed(self):
return self.__speed
ford = Cars(250,"green")
nissan = Cars(300,"red")
toyota = Cars(350, "blue")
# ford.set_speed(450) # If I wanted to chang he value of the speed after the instantiantion, I can do that by using the name of the instance and the method.
ford.speed = 500 # I can also access the speed variable directly without the method and change the value. I'm able to do this because there is no encapsulation in place.
# print(ford.get_speed()) # 250
# print(ford) # <__main__.Cars object at 0x000002AA04FC60A0>
# # print(ford.color) # Traceback (most recent call last):
# # # File "/home/rich/CarlsHub/Comprehensive-Python/ClassFiles/OOP/Encapsulation.py", line 92, in <module>
# # # print(ford.color) # green
# # # AttributeError: 'Cars' object has no attribute 'color'
# print(ford.__color)
print(ford.get_speed()) # 250
print(ford.__color) # Traceback (most recent call last):
# File "/home/rich/CarlsHub/Comprehensive-Python/ClassFiles/OOP/Encapsulation.py", line 100, in <module>
# print(ford.__color) # <__main__.Cars object at 0x000002AA04FC60A0>
# AttributeError: 'Cars' object has no attribute '__color'
|
#!/usr/bin/env python
"""job.py: File containing Job class to be used as the executors for the pipeline."""
__author__ = "Zeyad Osama"
class Job:
"""
Job class to be used as the executors for the pipeline.
"""
def __init__(self) -> None:
super().__init__()
def initialize(self):
pass
def terminate(self):
pass
def feed(self):
pass
def execute(self):
pass
|
class UndefinedMockBehaviorError(Exception):
pass
class MethodWasNotCalledError(Exception):
pass
|
class Solution:
def decodeString(self, s: str) -> str:
St = []
num = 0
curr = ''
for c in s:
if c.isdigit():
num = num*10 + int(c)
elif c == '[':
St.append([num, curr])
num = 0
curr = ''
elif c == ']':
count, prev = St.pop()
curr = prev + count*curr
else:
curr += c
return curr
class Solution2:
def decodeString(self, s: str) -> str:
i = 0
def decode(s):
nonlocal i
result = []
while i < len(s) and s[i] != ']':
if s[i].isdigit():
num = 0
while i < len(s) and s[i].isdigit():
num = num*10 + int(s[i])
i += 1
i += 1
temp = decode(s)
i += 1
result += temp*num
else:
result.append(s[i])
i += 1
return result
return ''.join(decode(s))
|
# Belajar default argument value
#defaul name berfungsi memberikan pengisian default pada parameter
#sehingga pengisian parameter bersifat opsional
def say_hello(nama="aris"): #menggunakan sama dengan lalu ketik default value nya
print(f"Hello {nama}!")
say_hello("karachi")
say_hello() #akan error jika tidak default argumen tidak dipasang, tetapi jika dipasang maka akan keluar hasil yg default
#bagaimana jika menggunakan lebih dari 1 parameter
def says_hello(nama_pertama="uchiha", nama_kedua=""): #ketika ada 2 parameter, jika ingin dipasang defaul argument, maka harus 22nya dipasang
print(f"Hello {nama_pertama}-{nama_kedua}!")
says_hello("muhammad", "aris") #auto terpasang berurutan
says_hello(nama_kedua="shishui") #ketik parameter lalu sama dengan, maka akan terpasang di parameter tsb
says_hello(nama_kedua="uchiha", nama_pertama="madara") #pemasangan argumen parameter (ex: madara) boleh acak, ketika ada deklarasi parameternya
says_hello(nama_kedua="obito")
|
# getattr(object, name[, default])
class C:
def A(self): pass
print(getattr(C, 'A'))
|
arr=input("Enter array elements").split(' ')
arr=[int(x) for x in arr]
for i in range(len(arr)):
for j in range(len(arr)-1-i):
if(arr[j]>arr[j+1]):
arr[j],arr[j+1]=arr[j+1],arr[j]
print("Sorted array is:",arr)
"""
Problem Statement: Sort array using bubble sort technique
Sample Input/Output:
Input: 4 2 5 3 1
Output: 1,2,3,4,5
Time Complexity: O(n^2) (worst)
Space Complexity: O(1)
"""
|
#
# Copyright (C) 2017 The Android Open Source Project
#
# 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 the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# model
model = Model()
i1 = Input("op1", "TENSOR_FLOAT32", "{1, 2, 3, 2}") # input tensor 0
i2 = Input("op2", "TENSOR_FLOAT32", "{1, 2, 3, 2}") # input tensor 1
i3 = Input("op3", "TENSOR_FLOAT32", "{1, 2, 3, 2}") # input tensor 2
axis0 = Int32Scalar("axis0", 3)
r = Output("result", "TENSOR_FLOAT32", "{1, 2, 3, 6}") # output
model = model.Operation("CONCATENATION", i1, i2, i3, axis0).To(r)
# Example 1.
input0 = {i1: [-0.03203143, -0.0334147 , -0.02527265, 0.04576106, 0.08869292,
0.06428383, -0.06473722, -0.21933985, -0.05541003, -0.24157837,
-0.16328812, -0.04581105],
i2: [-0.0569439 , -0.15872048, 0.02965238, -0.12761882, -0.00185435,
-0.03297619, 0.03581043, -0.12603407, 0.05999133, 0.00290503,
0.1727029 , 0.03342071],
i3: [ 0.10992613, 0.09185287, 0.16433905, -0.00059073, -0.01480746,
0.0135175 , 0.07129054, -0.15095694, -0.04579685, -0.13260484,
-0.10045543, 0.0647094 ]}
output0 = {r: [-0.03203143, -0.0334147 , -0.0569439 , -0.15872048, 0.10992613,
0.09185287, -0.02527265, 0.04576106, 0.02965238, -0.12761882,
0.16433905, -0.00059073, 0.08869292, 0.06428383, -0.00185435,
-0.03297619, -0.01480746, 0.0135175 , -0.06473722, -0.21933985,
0.03581043, -0.12603407, 0.07129054, -0.15095694, -0.05541003,
-0.24157837, 0.05999133, 0.00290503, -0.04579685, -0.13260484,
-0.16328812, -0.04581105, 0.1727029 , 0.03342071, -0.10045543,
0.0647094 ]}
# Instantiate an example
Example((input0, output0))
'''
# The above data was generated with the code below:
with tf.Session() as sess:
t1 = tf.random_normal([1, 2, 3, 2], stddev=0.1, dtype=tf.float32)
t2 = tf.random_normal([1, 2, 3, 2], stddev=0.1, dtype=tf.float32)
t3 = tf.random_normal([1, 2, 3, 2], stddev=0.1, dtype=tf.float32)
c1 = tf.concat([t1, t2, t3], axis=3)
print(c1) # print shape
print( sess.run([tf.reshape(t1, [12]),
tf.reshape(t2, [12]),
tf.reshape(t3, [12]),
tf.reshape(c1, [1*2*3*(2*3)])]))
'''
|
class PseudoData(dict):
def __init__(self, name_func_dict, sweep):
super(PseudoData, self).__init__()
self.name_func_dict = name_func_dict
self.sweep = sweep
def __getitem__(self, key):
if key in self.keys():
return dict.__getitem__(self, key)
elif key in self.name_func_dict:
func = self.name_func_dict[key]['func']
pcol = func(self.sweep.data, self.sweep.pdata, self.sweep.meta)
self.__setitem__(key, pcol)
return pcol
else:
return dict.__getitem__(self, key)
def get_names(self):
names = [k for k, v in self.name_func_dict.items() if 'func' in v]
names.sort()
return names
|
# LAB EXERCISE 05
print('Lab Exercise 05 \n')
# SETUP
pop_tv_shows = [
{"Title": "WandaVision", "Creator": ["Jac Schaeffer"], "Rating": 8.2, "Genre": "Action"},
{"Title": "Attack on Titan", "Creator": ["Hajime Isayama"], "Rating": 8.9, "Genre": "Animation"},
{"Title": "Bridgerton", "Creator": ["Chris Van Dusen"], "Rating": 7.3, "Genre": "Drama"},
{"Title": "Game of Thrones", "Creator": ["David Benioff", "D.B. Weiss"], "Rating": 9.3, "Genre": "Action"},
{"Title": "The Mandalorian", "Creator": ["Jon Favreau"], "Rating": 8.8, "Genre": "Action"},
{"Title": "The Queen's Gambit", "Creator": ["Scott Frank", "Allan Scott"], "Rating": 8.6, "Genre": "Drama"},
{"Title": "Schitt's Creek", "Creator": ["Dan Levy", "Eugene Levy"], "Rating": 8.5, "Genre": "Comedy"},
{"Title": "The Equalizer", "Creator": ["Andrew W. Marlowe", "Terri Edda Miller"], "Rating": 4.3, "Genre": "Action"},
{"Title": "Your Honor", "Creator": ["Peter Moffat"], "Rating": 7.9, "Genre": "Crime"},
{"Title": "Cobra Kai", "Creator": ["Jon Hurwitz", "Hayden Schlossberg", "Josh Heald"] , "Rating": 8.6, "Genre": "Action"}
]
# END SETUP
# Problem 01 (4 points)
print('/nProblem 01')
action_shows = []
for show in pop_tv_shows:
if show['Genre'] == 'Action':
action_shows.append(show['Title'])
print(f'Action show list:{action_shows}')
# Problem 02 (4 points)
print('/nProblem 02')
high_rating = 0
highest_rated_show = None
for show in pop_tv_shows:
if show["Rating"] > high_rating:
high_rating = show["Rating"]
highest_rated_show = show["Title"]
print(f'Highest rated show is {highest_rated_show} with a rating of {high_rating}')
# Problem 03 (4 points)
print('/nProblem 03')
low_rating = 10
lowest_rated_show = None
for show in pop_tv_shows:
if show["Rating"] < low_rating and show['Genre'] != "Action":
low_rating = show["Rating"]
lowest_rated_show = show["Title"]
print(f'Lowest rated non-action show is {lowest_rated_show} with a rating of {low_rating}')
# Problem 04 (4 points)
print('/nProblem 04')
multiple_creators = []
for show in pop_tv_shows:
if len(show["Creator"]) > 1:
multiple_creators.append(show["Title"])
print(f'Show with multiple creators: {multiple_creators}')
# Problem 05 (4 points)
print('/nProblem 05')
show_genre = []
for show in pop_tv_shows:
if show['Genre'] not in ["Action", "Drama"] or show["Rating"] >= 9:
item = {'Title': show['Title'], 'Genre': show['Genre']}
show_genre.append(item)
print(f'Show and genre: {show_genre}')
|
__author__ = 'chira'
# "return" used for mathematical function composition
def f(x): # x is an INPUT
y = 2*x + 3
return y # y is an OUTPUT
def g(x): # x is an INPUT
y = pow(x,2)
return y # y is an OUTPUT
def h(x,y): # x and y are INPUTS
z = pow(x,2) + 3*y;
return z # z is an OUTPUT
output = 0 # initializing a variable to store return values
output = f(1) # return form "f" stored in output
print("f(%d) = %d" %(1,output))
output = g(5)
print("g(%d) = %d" %(5,output))
output = f(25)
print("f(%d) = %d" %(25,output))
output = f(g(5)) # return form "g" is input to "f"
print("f(g(%d)) = %d" %(5,output))
output = h(5,25)
print("h(%d,%d) = %d" %(5,25,output))
output = h(f(1),g(5)) # returns form "f" and "g" are inputs to "h"
print("h(f(%d),g(%d)) = %d" %(1,5,output))
|
def balancedSums(arr):
if n == 1:
return 'YES'
sumL = 0
sumR = 0
i =0
j = n-1
while i <= j:
if i ==j and sumL == sumR:
return 'YES'
elif sumL > sumR:
sumR+=arr[j]
j =j-1
else:
sumL+=arr[i]
i =i +1
return 'NO'
arr = [0 ,0 ,2, 0]
n = len(arr)
print(balancedSums(arr))
|
# 4. Создать (не программно) текстовый файл со следующим содержимым:
# One — 1
# Two — 2
# Three — 3
# Four — 4
# Необходимо написать программу, открывающую файл на чтение и считывающую построчно данные.
# При этом английские числительные должны заменяться на русские. Новый блок строк должен записываться
# в новый текстовый файл.
print("")
try:
my_dict = {"One": "Один", "Two": "Два", "Three": "Три", "Four": "Четыре"}
lister = []
with open(r"dz4.txt", "r", encoding="utf-8") as my_file:
for line in my_file:
clean_line = line.replace("\n", "")
numbers = clean_line.split(" ")[0]
clean_line = clean_line.replace(numbers, my_dict[numbers])
lister.append(clean_line)
except IOError:
print("Error")
new_file = open("dz4NEW.txt", "w", encoding="utf-8")
for line in lister:
new_file.write(line+"\n")
new_file.close()
print("Файл dz4NEW.txt сохранён успешно")
|
def perfect_square(x):
if (x == 0 or x == 1):
return x
i = 1
result = 1
while (result <= x):
i += 1
result = i * i
return i - 1
x = int(input('Enter no.'))
print(perfect_square(x))
|
# Default delimiters
INPUT1 = '''
pid 2
uptime 675
version 1.2.5 END
pid 1
uptime 2
version 3
END
'''
OUTPUT1 = '''{"pid": "2", "uptime": "675", "version": "1.2.5"}
{"pid": "1", "uptime": "2", "version": "3"}
'''
# --field-delim '=', --record-delim '%\n'
INPUT2 = '''
a=1
b=2
c=3
%
d=4
e=5
f=6
%
'''
OUTPUT2 = '''{"a": "1", "b": "2", "c": "3"}
{"d": "4", "e": "5", "f": "6"}
'''
# --field-delim '=', --entry-delim '|' --record-delim '%\n'
INPUT3 = '''
a=1|b=2|c=3%
d=4|e=5|f=6%
'''
OUTPUT3 = '''{"a": "1", "b": "2", "c": "3"}
{"d": "4", "e": "5", "f": "6"}
'''
# --field-delim '=', --entry-delim '|' --record-delim '%'
INPUT4 = '''
a=1|b=2|c=3%d=4|e=5|f=6%
'''
OUTPUT4 = '''{"a": "1", "b": "2", "c": "3"}
{"d": "4", "e": "5", "f": "6"}
'''
|
def capitalize(string):
sttings_upper = string.title()
for word in string.split():
words = word[:-1] + word[0-1].upper() + " "
return sttings_upper[:-1]
print(capitalize("GoLand is a new commercial IDE by JetBrains aimed at providing an ergonomic environment "
"for Go development. The new IDE extends the IntelliJ platform with coding assistance "
"and tool integrations specific for the Go language."))
|
"""Meta information for csv2sql."""
__version__ = '0.4.1'
__author__ = 'Yu Mochizuki'
__author_email__ = 'ymoch.dev@gmail.com'
|
# Artificial Intelligence
# Grado en Ingeniería Informática
# 2017-18
# play_tennis.py (Unit 3, slide 8)
attributes=[('Outlook',['Sunny','Overcast','Rainy']),
('Temperature',['High','Low','Mild']),
('Humidity',['High','Normal']),
('Wind',['Weak','Strong'])]
class_name='Play Tennis'
classes=['yes','no']
train=[['Sunny' , 'High' , 'High' , 'Weak' , 'no'],
['Sunny' , 'High' , 'High' , 'Strong', 'no'],
['Overcast','High' , 'High' , 'Weak' , 'yes'],
['Rainy' , 'Mild' , 'High' , 'Weak' , 'yes'],
['Rainy' , 'Low' , 'Normal' , 'Weak' , 'yes'],
['Rainy' , 'Low' , 'Normal' , 'Strong', 'no'],
['Overcast','Low' , 'Normal' , 'Strong', 'yes'],
['Sunny' , 'Mild' , 'High' , 'Weak' , 'no'],
['Sunny' , 'Low' , 'Normal' , 'Weak' , 'yes'],
['Rainy' , 'Mild' , 'Normal' , 'Weak' , 'yes'],
['Sunny' , 'Mild' , 'Normal' , 'Strong', 'yes'],
['Overcast','Mild' , 'High' , 'Strong', 'yes'],
['Overcast','High' , 'Normal' , 'Weak' , 'yes'],
['Rainy', 'Mild' , 'High' , 'Strong', 'no']]
|
print('Adição + ',10 + 10 )
print('Subtração - ', 10 - 10 )
print('Multiplicação * ', 10 * 10 )
print('Divisão / ', 10 / 10 )
print('Potencia ** ', 10 ** 10 )
print('Divisão Inteiro // ', 10 // 3 )
print('Resto Divisão % ', 10 % 3 )
|
class Solution:
def compareVersion(self, version1: str, version2: str) -> int:
l1 = [int(s) for s in version1.split(".")]
l2 = [int(s) for s in version2.split(".")]
len1, len2 = len(l1), len(l2)
if len1 > len2:
l2 += [0] * (len1 - len2)
elif len1 < len2:
l1 += [0] * (len2 - len1)
return (l1 > l2) - (l1 < l2)
|
"""
File: anagram.py
Name: Jason Huang
----------------------------------
This program recursively finds all the anagram(s)
for the word input by user and terminates when the
input string matches the EXIT constant defined
at line 19
If you correctly implement this program, you should see the
number of anagrams for each word listed below:
* arm -> 3 anagrams
* contains -> 5 anagrams
* stop -> 6 anagrams
* tesla -> 10 anagrams
* spear -> 12 anagrams
"""
# Constants
FILE = 'dictionary.txt' # This is the filename of an English dictionary
EXIT = '-1' # Controls when to stop the loop
result_list = []
dictionary = []
def main():
# This is the program to find the anagram in dictionary
global result_list
while True:
result_list = []
print(f'Welcome to stanCode \"Anagram Generator\" (or {EXIT} to quit)')
s = input(str('Find anagrams for:'))
if s == EXIT:
break
else:
read_dictionary()
find_anagrams(s)
def read_dictionary():
# This function is to add the raw material of dictionary in the list.
with open(FILE, 'r') as f:
for line in f:
line = line.strip()
dictionary.append(line)
def find_anagrams(s):
"""
:param s: the word which is the word user want to find the anagram in the dictionary using this program
:return: list, all of the anagrams
"""
word = []
find_anagrams_helper(s, word)
print(f'{len(result_list)} anagrams: {result_list}')
def find_anagrams_helper(s, word):
"""
this is the helper program to support find_anagrams(s).
:param s: the word which is the word user want to find the anagram in the dictionary using this program
:param word: the list which will collect the index of the letter in s
:return: list, anagrams, the anagrams of s.
"""
if len(word) == len(s):
result = ''
for index in word:
result += s[index]
if result in dictionary:
if result not in result_list:
print('Searching...')
print(f'Found: \'{result}\' in dictionary..')
result_list.append(result)
else:
for i in range(len(s)):
if i not in word:
# choose
word.append(i)
# explore
find_anagrams_helper(s, word)
# un-choose
word.pop()
def has_prefix(sub_s):
"""
This program is to pre-check whether the word prefix is in the dictionary
:param sub_s: the prefix of string formulated by the word index.
:return: boolean, True or False
"""
read_dictionary()
bool_list = []
for word in dictionary:
if word.startswith(sub_s):
bool_list.append(1)
else:
bool_list.append(0)
if 1 in bool_list:
return True
return False
if __name__ == '__main__':
main()
|
############# constants
TITLE = "Cheese Maze"
DEVELOPER = "Jack Gartner"
HISTORY = "A mouse wants eat his cheese, Make it to the Hashtag to win, watch out for plus signs, $ is a teleport, P is a power up, Obtain the Key (K) in order to unlock the door (D)"
INSTRUCTIONS = "left arrow key\t\t\tto move left\nright arrow key\t\t\tto move right\nup arrow key\t\t\tto move up\ndown arrow key\t\t\tto move down\npress q\t\t\t\t\tto quit"
############# functions
def displayTitle():
print(TITLE)
print("By " + DEVELOPER)
print()
print(HISTORY)
print()
print(INSTRUCTIONS)
print()
def displayBoard():
print("-----------------")
print("| +\033[36mK\033[37m + \033[33mP\033[37m|")
print("|\033[32m#\033[37m \033[31mD\033[37m + |")
print("|++++ ++++++ |")
print("| + |")
print("| ++++++ +++++|")
print("| \033[34m$\033[37m|")
print("-----------------")
|
score = float(input("Enter Score: "))
if score < 1 and score > 0:
if score >= 0.9:
print('A')
elif score >= 0.8:
print('B')
elif score >= 0.7:
print('C')
elif score >= 0.6:
print('D')
else:
print('F')
else:
print('Value of score is out of range.')
largest = None
smallest = None
while True:
num = input("Enter a number: ")
if num == "done" : break
try:
num = int(num)
except:
print('Invalid input')
continue
if largest is None:
largest = num
elif num > largest:
largest = num
elif smallest is None:
smallest = num
elif num < smallest:
smallest = num
#print(num)
print("Maximum is", largest)
print('Minimum is', smallest)
def computepay(h,r):
if h <= 40:
pay = h * r
else:
h1 = h - 40
pay = 40 * r + h1 *(r * 1.5)
return pay
hrs = input("Enter Hours:")
rate = input('Enter Rate:')
h = float(hrs)
r = float(rate)
p = computepay(h,r)
print("Pay",p)
|
class BaseRequestError(Exception):
def __init__(self, *args, **kwargs):
self.errors = []
self.code = 400
if 'code' in kwargs:
self.code = kwargs['code']
def add_error(self, err):
self.info.append(err)
def set_errors(self, errors):
self.errors = errors
class BadRequestError(BaseRequestError):
"""400 BadRequestError"""
def __init__(self, *args, **kwargs):
super(BadRequestError, self).__init__(*args, **kwargs)
|
'''
Created on May 19, 2019
@author: ballance
'''
# TODO: implement simulation-access methods
# - yield
# - get sim time
# - ...
#
# The launcher will ultimately implement these methods
#
|
"""Provide some variants of assert."""
def _custom_assert(condition: bool, on_error_msg: str = "") -> None:
"""Provide a custom assert which is kept even if the optimized python mode is used.
See https://docs.python.org/3/reference/simple_stmts.html#assert for the documentation
on the classical assert function
Args:
condition(bool): the condition. If False, raise AssertionError
on_error_msg(str): optional message for precising the error, in case of error
"""
if not condition:
raise AssertionError(on_error_msg)
def assert_true(condition: bool, on_error_msg: str = ""):
"""Provide a custom assert to check that the condition is True.
Args:
condition(bool): the condition. If False, raise AssertionError
on_error_msg(str): optional message for precising the error, in case of error
"""
return _custom_assert(condition, on_error_msg)
def assert_false(condition: bool, on_error_msg: str = ""):
"""Provide a custom assert to check that the condition is False.
Args:
condition(bool): the condition. If True, raise AssertionError
on_error_msg(str): optional message for precising the error, in case of error
"""
return _custom_assert(not condition, on_error_msg)
def assert_not_reached(on_error_msg: str):
"""Provide a custom assert to check that a piece of code is never reached.
Args:
on_error_msg(str): message for precising the error
"""
return _custom_assert(False, on_error_msg)
|
def find_even_index(arr):
for index, int in enumerate(arr):
left = sum_range(arr, 0, index)
right = sum_range(arr, index, len(arr))
if left == right:
return index
return -1
def sum_range(arr, a, b):
return sum(arr[a:b + 1])
|
prompt = """Translate to French (fr)
From English (es)
==========
Bramshott is a village with mediaeval origins in the East Hampshire district of Hampshire, England. It lies 0.9 miles (1.4 km) north of Liphook. The nearest railway station, Liphook, is 1.3 miles (2.1 km) south of the village.
----------
Bramshott est un village avec des origines médiévales dans le quartier East Hampshire de Hampshire, en Angleterre. Il se trouve à 0,9 miles (1,4 km) au nord de Liphook. La gare la plus proche, Liphook, est à 1,3 km (2,1 km) au sud du village.
==========
Translate to Russian (rs)
From German (de)
==========
Der Gewöhnliche Strandhafer (Ammophila arenaria (L.) Link; Syn: Calamagrostis arenaria (L.) Roth) – auch als Gemeiner Strandhafer, Sandrohr, Sandhalm, Seehafer oder Helm (niederdeutsch) bezeichnet – ist eine zur Familie der Süßgräser (Poaceae) gehörige Pionierpflanze.
----------
Обычная пляжная овсянка (аммофила ареалия (л.) соединение; сина: каламагростисная анария (л.) Рот, также называемая обычной пляжной овцой, песчаной, сандалмой, морской орой или шлемом (нижний немецкий) - это кукольная станция, принадлежащая семье сладких трав (поа).
==========
"""
def generate_prompt(text, from_name, from_code, to_name, to_code):
# TODO: document
to_return = prompt
to_return += "Translate to "
if from_name:
to_return += from_name
if from_code:
to_return += " (" + from_code + ")"
to_return += "\nFrom "
if to_name:
to_return += to_name
if from_code:
to_return += " (" + to_code + ")"
to_return += "\n" + "=" * 10 + "\n"
to_return += text
to_return += "\n" + "-" * 10 + "\n"
return to_return
def parse_inference(output):
end_index = output.find("=" * 10)
if end_index != -1:
return output[end_index]
end_index = output.find("-" * 10)
if end_index != -1:
return output[end_index]
return output
|
# DO NOT EDIT: this file is auto-generated
def _jvm_deps_impl(ctx):
content = """
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
def load_jvm_deps():
http_file(name="com.google.code.findbugs_jsr305_1.3.9", urls=["https://repo1.maven.org/maven2/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar"], sha256="905721a0eea90a81534abb7ee6ef4ea2e5e645fa1def0a5cd88402df1b46c9ed")
http_file(name="com.google.code.findbugs_jsr305_3.0.2", urls=["https://repo1.maven.org/maven2/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar"], sha256="766ad2a0783f2687962c8ad74ceecc38a28b9f72a2d085ee438b7813e928d0c7")
http_file(name="com.google.errorprone_error_prone_annotations_2.3.4", urls=["https://repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.3.4/error_prone_annotations-2.3.4.jar"], sha256="baf7d6ea97ce606c53e11b6854ba5f2ce7ef5c24dddf0afa18d1260bd25b002c")
http_file(name="com.google.guava_failureaccess_1.0.1", urls=["https://repo1.maven.org/maven2/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar"], sha256="a171ee4c734dd2da837e4b16be9df4661afab72a41adaf31eb84dfdaf936ca26")
http_file(name="com.google.guava_guava_24.1.1-jre", urls=["https://repo1.maven.org/maven2/com/google/guava/guava/24.1.1-jre/guava-24.1.1-jre.jar"], sha256="490c16878c7a2c22e136728ad473c4190b21b82b46e261ba84ad2e4a5c28fbcf")
http_file(name="com.google.guava_guava_29.0-jre", urls=["https://repo1.maven.org/maven2/com/google/guava/guava/29.0-jre/guava-29.0-jre.jar"], sha256="b22c5fb66d61e7b9522531d04b2f915b5158e80aa0b40ee7282c8bfb07b0da25")
http_file(name="com.google.guava_listenablefuture_9999.0-empty-to-avoid-conflict-with-guava", urls=["https://repo1.maven.org/maven2/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar"], sha256="b372a037d4230aa57fbeffdef30fd6123f9c0c2db85d0aced00c91b974f33f99")
http_file(name="com.google.j2objc_j2objc-annotations_1.3", urls=["https://repo1.maven.org/maven2/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar"], sha256="21af30c92267bd6122c0e0b4d20cccb6641a37eaf956c6540ec471d584e64a7b")
http_file(name="com.google.protobuf_protobuf-java_3.13.0", urls=["https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java/3.13.0/protobuf-java-3.13.0.jar"], sha256="97d5b2758408690c0dc276238707492a0b6a4d71206311b6c442cdc26c5973ff")
http_file(name="com.lihaoyi_fansi_2.12_0.2.5", urls=["https://repo1.maven.org/maven2/com/lihaoyi/fansi_2.12/0.2.5/fansi_2.12-0.2.5.jar"], sha256="7d752240ec724e7370903c25b69088922fa3fb6831365db845cd72498f826eca")
http_file(name="com.lihaoyi_fastparse-utils_2.12_1.0.0", urls=["https://repo1.maven.org/maven2/com/lihaoyi/fastparse-utils_2.12/1.0.0/fastparse-utils_2.12-1.0.0.jar"], sha256="fb6cd6484e21459e11fcd45f22f07ad75e3cb29eca0650b39aa388d13c8e7d0a")
http_file(name="com.lihaoyi_fastparse_2.12_1.0.0", urls=["https://repo1.maven.org/maven2/com/lihaoyi/fastparse_2.12/1.0.0/fastparse_2.12-1.0.0.jar"], sha256="1227a00a26a4ad76ddcfa6eae2416687df7f3c039553d586324b32ba0a528fcc")
http_file(name="com.lihaoyi_pprint_2.12_0.5.3", urls=["https://repo1.maven.org/maven2/com/lihaoyi/pprint_2.12/0.5.3/pprint_2.12-0.5.3.jar"], sha256="2e18aa0884870537bf5c562255fc759d4ebe360882b5cb2141b30eda4034c71d")
http_file(name="com.lihaoyi_sourcecode_2.12_0.1.4", urls=["https://repo1.maven.org/maven2/com/lihaoyi/sourcecode_2.12/0.1.4/sourcecode_2.12-0.1.4.jar"], sha256="9a3134484e596205d0acdcccd260e0854346f266cb4d24e1b8a31be54fbaf6d9")
http_file(name="com.thesamet.scalapb_lenses_2.12_0.8.0-RC1", urls=["https://repo1.maven.org/maven2/com/thesamet/scalapb/lenses_2.12/0.8.0-RC1/lenses_2.12-0.8.0-RC1.jar"], sha256="6e061e15fa9f37662d89d1d0a3f4da64c73e3129108b672c792b36bf490ae8e2")
http_file(name="com.thesamet.scalapb_scalapb-runtime_2.12_0.8.0-RC1", urls=["https://repo1.maven.org/maven2/com/thesamet/scalapb/scalapb-runtime_2.12/0.8.0-RC1/scalapb-runtime_2.12-0.8.0-RC1.jar"], sha256="d922c788c8997e2524a39b1f43bac3c859516fc0ae580eab82c0db7e40aef944")
http_file(name="commons-codec_commons-codec_1.9", urls=["https://repo1.maven.org/maven2/commons-codec/commons-codec/1.9/commons-codec-1.9.jar"], sha256="ad19d2601c3abf0b946b5c3a4113e226a8c1e3305e395b90013b78dd94a723ce")
http_file(name="commons-logging_commons-logging_1.2", urls=["https://repo1.maven.org/maven2/commons-logging/commons-logging/1.2/commons-logging-1.2.jar"], sha256="daddea1ea0be0f56978ab3006b8ac92834afeefbd9b7e4e6316fca57df0fa636")
http_file(name="org.apache.httpcomponents_httpclient_4.4.1", urls=["https://repo1.maven.org/maven2/org/apache/httpcomponents/httpclient/4.4.1/httpclient-4.4.1.jar"], sha256="b2958ffb74f691e108abe69af0002ccff90ba326420596b1aab5bb0f63c31ef9")
http_file(name="org.apache.httpcomponents_httpcore_4.4.1", urls=["https://repo1.maven.org/maven2/org/apache/httpcomponents/httpcore/4.4.1/httpcore-4.4.1.jar"], sha256="dd1390c17d40f760f7e51bb20523a8d63deb69e94babeaf567eb76ecd2cad422")
http_file(name="org.apache.thrift_libthrift_0.10.0", urls=["https://repo1.maven.org/maven2/org/apache/thrift/libthrift/0.10.0/libthrift-0.10.0.jar"], sha256="8591718c1884ac8001b4c5ca80f349c0a6deec691de0af720c5e3bc3a581dada")
http_file(name="org.checkerframework_checker-compat-qual_2.0.0", urls=["https://repo1.maven.org/maven2/org/checkerframework/checker-compat-qual/2.0.0/checker-compat-qual-2.0.0.jar"], sha256="a40b2ce6d8551e5b90b1bf637064303f32944d61b52ab2014e38699df573941b")
http_file(name="org.checkerframework_checker-qual_2.11.1", urls=["https://repo1.maven.org/maven2/org/checkerframework/checker-qual/2.11.1/checker-qual-2.11.1.jar"], sha256="015224a4b1dc6de6da053273d4da7d39cfea20e63038169fc45ac0d1dc9c5938")
http_file(name="org.codehaus.mojo_animal-sniffer-annotations_1.14", urls=["https://repo1.maven.org/maven2/org/codehaus/mojo/animal-sniffer-annotations/1.14/animal-sniffer-annotations-1.14.jar"], sha256="2068320bd6bad744c3673ab048f67e30bef8f518996fa380033556600669905d")
http_file(name="org.scala-lang_scala-library_2.12.12", urls=["https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.12.12/scala-library-2.12.12.jar"], sha256="1673ffe8792021f704caddfe92067ed1ec75229907f84380ad68fe621358c925")
http_file(name="org.scalameta_common_2.12_4.0.0", urls=["https://repo1.maven.org/maven2/org/scalameta/common_2.12/4.0.0/common_2.12-4.0.0.jar"], sha256="57f0cfa2e5c95cbf350cd089cb6799933e6fdc19b177ac8194e0d2f7bd564a7c")
http_file(name="org.scalameta_dialects_2.12_4.0.0", urls=["https://repo1.maven.org/maven2/org/scalameta/dialects_2.12/4.0.0/dialects_2.12-4.0.0.jar"], sha256="d1486a19a438316454ff395bd6f904d2b2becc457706cd762cb50fa6306c5980")
http_file(name="org.scalameta_inputs_2.12_4.0.0", urls=["https://repo1.maven.org/maven2/org/scalameta/inputs_2.12/4.0.0/inputs_2.12-4.0.0.jar"], sha256="0ccc21c1dbc23cc680f704b49d82ee7840d3ee2f0fd790d03ed330fda6897ef8")
http_file(name="org.scalameta_io_2.12_4.0.0", urls=["https://repo1.maven.org/maven2/org/scalameta/io_2.12/4.0.0/io_2.12-4.0.0.jar"], sha256="8dd7baff1123c49370f44ffffeaefd86bc71d3aa919c48fba64e0b16ced8036f")
http_file(name="org.scalameta_parsers_2.12_4.0.0", urls=["https://repo1.maven.org/maven2/org/scalameta/parsers_2.12/4.0.0/parsers_2.12-4.0.0.jar"], sha256="8315d79b922e3978e92d5e948a468e00b0c5e2de6e4381315e3b0425c006ca72")
http_file(name="org.scalameta_quasiquotes_2.12_4.0.0", urls=["https://repo1.maven.org/maven2/org/scalameta/quasiquotes_2.12/4.0.0/quasiquotes_2.12-4.0.0.jar"], sha256="19bd420811488f6e07be39b8dc6ac8d1850476b820e460de90d3759bfba99bba")
http_file(name="org.scalameta_scalameta_2.12_4.0.0", urls=["https://repo1.maven.org/maven2/org/scalameta/scalameta_2.12/4.0.0/scalameta_2.12-4.0.0.jar"], sha256="e59f985f29ef19e5ffb0a26ef6a52cceb7a43968de21b0f2c208f773ac696a1e")
http_file(name="org.scalameta_semanticdb_2.12_4.0.0", urls=["https://repo1.maven.org/maven2/org/scalameta/semanticdb_2.12/4.0.0/semanticdb_2.12-4.0.0.jar"], sha256="77157079fd64a73938401fd9c41f2214ebe25182f98c2c5f6fbb56904f972746")
http_file(name="org.scalameta_tokenizers_2.12_4.0.0", urls=["https://repo1.maven.org/maven2/org/scalameta/tokenizers_2.12/4.0.0/tokenizers_2.12-4.0.0.jar"], sha256="231a4aa5b6c716e0972e23935bcbb7a5e78f5b164a45e1e8bd8fbcdf613839db")
http_file(name="org.scalameta_tokens_2.12_4.0.0", urls=["https://repo1.maven.org/maven2/org/scalameta/tokens_2.12/4.0.0/tokens_2.12-4.0.0.jar"], sha256="e703b9f64e072113ebff82af55962b1bdbed1541d99ffce329e30b682cc0d013")
http_file(name="org.scalameta_transversers_2.12_4.0.0", urls=["https://repo1.maven.org/maven2/org/scalameta/transversers_2.12/4.0.0/transversers_2.12-4.0.0.jar"], sha256="bd3913fe90783459e38cf43a9059498cfc638c18eda633bd02ba3cdda2455611")
http_file(name="org.scalameta_trees_2.12_4.0.0", urls=["https://repo1.maven.org/maven2/org/scalameta/trees_2.12/4.0.0/trees_2.12-4.0.0.jar"], sha256="e2573c57f3d582be2ca891a45928dd9e3b07ffdb915058b803f9da1ab6797f92")
http_file(name="org.slf4j_slf4j-api_1.7.12", urls=["https://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.12/slf4j-api-1.7.12.jar"], sha256="0aee9a77a4940d72932b0d0d9557793f872e66a03f598e473f45e7efecdccf99")
"""
ctx.file("jvm_deps.bzl", content, executable=False)
build_content = """
load("@io_bazel_rules_scala//scala:scala_import.bzl", "scala_import")
scala_import(name="3rdparty/jvm/com/google/protobuf/protobuf-java", jars=["@maven//:com.google.protobuf/protobuf-java/3.13.0/protobuf-java-3.13.0.jar"], deps=["com.google.protobuf_protobuf-java_3.13.0_1542979766"], exports=["com.google.protobuf_protobuf-java_3.13.0_1542979766"], visibility=["//visibility:public"])
scala_import(name="3rdparty/jvm/org/apache/thrift/libthrift", jars=["@maven//:org.apache.thrift/libthrift/0.10.0/libthrift-0.10.0.jar"], deps=["org.apache.thrift_libthrift_0.10.0_-1749481331"], exports=["org.apache.thrift_libthrift_0.10.0_-1749481331"], visibility=["//visibility:public"])
scala_import(name="3rdparty/jvm/com/google/guava/guava", jars=["@maven//:com.google.guava/guava/29.0-jre/guava-29.0-jre.jar"], deps=["com.google.guava_guava_29.0-jre_-1012487309"], exports=["com.google.guava_guava_29.0-jre_-1012487309"], visibility=["//visibility:public"])
scala_import(name="3rdparty/jvm/org/scala-lang/scala-library", jars=["@maven//:org.scala-lang/scala-library/2.12.12/scala-library-2.12.12.jar"], deps=["org.scala-lang_scala-library_2.12.12_977037598"], exports=["org.scala-lang_scala-library_2.12.12_977037598"], visibility=["//visibility:public"])
scala_import(name="3rdparty/jvm/org/scalameta/scalameta", jars=["@maven//:org.scalameta/scalameta_2.12/4.0.0/scalameta_2.12-4.0.0.jar"], deps=["org.scalameta_scalameta_2.12_4.0.0_1182173837"], exports=["org.scalameta_scalameta_2.12_4.0.0_1182173837"], visibility=["//visibility:public"])
scala_import(name="3rdparty/jvm/com/google/guava/guava-24", jars=["@maven//:org.checkerframework/checker-compat-qual/2.0.0/checker-compat-qual-2.0.0.jar", "@maven//:com.google.guava/guava/24.1.1-jre/guava-24.1.1-jre.jar"], deps=["org.checkerframework_checker-compat-qual_2.0.0_-1693045912", "com.google.guava_guava_24.1.1-jre_-295746057"], exports=["org.checkerframework_checker-compat-qual_2.0.0_-1693045912", "com.google.guava_guava_24.1.1-jre_-295746057"], visibility=["//visibility:public"])
genrule(name="genrules/com.google.code.findbugs_jsr305_1.3.9", srcs=["@com.google.code.findbugs_jsr305_1.3.9//file"], outs=["@maven//:com.google.code.findbugs/jsr305/1.3.9/jsr305-1.3.9.jar"], cmd="cp $< $@", tags=["jvm_module=com.google.code.findbugs:jsr305", "jvm_version=1.3.9"])
scala_import(name="_com.google.code.findbugs_jsr305_1.3.9", jars=["@maven//:com.google.code.findbugs/jsr305/1.3.9/jsr305-1.3.9.jar"], deps=[], exports=[], tags=["jvm_module=com.google.code.findbugs:jsr305", "jvm_version=1.3.9"], visibility=["//visibility:public"])
genrule(name="genrules/com.google.code.findbugs_jsr305_3.0.2", srcs=["@com.google.code.findbugs_jsr305_3.0.2//file"], outs=["@maven//:com.google.code.findbugs/jsr305/3.0.2/jsr305-3.0.2.jar"], cmd="cp $< $@", tags=["jvm_module=com.google.code.findbugs:jsr305", "jvm_version=3.0.2"])
scala_import(name="_com.google.code.findbugs_jsr305_3.0.2", jars=["@maven//:com.google.code.findbugs/jsr305/3.0.2/jsr305-3.0.2.jar"], deps=[], exports=[], tags=["jvm_module=com.google.code.findbugs:jsr305", "jvm_version=3.0.2"], visibility=["//visibility:public"])
genrule(name="genrules/com.google.errorprone_error_prone_annotations_2.3.4", srcs=["@com.google.errorprone_error_prone_annotations_2.3.4//file"], outs=["@maven//:com.google.errorprone/error_prone_annotations/2.3.4/error_prone_annotations-2.3.4.jar"], cmd="cp $< $@", tags=["jvm_module=com.google.errorprone:error_prone_annotations", "jvm_version=2.3.4"])
scala_import(name="_com.google.errorprone_error_prone_annotations_2.3.4", jars=["@maven//:com.google.errorprone/error_prone_annotations/2.3.4/error_prone_annotations-2.3.4.jar"], deps=[], exports=[], tags=["jvm_module=com.google.errorprone:error_prone_annotations", "jvm_version=2.3.4"], visibility=["//visibility:public"])
genrule(name="genrules/com.google.guava_failureaccess_1.0.1", srcs=["@com.google.guava_failureaccess_1.0.1//file"], outs=["@maven//:com.google.guava/failureaccess/1.0.1/failureaccess-1.0.1.jar"], cmd="cp $< $@", tags=["jvm_module=com.google.guava:failureaccess", "jvm_version=1.0.1"])
scala_import(name="_com.google.guava_failureaccess_1.0.1", jars=["@maven//:com.google.guava/failureaccess/1.0.1/failureaccess-1.0.1.jar"], deps=[], exports=[], tags=["jvm_module=com.google.guava:failureaccess", "jvm_version=1.0.1"], visibility=["//visibility:public"])
scala_import(name="com.google.guava_guava_24.1.1-jre_-295746057", jars=["@maven//:com.google.guava/guava/24.1.1-jre/guava-24.1.1-jre.jar"], deps=["_com.google.errorprone_error_prone_annotations_2.3.4", "_com.google.j2objc_j2objc-annotations_1.3", "_com.google.code.findbugs_jsr305_1.3.9", "_org.checkerframework_checker-compat-qual_2.0.0", "_org.codehaus.mojo_animal-sniffer-annotations_1.14"], exports=["_com.google.errorprone_error_prone_annotations_2.3.4", "_com.google.j2objc_j2objc-annotations_1.3", "_com.google.code.findbugs_jsr305_1.3.9", "_org.checkerframework_checker-compat-qual_2.0.0", "_org.codehaus.mojo_animal-sniffer-annotations_1.14"], tags=["jvm_module=com.google.guava:guava", "jvm_version=24.1.1-jre"], visibility=["//visibility:public"])
genrule(name="genrules/com.google.guava_guava_24.1.1-jre", srcs=["@com.google.guava_guava_24.1.1-jre//file"], outs=["@maven//:com.google.guava/guava/24.1.1-jre/guava-24.1.1-jre.jar"], cmd="cp $< $@", tags=["jvm_module=com.google.guava:guava", "jvm_version=24.1.1-jre"])
scala_import(name="_com.google.guava_guava_24.1.1-jre", jars=["@maven//:com.google.guava/guava/24.1.1-jre/guava-24.1.1-jre.jar"], deps=[], exports=[], tags=["jvm_module=com.google.guava:guava", "jvm_version=24.1.1-jre"], visibility=["//visibility:public"])
scala_import(name="com.google.guava_guava_29.0-jre_-1012487309", jars=["@maven//:com.google.guava/guava/29.0-jre/guava-29.0-jre.jar"], deps=["_com.google.guava_failureaccess_1.0.1", "_com.google.guava_listenablefuture_9999.0-empty-to-avoid-conflict-with-guava", "_com.google.code.findbugs_jsr305_3.0.2", "_org.checkerframework_checker-qual_2.11.1", "_com.google.errorprone_error_prone_annotations_2.3.4", "_com.google.j2objc_j2objc-annotations_1.3"], exports=["_com.google.guava_failureaccess_1.0.1", "_com.google.guava_listenablefuture_9999.0-empty-to-avoid-conflict-with-guava", "_com.google.code.findbugs_jsr305_3.0.2", "_org.checkerframework_checker-qual_2.11.1", "_com.google.errorprone_error_prone_annotations_2.3.4", "_com.google.j2objc_j2objc-annotations_1.3"], tags=["jvm_module=com.google.guava:guava", "jvm_version=29.0-jre"], visibility=["//visibility:public"])
genrule(name="genrules/com.google.guava_guava_29.0-jre", srcs=["@com.google.guava_guava_29.0-jre//file"], outs=["@maven//:com.google.guava/guava/29.0-jre/guava-29.0-jre.jar"], cmd="cp $< $@", tags=["jvm_module=com.google.guava:guava", "jvm_version=29.0-jre"])
scala_import(name="_com.google.guava_guava_29.0-jre", jars=["@maven//:com.google.guava/guava/29.0-jre/guava-29.0-jre.jar"], deps=[], exports=[], tags=["jvm_module=com.google.guava:guava", "jvm_version=29.0-jre"], visibility=["//visibility:public"])
genrule(name="genrules/com.google.guava_listenablefuture_9999.0-empty-to-avoid-conflict-with-guava", srcs=["@com.google.guava_listenablefuture_9999.0-empty-to-avoid-conflict-with-guava//file"], outs=["@maven//:com.google.guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar"], cmd="cp $< $@", tags=["jvm_module=com.google.guava:listenablefuture", "jvm_version=9999.0-empty-to-avoid-conflict-with-guava"])
scala_import(name="_com.google.guava_listenablefuture_9999.0-empty-to-avoid-conflict-with-guava", jars=["@maven//:com.google.guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar"], deps=[], exports=[], tags=["jvm_module=com.google.guava:listenablefuture", "jvm_version=9999.0-empty-to-avoid-conflict-with-guava"], visibility=["//visibility:public"])
genrule(name="genrules/com.google.j2objc_j2objc-annotations_1.3", srcs=["@com.google.j2objc_j2objc-annotations_1.3//file"], outs=["@maven//:com.google.j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar"], cmd="cp $< $@", tags=["jvm_module=com.google.j2objc:j2objc-annotations", "jvm_version=1.3"])
scala_import(name="_com.google.j2objc_j2objc-annotations_1.3", jars=["@maven//:com.google.j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar"], deps=[], exports=[], tags=["jvm_module=com.google.j2objc:j2objc-annotations", "jvm_version=1.3"], visibility=["//visibility:public"])
scala_import(name="com.google.protobuf_protobuf-java_3.13.0_1542979766", jars=["@maven//:com.google.protobuf/protobuf-java/3.13.0/protobuf-java-3.13.0.jar"], deps=[], exports=[], tags=["jvm_module=com.google.protobuf:protobuf-java", "jvm_version=3.13.0"], visibility=["//visibility:public"])
genrule(name="genrules/com.google.protobuf_protobuf-java_3.13.0", srcs=["@com.google.protobuf_protobuf-java_3.13.0//file"], outs=["@maven//:com.google.protobuf/protobuf-java/3.13.0/protobuf-java-3.13.0.jar"], cmd="cp $< $@", tags=["jvm_module=com.google.protobuf:protobuf-java", "jvm_version=3.13.0"])
scala_import(name="_com.google.protobuf_protobuf-java_3.13.0", jars=["@maven//:com.google.protobuf/protobuf-java/3.13.0/protobuf-java-3.13.0.jar"], deps=[], exports=[], tags=["jvm_module=com.google.protobuf:protobuf-java", "jvm_version=3.13.0"], visibility=["//visibility:public"])
genrule(name="genrules/com.lihaoyi_fansi_2.12_0.2.5", srcs=["@com.lihaoyi_fansi_2.12_0.2.5//file"], outs=["@maven//:com.lihaoyi/fansi_2.12/0.2.5/fansi_2.12-0.2.5.jar"], cmd="cp $< $@", tags=["jvm_module=com.lihaoyi:fansi_2.12", "jvm_version=0.2.5"])
scala_import(name="_com.lihaoyi_fansi_2.12_0.2.5", jars=["@maven//:com.lihaoyi/fansi_2.12/0.2.5/fansi_2.12-0.2.5.jar"], deps=[], exports=[], tags=["jvm_module=com.lihaoyi:fansi_2.12", "jvm_version=0.2.5"], visibility=["//visibility:public"])
genrule(name="genrules/com.lihaoyi_fastparse-utils_2.12_1.0.0", srcs=["@com.lihaoyi_fastparse-utils_2.12_1.0.0//file"], outs=["@maven//:com.lihaoyi/fastparse-utils_2.12/1.0.0/fastparse-utils_2.12-1.0.0.jar"], cmd="cp $< $@", tags=["jvm_module=com.lihaoyi:fastparse-utils_2.12", "jvm_version=1.0.0"])
scala_import(name="_com.lihaoyi_fastparse-utils_2.12_1.0.0", jars=["@maven//:com.lihaoyi/fastparse-utils_2.12/1.0.0/fastparse-utils_2.12-1.0.0.jar"], deps=[], exports=[], tags=["jvm_module=com.lihaoyi:fastparse-utils_2.12", "jvm_version=1.0.0"], visibility=["//visibility:public"])
genrule(name="genrules/com.lihaoyi_fastparse_2.12_1.0.0", srcs=["@com.lihaoyi_fastparse_2.12_1.0.0//file"], outs=["@maven//:com.lihaoyi/fastparse_2.12/1.0.0/fastparse_2.12-1.0.0.jar"], cmd="cp $< $@", tags=["jvm_module=com.lihaoyi:fastparse_2.12", "jvm_version=1.0.0"])
scala_import(name="_com.lihaoyi_fastparse_2.12_1.0.0", jars=["@maven//:com.lihaoyi/fastparse_2.12/1.0.0/fastparse_2.12-1.0.0.jar"], deps=[], exports=[], tags=["jvm_module=com.lihaoyi:fastparse_2.12", "jvm_version=1.0.0"], visibility=["//visibility:public"])
genrule(name="genrules/com.lihaoyi_pprint_2.12_0.5.3", srcs=["@com.lihaoyi_pprint_2.12_0.5.3//file"], outs=["@maven//:com.lihaoyi/pprint_2.12/0.5.3/pprint_2.12-0.5.3.jar"], cmd="cp $< $@", tags=["jvm_module=com.lihaoyi:pprint_2.12", "jvm_version=0.5.3"])
scala_import(name="_com.lihaoyi_pprint_2.12_0.5.3", jars=["@maven//:com.lihaoyi/pprint_2.12/0.5.3/pprint_2.12-0.5.3.jar"], deps=[], exports=[], tags=["jvm_module=com.lihaoyi:pprint_2.12", "jvm_version=0.5.3"], visibility=["//visibility:public"])
genrule(name="genrules/com.lihaoyi_sourcecode_2.12_0.1.4", srcs=["@com.lihaoyi_sourcecode_2.12_0.1.4//file"], outs=["@maven//:com.lihaoyi/sourcecode_2.12/0.1.4/sourcecode_2.12-0.1.4.jar"], cmd="cp $< $@", tags=["jvm_module=com.lihaoyi:sourcecode_2.12", "jvm_version=0.1.4"])
scala_import(name="_com.lihaoyi_sourcecode_2.12_0.1.4", jars=["@maven//:com.lihaoyi/sourcecode_2.12/0.1.4/sourcecode_2.12-0.1.4.jar"], deps=[], exports=[], tags=["jvm_module=com.lihaoyi:sourcecode_2.12", "jvm_version=0.1.4"], visibility=["//visibility:public"])
genrule(name="genrules/com.thesamet.scalapb_lenses_2.12_0.8.0-RC1", srcs=["@com.thesamet.scalapb_lenses_2.12_0.8.0-RC1//file"], outs=["@maven//:com.thesamet.scalapb/lenses_2.12/0.8.0-RC1/lenses_2.12-0.8.0-RC1.jar"], cmd="cp $< $@", tags=["jvm_module=com.thesamet.scalapb:lenses_2.12", "jvm_version=0.8.0-RC1"])
scala_import(name="_com.thesamet.scalapb_lenses_2.12_0.8.0-RC1", jars=["@maven//:com.thesamet.scalapb/lenses_2.12/0.8.0-RC1/lenses_2.12-0.8.0-RC1.jar"], deps=[], exports=[], tags=["jvm_module=com.thesamet.scalapb:lenses_2.12", "jvm_version=0.8.0-RC1"], visibility=["//visibility:public"])
genrule(name="genrules/com.thesamet.scalapb_scalapb-runtime_2.12_0.8.0-RC1", srcs=["@com.thesamet.scalapb_scalapb-runtime_2.12_0.8.0-RC1//file"], outs=["@maven//:com.thesamet.scalapb/scalapb-runtime_2.12/0.8.0-RC1/scalapb-runtime_2.12-0.8.0-RC1.jar"], cmd="cp $< $@", tags=["jvm_module=com.thesamet.scalapb:scalapb-runtime_2.12", "jvm_version=0.8.0-RC1"])
scala_import(name="_com.thesamet.scalapb_scalapb-runtime_2.12_0.8.0-RC1", jars=["@maven//:com.thesamet.scalapb/scalapb-runtime_2.12/0.8.0-RC1/scalapb-runtime_2.12-0.8.0-RC1.jar"], deps=[], exports=[], tags=["jvm_module=com.thesamet.scalapb:scalapb-runtime_2.12", "jvm_version=0.8.0-RC1"], visibility=["//visibility:public"])
genrule(name="genrules/commons-codec_commons-codec_1.9", srcs=["@commons-codec_commons-codec_1.9//file"], outs=["@maven//:commons-codec/commons-codec/1.9/commons-codec-1.9.jar"], cmd="cp $< $@", tags=["jvm_module=commons-codec:commons-codec", "jvm_version=1.9"])
scala_import(name="_commons-codec_commons-codec_1.9", jars=["@maven//:commons-codec/commons-codec/1.9/commons-codec-1.9.jar"], deps=[], exports=[], tags=["jvm_module=commons-codec:commons-codec", "jvm_version=1.9"], visibility=["//visibility:public"])
genrule(name="genrules/commons-logging_commons-logging_1.2", srcs=["@commons-logging_commons-logging_1.2//file"], outs=["@maven//:commons-logging/commons-logging/1.2/commons-logging-1.2.jar"], cmd="cp $< $@", tags=["jvm_module=commons-logging:commons-logging", "jvm_version=1.2"])
scala_import(name="_commons-logging_commons-logging_1.2", jars=["@maven//:commons-logging/commons-logging/1.2/commons-logging-1.2.jar"], deps=[], exports=[], tags=["jvm_module=commons-logging:commons-logging", "jvm_version=1.2"], visibility=["//visibility:public"])
genrule(name="genrules/org.apache.httpcomponents_httpclient_4.4.1", srcs=["@org.apache.httpcomponents_httpclient_4.4.1//file"], outs=["@maven//:org.apache.httpcomponents/httpclient/4.4.1/httpclient-4.4.1.jar"], cmd="cp $< $@", tags=["jvm_module=org.apache.httpcomponents:httpclient", "jvm_version=4.4.1"])
scala_import(name="_org.apache.httpcomponents_httpclient_4.4.1", jars=["@maven//:org.apache.httpcomponents/httpclient/4.4.1/httpclient-4.4.1.jar"], deps=[], exports=[], tags=["jvm_module=org.apache.httpcomponents:httpclient", "jvm_version=4.4.1"], visibility=["//visibility:public"])
genrule(name="genrules/org.apache.httpcomponents_httpcore_4.4.1", srcs=["@org.apache.httpcomponents_httpcore_4.4.1//file"], outs=["@maven//:org.apache.httpcomponents/httpcore/4.4.1/httpcore-4.4.1.jar"], cmd="cp $< $@", tags=["jvm_module=org.apache.httpcomponents:httpcore", "jvm_version=4.4.1"])
scala_import(name="_org.apache.httpcomponents_httpcore_4.4.1", jars=["@maven//:org.apache.httpcomponents/httpcore/4.4.1/httpcore-4.4.1.jar"], deps=[], exports=[], tags=["jvm_module=org.apache.httpcomponents:httpcore", "jvm_version=4.4.1"], visibility=["//visibility:public"])
scala_import(name="org.apache.thrift_libthrift_0.10.0_-1749481331", jars=["@maven//:org.apache.thrift/libthrift/0.10.0/libthrift-0.10.0.jar"], deps=["_org.slf4j_slf4j-api_1.7.12", "_org.apache.httpcomponents_httpclient_4.4.1", "_org.apache.httpcomponents_httpcore_4.4.1", "_commons-logging_commons-logging_1.2", "_commons-codec_commons-codec_1.9"], exports=["_org.slf4j_slf4j-api_1.7.12", "_org.apache.httpcomponents_httpclient_4.4.1", "_org.apache.httpcomponents_httpcore_4.4.1", "_commons-logging_commons-logging_1.2", "_commons-codec_commons-codec_1.9"], tags=["jvm_module=org.apache.thrift:libthrift", "jvm_version=0.10.0"], visibility=["//visibility:public"])
genrule(name="genrules/org.apache.thrift_libthrift_0.10.0", srcs=["@org.apache.thrift_libthrift_0.10.0//file"], outs=["@maven//:org.apache.thrift/libthrift/0.10.0/libthrift-0.10.0.jar"], cmd="cp $< $@", tags=["jvm_module=org.apache.thrift:libthrift", "jvm_version=0.10.0"])
scala_import(name="_org.apache.thrift_libthrift_0.10.0", jars=["@maven//:org.apache.thrift/libthrift/0.10.0/libthrift-0.10.0.jar"], deps=[], exports=[], tags=["jvm_module=org.apache.thrift:libthrift", "jvm_version=0.10.0"], visibility=["//visibility:public"])
scala_import(name="org.checkerframework_checker-compat-qual_2.0.0_-1693045912", jars=["@maven//:org.checkerframework/checker-compat-qual/2.0.0/checker-compat-qual-2.0.0.jar"], deps=[], exports=[], tags=["jvm_module=org.checkerframework:checker-compat-qual", "jvm_version=2.0.0"], visibility=["//visibility:public"])
genrule(name="genrules/org.checkerframework_checker-compat-qual_2.0.0", srcs=["@org.checkerframework_checker-compat-qual_2.0.0//file"], outs=["@maven//:org.checkerframework/checker-compat-qual/2.0.0/checker-compat-qual-2.0.0.jar"], cmd="cp $< $@", tags=["jvm_module=org.checkerframework:checker-compat-qual", "jvm_version=2.0.0"])
scala_import(name="_org.checkerframework_checker-compat-qual_2.0.0", jars=["@maven//:org.checkerframework/checker-compat-qual/2.0.0/checker-compat-qual-2.0.0.jar"], deps=[], exports=[], tags=["jvm_module=org.checkerframework:checker-compat-qual", "jvm_version=2.0.0"], visibility=["//visibility:public"])
genrule(name="genrules/org.checkerframework_checker-qual_2.11.1", srcs=["@org.checkerframework_checker-qual_2.11.1//file"], outs=["@maven//:org.checkerframework/checker-qual/2.11.1/checker-qual-2.11.1.jar"], cmd="cp $< $@", tags=["jvm_module=org.checkerframework:checker-qual", "jvm_version=2.11.1"])
scala_import(name="_org.checkerframework_checker-qual_2.11.1", jars=["@maven//:org.checkerframework/checker-qual/2.11.1/checker-qual-2.11.1.jar"], deps=[], exports=[], tags=["jvm_module=org.checkerframework:checker-qual", "jvm_version=2.11.1"], visibility=["//visibility:public"])
genrule(name="genrules/org.codehaus.mojo_animal-sniffer-annotations_1.14", srcs=["@org.codehaus.mojo_animal-sniffer-annotations_1.14//file"], outs=["@maven//:org.codehaus.mojo/animal-sniffer-annotations/1.14/animal-sniffer-annotations-1.14.jar"], cmd="cp $< $@", tags=["jvm_module=org.codehaus.mojo:animal-sniffer-annotations", "jvm_version=1.14"])
scala_import(name="_org.codehaus.mojo_animal-sniffer-annotations_1.14", jars=["@maven//:org.codehaus.mojo/animal-sniffer-annotations/1.14/animal-sniffer-annotations-1.14.jar"], deps=[], exports=[], tags=["jvm_module=org.codehaus.mojo:animal-sniffer-annotations", "jvm_version=1.14"], visibility=["//visibility:public"])
scala_import(name="org.scala-lang_scala-library_2.12.12_977037598", jars=["@maven//:org.scala-lang/scala-library/2.12.12/scala-library-2.12.12.jar"], deps=[], exports=[], tags=["jvm_module=org.scala-lang:scala-library", "jvm_version=2.12.12"], visibility=["//visibility:public"])
genrule(name="genrules/org.scala-lang_scala-library_2.12.12", srcs=["@org.scala-lang_scala-library_2.12.12//file"], outs=["@maven//:org.scala-lang/scala-library/2.12.12/scala-library-2.12.12.jar"], cmd="cp $< $@", tags=["jvm_module=org.scala-lang:scala-library", "jvm_version=2.12.12"])
scala_import(name="_org.scala-lang_scala-library_2.12.12", jars=["@maven//:org.scala-lang/scala-library/2.12.12/scala-library-2.12.12.jar"], deps=[], exports=[], tags=["jvm_module=org.scala-lang:scala-library", "jvm_version=2.12.12"], visibility=["//visibility:public"])
genrule(name="genrules/org.scalameta_common_2.12_4.0.0", srcs=["@org.scalameta_common_2.12_4.0.0//file"], outs=["@maven//:org.scalameta/common_2.12/4.0.0/common_2.12-4.0.0.jar"], cmd="cp $< $@", tags=["jvm_module=org.scalameta:common_2.12", "jvm_version=4.0.0"])
scala_import(name="_org.scalameta_common_2.12_4.0.0", jars=["@maven//:org.scalameta/common_2.12/4.0.0/common_2.12-4.0.0.jar"], deps=[], exports=[], tags=["jvm_module=org.scalameta:common_2.12", "jvm_version=4.0.0"], visibility=["//visibility:public"])
genrule(name="genrules/org.scalameta_dialects_2.12_4.0.0", srcs=["@org.scalameta_dialects_2.12_4.0.0//file"], outs=["@maven//:org.scalameta/dialects_2.12/4.0.0/dialects_2.12-4.0.0.jar"], cmd="cp $< $@", tags=["jvm_module=org.scalameta:dialects_2.12", "jvm_version=4.0.0"])
scala_import(name="_org.scalameta_dialects_2.12_4.0.0", jars=["@maven//:org.scalameta/dialects_2.12/4.0.0/dialects_2.12-4.0.0.jar"], deps=[], exports=[], tags=["jvm_module=org.scalameta:dialects_2.12", "jvm_version=4.0.0"], visibility=["//visibility:public"])
genrule(name="genrules/org.scalameta_inputs_2.12_4.0.0", srcs=["@org.scalameta_inputs_2.12_4.0.0//file"], outs=["@maven//:org.scalameta/inputs_2.12/4.0.0/inputs_2.12-4.0.0.jar"], cmd="cp $< $@", tags=["jvm_module=org.scalameta:inputs_2.12", "jvm_version=4.0.0"])
scala_import(name="_org.scalameta_inputs_2.12_4.0.0", jars=["@maven//:org.scalameta/inputs_2.12/4.0.0/inputs_2.12-4.0.0.jar"], deps=[], exports=[], tags=["jvm_module=org.scalameta:inputs_2.12", "jvm_version=4.0.0"], visibility=["//visibility:public"])
genrule(name="genrules/org.scalameta_io_2.12_4.0.0", srcs=["@org.scalameta_io_2.12_4.0.0//file"], outs=["@maven//:org.scalameta/io_2.12/4.0.0/io_2.12-4.0.0.jar"], cmd="cp $< $@", tags=["jvm_module=org.scalameta:io_2.12", "jvm_version=4.0.0"])
scala_import(name="_org.scalameta_io_2.12_4.0.0", jars=["@maven//:org.scalameta/io_2.12/4.0.0/io_2.12-4.0.0.jar"], deps=[], exports=[], tags=["jvm_module=org.scalameta:io_2.12", "jvm_version=4.0.0"], visibility=["//visibility:public"])
genrule(name="genrules/org.scalameta_parsers_2.12_4.0.0", srcs=["@org.scalameta_parsers_2.12_4.0.0//file"], outs=["@maven//:org.scalameta/parsers_2.12/4.0.0/parsers_2.12-4.0.0.jar"], cmd="cp $< $@", tags=["jvm_module=org.scalameta:parsers_2.12", "jvm_version=4.0.0"])
scala_import(name="_org.scalameta_parsers_2.12_4.0.0", jars=["@maven//:org.scalameta/parsers_2.12/4.0.0/parsers_2.12-4.0.0.jar"], deps=[], exports=[], tags=["jvm_module=org.scalameta:parsers_2.12", "jvm_version=4.0.0"], visibility=["//visibility:public"])
genrule(name="genrules/org.scalameta_quasiquotes_2.12_4.0.0", srcs=["@org.scalameta_quasiquotes_2.12_4.0.0//file"], outs=["@maven//:org.scalameta/quasiquotes_2.12/4.0.0/quasiquotes_2.12-4.0.0.jar"], cmd="cp $< $@", tags=["jvm_module=org.scalameta:quasiquotes_2.12", "jvm_version=4.0.0"])
scala_import(name="_org.scalameta_quasiquotes_2.12_4.0.0", jars=["@maven//:org.scalameta/quasiquotes_2.12/4.0.0/quasiquotes_2.12-4.0.0.jar"], deps=[], exports=[], tags=["jvm_module=org.scalameta:quasiquotes_2.12", "jvm_version=4.0.0"], visibility=["//visibility:public"])
scala_import(name="org.scalameta_scalameta_2.12_4.0.0_1182173837", jars=["@maven//:org.scalameta/scalameta_2.12/4.0.0/scalameta_2.12-4.0.0.jar"], deps=["_org.scala-lang_scala-library_2.12.12", "_com.google.protobuf_protobuf-java_3.13.0", "_org.scalameta_common_2.12_4.0.0", "_org.scalameta_dialects_2.12_4.0.0", "_org.scalameta_parsers_2.12_4.0.0", "_org.scalameta_quasiquotes_2.12_4.0.0", "_org.scalameta_tokenizers_2.12_4.0.0", "_org.scalameta_transversers_2.12_4.0.0", "_org.scalameta_trees_2.12_4.0.0", "_org.scalameta_inputs_2.12_4.0.0", "_org.scalameta_io_2.12_4.0.0", "_com.lihaoyi_pprint_2.12_0.5.3", "_org.scalameta_semanticdb_2.12_4.0.0", "_com.lihaoyi_sourcecode_2.12_0.1.4", "_org.scalameta_tokens_2.12_4.0.0", "_com.lihaoyi_fastparse_2.12_1.0.0", "_com.lihaoyi_fansi_2.12_0.2.5", "_com.thesamet.scalapb_scalapb-runtime_2.12_0.8.0-RC1", "_com.lihaoyi_fastparse-utils_2.12_1.0.0", "_com.thesamet.scalapb_lenses_2.12_0.8.0-RC1"], exports=["_org.scala-lang_scala-library_2.12.12", "_com.google.protobuf_protobuf-java_3.13.0", "_org.scalameta_common_2.12_4.0.0", "_org.scalameta_dialects_2.12_4.0.0", "_org.scalameta_parsers_2.12_4.0.0", "_org.scalameta_quasiquotes_2.12_4.0.0", "_org.scalameta_tokenizers_2.12_4.0.0", "_org.scalameta_transversers_2.12_4.0.0", "_org.scalameta_trees_2.12_4.0.0", "_org.scalameta_inputs_2.12_4.0.0", "_org.scalameta_io_2.12_4.0.0", "_com.lihaoyi_pprint_2.12_0.5.3", "_org.scalameta_semanticdb_2.12_4.0.0", "_com.lihaoyi_sourcecode_2.12_0.1.4", "_org.scalameta_tokens_2.12_4.0.0", "_com.lihaoyi_fastparse_2.12_1.0.0", "_com.lihaoyi_fansi_2.12_0.2.5", "_com.thesamet.scalapb_scalapb-runtime_2.12_0.8.0-RC1", "_com.lihaoyi_fastparse-utils_2.12_1.0.0", "_com.thesamet.scalapb_lenses_2.12_0.8.0-RC1"], tags=["jvm_module=org.scalameta:scalameta_2.12", "jvm_version=4.0.0"], visibility=["//visibility:public"])
genrule(name="genrules/org.scalameta_scalameta_2.12_4.0.0", srcs=["@org.scalameta_scalameta_2.12_4.0.0//file"], outs=["@maven//:org.scalameta/scalameta_2.12/4.0.0/scalameta_2.12-4.0.0.jar"], cmd="cp $< $@", tags=["jvm_module=org.scalameta:scalameta_2.12", "jvm_version=4.0.0"])
scala_import(name="_org.scalameta_scalameta_2.12_4.0.0", jars=["@maven//:org.scalameta/scalameta_2.12/4.0.0/scalameta_2.12-4.0.0.jar"], deps=[], exports=[], tags=["jvm_module=org.scalameta:scalameta_2.12", "jvm_version=4.0.0"], visibility=["//visibility:public"])
genrule(name="genrules/org.scalameta_semanticdb_2.12_4.0.0", srcs=["@org.scalameta_semanticdb_2.12_4.0.0//file"], outs=["@maven//:org.scalameta/semanticdb_2.12/4.0.0/semanticdb_2.12-4.0.0.jar"], cmd="cp $< $@", tags=["jvm_module=org.scalameta:semanticdb_2.12", "jvm_version=4.0.0"])
scala_import(name="_org.scalameta_semanticdb_2.12_4.0.0", jars=["@maven//:org.scalameta/semanticdb_2.12/4.0.0/semanticdb_2.12-4.0.0.jar"], deps=[], exports=[], tags=["jvm_module=org.scalameta:semanticdb_2.12", "jvm_version=4.0.0"], visibility=["//visibility:public"])
genrule(name="genrules/org.scalameta_tokenizers_2.12_4.0.0", srcs=["@org.scalameta_tokenizers_2.12_4.0.0//file"], outs=["@maven//:org.scalameta/tokenizers_2.12/4.0.0/tokenizers_2.12-4.0.0.jar"], cmd="cp $< $@", tags=["jvm_module=org.scalameta:tokenizers_2.12", "jvm_version=4.0.0"])
scala_import(name="_org.scalameta_tokenizers_2.12_4.0.0", jars=["@maven//:org.scalameta/tokenizers_2.12/4.0.0/tokenizers_2.12-4.0.0.jar"], deps=[], exports=[], tags=["jvm_module=org.scalameta:tokenizers_2.12", "jvm_version=4.0.0"], visibility=["//visibility:public"])
genrule(name="genrules/org.scalameta_tokens_2.12_4.0.0", srcs=["@org.scalameta_tokens_2.12_4.0.0//file"], outs=["@maven//:org.scalameta/tokens_2.12/4.0.0/tokens_2.12-4.0.0.jar"], cmd="cp $< $@", tags=["jvm_module=org.scalameta:tokens_2.12", "jvm_version=4.0.0"])
scala_import(name="_org.scalameta_tokens_2.12_4.0.0", jars=["@maven//:org.scalameta/tokens_2.12/4.0.0/tokens_2.12-4.0.0.jar"], deps=[], exports=[], tags=["jvm_module=org.scalameta:tokens_2.12", "jvm_version=4.0.0"], visibility=["//visibility:public"])
genrule(name="genrules/org.scalameta_transversers_2.12_4.0.0", srcs=["@org.scalameta_transversers_2.12_4.0.0//file"], outs=["@maven//:org.scalameta/transversers_2.12/4.0.0/transversers_2.12-4.0.0.jar"], cmd="cp $< $@", tags=["jvm_module=org.scalameta:transversers_2.12", "jvm_version=4.0.0"])
scala_import(name="_org.scalameta_transversers_2.12_4.0.0", jars=["@maven//:org.scalameta/transversers_2.12/4.0.0/transversers_2.12-4.0.0.jar"], deps=[], exports=[], tags=["jvm_module=org.scalameta:transversers_2.12", "jvm_version=4.0.0"], visibility=["//visibility:public"])
genrule(name="genrules/org.scalameta_trees_2.12_4.0.0", srcs=["@org.scalameta_trees_2.12_4.0.0//file"], outs=["@maven//:org.scalameta/trees_2.12/4.0.0/trees_2.12-4.0.0.jar"], cmd="cp $< $@", tags=["jvm_module=org.scalameta:trees_2.12", "jvm_version=4.0.0"])
scala_import(name="_org.scalameta_trees_2.12_4.0.0", jars=["@maven//:org.scalameta/trees_2.12/4.0.0/trees_2.12-4.0.0.jar"], deps=[], exports=[], tags=["jvm_module=org.scalameta:trees_2.12", "jvm_version=4.0.0"], visibility=["//visibility:public"])
genrule(name="genrules/org.slf4j_slf4j-api_1.7.12", srcs=["@org.slf4j_slf4j-api_1.7.12//file"], outs=["@maven//:org.slf4j/slf4j-api/1.7.12/slf4j-api-1.7.12.jar"], cmd="cp $< $@", tags=["jvm_module=org.slf4j:slf4j-api", "jvm_version=1.7.12"])
scala_import(name="_org.slf4j_slf4j-api_1.7.12", jars=["@maven//:org.slf4j/slf4j-api/1.7.12/slf4j-api-1.7.12.jar"], deps=[], exports=[], tags=["jvm_module=org.slf4j:slf4j-api", "jvm_version=1.7.12"], visibility=["//visibility:public"])
"""
ctx.file("BUILD", build_content, executable=False)
jvm_deps_rule = repository_rule(
implementation=_jvm_deps_impl,
)
def jvm_deps():
jvm_deps_rule(name="maven")
|
""" CHALLENGE PROBLEM!! NOT FOR THE FAINT OF HEART!
The Fibonacci numbers, discovered by Leonardo di Fibonacci,
is a sequence of numbers that often shows up in mathematics and,
interestingly, nature. The sequence goes as such:
1,1,2,3,5,8,13,21,34,55,...
where the sequence starts with 1 and 1, and then each number is the sum of the
previous 2. For example, 8 comes after 5 because 5+3 = 8, and 55 comes after 34
because 34+21 = 55.
The challenge is to use a for loop (not recursion, if you know what that is),
to find the 100th Fibonnaci number.
"""
# write code here
# Can you do it with a while loop?
|
INSTALLED_APPS = (
"testapp",
)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
SECRET_KEY = "django_tests_secret_key"
|
# Databricks notebook source
# MAGIC %md # Run transform
# MAGIC this will load the schema, the raw txt tables, then transform the dataframes to structured dataframes.
# COMMAND ----------
# MAGIC %run ./transform
# COMMAND ----------
# MAGIC %md # Store
# MAGIC write the transformed dataframes to our base-path
# COMMAND ----------
for table in df_openalex_c:
target=f'{base_path}parquet/{table}'
if table in partition_sizes:
partitions=partition_sizes[table]
else:
partitions=partition_sizes['default']
if file_exists(target):
print(f'{target} already exists, skip')
else:
print(f'writing {target}')
df_openalex_c[table].repartition(partitions).write.format('parquet').save(target)
|
# python3
def build_heap(data):
"""Build a heap from ``data`` inplace.
Returns a sequence of swaps performed by the algorithm.
"""
# The following naive implementation just sorts the given sequence
# using selection sort algorithm and saves the resulting sequence
# of swaps. This turns the given array into a heap, but in the worst
# case gives a quadratic number of swaps.
#
# TODO: replace by a more efficient implementation
swaps = []
n = len(data)
for i in range((n - 2) // 2, -1, -1):
j = i
while j < n:
m = j
l = 2 * m + 1
r = l + 1
if l < n and data[l] < data[m]:
m = l
if r < n and data[r] < data[m]:
m = r
if m != j:
swaps.append((j, m))
data[j], data[m] = data[m], data[j]
j = m
else:
break
return swaps
def main():
# n = int(input())
# data = list(map(int, input().split()))
# assert len(data) == n
data = list(map(int, '5 4 3 2 1'.split()))
swaps = build_heap(data)
print(len(swaps))
for i, j in swaps:
print(i, j)
if __name__ == "__main__":
main()
|
# Ex4.
#
# Create a program that is going to take a whole number as an input, and will calculate the factorial of the number.
#
# Factorial example: 5! = 5 * 4 * 3 * 2 * 1 = 120
factorial = 1
number = int(input('Enter a number: '))
for i in range(1, number+1):
factorial *= i
print(f'Factorial of {number} is {factorial}')
|
"""
描述
市政府想在品罗路建一些基站,保证这条路上每个公司的员工都能享受到 Wi-Fi。
为了简化问题,我们将品罗路理解成一条直线,一个 Wi-Fi 基站为直线上的一个点。
基站的费用为 A + k*B,其中A为建立基站的固定费用,B 为覆盖每单位距离需要的费用,k 为覆盖半径。
如果在 a 点建立基站,覆盖半径为 k,那么位于 [a-k, a+k] 的公司都能享受到这个基站的服务。
现在给出每个公司的坐标,以及 A 和 B,求覆盖到所有公司需要的最小建设费用。
输入
前两个整数是 A 和 B,然后是一个分号,然后是每个公司的坐标。(0 <= A, B <= 1000,0 <= 公司坐标 <= 1,000,000,坐标都为整数,公司数量 <= 2000)
输出
一个浮点,表示最小建设费用,四舍五入到小数点后一位。
输入样例
20 5;100 0 7
输出样例
57.5
"""
# 此处可 import 模块
"""
@param string line 为单行测试数据
@return string 处理后的结果
"""
def solution(line):
# 缩进请使用 4 个空格,遵循 PEP8 规范
# please write your code here
# return 'your_answer'
x, y = line.strip().split(';')
A, B = x.split(' ')
A, B = int(A), int(B)
nums = [int(x) for x in y.split(' ')]
nums.sort()
if A == 0:
return 0.0
if B == 0:
return float(A)
# 理想部署距离
k_m = 2*A/B
# j_s_list = []
count = 0
j_s = [nums[0]]
for i in range(1, len(nums)):
if nums[i]-nums[i-1] <= k_m:
j_s.append(nums[i])
else:
# j_s_list.append(j_s)
count += A+(j_s[-1]-j_s[0])/2*B
j_s = [nums[i]]
# j_s_list.append(j_s)
count += A+(j_s[-1]-j_s[0])/2*B
return float(count)
if __name__ == '__main__':
aa = solution("20 5;100 0 7 90")
|
"""
Parameters and syntactic sugar.
"""
def dec(func):
def wrapper(*args, **kwargs):
print('Top decoration')
rv = func(*args, **kwargs)
print('Bottom decoration')
return rv
return wrapper
@dec
def sum_it(a, b):
return(a + b)
x = sum_it(10, 5)
print(x)
|
def read_lines_of_file(filename):
with open(filename) as f:
content = f.readlines()
return content,len(content)
alltext,alltextlen = read_lines_of_file('read.txt')
for line in alltext:
print(line.rstrip())
print("Number of lines read from file --> %d" %(alltextlen))
|
class Authenticator():
def validate(self, username, password):
raise NotImplementedError() # pragma: no cover
def verify(self, username):
raise NotImplementedError() # pragma: no cover
def get_password(self, username):
raise NotImplementedError() # pragma: no cover
|
""" some types and constants
"""
# pylint: disable=too-few-public-methods
NS = "starters"
class Status:
""" pseudo-enum for managing statuses
"""
# the starter isn't done yet, and more data is required
CONTINUING = "continuing"
# the starter is done, and should not continue
DONE = "done"
# something terrible has happened
ERROR = "error"
|
"""
Given a string s, consisting of "X" and "Y"s, delete the minimum number of characters such that there's no consecutive "X" and no consecutive "Y".
Constraints
n ≤ 100,000 where n is the length of s
https://binarysearch.com/problems/Consecutive-Duplicates
"""
class Solution:
def solve(self, s):
# Write your code here
results = []
for c in s:
if len(results) == 0 or results[len(results)-1] != c:
results.append(c)
return "".join(results)
|
#!/usr/local/bin/python3
class Generator():
def __init__(self, init, factor, modulo, multiple):
self.value = init
self.factor = factor
self.modulo = modulo
self.multiple = multiple
def getNext(self):
self.value = (self.value * self.factor) % self.modulo
while (self.value % self.multiple) != 0:
self.value = (self.value * self.factor) % self.modulo
return self.value
class Judge():
def __init__(self, genA, genB):
self.generatorA = genA
self.generatorB = genB
self.count = 0
def evalNext(self):
if self.generatorA.getNext()&0xffff == self.generatorB.getNext()&0xffff:
self.count += 1
FACTOR_GEN_A = 16807
FACTOR_GEN_B = 48271
MODULO = 2147483647
START_VALUE_GEN_A = 512
START_VALUE_GEN_B = 191
generatorA = Generator(START_VALUE_GEN_A, FACTOR_GEN_A, MODULO, 1)
generatorB = Generator(START_VALUE_GEN_B, FACTOR_GEN_B, MODULO, 1)
judge = Judge(generatorA, generatorB)
for i in xrange(40000000):
judge.evalNext()
print("Star 1: %i" % judge.count)
generatorA = Generator(START_VALUE_GEN_A, FACTOR_GEN_A, MODULO, 4)
generatorB = Generator(START_VALUE_GEN_B, FACTOR_GEN_B, MODULO, 8)
judge = Judge(generatorA, generatorB)
for i in xrange(5000000):
judge.evalNext()
print("Star 2: %i" % judge.count)
|
price = 1000000
good_credit = True
high_income = True
if good_credit and high_income:
down_payment = 1.0 * price
print(f"eligible for loan")
else:
down_payment = 2.0 * price
print(f"ineligible for loan")
print(f"down payment is {down_payment}")
|
# Constants shared between C++ code and python
# TODO: Share properly via a configuration file
# ControllerWithSimpleHistory::EvaluationPeriod
EVALUATION_PERIOD_SEQUENCES = 64
# kWorkWindowSize in SysConsts.hpp
STATE_TRANSFER_WINDOW = 300
|
# Python program to print
# ASCII Value of Character
# In c we can assign different
# characters of which we want ASCII value
c = 'g'
# print the ASCII value of assigned character in c
print("The ASCII value of '" + c + "' is", ord(c))
|
#!/usr/bin/python3
"""
Contains empty class BaseGeometry
with public instance method area
"""
class BaseGeometry:
"""
Methods:
area(self)
"""
def area(self):
"""not implemented"""
raise Exception("area() is not implemented")
|
"""
Enable `django-admin-tools`_ to enhance the administration interface. This enables three widgets to customize certain elements. `filebrowser`_ is used, so if your project has not enabled it, you need to remove the occurrences of these widgets.
.. warning::
This mod cannot live with `admin_style`_, you have to choose only one of them.
"""
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 19 21:42:34 2020
@author: lukepinkel
"""
LBFGSB_options = dict(disp=10, maxfun=5000, maxiter=5000, gtol=1e-8)
SLSQP_options = dict(disp=True, maxiter=1000)
TrustConstr_options = dict(verbose=3, gtol=1e-5)
TrustNewton_options = dict(gtol=1e-5)
TrustConstr2_options = dict(verbose=0, gtol=1e-6)
default_opts = {'L-BFGS-B':LBFGSB_options,
'l-bfgs-b':LBFGSB_options,
'lbfgsb':LBFGSB_options,
'LBFGSB':LBFGSB_options,
'SLSQP':SLSQP_options,
'slsqp':SLSQP_options,
'trust-constr':TrustConstr_options,
'trust-ncg':TrustNewton_options}
def process_optimizer_kwargs(optimizer_kwargs, default_method='trust-constr'):
keys = optimizer_kwargs.keys()
if 'method' not in keys:
optimizer_kwargs['method'] = default_method
if 'options' not in keys:
optimizer_kwargs['options'] = default_opts[optimizer_kwargs['method']]
else:
options_keys = optimizer_kwargs['options'].keys()
for dfkey, dfval in default_opts[optimizer_kwargs['method']].items():
if dfkey not in options_keys:
optimizer_kwargs['options'][dfkey] = dfval
return optimizer_kwargs
|
def calculator():
values = input('Insira os valores que deseja calcular por exemplo 5+5: ')
if not values:
return 'Você não inseriu os valores.'
try:
primary = int(values[0])
secondary = int(values[2])
value = values[1]
obj = {
'+': primary + secondary,
'-': primary - secondary,
'x': primary * secondary,
'/': primary / secondary
}
if not obj[value]:
return 'Não foi possivel calcular.'
return f'O resultado é: {int(obj[value])}'
except ValueError:
return 'Valores inválidos, lembre-se apenas números de 1 a 9.'
while True:
cal = calculator()
print(cal)
|
def find(tree, key, value):
items = tree.get("children", []) if isinstance(tree, dict) else tree
for item in items:
if item[key] == value:
yield item
else:
yield from find(item, key, value)
def find_path(tree, key, value, path=()):
items = tree.get("children", []) if isinstance(tree, dict) else tree
for item in items:
if item[key] == value:
yield (*path, item)
else:
yield from find_path(item, key, value, (*path, item))
|
# compat2.py
# Copyright (c) 2013-2019 Pablo Acosta-Serafini
# See LICENSE for details
# pylint: disable=C0111,R1717,W0122,W0613
###
# Functions
###
def _readlines(fname): # pragma: no cover
"""Read all lines from file."""
with open(fname, "r") as fobj:
return fobj.readlines()
# Largely from From https://stackoverflow.com/questions/956867/
# how-to-get-string-objects-instead-of-unicode-ones-from-json-in-python
# with Python 2.6 compatibility changes
def _unicode_to_ascii(obj): # pragma: no cover
"""Convert to ASCII."""
# pylint: disable=E0602
if isinstance(obj, dict):
return dict(
[
(_unicode_to_ascii(key), _unicode_to_ascii(value))
for key, value in obj.items()
]
)
if isinstance(obj, list):
return [_unicode_to_ascii(element) for element in obj]
if isinstance(obj, unicode):
return obj.encode("utf-8")
return obj
def _write(fobj, data):
"""Write data to file."""
fobj.write(data)
|
# GRADED FUNCTION: gram_matrix
def gram_matrix(A):
"""
Argument:
A -- matrix of shape (n_C, n_H*n_W)
Returns:
GA -- Gram matrix of A, of shape (n_C, n_C)
"""
### START CODE HERE ### (≈1 line)
GA = tf.matmul(A, tf.transpose(A))
### END CODE HERE ###
return GA
|
'''
Problem: 13 Reasons Why
Given 3 integers A, B, C. Do the following steps-
Swap A and B.
Multiply A by C.
Add C to B.
Output new values of A and B.
'''
# When ran, you will see a blank line, as that is needed for the submission.
# If you are debugging and want it to be easier, change it too
# input = input("Numbers: ")
# Collects the input
input = input()
# Puts the input in the list, it's cutting them due to the space between the numbers.
inputList = input.split(" ")
# Since A and B are being swapped, A is given inputList[1], which was B's input. Vice Versa for B.
# C is just given the third input, which was C.
A = int(inputList[1])
B = int(inputList[0])
C = int(inputList[2])
# Multiplies A * C.
A = A * C
# Adds C + B.
B = C + B
# Converts them to strings since the submission needs to be one line.
A = str(A)
B = str(B)
# Prints the answer.
print(A + " " + B)
|
class Solution:
def maxIncreaseKeepingSkyline(self, grid):
skyline = []
for v_line in grid:
skyline.append([max(v_line)] * len(grid))
for x, h_line in enumerate(list(zip(*grid))):
max_h = max(h_line)
for y in range(len(skyline)):
skyline[y][x] = min(skyline[y][x], max_h)
ans = sum([sum(l) for l in skyline]) - sum([sum(l) for l in grid])
return ans
|
class Solution:
def subsetsWithDup(self, nums: List[int]) -> List[List[int]]:
output = [[]]
result = []
for num in sorted(nums):
res = [lst + [num] for lst in output]
output += res
for subset in output:
if subset not in result:
result.append(subset)
return result
|
with open('/home/ai/hdd/tupm/projects/textGenOCR/trdg/dicts/general_form_ocr.txt') as f:
text = f.readlines()
f2 = open('/home/ai/hdd/tupm/projects/textGenOCR/trdg/dicts/dlo_address.txt', 'w+')
# data = list(set(text))
# data.sort()
# # count2 = 0
# count = {e: 0 for e in data}
# count2 = 0
for e in text:
e = e.strip()
length = len(e)
if length > 25:
f2.write(f'{e[:length//2]}\n')
f2.write(f'{e[length//2:]}\n')
else:
f2.write(f'{e}\n')
# # data.sort()
# print(count)
# print(len(count))
# print(min(count.values()))
|
# -*- coding: utf-8 -*-
"""Top-level package for Hauberk Email Automations."""
__author__ = """Andrew Kail"""
__email__ = 'andrew.a.kail@gmail.com'
__version__ = '0.1.0'
|
"""Common testing word list."""
# word list Breakdown
# 1: a (1)
# 2: go. no, be, by (4)
# 3: cry, fun, run, for (4)
# 4: demo, foul, wait, sell (4)
# 5: yeast, wrong, water, skill (4)
# 6: accept, admire, bicorn, biceps, planks (5)
# 7: bizonal, biofuel, bigfoot, scalene (4)
# 8: mobility, notebook, superior, taxpayer (4)
# 9: squeezing, emphasize, humanized, bubblegum (4)
# 10: victimized, complexity, nonsubject (3)
# 11: overcomplex, conjunction, pocketknife (3)
# 12: embezzlement, hyperbolized, racquetballs (3)
# Over: Supercalifragilisticexpialidocious (1)
LIST_EXAMPLE = [
"a",
"go",
"no",
"be",
"by",
"cry",
"fun",
"run",
"for",
"demo",
"foul",
"wait",
"sell",
"yeast",
"wrong",
"water",
"skill",
"accept",
"admire",
"bicorn",
"biceps",
"planks",
"bizonal",
"biofuel",
"bigfoot",
"scalene",
"mobility",
"notebook",
"superior",
"taxpayer",
"squeezing",
"emphasize",
"humanized",
"bubblegum",
"victimized",
"complexity",
"nonsubject",
"overcomplex",
"conjunction",
"pocketknife",
"embezzlement",
"hyperbolized",
"racquetballs",
"Supercalifragilisticexpialidocious",
]
LIST_EXAMPLE_EASY = [
"cry",
"fun",
"run",
"for",
"demo",
"foul",
"wait",
"sell",
"yeast",
"wrong",
"water",
"skill",
]
LIST_EXAMPLE_ADVANCED = [
"accept",
"admire",
"bicorn",
"biceps",
"planks",
"bizonal",
"biofuel",
"bigfoot",
"scalene",
"mobility",
"notebook",
"superior",
"taxpayer",
]
LIST_EXAMPLE_EXPERT = [
"squeezing",
"emphasize",
"humanized",
"bubblegum",
"victimized",
"complexity",
"nonsubject",
]
LIST_EXAMPLE_MASTER = [
"overcomplex",
"conjunction",
"pocketknife",
"embezzlement",
"hyperbolized",
"racquetballs",
]
|
def foo():
'''
>>> class bad():
... pass
'''
pass
|
# -*- coding: utf-8 -*-
"""
Useful exception classes that are used to return HTTP errors.
"""
class ApiException(Exception):
"""
The base exception class for all APIExceptions.
Parameters
----------
code : str
Error code.
message : str
Human readable string describing the exception.
status_code : int
HTTP status code.
"""
def __init__(self, code: str, message: str, status_code: int):
self.code = code
self.message = message
self.status_code = status_code
class BadRequest(ApiException):
"""
Bad Request response status code indicates that the server cannot or will not
process the request due to something that is perceived to be a client error.
A common cause is that the client has sent invalid request values.
"""
def __init__(self, code: str, message: str):
super().__init__(code, message, status_code=400)
class Forbidden(ApiException):
"""
Forbidden client error status response code indicates that the server understands
the request but refuses to authorize it.
"""
def __init__(self, code: str, message: str):
super().__init__(code, message, status_code=403)
class NotFound(ApiException):
"""
Not Found client error response code indicates that the server can't find the requested resource.
A common cause is that a provided ID does not exist in the database.
"""
def __init__(self, code: str, message: str):
super().__init__(code, message, status_code=404)
class InternalServerError(ApiException):
"""
Internal Server Error server error response code indicates that the server
encountered an unexpected condition that prevented it from fulfilling the request.
This error response is a generic "catch-all" response.
You should log error responses like the 500 status code with more details about
the request to prevent the error from happening again in the future.
"""
def __init__(self, code: str, message: str):
super().__init__(code, message, status_code=500)
class ServiceUnavailable(ApiException):
"""
Service Unavailable server error response code indicates that the server is
not ready to handle the request.
A common cause is that the database is not available or overloaded.
"""
def __init__(self, code: str, message: str):
super().__init__(code, message, status_code=503)
|
class InstanceObjectManager:
def __init__(self, parent):
self.parent = parent
# All Instance Id's of instanced objects on this server.
self.localInstanceIds = set()
# Dict of {Temp Id: Instance Object}
self.tempId2iObject = {}
# Dict of {Instance Id: Instance Object}
self.instanceId2iObject = {}
# Keeps track of all instanced objects under their Parent->Zone key-pair.
self.locationDict = {}
def storeTempObject(self, tempId, iObject):
if tempId in self.tempId2iObject:
print("Warning: TempId (%s) already exists in TempId dict. Overriding." % tempId)
self.tempId2iObject[tempId] = iObject
def deleteTempObject(self, tempId):
if tempId not in self.tempId2iObject:
print("Error: Attempted to delete non-existent object with TempId (%s)" % tempId)
return
del self.tempId2iObject[tempId]
def activateTempObject(self, tempId, instanceId):
if tempId not in self.tempId2iObject:
print("Error: Attempted to activate non-existent TempId (%s)" % tempId)
return
iObject = self.tempId2iObject[tempId]
iObject.instanceId = instanceId
self.storeInstanceObject(iObject)
self.deleteTempObject(tempId)
def storeInstanceObject(self, iObject):
instanceId = iObject.instanceId
if instanceId in self.localInstanceIds:
print("Warning: Instance Object (%s) already exists in localInstanceIds. Duplicate generate or poor cleanup?" % instanceId)
if instanceId in self.instanceId2iObject:
print("Warning: Instance Object (%s) already exists in memory. Overriding." % instanceId)
# Store object in memory.
self.instanceId2iObject[instanceId] = iObject
# Store object in location.
parentId = iObject.parentId
zoneId = iObject.zoneId
parentDict = self.locationDict.setdefault(parentId, {})
zoneDict = parentDict.setdefault(zoneId, set())
zoneDict.add(iObject)
# Store the instance id as a known id.
self.localInstanceIds.add(instanceId)
def deleteInstanceObject(self, instanceId):
if (instanceId not in self.localInstanceIds) or (instanceId not in self.instanceId2iObject):
print("Error: Attempted to delete invalid Instance Object (%s)" % instanceId)
return
iObject = self.instanceId2iObject[instanceId]
# Get object location.
parentId = iObject.parentId
zoneId = iObject.zoneId
# Remove the object from memory.
del self.instanceId2iObject[instanceId]
del self.localInstanceIds[instanceId]
parentDict = self.locationDict.get(parentId)
if parentDict is None:
print("Error: Attempted to delete Instance Object (%s) with invalid parent (%s)." % (instanceId, parentId))
return
zoneDict = parentDict.get(zoneId)
if zoneDict is None:
print("Error: Attempted to delete Instance Object (%s) with invalid parent-zone pair (%s:%s)." % (instanceId, parentId, zoneId))
return
if instanceId not in zoneDict:
print("Error: Attempted to delete Instance Object (%s) that does not exist at location (%s:%s)." % (instanceId, parentId, zoneId))
return
# We can finally delete the object out of the locationDict.
del zoneDict[instanceId]
# Cleanup.
if len(zoneDict) == 0:
del parentDict[zoneId]
if len(parentDict) == 0:
del self.locationDict[parentId]
def getInstanceObjects(self, parentId, zoneId=None):
parent = self.locationDict.get(parentId)
if parent is None:
return []
# If no zoneId is specified, return all child objects of the parent.
if zoneId is None:
children = []
for zone in parent.values():
for iObject in zone:
children.append(iObject)
# If we have a specific zoneId, return all objects under that zone.
else:
children = parent.get(zoneId, [])
return children
|
"""
File: complement.py
Name: 張文銓
----------------------------
This program uses string manipulation to
tackle a real world problem - finding the
complement strand of a DNA sequence.
THe program asks uses for a DNA sequence as
a python string that is case-insensitive.
Your job is to output the complement of it.
"""
def main():
build_complement()
def build_complement():
d = input("Please give me a DNA strand and I'll find the complement: ")
new_d = ""
for i in range(len(d)):
char = d[i]
if char.islower:
new_d += char.upper()
else:
new_d += char
ans = ""
for i in range(len(new_d)):
char = new_d[i]
if char == 'A':
ans = ans + 'T'
elif char == 'T':
ans = ans + 'A'
elif char == 'C':
ans = ans + 'G'
elif char == 'G':
ans = ans + 'C'
print("The complement of " + d + " is " + ans)
# DO NOT EDIT CODE BELOW THIS LINE ######
if __name__ == '__main__':
main()
|
def append(list1, list2):
pass
def concat(lists):
pass
def filter(function, list):
pass
def length(list):
pass
def map(function, list):
pass
def foldl(function, list, initial):
pass
def foldr(function, list, initial):
pass
def reverse(list):
pass
|
class Solution:
def rob(self, nums: List[int]) -> int:
def dp(i: int) -> int:
if i == 0:
return nums[0]
if i == 1:
return max(nums[0], nums[1])
if i not in memo:
memo[i] = max(dp(i-1), nums[i]+dp(i-2))
return memo[i]
memo = {}
return dp(len(nums)-1)
|
#!/usr/bin/env python3
###############################################################################
# Copyright 2018 The Apollo Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
###############################################################################
def segment_overlap(a, b, x, y):
if b < x or a > y:
return False
return True
def vector_projection_overlap(p0, p1, p2, p3):
v = p1.subtract(p0)
n_square = v.norm_square()
v0 = p2.subtract(p0)
v1 = p3.subtract(p0)
t0 = v0.dot(v)
t1 = v1.dot(v)
if t0 > t1:
t = t0
t0 = t1
t1 = t
return segment_overlap(t0, t1, 0.0, n_square)
|
class Matrix:
def transpose(self, matrix):
return list(zip(*matrix))
def column(self, matrix, i):
return [row[i] for row in matrix]
|
class Solution:
def flipLights(self, n, m):
"""
:type n: int
:type m: int
:rtype: int
"""
if n == 1:
return 1 if m == 0 else 2
if m == 0:
return 1
elif m & 1:
if m == 1:
return 3 if n <= 2 else 4
else:
return 4 if n <= 2 else 8
else:
if m == 2:
return 4 if n <= 2 else 7
else:
return 4 if n <= 2 else 8
|
#!/usr/bin/env python3
"""
PartBuilder exception for part builder errors
"""
class PartBuilderException(Exception):
"""
Raised by PartBuilder functions when things go wrong
"""
pass
|
def create_histo_table(dataname, dimPerfMap, lines, histoLambda, meanLambda, subsectitle, header):
colPairs = len(dimPerfMap)
colspecs = '|c|c|' * colPairs
lines.append("\\begin{table}[H]")
lines.append("\centering")
lines.append("\caption{%s: %s}" % (subsectitle, header))
lines.append("\\begin{adjustbox}{width=1\\textwidth}")
lines.append("\\begin{tabular}{ %s }" % colspecs)
lines.append("\hline")
lines.append("\multicolumn{%s}{|c|}{%s} \\\\" % (str(colPairs * 2), header))
lines.append("\hline")
tmpl0 = "\multicolumn{2}{|c||}{%s}"
tmpl = "\multicolumn{2}{c||}{%s}"
tmplN = "\multicolumn{2}{c|}{%s}"
dimcols = []
idx = 0
for M,N in sorted(dimPerfMap):
if idx == 0:
tmplVal = tmpl0 % ("%s-%s" % (dataname, M))
elif idx == len(dimPerfMap) - 1:
tmplVal = tmplN % ("%s-%s" % (dataname, M))
else:
tmplVal = tmpl % ("%s-%s" % (dataname, M))
dimcols.append(tmplVal)
idx += 1
lines.append(" & ".join(dimcols) + "\\\\")
lines.append("\hline")
dimcols = []
idx = 0
for M,N in sorted(dimPerfMap):
if idx == 0:
tmplVal = tmpl0 % ("m = %d, gc = %d" % (M,N))
elif idx == len(dimPerfMap) - 1:
tmplVal = tmplN % ("m = %d, gc = %d" % (M,N))
else:
tmplVal = tmpl % ("m = %d, gc = %d" % (M,N))
dimcols.append(tmplVal)
idx += 1
lines.append(" & ".join(dimcols) + "\\\\")
lines.append("\hline")
lineArr = ["f($\\bar{x}$) & N" for i in range(colPairs)]
lines.append(" & ".join(lineArr) + "\\\\")
lines.append("\hline")
lines.append("\hline")
ROWLIMIT = 8
tableData = [[" " for j in range(colPairs*2)] for idx in range(ROWLIMIT)]
idx = 0
for M,N in sorted(dimPerfMap):
dimPerf = dimPerfMap[(M,N)]
j = 0
maxN = -float('inf')
maxNIdx = -1
maxN_f = -1
for (f,N) in histoLambda(dimPerf):
if N > maxN:
maxN = N
maxNIdx = j
maxN_f = f
if j < ROWLIMIT:
tableData[j][idx] = str(f)
tableData[j][idx+1] = str(N)
j+= 1
# Overwrite first row with max
tableData[0][idx] = str(maxN_f)
tableData[0][idx+1] = str(maxN)
idx += 2
maxStatRow = tableData[0]
lines.append(" & ".join(maxStatRow) + "\\\\")
lines.append("\hline")
for tableRow in tableData:
lines.append(" & ".join(tableRow) + "\\\\")
lines.append("\hline")
dimcols = []
idx = 0
summary = []
for M,N in sorted(dimPerfMap):
dimPerf = dimPerfMap[(M,N)]
if idx == 0:
tmplVal = tmpl0 % ("\\^{f} = %s" % str(meanLambda(dimPerf)))
elif idx == len(dimPerfMap) - 1:
tmplVal = tmplN % ("\\^{f} = %s" % str(meanLambda(dimPerf)))
else:
tmplVal = tmpl % ("\\^{f} = %s" % str(meanLambda(dimPerf)))
dimcols.append(tmplVal)
score = str(meanLambda(dimPerf))
summary.append([str(M), str(N), score])
idx += 1
lines.append(" & ".join(dimcols) + "\\\\")
lines.append("\hline")
lines.append("\end{tabular}")
lines.append("\end{adjustbox}")
lines.append("\\end{table}")
return summary
def create_tables(dataname, dimPerfMap, lines, subsectitle):
retSummary = []
# lines.append("\subsubsection{DATA:%s | FITNESS}" % (dataname.upper()))
histoLambda = lambda dimPerf: dimPerf.scoreFitnessHisto
meanLambda = lambda dimPerf: dimPerf.scoreFitnessMean
summary = create_histo_table(dataname, dimPerfMap, lines, histoLambda, meanLambda, subsectitle, header = "%s - fitness" % dataname)
retSummary = retSummary + [['fitness', summ[0], summ[1], summ[2]] for summ in summary] # M,N,score
# lines.append("\subsubsection{DATA:%s | SELF}" % (dataname.upper()))
histoLambda = lambda dimPerf: dimPerf.scoreSelfHisto
meanLambda = lambda dimPerf: dimPerf.scoreSelfMean
summary = create_histo_table(dataname, dimPerfMap, lines, histoLambda, meanLambda, subsectitle, header = "%s - self" % dataname)
retSummary = retSummary + [['pscore', summ[0], summ[1], summ[2]] for summ in summary] # M,N,score
# lines.append("\subsubsection{DATA:%s | COMPETE}" % (dataname.upper()))
histoLambda = lambda dimPerf: dimPerf.scoreCompeteHisto
meanLambda = lambda dimPerf: dimPerf.scoreCompeteMean
summary = create_histo_table(dataname, dimPerfMap, lines, histoLambda, meanLambda, subsectitle, header = "%s - compete" % dataname)
retSummary = retSummary + [['cscore', summ[0], summ[1], summ[2]] for summ in summary] # M,N,score
return retSummary
def latexify(perfMap):
'''
('rouletteWheel', 'crossover_1p') / (10, 10, 'auth'): (stat.scoreCompeteHisto: [(1.0, 9), (0.9, 1)], stat.scoreCompeteMean: 0.99, stat.scoreSelfHisto: [(0.0, 10)], stat.scoreSelfMean: 0.0, stat.scoreFitnessHisto: [(4.3463447172747323, 1), (7.948375686832958, 1), (3.9489350437230737, 1), (0.34958729407625033, 1), (0.81301756889153154, 1), (3.2477890015590951, 1), (3.581170550257939, 2), (-0.062549850063921664, 2)], stat.scoreFitnessMean: 2.76912907127)
Table template:
\begin{tabular}{ |c|c||c|c| }
\hline
\multicolumn{2}{|c||}{col1} & \multicolumn{2}{c|}{col2}\\
\hline
\multicolumn{2}{|c||}{m = 10, gc = 10} & \multicolumn{2}{c|}{m = 10, gc = 20}\\
\hline
f($\bar{x}$) & N & f($\bar{x}$) & N \\
\hline
\hline
100 & 10 & 200 & 20 \\
\hline
100 & 10 & 200 & 20 \\
100 & 10 & 200 & 20 \\
100 & 10 & 200 & 20 \\
100 & 10 & 200 & 20 \\
\hline
\multicolumn{2}{|c||}{\^{f} = 150} & \multicolumn{2}{c|}{\^{f} = 15}\\
\hline
\end{tabular}
'''
lines = []
retSummary = []
for (select, xover), perf1 in perfMap.items():
subsectitle = "SELECTION: %s; CROSSOVER: %s" % (select.upper().replace('_', '-'), xover.upper().replace('CROSSOVER', '').replace('_', ''))
lines.append("\subsection{%s}" % subsectitle)
dataPerfs = dict()
for (M,N,dataname), perf2 in perf1.items():
k = (M,N)
if dataname not in dataPerfs:
dataPerfs[dataname] = dict()
dataPerfs[dataname][k] = perf2
for dataname, dimPerfMap in dataPerfs.items():
dataname = dataname.upper().replace('_', '-')
summary = create_tables(dataname, dimPerfMap, lines, subsectitle)
select = select.upper().replace('_', '-')
xover = xover.upper().replace('CROSSOVER', '').replace('_', '')
retSummary = retSummary + [[select, xover, dataname, summ[0], summ[1], summ[2], summ[3]] for summ in summary] # metric, M,N,score
print("\n".join(lines))
return retSummary
def select_best(summary):
'''
select best by dataname, metric
'''
summMap = dict()
for summ in summary:
(select,xover,dataname,metric,M,N,score) = (summ[0], summ[1], summ[2], summ[3], summ[4], summ[5], summ[6])
if (dataname, metric) not in summMap:
summMap[(dataname, metric)] = []
summMap[(dataname, metric)].append((summ, score))
ret = []
for (dataname, metric), summArr in summMap.items():
summArrSorted = sorted(summArr, reverse=True, key=lambda kv: kv[1])
ret.append(summArrSorted[0][0])
ret = sorted(ret, key = lambda arr: (arr[2], arr[3])) #sort by dataname, metric
return ret
def summaryTable(summary):
summary = select_best(summary)
header = ['select', 'xover', 'dataname', 'metric', 'M', 'N', 'score']
colspecs = "|c|c|c|c|c|c|c|"
lines = []
lines.append("\\begin{table}[H]")
lines.append("\centering")
lines.append("\caption{SUMMARY}")
lines.append("\\begin{adjustbox}{width=1\\textwidth}")
lines.append("\\begin{tabular}{ %s }" % colspecs)
lines.append("\hline")
lines.append(" & ".join(header) + "\\\\")
lines.append("\hline")
for summ in summary:
lines.append("\hline")
lines.append(" & ".join(summ) + "\\\\")
lines.append("\hline")
lines.append("\end{tabular}")
lines.append("\end{adjustbox}")
lines.append("\\end{table}")
print("\n".join(lines))
|
#!/usr/bin/python
FILENAME="arr1new.txt"
def matrix2column(filename):
"""
@filename: a file contains data format looks like
<string1: value01, value02, .....>
<string2: value11, value12, .....>
return: a list looks like
[value01, value11, ......, value02, value12......]
"""
data_list = []
for item in open(filename, 'r'):
item = item.strip()
item = item.split('\t')
if item != '':
try:
for element in item:
data_list.append(float(element))
except ValueError:
pass
return data_list
if __name__ == '__main__':
file_2_write = open(FILENAME + ".matrix2column", 'w')
data_list = matrix2column(FILENAME)
for item in data_list:
file_2_write.write(str(item)+"\n")
|
print('-' * 30)
print('BANCO DO BRASILEIRO')
print('-' * 30)
valor = int(input('Qual valor você quer sacar? R$ '))
valorRestante = valor
valores = [50, 20, 10, 1]
for i in valores:
if valorRestante // i > 0:
print(f'Total de {valorRestante // i} cédulas de R${str(i)}')
valorRestante = valorRestante % i
|
example_schema_array = {"type": "array", "items": {"type": "string"}}
example_array = ["string"]
example_schema_integer = {"type": "integer", "minimum": 3, "maximum": 5}
example_integer = 3
example_schema_number = {"type": "number", "minimum": 3, "maximum": 5}
example_number = 3.2
example_schema_object = {"type": "object", "properties": {"value": {"type": "integer"}}, "required": ["value"]}
example_object = {"value": 1}
example_schema_string = {"type": "string", "minLength": 3, "maxLength": 5}
example_string = "str"
example_response_types = [example_array, example_integer, example_number, example_object, example_string]
example_schema_types = [
example_schema_array,
example_schema_integer,
example_schema_number,
example_schema_object,
example_schema_string,
]
|
# -*- coding: utf-8 -*-
# @Time : 2018/11/21 16:31
# @Author : Xiao
# 基础需求:
# 让用户输入用户名密码
# 认证成功后显示欢迎信息
# 输错三次后退出程序
users = {"alex":123456,'Miller':654321,"Xiaogang":"123654"}
count = 3
while count > 0:
user = input("Your name :\n").strip()
pwd = input("Password :\n").strip()
if user in users and pwd == str(users.get(user)):
print("欢迎%s登陆系统".center(50,"*")%user)
break
else:
if count == 1:
print("错误次数达到3次,已被锁定".center(50, "*"))
else:
print("用户名或密码有误,请重新输入".center(50, "*"))
count -= 1
# 升级需求:
# 可以支持多个用户登录 (提示,通过列表存多个账户信息)
# 用户3次认证失败后,退出程序,再次启动程序尝试登录时,还是锁定状态(提示:需把用户锁定的状态存到文件里)
users = {"alex":123456,'Miller':654321,"Xiaogang":"123654"}
count = 3
with open("user.txt", "a+", encoding="utf-8") as f:
f.seek(0)
lock_users = f.read().splitlines()
while count > 0:
user = input("Your name :\n").strip()
pwd = input("Password :\n").strip()
if user not in lock_users:
if user in users and pwd == str(users.get(user)):
print("欢迎%s登陆系统".center(50,"*")%user)
break
else:
if count == 1:
print("错误次数达到3次,已被锁定".center(50, "*"))
with open("user.txt","a+",encoding="utf-8") as f:
f.write(user+"\n")
else:
print("用户名或密码有误,请重新输入".center(50, "*"))
count -= 1
else:
print("用户被锁定,请联系管理员解锁!".center(50, "*"))
break
|
# region headers
# escript-template v20190611 / stephane.bourdeaud@nutanix.com
# * author: MITU Bogdan Nicolae (EEAS-EXT) <Bogdan-Nicolae.MITU@ext.eeas.europa.eu>
# * stephane.bourdeaud@emeagso.lab
# * version: 2019/09/18
# task_name: CalmSetProjectOwner
# description: Given a Calm project UUID, updates the owner reference section
# in the metadata.
# endregion
#region capture Calm variables
username = "@@{pc.username}@@"
username_secret = "@@{pc.secret}@@"
api_server = "@@{pc_ip}@@"
nutanix_calm_user_uuid = "@@{nutanix_calm_user_uuid}@@"
nutanix_calm_user_upn = "@@{calm_username}@@"
project_uuid = "@@{project_uuid}@@"
#endregion
#region prepare api call (get project)
api_server_port = "9440"
api_server_endpoint = "/api/nutanix/v3/projects_internal/{}".format(project_uuid)
url = "https://{}:{}{}".format(
api_server,
api_server_port,
api_server_endpoint
)
method = "GET"
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
#endregion
#region make the api call (get project)
print("Making a {} API call to {}".format(method, url))
resp = urlreq(
url,
verb=method,
auth='BASIC',
user=username,
passwd=username_secret,
headers=headers,
verify=False
)
# endregion
#region process the results (get project)
if resp.ok:
print("Successfully retrieved project details for project with uuid {}".format(project_uuid))
project_json = json.loads(resp.content)
else:
#api call failed
print("Request failed")
print("Headers: {}".format(headers))
print('Status code: {}'.format(resp.status_code))
print('Response: {}'.format(json.dumps(json.loads(resp.content), indent=4)))
exit(1)
# endregion
#region prepare api call (update project with acp)
api_server_port = "9440"
api_server_endpoint = "/api/nutanix/v3/projects_internal/{}".format(project_uuid)
url = "https://{}:{}{}".format(
api_server,
api_server_port,
api_server_endpoint
)
method = "PUT"
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
# Compose the json payload
#removing stuff we don't need for the update
project_json.pop('status', None)
project_json['metadata'].pop('create_time', None)
#updating values
project_json['metadata']['owner_reference']['uuid'] = nutanix_calm_user_uuid
project_json['metadata']['owner_reference']['name'] = nutanix_calm_user_upn
for acp in project_json['spec']['access_control_policy_list']:
acp["operation"] = "ADD"
payload = project_json
#endregion
#region make the api call (update project with acp)
print("Making a {} API call to {}".format(method, url))
resp = urlreq(
url,
verb=method,
auth='BASIC',
user=username,
passwd=username_secret,
params=json.dumps(payload),
headers=headers,
verify=False
)
#endregion
#region process the results (update project with acp)
if resp.ok:
print("Successfully updated the project owner reference to {}".format(nutanix_calm_user_upn))
exit(0)
else:
#api call failed
print("Request failed")
print("Headers: {}".format(headers))
print("Payload: {}".format(json.dumps(payload)))
print('Status code: {}'.format(resp.status_code))
print('Response: {}'.format(json.dumps(json.loads(resp.content), indent=4)))
exit(1)
#endregion
|
class TCPControlFlags():
def __init__(self):
'''Control Bits govern the entire process of connection establishment, data transmissions and connection termination. The control bits are listed as follows, they are'''
'''It indicates if we need to use Urgent pointer field or not. If it is set to 1 then only we use Urgent pointer.'''
self.URG = 0x0
'''It is set when an acknowledgement is being sent to the sender.'''
self.ACK = 0x0
'''When the bit is set, it tells the receiving TCP module to pass the data to the application immediately.'''
self.PSH = 0x0
'''When the bit is set, it aborts the connection. It is also used as a negative acknowledgement against a connection request.'''
self.RST = 0x0
'''It is used during the initial establishment of a connection. It is set when synchronizing process is initiated.'''
self.SYN = 0x0
'''The bit indicates that the host that sent the FIN bit has no more data to send.'''
self.FIN = 0x0
|
def isPalindrome(string):
if len(string) <= 1:
return True
else:
return string[0] == string[-1] and isPalindrome(string[1:-1])
userInput = input("Please enter a sequence to check if it is an palindrome: ")
answer = isPalindrome(userInput)
print("Is '" + userInput + "' an palindrome? " + str(answer))
|
dia=input ('Qual é o dia que você nasceu?')
mês=input ('Qual é o mês que você nasceu?')
ano=input ('Qual é o ano que você nasceu?')
|
def gen_binary(control, n1, n2, prefix):
if n1 == 0 and n2 == 0:
print(prefix)
else:
if n1 > 0:
gen_binary(control + 1, n1 - 1, n2, prefix + "(")
if control > 0 and n2 > 0:
gen_binary(control - 1, n1, n2 - 1, prefix + ")")
def read_input():
n = int(input())
control = 0
n1 = n
n2 = n
return n, control, n1, n2
def main():
n, control, n1, n2 = read_input()
gen_binary(control, n1, n2, "")
if __name__ == "__main__":
main()
# https://neerc.ifmo.ru/wiki/index.php?title=Правильные_скобочные_последовательности
|
#! /usr/bin/env python3
#
# === This file is part of Calamares - <https://calamares.io> ===
#
# SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org>
# SPDX-License-Identifier: BSD-2-Clause
#
"""
Python3 script to scrape some data out of zoneinfo/zone.tab.
To use this script, you must have a zone.tab in a standard location,
/usr/share/zoneinfo/zone.tab (this is usual on FreeBSD and Linux).
Prints out a few tables of zone names for use in translations.
"""
def scrape_file(file, regionset, zoneset):
for line in file.readlines():
if line.startswith("#"):
continue
parts = line.split("\t")
if len(parts) < 3:
continue
zoneid = parts[2]
if not "/" in zoneid:
continue
region, zone = zoneid.split("/", 1)
zone = zone.strip().replace("_", " ")
regionset.add(region)
assert(zone not in zoneset)
zoneset.add(zone)
def write_set(file, label, set):
file.write("/* This returns a reference to local, which is a terrible idea.\n * Good thing it's not meant to be compiled.\n */\n")
# Note {{ is an escaped { for Python string formatting
file.write("static const QStringList& {!s}_table()\n{{\n\treturn QStringList {{\n".format(label))
for x in sorted(set):
file.write("""\t\tQObject::tr("{!s}", "{!s}"),\n""".format(x, label))
file.write("\t\tQString()\n\t};\n}\n\n")
cpp_header_comment = """/* GENERATED FILE DO NOT EDIT
*
* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2009 Arthur David Olson
* SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: CC0-1.0
*
* This file is derived from zone.tab, which has its own copyright statement:
*
* This file is in the public domain, so clarified as of
* 2009-05-17 by Arthur David Olson.
*
* From Paul Eggert (2018-06-27):
* This file is intended as a backward-compatibility aid for older programs.
* New programs should use zone1970.tab. This file is like zone1970.tab (see
* zone1970.tab's comments), but with the following additional restrictions:
*
* 1. This file contains only ASCII characters.
* 2. The first data column contains exactly one country code.
*
*/
/** THIS FILE EXISTS ONLY FOR TRANSLATIONS PURPOSES **/
// *INDENT-OFF*
// clang-format off
"""
if __name__ == "__main__":
regions=set()
zones=set()
with open("/usr/share/zoneinfo/zone.tab", "r") as f:
scrape_file(f, regions, zones)
with open("ZoneData_p.cpp", "w") as f:
f.write(cpp_header_comment)
write_set(f, "tz_regions", regions)
write_set(f, "tz_names", zones)
|
N = int(input())
A = [int(n) for n in input().split()]
Aset = set(A)
m = (10**9+7)
o = {}
ans = []
for a in A:
o.setdefault(a, 0)
o[a] += 1
for i in range(len(Aset)-1):
for j in range(i+1, len(Aset)):
ans.append((A[i]^A[j])*o[A[i]]*o[A[j]])
print(sum(ans)/m)
|
# DOWNLOADER_MIDDLEWARES = {}
# DOWNLOADER_MIDDLEWARES.update({
# 'scrapy.downloadermiddlewares.httpcache.HttpCacheMiddleware': None,
# 'scrapy_httpcache.downloadermiddlewares.httpcache.AsyncHttpCacheMiddleware': 900,
# })
HTTPCACHE_STORAGE = 'scrapy_httpcache.extensions.httpcache_storage.MongoDBCacheStorage'
HTTPCACHE_MONGODB_HOST = '127.0.0.1'
HTTPCACHE_MONGODB_PORT = 27017
HTTPCACHE_MONGODB_USERNAME = None
HTTPCACHE_MONGODB_PASSWORD = None
HTTPCACHE_MONGODB_AUTH_DB = None
HTTPCACHE_MONGODB_DB = 'cache_storage'
HTTPCACHE_MONGODB_COLL = 'cache'
HTTPCACHE_MONGODB_COLL_INDEX = [[('fingerprint', 1)]]
HTTPCACHE_MONGODB_CONNECTION_POOL_KWARGS = {}
BANNED_STORAGE = 'scrapy_httpcache.extensions.banned_storage.MongoBannedStorage'
BANNED_MONGODB_COLL = 'banned'
BANNED_MONGODB_COLL_INDEX = [[('fingerprint', 1)]]
REQUEST_ERROR_STORAGE = 'scrapy_httpcache.extensions.request_error_storage.MongoRequestErrorStorage'
REQUEST_ERROR_MONGODB_COLL = 'request_error'
REQUEST_ERROR_MONGODB_COLL_INDEX = [[('fingerprint', 1)]]
|
def flatten(aList):
myList = []
for el in aList:
if isinstance(el, list) or isinstance(el, tuple):
myList.extend(flatten(el))
else:
myList.append(el)
return myList
|
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def zlib():
if "zlib" not in native.existing_rules():
http_archive(
name = "zlib",
build_file = "//third_party/zlib:zlib.BUILD",
sha256 = "91844808532e5ce316b3c010929493c0244f3d37593afd6de04f71821d5136d9",
strip_prefix = "zlib-1.2.12",
url = "https://zlib.net/zlib-1.2.12.tar.gz",
)
|
class Sampler(object):
def __init__(self):
self._params = None
self._dim = None
self._iteration = 0
def setParameters(self, params):
self._params = params
self._dim = params.getStochasticDim()
def nextSamples(self, *args, **kws):
raise NotImplementedError()
def learnData(self, *args, **kws):
raise NotImplementedError()
def hasMoreSamples(self):
raise NotImplementedError()
|
class Trie:
def __init__(self):
"""
Initialize your data structure here.
"""
self.main_trie = dict()
def insert(self, word: str) -> None:
"""
Inserts a word into the trie.
"""
nav = self.main_trie
#print(f"Inserting {word}")
for c in word:
if c in nav:
nav = nav[c]
else:
nav[c] = dict()
nav = nav[c]
# is it word (?)
nav[True] = True
def search(self, word: str) -> bool:
"""
Returns if the word is in the trie.
"""
nav = self.main_trie
for c in word:
if c in nav:
nav = nav[c]
continue
return False
return True in nav
def startsWith(self, prefix: str) -> bool:
"""
Returns if there is any word in the trie that starts with the given prefix.
"""
nav = self.main_trie
for c in prefix:
if c in nav:
nav = nav[c]
continue
return False
return True
# Trie object should be instantiated and called as such:
# obj = Trie()
# obj.insert(word)
# param_2 = obj.search(word) # search for word in trie
# param_3 = obj.startsWith(prefix) # return true if word exists in Trie
|
#
def calcula_investimento(inv, mes, tipo):
# seleciona tipo de investimento
# CDB
if tipo == 'CDB':
for i in range(1, mes + 1):
inv = inv * 1.013
if i % 6 == 0:
inv = inv * 1.012
# LCI
elif tipo == 'LCI':
inv = inv*1.016**(mes)
'''for i in range(1, mes + 1):
inv = inv * 1.016'''
# LCA
else:
for i in range(1, mes + 1):
inv = inv * 1.0145
if i % 4 == 0:
inv = inv * 1.01
return inv
|
#!/usr/bin/env python3
def collatz(x):
if x <= 0:
raise ValueError("Collatz has become 0")
if (x % 2) == 0:
return x/2
else:
return 3*x+1
if __name__ == "__main__":
number = 10
print("Ausgangszahl: ", number)
iteration = 0
while True:
number = collatz(number)
iteration += 1
print("Iteration ", iteration, ": ", number)
input("")
|
'''
256 definitions cause LOAD_NAME and LOAD_CONST to both require EXTENDED_ARGS.
Generated with: `for i in range(0, 0xff, 0x10): print(*[f'x{j:02x}=0x{j:02x}' for j in range(i, i+0x10)], sep='; ')`
'''
x00=0x00; x01=0x01; x02=0x02; x03=0x03; x04=0x04; x05=0x05; x06=0x06; x07=0x07; x08=0x08; x09=0x09; x0a=0x0a; x0b=0x0b; x0c=0x0c; x0d=0x0d; x0e=0x0e; x0f=0x0f
x10=0x10; x11=0x11; x12=0x12; x13=0x13; x14=0x14; x15=0x15; x16=0x16; x17=0x17; x18=0x18; x19=0x19; x1a=0x1a; x1b=0x1b; x1c=0x1c; x1d=0x1d; x1e=0x1e; x1f=0x1f
x20=0x20; x21=0x21; x22=0x22; x23=0x23; x24=0x24; x25=0x25; x26=0x26; x27=0x27; x28=0x28; x29=0x29; x2a=0x2a; x2b=0x2b; x2c=0x2c; x2d=0x2d; x2e=0x2e; x2f=0x2f
x30=0x30; x31=0x31; x32=0x32; x33=0x33; x34=0x34; x35=0x35; x36=0x36; x37=0x37; x38=0x38; x39=0x39; x3a=0x3a; x3b=0x3b; x3c=0x3c; x3d=0x3d; x3e=0x3e; x3f=0x3f
x40=0x40; x41=0x41; x42=0x42; x43=0x43; x44=0x44; x45=0x45; x46=0x46; x47=0x47; x48=0x48; x49=0x49; x4a=0x4a; x4b=0x4b; x4c=0x4c; x4d=0x4d; x4e=0x4e; x4f=0x4f
x50=0x50; x51=0x51; x52=0x52; x53=0x53; x54=0x54; x55=0x55; x56=0x56; x57=0x57; x58=0x58; x59=0x59; x5a=0x5a; x5b=0x5b; x5c=0x5c; x5d=0x5d; x5e=0x5e; x5f=0x5f
x60=0x60; x61=0x61; x62=0x62; x63=0x63; x64=0x64; x65=0x65; x66=0x66; x67=0x67; x68=0x68; x69=0x69; x6a=0x6a; x6b=0x6b; x6c=0x6c; x6d=0x6d; x6e=0x6e; x6f=0x6f
x70=0x70; x71=0x71; x72=0x72; x73=0x73; x74=0x74; x75=0x75; x76=0x76; x77=0x77; x78=0x78; x79=0x79; x7a=0x7a; x7b=0x7b; x7c=0x7c; x7d=0x7d; x7e=0x7e; x7f=0x7f
x80=0x80; x81=0x81; x82=0x82; x83=0x83; x84=0x84; x85=0x85; x86=0x86; x87=0x87; x88=0x88; x89=0x89; x8a=0x8a; x8b=0x8b; x8c=0x8c; x8d=0x8d; x8e=0x8e; x8f=0x8f
x90=0x90; x91=0x91; x92=0x92; x93=0x93; x94=0x94; x95=0x95; x96=0x96; x97=0x97; x98=0x98; x99=0x99; x9a=0x9a; x9b=0x9b; x9c=0x9c; x9d=0x9d; x9e=0x9e; x9f=0x9f
xa0=0xa0; xa1=0xa1; xa2=0xa2; xa3=0xa3; xa4=0xa4; xa5=0xa5; xa6=0xa6; xa7=0xa7; xa8=0xa8; xa9=0xa9; xaa=0xaa; xab=0xab; xac=0xac; xad=0xad; xae=0xae; xaf=0xaf
xb0=0xb0; xb1=0xb1; xb2=0xb2; xb3=0xb3; xb4=0xb4; xb5=0xb5; xb6=0xb6; xb7=0xb7; xb8=0xb8; xb9=0xb9; xba=0xba; xbb=0xbb; xbc=0xbc; xbd=0xbd; xbe=0xbe; xbf=0xbf
xc0=0xc0; xc1=0xc1; xc2=0xc2; xc3=0xc3; xc4=0xc4; xc5=0xc5; xc6=0xc6; xc7=0xc7; xc8=0xc8; xc9=0xc9; xca=0xca; xcb=0xcb; xcc=0xcc; xcd=0xcd; xce=0xce; xcf=0xcf
xd0=0xd0; xd1=0xd1; xd2=0xd2; xd3=0xd3; xd4=0xd4; xd5=0xd5; xd6=0xd6; xd7=0xd7; xd8=0xd8; xd9=0xd9; xda=0xda; xdb=0xdb; xdc=0xdc; xdd=0xdd; xde=0xde; xdf=0xdf
xe0=0xe0; xe1=0xe1; xe2=0xe2; xe3=0xe3; xe4=0xe4; xe5=0xe5; xe6=0xe6; xe7=0xe7; xe8=0xe8; xe9=0xe9; xea=0xea; xeb=0xeb; xec=0xec; xed=0xed; xee=0xee; xef=0xef
xf0=0xf0; xf1=0xf1; xf2=0xf2; xf3=0xf3; xf4=0xf4; xf5=0xf5; xf6=0xf6; xf7=0xf7; xf8=0xf8; xf9=0xf9; xfa=0xfa; xfb=0xfb; xfc=0xfc; xfd=0xfd; xfe=0xfe; xff=0xff
cond = False
for i in range(2):
if i:
continue
def main(): pass
if __name__ == '__main__': main()
|
# This function tells a user whether or not a number is prime
def isPrime(number):
# this will tell us if the number is prime, set to True automatically
# We will set to False if the number is divisible by any number less than it
number_is_prime = True
# loop over all numbers less than the input number
for i in range(2, number):
# calculate the remainder
remainder = number % i
# if the remainder is 0, then the number is not prime by definition!
if remainder == 0:
number_is_prime = False
# return result to the user
return number_is_prime
|
class Solution:
def longestCommonSubstring(self, a, b):
matrix = [[0 for _ in range(len(b))] for _ in range((len(a)))]
z = 0
ret = []
for i in range(len(a)):
for j in range(len(b)):
if a[i] == b[j]:
if i == 0 or j == 0:
matrix[i][j] = 1
else:
matrix[i][j] = matrix[i - 1][j - 1] + 1
if matrix[i][j] > z:
z = matrix[i][j]
ret = [a[i - z + 1: i + 1]]
elif matrix[i][j] == z:
ret.append(a[i - z + 1: i + 1])
else:
matrix[i][j] = 0
return ret
sol = Solution()
a = 'caba'
b = 'caba'
res = sol.longestCommonSubstring(a, b)
print(res)
a = 'wallacetambemsechamafelipecujosobrenomeficafranciscoecardosotambem'
b = 'euwallacefelipefranciscocardososoucientista'
res = sol.longestCommonSubstring(a, b)
print(res)
|
class Geladeira:
def __init__(self, alimentos=None):
"""
Estrutura principal formada por um dicionário self.alimentos em que as chaves são os nomes dos alimentos e os
valores são listas que contém o objeto Comida e a sua quantidade na geladeira.
{'nome_alimento': [Comida, quantidade]}
"""
if alimentos is None:
alimentos = {}
self.alimentos = alimentos
def __str__(self):
s = ''
comidas = sorted([valor[0] for valor in self.alimentos.values()], reverse=True)
for comida in comidas:
f = self.alimentos[comida.nome]
s += '|' + f'{f[1]}'.center(6) + '|' + str(f[0]) + '|\n'
return s
def __getitem__(self, name):
return self.alimentos[name]
def add_comida(self, comida, quantidade=1):
"""Adiciona uma determinada quantidade da Comida."""
try:
self.alimentos[comida.nome][1] += quantidade
except KeyError:
self.alimentos[comida.nome] = [comida, quantidade]
def pegar_comida(self, comida):
"""Diminui em 1 a quantidade da Comida ou a remove da geladeira."""
self.alimentos[comida.nome][1] -= 1
if self.alimentos[comida.nome][1] == 0:
del self.alimentos[comida.nome]
def tem_comida(self, comida):
"""Verifica se a Comida está na geladeira."""
return comida.nome in self.alimentos.keys()
def mostrar_comidas(self, comida=None):
"""Imprime uma Comida em específico e sua quantidade, ou todos os alimentos na geladeira."""
if not comida:
print(self)
else:
f = self.alimentos[comida.nome]
print(f'{f[1]}x {f[0]}')
def comida_por_classe(self):
c = {}
for val in self.alimentos.values():
comida = val[0]
try:
c[comida.__class__.__name__].append(comida)
except KeyError:
c[comida.__class__.__name__] = [comida]
return c
def comidasort(self):
c = self.comida_por_classe()
aux = []
for key in sorted(c.keys(), key=len, reverse=True):
aux += sorted(c[key], reverse=True)
return aux
|
# Copyright (c) 2020 The Khronos Group 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 law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
def _split_counter_from_name(str):
if len(str) > 0 and not str[-1].isdigit():
return str, None
i = len(str)
while i > 0:
if not str[i-1].isdigit():
return str[:i], int(str[i:])
i -= 1
return None, int(str)
def generate_tensor_names_from_op_type(graph, keep_io_names=False):
used_names = set()
if keep_io_names:
used_names.update(tensor.name for tensor in graph.inputs if tensor.name is not None)
used_names.update(tensor.name for tensor in graph.outputs if tensor.name is not None)
op_counts = {}
for op in graph.operations:
for tensor in op.outputs:
if keep_io_names and tensor.name is not None and (tensor in graph.inputs or tensor in graph.outputs):
continue
idx = op_counts.get(op.type, 0) + 1
while op.type + str(idx) in used_names:
idx += 1
op_counts[op.type] = idx
tensor.name = op.type + str(idx)
for tensor in graph.tensors:
if tensor.producer is None:
tensor.name = None
def generate_missing_tensor_names_from_op_type(graph):
counters = {}
for tensor in graph.tensors:
if tensor.name is not None:
name, count = _split_counter_from_name(tensor.name)
if name is not None and count is not None:
counters[name] = max(counters.get(name, 0), count)
for tensor in graph.tensors:
if tensor.name is None and tensor.producer is not None:
op = tensor.producer
idx = counters.get(op.type, 0) + 1
counters[op.type] = idx
tensor.name = op.type + str(idx)
def generate_op_names_from_op_type(graph):
op_counts = {}
for op in graph.operations:
idx = op_counts.get(op.type, 0) + 1
op_counts[op.type] = idx
op.name = op.type + str(idx)
def replace_tensor_in_graph_inputs(graph, old_tensor, new_tensor):
graph.inputs = [new_tensor if t is old_tensor else t for t in graph.inputs]
def replace_tensor_in_graph_outputs(graph, old_tensor, new_tensor):
graph.outputs = [new_tensor if t is old_tensor else t for t in graph.outputs]
def replace_tensor_in_consumers(graph, old_tensor, new_tensor):
for consumer in list(old_tensor.consumers): # copy list to avoid changes during iteration
sequence = tuple if isinstance(consumer.inputs, tuple) else list
consumer.inputs = sequence(new_tensor if t is old_tensor else t for t in consumer.inputs)
replace_tensor_in_graph_outputs(graph, old_tensor, new_tensor)
def replace_tensor_in_producers(graph, old_tensor, new_tensor):
for producer in list(old_tensor.producers): # copy list to avoid changes during iteration
sequence = tuple if isinstance(producer.outputs, tuple) else list
producer.outputs = sequence(new_tensor if t is old_tensor else t for t in producer.outputs)
replace_tensor_in_graph_inputs(graph, old_tensor, new_tensor)
def bypass_and_remove(graph, op, remove_input_not_output=False):
assert len(op.outputs) == 1 and len(op.inputs) == 1
op_input = op.input
op_output = op.output
graph.remove_operation(op, unlink=True)
if remove_input_not_output:
replace_tensor_in_consumers(graph, op_input, op_output)
replace_tensor_in_producers(graph, op_input, op_output)
graph.remove_tensor(op_input)
else:
replace_tensor_in_consumers(graph, op_output, op_input)
replace_tensor_in_producers(graph, op_output, op_input)
graph.remove_tensor(op_output)
def replace_chain(graph, types, func, allow_forks=False):
def _match_type(type, template):
return type in template if isinstance(template, set) else type == template
def _match_link(op, template, is_last):
return _match_type(op.type, template) and (len(op.outputs) == 1 or is_last)
def _match_chain(op, types, allow_forks):
if not _match_link(op, types[0], is_last=len(types) == 1):
return None
chain = [op]
tensor = op.output
for idx, type in enumerate(types[1:]):
is_last = idx + 1 == len(types) - 1
if not allow_forks and len(tensor.consumers) > 1:
return None
op = next((consumer for consumer in tensor.consumers if _match_link(consumer, type, is_last)), None)
if op is None:
return None
chain.append(op)
if not is_last:
tensor = op.output
return chain
changed = False
i = 0
while i < len(graph.operations):
count = len(graph.operations)
chain = _match_chain(graph.operations[i], types, allow_forks)
if chain is not None and func(*chain) is not False:
k = i
while graph.operations[k] is not chain[-1]:
k += 1
for j in range(count, len(graph.operations)):
graph.move_operation(j, k)
k += 1
offs = len(chain) - 1
while offs > 0 and len(chain[offs - 1].output.consumers) == 1:
offs -= 1
interns = [op.output for op in chain[offs:-1]]
graph.remove_operations(chain[offs:], unlink=True)
graph.remove_tensors(interns)
changed = True
else:
i += 1
return changed
def remove_unreachable(graph):
visited = {tensor.producer for tensor in graph.outputs}
queue = list(visited)
k = 0
while k < len(queue):
op = queue[k]
k += 1
for tensor in op.inputs:
if tensor.producer is not None and tensor.producer not in visited and \
(tensor not in graph.inputs or len(tensor.producer.inputs) == 0):
visited.add(tensor.producer)
queue.append(tensor.producer)
graph.remove_operations({op for op in graph.operations if op not in visited}, unlink=True)
graph.remove_tensors({tensor for tensor in graph.tensors
if len(tensor.producers) == 0 and len(tensor.consumers) == 0
and tensor not in graph.inputs and tensor not in graph.outputs})
|
sigla = input('Digite uma das siglas: SP / RJ / MG: ')
if sigla == 'RJ' or sigla == 'rj':
print('Carioca')
elif sigla == 'SP' or sigla == 'sp':
print('Paulista')
elif sigla == 'MG' or sigla == 'mg':
print('Mineiro')
else:
print('Outro estado')
|
"""Базовый класс Widget для всех виджетов."""
class Widget:
def __init__(self, app=None):
self.app = app
if app is not None:
self.init_app(app)
def init_app(self, app):
# Должен работать как синглтон ?
if self.app is None:
self.app = app
|
"""
Module: 'flowlib.lib.emoji' on M5 FlowUI v1.4.0-beta
"""
# MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11-284-g5d8e1c867 on 2019-08-30', machine='ESP32 module with ESP32')
# Stubber: 1.3.1
class Emoji:
''
def clear():
pass
def draw_square():
pass
def show_love():
pass
def show_map():
pass
def show_normal():
pass
lcd = None
def sleep():
pass
|
# Copyright (c) 2019 Ezybaas by Bhavik Shah.
# CTO @ Susthitsoft Technologies Private Limited.
# All rights reserved.
# Please see the LICENSE.txt included as part of this package.
# EZYBAAS RELEASE CONFIG
EZYBAAS_RELEASE_NAME = 'EzyBaaS'
EZYBAAS_RELEASE_AUTHOR = 'Bhavik Shah CTO @ SusthitSoft Technologies'
EZYBAAS_RELEASE_VERSION = '0.1.4'
EZYBAAS_RELEASE_DATE = '2019-07-20'
EZYBAAS_RELEASE_NOTES = 'https://github.com/bhavik1st/ezybaas'
EZYBAAS_RELEASE_STANDALONE = True
EZYBAAS_RELEASE_LICENSE = 'https://github.com/bhavik1st/ezybaas'
EZYBAAS_SWAGGER_ENABLED = True
# EZYBAAS OPERATIONAL CONFIG
BAAS_NAME = 'ezybaas'
SERIALIZERS_FILE_NAME = 'api'
VIEWS_FILE_NAME = 'api'
URLS_FILE_NAME = 'urls'
MODELS_FILE_NAME = 'models'
TESTS_FILE_NAME = 'tests'
|
class Solution(object):
def rob_o(self, nums):
# 依照上面的思路,其实我们用到的数据永远都是dp的dp[i-1]和dp[i-2]两个变量
# 因此,我们可以使用两个变量来存放前两个状态值
# 空间使用由O(N) -> O(1)
size = len(nums)
if size == 0:
return 0
dp1 = 0
dp2 = nums[0]
for i in range(2, size+1):
dp1 = max(dp2, nums[i-1]+dp1)
dp1, dp2 = dp2, dp1
return dp2
def rob(self, nums):
# 1.dp[i] 代表当前最大子序和
# 2.动态方程: dp[i] = max(dp[i-1], nums[i-1]+dp[i-2])
# 3.初始化: 给没有房子时,dp一个位置,即:dp[0]
# 3.1 当size=0时,没有房子,dp[0]=0;
# 3.2 当size=1时,有一间房子,偷即可:dp[1]=nums[0]
size = len(nums)
if size == 0:
return 0
dp = [0 for _ in range(size+1)]
dp[0] = 0
dp[1] = nums[0]
for i in range(2, size+1):
dp[i] = max(dp[i-1], nums[i-1]+dp[i-2])
print("i = {}, dp={}".format(i, dp[i]))
return dp[size]
if __name__ == "__main__":
solution = Solution()
nums = [2,1,1,2]
#result = solution.rob_o(nums)
#print(result)
result = solution.rob(nums)
print(result)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.