content
stringlengths 7
1.05M
|
---|
s = b'abc'; print(s.isspace(), s)
s = b'a-c'; print(s.isspace(), s)
s = b'a c'; print(s.isspace(), s)
s = b'a\tc'; print(s.isspace(), s)
s = b' '; print(s.isspace(), s)#半角スペースつ3
s = b'\r\n'; print(s.isspace(), s)
#s = b' '; print(s.isspace(), s)#全角スペース SyntaxError: bytes can only contain ASCII literal characters.
s = bytearray(b'abc'); print(s.isspace(), s)
s = bytearray(b'a-c'); print(s.isspace(), s)
s = bytearray(b'a c'); print(s.isspace(), s)
s = bytearray(b'a\tc'); print(s.isspace(), s)
s = bytearray(b' '); print(s.isspace(), s)#半角スペースつ3
s = bytearray(b'\r\n'); print(s.isspace(), s)
#s = bytearray(b' '); print(s.isspace(), s)#全角スペース SyntaxError: bytes can only contain ASCII literal characters.
|
class LampStateBase(object):
"""Состояние лампы"""
def get_color(self):
raise NotImplementedError()
class GreenLampState(LampStateBase):
def get_color(self):
return 'Green'
class RedLampState(LampStateBase):
def get_color(self):
return 'Red'
class BlueLampState(LampStateBase):
def get_color(self):
return 'Blue'
class Lamp(object):
def __init__(self):
self._current_state = None
self._states = self.get_states()
def get_states(self):
return [GreenLampState(), RedLampState(), BlueLampState()]
def next_state(self):
if self._current_state is None:
self._current_state = self._states[0]
else:
index = self._states.index(self._current_state)
if index < len(self._states) - 1:
index += 1
else:
index = 0
self._current_state = self._states[index]
return self._current_state
def light(self):
state = self.next_state()
print(state.get_color())
lamp = Lamp()
[lamp.light() for i in range(3)]
# Green
# Red
# Blue
[lamp.light() for i in range(3)]
# Green
# Red
# Blue |
a=[5,20,15,20,25,50,20]
b=set(a)
b.remove(20)
print(b)
|
#condições
nome = str(input('Digite seu nome: ')).strip().lower()
if 'isis' in nome:
print('Que nome bonito vc tem!')
else:
print('Você ainda pode mudar seu nome!')
print('fim')
#media
n1 = float(input('Digite sua nota: '))
n2 = float(input('Digite outra nota: '))
media = (n1 + n2)/2
if media >= 7:
print('PARABÉNS aprovado!')
else:
print('Ficou de exame!')
|
x = int(input('Digite o ano que quer saber: '))
y = x%4
if y == 0 and x%100 !=0 or x%400 == 0:
print('O ano de {} é bissexto'.format(x))
else:
print('O ano de {} não é bissexto '.format(x)) |
FEATKEY_NR_IMAGES = "nr_images"
FEATKEY_IMAGE_HEIGHT = "height"
FEATKEY_IMAGE_WIDTH = "width"
FEATKEY_ORIGINAL_HEIGHT = "original_height"
FEATKEY_ORIGINAL_WIDTH = "original_width"
FEATKEY_PATIENT_ID = "patient_id"
FEATKEY_LATERALITY = "laterality"
FEATKEY_VIEW = "view"
FEATKEY_IMAGE = "pixel_arr"
FEATKEY_IMAGE_ORIG = "pixel_arr_orig"
FEATKEY_MANUFACTURER = "manufacturer"
FEATKEY_SOP_INSTANCE_UID = "sop_instance_uid"
FEATKEY_STUDY_INSTANCE_UID = "study_instance_uid"
FEATKEY_ANNOTATION_STATUS = "annotation_status"
FEATKEY_COORDINATES_SEGMENTATION_MASK = "coordinates_segmentation_mask"
FEATKEY_COORDINATES_PECTORAL_MUSCLE_PARAMETERS = "coordinates_pectoral_muscle_parameters"
FEATKEY_COORDINATES_SKINLINE = "coordinates_skinline"
FEATKEY_COORDINATES_MAMMILLA_LOCATION = "coordinates_mammilla_location"
FEATKEY_PATCH_ID = "patch_id"
FEATKEY_PATCH_BOUNDING_BOX_CENTER_ROW = "patch_bounding_box_center_row"
FEATKEY_PATCH_BOUNDING_BOX_CENTER_COLUMN = "patch_bounding_box_center_column"
FEATKEY_PATCH_BOUNDING_BOX_WIDTH = "patch_bounding_box_width"
FEATKEY_PATCH_BOUNDING_BOX_HEIGHT = "patch_bounding_box_height"
# Label keys
LABELKEY_GT_ROIS_WITH_FINDING_CODES = "gt_rois_with_finding_codes"
LABELKEY_GT_ROIS_WITH_LABELS = "gt_rois_with_labels"
LABELKEY_GT_ANNOTATION_CONFIDENCES = "gt_annotation_confidences"
LABELKEY_GT_BIOPSY_PROVEN = "gt_biopsy_proven"
LABELKEY_PATCH_CLASS = "patch_class"
LABELKEY_FINDING_CODE = "gt_finding_code"
LABELKEY_GT_BIRADS_SCORE = "gt_birads_score"
# track here all region level label keys
LABELKEYS_REGION_LEVEL = {
LABELKEY_GT_ROIS_WITH_FINDING_CODES,
LABELKEY_GT_ROIS_WITH_LABELS,
LABELKEY_GT_ANNOTATION_CONFIDENCES,
LABELKEY_GT_BIOPSY_PROVEN,
LABELKEY_GT_BIRADS_SCORE,
}
LABELKEY_DENSITY = "density"
LABELKEY_DENSITY_0_BASED = "density_0_based"
LABELKEY_ANNOTATION_ID = "annotation_id"
LABELKEY_ANNOTATOR_MAIL = "annotator_mail"
LABELKEY_WAS_REFERRED = "was_referred"
LABELKEY_WAS_REFERRED_IN_FOLLOWUP = "was_referred_in_followup"
LABELKEY_BIOPSY_SCORE = "biopsy_score"
LABELKEY_BIOPSY_SCORE_OF_FOLLOWUP = "biopsy_score_of_followup"
LABELKEY_INTERVAL_TYPE = "interval_type"
# Model output keys
OUTKEY_RCNN_ROIS = "rcnn_rois"
OUTKEY_RPN_ROIS = "rpn_rois"
OUTKEY_RPN_ROIS_FG_PROBS = "rpn_rois_fg_probs"
OUTKEY_GT_ROIS = "gt_rois"
OUTKEY_RCNN_CLASS_LABELS = "rcnn_class_labels"
OUTKEY_IMAGE_LEVEL_PROBS = "image_level_probs"
OUTKEY_PROB_MAP = "image_prob_map"
OUTKEY_RCNN_PROBS = "rcnn_probs"
OUTKEY_IMAGE_LEVEL_LABEL = "image_level_label"
OUTKEY_ANCHORS = "anchors"
|
def get_packages_dict(activities):
"""
将activity对应的dict转化为package对应的dict
:param activities: 用户定义的程序和活动dict
:return: package对应的dict
"""
packages = activities.copy()
for key in packages:
packages[key] = packages[key][
1 if packages[key].__contains__('#') else 0:
packages[key].index('/')]
return packages
|
# DDA Algorithm
def draw_line(x0, y0, x1, y1):
dy = y1 - y0
dx = x1 - x0
m = dy / dx
current_y = y0
print(f'dy = {dy}')
print(f'dx = {dx}')
print(f'm = {m}')
for index in range (x0, x1 + 1):
print(f'x = {index}, y = {round(current_y)}')
current_y = current_y + m
draw_line(2, 1, 7, 3)
|
# 函数,通过注解来告知用户或者开发者
def getValue(word: str='hahha') -> set:
"""哈哈"""
return set(word)
|
"""String constants.
Once defined, it becomes immutable.
"""
class _const:
class ConstError(TypeError):
pass
def __setattr__(self, name, value):
if name in self.__dict__:
raise self.ConstError
self.__dict__[name] = value
def __delattr__(self, name):
if name in self.__dict__:
raise self.ConstError
raise NameError
pass
const = _const()
const.wce_share="wce_share"
const.wce_payload="wce_payload"
# WCE setup consts
const.WCE_SERVER="WCE_SERVER"
const.WCE_DESKTOP="WCE_DESKTOP"
const.WCE_TRIAGE_DISK='WCE_TRIAGE_DISK'
# Triage ssid/password
const.TRIAGE_SSID = "TRIAGE_SSID"
const.TRIAGE_PASSWORD = "TRIAGE_PASSWORD"
const.TRIAGEUSER = 'TRIAGEUSER'
const.TRIAGEPASS = 'TRIAGEPASS'
#
const.GRUB_DISABLE_OS_PROBER = 'GRUB_DISABLE_OS_PROBER'
const.PATCHES = 'PATCHES'
const.server = 'server'
const.workstation = 'workstation'
#
const.true = 'true'
const.efi_image = 'efi_image'
const.partition_plan = 'partition_plan'
const.partition_map = 'partition_map'
const.clone = 'clone'
const.traditional = 'traditional'
const.triage = 'triage'
const.ext4_version = 'ext4_version'
const.ext4_version_1_42 = "1.42"
const.ext4_version_no_metadata_csum = const.ext4_version_1_42
const.forcepae = 'forcepae'
const.cmdline = 'cmdline'
# cmdline special value for removing vlaue
const._REMOVE_ = '_REMOVE_'
|
""" Distributor init file
Distributors: you can add custom code here to support particular distributions
of numpy_demo.
For example, this is a good place to put any checks for hardware requirements.
The numpy_demo standard source distribution will not put code in this file, so you
can safely replace this file with your own version.
"""
|
class Strategy:
moneymanagement = None
def __init__(self, moneymanagement):
self.moneymanagement = moneymanagement
def can_find_pattern(self, data):
if self.moneymanagement.checkDrawdown() < - float(self.moneymanagement.algorithm.Portfolio.Cash) * 0.1:
return False
return True
|
# Attribute types
STRING = 1
NUMBER = 2
DATETIME = 3
# Analysis Types
SENTIMENT_ANALYSIS = 1
DOCUMENT_CLUSTERING = 2
CONCEPT_EXTRACTION = 3
DOCUMENT_CLASSIFICATION = 4
# Analysis Status
NOT_EXECUTED = 1
IN_PROGRESS = 2
EXECUTED = 3
# Creation Status
DRAFT = 1
COMPLETED = 2
# Visibilities
PUBLIC = 1
PRIVATE = 2
TEAM = 3
|
#!/usr/bin/env python3
# coding:utf-8
f = open("yankeedoodle.csv")
nums = [num.strip() for num in f.read().split(',')]
f.close()
res = [int(x[0][5] + x[1][5] + x[2][6]) for x in zip(nums[0::3], nums[1::3], nums[2::3])]
print(''.join([chr(e) for e in res]))
|
hex_colors = {
"COLOR_1": "#d9811e",
"TEXT_BUTTON_LIGHT": "#000000",
"BUTTON_1": "#dfdfdf",
"BACKGROUND": "#dfdfdf",
"LABEL_TEXT_COLOR_LIGHT": "black",
"FRAME_1_DARK": "#2b2b42",
"TEXT_BUTTON_DARK": "white",
"BUTTON_DARK": "#292929",
"BACKGROUND_DARK": "#292929",
"LABEL_TEXT_COLOR_DARK": "white",
}
custom_size = {
"init_width": "1280",
"init_height": "720",
"min_width": "800",
"min_height": "600",
}
|
## Mel-filterbank
mel_window_length = 25 # In milliseconds
mel_window_step = 10 # In milliseconds
mel_n_channels = 40
## Audio
sampling_rate = 16000
# Number of spectrogram frames in a partial utterance
partials_n_frames = 160 # 1600 ms
## Voice Activation Detection
vad_window_length = 30 # In milliseconds
vad_moving_average_width = 8
# Maximum number of consecutive silent frames a segment can have.
vad_max_silence_length = 6
## Audio volume normalization
audio_norm_target_dBFS = -30
## Model parameters
model_hidden_size = 256
model_embedding_size = 256
model_num_layers = 3
|
#python3
for t in range(int(input())):
count = 0
s,w1,w2,w3 = map(int,input().split())
if((w1+w2+w3)<=s):
count = 1
elif((w1+w2)<=s):
if(w3 <= s):
count = 2
else:
count = 1
elif((w2+w3)<=s):
if(w3 <= s):
count = 2
else:
count = 1
elif(w1 <= s and w2 <= s and w3 <= s):
count = 3
elif(w1>s and w3 > s):
count = 0
print(count)
#score:100
|
# Moeda
# 108
# Crie um módulo chamado moeda.py que tenha as funções incorporadas aumentar(), diminuir(), dobro() e metade(). Faça também um programa que importe esse módulo e use algumas dessas funções.
def aumentar(preco = 0, taxa = 0):
return preco + (preco * taxa / 100)
def diminuir(preco = 0, taxa = 0):
return preco - (preco * taxa / 100)
def dobro(preco = 0):
return preco * 2
def metade(preco = 0):
return preco / 2
def moedaFormat(preco = 0, moeda = 'R$'):
return f'\33[32m{moeda} {preco:.2f}\33[m'.replace('.' ,',')
def taxaFormat(taxa = 0, porcentagem = '%'):
return f'\33[32m{taxa:.2f} {porcentagem}\33[m'.replace('.' ,',') |
# ================================================= #
# Trash Guy Animation #
# (> ^_^)> #
# Made by Zac ([email protected]) #
# Version 4.1.0+20201210 #
# Donate: #
# 12Na1AmuGMCQYsxwM7ZLSr1sgfZacZFYxa #
# ================================================= #
# Copyright (C) 2020 Zac ([email protected]) #
# Permission is hereby granted, free of charge, to #
# any person obtaining a copy of this software and #
# associated documentation files (the "Software"), #
# to deal in the Software without restriction, #
# including without limitation the rights to use, #
# copy, modify, merge, publish, distribute, #
# sublicense, and/or sell copies of the Software, #
# and to permit persons to whom the Software is #
# furnished to do so, subject to the following #
# conditions: The above copyright notice and this #
# permission notice shall be included in all copies #
# or substantial portions of the Software. #
# ================================================= #
#
# ================================================= #
# If you rewrite this software in a different #
# programming language or create a derivative #
# work, please be kind and include this notice #
# and the below credit along with the license: #
# #
# This work is based on the original TrashGuy #
# animation (https://github.com/trash-guy/TrashGuy) #
# written by Zac ([email protected]). #
# #
# ================================================= #
# Look-up table of commonly used indices for instant conversion
# Generated with generate_lut.py
_LUT = (
(0, 7), (0, 7), (0, 7), (0, 7), (0, 7), (0, 7), (0, 7), (1, 9), (1, 9),
(1, 9), (1, 9), (1, 9), (1, 9), (1, 9), (1, 9), (1, 9), (2, 11), (2, 11),
(2, 11), (2, 11), (2, 11), (2, 11), (2, 11), (2, 11), (2, 11), (2, 11),
(2, 11), (3, 13), (3, 13), (3, 13), (3, 13), (3, 13), (3, 13), (3, 13),
(3, 13), (3, 13), (3, 13), (3, 13), (3, 13), (3, 13), (4, 15), (4, 15),
(4, 15), (4, 15), (4, 15), (4, 15), (4, 15), (4, 15), (4, 15), (4, 15),
(4, 15), (4, 15), (4, 15), (4, 15), (4, 15), (5, 17), (5, 17), (5, 17),
(5, 17), (5, 17), (5, 17), (5, 17), (5, 17), (5, 17), (5, 17), (5, 17),
(5, 17), (5, 17), (5, 17), (5, 17), (5, 17), (5, 17), (6, 19), (6, 19),
(6, 19), (6, 19), (6, 19), (6, 19), (6, 19), (6, 19), (6, 19), (6, 19),
(6, 19), (6, 19), (6, 19), (6, 19), (6, 19), (6, 19), (6, 19), (6, 19),
(6, 19), (7, 21), (7, 21), (7, 21), (7, 21), (7, 21), (7, 21), (7, 21),
(7, 21), (7, 21), (7, 21), (7, 21), (7, 21), (7, 21), (7, 21), (7, 21),
(7, 21), (7, 21), (7, 21), (7, 21), (7, 21), (7, 21), (8, 23), (8, 23),
(8, 23), (8, 23), (8, 23), (8, 23), (8, 23), (8, 23), (8, 23), (8, 23),
(8, 23), (8, 23), (8, 23), (8, 23), (8, 23), (8, 23), (8, 23), (8, 23),
(8, 23), (8, 23), (8, 23), (8, 23), (8, 23), (9, 25), (9, 25), (9, 25),
(9, 25), (9, 25), (9, 25), (9, 25), (9, 25), (9, 25), (9, 25), (9, 25),
(9, 25), (9, 25), (9, 25), (9, 25), (9, 25), (9, 25), (9, 25), (9, 25),
(9, 25), (9, 25), (9, 25), (9, 25), (9, 25), (9, 25), (10, 27), (10, 27),
(10, 27), (10, 27), (10, 27), (10, 27), (10, 27), (10, 27), (10, 27),
(10, 27), (10, 27), (10, 27), (10, 27), (10, 27), (10, 27), (10, 27),
(10, 27), (10, 27), (10, 27), (10, 27), (10, 27), (10, 27), (10, 27),
(10, 27), (10, 27), (10, 27), (10, 27), (11, 29), (11, 29), (11, 29),
(11, 29), (11, 29), (11, 29), (11, 29), (11, 29), (11, 29), (11, 29),
(11, 29), (11, 29), (11, 29), (11, 29), (11, 29), (11, 29), (11, 29),
(11, 29), (11, 29), (11, 29), (11, 29), (11, 29), (11, 29), (11, 29),
(11, 29), (11, 29), (11, 29), (11, 29), (11, 29), (12, 31), (12, 31),
(12, 31), (12, 31), (12, 31), (12, 31), (12, 31), (12, 31), (12, 31),
(12, 31), (12, 31), (12, 31), (12, 31), (12, 31), (12, 31), (12, 31),
(12, 31), (12, 31), (12, 31), (12, 31), (12, 31), (12, 31), (12, 31),
(12, 31), (12, 31), (12, 31), (12, 31), (12, 31), (12, 31), (12, 31),
(12, 31), (13, 33), (13, 33), (13, 33), (13, 33), (13, 33), (13, 33),
(13, 33), (13, 33), (13, 33), (13, 33), (13, 33), (13, 33), (13, 33),
(13, 33), (13, 33), (13, 33), (13, 33), (13, 33), (13, 33), (13, 33),
(13, 33), (13, 33), (13, 33), (13, 33), (13, 33), (13, 33), (13, 33),
(13, 33), (13, 33), (13, 33), (13, 33), (13, 33), (13, 33), (14, 35),
(14, 35), (14, 35), (14, 35), (14, 35), (14, 35), (14, 35), (14, 35),
(14, 35), (14, 35), (14, 35), (14, 35), (14, 35), (14, 35), (14, 35),
(14, 35), (14, 35), (14, 35), (14, 35), (14, 35), (14, 35), (14, 35),
(14, 35), (14, 35), (14, 35), (14, 35), (14, 35), (14, 35), (14, 35),
(14, 35), (14, 35), (14, 35), (14, 35), (14, 35), (14, 35), (15, 37),
(15, 37), (15, 37), (15, 37), (15, 37), (15, 37), (15, 37), (15, 37),
(15, 37), (15, 37), (15, 37), (15, 37), (15, 37), (15, 37), (15, 37),
(15, 37), (15, 37), (15, 37), (15, 37), (15, 37), (15, 37), (15, 37),
(15, 37), (15, 37), (15, 37), (15, 37), (15, 37), (15, 37), (15, 37),
(15, 37), (15, 37), (15, 37), (15, 37), (15, 37), (15, 37), (15, 37),
(15, 37), (16, 39), (16, 39), (16, 39), (16, 39), (16, 39), (16, 39),
(16, 39), (16, 39), (16, 39), (16, 39), (16, 39), (16, 39), (16, 39),
(16, 39), (16, 39), (16, 39), (16, 39), (16, 39), (16, 39), (16, 39),
(16, 39), (16, 39), (16, 39), (16, 39), (16, 39), (16, 39), (16, 39),
(16, 39), (16, 39), (16, 39), (16, 39), (16, 39), (16, 39), (16, 39),
(16, 39), (16, 39), (16, 39), (16, 39), (16, 39), (17, 41), (17, 41),
(17, 41), (17, 41), (17, 41), (17, 41), (17, 41), (17, 41), (17, 41),
(17, 41), (17, 41), (17, 41), (17, 41), (17, 41), (17, 41), (17, 41),
(17, 41), (17, 41), (17, 41), (17, 41), (17, 41), (17, 41), (17, 41),
(17, 41), (17, 41), (17, 41), (17, 41), (17, 41), (17, 41), (17, 41),
(17, 41), (17, 41), (17, 41), (17, 41), (17, 41), (17, 41), (17, 41),
(17, 41), (17, 41), (17, 41), (17, 41), (18, 43), (18, 43), (18, 43),
(18, 43), (18, 43), (18, 43), (18, 43), (18, 43), (18, 43), (18, 43),
(18, 43), (18, 43), (18, 43), (18, 43), (18, 43), (18, 43), (18, 43),
(18, 43), (18, 43), (18, 43), (18, 43), (18, 43), (18, 43), (18, 43),
(18, 43), (18, 43), (18, 43), (18, 43), (18, 43), (18, 43), (18, 43),
(18, 43), (18, 43), (18, 43), (18, 43), (18, 43), (18, 43), (18, 43),
(18, 43), (18, 43), (18, 43), (18, 43), (18, 43), (19, 45), (19, 45),
(19, 45), (19, 45), (19, 45), (19, 45), (19, 45), (19, 45), (19, 45),
(19, 45), (19, 45), (19, 45), (19, 45), (19, 45), (19, 45), (19, 45),
(19, 45), (19, 45), (19, 45), (19, 45), (19, 45), (19, 45), (19, 45),
(19, 45), (19, 45), (19, 45), (19, 45), (19, 45), (19, 45), (19, 45),
(19, 45), (19, 45), (19, 45), (19, 45), (19, 45), (19, 45), (19, 45),
(19, 45), (19, 45), (19, 45), (19, 45), (19, 45), (19, 45), (19, 45),
(19, 45), (20, 47), (20, 47), (20, 47), (20, 47), (20, 47), (20, 47),
(20, 47), (20, 47), (20, 47), (20, 47), (20, 47), (20, 47), (20, 47),
(20, 47), (20, 47), (20, 47), (20, 47), (20, 47), (20, 47), (20, 47),
(20, 47), (20, 47), (20, 47), (20, 47), (20, 47), (20, 47), (20, 47),
(20, 47), (20, 47), (20, 47), (20, 47), (20, 47), (20, 47), (20, 47),
(20, 47), (20, 47), (20, 47), (20, 47), (20, 47), (20, 47), (20, 47),
(20, 47), (20, 47), (20, 47), (20, 47), (20, 47), (20, 47), (21, 49),
(21, 49), (21, 49), (21, 49), (21, 49), (21, 49), (21, 49), (21, 49),
(21, 49), (21, 49), (21, 49), (21, 49), (21, 49), (21, 49), (21, 49),
(21, 49), (21, 49), (21, 49), (21, 49), (21, 49), (21, 49), (21, 49),
(21, 49), (21, 49), (21, 49), (21, 49), (21, 49), (21, 49), (21, 49),
(21, 49), (21, 49), (21, 49), (21, 49), (21, 49), (21, 49), (21, 49),
(21, 49), (21, 49), (21, 49), (21, 49), (21, 49), (21, 49), (21, 49),
(21, 49), (21, 49), (21, 49), (21, 49), (21, 49), (21, 49), (22, 51),
(22, 51), (22, 51), (22, 51), (22, 51), (22, 51), (22, 51), (22, 51),
(22, 51), (22, 51), (22, 51), (22, 51), (22, 51), (22, 51), (22, 51),
(22, 51), (22, 51), (22, 51), (22, 51), (22, 51), (22, 51), (22, 51),
(22, 51), (22, 51), (22, 51), (22, 51), (22, 51), (22, 51), (22, 51),
(22, 51), (22, 51), (22, 51), (22, 51), (22, 51), (22, 51), (22, 51),
(22, 51), (22, 51), (22, 51), (22, 51), (22, 51), (22, 51), (22, 51),
(22, 51), (22, 51), (22, 51), (22, 51), (22, 51), (22, 51), (22, 51),
(22, 51), (23, 53), (23, 53), (23, 53), (23, 53), (23, 53), (23, 53),
(23, 53), (23, 53), (23, 53), (23, 53), (23, 53), (23, 53), (23, 53),
(23, 53), (23, 53), (23, 53), (23, 53), (23, 53), (23, 53), (23, 53),
(23, 53), (23, 53), (23, 53), (23, 53), (23, 53), (23, 53), (23, 53),
(23, 53), (23, 53), (23, 53), (23, 53), (23, 53), (23, 53), (23, 53),
(23, 53), (23, 53), (23, 53), (23, 53), (23, 53), (23, 53), (23, 53),
(23, 53), (23, 53), (23, 53), (23, 53), (23, 53), (23, 53), (23, 53),
(23, 53), (23, 53), (23, 53), (23, 53), (23, 53), (24, 55), (24, 55),
(24, 55), (24, 55), (24, 55), (24, 55), (24, 55), (24, 55), (24, 55),
(24, 55), (24, 55), (24, 55), (24, 55), (24, 55), (24, 55), (24, 55),
(24, 55), (24, 55), (24, 55), (24, 55), (24, 55), (24, 55), (24, 55),
(24, 55), (24, 55), (24, 55), (24, 55), (24, 55), (24, 55), (24, 55),
(24, 55), (24, 55), (24, 55), (24, 55), (24, 55), (24, 55), (24, 55),
(24, 55), (24, 55), (24, 55), (24, 55), (24, 55), (24, 55), (24, 55),
(24, 55), (24, 55), (24, 55), (24, 55), (24, 55), (24, 55), (24, 55),
(24, 55), (24, 55), (24, 55), (24, 55), (25, 57), (25, 57), (25, 57),
(25, 57), (25, 57), (25, 57), (25, 57), (25, 57), (25, 57), (25, 57),
(25, 57), (25, 57), (25, 57), (25, 57), (25, 57), (25, 57), (25, 57),
(25, 57), (25, 57), (25, 57), (25, 57), (25, 57), (25, 57), (25, 57),
(25, 57), (25, 57), (25, 57), (25, 57), (25, 57), (25, 57), (25, 57),
(25, 57), (25, 57), (25, 57), (25, 57), (25, 57), (25, 57), (25, 57),
(25, 57), (25, 57), (25, 57), (25, 57), (25, 57), (25, 57), (25, 57),
(25, 57), (25, 57), (25, 57), (25, 57), (25, 57), (25, 57), (25, 57),
(25, 57), (25, 57), (25, 57), (25, 57), (25, 57), (26, 59), (26, 59),
(26, 59), (26, 59), (26, 59), (26, 59), (26, 59), (26, 59), (26, 59),
(26, 59), (26, 59), (26, 59), (26, 59), (26, 59), (26, 59), (26, 59),
(26, 59), (26, 59), (26, 59), (26, 59), (26, 59), (26, 59), (26, 59),
(26, 59), (26, 59), (26, 59), (26, 59), (26, 59), (26, 59), (26, 59),
(26, 59), (26, 59), (26, 59), (26, 59), (26, 59), (26, 59), (26, 59),
(26, 59), (26, 59), (26, 59), (26, 59), (26, 59), (26, 59), (26, 59),
(26, 59), (26, 59), (26, 59), (26, 59), (26, 59), (26, 59), (26, 59),
(26, 59), (26, 59), (26, 59), (26, 59), (26, 59), (26, 59), (26, 59),
(26, 59), (27, 61), (27, 61), (27, 61), (27, 61), (27, 61), (27, 61),
(27, 61), (27, 61), (27, 61), (27, 61), (27, 61), (27, 61), (27, 61),
(27, 61), (27, 61), (27, 61), (27, 61), (27, 61), (27, 61), (27, 61),
(27, 61), (27, 61), (27, 61), (27, 61), (27, 61), (27, 61), (27, 61),
(27, 61), (27, 61), (27, 61), (27, 61), (27, 61), (27, 61), (27, 61),
(27, 61), (27, 61), (27, 61), (27, 61), (27, 61), (27, 61), (27, 61),
(27, 61), (27, 61), (27, 61), (27, 61), (27, 61), (27, 61), (27, 61),
(27, 61), (27, 61), (27, 61), (27, 61), (27, 61), (27, 61), (27, 61),
(27, 61), (27, 61), (27, 61), (27, 61), (27, 61), (27, 61), (28, 63),
(28, 63), (28, 63), (28, 63), (28, 63), (28, 63), (28, 63), (28, 63),
(28, 63), (28, 63), (28, 63), (28, 63), (28, 63), (28, 63), (28, 63),
(28, 63), (28, 63), (28, 63), (28, 63), (28, 63), (28, 63), (28, 63),
(28, 63), (28, 63), (28, 63), (28, 63), (28, 63), (28, 63), (28, 63),
(28, 63), (28, 63), (28, 63), (28, 63), (28, 63), (28, 63), (28, 63),
(28, 63), (28, 63), (28, 63), (28, 63), (28, 63), (28, 63), (28, 63),
(28, 63), (28, 63), (28, 63), (28, 63), (28, 63), (28, 63), (28, 63),
(28, 63), (28, 63), (28, 63), (28, 63), (28, 63), (28, 63), (28, 63),
(28, 63), (28, 63), (28, 63), (28, 63), (28, 63), (28, 63), (29, 65),
(29, 65), (29, 65), (29, 65), (29, 65), (29, 65), (29, 65), (29, 65),
(29, 65), (29, 65), (29, 65), (29, 65), (29, 65), (29, 65), (29, 65),
(29, 65), (29, 65), (29, 65), (29, 65), (29, 65), (29, 65), (29, 65),
(29, 65), (29, 65), (29, 65), (29, 65), (29, 65), (29, 65), (29, 65),
(29, 65), (29, 65), (29, 65), (29, 65), (29, 65), (29, 65), (29, 65),
(29, 65), (29, 65), (29, 65), (29, 65), (29, 65), (29, 65), (29, 65),
(29, 65), (29, 65), (29, 65), (29, 65), (29, 65), (29, 65), (29, 65),
(29, 65), (29, 65), (29, 65), (29, 65), (29, 65), (29, 65), (29, 65),
(29, 65), (29, 65), (29, 65), (29, 65), (29, 65), (29, 65), (29, 65),
(29, 65))
|
'''
что будет на выходе из приведенного кода?
'''
i = 100
while i > 0:
if i == 40:
break
print(i, end='*')
i -= 20 |
with open('F_T_W copy/ada_fund.json') as f:
data = json.load(f)
print(data)
|
class Dice(object):
__slots__ = ['sides']
def __init__(self, sides):
self.sides = sides
class DiceStack(object):
__slots__ = ['amount', 'dice']
def __init__(self, amount, dice):
self.amount = amount
self.dice = dice |
_cmds_registry = {}
def register(cmd:str, alias:str) -> bool:
if alias in _cmds_registry:
return False
else:
_cmds_registry[alias] = cmd
return True
def get_cmd(alias:str) -> str:
if alias in _cmds_registry:
return _cmds_registry[alias]
else:
return ''
|
class Meta(type):
def __new__(mcs, name, bases, namespace):
#mcs -> Metaclasse
#name -> Nome da classe
#base -> Classes pai da das subsclasses
#namespace -> Tudo que tem na classe em forma de dicionario
print(name)
if name == 'A': #
return type.__new__(mcs, name, bases, namespace)
if 'b_fala' not in namespace:
print(f'ERRO! Você precisa criar b_fala em {name}') # Obriga a classe filha ter 'b_fala'
else:
if not callable(namespace['b_fala']):
print('Precisa ser um método,não atributo! ')
print(namespace)
return type.__new__(mcs, name, bases, namespace) # Tem que retornar sempre, caso não tenha sido chamado anteriormente
class A(metaclass=Meta): # Vai se comportar da maneira que a Classe META determinar.
def falar(self):
self.b_fala()
class B(A):
def b_fala(self): # Se esse metodo não existir, dará erro na classe A.
# É possivel utilizar classes abstratas, mas será utilizado metaclass
...
def cantar(self):
print('cantando...')
thiago = 1
# b = B()
# b.b_fala() |
def word_form(number):
ones = ('', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight',
'nine')
tens = ('', '', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy',
'eighty', 'ninety')
teens = ('ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen',
'sixteen', 'seventeen', 'eighteen', 'nineteen')
levels = ('', 'thousand', 'million', 'billion', 'trillion', 'quadrillion',
'quintillion', 'sextillion', 'septillion', 'octillion', 'nonillion')
word = ''
number = str(number)[::-1]
if len(number) % 3 == 1: number += '0'
for x, digit in enumerate(number):
if x % 3 == 0:
word = levels[x // 3] + ', ' + word
prevDigit = int(digit)
elif x % 3 == 1:
if digit is '1':
num = teens[prevDigit]
elif digit is '0':
num = ones[prevDigit]
else:
num = tens[int(digit)]
if prevDigit:
num += '-' + ones[prevDigit]
word = num + ' ' + word
elif x % 3 == 2:
if digit is not '0':
if all(n is '0' for n in number[:x]):
word = ones[int(digit)] + ' hundred' + word
else:
word = ones[int(digit)] + ' hundred and ' + word
return word.strip(' , ')
lengths = [len(word_form(i).replace(' ', '').replace('-', ''))
for i in range(1, 1000 + 1)]
print(sum(lengths))
|
""" Settings default definition for Nine CMS """
__author__ = 'George Karakostas'
__copyright__ = 'Copyright 2015, George Karakostas'
__licence__ = 'BSD-3'
__email__ = '[email protected]'
""" Default recommended settings """
# INSTALLED_APPS = (
# 'admin_bootstrapped_plus',
# # 'bootstrap3',
# 'django_admin_bootstrapped',
# 'django.contrib.admin',
# 'django.contrib.auth',
# 'django.contrib.contenttypes',
# 'django.contrib.sessions',
# 'django.contrib.messages',
# 'django.contrib.staticfiles',
# 'mptt',
# 'debug_toolbar',
# 'guardian',
# 'ninecms',
# 'myproject_core'
# )
#
# MIDDLEWARE_CLASSES = (
# 'django.middleware.cache.UpdateCacheMiddleware',
# 'django.contrib.sessions.middleware.SessionMiddleware',
# 'django.middleware.locale.LocaleMiddleware',
# 'django.middleware.common.CommonMiddleware',
# 'django.middleware.cache.FetchFromCacheMiddleware',
# 'django.middleware.csrf.CsrfViewMiddleware',
# 'django.contrib.auth.middleware.AuthenticationMiddleware',
# 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
# 'django.contrib.messages.middleware.MessageMiddleware',
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
# 'django.middleware.security.SecurityMiddleware',
# )
# ROOT_URLCONF = 'myproject.urls'
# TEMPLATES = [
# {
# 'BACKEND': 'django.template.backends.django.DjangoTemplates',
# 'DIRS': [
# os.path.join(BASE_DIR, 'templates'),
# ],
# 'APP_DIRS': True,
# 'OPTIONS': {
# 'context_processors': [
# 'django.template.context_processors.debug',
# 'django.template.context_processors.request',
# 'django.contrib.auth.context_processors.auth',
# 'django.contrib.messages.context_processors.messages',
# ],
# 'debug': True,
# },
# },
# ]
# WSGI_APPLICATION = 'myproject.wsgi.application'
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
# }
# }
# LANGUAGE_CODE = 'el'
#
# LANGUAGES = (
# ('el', 'Greek'),
# # ('en', 'English'),
# )
#
# TIME_ZONE = 'Europe/Athens'
# USE_I18N = True
#
# USE_L10N = True
#
# USE_TZ = True
# STATIC_URL = '/static/'
#
# # Following remains for PyCharm code inspections in templates; deprecated in Django 1.8
# TEMPLATE_DIRS = (
# os.path.join(BASE_DIR, 'templates'),
# )
# STATICFILES_DIRS = (
# os.path.join(BASE_DIR, "static"),
# )
# MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
#
# MEDIA_URL = '/media/'
# LOGIN_URL = '/admin/login/'
# # Error reporting
#
# ADMINS = (
# ("Webmaster", "[email protected]"),
# )
#
# MANAGERS = (
# ("Webmaster", "[email protected]"),
# )
#
# EMAIL_HOST = 'mail.9-dev.com'
#
# EMAIL_HOST_USER = '[email protected]'
#
# EMAIL_HOST_PASSWORD = ''
#
# EMAIL_USE_SSL = True
#
# EMAIL_PORT = 465
#
# EMAIL_SUBJECT_PREFIX = '[9cms] '
#
# SERVER_EMAIL = '[email protected]'
#
# DEFAULT_FROM_EMAIL = '[email protected]'
#
#
# # Security
# # http://django-secure.readthedocs.org/en/latest/settings.html
#
# SECURE_CONTENT_TYPE_NOSNIFF = True
#
# SECURE_BROWSER_XSS_FILTER = True
#
# X_FRAME_OPTIONS = 'DENY'
#
# CSRF_COOKIE_HTTPONLY = True
#
# # SSL only
# # SECURE_SSL_REDIRECT = True
#
# # SECURE_HSTS_SECONDS = 31536000
#
# # SECURE_HSTS_INCLUDE_SUBDOMAINS = True
#
# # SESSION_COOKIE_SECURE = True
#
# # CSRF_COOKIE_SECURE = True
# # Add unique session cookie name for concurrent logins with other sites
# SESSION_COOKIE_NAME = 'myapp_sessionid'
#
# # Caches
# # https://docs.djangoproject.com/en/1.8/topics/cache/
#
# CACHES = {
# 'default': {
# 'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
# }
# }
#
# CACHE_MIDDLEWARE_SECONDS = 3 * 60 * 60
# # Guardian
# # https://django-guardian.readthedocs.org/en/v1.2/configuration.html
#
# AUTHENTICATION_BACKENDS = (
# 'django.contrib.auth.backends.ModelBackend', # this is default
# 'guardian.backends.ObjectPermissionBackend',
# )
#
# ANONYMOUS_USER_ID = -1
# # Django admin
# DAB_FIELD_RENDERER = 'django_admin_bootstrapped.renderers.BootstrapFieldRenderer'
#
# MESSAGE_TAGS = {
# messages.SUCCESS: 'alert-success success',
# messages.WARNING: 'alert-warning warning',
# messages.ERROR: 'alert-danger error'
# }
""" Test """
# from myapp.settings import *
#
# DEBUG = True
#
# PASSWORD_HASHERS = (
# 'django.contrib.auth.hashers.MD5PasswordHasher',
# )
#
# TEMPLATES = [
# {
# 'BACKEND': 'django.template.backends.django.DjangoTemplates',
# 'DIRS': [ # disable overriden templates
# ],
# 'APP_DIRS': True,
# 'OPTIONS': {
# 'context_processors': [
# 'django.template.context_processors.debug',
# 'django.template.context_processors.request',
# 'django.contrib.auth.context_processors.auth',
# 'django.contrib.messages.context_processors.messages',
# ],
# 'debug': True,
# },
# },
# ]
#
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
# }
# }
#
# LANGUAGES = (
# ('el', 'Greek'),
# ('en', 'English'),
# )
#
# IMAGE_STYLES.update({
# 'thumbnail-upscale': {
# 'type': 'thumbnail-upscale',
# 'size': (150, 150)
# },
# })
""" Live """
# # noinspection PyUnresolvedReferences
# from myapp.settings import *
#
# DEBUG = False
#
# ALLOWED_HOSTS = [
# '',
# ]
#
# TEMPLATE_DIRS = None
#
# TEMPLATES = [
# {
# 'BACKEND': 'django.template.backends.django.DjangoTemplates',
# 'DIRS': [
# os.path.join(BASE_DIR, 'templates'),
# ],
# 'APP_DIRS': True,
# 'OPTIONS': {
# 'context_processors': [
# 'django.template.context_processors.debug',
# 'django.template.context_processors.request',
# 'django.contrib.auth.context_processors.auth',
# 'django.contrib.messages.context_processors.messages',
# ],
# },
# },
# ]
#
# STATIC_ROOT = '/var/www'
#
# STATICFILES_DIRS = []
#
# CACHES = {
# 'default': {
# 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
# 'LOCATION': '127.0.0.1:11211',
# 'TIMEOUT': 3 * 60 * 60, # 3h
# 'KEY_PREFIX': 'rabelvideo_',
# 'VERSION': 1,
# }
# }
""" CMS """
# Site name to display in title etc.
SITE_NAME = "9cms"
# Meta author tag
SITE_AUTHOR = "9cms"
# Meta keywords
SITE_KEYWORDS = ""
# Define image styles
IMAGE_STYLES = {
'thumbnail': {
'type': 'thumbnail',
'size': (150, 1000)
},
'thumbnail_crop': {
'type': 'thumbnail-crop',
'size': (150, 150)
},
'thumbnail_upscale': {
'type': 'thumbnail-upscale',
'size': (150, 150)
},
'gallery_style': {
'type': 'thumbnail',
'size': (400, 1000)
},
'blog_style': {
'type': 'thumbnail-crop',
'size': (350, 226)
},
'large': {
'type': 'thumbnail',
'size': (1280, 1280)
},
}
# Update image styles in project settings such as:
# IMAGE_STYLES.update({})
# Define characters to remove at transliteration
TRANSLITERATE_REMOVE = '"\'`,:;|{[}]+=*&%^$#@!~()?<>'
# Define characters to replace at transliteration
TRANSLITERATE_REPLACE = (' .-_/', '-----')
# Define language menu labels
# Possible values: name, code, flag
LANGUAGE_MENU_LABELS = 'name'
# Enable i18n urls for 9cms
I18N_URLS = True
|
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Created by Ross on 19-1-10
def solve_dp(length):
if length < 2:
return 0
elif length == 2:
return 1
elif length == 3:
return 2
products = [0] * (length + 1)
products[0] = 0
products[1] = 1
products[2] = 2
products[3] = 3
for i in range(4, length + 1): # 0 - length 长度中,每一个长度的最大积
max = 0
for j in range(length // 2, length):
product = products[j] * products[i - j]
if max < product:
max = product
products[i] = max
return products[length]
def solve_greedy(length):
if length < 2:
return 0
elif length == 2:
return 1
elif length == 3:
return 2
product = 1
while length > 3:
if length >= 5:
product *= 3
length -= 3
elif length == 4:
product *= 2
length -= 2
product *= length
return product
if __name__ == '__main__':
print(solve_greedy(0))
print(solve_greedy(1))
print(solve_greedy(2))
print(solve_greedy(3))
print(solve_greedy(4))
print(solve_greedy(5))
print(solve_greedy(6))
print(solve_greedy(7))
|
__author__ = 'Ladeinde Oluwaseun'
__copyright__ = 'Copyright 2018, Ladeinde Oluwaseun'
__credits__ = ['Ladeinde Oluwaseun, amordigital']
__license__ = 'BSD'
__version__ = '1.5.1'
__maintainer__ = 'Ladeinde Oluwaseun'
__email__ = '[email protected]'
__status__ = 'Development'
|
a=10
b=5
print('Addition:', a+b)
print('Substraction: ', a-b)
print('Multiplication:', a*b)
print('Division: ', a/b)
print('Remainder: ', a%b)
print('Exponential:', a ** b) |
CHUNK_SIZE = (1024**2) * 50
file_number = 1
with open('encoder-5-3000.pkl', 'rb') as f:
chunk = f.read(CHUNK_SIZE)
while chunk:
with open('encoder-5-3000_part_' + str(file_number), 'wb') as chunk_file:
chunk_file.write(chunk)
file_number += 1
chunk = f.read(CHUNK_SIZE)
|
def app(amb , start_response):
arq=open('index.html','rb')
data = arq.read()
status = "200 OK"
headers = [('Content-type',"text/html")]
start_response(status,headers)
return [data] |
#!/usr/bin/env python3
SIZE = 100
with open('03-output.pbm', 'wb') as f:
f.write(b'P4\n100 100\n')
for i in range(SIZE):
counter = 0
xs = b''
for j in range(SIZE):
counter += 1
if (i + j) % 2 == 0:
xs += b'1'
else:
xs += b'0'
if counter == 8:
print("_", xs, counter, 8 - ((SIZE * SIZE) % 8))
f.write(bytes([int(xs, 2)]))
xs = b''
counter = 0
if counter != 0:
xs += b'0' * (8 - counter)
f.write(bytes([int(xs, 2)]))
|
#
# PySNMP MIB module RSTP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RSTP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:50:24 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, ConstraintsUnion, ValueSizeConstraint, ValueRangeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ConstraintsUnion", "ValueSizeConstraint", "ValueRangeConstraint", "SingleValueConstraint")
dot1dStp, dot1dStpPortEntry = mibBuilder.importSymbols("BRIDGE-MIB", "dot1dStp", "dot1dStpPortEntry")
ObjectGroup, ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "ModuleCompliance", "NotificationGroup")
Counter32, Gauge32, NotificationType, Counter64, ObjectIdentity, ModuleIdentity, Bits, TimeTicks, IpAddress, MibIdentifier, Integer32, mib_2, Unsigned32, iso, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "Counter32", "Gauge32", "NotificationType", "Counter64", "ObjectIdentity", "ModuleIdentity", "Bits", "TimeTicks", "IpAddress", "MibIdentifier", "Integer32", "mib-2", "Unsigned32", "iso", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn")
DisplayString, TruthValue, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TruthValue", "TextualConvention")
rstpMIB = ModuleIdentity((1, 3, 6, 1, 2, 1, 134))
rstpMIB.setRevisions(('2005-12-07 00:00',))
if mibBuilder.loadTexts: rstpMIB.setLastUpdated('200512070000Z')
if mibBuilder.loadTexts: rstpMIB.setOrganization('IETF Bridge MIB Working Group')
rstpNotifications = MibIdentifier((1, 3, 6, 1, 2, 1, 134, 0))
rstpObjects = MibIdentifier((1, 3, 6, 1, 2, 1, 134, 1))
rstpConformance = MibIdentifier((1, 3, 6, 1, 2, 1, 134, 2))
dot1dStpVersion = MibScalar((1, 3, 6, 1, 2, 1, 17, 2, 16), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 2))).clone(namedValues=NamedValues(("stpCompatible", 0), ("rstp", 2))).clone('rstp')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dot1dStpVersion.setStatus('current')
dot1dStpTxHoldCount = MibScalar((1, 3, 6, 1, 2, 1, 17, 2, 17), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 10)).clone(3)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dot1dStpTxHoldCount.setStatus('current')
dot1dStpExtPortTable = MibTable((1, 3, 6, 1, 2, 1, 17, 2, 19), )
if mibBuilder.loadTexts: dot1dStpExtPortTable.setStatus('current')
dot1dStpExtPortEntry = MibTableRow((1, 3, 6, 1, 2, 1, 17, 2, 19, 1), )
dot1dStpPortEntry.registerAugmentions(("RSTP-MIB", "dot1dStpExtPortEntry"))
dot1dStpExtPortEntry.setIndexNames(*dot1dStpPortEntry.getIndexNames())
if mibBuilder.loadTexts: dot1dStpExtPortEntry.setStatus('current')
dot1dStpPortProtocolMigration = MibTableColumn((1, 3, 6, 1, 2, 1, 17, 2, 19, 1, 1), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dot1dStpPortProtocolMigration.setStatus('current')
dot1dStpPortAdminEdgePort = MibTableColumn((1, 3, 6, 1, 2, 1, 17, 2, 19, 1, 2), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dot1dStpPortAdminEdgePort.setStatus('current')
dot1dStpPortOperEdgePort = MibTableColumn((1, 3, 6, 1, 2, 1, 17, 2, 19, 1, 3), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dot1dStpPortOperEdgePort.setStatus('current')
dot1dStpPortAdminPointToPoint = MibTableColumn((1, 3, 6, 1, 2, 1, 17, 2, 19, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("forceTrue", 0), ("forceFalse", 1), ("auto", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dot1dStpPortAdminPointToPoint.setStatus('current')
dot1dStpPortOperPointToPoint = MibTableColumn((1, 3, 6, 1, 2, 1, 17, 2, 19, 1, 5), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dot1dStpPortOperPointToPoint.setStatus('current')
dot1dStpPortAdminPathCost = MibTableColumn((1, 3, 6, 1, 2, 1, 17, 2, 19, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 200000000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dot1dStpPortAdminPathCost.setStatus('current')
rstpGroups = MibIdentifier((1, 3, 6, 1, 2, 1, 134, 2, 1))
rstpCompliances = MibIdentifier((1, 3, 6, 1, 2, 1, 134, 2, 2))
rstpBridgeGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 134, 2, 1, 1)).setObjects(("RSTP-MIB", "dot1dStpVersion"), ("RSTP-MIB", "dot1dStpTxHoldCount"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
rstpBridgeGroup = rstpBridgeGroup.setStatus('current')
rstpPortGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 134, 2, 1, 2)).setObjects(("RSTP-MIB", "dot1dStpPortProtocolMigration"), ("RSTP-MIB", "dot1dStpPortAdminEdgePort"), ("RSTP-MIB", "dot1dStpPortOperEdgePort"), ("RSTP-MIB", "dot1dStpPortAdminPointToPoint"), ("RSTP-MIB", "dot1dStpPortOperPointToPoint"), ("RSTP-MIB", "dot1dStpPortAdminPathCost"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
rstpPortGroup = rstpPortGroup.setStatus('current')
rstpCompliance = ModuleCompliance((1, 3, 6, 1, 2, 1, 134, 2, 2, 1)).setObjects(("RSTP-MIB", "rstpBridgeGroup"), ("RSTP-MIB", "rstpPortGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
rstpCompliance = rstpCompliance.setStatus('current')
mibBuilder.exportSymbols("RSTP-MIB", dot1dStpTxHoldCount=dot1dStpTxHoldCount, dot1dStpExtPortEntry=dot1dStpExtPortEntry, rstpMIB=rstpMIB, dot1dStpPortAdminPathCost=dot1dStpPortAdminPathCost, rstpPortGroup=rstpPortGroup, dot1dStpPortAdminEdgePort=dot1dStpPortAdminEdgePort, dot1dStpPortProtocolMigration=dot1dStpPortProtocolMigration, dot1dStpPortOperPointToPoint=dot1dStpPortOperPointToPoint, rstpObjects=rstpObjects, dot1dStpVersion=dot1dStpVersion, dot1dStpPortOperEdgePort=dot1dStpPortOperEdgePort, rstpCompliances=rstpCompliances, dot1dStpExtPortTable=dot1dStpExtPortTable, dot1dStpPortAdminPointToPoint=dot1dStpPortAdminPointToPoint, rstpConformance=rstpConformance, rstpGroups=rstpGroups, rstpBridgeGroup=rstpBridgeGroup, rstpNotifications=rstpNotifications, PYSNMP_MODULE_ID=rstpMIB, rstpCompliance=rstpCompliance)
|
class Payment:
"""Class for handling payments
"""
def __init__(self):
self.flag_1 = 1
def payment_process(self, dist, delivery_charge, bill, time_avg, delivery_time):
"""Print final invoice generated with details
Args:
dist (float): Distance b/w user and restaurant in KM
delivery_charge (int): Delivery charges in INR
bill (int): Bill amount in INR
time_avg (int): Time in minutes
delivery_time (int): Delivery time in minutes
"""
print(f"Distance between User and Restaurant: {dist} KM ")
print(f"Delivery Charges: Rs. {delivery_charge}")
print(f"Bill Amount to be paid by the USER: Rs. {bill} ")
print(f"Estimated time for Preparing the food: {time_avg} minutes")
print(
f"Approaximate time taken by delivery executive: {delivery_time} minutes")
total_time = time_avg + delivery_time
total_amount = bill + delivery_charge
print(f"Estimated time for Delivery: {total_time} minutes ")
print(f"Total Amount to be paid: Rs. {total_amount} ")
print("--------------------------------------------------------")
print("Proceeding forward for Payment:")
print("----------------------------")
def Net_Banking(self, total):
"""Execute Net Banking for payment
Args:
total (int): Total amount in INR
"""
print("ThankYou For using NET BANKING:")
print(f"INR {total} has been debited from your account.")
print("ENJOY YOUR MEAL!")
def Bhim_upi(self, total):
"""Execute BHIM UPI for payment
Args:
total (int): Total amount in INR
"""
print("ThankYou For using BHIM UPI:")
print(f"INR {total} has been debited from your account.")
print("ENJOY YOUR MEAL!")
def Credit_Card(self, total):
"""Execute Credit Card for payment
Args:
total (int): Total amount in INR
"""
print("ThankYou For using CREDIT CARD services:")
print(f"INR {total} has been debited from your card.")
print("ENJOY YOUR MEAL!")
def Debit_Card(self, total):
"""Execute Debit Card for payment
Args:
total (int): Total amount in INR
"""
print("ThankYou For using DEBIT CARD:")
print(f"INR {total} has been debited from your account.")
print("ENJOY YOUR MEAL!")
def COD(self, total):
"""Execute COD for payment
Args:
total (int): Total amount in INR
"""
print("ThankYou For the ORDER:")
print(f"Please Pay INR {total} to the Delivery Executive.")
print("ENJOY YOUR MEAL!")
def payment_final(self, delivery_charge, bill, email, obj):
"""Finalise payment for order
Args:
delivery_charge (int): Delivery charges in INR
bill (int): Bill amount in INR
email (str): User email
obj (object): Object of type Promocode
Returns:
bool: Boolean value True if promo1 used
bool: Boolean value False if promo2 used
bool: Boolean value for flag_1
"""
self.promo1_used = False
self.promo2_used = False
if obj.show_promo1(email) == 1 and obj.show_promo2(email) == 1:
new_bill = bill
print("Sorry You Don't Have any Promocodes Left:")
else:
while True:
print("Select the Promocode you would like to use:")
print("1. SAVE20")
print("2. SAVE50")
x = int(input())
if x == 1:
z = obj.show_promo1(email)
if z == 1:
print("Sorry You Already used this Promocode once:")
else:
self.promo1_used = True
new_bill = bill - 20
obj.update_promo1_to_1(email)
break
elif x == 2:
z = obj.show_promo2(email)
if z == 1:
print("Sorry You Already used this Promocode once:")
else:
self.promo2_used = True
new_bill = bill - 50
obj.update_promo2_to_1(email)
break
total = new_bill + delivery_charge
print(f"Final Bill: Rs. {new_bill}")
print(f"Delivery Charges: Rs. {delivery_charge}")
print(f"Total Amount to be Paid: Rs. {total}")
print("----------------------------------------")
print("Select the Payment Method:")
print("1. BHIM UPI")
print("2. NET BANKING")
print("3. CREDIT CARD")
print("4. DEBIT CARD")
print("5. CASH ON DELIVERY")
pay = int(input())
if pay == 1:
self.Bhim_upi(total)
elif pay == 2:
self.Net_Banking(total)
elif pay == 3:
self.Credit_Card(total)
elif pay == 4:
self.Debit_Card(total)
elif pay == 5:
self.COD(total)
return self.promo1_used, self.promo2_used, self.flag_1
|
"""
File: settings.py
------------------------
This file holds all the constant variables
so that they can be globally called upon
and accessed by all of the other programs
"""
LEXICON_FILE = "Lexicon.txt" # File to read word list from
SCORE_FILE = 'highscores.txt' # File that stores all the scores
GRID_DIMENSION = 10 # nxn grid (10 fits well)
TIME_LIMIT = 90 # How long the user has to search, in seconds
# graphics dimensions
WINDOW_WIDTH = 1000
WINDOW_HEIGHT = 600
VERTICAL_MARGIN = 30
LEFT_MARGIN = 60
RIGHT_MARGIN = 30
LINE_WIDTH = 2 |
#Done by Carlos Amaral in 16/07/2020
"""
Write a function that accepts two parameters: a city name
and a country name. The function should return a single string of the form
City, Country , such as Santiago, Chile . Store the function in a module called
city _functions.py.
Create a file called test_cities.py that tests the function you just wrote
(remember that you need to import unittest and the function you want to test).
Write a method called test_city_country() to verify that calling your function
with values such as 'santiago' and 'chile' results in the correct string. Run
test_cities.py, and make sure test_city_country() passes.
"""
#City, country
def get_formatted_place(city, country):
"""Generate the name of a place, neatly formatted."""
place = f"{city} {country}"
return place.title() |
#..............example 1 combine................
# s = "ABC"
# s2 = "123"
# L = [x+y for x in s for y in s2]
# print(L)
#..............example 2 remove duplicates................
# L = [1, 3, 2, 1, 6, 4, 2, 98, 82]
# L2 = []
# for x in L:
# if x not in L2:
# L2.append(x)
# print(L2)
#..............example 3 fibonacci................
#1 1 2 3 5 8 13
#2=1+1; 3=1+2; 5=2+3 .....
# method 1
# a=0
# b=1
# L=[]
# while len(L) < 40:
# a,b = b, a+b
# L.append(a)
# print(L)
# method 2
L=[1,1]
while len(L) < 40:
L.append(L[-1]+L[-2])
print(L) |
""" var object
this is for storing system variables
"""
class Var(object):
@classmethod
def fetch(cls, name):
"fetch var with given name"
return cls.list(name=name)[0]
@classmethod
def next(cls, name, advance=True):
"give (and, if advance, then increment) a counter variable"
v = cls.fetch(name)
next = v.value
if advance:
v.value = next + 1
v.flush()
return next
@classmethod
def add(cls, name, value=0, textvalue='', datevalue=None, comment=''):
"add a new var of given name with given values"
v = cls.new()
v.name = name
v.value = value
v.textvalue = textvalue
v.datevalue = datevalue
v.comment = comment
v.flush()
@classmethod
def amend(cls,
name,
value=None,
textvalue=None,
datevalue=None,
comment=None):
"update var of given name with given values"
v = cls.fetch(name)
if value is not None:
v.value = value
if textvalue is not None:
v.textvalue = textvalue
if datevalue is not None:
v.datevalue = datevalue
if comment is not None:
v.comment = comment
v.flush()
@classmethod
def say(cls, name):
v = cls.fetch(name)
return "%s : %s (%s) (%s) %s" % (v.name, v.value, v.textvalue,
v.datevalue, v.comment)
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# +
# __doc__ string
# _
__doc__ = """test of ocs_common"""
# +
# function: test_ocs_common() to keep py.test happy
# -
def test_ocs_common():
assert True
|
def main(request, response):
headers = []
if "cors" in request.GET:
headers.append(("Access-Control-Allow-Origin", "*"))
headers.append(("Access-Control-Allow-Credentials", "true"))
headers.append(("Access-Control-Allow-Methods", "GET, POST, PUT, FOO"))
headers.append(("Access-Control-Allow-Headers", "x-test, x-foo"))
headers.append(("Access-Control-Expose-Headers", "x-request-method, x-request-content-type, x-request-query, x-request-content-length"))
filter_value = request.GET.first("filter_value", "")
filter_name = request.GET.first("filter_name", "").lower()
result = ""
for name, value in request.headers.iteritems():
if filter_value:
if value == filter_value:
result += name.lower() + ","
elif name.lower() == filter_name:
result += name.lower() + ": " + value + "\n";
headers.append(("content-type", "text/plain"))
return headers, result
|
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_jar")
load("@bazel_tools//tools/build_defs/repo:jvm.bzl", "jvm_maven_import_external")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("@bazelrio//:deps_utils.bzl", "cc_library_headers", "cc_library_shared", "cc_library_sources", "cc_library_static")
def setup_wpilib_2022_1_1_beta_1_dependencies():
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpilibc_wpilibc-cpp_linuxathena",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibc/wpilibc-cpp/2022.1.1-beta-1/wpilibc-cpp-2022.1.1-beta-1-linuxathena.zip",
sha256 = "c926798f365dcb52f8da4b3aa16d2b712a0b180e71990dab9013c53cb51ec8c9",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpilibc_wpilibc-cpp_linuxathenastatic",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibc/wpilibc-cpp/2022.1.1-beta-1/wpilibc-cpp-2022.1.1-beta-1-linuxathenastatic.zip",
sha256 = "134d58c2d76ee9fc57f2e8c69b3f937175d98b9f33cd7b2f11504f2b16ca57a0",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpilibc_wpilibc-cpp_windowsx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibc/wpilibc-cpp/2022.1.1-beta-1/wpilibc-cpp-2022.1.1-beta-1-windowsx86-64.zip",
sha256 = "634688e85581e4067213b8578b8f1368aada728e2f894f7ac0460e60390dc3a6",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpilibc_wpilibc-cpp_linuxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibc/wpilibc-cpp/2022.1.1-beta-1/wpilibc-cpp-2022.1.1-beta-1-linuxx86-64.zip",
sha256 = "9cccf85bd6d0a576174d2bc352eda5f46fbba2878ff74a33711f99c21d0e3467",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpilibc_wpilibc-cpp_osxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibc/wpilibc-cpp/2022.1.1-beta-1/wpilibc-cpp-2022.1.1-beta-1-osxx86-64.zip",
sha256 = "042f30b8ff66f862868df5557d38b1518f85641ad3b824b13e5804137da0955e",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpilibc_wpilibc-cpp_windowsx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibc/wpilibc-cpp/2022.1.1-beta-1/wpilibc-cpp-2022.1.1-beta-1-windowsx86-64static.zip",
sha256 = "19076d7738bdcf3351286750abcd63cf3b9be3ae094975c1a44212d618ffdd93",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpilibc_wpilibc-cpp_linuxx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibc/wpilibc-cpp/2022.1.1-beta-1/wpilibc-cpp-2022.1.1-beta-1-linuxx86-64static.zip",
sha256 = "c1a67b54dece57acefc92a888f85320b1623fa1d3e55b6b36721841c0a0c8926",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpilibc_wpilibc-cpp_osxx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibc/wpilibc-cpp/2022.1.1-beta-1/wpilibc-cpp-2022.1.1-beta-1-osxx86-64static.zip",
sha256 = "88834ad637e9c7a3b92c1dca72a7a18b00f67e711ab4e51125bfff44996c5331",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpilibc_wpilibc-cpp_headers",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibc/wpilibc-cpp/2022.1.1-beta-1/wpilibc-cpp-2022.1.1-beta-1-headers.zip",
sha256 = "ee96572633364a858348ecfd781a54a915ec44e61ff66c74d115dc5a25667788",
build_file_content = cc_library_headers,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpilibc_wpilibc-cpp_sources",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibc/wpilibc-cpp/2022.1.1-beta-1/wpilibc-cpp-2022.1.1-beta-1-sources.zip",
sha256 = "3811ded44c6350f51047b115a50c713fdeb81e68f47b6fb0c17131117e7d9f9b",
build_file_content = cc_library_sources,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_hal_hal-cpp_linuxathena",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/hal/hal-cpp/2022.1.1-beta-1/hal-cpp-2022.1.1-beta-1-linuxathena.zip",
sha256 = "ccb9f76f81afde7100eee4940a19d5ccd5cba8a558570b9a1f1a051430a6d262",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_hal_hal-cpp_linuxathenastatic",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/hal/hal-cpp/2022.1.1-beta-1/hal-cpp-2022.1.1-beta-1-linuxathenastatic.zip",
sha256 = "9711645efa98f61a9634ce2bd68a1aae56bcfcd9944b8ada2bd7564480f5d66e",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_hal_hal-cpp_windowsx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/hal/hal-cpp/2022.1.1-beta-1/hal-cpp-2022.1.1-beta-1-windowsx86-64.zip",
sha256 = "2ac30bba83f507dfa4b63bb9605153a5f40b95d4f17ae91229c96fe9ea0cd4ac",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_hal_hal-cpp_linuxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/hal/hal-cpp/2022.1.1-beta-1/hal-cpp-2022.1.1-beta-1-linuxx86-64.zip",
sha256 = "da54ece30b3d429f1a6263b90a316e9ab4f891176412704be9825225e39afaf3",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_hal_hal-cpp_osxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/hal/hal-cpp/2022.1.1-beta-1/hal-cpp-2022.1.1-beta-1-osxx86-64.zip",
sha256 = "8299fbc2e2ac770deabf4c6cd37cfa1a8efef9fd700a3f2ca99d7e1c6a6ec40d",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_hal_hal-cpp_windowsx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/hal/hal-cpp/2022.1.1-beta-1/hal-cpp-2022.1.1-beta-1-windowsx86-64static.zip",
sha256 = "217867fabddf6331c0aa950431e3d2c6430f8afee5754736a96c904431abc557",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_hal_hal-cpp_linuxx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/hal/hal-cpp/2022.1.1-beta-1/hal-cpp-2022.1.1-beta-1-linuxx86-64static.zip",
sha256 = "c090c7a22f179b0987fec03f603656b1ec5ce1666ba4c70ef8473a9a7803a075",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_hal_hal-cpp_osxx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/hal/hal-cpp/2022.1.1-beta-1/hal-cpp-2022.1.1-beta-1-osxx86-64static.zip",
sha256 = "0386e15436bd22dffb4e18829c0bc58c19d7520512bc7c9af92b494ef33f41ce",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_hal_hal-cpp_headers",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/hal/hal-cpp/2022.1.1-beta-1/hal-cpp-2022.1.1-beta-1-headers.zip",
sha256 = "a4f8a16b4082577733d10ba420fcae5174ceaec7f42260fb60197fb317f89335",
build_file_content = cc_library_headers,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_hal_hal-cpp_sources",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/hal/hal-cpp/2022.1.1-beta-1/hal-cpp-2022.1.1-beta-1-sources.zip",
sha256 = "8913794392a9a8a33577f454e0ad055f9985d9b54dc7857e06b85fc2944d5de7",
build_file_content = cc_library_sources,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpiutil_wpiutil-cpp_linuxathena",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpiutil/wpiutil-cpp/2022.1.1-beta-1/wpiutil-cpp-2022.1.1-beta-1-linuxathena.zip",
sha256 = "0959646557ae65cc3be8894ee8d39beb7c951ffd6be993ab58c709851069bdf3",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpiutil_wpiutil-cpp_linuxathenastatic",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpiutil/wpiutil-cpp/2022.1.1-beta-1/wpiutil-cpp-2022.1.1-beta-1-linuxathenastatic.zip",
sha256 = "1fb70cd539e29463bb468a5fd4f8342fdbfd51fbe123abb3183eeb69ba18831b",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpiutil_wpiutil-cpp_windowsx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpiutil/wpiutil-cpp/2022.1.1-beta-1/wpiutil-cpp-2022.1.1-beta-1-windowsx86-64.zip",
sha256 = "cc10bb439a75f6d97f89761ed27cc1df12dffd330d6fc052383a21d8a9575ffb",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpiutil_wpiutil-cpp_linuxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpiutil/wpiutil-cpp/2022.1.1-beta-1/wpiutil-cpp-2022.1.1-beta-1-linuxx86-64.zip",
sha256 = "fcfc83f420f57549d1f8068edd1e1182f2c5bc7562caca6129326ba116621d5d",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpiutil_wpiutil-cpp_osxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpiutil/wpiutil-cpp/2022.1.1-beta-1/wpiutil-cpp-2022.1.1-beta-1-osxx86-64.zip",
sha256 = "4dfff5233bb7b0b8ea3c4b9eefc31d0c17fd0962ffaf785ec87305bd6b55e5da",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpiutil_wpiutil-cpp_windowsx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpiutil/wpiutil-cpp/2022.1.1-beta-1/wpiutil-cpp-2022.1.1-beta-1-windowsx86-64static.zip",
sha256 = "3c54a5440519e4001fdd3e3e4c7f4a5c9cc26c7a4d6910bc0a5b66e5fa4459be",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpiutil_wpiutil-cpp_linuxx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpiutil/wpiutil-cpp/2022.1.1-beta-1/wpiutil-cpp-2022.1.1-beta-1-linuxx86-64static.zip",
sha256 = "099125e210b1a3ddcd1854bbfa236dbe6477dd1bd6ed7dcc1c95f12b0e212a61",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpiutil_wpiutil-cpp_osxx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpiutil/wpiutil-cpp/2022.1.1-beta-1/wpiutil-cpp-2022.1.1-beta-1-osxx86-64static.zip",
sha256 = "fbf604a990af907944923157c20d33d3bc2050cf40a719abdd3c14344e69f4b2",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpiutil_wpiutil-cpp_headers",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpiutil/wpiutil-cpp/2022.1.1-beta-1/wpiutil-cpp-2022.1.1-beta-1-headers.zip",
sha256 = "6efa9420ef875cd69a4d3d55ebfde2b9ed0ed2bd61db9811dcb2e274b0ae56d8",
build_file_content = cc_library_headers,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpiutil_wpiutil-cpp_sources",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpiutil/wpiutil-cpp/2022.1.1-beta-1/wpiutil-cpp-2022.1.1-beta-1-sources.zip",
sha256 = "ed55b6ea290b075a9a7f1c94852a50c1a5e28ce3e01d3cab713811eeca03803d",
build_file_content = cc_library_sources,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_ntcore_ntcore-cpp_linuxathena",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/ntcore/ntcore-cpp/2022.1.1-beta-1/ntcore-cpp-2022.1.1-beta-1-linuxathena.zip",
sha256 = "099448b290666ca9d594e28fb21c5b4d199b31669d61d8d26b7b837245f74dc3",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_ntcore_ntcore-cpp_linuxathenastatic",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/ntcore/ntcore-cpp/2022.1.1-beta-1/ntcore-cpp-2022.1.1-beta-1-linuxathenastatic.zip",
sha256 = "aad15ca5bd6976730465ba1896f07576529e8384a2a3740ab60345a430ff0bb3",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_ntcore_ntcore-cpp_windowsx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/ntcore/ntcore-cpp/2022.1.1-beta-1/ntcore-cpp-2022.1.1-beta-1-windowsx86-64.zip",
sha256 = "389018e731f998c8fe2ce42e80cf2eae60935a386d3c40af54f7cf9159e9a70e",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_ntcore_ntcore-cpp_linuxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/ntcore/ntcore-cpp/2022.1.1-beta-1/ntcore-cpp-2022.1.1-beta-1-linuxx86-64.zip",
sha256 = "98483d6dea79148389d25ce0ece2ea474d43a041d39aaaf3998bc51a2b109b53",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_ntcore_ntcore-cpp_osxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/ntcore/ntcore-cpp/2022.1.1-beta-1/ntcore-cpp-2022.1.1-beta-1-osxx86-64.zip",
sha256 = "07989a5109f6aab4fab038fb36b25511b965d0179bdcf7ba13b6d200d77592e4",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_ntcore_ntcore-cpp_windowsx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/ntcore/ntcore-cpp/2022.1.1-beta-1/ntcore-cpp-2022.1.1-beta-1-windowsx86-64static.zip",
sha256 = "c0acb88ac54d06cebba5374aa6ef10ba9f4f6019c1352718c5d8ce70232a55d6",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_ntcore_ntcore-cpp_linuxx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/ntcore/ntcore-cpp/2022.1.1-beta-1/ntcore-cpp-2022.1.1-beta-1-linuxx86-64static.zip",
sha256 = "5b3623a3f6d87f33d98cec7d6e6a7bb1983bf43f1056d9983fbb4c15d269821a",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_ntcore_ntcore-cpp_osxx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/ntcore/ntcore-cpp/2022.1.1-beta-1/ntcore-cpp-2022.1.1-beta-1-osxx86-64static.zip",
sha256 = "765bdd0196a487125b4076dd5eaabfaf2c4a0e37391a975592c3d141e7ae39e0",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_ntcore_ntcore-cpp_headers",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/ntcore/ntcore-cpp/2022.1.1-beta-1/ntcore-cpp-2022.1.1-beta-1-headers.zip",
sha256 = "403322df2c7637bc0c47e5437d4fea678962375989149f5ae6ecf81810b80d67",
build_file_content = cc_library_headers,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_ntcore_ntcore-cpp_sources",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/ntcore/ntcore-cpp/2022.1.1-beta-1/ntcore-cpp-2022.1.1-beta-1-sources.zip",
sha256 = "db0e677a833054cccb0df6eefcad8888970f2b9c65a7b0c6211ce1969c32acb2",
build_file_content = cc_library_sources,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpimath_wpimath-cpp_linuxathena",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpimath/wpimath-cpp/2022.1.1-beta-1/wpimath-cpp-2022.1.1-beta-1-linuxathena.zip",
sha256 = "86090d1cde7a10662abb7e163f5920e743ca0210a72691f3edaaa7501bd7381a",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpimath_wpimath-cpp_linuxathenastatic",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpimath/wpimath-cpp/2022.1.1-beta-1/wpimath-cpp-2022.1.1-beta-1-linuxathenastatic.zip",
sha256 = "b4d6c1a57c398dd131baa5632e66257d139c22620b31637abfb9cb2eec641fa2",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpimath_wpimath-cpp_windowsx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpimath/wpimath-cpp/2022.1.1-beta-1/wpimath-cpp-2022.1.1-beta-1-windowsx86-64.zip",
sha256 = "064beaffc16feee23c01a868cfc6b548537badc5332a0cc753f5714dedb0f6d3",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpimath_wpimath-cpp_linuxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpimath/wpimath-cpp/2022.1.1-beta-1/wpimath-cpp-2022.1.1-beta-1-linuxx86-64.zip",
sha256 = "403826a614ed8a46720b52f89d8d337ce6cc89c55bddde29667af65b7f1d9d79",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpimath_wpimath-cpp_osxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpimath/wpimath-cpp/2022.1.1-beta-1/wpimath-cpp-2022.1.1-beta-1-osxx86-64.zip",
sha256 = "e89d7504bea9ae7007bc80b13d595451e2486f449dd3c1878783000dcc95fc80",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpimath_wpimath-cpp_windowsx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpimath/wpimath-cpp/2022.1.1-beta-1/wpimath-cpp-2022.1.1-beta-1-windowsx86-64static.zip",
sha256 = "48ebd0fe7e162ac5a624055768e07237278885657697e8533cad5bd8656b5373",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpimath_wpimath-cpp_linuxx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpimath/wpimath-cpp/2022.1.1-beta-1/wpimath-cpp-2022.1.1-beta-1-linuxx86-64static.zip",
sha256 = "6c224639a477f789cc4198022bf07014ccd28a7643025e8bcd8157d300d42753",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpimath_wpimath-cpp_osxx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpimath/wpimath-cpp/2022.1.1-beta-1/wpimath-cpp-2022.1.1-beta-1-osxx86-64static.zip",
sha256 = "3737e59c8c0d70b3926426f3fba0c3f7c9275d5c6dbaf68708631578de6ff8a1",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpimath_wpimath-cpp_headers",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpimath/wpimath-cpp/2022.1.1-beta-1/wpimath-cpp-2022.1.1-beta-1-headers.zip",
sha256 = "5dfd502ac49fc6f0fa33727b2078389ac3616ee995b9878b34d85e07d908ed0a",
build_file_content = cc_library_headers,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpimath_wpimath-cpp_sources",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpimath/wpimath-cpp/2022.1.1-beta-1/wpimath-cpp-2022.1.1-beta-1-sources.zip",
sha256 = "edaf77f5ee765213fac1c39169c8cf7568cf6a0e1fe1841cea56385f10a4483a",
build_file_content = cc_library_sources,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_cameraserver_cameraserver-cpp_linuxathena",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/cameraserver/cameraserver-cpp/2022.1.1-beta-1/cameraserver-cpp-2022.1.1-beta-1-linuxathena.zip",
sha256 = "47885af110d9faca20b952fcb952563ba0aef3dd7aab9b9693712d63b96f46a3",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_cameraserver_cameraserver-cpp_linuxathenastatic",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/cameraserver/cameraserver-cpp/2022.1.1-beta-1/cameraserver-cpp-2022.1.1-beta-1-linuxathenastatic.zip",
sha256 = "ed2ba5e2be2542de80ae974f29b47e9a788184425497e88b65ca6525d3ea0ce0",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_cameraserver_cameraserver-cpp_windowsx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/cameraserver/cameraserver-cpp/2022.1.1-beta-1/cameraserver-cpp-2022.1.1-beta-1-windowsx86-64.zip",
sha256 = "1a2860600a2265578b5eb4ee04bf54286fd6a853a46821d299e40d2828fd5162",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_cameraserver_cameraserver-cpp_linuxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/cameraserver/cameraserver-cpp/2022.1.1-beta-1/cameraserver-cpp-2022.1.1-beta-1-linuxx86-64.zip",
sha256 = "5f6e5dd516217cae42849a83b58a4072d4df0250aac0d5c704cba400cc7a2b7f",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_cameraserver_cameraserver-cpp_osxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/cameraserver/cameraserver-cpp/2022.1.1-beta-1/cameraserver-cpp-2022.1.1-beta-1-osxx86-64.zip",
sha256 = "85c1840acbb9592776e788cf352c64f0ceaa2f17167290211940c0e6f6affe12",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_cameraserver_cameraserver-cpp_windowsx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/cameraserver/cameraserver-cpp/2022.1.1-beta-1/cameraserver-cpp-2022.1.1-beta-1-windowsx86-64static.zip",
sha256 = "c53615899910ae011f21824ec0cbfb462d0ad8a8630ddef9576674bfa6238d32",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_cameraserver_cameraserver-cpp_linuxx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/cameraserver/cameraserver-cpp/2022.1.1-beta-1/cameraserver-cpp-2022.1.1-beta-1-linuxx86-64static.zip",
sha256 = "414c15f0fcc21ef814a515af73319284193817784766e963bf548ea088c32912",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_cameraserver_cameraserver-cpp_osxx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/cameraserver/cameraserver-cpp/2022.1.1-beta-1/cameraserver-cpp-2022.1.1-beta-1-osxx86-64static.zip",
sha256 = "598281e2232aa2adfa56a64359e2c26fde8ac211fac2e76ef8bb28ce7875759c",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_cameraserver_cameraserver-cpp_headers",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/cameraserver/cameraserver-cpp/2022.1.1-beta-1/cameraserver-cpp-2022.1.1-beta-1-headers.zip",
sha256 = "0c5abbef3b75a0c628a25fd5c5f014d1fd13f4e6f9a142e3c44fdcc7ce3ee5a2",
build_file_content = cc_library_headers,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_cameraserver_cameraserver-cpp_sources",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/cameraserver/cameraserver-cpp/2022.1.1-beta-1/cameraserver-cpp-2022.1.1-beta-1-sources.zip",
sha256 = "e4c046e19b1aef915f501dcfc7944abd608412d080c064d788610f5a470d0a28",
build_file_content = cc_library_sources,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_cscore_cscore-cpp_linuxathena",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/cscore/cscore-cpp/2022.1.1-beta-1/cscore-cpp-2022.1.1-beta-1-linuxathena.zip",
sha256 = "382221f7ba2942cf74e96a56a3a2d8d2a581ff1a187d4fdc26970520ffa36eaf",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_cscore_cscore-cpp_linuxathenastatic",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/cscore/cscore-cpp/2022.1.1-beta-1/cscore-cpp-2022.1.1-beta-1-linuxathenastatic.zip",
sha256 = "98889140f84057385ca8263405ade9b11a552ca3bacbbaa327f32515d16e0bec",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_cscore_cscore-cpp_windowsx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/cscore/cscore-cpp/2022.1.1-beta-1/cscore-cpp-2022.1.1-beta-1-windowsx86-64.zip",
sha256 = "d5bbb852db8ba3345495bbd1fe865f3d650a13349a1d0fb8c401de702bc1206f",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_cscore_cscore-cpp_linuxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/cscore/cscore-cpp/2022.1.1-beta-1/cscore-cpp-2022.1.1-beta-1-linuxx86-64.zip",
sha256 = "ed33579479ed14b317995507782a35a18c49569705d72f5118004093c6b9a7ae",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_cscore_cscore-cpp_osxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/cscore/cscore-cpp/2022.1.1-beta-1/cscore-cpp-2022.1.1-beta-1-osxx86-64.zip",
sha256 = "bb2fd292aeb59e3c05b495cdf3889885601fc1de5520597b779dd1bc90976db9",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_cscore_cscore-cpp_windowsx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/cscore/cscore-cpp/2022.1.1-beta-1/cscore-cpp-2022.1.1-beta-1-windowsx86-64static.zip",
sha256 = "be3c019597b8787c05d0c0c82096466a00d622e8bc8e1cb58569dfff28ab66d3",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_cscore_cscore-cpp_linuxx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/cscore/cscore-cpp/2022.1.1-beta-1/cscore-cpp-2022.1.1-beta-1-linuxx86-64static.zip",
sha256 = "dde2724d4c88fe659aea7b855ae4ab55105963c2a2f5db6ebca93f6f49b89a42",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_cscore_cscore-cpp_osxx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/cscore/cscore-cpp/2022.1.1-beta-1/cscore-cpp-2022.1.1-beta-1-osxx86-64static.zip",
sha256 = "47d3c6b7fae8808eda0c31a148890f43cbd7093b499d869bb48dece5ccb6c7f1",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_cscore_cscore-cpp_headers",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/cscore/cscore-cpp/2022.1.1-beta-1/cscore-cpp-2022.1.1-beta-1-headers.zip",
sha256 = "95d3cd2305e89dec7d82e6ece371d95b1786ac456ac6277f6a2746febeb73d1c",
build_file_content = cc_library_headers,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_cscore_cscore-cpp_sources",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/cscore/cscore-cpp/2022.1.1-beta-1/cscore-cpp-2022.1.1-beta-1-sources.zip",
sha256 = "ab6536f368e736c97edd79ed018a129549fa5cf9810b6bfd509a267fb17e594d",
build_file_content = cc_library_sources,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpiliboldcommands_wpiliboldcommands-cpp_linuxathena",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibOldCommands/wpilibOldCommands-cpp/2022.1.1-beta-1/wpilibOldCommands-cpp-2022.1.1-beta-1-linuxathena.zip",
sha256 = "475483064284e6922327b0d58bf3511ca4671f7b527d37a014217c995516d12c",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpiliboldcommands_wpiliboldcommands-cpp_linuxathenastatic",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibOldCommands/wpilibOldCommands-cpp/2022.1.1-beta-1/wpilibOldCommands-cpp-2022.1.1-beta-1-linuxathenastatic.zip",
sha256 = "a70860defafb87cf2f09fe5a2495ae5d7332fe5de1a46c4832e06febfca3e3b1",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpiliboldcommands_wpiliboldcommands-cpp_windowsx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibOldCommands/wpilibOldCommands-cpp/2022.1.1-beta-1/wpilibOldCommands-cpp-2022.1.1-beta-1-windowsx86-64.zip",
sha256 = "ed3a372a0ee57db77f9021f3494e52fdd36afeeb076211d37a4df438a299b3c9",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpiliboldcommands_wpiliboldcommands-cpp_linuxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibOldCommands/wpilibOldCommands-cpp/2022.1.1-beta-1/wpilibOldCommands-cpp-2022.1.1-beta-1-linuxx86-64.zip",
sha256 = "4f60f242a3fc52aa409266ba9590c61bf6e4f52c88d2da863ef0d69fa0144de4",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpiliboldcommands_wpiliboldcommands-cpp_osxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibOldCommands/wpilibOldCommands-cpp/2022.1.1-beta-1/wpilibOldCommands-cpp-2022.1.1-beta-1-osxx86-64.zip",
sha256 = "66ee7560050f7fd4465642da518d3e05088e5417b3d0fa4f715f14ec25b3b4f1",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpiliboldcommands_wpiliboldcommands-cpp_windowsx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibOldCommands/wpilibOldCommands-cpp/2022.1.1-beta-1/wpilibOldCommands-cpp-2022.1.1-beta-1-windowsx86-64static.zip",
sha256 = "4257f7c892132c3253a3dc35afbf12323cd1fc715537278276e1a6db12b1c002",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpiliboldcommands_wpiliboldcommands-cpp_linuxx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibOldCommands/wpilibOldCommands-cpp/2022.1.1-beta-1/wpilibOldCommands-cpp-2022.1.1-beta-1-linuxx86-64static.zip",
sha256 = "70276571e289259ebe07fbc68e1747f0623b86770bf847c6af3cdfc71b297478",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpiliboldcommands_wpiliboldcommands-cpp_osxx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibOldCommands/wpilibOldCommands-cpp/2022.1.1-beta-1/wpilibOldCommands-cpp-2022.1.1-beta-1-osxx86-64static.zip",
sha256 = "60246184ac373a5d377008f80f9a49f1a1dd973cc7ca820b09af9dad80731d24",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpiliboldcommands_wpiliboldcommands-cpp_headers",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibOldCommands/wpilibOldCommands-cpp/2022.1.1-beta-1/wpilibOldCommands-cpp-2022.1.1-beta-1-headers.zip",
sha256 = "9d5ab40d7dce760faaad3798c00844a1d2f1235695266edd5445934a8c3ecf7f",
build_file_content = cc_library_headers,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpiliboldcommands_wpiliboldcommands-cpp_sources",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibOldCommands/wpilibOldCommands-cpp/2022.1.1-beta-1/wpilibOldCommands-cpp-2022.1.1-beta-1-sources.zip",
sha256 = "cfb4874270dcefd3bffa021ecbc218ff4f21491665c8ce6dfe68aa3239c8f49d",
build_file_content = cc_library_sources,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpilibnewcommands_wpilibnewcommands-cpp_linuxathena",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibNewCommands/wpilibNewCommands-cpp/2022.1.1-beta-1/wpilibNewCommands-cpp-2022.1.1-beta-1-linuxathena.zip",
sha256 = "25f8e6c5eeaff7b8131d26b82fb6b7d790e1c69d794bd73397611f575decd9fe",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpilibnewcommands_wpilibnewcommands-cpp_linuxathenastatic",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibNewCommands/wpilibNewCommands-cpp/2022.1.1-beta-1/wpilibNewCommands-cpp-2022.1.1-beta-1-linuxathenastatic.zip",
sha256 = "eab92c0b8828b775edfc8a56dc12cdfa9c847582ed9093022308fbec1f46b647",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpilibnewcommands_wpilibnewcommands-cpp_windowsx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibNewCommands/wpilibNewCommands-cpp/2022.1.1-beta-1/wpilibNewCommands-cpp-2022.1.1-beta-1-windowsx86-64.zip",
sha256 = "623ebee022435a80c1d63ed6cc3f4f5086c156863714b924bc789881af5effaf",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpilibnewcommands_wpilibnewcommands-cpp_linuxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibNewCommands/wpilibNewCommands-cpp/2022.1.1-beta-1/wpilibNewCommands-cpp-2022.1.1-beta-1-linuxx86-64.zip",
sha256 = "67a59105f1e279035197221c4512eb746a92cc830af3eb918ea2e8a48d0d557c",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpilibnewcommands_wpilibnewcommands-cpp_osxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibNewCommands/wpilibNewCommands-cpp/2022.1.1-beta-1/wpilibNewCommands-cpp-2022.1.1-beta-1-osxx86-64.zip",
sha256 = "22e3d809e7509690c9147f9c43ef8ba4a1acc52ac7b020a46ac96b55fc534f78",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpilibnewcommands_wpilibnewcommands-cpp_windowsx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibNewCommands/wpilibNewCommands-cpp/2022.1.1-beta-1/wpilibNewCommands-cpp-2022.1.1-beta-1-windowsx86-64static.zip",
sha256 = "fb3deee37a2e9e9157f3ae4fe9631cee54f776081be601e8da8f3dca9ad0e578",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpilibnewcommands_wpilibnewcommands-cpp_linuxx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibNewCommands/wpilibNewCommands-cpp/2022.1.1-beta-1/wpilibNewCommands-cpp-2022.1.1-beta-1-linuxx86-64static.zip",
sha256 = "f7f3af6846e0ceaa334b9332802c6b02d6e3ecc471f163ec78e53d4a3f1a15e8",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpilibnewcommands_wpilibnewcommands-cpp_osxx86-64static",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibNewCommands/wpilibNewCommands-cpp/2022.1.1-beta-1/wpilibNewCommands-cpp-2022.1.1-beta-1-osxx86-64static.zip",
sha256 = "d035191b46d152d1406337394138c989cd1ebcc11eb15ad407ac234ba64d5789",
build_file_content = cc_library_static,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpilibnewcommands_wpilibnewcommands-cpp_headers",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibNewCommands/wpilibNewCommands-cpp/2022.1.1-beta-1/wpilibNewCommands-cpp-2022.1.1-beta-1-headers.zip",
sha256 = "136f1a8bfc41e903cb63d20cc03754db505a1ebba6c0e1ab498e31632f28f154",
build_file_content = cc_library_headers,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_wpilibnewcommands_wpilibnewcommands-cpp_sources",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/wpilibNewCommands/wpilibNewCommands-cpp/2022.1.1-beta-1/wpilibNewCommands-cpp-2022.1.1-beta-1-sources.zip",
sha256 = "13de71a91d7ad1a1c1ed8ae900ddba97f279174c3a82ab5c277cda6eccf2585f",
build_file_content = cc_library_sources,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_halsim_halsim_ds_socket_windowsx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/halsim/halsim_ds_socket/2022.1.1-beta-1/halsim_ds_socket-2022.1.1-beta-1-windowsx86-64.zip",
sha256 = "8b41bd26ca874ff3d6d7d4bf34ae54d6dfe763b0611d6a25d1cdf82db4d65b55",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_halsim_halsim_ds_socket_linuxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/halsim/halsim_ds_socket/2022.1.1-beta-1/halsim_ds_socket-2022.1.1-beta-1-linuxx86-64.zip",
sha256 = "aa8015098b6e3dcb71edf8a3bfb2aab92f1e0360b4045538f15592ead24cf2e6",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_halsim_halsim_ds_socket_osxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/halsim/halsim_ds_socket/2022.1.1-beta-1/halsim_ds_socket-2022.1.1-beta-1-osxx86-64.zip",
sha256 = "dc4a908e576ac0af2ea0ac4147da13ce541ef114b90183823057bab7506e8d8c",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_halsim_halsim_gui_windowsx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/halsim/halsim_gui/2022.1.1-beta-1/halsim_gui-2022.1.1-beta-1-windowsx86-64.zip",
sha256 = "2eea12aeafe46a57589533eedd8693f8e15ec973c68001ec78b14c9744f56fd7",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_halsim_halsim_gui_linuxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/halsim/halsim_gui/2022.1.1-beta-1/halsim_gui-2022.1.1-beta-1-linuxx86-64.zip",
sha256 = "da89913dd83ccaefb65ce3056cecb2ccd6a01cf1b3fbe8ceb868b8eeb2a93e43",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_halsim_halsim_gui_osxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/halsim/halsim_gui/2022.1.1-beta-1/halsim_gui-2022.1.1-beta-1-osxx86-64.zip",
sha256 = "57c6614f08b60a1a1274b293cdf559166b7725b0079b5f3a81c828e65938b52b",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_halsim_halsim_ws_client_windowsx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/halsim/halsim_ws_client/2022.1.1-beta-1/halsim_ws_client-2022.1.1-beta-1-windowsx86-64.zip",
sha256 = "38e14c93b68d118ea1d5ca963ca44d2564ce6a0182c345b6e46a17e033c34cd9",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_halsim_halsim_ws_client_linuxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/halsim/halsim_ws_client/2022.1.1-beta-1/halsim_ws_client-2022.1.1-beta-1-linuxx86-64.zip",
sha256 = "574a865b137ee07259b0320b0b9bb4f173afd14e08c232a98fac67a2e2698c82",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_halsim_halsim_ws_client_osxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/halsim/halsim_ws_client/2022.1.1-beta-1/halsim_ws_client-2022.1.1-beta-1-osxx86-64.zip",
sha256 = "95884c7e85aa2abfce610036a76f18dd29a91e12eef59c6f9dad08ac137aab4d",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_halsim_halsim_ws_server_windowsx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/halsim/halsim_ws_server/2022.1.1-beta-1/halsim_ws_server-2022.1.1-beta-1-windowsx86-64.zip",
sha256 = "a32abc69d6672cdc6ea0c91369aea67db4d1658762d040a5e6fe8e095562e919",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_halsim_halsim_ws_server_linuxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/halsim/halsim_ws_server/2022.1.1-beta-1/halsim_ws_server-2022.1.1-beta-1-linuxx86-64.zip",
sha256 = "04df8fb4270e877569e5fe5e180ab00f7f9b4b9e79007edfb1e7e4a8bc7eb48a",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_halsim_halsim_ws_server_osxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/halsim/halsim_ws_server/2022.1.1-beta-1/halsim_ws_server-2022.1.1-beta-1-osxx86-64.zip",
sha256 = "838d001c5a43d6a1d8e1fd30501879d301d953e8ab9ca1727fcb3b0887ab6e58",
build_file_content = cc_library_shared,
)
maybe(
jvm_maven_import_external,
name = "__bazelrio_edu_wpi_first_shuffleboard_api",
artifact = "edu.wpi.first.shuffleboard:api:2022.1.1-beta-1",
artifact_sha256 = "9c6376870f388fec8888eb0e50c04b3047633c83837132279d665be261a84bc6",
server_urls = ["https://frcmaven.wpi.edu/release"],
)
maybe(
jvm_maven_import_external,
name = "__bazelrio_edu_wpi_first_wpilibj_wpilibj-java",
artifact = "edu.wpi.first.wpilibj:wpilibj-java:2022.1.1-beta-1",
artifact_sha256 = "ef4869b33ad1ec3c1c29b805bf6ac952495ef28f4affd0038f0e8435f4f7e76f",
server_urls = ["https://frcmaven.wpi.edu/release"],
)
maybe(
jvm_maven_import_external,
name = "__bazelrio_edu_wpi_first_hal_hal-java",
artifact = "edu.wpi.first.hal:hal-java:2022.1.1-beta-1",
artifact_sha256 = "dff7d3775ec7c9483a3680b40545b021f57840b71575ae373e28a7dba6f0b696",
server_urls = ["https://frcmaven.wpi.edu/release"],
)
maybe(
jvm_maven_import_external,
name = "__bazelrio_edu_wpi_first_wpiutil_wpiutil-java",
artifact = "edu.wpi.first.wpiutil:wpiutil-java:2022.1.1-beta-1",
artifact_sha256 = "84f951c38694c81d29470b69e76eb3812cc25f50733136ca13ce06a68edea96b",
server_urls = ["https://frcmaven.wpi.edu/release"],
)
maybe(
jvm_maven_import_external,
name = "__bazelrio_edu_wpi_first_ntcore_ntcore-java",
artifact = "edu.wpi.first.ntcore:ntcore-java:2022.1.1-beta-1",
artifact_sha256 = "c06b743e2e12690a0e5c7cf34ade839d46091f5ecad5617c544173baa5bacaa2",
server_urls = ["https://frcmaven.wpi.edu/release"],
)
maybe(
jvm_maven_import_external,
name = "__bazelrio_edu_wpi_first_wpimath_wpimath-java",
artifact = "edu.wpi.first.wpimath:wpimath-java:2022.1.1-beta-1",
artifact_sha256 = "5c5889793fb13bdf2e5381d08ddea6e0cc932d8b401c01d9cb8a03de71a91678",
server_urls = ["https://frcmaven.wpi.edu/release"],
)
maybe(
jvm_maven_import_external,
name = "__bazelrio_edu_wpi_first_cameraserver_cameraserver-java",
artifact = "edu.wpi.first.cameraserver:cameraserver-java:2022.1.1-beta-1",
artifact_sha256 = "31006372443254e750a5effb2e89288e928b6009a2a7675da9ccee874bd8246d",
server_urls = ["https://frcmaven.wpi.edu/release"],
)
maybe(
jvm_maven_import_external,
name = "__bazelrio_edu_wpi_first_cscore_cscore-java",
artifact = "edu.wpi.first.cscore:cscore-java:2022.1.1-beta-1",
artifact_sha256 = "23a0c922dbd6e3a5a7af528afa13d19419aa1d47b808a3ea3b101a1030ad0073",
server_urls = ["https://frcmaven.wpi.edu/release"],
)
maybe(
jvm_maven_import_external,
name = "__bazelrio_edu_wpi_first_wpiliboldcommands_wpiliboldcommands-java",
artifact = "edu.wpi.first.wpilibOldCommands:wpilibOldCommands-java:2022.1.1-beta-1",
artifact_sha256 = "81dea5a894326acca1891473dbc1adec0b66ef94e45778799a566bfe9b7c7f6d",
server_urls = ["https://frcmaven.wpi.edu/release"],
)
maybe(
jvm_maven_import_external,
name = "__bazelrio_edu_wpi_first_wpilibnewcommands_wpilibnewcommands-java",
artifact = "edu.wpi.first.wpilibNewCommands:wpilibNewCommands-java:2022.1.1-beta-1",
artifact_sha256 = "3842455781a71aa340468163e911b166573e966c7d5fbfd46e8091909b96e326",
server_urls = ["https://frcmaven.wpi.edu/release"],
)
maybe(
http_jar,
name = "__bazelrio_edu_wpi_first_tools_smartdashboard_linux64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/tools/SmartDashboard/2022.1.1-beta-1/SmartDashboard-2022.1.1-beta-1-linux64.jar",
sha256 = "fb421832c106f6f9ebe1f33e196245f045da3d98492b3a68cabc93c16099e330",
)
maybe(
http_jar,
name = "__bazelrio_edu_wpi_first_tools_smartdashboard_mac64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/tools/SmartDashboard/2022.1.1-beta-1/SmartDashboard-2022.1.1-beta-1-mac64.jar",
sha256 = "55d6f7981c28e41a79f081918184ad3f238ae99364fc7761de66a122bd32ee47",
)
maybe(
http_jar,
name = "__bazelrio_edu_wpi_first_tools_smartdashboard_win64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/tools/SmartDashboard/2022.1.1-beta-1/SmartDashboard-2022.1.1-beta-1-win64.jar",
sha256 = "afc725e395bb97d71e12ee89aeac22bd3f5afec724e69f24dedd2e8fc8e6622b",
)
maybe(
http_jar,
name = "__bazelrio_edu_wpi_first_tools_pathweaver_linux64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/tools/PathWeaver/2022.1.1-beta-1/PathWeaver-2022.1.1-beta-1-linux64.jar",
sha256 = "e28f067e874772780ce6760b1376a78112cc021ec1eef906e55fe98881fe0d29",
)
maybe(
http_jar,
name = "__bazelrio_edu_wpi_first_tools_pathweaver_mac64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/tools/PathWeaver/2022.1.1-beta-1/PathWeaver-2022.1.1-beta-1-mac64.jar",
sha256 = "33dda4aee5c592ce56504875628553b0c1a69ef3fc6bb51ecff111a363866cda",
)
maybe(
http_jar,
name = "__bazelrio_edu_wpi_first_tools_pathweaver_win64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/tools/PathWeaver/2022.1.1-beta-1/PathWeaver-2022.1.1-beta-1-win64.jar",
sha256 = "6a5058800532570a027de9c70f686223880296974820b736a09889755f9fecc7",
)
maybe(
http_jar,
name = "__bazelrio_edu_wpi_first_tools_robotbuilder",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/tools/RobotBuilder/2022.1.1-beta-1/RobotBuilder-2022.1.1-beta-1.jar",
sha256 = "d431daca5c2c24ddd0a147826b13fb0dfdfc89f3862b9bbda60d0bdecd188e0a",
)
maybe(
http_jar,
name = "__bazelrio_edu_wpi_first_shuffleboard_shuffleboard_linux64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/shuffleboard/shuffleboard/2022.1.1-beta-1/shuffleboard-2022.1.1-beta-1-linux64.jar",
sha256 = "4c2862156bf207c87d5463b54a5745383086712903eb8c0b53b5fa268881b5ed",
)
maybe(
http_jar,
name = "__bazelrio_edu_wpi_first_shuffleboard_shuffleboard_mac64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/shuffleboard/shuffleboard/2022.1.1-beta-1/shuffleboard-2022.1.1-beta-1-mac64.jar",
sha256 = "a28e1b869c9d7baeb4c1775e485147c4fb586b0fbc61da79ecdea93af57b7408",
)
maybe(
http_jar,
name = "__bazelrio_edu_wpi_first_shuffleboard_shuffleboard_win64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/shuffleboard/shuffleboard/2022.1.1-beta-1/shuffleboard-2022.1.1-beta-1-win64.jar",
sha256 = "3271f09fc3f990964a402b47cdc1c08c1219fe01cb59d33fb9742b2e069fbf9c",
)
maybe(
http_archive,
name = "__bazelrio_edu_wpi_first_tools_glass_windowsx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/tools/Glass/2022.1.1-beta-1/Glass-2022.1.1-beta-1-windowsx86-64.zip",
sha256 = "61b5d458f06afb4db00e37182c26899f3cc0d94d7831cb0b6a071dca7bf136c8",
build_file_content = "filegroup(name='all', srcs=glob(['**']), visibility=['//visibility:public'])",
)
maybe(
http_archive,
name = "__bazelrio_edu_wpi_first_tools_glass_linuxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/tools/Glass/2022.1.1-beta-1/Glass-2022.1.1-beta-1-linuxx86-64.zip",
sha256 = "2f0e3deacc8ee86906a2b40d37d11766397103aa8e211bfbcc8adf5803b848bd",
build_file_content = "filegroup(name='all', srcs=glob(['**']), visibility=['//visibility:public'])",
)
maybe(
http_archive,
name = "__bazelrio_edu_wpi_first_tools_glass_osxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/tools/Glass/2022.1.1-beta-1/Glass-2022.1.1-beta-1-osxx86-64.zip",
sha256 = "798928072fb1210984cc4f891567d4595080a0d009c4704065ccb0b054830773",
build_file_content = "filegroup(name='all', srcs=glob(['**']), visibility=['//visibility:public'])",
)
maybe(
http_archive,
name = "__bazelrio_edu_wpi_first_tools_outlineviewer_windowsx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/tools/OutlineViewer/2022.1.1-beta-1/OutlineViewer-2022.1.1-beta-1-windowsx86-64.zip",
sha256 = "b9c80208ce59344b2170f49c37bf69e90c29161921a302398643949614a7d7d7",
build_file_content = "filegroup(name='all', srcs=glob(['**']), visibility=['//visibility:public'])",
)
maybe(
http_archive,
name = "__bazelrio_edu_wpi_first_tools_outlineviewer_linuxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/tools/OutlineViewer/2022.1.1-beta-1/OutlineViewer-2022.1.1-beta-1-linuxx86-64.zip",
sha256 = "99a7a29752d14caab11a0bd6fdb2e0aecf215ea0b5b52da9fa05336902e38c60",
build_file_content = "filegroup(name='all', srcs=glob(['**']), visibility=['//visibility:public'])",
)
maybe(
http_archive,
name = "__bazelrio_edu_wpi_first_tools_outlineviewer_osxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/tools/OutlineViewer/2022.1.1-beta-1/OutlineViewer-2022.1.1-beta-1-osxx86-64.zip",
sha256 = "7d32f193cbbcb692ccfbba3edf582261dc40fed9cdfbde042f71933d84193161",
build_file_content = "filegroup(name='all', srcs=glob(['**']), visibility=['//visibility:public'])",
)
maybe(
http_archive,
name = "__bazelrio_edu_wpi_first_tools_sysid_windowsx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/tools/SysId/2022.1.1-beta-1/SysId-2022.1.1-beta-1-windowsx86-64.zip",
sha256 = "4b417e19c18b38cc2d887db45ccdcc0511a1c9dc7b03146cb3d693e36abde912",
build_file_content = "filegroup(name='all', srcs=glob(['**']), visibility=['//visibility:public'])",
)
maybe(
http_archive,
name = "__bazelrio_edu_wpi_first_tools_sysid_linuxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/tools/SysId/2022.1.1-beta-1/SysId-2022.1.1-beta-1-linuxx86-64.zip",
sha256 = "7d2eaebb9d465a58fa1684538508dd693431b7759462a6a445ab44655caadd8b",
build_file_content = "filegroup(name='all', srcs=glob(['**']), visibility=['//visibility:public'])",
)
maybe(
http_archive,
name = "__bazelrio_edu_wpi_first_tools_sysid_osxx86-64",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/tools/SysId/2022.1.1-beta-1/SysId-2022.1.1-beta-1-osxx86-64.zip",
sha256 = "001ed38d1aa29828a717cfb5a041e3d5ed899cc3bd4ba38bac965f19bc0e221b",
build_file_content = "filegroup(name='all', srcs=glob(['**']), visibility=['//visibility:public'])",
)
|
class Display(object):
@classmethod
def getColumns(cls):
raise NotImplementedError
@classmethod
def getRows(cls):
raise NotImplementedError
@classmethod
def getRowText(cls, row):
raise NotImplementedError
def show(self):
for i in range(int(self.getRows())):
print(self.getRowText(i))
|
def fact(a):
if a<=1:
return 1
return a*fact(a-1)
a = int(input())
for i in range(a):
n=int(input())
print(fact(n))
|
#!/usr/bin/env python
# coding: utf-8
class Solution:
def numSubarrayProductLessThanK(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: int
"""
if not nums:
return 0
prod = nums[0]
head, tail = 0, 0
count = 0
while tail < len(nums):
if head > tail:
if head >= len(nums):
break
tail = head
prod = nums[tail]
elif prod < k:
# print(head, tail, prod)
count += (tail - head + 1)
tail += 1
if tail == len(nums):
break
prod *= nums[tail]
else:
prod //= nums[head]
head += 1
return count
if __name__ == '__main__':
sol = Solution().numSubarrayProductLessThanK
print(sol([10, 5, 2, 6], 100))
print(sol([10, 5, 2, 6], 1))
print(sol([10, 5, 2, 6], 0))
|
""" Binary Search Algortihm
--------------------------------------------------
"""
#iterative implementation of binary search in Python def binary_search(a+list, item):
""" Performs iterative bonary search to find the position of an integer in a given, sorted, list.
a_list -- sorted list of integers
item -- integer you are searching for the position of
"""
first = 0
last = len(a_list)-1
while first <= last:
i = (first + last)/2
if a_list[i]==item:
return 'found at position '.format(item=item, i=i)
elif a_list[i] > item:
last = i - 1
elif a_list[i] < item:
first = i + 1
else:
return 'not found in the list'.format(item=item)
#recursive implementation of binary search in python
def binary_search_recursive(a_list, item):
""" Performs recursive binary search of an integer in a gien, sorted, list.
a_list -- integer you are searching for the position of
"""
first = 0
last = len(a_list)-1
if len(a_list) == 0:
return 'was not found in the list '.format(item=item)
else:
i = (first + last)//2
if item == a_list[i]:
return ' found'.format(item=item)
else:
if a_list[i] < item:
return binary_search_recursive(a_list[i+1:], item)
else:
return binary_search_recursive(a_list[:1], item)
|
'''
package fitnesse.slim;
import java.util.List;
import fitnesse.util.ListUtility;
'''
'''
Packs up a list into a serialized string using a special format. The list items must be strings, or lists.
They will be recursively serialized.
Format: [iiiiii:llllll:item...]
All lists (including lists within lists) begin with [ and end with ]. After the [ is the 6 digit number of items
in the list followed by a :. Then comes each item which is composed of a 6 digit length a : and then the value
of the item followed by a :.
'''
def serialize(data):
return ListSerializer(data).serialize()
class ListSerializer(object):
def __init__(self, data):
self.data = data
self.result = ''
'''
private StringBuffer result;
private List<Object> list;
public ListSerializer(List<Object> list) {
this.list = list;
result = new StringBuffer();
}
public static String serialize(List<Object> list) {
return new ListSerializer(list).serialize();
}
'''
def serialize(self):
self.result += '['
self.appendLength(len(self.data))
for o in self.data:
s = self.marshalObjectToString(o)
self.appendLength(len(s))
self.appendString(s)
self.result += ']'
return self.result
'''
public String serialize() {
result.append('[');
appendLength(list.size());
for (Object o : list) {
String s = marshalObjectToString(o);
appendLength(s.length());
appendString(s);
}
result.append(']');
return result.toString();
}
private String marshalObjectToString(Object o) {
String s;
if (o == null)
s = "null";
else if (o instanceof String)
s = (String) o;
else if (o instanceof List)
s = ListSerializer.serialize(ListUtility.uncheckedCast(Object.class, o));
else
s = o.toString();
return s;
}
'''
def marshalObjectToString(self, o):
s = ''
if o == None:
s = 'null'
elif type(o) == str:
s = o
elif type(o) == list:
s = serialize(o)
return s
'''
private void appendString(String s) {
result.append(s).append(':');
}
'''
def appendString(self, s):
self.result += s + ':'
'''
private void appendLength(int size) {
result.append(String.format("%06d:", size));
}
'''
def appendLength(self, size):
self.result += "%06d:" % size
'''
}
'''
|
def selection_sort(array):
N = len(array)
for i in range(N):
# Find the min element in the unsorted a[i .. N - 1]
# Assume the min is the first element.
minimum_element_index = i
for j in range(i + 1, N):
if (array[j] < array[minimum_element_index]):
# Found a new minimum, remember its index.
minimum_element_index = j
if (minimum_element_index != i):
# Move minimum element to the "front" or "left".
array[i], array[minimum_element_index] = \
array[minimum_element_index], array[i]
return array |
def store_email(liste_mails):
res = {}
for addr in liste_mails:
n = addr.split('@')
if n[1] not in res:
res[n[1]] = []
res[n[1]].append(n[0])
res[n[1]].sort()
return res
print(store_email(["[email protected]", "[email protected]",
"[email protected]", "sé[email protected]",
"[email protected]", "[email protected]",
"[email protected]" ]))
# {
# 'prof.ur' : ['ludo', 'sébastien']
# 'stud.ulb' : ['andre.colon']
# 'profs.ulb' : ['bernard', 'jean', 'thierry']
# 'stud.ur' : ['eric.ramzi']
# }
# {'prof.ur': ['ludo', 'sébastien'], 'stud.ulb': ['andre.colon'], 'profs.ulb': ['thierry', 'bernard', 'jean'], 'stud.ur': ['eric.ramzi']}
# {'prof.ur': ['ludo', 'sébastien'], 'stud.ulb': ['andre.colon'], 'profs.ulb': ['bernard', 'jean', 'thierry']; 'stud.ur': ['eric.ramzi']} |
width = 10
precision = 4
value = decimal.Decimal("12.34567")
f"result: {value:{width}.{precision}}"
rf"result: {value:{width}.{precision}}"
foo(f'this SHOULD be a multi-line string because it is '
f'very long and does not fit on one line. And {value} is the value.')
foo('this SHOULD be a multi-line string, but not reflowed because it is '
f'very long and and also unusual. And {value} is the value.')
foo(fR"this should NOT be \t "
rF'a multi-line string \n')
|
"""
Here are data files describing three graphs: g1.txt, g2.txt, g3.txt.
The first line indicates the number of vertices and edges, respectively. Each
subsequent line describes an edge (the first two numbers are its tail and head,
respectively) and its length (the third number).
NOTE: some of the edge lengths are negative.
NOTE: These graphs may or may not have negative-cost cycles.
Your task is to compute the "shortest shortest path". Precisely, you must first
identify which, if any, of the three graphs have no negative cycles. For each
such graph, you should compute all-pairs shortest paths and remember the
smallest one.
If each of the three graphs has a negative-cost cycle, then enter "NULL" in the
box below. If exactly one graph has no negative-cost cycles, then enter the
length of its shortest shortest path in the box below. If two or more of the
graphs have no negative-cost cycles, then enter the smallest of the lengths of
their shortest shortest paths in the box below.
TODO: need to implement a heap structure for dijkstra's algorithm to process
big graph
"""
def dijkstra(graph, source):
Q = list(graph.keys())
dist = [1000000] * len(graph)
prev = [None] * len(graph)
dist[source-1] = 0
while Q:
distQ = [dist[v-1] for v in Q]
u = Q[distQ.index(min(distQ))]
Q.remove(u)
for e in graph[u]:
v, lengthuv = e
alt = dist[u-1] + lengthuv
if alt < dist[v-1]:
dist[v-1] = alt
prev[v-1] = u
return dist, prev
def bellman_ford(edges, n, source):
"""This implementation takes in a graph, represented as lists of vertices
(represented as integers [0..n-1]) and edges, and fills two arrays
(distance and predecessor) holding the shortest path from the source to
each vertex
NOTE: vertices start from 0
Examples:
>>> edges = [
>>> (0, 1, 2), (1, 2, 2), (2, 3, 2),
>>> (0, 4, 4), (4, 3, 4), (1, 4, 1)
>>> ]
>>> dist = bellman_ford(edges, 5, 0)
>>> print(dist)
[0, 2, 4, 6, 3]
>>> edges = [
>>> (0, 1, 2), (1, 2, 2), (2, 3, 2),
>>> (4, 0, 1), (4, 3, 4), (1, 4, -5)
>>> ]
>>> dist = bellman_ford(edges, 5, 0)
>>> print(dist)
Graph contains a negative-weight cycle
None
"""
# Step 1: initialize graph
weights = [e[2] for e in edges]
dist = [max(weights) * n] * n
predecessor = [None] * n
dist[0] = 0
# Step 2: relax edges |V|−1 times
for i in range(n-1):
for (u, v, w) in edges:
if dist[u] + w < dist[v]:
dist[v] = dist[u] + w
predecessor[v] = u
# Step 3: check for negative-weight cycles
for (u, v, w) in edges:
if dist[u] + w < dist[v]:
print("Graph contains a negative-weight cycle")
return None
return dist
def johnson_apsp(edges, n):
"""This function impements a Johnson's algorithm. This algorithm find the
shortest paths between all pairs of vertices in an edge-weighted, directed
graph. It allows some of the edge weights to be negative numbers, but no
negative-weight cycles may exist. It works by using the Bellman–Ford
algorithm to compute a transformation of the input graph that removes all
negative weights, allowing Dijkstra's algorithm to be used on the
transformed graph.
https://en.wikipedia.org/wiki/Johnson%27s_algorithm
NOTE: vertices start from 1
Examples:
>>> edges = [
>>> (1, 2, 2), (2, 3, 2), (3, 4, 2),
>>> (1, 5, 4), (5, 4, 4), (2, 5, 1)
>>> ]
>>> dists = johnson_apsp(edges, 5)
>>> print(dists)
[[0, 2, 4, 6, 3], [1000000, 0, 2, 4, 1], [1000000, 1000000, 0, 2, 1000000],
[1000000, 1000000, 1000000, 0, 1000000], [1000000, 1000000, 1000000, 4, 0]]
>>> edges = [
>>> (1, 2, 2), (2, 3, 2), (3, 4, 2),
>>> (5, 1, 1), (5, 4, 4), (2, 5, -5)
>>> ]
>>> dist = johnson_apsp(edges, 5)
>>> print(dist)
Graph contains a negative-weight cycle
None
"""
# Form G' by adding a new vertex s and a new edge (s, v) with length 0
# for each v ∈ G. Original graph has node starts from 1, extended starts
# from 0
edges_extended = edges + [(0, i, 0) for i in range(1, n+1)]
# Run Bellman-Ford on G' with source vertex s. [If B-F detects a
# negative-cost cycle in G' (which must lie in G), halt + report this.]
# For each v ∈ G , define p(v) = length of a shortest s → v path in G'.
p = bellman_ford(edges_extended, n+1, 0)
if p:
edges_reweighted = edges.copy()
# For each edge e = (u, v) ∈ G, define w'(e) = w(e) + p(u) − p(v)
for i in range(len(edges)):
u, v, w = edges[i]
edges_reweighted[i] = (u, v, w + p[u] - p[v])
# convert edges presentation to adjacency lists
graph = {i: [] for i in range(1, n+1)}
for (u, v, w) in edges_reweighted:
graph[u].append((v, w))
# For each vertex u of G : Run Dijkstra’s algorithm in G , with edge
# lengths w'(e), with source vertex u, to compute the shortest-path
# distance d'(u, v) for each v ∈ G
dists = []
for u in range(1, n+1):
# print(f"Processing {u}/{n}")
dist, _ = dijkstra(graph, u)
# For each pair u, v ∈ G , return the shortest-path distance
# d(u, v) := d'(u, v) − p(u) + p(v)
for v in range(1, n+1):
dist[v-1] = dist[v-1] - p[u-1] + p[v-1]
dists.append(dist)
return dists
else:
return None
if __name__ == "__main__":
for file in ["g1.txt", "g2.txt", "g3.txt"]:
f = open(file)
lines = f.readlines()
n, m = (int(s) for s in lines[0].split())
edges = [[int(s) for s in line.split()] for line in lines[1:]]
dists = johnson_apsp(edges, n)
if dists:
min_dist = min([d for ds in dists for d in ds])
print(min_dist)
# TODO: VERY SLOW, NEEDS FURTHER OPTIMIZATION OF CODE
# f = open("large.txt")
# lines = f.readlines()
# n, m = (int(s) for s in lines[0].split())
# edges = [[int(s) for s in line.split()] for line in lines[1:]]
# dists = johnson_apsp(edges, n)
# if dists:
# min_dist = min([d for ds in dists for d in ds])
# print(min_dist)
|
# Event: LCCS Python Fundamental Skills Workshop
# Date: May 2018
# Author: Joe English, PDST
# eMail: [email protected]
# Purpose: A program to demonstrate string concatenation
noun = input("Enter a singular noun: ")
print("The plural of "+noun+" is "+noun+"s")
|
elements = {
0: {
"element": 0,
"description": "",
"dynamic": False,
"bitmap": False,
"len": 0,
"format": "",
"start_position": 0,
"end_position": 0
},
1: {
"element": 1,
"description": "Bitmap Secondary",
"dynamic": False,
"bitmap": True,
"len": 16,
"format": "AN",
"start_position": 0,
"end_position": 16
},
3: {
"element": 3,
"description": "Processing Code",
"dynamic": False,
"bitmap": False,
"len": 6,
"format": "N",
"start_position": 16,
"end_position": 22
},
4: {
"element": 4,
"description": "Transaction Amount",
"dynamic": False,
"bitmap": False,
"len": 12,
"format": "N",
"start_position": 22,
"end_position": 34
},
7: {
"element": 7,
"description": "Transmission Date and Time",
"dynamic": False,
"bitmap": False,
"len": 10,
"format": "N",
"start_position": 34,
"end_position": 44
},
11: {
"element": 11,
"description": "Systems Trace Audit Number",
"dynamic": False,
"bitmap": False,
"len": 6,
"format": "N",
"start_position": 44,
"end_position": 50
},
12: {
"element": 12,
"description": "Local Transaction Time",
"dynamic": False,
"bitmap": False,
"len": 6,
"format": "N",
"start_position": 50,
"end_position": 56
},
13: {
"element": 13,
"description": "Local Transaction Date",
"dynamic": False,
"bitmap": False,
"len": 4,
"format": "N",
"start_position": 56,
"end_position": 60
},
14: {
"element": 14,
"description": "Settlement Date",
"dynamic": False,
"bitmap": False,
"len": 4,
"format": "N",
"start_position": 60,
"end_position": 64
}
}
|
def write_html(messages):
file = open("messages.html","w")
html = []
html.append('<html>\n<head>\n\t<meta http-equiv="Content-Type" content = "text/html" charset=UTF-8 >\n')
html.append('\t<link rel="stylesheet" href="body.css">\n')
html.append('\t<base href="../../"/>\n')
html.append('\t<title>Beatriz Valladares</title>\n')
html.append('</head>\n')
html.append('\t<body class="_5vb_ _2yq _4yic">\n')
html.append('\t<div class="clearfix _ikh"><div class="_4bl9"><div class="_li"><div id="bluebarRoot" class="_2t-8 _1s4v _2s1x _h2p _3b0a"><div aria-label="Facebook" class="_2t-a _26aw _5rmj _50ti _2s1y" role="banner"><div class="_2t-a _50tj"><div class="_2t-a _4pmj _2t-d"><div class="_218o"><div class="_2t-e"><div class="_4kny"><h1 class="_19ea" data-click="bluebar_logo"><a class="_19eb" data-gt="{"chrome_nav_item":"logo_chrome"}" href="https://www.facebook.com/?ref=logo"><span class="_2md">Facebook</span></a></h1></div></div><div aria-label="Facebook" class="_2t-f" role="navigation"><div class="_cy6" id="bluebar_profile_and_home"><div class="_4kny"><div class="_1k67 _cy7" data-click="profile_icon"><a accesskey="2" data-gt="{"chrome_nav_item":"timeline_chrome"}" class="_2s25 _606w" href="https://www.facebook.com/osniel.quintana" title="Perfil"><span class="_1qv9"><img class="_2qgu _7ql _1m6h img" src="https://scontent.ftpa1-1.fna.fbcdn.net/v/t1.0-1/p24x24/28577591_1570706753048642_5187107547097320467_n.jpg?_nc_cat=0&_nc_ad=z-m&_nc_cid=0&oh=97807afcd09fe84405ca0235bff672b2&oe=5C2336CD" alt="" id="profile_pic_header_100003279974709" /><span class="_1vp5">Osniel</span></span></a></div></div><div class="_4kny _2s24"><a class="_2s25 _cy7" href="index.html" title="Inicio">Inicio</a></div></div></div></div></div></div></div></div><div class="_3a_u"><div class="_3-8y _3-95 _3b0b"><div style="background-color: #3578E5" class="_3z-t"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAALVBMVEUAAAD///////////////////////////////////////////////////////+hSKubAAAADnRSTlMA7zDfcM8QYEC/gK+fj+TZazYAAABuSURBVAhbPc2xDQFhAAbQLyTKSxjgQvQKEeV12itELRIjiAVUNrCFUcQKf5yG5M2gwQLvJTlySZIprJNeDWWcPbDMFQy7NGy822cou8OJMEomhPNiUJNtd7PikbaAV/o/5y9nBvMkVfnu1T1J8gFhkEwPa1z8VAAAAABJRU5ErkJggg==" /></div><div class="_3b0c"><div class="_3b0d">Beatriz Valladares</div></div></div><div class="_4t5n" role="main">\n')
for message in messages:
html.append(write_message(message))
html.append('\t</div></div></div></div></div>\n')
html.append('\t</body>\n')
html.append('\n</html>')
toWrite = u''.join(html).encode('latin-1').strip()
file.write(toWrite)
file.close()
def write_message(message):
sms = []
sms.append('\t<div class="pam _3-95 _2pi0 _2lej uiBoxWhite noborder">\n')
sms.append('\t\t<div class="_3-96 _2pio _2lek _2lel">\n')
sms.append('\t\t\t' + message['sender_name'] + '\n')
sms.append('\t\t</div>\n')
sms.append('\t\t<div class="_3-96 _2let"><div><div></div><div>\n')
sms.append('\t\t\t' + message['content'] + '\n')
sms.append('\t\t</div><div></div><div></div></div></div>\n')
sms.append('\t\t<div class="_3-94 _2lem">\n')
sms.append('\t\t\t' + message['timestamp_ms'])
sms.append('\t\t</div></div>\n')
return ''.join(sms)
|
msg = str(input('Número ponto flutuante: '))
numf = msg.replace(',', '.')
print(numf)
n = float(numf)
print(n) |
class ViradaCulturalSpider(CrawlSpider):
name = "virada_cultural"
start_urls = ["http://conteudo.icmc.usp.br/Portal/conteudo/484/243/alunos-especiais"]
def parse(self, response):
self.logger.info('A response from %s just arrived!', response.url)
|
red = (255,0,0)
green = (0,255,0)
blue = (0,0,255)
darkBlue = (0,0,128)
white = (255,255,255)
black = (0,0,0)
pink = (255,200,200)
|
#Programa 3.1- Exemplo de sequência e tempo
divida = 0
compra = 100
divida = divida + compra
compra = 200
divida = divida + compra
compra = 300
divida = divida + compra
compra = 0
print (divida)
|
def createWordList(filename):
text_file= open(filename,"r")
temp = text_file.read().split("\n")
text_file.close()
temp.pop() #remove the last new line
return temp
def canWeMakeIt(myWord, myLetters):
listLetters=[]
for letter in myLetters:
listLetters.append (letter)
for x in myWord:
if x not in listLetters:
return False
else:
return True
def specificLength(s,l):
result = []
if l == 1:
for c in s:
result.append(c)
return result
for c in s:
words = specificLength(s.replace(c,'',1), l-1)
for w in words:
result.append(w+c)
return result
def makeCandidates(s):
wordSet=set()
for a in range(1,len(s)):
word= specificLength(s,a)
for x in word:
wordSet.add(x)
return wordSet
def wordList(s):
list1=makeCandidates(s)
list2=createWordList("wordlist.txt")
list3=[]
for a in list1:
if a in list2:
list3.append(a)
return list3
def getWordPoints(myWord):
letterPoints = {'a':1, 'b':3, 'c':3, 'd':2, 'e':1, 'f':4,\
'g':2, 'h':4, 'i':1, 'j':8, 'k':5, 'l':1,\
'm':3, 'n':1, 'o':1, 'p':3, 'q':10, 'r':1,\
's':1, 't':1, 'u':1, 'v':4, 'w':4, 'x':8,\
'y':4, 'z':10}
result=0
for letter in myWord:
result=result+letterPoints[letter]
return result
def scrabbleWords(myLetters):
list1=wordList(myLetters)
lst=list()
for word in list1:
point=getWordPoints(word)
lst.append((point,word))
lst.sort(reverse=True)
result=[]
for point,word in lst:
result.append([point,word])
return result
|
expected_output = {
"BDI3147": {
"interface": "BDI3147",
"redirects_disable": False,
"address_family": {
"ipv4": {
"version": {
1: {
"groups": {
31: {
"group_number": 31,
"hsrp_router_state": "active",
"statistics": {
"num_state_changes": 17
},
"last_state_change": "12w6d",
"primary_ipv4_address": {
"address": "10.190.99.49"
},
"virtual_mac_address": "0000.0c07.ac1f",
"virtual_mac_address_mac_in_use": True,
"local_virtual_mac_address": "0000.0c07.ac1f",
"local_virtual_mac_address_conf": "v1 default",
"timers": {
"hello_msec_flag": False,
"hello_sec": 3,
"hold_msec_flag": False,
"hold_sec": 10,
"next_hello_sent": 1.856
},
"active_router": "local",
"standby_priority": 90,
"standby_expires_in": 11.504,
"standby_router": "10.190.99.51",
"standby_ip_address": "10.190.99.51",
"priority": 110,
"configured_priority": 110,
"session_name": "hsrp-BD3147-31"
},
32: {
"group_number": 32,
"hsrp_router_state": "active",
"statistics": {
"num_state_changes": 17
},
"last_state_change": "12w6d",
"primary_ipv4_address": {
"address": "10.188.109.1"
},
"virtual_mac_address": "0000.0c07.ac20",
"virtual_mac_address_mac_in_use": True,
"local_virtual_mac_address": "0000.0c07.ac20",
"local_virtual_mac_address_conf": "v1 default",
"timers": {
"hello_msec_flag": False,
"hello_sec": 3,
"hold_msec_flag": False,
"hold_sec": 10,
"next_hello_sent": 2.496
},
"active_router": "local",
"standby_priority": 90,
"standby_expires_in": 10.576,
"standby_router": "10.188.109.3",
"standby_ip_address": "10.188.109.3",
"priority": 110,
"configured_priority": 110,
"session_name": "hsrp-BD3147-32"
}
}
}
}
}
},
"use_bia": False
}
}
|
# User Configuration variable settings for pitimolo
# Purpose - Motion Detection Security Cam
# Created - 20-Jul-2015 pi-timolo ver 2.94 compatible or greater
# Done by - Claude Pageau
configTitle = "pi-timolo default config motion"
configName = "pi-timolo-default-config"
# These settings should both be False if this script is run as a background /etc/init.d daemon
verbose = True # Sends detailed logging info to console. set to False if running script as daeman
logDataToFile = True # logs diagnostic data to a disk file for review default=False
debug = False # Puts in debug mode returns pixel average data for tuning
# print a test image
imageTestPrint = False # default=False Set to True to print one image and exit (useful for aligning camera)
# Image Settings
imageNamePrefix = 'cam1-' # Prefix for all image file names. Eg front-
imageWidth = 1024 # Full Size Image Width in px default=1024
imageHeight = 768 # Full Size Image Height in px default=768
imageVFlip = False # Flip image Vertically default=False
imageHFlip = False # Flip image Horizontally default=False
imageRotation = 0 # Rotate image. Valid values: 0, 90, 180 & 270
imagePreview = False # Preview image on connected RPI Monitor default=False
noNightShots = False # Don't Take images at Night default=False
noDayShots = False # Don't Take images during day time default=False
# Low Light Night Settings
nightMaxShut = 5.5 # default=5.5 sec Highest cam shut exposure time.
# IMPORTANT 6 sec works sometimes but occasionally locks RPI and HARD reboot required to clear
nightMinShut = .001 # default=.002 sec Lowest camera shut exposure time for transition from day to night (or visa versa)
nightMaxISO = 800 # default=800 Max cam ISO night setting
nightMinISO = 100 # lowest ISO camera setting for transition from day to night (or visa versa)
nightSleepSec = 10 # default=10 Sec - Time period to allow camera to calculate low light AWB
twilightThreshold = 40 # default=40 Light level to trigger day/night transition at twilight
# Date/Time Settings for Displaying info Directly on Images
showDateOnImage = True # Set to False for No display of date/time on image default= True
showTextFontSize = 18 # Size of image Font in pixel height
showTextBottom = True # Location of image Text True=Bottom False=Top
showTextWhite = True # Colour of image Text True=White False=Black
showTextWhiteNight = True # Change night text to white. Might help if night needs white instead of black during day or visa versa
# Motion Detect Settings
motionOn = True # True = motion capture is turned on. False= No motion detection
motionPrefix = "mo-" # Prefix Motion Detection images
motionDir = "motion" # Storage Folder for Motion Detect Images
threshold = 35 # How much a pixel has to change to be counted default=35 (1-200)
sensitivity = 100 # Number of changed pixels to trigger motion default=100
motionAverage = 2 # Number of images to average for motion verification: 1=last image only or 100=Med 300=High Average Etc.
useVideoPort = True # Use the video port to capture motion images - faster than the image port. Default=False
motionVideoOn = False # If set to True then video clip is taken rather than image
motionVideoTimer = 10 # Number of seconds of video clip to take if Motion Detected default=10
motionQuickTLOn = False # if set to True then take a quick time lapse sequence rather than a single image (overrides motionVideoOn)
motionQuickTLTimer = 10 # Duration in seconds of quick time lapse sequence after initial motion detected default=10
motionQuickTLInterval = 0 # Time between each Quick time lapse image 0 is fast as possible
motionForce = 60 * 60 # Force single motion image if no Motion Detected in specified seconds. default=60*60
motionNumOn = True # True=On (filenames by sequenced Number) otherwise date/time used for filenames
motionNumStart = 1000 # Start motion number sequence
motionNumMax = 500 # Max number of motion images desired. 0=Continuous default=0
motionNumRecycle = True # After numberMax reached restart at numberStart instead of exiting default=True
motionMaxDots = 100 # Number of motion dots before starting new line
createLockFile = False # default=False if True then sync.sh will call gdrive to sync files to your web google drive if .sync file exists
# Lock File is used to indicate motion images are added so sync.sh can sync in background via sudo crontab -e
# Time Lapse Settings
timelapseOn = True # Turns timelapse True=On False=Off
timelapseTimer = 60 # Seconds between timelapse images default=5*60
timelapseDir = "timelapse" # Storage Folder for Time Lapse Images
timelapsePrefix = "tl-" # Prefix timelapse images with this prefix
timelapseExit = 0 * 60 # Will Quit program after specified seconds 0=Continuous default=0
timelapseNumOn = False # True=On (filenames Sequenced by Number) otherwise date/time used for filename
timelapseNumStart = 1000 # Start of timelapse number sequence
timelapseNumMax = 2000 # Max number of timelapse images desired. 0=Continuous default=2000
timelapseNumRecycle = True # After numberMax reached restart at numberStart instead of exiting default=True
# ---------------------------------------------- End of User Variables -----------------------------------------------------
|
# This problem was asked by Facebook.
# Given a binary tree, return all paths from the root to leaves.
# For example, given the tree:
# 1
# / \
# 2 3
# / \
# 4 5
# Return [[1, 2], [1, 3, 4], [1, 3, 5]].
def getPaths(tree, path):
left = None
if tree.left:
left = getPaths(tree.left, path + [tree.value])
right = None
if tree.right:
right = getPaths(tree.right, path + [tree.value])
mergedList = []
if left:
mergedList = mergedList + left
if right:
mergedList = mergedList + right
if len(mergedList) > 0:
return mergedList
else:
return [path + [tree.value]]
class Node:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
two = Node(2)
four = Node(4)
five = Node(5)
three = Node(3)
three.left = four
three.right = five
one = Node(1)
one.left = two
one.right = three
print(getPaths(one, [])) |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File : __init__.py
# Author : yang <[email protected]>
# Date : 10.03.2019
# Last Modified Date: 11.03.2019
# Last Modified By : yang <[email protected]>
__all__ = ['pkgProj']
# from . import *
|
# Sum square difference
# Answer: 25164150
def sum_of_the_squares(min_value, max_value):
total = 0
for i in range(min_value, max_value + 1):
total += i ** 2
return total
def square_of_the_sum(min_value, max_value):
total = 0
for i in range(min_value, max_value + 1):
total += i
return total ** 2
def sum_square_difference(min_value, max_value):
return square_of_the_sum(min_value, max_value) - sum_of_the_squares(min_value, max_value)
if __name__ == "__main__":
print("Please enter the min and max values separated by a space: ", end='')
min_value, max_value = map(int, input().split())
print(sum_square_difference(min_value, max_value))
|
dia = input ('dia= ')
mes= input ('mês= ')
ano = input ('ano = ')
print ("você nasceu no dia " + dia + " no mês de " + mes + " de " + ano)
|
n1 = int(input('Digite um número: '))
n2 = int(input('Digite o segundo número: '))
n3 = n1 + n2
#comentário no pyton
print('{} + {} = {}'.format(n1, n2, n3)) |
# import pytest
def test_query_no_join(connection):
query = connection.get_sql_query(metrics=["total_item_revenue"], dimensions=["channel"])
correct = (
"SELECT order_lines.sales_channel as order_lines_channel,"
"SUM(order_lines.revenue) as order_lines_total_item_revenue "
"FROM analytics.order_line_items order_lines GROUP BY order_lines.sales_channel;"
)
assert query == correct
def test_alias_only_query(connection):
metric = connection.get_metric(metric_name="total_item_revenue")
query = metric.sql_query(query_type="SNOWFLAKE", alias_only=True)
assert query == "SUM(order_lines_total_item_revenue)"
def test_alias_only_query_number(connection):
metric = connection.get_metric(metric_name="line_item_aov")
query = metric.sql_query(query_type="SNOWFLAKE", alias_only=True)
assert query == "SUM(order_lines_total_item_revenue) / COUNT(orders_number_of_orders)"
def test_alias_only_query_symmetric_average_distinct(connection):
metric = connection.get_metric(metric_name="average_order_revenue")
query = metric.sql_query(query_type="SNOWFLAKE", alias_only=True)
correct = (
"(COALESCE(CAST((SUM(DISTINCT (CAST(FLOOR(COALESCE(order_lines_average_order_revenue, 0) "
"* (1000000 * 1.0)) AS DECIMAL(38,0))) + (TO_NUMBER(MD5(order_lines_order_id), "
"'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') % 1.0e27)::NUMERIC(38, 0)) "
"- SUM(DISTINCT (TO_NUMBER(MD5(order_lines_order_id), 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') "
"% 1.0e27)::NUMERIC(38, 0))) AS DOUBLE PRECISION) / CAST((1000000*1.0) AS "
"DOUBLE PRECISION), 0) / NULLIF(COUNT(DISTINCT CASE WHEN (order_lines_average_order_revenue) "
"IS NOT NULL THEN order_lines_order_id ELSE NULL END), 0))"
)
assert query == correct
def test_query_no_join_average_distinct(connection):
query = connection.get_sql_query(metrics=["average_order_revenue"], dimensions=["channel"])
correct = (
"SELECT order_lines.sales_channel as order_lines_channel,(COALESCE(CAST((SUM(DISTINCT "
"(CAST(FLOOR(COALESCE(order_lines.order_total, 0) * (1000000 * 1.0)) AS DECIMAL(38,0))) "
"+ (TO_NUMBER(MD5(order_lines.order_unique_id), 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') "
"% 1.0e27)::NUMERIC(38, 0)) - SUM(DISTINCT (TO_NUMBER(MD5(order_lines.order_unique_id), "
"'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') % 1.0e27)::NUMERIC(38, 0))) AS DOUBLE PRECISION) "
"/ CAST((1000000*1.0) AS DOUBLE PRECISION), 0) / NULLIF(COUNT(DISTINCT CASE WHEN "
"(order_lines.order_total) IS NOT NULL THEN order_lines.order_unique_id ELSE NULL END), 0)) "
"as order_lines_average_order_revenue FROM analytics.order_line_items order_lines "
"GROUP BY order_lines.sales_channel;"
)
assert query == correct
def test_query_single_join(connection):
query = connection.get_sql_query(metrics=["total_item_revenue"], dimensions=["channel", "new_vs_repeat"])
correct = (
"SELECT order_lines.sales_channel as order_lines_channel,"
"orders.new_vs_repeat as orders_new_vs_repeat,"
"SUM(order_lines.revenue) as order_lines_total_item_revenue FROM "
"analytics.order_line_items order_lines LEFT JOIN analytics.orders orders ON "
"order_lines.order_unique_id=orders.id GROUP BY order_lines.sales_channel,orders.new_vs_repeat;"
)
assert query == correct
def test_query_single_dimension(connection):
query = connection.get_sql_query(metrics=[], dimensions=["new_vs_repeat"])
correct = "SELECT orders.new_vs_repeat as orders_new_vs_repeat FROM "
correct += "analytics.order_line_items order_lines LEFT JOIN analytics.orders orders ON "
correct += "order_lines.order_unique_id=orders.id GROUP BY orders.new_vs_repeat;"
assert query == correct
def test_query_single_dimension_with_comment(connection):
query = connection.get_sql_query(metrics=["total_item_revenue"], dimensions=["parent_channel"])
correct = (
"SELECT CASE\n--- parent channel\nWHEN order_lines.sales_channel ilike '%social%' then "
"'Social'\nELSE 'Not Social'\nEND as order_lines_parent_channel,"
"SUM(order_lines.revenue) as order_lines_total_item_revenue "
"FROM analytics.order_line_items order_lines GROUP BY CASE\n--- parent channel\nWHEN "
"order_lines.sales_channel ilike '%social%' then 'Social'\nELSE 'Not Social'\nEND;"
)
assert query == correct
def test_query_single_dimension_with_multi_filter(connection):
query = connection.get_sql_query(metrics=["total_item_costs"], dimensions=["channel"])
correct = (
"SELECT order_lines.sales_channel as order_lines_channel,SUM(case when order_lines.product_name "
"= 'Portable Charger' and orders.revenue * 100 > 100 then order_lines.item_costs end) "
"as order_lines_total_item_costs FROM analytics.order_line_items order_lines LEFT JOIN "
"analytics.orders orders ON order_lines.order_unique_id=orders.id "
"GROUP BY order_lines.sales_channel;"
)
assert query == correct
def test_query_single_dimension_sa_duration(connection):
query = connection.get_sql_query(metrics=["average_days_between_orders"], dimensions=["product_name"])
correct = (
"SELECT order_lines.product_name as order_lines_product_name,(COALESCE(CAST((SUM(DISTINCT "
"(CAST(FLOOR(COALESCE(DATEDIFF('DAY', orders.previous_order_date, orders.order_date), 0) "
"* (1000000 * 1.0)) AS DECIMAL(38,0))) + (TO_NUMBER(MD5(orders.id), "
"'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') % 1.0e27)::NUMERIC(38, 0)) "
"- SUM(DISTINCT (TO_NUMBER(MD5(orders.id), 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') "
"% 1.0e27)::NUMERIC(38, 0))) AS DOUBLE PRECISION) / CAST((1000000*1.0) AS DOUBLE PRECISION), 0) "
"/ NULLIF(COUNT(DISTINCT CASE WHEN (DATEDIFF('DAY', orders.previous_order_date, "
"orders.order_date)) IS NOT NULL THEN orders.id "
"ELSE NULL END), 0)) as orders_average_days_between_orders "
"FROM analytics.order_line_items order_lines LEFT JOIN analytics.orders orders "
"ON order_lines.order_unique_id=orders.id GROUP BY order_lines.product_name;"
)
assert query == correct
def test_query_single_join_count(connection):
query = connection.get_sql_query(
metrics=["order_lines.count"],
dimensions=["channel", "new_vs_repeat"],
explore_name="order_lines_all",
)
correct = (
"SELECT order_lines.sales_channel as order_lines_channel,"
"orders.new_vs_repeat as orders_new_vs_repeat,"
"COUNT(order_lines.order_line_id) as order_lines_count FROM "
"analytics.order_line_items order_lines LEFT JOIN analytics.orders orders ON "
"order_lines.order_unique_id=orders.id GROUP BY order_lines.sales_channel,orders.new_vs_repeat;"
)
assert query == correct
def test_query_single_join_metric_with_sub_field(connection):
query = connection.get_sql_query(
metrics=["line_item_aov"],
dimensions=["channel"],
)
correct = (
"SELECT order_lines.sales_channel as order_lines_channel,SUM(order_lines.revenue) "
"/ NULLIF(COUNT(DISTINCT CASE WHEN (orders.id) IS NOT NULL "
"THEN orders.id ELSE NULL END), 0) as order_lines_line_item_aov "
"FROM analytics.order_line_items order_lines LEFT JOIN analytics.orders orders "
"ON order_lines.order_unique_id=orders.id GROUP BY order_lines.sales_channel;"
)
assert query == correct
def test_query_single_join_with_forced_additional_join(connection):
query = connection.get_sql_query(
metrics=["avg_rainfall"],
dimensions=["discount_promo_name"],
query_type="BIGQUERY",
)
correct = (
"SELECT discount_detail.promo_name as discount_detail_discount_promo_name,(COALESCE(CAST(("
"SUM(DISTINCT (CAST(FLOOR(COALESCE(country_detail.rain, 0) * (1000000 * 1.0)) AS FLOAT64))"
" + CAST(FARM_FINGERPRINT(CAST(country_detail.country AS STRING)) AS BIGNUMERIC)) - SUM(DISTINCT "
"CAST(FARM_FINGERPRINT(CAST(country_detail.country AS STRING)) AS BIGNUMERIC))) AS FLOAT64) "
"/ CAST((1000000*1.0) AS FLOAT64), 0) / NULLIF(COUNT(DISTINCT CASE WHEN "
"(country_detail.rain) IS NOT NULL THEN country_detail.country ELSE NULL END), "
"0)) as country_detail_avg_rainfall FROM analytics.order_line_items order_lines "
"LEFT JOIN analytics.orders orders ON order_lines.order_unique_id=orders.id "
"LEFT JOIN analytics_live.discounts discounts ON orders.id=discounts.order_id "
"LEFT JOIN analytics.discount_detail discount_detail "
"ON discounts.discount_id=discount_detail.discount_id "
"AND DATE_TRUNC(discounts.order_date, WEEK) is not null "
"LEFT JOIN (SELECT * FROM ANALYTICS.COUNTRY_DETAIL) as country_detail "
"ON discounts.country=country_detail.country GROUP BY discount_detail.promo_name;"
)
assert query == correct
def test_query_single_join_select_args(connection):
query = connection.get_sql_query(
metrics=["total_item_revenue"],
dimensions=["channel", "new_vs_repeat"],
select_raw_sql=[
"CAST(new_vs_repeat = 'Repeat' AS INT) as group_1",
"CAST(date_created > '2021-04-02' AS INT) as period",
],
)
correct = (
"SELECT order_lines.sales_channel as order_lines_channel,"
"orders.new_vs_repeat as orders_new_vs_repeat,"
"SUM(order_lines.revenue) as order_lines_total_item_revenue,"
"CAST(new_vs_repeat = 'Repeat' AS INT) as group_1,"
"CAST(date_created > '2021-04-02' AS INT) as period FROM "
"analytics.order_line_items order_lines LEFT JOIN analytics.orders orders ON "
"order_lines.order_unique_id=orders.id GROUP BY order_lines.sales_channel,orders.new_vs_repeat,"
)
correct += "CAST(new_vs_repeat = 'Repeat' AS INT),CAST(date_created > '2021-04-02' AS INT);"
assert query == correct
def test_query_single_join_with_case_raw_sql(connection):
query = connection.get_sql_query(
metrics=["total_item_revenue"],
dimensions=["is_on_sale_sql", "new_vs_repeat"],
)
correct = (
"SELECT CASE WHEN order_lines.product_name ilike '%sale%' then TRUE else FALSE end "
"as order_lines_is_on_sale_sql,orders.new_vs_repeat as orders_new_vs_repeat,"
"SUM(order_lines.revenue) as order_lines_total_item_revenue FROM "
"analytics.order_line_items order_lines LEFT JOIN analytics.orders orders "
"ON order_lines.order_unique_id=orders.id GROUP BY CASE WHEN order_lines.product_name "
"ilike '%sale%' then TRUE else FALSE end,orders.new_vs_repeat;"
)
assert query == correct
def test_query_single_join_with_case(connection):
query = connection.get_sql_query(
metrics=["total_item_revenue"],
dimensions=["is_on_sale_case", "new_vs_repeat"],
)
correct = "SELECT case when order_lines.product_name ilike '%sale%' then 'On sale' else 'Not on sale' end " # noqa
correct += "as order_lines_is_on_sale_case,orders.new_vs_repeat as orders_new_vs_repeat,"
correct += "SUM(order_lines.revenue) as order_lines_total_item_revenue FROM "
correct += "analytics.order_line_items order_lines LEFT JOIN analytics.orders orders "
correct += "ON order_lines.order_unique_id=orders.id GROUP BY case when order_lines.product_name "
correct += "ilike '%sale%' then 'On sale' else 'Not on sale' end,orders.new_vs_repeat;"
assert query == correct
def test_query_single_join_with_tier(connection):
query = connection.get_sql_query(
metrics=["total_item_revenue"],
dimensions=["order_tier", "new_vs_repeat"],
)
tier_case_query = "case when order_lines.revenue < 0 then 'Below 0' when order_lines.revenue >= 0 "
tier_case_query += "and order_lines.revenue < 20 then '[0,20)' when order_lines.revenue >= 20 and "
tier_case_query += "order_lines.revenue < 50 then '[20,50)' when order_lines.revenue >= 50 and "
tier_case_query += "order_lines.revenue < 100 then '[50,100)' when order_lines.revenue >= 100 and "
tier_case_query += "order_lines.revenue < 300 then '[100,300)' when order_lines.revenue >= 300 "
tier_case_query += "then '[300,inf)' else 'Unknown' end"
correct = (
f"SELECT {tier_case_query} as order_lines_order_tier,orders.new_vs_repeat as orders_new_vs_repeat,"
"SUM(order_lines.revenue) as order_lines_total_item_revenue FROM "
"analytics.order_line_items order_lines LEFT JOIN analytics.orders orders "
f"ON order_lines.order_unique_id=orders.id GROUP BY {tier_case_query},orders.new_vs_repeat;"
)
assert query == correct
def test_query_single_join_with_filter(connection):
query = connection.get_sql_query(
metrics=["number_of_email_purchased_items"],
dimensions=["channel", "new_vs_repeat"],
)
correct = (
"SELECT order_lines.sales_channel as order_lines_channel,"
"orders.new_vs_repeat as orders_new_vs_repeat,"
"COUNT(case when order_lines.sales_channel = 'Email' then order_lines.order_id end) "
"as order_lines_number_of_email_purchased_items FROM analytics.order_line_items "
"order_lines LEFT JOIN analytics.orders orders ON order_lines.order_unique_id=orders.id"
" GROUP BY order_lines.sales_channel,orders.new_vs_repeat;"
)
assert query == correct
def test_query_multiple_join(connection):
query = connection.get_sql_query(
metrics=["total_item_revenue"],
dimensions=["region", "new_vs_repeat"],
)
correct = (
"SELECT customers.region as customers_region,orders.new_vs_repeat as orders_new_vs_repeat,"
"SUM(order_lines.revenue) as order_lines_total_item_revenue FROM "
"analytics.order_line_items order_lines "
"LEFT JOIN analytics.orders orders ON order_lines.order_unique_id=orders.id "
"LEFT JOIN analytics.customers customers ON order_lines.customer_id=customers.customer_id "
"GROUP BY customers.region,orders.new_vs_repeat;"
)
assert query == correct
def test_query_multiple_join_where_dict(connection):
query = connection.get_sql_query(
metrics=["total_item_revenue"],
dimensions=["region", "new_vs_repeat"],
where=[{"field": "region", "expression": "not_equal_to", "value": "West"}],
)
correct = (
"SELECT customers.region as customers_region,orders.new_vs_repeat as orders_new_vs_repeat,"
"SUM(order_lines.revenue) as order_lines_total_item_revenue FROM "
"analytics.order_line_items order_lines "
"LEFT JOIN analytics.orders orders ON order_lines.order_unique_id=orders.id "
"LEFT JOIN analytics.customers customers ON order_lines.customer_id=customers.customer_id "
"WHERE customers.region<>'West' "
"GROUP BY customers.region,orders.new_vs_repeat;"
)
assert query == correct
def test_query_multiple_join_where_literal(connection):
query = connection.get_sql_query(
metrics=["total_item_revenue"],
dimensions=["region", "new_vs_repeat"],
where="first_order_week > '2021-07-12'",
)
correct = (
"SELECT customers.region as customers_region,orders.new_vs_repeat as orders_new_vs_repeat,"
"SUM(order_lines.revenue) as order_lines_total_item_revenue FROM "
"analytics.order_line_items order_lines "
"LEFT JOIN analytics.orders orders ON order_lines.order_unique_id=orders.id "
"LEFT JOIN analytics.customers customers ON order_lines.customer_id=customers.customer_id "
"WHERE DATE_TRUNC('WEEK', customers.first_order_date) > '2021-07-12' "
"GROUP BY customers.region,orders.new_vs_repeat;"
)
assert query == correct
def test_query_multiple_join_having_dict(connection):
query = connection.get_sql_query(
metrics=["total_item_revenue"],
dimensions=["region", "new_vs_repeat"],
having=[{"field": "total_item_revenue", "expression": "greater_than", "value": -12}],
)
correct = (
"SELECT customers.region as customers_region,orders.new_vs_repeat as orders_new_vs_repeat,"
"SUM(order_lines.revenue) as order_lines_total_item_revenue FROM "
"analytics.order_line_items order_lines "
"LEFT JOIN analytics.orders orders ON order_lines.order_unique_id=orders.id "
"LEFT JOIN analytics.customers customers ON order_lines.customer_id=customers.customer_id "
"GROUP BY customers.region,orders.new_vs_repeat HAVING SUM(order_lines.revenue)>-12;"
)
assert query == correct
def test_query_multiple_join_having_literal(connection):
query = connection.get_sql_query(
metrics=["total_item_revenue"],
dimensions=["region", "new_vs_repeat"],
having="total_item_revenue > -12",
)
correct = (
"SELECT customers.region as customers_region,orders.new_vs_repeat as orders_new_vs_repeat,"
"SUM(order_lines.revenue) as order_lines_total_item_revenue FROM "
"analytics.order_line_items order_lines "
"LEFT JOIN analytics.orders orders ON order_lines.order_unique_id=orders.id "
"LEFT JOIN analytics.customers customers ON order_lines.customer_id=customers.customer_id "
"GROUP BY customers.region,orders.new_vs_repeat HAVING SUM(order_lines.revenue) > -12;"
)
assert query == correct
def test_query_multiple_join_order_by_literal(connection):
query = connection.get_sql_query(
metrics=["total_item_revenue"],
dimensions=["region", "new_vs_repeat"],
order_by="total_item_revenue",
)
correct = (
"SELECT customers.region as customers_region,orders.new_vs_repeat as orders_new_vs_repeat,"
"SUM(order_lines.revenue) as order_lines_total_item_revenue FROM "
"analytics.order_line_items order_lines "
"LEFT JOIN analytics.orders orders ON order_lines.order_unique_id=orders.id "
"LEFT JOIN analytics.customers customers ON order_lines.customer_id=customers.customer_id "
"GROUP BY customers.region,orders.new_vs_repeat ORDER BY total_item_revenue ASC;"
)
assert query == correct
def test_query_multiple_join_all(connection):
query = connection.get_sql_query(
metrics=["total_item_revenue"],
dimensions=["region", "new_vs_repeat"],
where=[{"field": "region", "expression": "not_equal_to", "value": "West"}],
having=[{"field": "total_item_revenue", "expression": "greater_than", "value": -12}],
order_by=[{"field": "total_item_revenue", "sort": "desc"}],
)
correct = (
"SELECT customers.region as customers_region,orders.new_vs_repeat as orders_new_vs_repeat,"
"SUM(order_lines.revenue) as order_lines_total_item_revenue FROM "
"analytics.order_line_items order_lines "
"LEFT JOIN analytics.orders orders ON order_lines.order_unique_id=orders.id "
"LEFT JOIN analytics.customers customers ON order_lines.customer_id=customers.customer_id "
"WHERE customers.region<>'West' "
"GROUP BY customers.region,orders.new_vs_repeat HAVING SUM(order_lines.revenue)>-12 "
"ORDER BY total_item_revenue DESC;"
)
assert query == correct
|
#%%
def validate_velocity_derivative():
pass
#%%
trial = 's1x2i7x5'
subject = 'AB01'
joint = 'jointangles_shank_x'
filename = '../local-storage/test/dataport_flattened_partial_{}.parquet'.format(subject)
df = pd.read_parquet(filename)
trial_df = df[df['trial'] == trial]
model_foot_dot = model_loader('foot_dot_model.pickle')
model_foot = model_loader('foot_model.pickle')
states = ['phase', 'phase_dot', 'stride_length', 'ramp']
states_data = trial_df[states].values.T
foot_angle_evaluated = model_foot.evaluate_numpy(states_data)
foot_angle_dot_evaluated = model_foot_dot.evaluate_numpy(states_data)
#Calculate the derivative of foot dot manually
foot_anles_cutoff = trial_df[joint].values[:-1]
foot_angles_future = trial_df[joint].values[1:]
phase_rate = trial_df['phase_dot'].values[:-1]
measured_foot_derivative = (foot_angles_future-foot_anles_cutoff)*(phase_rate)*150
calculated_foot_derivative = foot_angle_dot_evaluated @ model_foot_dot.subjects[subject]['optimal_xi']
measured_foot_angle = trial_df[joint]
calculated_foot_angles = foot_angle_evaluated @ model_foot.subjects[subject]['optimal_xi']
points_per_stride = 150
start_stride = 40
num_strides = 3 + start_stride
x = np.linspace(0,1+1/(num_strides-start_stride)*points_per_stride,(num_strides-start_stride)*points_per_stride)
fig, axs = plt.subplots(2,1)
axs[0].plot(x,measured_foot_derivative[start_stride*points_per_stride:num_strides*points_per_stride])
axs[0].plot(x,calculated_foot_derivative[start_stride*points_per_stride:num_strides*points_per_stride])
axs[0].legend(['measured','calculated'])
axs[0].grid(True)
axs[1].plot(x, measured_foot_angle[start_stride*points_per_stride:num_strides*points_per_stride])
axs[1].plot(x, calculated_foot_angles[start_stride*points_per_stride:num_strides*points_per_stride])
axs[1].legend([ 'measured foot angle', 'calculated foot angle'])
axs[1].grid(True)
plt.show()
|
"""
Descrição: Este programa converte dias, horas, minutos e segundos
Autor:Henrique Joner
Versão:0.0.1
Data:23/11/2018
"""
#Inicialização de variáveis
dias = 0
horas = 0
minutos = 0
segundos = 0
#Entrada de dados
dias = int(input("Digite o número de dias: "))
horas = int(input("Digite o número de horas: "))
minutos = int(input("Digite o número de minutos: "))
segundos = int(input("Digite o número de segundos: "))
resultado = 0
#Processamento de dados
resultado = dias * 86400 + horas * 3600 + minutos * 60 + segundos
#Saída de dados
print("O total em minutos de %d dias, %d horas, %d minutos e %d segundos em segundos é: %.1d segundos" % (dias, horas, minutos, segundos, resultado))
|
# Inheritance in coding is when one "child" class receives
# all of the methods and attributes of another "parent" class
class Test:
def __init__(self):
self.x = 0
# class Derived_Test inherits from class Test
class Derived_Test(Test):
def __init__(self):
Test.__init__(self) # do Test's __init__ method
# Test's __init__ gives Derived_Test the attribute 'x'
self.y = 1
b = Derived_Test()
# Derived_Test now has an attribute "x", even though
# it originally didn't
print(b.x, b.y)
|
def restes(dividendes, diviseur):
'''restes (list(int) * int -> list(int)) : renvoie les restes de la division
euclidienne de chaque dividende par le diviseur'''
# Initialisation
'''restes (list(int)) : restes des divisions euclidiennes'''
restes = []
# Début du traitement
for dividende in dividendes:
reste = dividende % diviseur
restes.append(reste)
return restes
|
DEFAULT_NUM_IMAGES = 40
LOWER_LIMIT = 0
UPPER_LIMIT = 100
class MissingConfigException(Exception):
pass
class ImageLimitException(Exception):
pass
def init(config):
if (config is None):
raise MissingConfigException()
raise NotImplementedError
def download(num_images):
images_to_download = num_images
if num_images is None:
images_to_download = DEFAULT_NUM_IMAGES
if images_to_download <= LOWER_LIMIT or images_to_download > UPPER_LIMIT:
raise ImageLimitException()
return images_to_download
def upload():
raise NotImplementedError()
def abandon():
raise NotImplementedError()
|
#new file as required
print ('ne1')
print ('ne2')
#C:\Users\kpmis\OneDrive\Documents\GitHub\wowmeter\new1.py
|
"""Convert Big-5 to UTF-8 and fix some trailing commas"""
with open("data/tetfp.csv", "rb") as f:
with open("data/tetfp_fixed.csv", "wb") as f2:
for line in f.readlines():
line = line.decode("big5").strip()
if line.endswith(","):
f2.write((line[:-1] + "\n").encode("utf8"))
else:
f2.write((line + "\n").encode("utf8"))
|
def includeme(config):
config.add_static_view('static', 'static', cache_max_age=0)
config.add_route('home', '/')
config.add_route('auth', '/auth')
config.add_route('add-stock', '/add-stock')
config.add_route('logout', '/logout')
config.add_route('portfolio', '/portfolio')
config.add_route('stock_detail', '/portfolio/{symbol}')
|
######################################################################
#
# File: b2sdk/transfer/transfer_manager.py
#
# Copyright 2022 Backblaze Inc. All Rights Reserved.
#
# License https://www.backblaze.com/using_b2_code.html
#
######################################################################
class TransferManager:
"""
Base class for manager classes (copy, upload, download)
"""
def __init__(self, services, **kwargs):
self.services = services
super().__init__(**kwargs)
|
#! python3
# -*- coding: utf-8 -*-
class OdoleniumError(Exception):
def __init__(self, msg):
super().__init__(msg)
|
def oeis_transform(seq: list):
"""
This function will receive an OEIS sequence, you should return the sequence after applying your transformation
"""
return seq
def input_transform(seq: list):
"""
This function will receive the input sequence, you should return the sequence after applying your transformation
"""
return seq
def list_a_in_b(a: list, b: list):
"""
Check if list A elements are exist in list B elements while preserving the order
returns: True if A in B, False otherwise.
"""
if len(a) > len(b):
return False
elif len(a) == len(b):
return a == b
else:
for seq_start in range(len(b) - len(a) + 1):
contains_flag = True
for n in range(len(a)):
if a[n] != b[seq_start + n]:
contains_flag = False
break
if contains_flag:
return True
return False
def filter_fun(oeis_sequence_transformed: list, input_sequence_transformed: list):
"""
This function will filter the sequences based on a specific criteria
Return True if the sequence match, False otherwise.
"""
return list_a_in_b(input_sequence_transformed, oeis_sequence_transformed)
|
"""
This package is the central point to find nice utilities in Matils.
Check out the code documentation it is very rich and provides informations and
valuable examples to start playing with Matils.
"""
|
# name = 'Samet Gedik'
# for letter in name:
# if letter == 'G':
# continue
# print(letter)
# x = 0
# while x < 5:
# x+=1
# if x == 2:
# continue
# print(x)
# 1-100 e kadar tek sayıalrın toplamı
x = 0
result = 0
while x <= 100:
x+=1
if x % 2 == 0:
continue
result += x
print(f'toplam: {result}') |
numbers = [1, 2, 3, 10, 11, 15, 99]
def algo(n):
if n % 2 != 0:
return True
return False
def both_requisites(n):
if algo(n) and n > 10:
return True
return False
higher_than_ten = [num for num in numbers if both_requisites(num)]
print(higher_than_ten)
nombres = ['Alicia', 'María', 'Amaro']
acciones = [' salta', ' llora', ' rasca']
for nombre in nombres:
for accion in acciones:
print(nombre + accion)
for num in range(1,11):
for s_num in range(1,11):
print('{} * {} = {}'.format(num, s_num, num * s_num))
|
numero = int(input('Me diga um numero: '))
resultado = numero % 2
if resultado == 0:
print('O numero {} é PAR'.format(numero))
else:
print('O numero {} é IMPAR'.format(numero))
|
"""
Given an integer (signed 32 bits), write a function to check whether it is
a power of 4.
Example:
Input: 16
Output: true
Follow up: Could you solve it without loops/recursion?
"""
#Difficulty: Easy
#1060 / 1060 test cases passed.
#Runtime: 28 ms
#Memory Usage: 13.6 MB
#Runtime: 28 ms, faster than 88.81% of Python3 online submissions for Power of Four.
#Memory Usage: 13.6 MB, less than 93.86% of Python3 online submissions for Power of Four.
class Solution:
def isPowerOfFour(self, num: int) -> bool:
if num != 0:
return (num & (num - 1) == 0) & len(bin(num)) % 2 == 1
return False
|
while True:
print('-' * 50)
num = int(input('Quer ver a tabuada de qual valor? '))
print('-'*50)
if num < 0:
break
for i in range(1,11):
print(f'{num} x {i} = {num*i}')
print('Programa finalizado. \nObrigado e volte sempre!') |
def get_code_langs():
return [[164, 'MPASM', True],
[165, 'MXML', True],
[166, 'MySQL', True],
[167, 'Nagios', True],
[160, 'MIX Assembler', True],
[161, 'Modula 2', True],
[162, 'Modula 3', True],
[163, 'Motorola 68000 HiSoft Dev', True],
[173, 'NullSoft Installer', True],
[174, 'Oberon 2', True],
[175, 'Objeck Programming Langua', True],
[168, 'NetRexx', True],
[169, 'newLISP', True],
[170, 'Nginx', True],
[171, 'Nimrod', True],
[84, 'DCL', True],
[85, 'DCPU-16', True],
[86, 'DCS', True],
[87, 'Delphi', True],
[81, 'Cuesheet', True],
[82, 'D', True],
[83, 'Dart', True],
[92, 'E', True],
[93, 'Easytrieve', True],
[94, 'ECMAScript', True],
[95, 'Eiffel', True],
[88, 'Delphi Prism (Oxygene)', True],
[89, 'Diff', True],
[90, 'DIV', True],
[91, 'DOT', True],
[68, 'CAD Lisp', True],
[69, 'Ceylon', True],
[70, 'CFDG', True],
[71, 'ChaiScript', True],
[64, 'C++ WinAPI', True],
[65, 'C++ with Qt extensions', True],
[66, 'C: Loadrunner', True],
[67, 'CAD DCL', True],
[76, 'CMake', True],
[77, 'COBOL', True],
[78, 'CoffeeScript', True],
[79, 'ColdFusion', True],
[72, 'Chapel', True],
[73, 'Clojure', True],
[74, 'Clone C', True],
[75, 'Clone C++', True],
[116, 'GwBasic', True],
[117, 'Haskell', True],
[118, 'Haxe', True],
[119, 'HicEst', True],
[112, 'Genie', True],
[113, 'GetText', True],
[114, 'Go', True],
[115, 'Groovy', True],
[124, 'IDL', True],
[125, 'INI file', True],
[126, 'Inno Script', True],
[127, 'INTERCAL', True],
[120, 'HQ9 Plus', True],
[122, 'HTML 5', True],
[123, 'Icon', True],
[100, 'F#', True],
[101, 'Falcon', True],
[102, 'Filemaker', True],
[103, 'FO Language', True],
[96, 'Email', True],
[97, 'EPC', True],
[98, 'Erlang', True],
[99, 'Euphoria', True],
[108, 'GAMBAS', True],
[109, 'Game Maker', True],
[110, 'GDB', True],
[111, 'Genero', True],
[104, 'Formula One', True],
[105, 'Fortran', True],
[106, 'FreeBasic', True],
[107, 'FreeSWITCH', True],
[20, '6502 ACME Cross Assembler', True],
[21, '6502 Kick Assembler', True],
[22, '6502 TASM/64TASS', True],
[23, 'ABAP', True],
[16, 'Python', True],
[17, 'Ruby', True],
[18, 'Swift', True],
[19, '4CS', True],
[28, 'ALGOL 68', True],
[29, 'Apache Log', True],
[30, 'AppleScript', True],
[31, 'APT Sources', True],
[24, 'ActionScript', True],
[25, 'ActionScript 3', True],
[26, 'Ada', True],
[27, 'AIMMS', True],
[4, 'C#', True],
[5, 'C++', True],
[6, 'CSS', True],
[7, 'HTML', True],
[1, 'None', True],
[2, 'Bash', True],
[3, 'C', True],
[12, 'Markdown', True],
[13, 'Objective C', True],
[14, 'Perl', True],
[15, 'PHP', True],
[8, 'Java', True],
[9, 'JavaScript', True],
[10, 'JSON', True],
[11, 'Lua', True],
[52, 'Blitz Basic', True],
[53, 'Blitz3D', True],
[54, 'BlitzMax', True],
[55, 'BNF', True],
[49, 'Basic4GL', True],
[50, 'Batch', True],
[51, 'BibTeX', True],
[60, 'C for Macs', True],
[61, 'C Intermediate Language', True],
[56, 'BOO', True],
[57, 'BrainFuck', True],
[59, 'C WinAPI', True],
[36, 'autoconf', True],
[37, 'Autohotkey', True],
[38, 'AutoIt', True],
[39, 'Avisynth', True],
[32, 'ARM', True],
[33, 'ASM (NASM)', True],
[34, 'ASP', True],
[35, 'Asymptote', True],
[47, 'BASCOM AVR', True],
[40, 'Awk', True],
[276, 'Z80 Assembler', True],
[277, 'ZXBasic', True],
[272, 'XML', True],
[273, 'Xorg Config', True],
[274, 'XPP', True],
[275, 'YAML', True],
[260, 'VBScript', True],
[261, 'Vedit', True],
[262, 'VeriLog', True],
[263, 'VHDL', True],
[256, 'UPC', True],
[257, 'Urbi', True],
[258, 'Vala', True],
[259, 'VB.NET', True],
[268, 'WhiteSpace', True],
[269, 'WHOIS', True],
[270, 'Winbatch', True],
[271, 'XBasic', True],
[264, 'VIM', True],
[265, 'Visual Pro Log', True],
[266, 'VisualBasic', True],
[267, 'VisualFoxPro', True],
[212, 'Puppet', True],
[213, 'PureBasic', True],
[214, 'PyCon', True],
[208, 'Progress', True],
[209, 'Prolog', True],
[210, 'Properties', True],
[211, 'ProvideX', True],
[220, 'R', True],
[221, 'Racket', True],
[222, 'Rails', True],
[223, 'RBScript', True],
[216, 'Python for S60', True],
[217, 'q/kdb+', True],
[218, 'QBasic', True],
[219, 'QML', True],
[196, 'PHP Brief', True],
[197, 'Pic 16', True],
[198, 'Pike', True],
[199, 'Pixel Bender', True],
[192, 'Per', True],
[194, 'Perl 6', True],
[204, 'POV-Ray', True],
[205, 'Power Shell', True],
[206, 'PowerBuilder', True],
[207, 'ProFTPd', True],
[200, 'PL/I', True],
[201, 'PL/SQL', True],
[202, 'PostgreSQL', True],
[203, 'PostScript', True],
[244, 'StandardML', True],
[245, 'StoneScript', True],
[246, 'SuperCollider', True],
[240, 'SPARK', True],
[241, 'SPARQL', True],
[242, 'SQF', True],
[243, 'SQL', True],
[252, 'thinBasic', True],
[253, 'TypoScript', True],
[254, 'Unicon', True],
[255, 'UnrealScript', True],
[248, 'SystemVerilog', True],
[249, 'T-SQL', True],
[250, 'TCL', True],
[251, 'Tera Term', True],
[228, 'RPM Spec', True],
[230, 'Ruby Gnuplot', True],
[231, 'Rust', True],
[224, 'REBOL', True],
[225, 'REG', True],
[226, 'Rexx', True],
[227, 'Robots', True],
[236, 'SCL', True],
[237, 'SdlBasic', True],
[238, 'Smalltalk', True],
[239, 'Smarty', True],
[232, 'SAS', True],
[233, 'Scala', True],
[234, 'Scheme', True],
[235, 'Scilab', True],
[148, 'LOL Code', True],
[149, 'Lotus Formulas', True],
[150, 'Lotus Script', True],
[151, 'LScript', True],
[144, 'Lisp', True],
[145, 'LLVM', True],
[146, 'Loco Basic', True],
[147, 'Logtalk', True],
[156, 'MapBasic', True],
[158, 'MatLab', True],
[159, 'mIRC', True],
[153, 'M68000 Assembler', True],
[154, 'MagikSF', True],
[155, 'Make', True],
[132, 'Java 5', True],
[134, 'JCL', True],
[135, 'jQuery', True],
[128, 'IO', True],
[129, 'ISPF Panel Definition', True],
[130, 'J', True],
[140, 'Latex', True],
[141, 'LDIF', True],
[142, 'Liberty BASIC', True],
[143, 'Linden Scripting', True],
[137, 'Julia', True],
[138, 'KiXtart', True],
[139, 'Kotlin', True],
[180, 'Open Object Rexx', True],
[181, 'OpenBSD PACKET FILTER', True],
[182, 'OpenGL Shading', True],
[183, 'Openoffice BASIC', True],
[177, 'OCalm Brief', True],
[178, 'OCaml', True],
[179, 'Octave', True],
[188, 'PARI/GP', True],
[189, 'Pascal', True],
[190, 'Pawn', True],
[191, 'PCRE', True],
[184, 'Oracle 11', True],
[185, 'Oracle 8', True],
[186, 'Oz', True],
[187, 'ParaSail', True]]
|
'''
TODO:
def get_wrapper
def get_optimizer
''' |
"""
day1ab - https://adventofcode.com/2020/day/1
Part 1 - 1019571
Part 2 - 100655544
"""
def load_data():
numbers = []
datafile = 'input-day1'
with open(datafile, 'r') as input:
for line in input:
num = line.strip()
numbers.append(int(num))
return numbers
def part1(numbers):
position = 0
for first in numbers:
for second in numbers[position:]:
if first + second == 2020:
print(f"found it: {first} * {second} = {first * second}")
return first * second
position += 1
def part2(numbers):
position = 0
for first in numbers:
for second in numbers[position:]:
position3 = position + 1
for third in numbers[position3:]:
if first + second + third == 2020:
print(f"found it: {first} * {second} * {third} = {first * second * third}")
return first * second * third
position += 1
if __name__ == '__main__':
data = load_data()
print(f"{data} \n")
results1 = part1(data)
print(f"Part 1 - {results1}")
results2 = part2(data)
print(f"Part 2 - {results2}\n")
|
"""
File: caesar.py
Name: Yujing Wei
------------------------------
This program demonstrates the idea of caesar cipher.
Users will be asked to input a number to produce shifted
ALPHABET as the cipher table. After that, any strings typed
in will be encrypted.
"""
# This constant shows the original order of alphabetic sequence
ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
def main():
"""
First of all, secret_number: the STEPS you'd like to displace(to left).
### You can optionally use function 'cipher_words()' to cipher the string.
Then,
Decipher the ciphered string in main function:
clipped_string: the WORDS you'd like to decipher.
ans: the WORDS had been deciphered.
"""
secret_number = int(input('Secret number: '))
secret_number %= len(ALPHABET)
cipher_string(secret_number)
# First of all, cipher the string with this function. (ex. APPLE to WLLHA.)
clipped_string = input('What\'s the ciphered string? ').upper()
ans = ''
for ch in clipped_string:
if ch.isalpha():
place = ALPHABET.find(ch)
ch = ALPHABET[place + secret_number - len(ALPHABET)]
ans += ch
else:
ans += ch
print('The deciphered string is: ' + str(ans))
def cipher_string(secret_number):
# You can optionally use this function to cipher the string.
"""
Cipher the string with this function. (ex. APPLE to WLLHA.)
original_string: the WORDS you'd like to cipher.
ans: the string had been ciphered.
"""
original_string = input('What\'s the string that you\'d like to cipher? ').upper()
ans = ''
for ch in original_string:
if ch.isalpha():
place = ALPHABET.find(ch)
ch = ALPHABET[place - secret_number]
ans += ch
else:
ans += ch
print(original_string + ' is deciphered as ' + str(ans))
##### DO NOT EDIT THE CODE BELOW THIS LINE #####
if __name__ == '__main__':
main()
|
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# @Author : Ren Qiang
# %% 列表解析式 查找股票
stocks = {'MSFT': 165.51, 'FB': 174.79,
'YHOO': 19.63, 'IBM': 121.15, 'GOOG': 1210.41}
stocks_150 = {v: k for k, v in stocks.items() if v > 150}
print(stocks_150)
|
"""
异常处理
1. 目标:解决程序运行时的逻辑错误(数据超过有效范围).
不负责处理语法错误.
2. 现象:程序不再向下执行,而是不断向上返回.
3. 目的:将异常流程(向上),恢复为正常流程(向下).
4. 手段:四种写法
5. 价值:
保障程序可以按照既定的流程执行
就近原则
A --> B --> C --> D --> E --> ...
"""
# 1. 语法错误
# class MyClass:
# pass
#
# m01 = MyClass()
# print(m01.name)# AttributeError
# print(qtx) # NameError
# 2. 逻辑错误
# def div_apple(apple_count):
# # 如果发生异常,返回给调用者
# person_count = int(input("请输入人数:")) # ValueError
# result = apple_count / person_count # ZeroDivisionError
# print(f"每个人分了{result}个苹果")
#
# def main():
# div_apple(10)
#
# main()
# print("后续逻辑")
# 写法1:"包治百病"
# def div_apple(apple_count):
# try:
# person_count = int(input("请输入人数:")) # ValueError
# result = apple_count / person_count # ZeroDivisionError
# print(f"每个人分了{result}个苹果")
# # except Exception:
# except:
# print("出错啦") # 程序能够执行本行,说明个程序已经恢复正常
#
# div_apple(10)
# 写法2:"对症下药" (官方建议)
# def div_apple(apple_count):
# try:
# person_count = int(input("请输入人数:")) # ValueError
# result = apple_count / person_count # ZeroDivisionError
# print(f"每个人分了{result}个苹果")
# except ValueError:
# print("输入的不是整数")
# except ZeroDivisionError:
# print("输入的是零")
#
# div_apple(10)
# 3. 写法3:无论对错,无论处理与否,一定执行某些逻辑.
# def div_apple(apple_count):
# try:
# person_count = int(input("请输入人数:")) # ValueError
# result = apple_count / person_count # ZeroDivisionError
# print(f"每个人分了{result}个苹果")
# # 文件处理
# # 1. 打开文件(开门)
# # 2. 处理逻辑(进入房间)
# finally:
# # 3. 关闭文件(关门)
# print("分苹果结束啦")
#
# div_apple(10)
# 写法4:程序没有出错执行的逻辑
def div_apple(apple_count):
try:
person_count = int(input("请输入人数:")) # ValueError
result = apple_count / person_count # ZeroDivisionError
print(f"每个人分了{result}个苹果")
except:
print("分苹果失败啦")
else: # 与except互斥
print("分苹果成功啦")
div_apple(10)
print("后续逻辑")
|
_base_ = 'fcos_r50_caffe_fpn_gn-head_1x_coco.py'
model = dict(
pretrained='open-mmlab://detectron2/resnet50_caffe',
backbone=dict(
dcn=dict(type='DCNv2', deform_groups=1, fallback_on_stride=False),
stage_with_dcn=(False, True, True, True)),
bbox_head=dict(
norm_on_bbox=True,
centerness_on_reg=True,
dcn_on_last_conv=True,
center_sampling=True,
conv_bias=True,
loss_bbox=dict(type='GIoULoss', loss_weight=1.0)),
# training and testing settings
test_cfg=dict(nms=dict(type='nms', iou_threshold=0.6), max_per_img=300))
# dataset settings
img_norm_cfg = dict(
mean=[103.530, 116.280, 123.675], std=[1.0, 1.0, 1.0], to_rgb=False)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations', with_bbox=True),
dict(type='Resize', img_scale=(1333, 800), keep_ratio=True),
dict(type='RandomFlip', flip_ratio=0.5),
dict(type='Normalize', **img_norm_cfg),
dict(type='Pad', size_divisor=32),
dict(type='DefaultFormatBundle'),
dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']),
]
test_pipeline = [
dict(type='LoadImageFromFile'),
dict(
type='MultiScaleFlipAug',
img_scale=(1333, 800),
flip=False,
transforms=[
dict(type='Resize', keep_ratio=True),
dict(type='RandomFlip'),
dict(type='Normalize', **img_norm_cfg),
dict(type='Pad', size_divisor=32),
dict(type='ImageToTensor', keys=['img']),
dict(type='Collect', keys=['img']),
])
]
# optimizer
optimizer = dict(type='SGD', lr=0.005, momentum=0.9, weight_decay=0.0001)
# optimizer_config = dict(grad_clip=None)
optimizer_config = dict(_delete_=True, grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='linear',
warmup_iters=2000,
warmup_ratio=0.001,
step=[16, 19])
total_epochs = 22
dataset_type = 'CocoDataset'
data = dict(
samples_per_gpu=4,
workers_per_gpu=4,
train=dict(
type=dataset_type,
# ann_file="data/patch_visdrone/train/train.json",
# img_prefix="data/patch_visdrone/train/images",
# ann_file="data/crop_coco/train/train.json",
# img_prefix="data/crop_coco/train/images",
ann_file="data/visdrone_coco/train/train.json",
img_prefix="data/visdrone_coco/train/images",
pipeline=train_pipeline),
val=dict(
type=dataset_type,
ann_file="data/visdrone_coco/val/val.json",
img_prefix="data/visdrone_coco/val/images",
pipeline=test_pipeline),
test=dict(
type=dataset_type,
# img_prefix="data/visdrone_coco/test_dev/images",
# ann_file="data/visdrone_coco/test_dev/test_dev.json",
ann_file="data/visdrone_coco/val/val.json",
img_prefix="data/visdrone_coco/val/images",
pipeline=test_pipeline)) |
#!/usr/bin/env python3
bank = [0, 2, 7, 0]
bank = [0, 5, 10, 0, 11, 14, 13, 4, 11, 8, 8, 7, 1, 4, 12, 11]
visited = {}
steps = 0
l = len(bank)
while tuple(bank) not in visited:
visited[tuple(bank)] = steps
m = max(bank)
i = bank.index(m)
bank[i] = 0 # Set the item to 0
quotient = m // l
bank = [x + quotient for x in bank] # Evenly distribute quotient
remainder = m % l
arr = [1] * (remainder) + [0] * (l - remainder)
arr = arr[-i-1:] + arr[:-i-1]
bank = [x+y for x, y in zip(bank, arr)]
steps += 1
print (steps, steps - visited[tuple(bank)]) # Step1, Step2 |
def reorder_boxes(boxes):
boxes.sort()
ans = list()
for i in range(len(boxes) - 1, -1, -2):
if i - 1 >= 0:
ans.append(boxes[i] + boxes[i - 1])
else:
ans.append(boxes[i])
return ans
print(reorder_boxes([1, 2, 3, 4, 5, 6, 7]))
|
def sleep(seconds: float):
pass
def sleep_ms(millis: int):
pass
def sleep_us(micros: int):
pass |
class IEntry:
"""
* Entry interface - this will be shared across the projects
"""
SOURCE_CLI = 'cli'
SOURCE_GET = 'get'
SOURCE_POST = 'post'
SOURCE_FILES = 'files'
SOURCE_COOKIE = 'cookie'
SOURCE_SESSION = 'session'
SOURCE_SERVER = 'server'
SOURCE_ENV = 'environment'
SOURCE_EXTERNAL = 'external'
def get_source(self) -> str:
"""
* Return source of entry
"""
raise NotImplementedError('TBA')
def get_key(self) -> str:
"""
* Return key of entry
"""
raise NotImplementedError('TBA')
def get_value(self):
"""
* Return value of entry
* It could be anything - string, boolean, array - depends on source
"""
raise NotImplementedError('TBA')
class IFileEntry(IEntry):
"""
* File entry interface - how to access uploaded files
* @link https://www.php.net/manual/en/reserved.variables.files.php
"""
def get_mime_type(self) -> str:
"""
* Return what mime is that by browser
* Beware, it is not reliable
"""
raise NotImplementedError('TBA')
def get_temp_name(self) -> str:
"""
* Get name in temp
* Use it for function like move_uploaded_file()
"""
raise NotImplementedError('TBA')
def get_error(self) -> int:
"""
* Get error code from upload
* @link https://www.php.net/manual/en/features.file-upload.errors.php
"""
raise NotImplementedError('TBA')
def get_size(self) -> int:
"""
* Get uploaded file size
"""
raise NotImplementedError('TBA')
class ISource:
"""
* Source of values to parse
"""
def cli(self):
raise NotImplementedError('TBA')
def get(self):
raise NotImplementedError('TBA')
def post(self):
raise NotImplementedError('TBA')
def files(self):
raise NotImplementedError('TBA')
def cookie(self):
raise NotImplementedError('TBA')
def session(self):
raise NotImplementedError('TBA')
def server(self):
raise NotImplementedError('TBA')
def env(self):
raise NotImplementedError('TBA')
def external(self):
raise NotImplementedError('TBA')
class IInputs:
"""
* Basic interface which tells us what actions are by default available by inputs
"""
def set_source(self, source=None):
"""
* Setting the variable sources - from cli (argv), _GET, _POST, _SERVER, ...
"""
raise NotImplementedError('TBA')
def load_entries(self):
"""
* Load entries from source into the local entries which will be accessible
* These two calls came usually in pair
*
* input.set_source(sys.argv).load_entries()
"""
raise NotImplementedError('TBA')
def get_in(self, entry_key: str = None, entry_sources = None):
"""
* Get iterator of local entries, filter them on way
* @param string|null $entry_key
* @param string[] $entry_sources array of constants from Entries.IEntry.SOURCE_*
* @return iterator
* @see Entries.IEntry.SOURCE_CLI
* @see Entries.IEntry.SOURCE_GET
* @see Entries.IEntry.SOURCE_POST
* @see Entries.IEntry.SOURCE_FILES
* @see Entries.IEntry.SOURCE_COOKIE
* @see Entries.IEntry.SOURCE_SESSION
* @see Entries.IEntry.SOURCE_SERVER
* @see Entries.IEntry.SOURCE_ENV
"""
raise NotImplementedError('TBA')
class IVariables:
"""
* Helper interface which allows us access variables from input
"""
def get_in_array(self, entry_key: str = None, entry_sources = None):
"""
* Reformat into array with key as array key and value with the whole entry
* @param string|None entry_key
* @param string[] entry_sources
* @return Entries.IEntry[]
* Also usually came in pair with previous call - but with a different syntax
* Beware - due any dict limitations there is a limitation that only the last entry prevails
*
* entries = variables.get_in_array('example', [Entries.IEntry.SOURCE_GET]);
"""
raise NotImplementedError('TBA')
def get_in_object(self, entry_key: str = None, entry_sources = None):
"""
* Reformat into object with access by key as string key and value with the whole entry
* @param string|None entry_key
* @param string[] entry_sources
* @return Inputs.Input
* Also usually came in pair with previous call - but with a different syntax
* Beware - due any dict limitations there is a limitation that only the last entry prevails
*
* entries_in_object = variables.get_in_object('example', [Entries.IEntry.SOURCE_GET]);
"""
raise NotImplementedError('TBA')
|
for i in range(1, 11):
for j in range(1, 11):
a = i * j
if a < 10:
a = " " + str(a)
elif a < 100:
a = " " + str(a)
else:
a = str(a)
print(a, end=" ")
print()
|
class GaiaUtils:
@staticmethod
def convert_positive_int(param):
param = int(param)
if param < 1:
raise ValueError
return param |
class Attachment:
_SUPPORTED_MIME_TYPES = [
"application/vnd.google-apps.audio",
"application/vnd.google-apps.document", # Google Docs
"application/vnd.google-apps.drawing", # Google Drawing
"application/vnd.google-apps.file", # Google Drive file
"application/vnd.google-apps.folder", # Google Drive folder
"application/vnd.google-apps.form", # Google Forms
"application/vnd.google-apps.fusiontable", # Google Fusion Tables
"application/vnd.google-apps.map", # Google My Maps
"application/vnd.google-apps.photo",
"application/vnd.google-apps.presentation", # Google Slides
"application/vnd.google-apps.script", # Google Apps Scripts
"application/vnd.google-apps.site", # Google Sites
"application/vnd.google-apps.spreadsheet", # Google Sheets
"application/vnd.google-apps.unknown",
"application/vnd.google-apps.video",
"application/vnd.google-apps.drive-sdk" # 3rd party shortcut
]
def __init__(self, title, file_url, mime_type, icon_link=None, file_id=None):
"""File attachment for the event.
Currently only Google Drive attachments are supported.
:param title:
attachment title
:param file_url:
a link for opening the file in a relevant Google editor or viewer.
:param mime_type:
internet media type (MIME type) of the attachment. See `available MIME types`_
:param icon_link:
URL link to the attachment's icon (read only)
:param file_id:
id of the attached file (read only)
.. note: "read only" means that Attachment has given property only
when received from the existing event in the calendar.
.. _`available MIME types`: https://developers.google.com/drive/api/v3/mime-types
"""
if mime_type not in Attachment._SUPPORTED_MIME_TYPES:
raise ValueError("Mime type {} is not supported.".format(mime_type))
self.title = title
self.file_url = file_url
self.mime_type = mime_type
self.icon_link = icon_link
self.file_id = file_id
|
A_CONSTANT = 45
def a_sum_function(a: int, b: int) -> int:
return a + b
def a_mult_function(a: int, b: int) -> int:
return a * b
class ACarClass:
def __init__(self, color: str, speed: int):
self.color = color
self.speed = speed
def describe(self) -> str:
return f'I am a {self.color} car, with a speed of {self.speed} km/h'
|
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def getIntersectionNode(self, headA, headB):
ha, hb = headA, headB
while ha != hb:
ha = ha.next if ha else headB
hb = hb.next if hb else headA
return ha |
r1 = int(input('Digite a reta 1: '))
r2 = int(input('Digite a reta 2: '))
r3 = int(input('Digite a reta 3: '))
a = r1 < (r2 + r3)
b = r2 < (r1 + r3)
c = r3 < (r1 + r2)
if a and b and c is True:
print('\nPode Foramr um Triangulo')
if r1 == r2 and r1 == r3:
print('É Um Triangulo EQUILÁTERO')
elif r1 != r2 and r1 == r3 or r1 != r3 and r1 == r2:
print('É Um Triangulo ISÓSCELES')
elif r1 != r2 and r2 != r3 and r1 != r3:
print('É Um Triangulo ESCALENO')
else:
print('Não Pode Formar um Triangulo')
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.