content stringlengths 7 1.05M |
|---|
dff = data
df_sk = dff.loc[(dff['scenario']=='ND_NO_SKAVICA')|(dff['scenario']=='ND_SKAVICA')]
df_sk['scenario'].replace({"ND_NO_SKAVICA":"No Skavica", "ND_SKAVICA":"With Skavica"}, inplace=True)
df_sk1 = df_sk.loc[(df_sk['country']=='Albania')&(df_sk['tech']!='AL-Import')]
df_sk1 = df_sk1.groupby(['country','tech','y... |
"""
Module: 'functools' on LEGO EV3 v1.0.0
"""
# MCU: sysname=ev3, nodename=ev3, release=('v1.0.0',), version=('0.0.0',), machine=ev3
# Stubber: 1.3.2
def partial():
pass
def reduce():
pass
def update_wrapper():
pass
def wraps():
pass
|
#If the bill was $150.00, split between 5 people, with 12% tip.
#Each person should pay (150.00 / 5) * 1.12 = 33.6
#Format the result to 2 decimal places = 33.60
#Tip: There are 2 ways to round a number. You might have to do some Googling to solve this.💪
#HINT 1: https://www.google.com/search?q=how+to+round+number+to... |
# ASL ALPHABET, j,Z OMITTED
language = {
'letter_a' : [
"http://science.opposingviews.com/DM-Resize/photos.demandstudios.com/getty/article/81/210/78033946.jpg?w=600&h=600&keep_ratio=1",
"http://www.lifeprint.com/asl101/signjpegs/a/a.jpg",
"http://thumbs.dreamstime.com/x/letter-sign-language-587184.jpg",
"http:/... |
#!/usr/bin/python3
'''Day 5 of the 2017 advent of code'''
def process_commands(cmds, program_counter):
"""helper for part 2"""
jmp_offset = cmds[program_counter]
if jmp_offset > 2:
cmds[program_counter] -= 1
else:
cmds[program_counter] += 1
return jmp_offset + program_counter
... |
def get_access_by_username (cursor, username) :
try :
sql_statement = 'SELECT username,password,active FROM access WHERE username = %s'
cursor.execute(sql_statement,(username,))
data = cursor.fetchone()
except Exception as ex:
print('[ERROR] get_access_by_username : ' + ex.__str_... |
"""
cmd.do('create ${1:t4l}, ${2:1lw9};')
"""
cmd.do('create t4l, 1lw9;')
# Description: Duplicate object.
# Source: placeHolder
|
def misspelled(words):
misspelled_words = []
for keys, values in words.items():
if ''.join(values) != keys:
misspelled_words.append(keys)
return misspelled_words |
# 我的,无法全通过
class Solution:
def licenseKeyFormatting(self, S, K):
"""
:type S: str
:type K: int
:rtype: str
"""
lists = []
s = ''
for ele in S:
if ele.isalnum():
lists.append(ele.upper())
for _ in lists:
c... |
#!/usr/bin/python
class VideoData(object):
percent_confidence_limit = 25
def __init__(self):
# Standard Data
self._video_id = None
self._title = None
self._description = None
self._published = None
# Metrics
self._date_start = None
self._date_... |
menu_kb = {
# "DefaultHeight": True,
# "CustomDefaultHeight": 70,
# "BgColor": "#4d79ff",
"Type": "keyboard",
# "InputFieldState": "minimized",
"Buttons": [
{
"Columns": 3,
"Rows": 1,
"BgColor": "#e6f5ff",
# "BgLoop": True,
"Act... |
'''
Description: exercise: your age
Version: 1.0.0.20210113
Author: Arvin Zhao
Date: 2021-01-13 09:44:34
Last Editors: Arvin Zhao
LastEditTime: 2021-01-13 10:27:55
'''
def check_age(age: int) -> None:
'''
Check an age and print what he/she can do regarding the age.
Parameters
----------
age : his/... |
# Ler um número e mostrar seu fatorial
# Solução usando WHILE e FOR
n = int(input('Digite um número, que vou mostrar seu fatorial: '))
r = n - 1 # contador
nf = n
# calcular
while r >= 1:
nf = nf * r
r = r - 1
# for f in range(r, 1, -1):
# nf = nf * f
print('{}! = {}'.format(n, nf)) |
nome = str(input('Digite o seu nome completo: '))
nomelista = nome.split()
print('O nome em maiúscula: {}'.format(nome.upper()))
print('O nome em minúscula: {}'.format(nome.lower()))
print('O total de letras são {} letras'.format(len(nome.replace(' ', ''))))
print('O primeiro nome tem {} letras'.format(len(nomelista[0]... |
"""Top-level package for pycoview."""
__author__ = """John Gilling"""
__email__ = 'suddensleep@gmail.com'
__version__ = '0.1.0'
|
#!/usr/bin/env python3
DOCTL = "/usr/local/bin/doctl"
PK_FILE = "/home/ndjuric/.ssh/id_rsa.pub"
SWARM_DIR = TAG = "swarm"
OVERLAY_NETWORK = "swarmnet"
DOCKER_REGISTRY = {
'master': 'private.docker.registry.example.com:5000/master',
'worker': 'private.docker.registry.example.com:5000/worker'
}
NFS_SERVER = '10.... |
# Filename: BotGlobals.py
# Author: mfwass
# Date: January 8th, 2017
#
# The Legend of Pirates Online Software
# Copyright (c) The Legend of Pirates Online. All rights reserved.
#
# All use of this software is subject to the terms of the revised BSD
# license. You should have received a copy of this license along
# wi... |
"""Escrevam um programa para aprovar o empréstimo bancário para a compra de uma casa. O programa
vai perguntar o valor da casa, o salário do comprador e em quantos anos ele vai pagar.
Calucule o valor da prestação mensal, sabendo que ela não pode excerder 30% do
salário ou então o emprétismo será negado"""
|
x = int(input('Enter a number: '))
index = 0
for i in range(1, int(x/2) +1):
if x % i == 0:
print(i)
index += 1
print(x)
print(f'There were {index + 1} divisors') |
# CALCULATING THE WORK ON AN OBJECT, GIVEN THE FORCE AND DISPLACEMENT OF THE OBJECT.
# creating a function to calculate the work.
def calc_work (force, displacement):
# arithmetic calculation to determine the work on an object.
work = force * displacement
work = round(work, 2)
# returning th... |
class DiseaseError(Exception):
"Base class for disease module exceptions."
pass
class ParserError(DiseaseError): pass
|
"""038 - ESCREVA UM PROGRAMA QUE LEIA DOIS NÚMEROS INTEIROS E COMPARE-OS:
MOSTRANDO NA TELA UMA MENSAGEM:
- O PRIMEIRO VALOR É MAIOR
- O SEGUNDO VALOR É MAIOR
- NÃO EXISTE VALOR MAIOR, OS DOIS SÃO IGUAIS"""
print('*' * 10, ' DESAFIO 038 ', '*' * 10)
n1 = int(input('Informe o primeiro número: '))
n2 = int(input('Inf... |
""" Stored values specific to a single test execution. """
test_file = None
browser = None
browser_definition = None
browsers = {}
data = None
secrets = None
description = None
settings = None
test_dirname = None
test_path = None
project_name = None
project_path = None
testdir = None
execution_reportdir = None
testfil... |
class SaveCurrentUser():
def save_model(self, request, obj, form, change):
obj.current_user = request.user
super().save_model(request, obj, form, change)
class SaveCurrentUserAdmin():
def save_model(self, request, obj, form, change):
obj.current_user = request.user
super().sa... |
LANGUAGE_SETTING = {
'ru':
{'start_urls':
'https://ru.wikipedia.org/w/index.php?title=%D0%A1%D0%BB%D1%83%D0%B6%D0%B5%D0%B1%D0%BD%D0%B0%D1%8F:%D0%92%D1%81%D0%B5_%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D1%8B',
'allowed_domains': 'ru.wikipedia.org',
'next_page_words': "Следующа... |
# CSV related
ROW_MOST_RECENT_DAY = 1 # First row with data (i.e row 2)
ROW_FIRST_COMPLETE_DAY = 3 # First row with valid data for the 7-day total (i.e row 4)
COL_AREA_CODE = 0
COL_AREA_NAME = 1
COL_AREA_TYPE = 2
COL_DATE = 3
COL_TOTAL_DEATHS = 4
COL_HOSPITAL_CASES = 5
COL_NEW_CASES = 6
|
# Time: O(n)
# Space: O(h)
class Solution(object):
def widthOfBinaryTree(self, root):
"""
:type root: TreeNode
:rtype: int
"""
def dfs(node, i, depth, leftmosts):
if not node:
return 0
if depth >= len(leftmosts):
... |
class House:
"""All houses have rooms, a type of roof, and may have a porch."""
def __init__(self):
self.__rooms = list()
self.__roof = None
self.__porch = False
def add_room(self, room):
self.__rooms.append(room)
def set_roof(self, roof):
self.__roof = roof
... |
'''
A peak element is an element that is greater than its neighbors.
Given an input array nums, where nums[i] ≠ nums[i+1], find a peak element and return its index.
The array may contain multiple peaks, in that case return the index to any one of the peaks is fine.
You may imagine that nums[-1] = nums[n] = -∞.
... |
DEFAULT_AUTOPILOT_CONFIG = {
'region_name': 'YOUR_REGION',
's3_bucket': 'YOUR_S3_BUCKET',
'role_arn': 'YOUR_ROLE_ARN',
}
|
#
t = int(input("T:"))
list = []
for i in range(0,t):
k = input("A B :")
list.append(k)
print(list)
for z in range(0,len(list)):
q = str(list[z])
m = q.split(" ")
print(int(m[0])+int(m[1]))
|
'''
a + b + c = 1000.
a2+b2=C2
求 abc的积
'''
const=1000
def main():
a=1
b=1
c=1000-a-b
while(not pTrigle(a,b,c)):
b+=1
a=abc(b)
c = const - a - b
if(c<0):
break
print("a:%s b:%s c:%s"%(a,b,c))
print("result: %s"%(a*b*c))
def abc(b):
'''根据公式求出a和 b的关系... |
class BianPlugin():
def ready(self):
return True
def run(self,core,*params):
if len(params) != 4:
raise Exception("missing params:"+str(params))
init = "from halo_bian.bian.exceptions import BianException\n\nfrom halo_bian.bian.bian import ActionTerms\n\nfrom botocore.exce... |
V,E=map(int,input().split())
edges=[set() for i in range(V)]
for i in range(E):
a,b=map(int,input().split())
edges[a-1].add(b-1)
edges[b-1].add(a-1)
for i in range(V):
print(len({n for v in edges[i] for n in edges[v] if not n in edges[i] and n!=i})) |
'''
Copyright (C) 2021 Sovrasov V. - All Rights Reserved
* You may use, distribute and modify this code under the
* terms of the MIT license.
* You should have received a copy of the MIT license with
* this file. If not visit https://opensource.org/licenses/MIT
'''
def flops_to_string(flops, units='GMac', precisi... |
a=[12,9,1,3]
a1=[12,9,1,3]
s=[]
z=0
c=0
#expected a=[1,3,12,9]
for i in range(len(a)):
q=0
while(a1[i]>0):
z=a1[i]%10
q=q+z
a1[i]=a1[i]//10
s.append(q)
print(a)
s.sort()
print(s)
|
# host and port for client and tracker
HOST = '192.168.43.92'
PORT = 9992
# redis key prefixes
TRANSACTION_QUEUE_KEY = 'transactions.queue'
BLOCK_KEY_PREFIX = 'chain.block.'
PREV_HASH_KEY = 'prev_hash'
SEND_TRANSACTIONS_QUEUE_KEY = 'send.transactions.queue'
TRANSACTIONS_SIGNATURE = 'transactions.signature.'
# number ... |
# -*- coding: utf-8 -*-
description = 'Monitoring for DNS setup'
group = 'basic'
tango_base = 'tango://localhost:10000/test/'
devices = dict(
dns_main_voltages = device('nicos_mlz.emc.devices.janitza_online.VectorInput',
description = 'Voltage monitoring',
tangodevice = tango_base + 'janitza_dns/... |
# -*- coding: utf-8 -*-
"""
Created on 2019/8/27
@author: LoyeLee
"""
# 容错最大的有色判断
MAX_RGB_VALUE = 20
# 噪点大小
MAX_NOISY_COUNT = 25
# RGBA白色定义
WHITE_COLOR = (255, 255, 255, 255)
# RGBA黑色定义
BLACK_COLOR = (0, 0, 0, 255)
def print_char_pic(width, height, s_data):
"""
画出字符图, 空格为白色, 点为黑色
"""
_pic_str = ''
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@Author: Nasy
@Date: Dec 31. 2016
@email: sy_n@me.com
@file: optlib/tools/color_print.py
@license: MIT
An Excited Python Script
"""
RESET_COLOR = "\033[0m"
COLOR_CODES = {
"blue": "\033[1;34m", # blue
"green": "\033[1;32m", # green
"yellow"... |
#
# PySNMP MIB module HPN-ICF-DHCPSNOOP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-DHCPSNOOP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:25:32 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... |
class InvalidEmailException(Exception):
pass
def send_email(email, subject, content):
if not "@" in email:
raise InvalidEmailException("email does not contain '@'")
try:
send_email("xyz", "t11", "t22")
except InvalidEmailException:
print("Ungültige Email")
finally:
print(... |
## HTML lists ##
CHECKBOX_TOGGLES = [
"accelerometer",
"gps",
"calls",
"texts",
"wifi",
"bluetooth",
"power_state",
"proximity",
"gyro",
"magnetometer",
"devicemotion",
"ambient_audio",
"reachability",
"allow_upload_over_cellular_data",
"use_anonymized_hashing... |
# Comments allow for programers to write reminders or create a better understanding of the code and program
city_name = "St. Potatosburg"
# The amount of people living in the city of St. Potatosburg:
city_pop = 340000 |
# Script to generate translation and rotation specializations of placed volumes,
rotation = [0x1B1, 0x18E, 0x076, 0x16A, 0x155, 0x0AD, 0x0DC, 0x0E3, 0x11B,
0x0A1, 0x10A, 0x046, 0x062, 0x054, 0x111, 0x200]
translation = ["translation::kGeneric", "translation::kIdentity"]
header_string = """\
/// @file Tran... |
class Solution:
def dropNegatives(self, A):
j = 0
newlist = []
for i in range(len(A)):
if A[i] > 0:
newlist.append(A[i])
return newlist
def firstMissingPositive(self, nums: List[int]) -> int:
A = self.dropNegatives(nums)
if len(A)==0:
... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# author: bigfoolliu
"""
- getattr函数获取实例的属性
- __getattr__,当调用的属性或者方法不存在的时候,该方法会被调用
"""
class A(object):
def __init__(self, name):
self.name = name
def default_func(self):
print("default func")
def __getattr__(self, attr):
return se... |
def group_weekly(df, date_col):
weekly = df.copy()
weekly['week'] = weekly[date_col].dt.isocalendar().week
weekly['year'] = weekly[date_col].dt.isocalendar().year
weekly['year_week'] = weekly['year'].astype(str) + "-" + weekly['week'].astype(str)
weekly = weekly.groupby('year_week').sum()
weekly... |
# coding:utf-8
workers = 4
threads = 4
bind = '0.0.0.0:5000'
worker_class = 'eventlet' # 'gevent'
worker_connections = 2000
pidfile = 'gunicorn.pid'
accesslog = './logs/gunicorn_acess.log'
errorlog = './logs/gunicorn_error.log'
loglevel = 'info'
reload = True
|
seed_csv = """
id,name,some_date
1,Easton,1981-05-20T06:46:51
2,Lillian,1978-09-03T18:10:33
3,Jeremiah,1982-03-11T03:59:51
4,Nolan,1976-05-06T20:21:35
""".lstrip()
model_sql = """
select * from {{ ref('seed') }}
"""
profile_yml = """
version: 2
models:
- name: materialization
columns:
- name: id
t... |
# -*- coding: utf-8 -*-
"""
1954. Minimum Garden Perimeter to Collect Enough Apples
https://leetcode.com/problems/minimum-garden-perimeter-to-collect-enough-apples/
Example 1:
Input: neededApples = 1
Output: 8
Explanation: A square plot of side length 1 does not contain any apples.
However, a square plot of side len... |
donate_msg = """{name} is an open source project, created with the intention
of sharing a simple and easy-to-use application for the care of
information integrity, through the use of hash table files.
If you like {name}, feel free to make a donation if you think so.
Any kind of support will be immensely gratefu... |
# -*- coding: utf-8 -*-
# * ********************************************************************* *
# * Copyright (C) 2018 by xmz *
# * ********************************************************************* *
__author__ = "Marcin Zelek (marcin.zelek@gmail.com)"
__copyright__ ... |
# The below function calculates the BMI or Body Mass Index of a person
# Created by Agamdeep Singh / CodeWithAgam
# Youtube: CodeWithAgam
# Github: CodeWithAgam
# Instagram: @agamdeep_21, @coderagam001
# Twitter: @CoderAgam001
# Linkdin: Agamdeep Singh
def calculate_BMI():
# Get the inputs from the user
height... |
{
"includes": [
"common.gypi",
],
"targets": [
{
"target_name": "colony-lua",
"product_name": "colony-lua",
"type": "static_library",
"defines": [
'LUA_USELONGLONG',
],
"sources": [
'<(colony_lua_path)/src/lapi.c',
'<(colony_lua_path)/src/lauxl... |
awnser = 5
print('Enter a number between 1 and 10')
for i in range(0, 4):
guess = int(input(f'You have {4-i} guesses left: '))
if guess == 5 or guess == 10:
print('You guessed correct!')
break
else:
print(f'The guess of {guess} was not correct')
if guess > awnser:
print('Your guess was too l... |
"""
0606. Construct String from Binary Tree
You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way.
The null node needs to be represented by empty parenthesis pair "()". And you need to omit all the empty parenthesis pairs that don't affect the one-to-on... |
class WrongInputDataType(Exception):
def __init__(self, message="Input data must be a pandas.Series."):
self.message = message
super().__init__(self.message)
class NotFittedError(Exception):
def __init__(self, message="Please call fit() before detect().", tip=""):
self.message = " ".jo... |
alpha = "abcdefghijklmnopqrstuvwxyz"
key = "xznlwebgjhqdyvtkfuompciasr"
message = input("enter the message : ")
cipher = ""
for i in message:
cipher+=key[alpha.index(i)]
print(cipher) |
def keep(sequence, predicate):
pass
def discard(sequence, predicate):
pass
|
class Solution(object):
"""
A happy number is a number defined by the following process: Starting with any positive integer,
replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1
(where it will stay), or it loops endlessly in a cycle which does not ... |
# coding: utf-8
# create by tongshiwei on 2018/4/27
class Solution:
def subsetsWithDup(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
num_rec = {}
for n in nums:
if n not in num_rec:
num_rec[n] = 0
num_rec[n... |
n1=int(input('Digite a idade da primeira pessoa:'))
n2=int(input('Digite a idade da segunda pessoa:'))
n3=int(input('Digite a idade da terceira pessoa:'))
#Maior ou igual a 100
#menor que 100
soma = n1+ n2+ n3
if soma > 100 or soma == 100:
print('Maior ou igual a 100')
else:
print('Menor que 100')
|
class Solution:
"""
@param grid: a 2D array
@return: the maximum area of an island in the given 2D array
"""
def maxAreaOfIsland(self, grid):
# Write your code here
maxArea = 0
m = len(grid)
n = len(grid[0])
def dfs(r, c):
if grid[r][c] == 0:
... |
print ("Angka Pertama : ")
a = int(input())
print ("Angka Kedua : ")
b = int (input())
print (hasil = a * b)
|
# Stop words
STOP_WORDS = set(
"""
ke gareng ga selekanyo tlhwatlhwa yo mongwe se
sengwe fa go le jalo gongwe ba na mo tikologong
jaaka kwa morago nna gonne ka sa pele nako teng
tlase fela ntle magareng tsona feta bobedi kgabaganya
moo gape kgatlhanong botlhe tsotlhe bokana e esi
setseng mororo dinako golo ... |
class Solution:
def canConstruct(self, ransomNote, magazine):
"""
:type ransomNote: str
:type magazine: str
:rtype: bool
"""
ransomNote = list(ransomNote)
magazine = list(magazine)
r_len = len(ransomNote)
m_len = len(magazine)
if r_len... |
'''
UFCG
PROGRAMAÇÃO 1
JOSE ARTHUR NEVES DE BRITO - 119210204
Lei Estadual
'''
idade = int(input("Idade? "))
if(idade < 12):
print('criança (meia entrada)')
elif(idade >= 65):
print('idoso (meia entrada)')
else:
estudante = input('Estudante? ')
if(estudante == 's'):
rp = input('Rede Pública? ')
if(rp == 's'):... |
'''
LC1413: Minimum Value to Get Positive Step by Step Sum
Given an array of integers nums, you start
with an initial positive value startValue.
In each iteration, you calculate the step by
step sum of startValue plus elements in nums (from left to right).
Return the minimum positive value of startValue
such that the s... |
def solve_part_one(puzzle: list) -> int:
turn = 1
numbers = []
while turn <= 2020:
if turn <= len(puzzle):
numbers.append(puzzle[turn - 1])
turn += 1
continue
# We finished the initial list. Look at the last number
last_num = numbers[-1]
if... |
#
# PySNMP MIB module BNET-ATM-ATOM-AUG-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BNET-ATM-ATOM-AUG-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:40:04 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... |
UP_KEY = 16777235
DOWN_KEY = 16777237
TAB_KEY = 16777217 |
#author Kollen Gruizenga
#function to return all words in list L who start with letter "let"
def beginWith(L, let):
result = []
for x in L:
if (x[0] == let):
result += [x]
return result
|
#!/usr/bin/env python3
"""
Check if a given number is a prime number
"""
def prime_checker(number):
if number <= 1:
return False
for i in range(2, number - 1):
if number % i == 0: # not reminder, is not a prime
return False
return True
n = int(input("Check this number: "))
r... |
CAMPAIGN_INCIDENT_CONTEXT = {
"EmailCampaign": {
"firstIncidentDate": "2021-11-21T14:00:07.425185+00:00",
"incidents": [
{
"emailfrom": "examplesupport@example2.com",
"emailfromdomain": "example.com",
"id": "1",
"name": "Ver... |
# Use a variable to represent a person’s name, and print
# a message to that person. Your message should be simple, such as, “Hello Eric,
# would you like to learn some Python today?”
name = "Kuljot"
print(f"Hello {name}, would you like to learn some Python today?")
|
'''
Class to represent plant care.
'''
class Plant_Care:
'''
General representation of abstract plant care.
'''
def __init__(self,
times_monthly=2,
plant_type='Cacti',
soil_moisutre='Arid'):
self.times_monthly = times_monthly
self.plan... |
# Defaults
ansi_colors = """
RESTORE=$(echo -en '\033[0m')
RED=$(echo -en '\033[00;31m')
GREEN=$(echo -en '\033[00;32m')
YELLOW=$(echo -en '\033[00;33m')
BLUE=$(echo -en '\033[00;34m')
MAGENTA=$(echo -en '\033[00;35m')
PURPLE=$(echo -en '\033[00;35m')
CYAN=$(echo -en '\033[00;36m')
LIGHTGRAY=$(echo -en '\033[00;37m')
"... |
"""
https://projecteuler.net/problem=4
Largest palindrome product
Problem 4
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
"""
def main():
min_factor =... |
#
# PySNMP MIB module NTWS-AP-CONFIG-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NTWS-AP-CONFIG-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:25:33 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... |
class CarTablePage(Page):
add_car_form = AddCarForm()
car_table = CarTable()
def add_car(self, car: Car):
self.add_car_form.add_car(car)
def remove_car(self, car: Car):
self.car_table.remove_car(car)
@property
def cars(self) -> List[Car]:
return self.car_table.cars
|
r_0_0=[[0,1,2,3,4],[15,16,17,18,5],[14,23,34,19,6],[13,22,21,20,7],[12,11,10,9, 8]]
r_4_0=[[4,5,6,7,8],[ 3,18,19,20,9],[2,17,24,21,10],[1,16,23,22,11],[0,15,14,13,12]]
def index(s,pos):
def espelho_linhas(lst):
"""
Pega numa chave e inverte cada linha, mantendo a sua ordem na chave
"""
res=[]
for linha in ... |
#
# PySNMP MIB module UBNT-AirMAX-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/UBNT-AirMAX-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:28:21 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... |
# https://leetcode.com/explore/interview/card/top-interview-questions-easy/102/math/745/
# https://leetcode.com/problems/power-of-three/description/
# Power of Three
#
# Given an integer, write a function to determine if it is a power of three.
# ie, 45 % 3 is 0, but 45 is not power of 3
# so it is not simply "n % 3 ... |
def handle_annotations(annotations):
new_global = {}
new_local = {}
if 'global' in annotations:
for key in annotations['global']:
key_new = key.replace('__EQUALS__', '=')
new_global[key_new] = annotations['global'][key]
if 'local' in annotations:
for key in anno... |
range_von, range_bis = 357253,892943
lösung = 0
for password in range(range_von, range_bis):
text = str(password)
double = False
for x in range(5):
if text[x] == text[x+1]:
double = True
increasing = True
for x in range(5):
if text[x] > text[x+1]:
increasing = False
if double and increa... |
# Nó para alocação de uma Fila
class Node:
def __init__(self, data):
self.data = data
self.next = None
# Classe que define uma Fila
class Queue:
def __init__(self):
self.first = None
self.last = None
self._size = 0
# inserir na fila
def push(self, elem):
... |
# Fields
NAME = 'name'
NUMBER = 'number'
SET = 'set'
TYPE = 'type'
IS_INSTANT = 'is-instant'
MEDICINE = 'medicine'
PLUS_DIG = 'plus-dig'
PLUS_HUNT = 'plus-hunt'
PLUS_FIGHT = 'plus-fight'
ABILITY = 'ability'
TEXT = 'text'
# Set values
BASE = 'base'
HQ_EXP = 'hq'
RECON_EXP = 'recon'
# Type values
JUNKYARD = 'junkyard'
... |
class LocationFailureException(Exception):
pass
class BadLatitudeException(Exception):
pass
class BadLongitudeException(Exception):
pass
class BadAltitudeException(Exception):
pass
class BadNumberException(Exception):
pass
class GetPassesException(Exception):
pass
class AstronautFail... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def constructMaximumBinaryTree(self, nums: List[int]) -> TreeNode:
def maxTree(nums):
... |
# 가장 큰 수
def solution(numbers):
str_numbers = list(map(str, numbers))
str_numbers.sort(key=lambda x: x * 3, reverse=True)
return str(int("".join(str_numbers)))
print(solution([6, 10, 2])) |
# -*- coding: utf-8 -*-
N = int(input())
A = list(map(int, input().split()))
pre = [0]*len(A)
pre[0] = A[0]
aft = [0]*len(A)
aft[-1] = A[-1]
for pos, it in enumerate(A[1:], 1):
pre[pos] = pre[pos-1]+it
for pos in range(len(A)-2, -1, -1):
aft[pos] = aft[pos+1]+A[pos]
ans = 0;
print(pre)
print(aft)
for pos in ra... |
def group(it, n):
it = iter(it)
block = []
for elem in it:
block.append(elem)
if len(block) == n:
yield block
block = []
if block:
yield block
|
"""
Copyright 2014 VoterChat
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distr... |
class CriteriaBuilder():
'''Defines the CriteriaBuilder class'''
__and = None
__where = None
__or = None
__criteria = None
__cmd = None
__sql = None
@property
def AND( self ):
if self.__and is not None:
return self.__and
@property
def WHERE( self ):
... |
description = 'testing qmesydaq'
group = 'optional'
excludes = []
sysconfig = dict(
datasinks = ['LiveViewSink'],
)
tango_base = 'tango://localhost:10000/test/qmesydaq/'
devices = dict(
# RAWFileSaver = device('nicos.devices.datasinks.RawImageSink',
# description = 'Saves image data in RAW format',... |
NUMBER = (1 << 15)
OPERATOR = (1 << 16)
FUNCTION = (1 << 17)
OTHER = (1 << 18)
OPERATOR_PRIORITY_1 = (1 << 10)
OPERATOR_PRIORITY_2 = (1 << 11) # Multiplication & Division
OPERATOR_PRIORITY_3 = (1 << 12) # Implicit Multiplication (0.5/2x, a/b(c))
OPERATOR_PRIORITY_4 = (1 << 13) # Root & Exponent
STUndefined = 0
ST... |
# test for function notation
def helloworld(txt:dict(type=str,help='input text')):
print(txt)
if __name__ == '__main__' :
helloworld('hawken')
print(helloworld.__annotations__) |
# 核心思路
# 题目保证了每个单词之间只会有一个空格分隔,所以只需要简单的
# 按照空格切分即可得到每个token
# 然后对每个token reverse之后再拼接在一起
# 内建功能丰富的语言对这题比较简单
class Solution(object):
def reverseWords(self, s):
"""
:type s: str
:rtype: str
"""
tokens = s.split()
for i in range(len(tokens)):
tokens[i] = token... |
class Solution(object):
def shortestDistance(self, words, word1, word2):
"""
:type words: List[str]
:type word1: str
:type word2: str
:rtype: int
"""
d = {}
d[word1] = -1
d[word2] = -1
minDist = 0x7fffffff
for i,word in enumerat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.