content stringlengths 7 1.05M |
|---|
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
ANY_NAMESPACE = 'json_schema_compiler::any'
ANY_CLASS = ANY_NAMESPACE + '::Any'
class AnyHelper(object):
"""A util class that generates code that uses... |
"""(c) All rights reserved. ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE, Switzerland, VPSI, 2017"""
class Link:
"""A link"""
def __init__(self, url, title):
self.title = title
self.url = url
def __str__(self):
return "<a href='%s'>%s</a>" % (self.url, self.title)
|
# WARNING: this uses `eval`, don't run it on untrusted inputs
class Node:
def __init__(self, value, parent = None):
self.parent = parent
self.nest = (parent.nest + 1) if parent else 0
if type(value) == list:
self.pair = True
self.left, self.right = map(lambda n:Node(n,self), value)
elif ty... |
# Laskeminen luvuilla, kerta 3
# Minkälaisia laskuja voi laskea
print(5+2) # Summa
print(5-2) # Erotus
print(5*2) # Tulo
print(5/2) # Osamäärä / jakolasku
print(5//2) # Jakolaskun kokonaislukuosa
print(5%2) # Jakojäännös
# Laskujärjestys
print(2 + 2 * 3)
print((2 + 2) * 3)
# Liukuluvut = desimaaliluvut
luku1 = 4.0
l... |
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 10 22:32:41 2020
@author: Goutam Dadhich
"""
"""
Given the mobile numeric keypad. You can only press buttons that are
up, left, right or down to the current button. You are not allowed to
press bottom row corner buttons (i.e. * and # ).
Given a number N, find out the ... |
HOST = "0.0.0.0"
DEBUG = True
PORT = 8000
WORKERS = 4
|
# -*- coding: utf-8 -*-
# Re-partitions the feature lookup blocks to conform to a specific max. block size
filename = "feature US.txt"
outfilename = "frag feature US.txt"
with open(outfilename, "wt") as fout:
with open(filename, "rt") as fin:
lookupsize = 50
lookupcount = 0
count = 0
... |
"""
Adding Workflow Labels and Annotations
---------------------------------------
.. NOTE::
Coming soon 🛠
""" |
class MenuItem:
pass
# Create an instance of the MenuItem class
menu_item1 = MenuItem()
|
#!/usr/bin/env python
#
# Copyright 2007 Google LLC
#
# 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... |
def canonicalize_string(val):
"""
Return version of string in UPPERCASE and without redundant whitespace.
"""
try:
return " ".join(val.upper().split())
except AttributeError: # was not upper-able, so was not a string
return val
canonicalizable = ["address_line", "city_name", "cou... |
{
"targets" : [{
"target_name" : "nof",
"sources" : [
"src/nof.cc",
"src/mpi/node_mpi.cc",
"src/osuflow/osuflow.cc",
"src/osuflow/field.cc"
],
"include_dirs" : ["deps/osuflow/include"],
"libraries" : [
"../deps/osuflow/lib/libOSUFlow.so",
"../deps/osuflow/lib/libdiy.so"
]
}]
}
|
def compute(n: int) -> int:
combinations = [1] + [0] * n
for i in range(1, n):
for j in range(i, n + 1):
combinations[j] += combinations[j - i]
return combinations[-1]
|
"""Example B.
"""
def is_match(a, b):
return a is b
print(is_match(1, 1))
|
# API email tester demo
def default( server, postData = None, getData = None ):
print("email tester")
server.email( postData['to'], 'Test Subject', 'Test Body' )
server.respondJson( True ) |
"""Data pipelines allow large amounts of data to be processed without loading into memory at once."""
print("\n############# PULL PIPELINES ##############")
print("\ngenerators can be used for iteration based data pipelines...")
def pipeline_stage_one_a(limit):
num = 0
while num <= limit:
print("stag... |
def genhtml(sites):
##############################################
html = r'''<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Passme JS</title>
<style type="text/css">
fieldset {
margin: 0; padding: 0.75em; ... |
def get_bright(r, g, b):
return sum([r, g, b]) / 3
|
_base_ = [
'../_base_/models/hv_pointpillars_fpn_nus.py',
'../_base_/datasets/nus-3d.py',
'../_base_/schedules/schedule_2x.py',
'../_base_/default_runtime.py',
]
# Note that the order of class names should be consistent with
# the following anchors' order
point_cloud_range = [-50, -50, -5, 50, 50, 3]
cl... |
#
# PySNMP MIB module ZHONE-COM-VOIP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZHONE-COM-VOIP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:41:09 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... |
'''
Created on Aug 29 2015
@author: kevin.chien@94301.ca
'''
class FlamesStatus(object):
def __init__(self, code, key, message):
self.code = code
self.key = key
self.message = message
def __eq__(self, other):
if isinstance(other, FlamesStatus):
return other.code == ... |
#def ask_ok(prompt, retries=4, reminder='Please try again!'):
#while True:
#ok = input(prompt)
#if ok in ('y', 'ye', 'yes'):
#return True
#if ok in ('n', 'no', 'nop', 'nope'):
#return False
#retries = retries - 1
#if retries < 0:
#... |
# with open("status.json","w") as outf:
# print('{"status":"ok"}',file=outf)
with open("status.json","w") as outf:
print('{"status":"updating"}',file=outf) |
#Write a program that calculates how many hours an architect will need to draw projects of several construction sites.
#The preparation of a project takes approximately three hours.
name=input()
number_of_projects=int(input())
required_hours=number_of_projects*3
print(f'The architect {name} will need {required_hours} ... |
#Salvando Dados dos objetos
class Base:
def __init__(self):
self.dados = {
'adm': {'ronaldo@adm.com': ['123', 'Ronaldo', '12345678912', 20], 'carlos@adm.com': ['321', 'Carlos', '782897392821', 25]},
'fisica': {'joao@gmail.com': ['231', 'João', '782901635123', 13], 'andres... |
with open('day17.txt') as f:
lines = [line.strip() for line in f]
xmin,xmax,ymin,ymax,zmin,zmax,wmin,wmax = 0,0,0,0,0,0,0,0
active = set()
for row in range(len(lines)):
for col in range(len(lines[0])):
if lines[row][col] == '#':
xmin = min(xmin, col)
xmax = max(xmax, col)
ymin = min(ymin, ro... |
# "Global" users list.
users = []
while True:
# Initialize a new user. This uses fromkeys as a shorthand for literally
# creating a new dictionary and setting its values to None, which is fine.
# But, show this to users, since it's much faster.
# user = dict.fromkeys(['first_name', 'last_name', 'mid... |
"""
Given a root node reference of a BST and a key, delete the node with the given key in the BST.
Return the root node reference (possibly updated) of the BST.
Basically, the deletion can be divided into two stages:
Search for a node to remove.
If the node is found, delete the node.
Note: Time complexity should be ... |
nome = 'Pedro Paulo Barros Correia da Silva'
print(nome.upper())
print(nome.lower())
nome_sem_espaco = (nome.replace(' ',''))
print(len(nome_sem_espaco))
|
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 15 13:22:40 2021
@author: Victor
"""
annual_salary = float(input("Enter your annual salary: "))
portion_saved = float(input("Enter the percent of your salary to save, as a decimal: "))
monthly_salary = annual_salary/12
monthly_savings = monthly_salary * portion_saved
t... |
def test_passwd_file(File):
passwd = File("/etc/passwd")
assert passwd.contains("root")
assert passwd.user == "root"
assert passwd.group == "root"
assert passwd.mode == 0o644
def test_nginx_is_installed(Package):
nginx = Package("nginx")
assert nginx.is_installed
assert nginx.version.s... |
"""Commandline engine to do work on minecraft waypoints."""
# pylint: disable=C0301
# pylint: disable=C0103
# pylint: disable=R1723
# pylint: disable=W0703
# pylint: disable=W0104
# pylint: disable=R1720
# I realise you said no global variables, but these were a pain to try passing into every function
data = [
{
... |
#!/usr/bin/python3.5
print('Running ETL For Riders')
# Brings data using the Cloudstitch API
# into staging tables for further processing by other parts
# of the process
|
#
# PySNMP MIB module Juniper-PPP-Profile-CONF (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-PPP-Profile-CONF
# Produced by pysmi-0.3.4 at Mon Apr 29 19:53:03 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.... |
load(
"@com_activestate_rules_vendor//private:dependencies.bzl",
_vendor_dependencies = "vendor_dependencies"
)
load(
"@com_activestate_rules_vendor//private:generate.bzl",
_vendor_generate = "vendor_generate"
)
vendor_dependencies = _vendor_dependencies
vendor_generate = _vendor_generate
|
# OpenWeatherMap API Key
weather_api_key = "532f8d0abc1e638795cea2ce10729a26"
# Google API Key
g_key = "AIzaSyBIgvIa9rZosgo9uoIOjJL9Cgdz5ZIdj9Q"
|
# x는 글로벌 변수이다.
# foo 함수 내에서 x는 자유 변수이다.
x = 1
def foo():
print(x)
# outer_func는 지역변수 n이 있다.
# inner_func 에는 지역변수 m 과 n 이 있다.
def outer_func():
n = 1
def inner_func():
m = 2
print(n)
print(m)
return inner_func
func = outer_func()
print(func.__code__.co_freevars)
|
class Solution:
def isAnagram(self, s: str, t: str) -> bool:
if s == t:
return True
if len(s) != len(t) or len(s) == 0 or len(t) == 0:
return False
pre_map = {}
for i in s:
if pre_map.__contains__(i):
pre_map[i] += 1
els... |
class Solution:
def findNumberOfLIS(self, nums: List[int]) -> int:
n = len(nums)
if n < 2:
return n
length, cnt = [1] * n, [1] * n
for idx, _ in enumerate(nums):
for j in range(idx):
if nums[j] < _:
if length[idx] == length[... |
# Finding Bridges in Undirected Graph
def computeBridges(l):
id = 0
n = len(l) # No of vertices in graph
low = [0] * n
visited = [False] * n
def dfs(at, parent, bridges, id):
visited[at] = True
low[at] = id
id += 1
for to in l[at]:
if to == parent:
... |
class BaseError(Exception):
pass
class ResourceNotFoundError(BaseError):
name = "ResourceNotFoundError"
status = 404
def __init__(self, message=None):
self.body = {
"message": message or "Resource not found"
}
class BadParametersError(BaseError):
name = "BadParameter... |
class Antibiotico:
def __init__(self, nombre, tipoAnimal, dosis, precio):
self.__nombre = nombre
self.__tipoAnimal = tipoAnimal
self.__dosis = dosis
self.__precio = precio
@property
def nombre(self):
return self.__nombre
@property
def tipoAnimal(... |
"""
BIAflows problem classes
"""
CLASS_OBJSEG = "ObjSeg"
CLASS_SPTCNT = "SptCnt"
CLASS_PIXCLA = "PixCla"
CLASS_TRETRC = "TreTrc"
CLASS_LOOTRC = "LooTrc"
CLASS_OBJDET = "ObjDet"
CLASS_PRTTRK = "PrtTrk"
CLASS_OBJTRK = "ObjTrk"
CLASS_LNDDET = "LndDet"
|
#%%
def cal_iou(box1, box2):
"""
:param box1: = [xmin1, ymin1, xmax1, ymax1]
:param box2: = [xmin2, ymin2, xmax2, ymax2]
:return:
"""
xmin1, ymin1, xmax1, ymax1 = box1
xmin2, ymin2, xmax2, ymax2 = box2
# 计算每个矩形的面积
s1 = (xmax1 - xmin1) * (ymax1 - ymin1) # C的面积
s2 = (xmax2 - xm... |
{
"targets": [
{
"target_name": "unidecode",
"sources": [
"src/addon.cxx"
],
"include_dirs" : [
"<!(node -e \"require('nan')\")"
],
"cflags": ["-g"],
'cflags_cc!': [ '-fno-exceptions' ],
'conditions': [
['OS=="mac"', {
'xcode_s... |
#!/usr/bin/python
# not_kwd.py
grades = ["A", "B", "C", "D", "E", "F"]
grade = "L"
if grade not in grades:
print ("Unknown grade")
|
def setup(bot):
return
DISCORD_EPOCH = 1420070400000
def ReadableTime(first, last):
readTime = int(last-first)
weeks = int(readTime/604800)
days = int((readTime-(weeks*604800))/86400)
hours = int((readTime-(days*86400 + weeks*604800))/3600)
minutes = int((readTime-(hours*3600 + days*864... |
EXAMPLES1 = (
('09-exemple1.txt', 15),
)
EXAMPLES2 = (
('09-exemple1.txt', 1134),
)
INPUT = '09.txt'
def read_data(fn):
data = list()
with open(fn) as f:
for line in f:
line = line.strip()
data.append(line)
return data
def neighbours(data,... |
# Selecting Indices
# Explain in simple terms what idxmin and idxmax do in the short program below.
# When would you use these methods?
data = pd.read_csv('../../data/gapminder_gdp_europe.csv', index_col='country')
print(data.idxmin())
print(data.idxmax()) |
# status: testado com exemplos da prova
if __name__ == '__main__':
char = input()
all_words = input().split()
words = [word for word in all_words if char in word]
print("{0:.1f}".format(len(words) / len(all_words) * 100))
|
#! /usr/bin/env python
model0.initialize()
model1.initialize()
time = model0.get_current_time()
end_time = model0.get_end_time()
while time < end_time:
has_converged = False
while has_converged is False:
state1 = model1.get_value("some_state_variable")
model0.set_value("some_state_varia... |
class LinkedListNode:
def __init__(self, data):
self.data = data
self.next = None
class Stack:
def __init__(self):
self.num_elements = 0
self.head = None
def push(self, data):
new_node = LinkedListNode(data)
if self.head is None:
self.head = ne... |
# Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase.
# Example 1:
# Input: "Hello"
# Output: "hello"
# Example 2:
# Input: "here"
# Output: "here"
# Example 3:
# Input: "LOVELY"
# Output: "lovely"
class Solution:
def toLowerCase(self, str: str) -> str:
... |
"""
Project Euler Problem 6: Sum square difference
"""
# Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum
MAXINT = 100
sumsq = 0
sqsum = (MAXINT*(MAXINT+1)//2)**2
# Calculate the sum of squares
for i in range(1,MAXINT+1):
sumsq += i**2
print(s... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Helper methods used in notebooks
"""
def _dataframe_highlight_4d_no_altitude_dim(x, bg_color='#ffcccc'):
#copy df to new - original data are not changed
df = x.copy()
#set by condition
m1 = df['Dim'] == 4
m2 = 'altitude' not in df['Dim names']
m... |
class Graph(object):
def __init__(self,*args,**kwargs):
self.node_neighbors = {} # Define vertex and adjacent vertex set as dictionary structure
self.visited = {} # Define the visited vertex set as a dictionary structure
def add_nodes(self,nodelist):
for node in nodelist:
... |
"""Write a function that returns the largest element in a list."""
def largest_element(a):
return max(a)
mylist = [1, 4, 5, 100, 2, 1, -1, -7]
max = largest_element(mylist)
print("The largest value is ", max)
|
# Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project au... |
sample_rate=16000 #Provided in the paper
n_mels = 80
frame_rate = 80 #Provided in the paper
frame_length = 0.05
hop_length = int(sample_rate/frame_rate)
win_length = int(sample_rate*frame_length)
scaling_factor = 4
min_db_level = -100
bce_weights = 7
embed_dims = 512
hidden_dims = 256
heads = 4
forward_expansion =... |
# Classes are blueprints that make instances of a class
# emp_1 = Employee()
# emp_2 = Employee()
# These two things become independant objects or 'instances'
"""
emp_1.first = 'Corey'
emp_1.last = 'Schafer'
emp_1.email = 'Corey.Schafer@company.com'
emp_1.pay = 50000
emp_2.first = 'Corey'
emp_2.last = 'Schafer'
emp... |
class node:
def __init__(self, x):
self.value = x
self.next = None
class LinkedList:
def __init__(self, y):
self.head = node(y)
|
class Genre:
"""
Entidad que representa géneros de un manga.
Attributes
----------
name : str
Nombre del manga.
generos : list of String
Lista de géneros que puede tener el manga.
"""
def __init__(self) -> None:
"""
Constructor de la entidad
"""
self.gener... |
class Message(object):
def __init__(self, args, kwargs=None, start_timestamp=None):
'''
The Nomad Message type which is passed around clients.
:param args: list of args for the next operator
:type args: list
:param kwargs: dict of kwargs for the next operator
:type kw... |
def subwaysFilter(dimension):
def _filter(poi):
if poi["id"] == "subways/" + dimension:
return poi
return _filter
|
'''Crie um programa que tenha uma tupla com várias palavras (não usar acentos).
Depois disso, você deve mostrar, para cada palavra, quais são suas vogais.'''
palavra = ''
tupla = ('APRENDER',
'PROGRAMAR',
'LINGUAGEM',
'PYTHON',
'CURSO',
'GRATIS',
'ESTUDAR',
... |
'''
TOTAL PATHS FROM (0, 0) to (m, n)
The task is to calculate total possible moves we can make to reach
(m, n) in a matrix, starting from origin, given that we can only take
1 step towards right or up in a single move.
'''
def totalPaths(m, n):
total = []
for i in range(0, m):
temp = []
for j... |
def combo_breaker_part1(data: str) -> int:
key1, key2 = tuple(map(int, data.splitlines(keepends=False)))
subject = 7
found = False
loop_size = None
loop_count = 1
while not found:
loop_count += 1
subject = transform(subject)
if subject == key2:
loop_size = loo... |
with open("mystery.png", "rb") as f:
buf1 = f.read()[-0x10:]
with open("mystery2.png", "rb") as f:
buf2 = f.read()[-2:]
with open("mystery3.png", "rb") as f:
buf3 = f.read()[-8:]
flag = [0 for i in range(0x1a)]
flag[1] = buf3[0]
flag[0] = buf2[0] - ((0x2a + (0x2a >> 7)) >> 1)
flag[2] = buf3[1]
flag[4] = bu... |
# Input exmaple and variable value assignment
print('Yo nerd, waddup?')
print('Tell me your name:')
myName = input() # Assigns whatever you type to the myName variable
print('Nice to meet you, ' + myName + '!') # Print text with a variable name
print('Your name consists of this many characters: ')
print(len... |
class Solution:
def isRectangleCover(self, rectangles: List[List[int]]) -> bool:
points={}
for r in rectangles:
vs=[tuple(r[:2]), (r[2],r[1]), tuple(r[2:]), (r[0],r[3])]
for i in range(len(vs)):
v=vs[i]
if v not in points:
... |
class Solution(object):
def findMedianSortedArrays(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: float
"""
nums = sorted(nums1 + nums2)
n = len(nums)
middle = n // 2
if n % 2 == 0:
return (nums[middle - 1] + nums[middle]) / 2.... |
def complement(num):
"""
Find the non-zero padded binary compelement.
"""
if not num:
return 1
i = 1
while i <= num:
num ^= i
i = i << 1
return num
|
hugehairypants = ['огромные', 'волосатые', 'штаны']
for i in hugehairypants:
print(i)
print(i)
input() |
aUser = input("Please enter the first integer: ")
bUser = input("Please enter the second integer: ")
cUser = input("Please enter the third integer: ")
# Compare Inputs
def compareInput(aUser, bUser, cUser):
aUser = integerCheck(aUser)
bUser = integerCheck(bUser)
cUser = integerCheck(cUser)
if aUser >... |
"""
File that contains exceptions for molecules that need
to have different multiplicity/spin or symmetry configurations
than the defaults set by Gaussian or other Quantum Chemistry programs
Ex: CH2 radical, O2, OH radical
"""
# species
# 320320000000000000001 = O2
# 140260020000000000001 = CH2
# 17017000000000000... |
class MgraphConnectoSiteMixin:
def get_root_site(self):
return self.get('/sites/root')
def get_site(self, site_id):
return self.get(f'/sites/{site_id}')
def get_site_drive(self, site_id):
return self.get(f'/sites/{site_id}/drive')
def get_site_drives(self, site_id):
re... |
dictionary = {
"1": "一,one",
"2": "丨,line",
"3": "丶,dot",
"4": "丿,slash",
"5": "乙,second",
"6": "亅,hook",
"7": "二,two",
"8": "亠,lid",
"9": "人,man",
"10": "儿,son, legs",
"11": "入,enter",
"12": "八,eight",
"13": "冂,wide",
"14": "冖,cloth cover",
"15": "冫,ice",
... |
game = {
'columns': 8,
'rows': 8,
'fps': 30,
'countdown': 5,
'interval': 800,
'score_increment': 1,
'level_increment': 8,
'interval_increment': 50
}
|
'''
Given an integer array nums, in which exactly two elements
appear only once and all the other elements appear exactly
twice. Find the two elements that appear only once. You can
return the answer in any order.
Follow up: Your algorithm should run in linear runtime
complexity. Could you ... |
# Write a method to replace all spaces in a string s with '%20'.
# You my assume that the string has sufficient space at the end to hold
# the additional characters, and that you are given the "true"
# length of the string.
# Naive Solution (In this case the less beautiful solution)
# Runtime O(n)
def naiveURLify(s):
... |
StampManifestProvider = provider(fields = ["stamp_enabled"])
def _impl(ctx):
return StampManifestProvider(stamp_enabled = ctx.build_setting_value)
stamp_manifest = rule(
implementation = _impl,
build_setting = config.bool(flag = True),
)
|
#first line opening when chat starts
def chat_opening():
"""Prints an opening line and checks if user returns proper response to determine if the chatbot should be started."""
msg = input("Would you like to learn about how animals migrate throughout and across the world? [Y/N]\nINPUT: ")
msg = msg... |
class Solution:
"""
@param x: a double
@return: the square root of x
"""
def sqrt(self, x):
# write your code here
start = 1
end = x
if x < 1:
start = x
end = 1
while (end - start > 1e-10):
mid = start ... |
nono = int(input('Digite um número: '))
cont = contn = 0
while not nono == 101:
cont += 1
contn += nono
nono = int(input('Digite um número: '))
print(f'Você digitou {cont} vezes.')
print(f'A soma dos números digitados é de {contn}')
|
# -*- coding: utf-8 -*-
# ------------- Comparaciones -------------
print (7 < 5) # Falso
print (7 > 5) # Verdadero
print ((11 * 3) + 2 == 36 - 1) # Verdadero
print ((11 * 3) + 2 >= 36) # Falso
print ("curso" != "CuRsO") # Verdadero
print (5 and 4) #Operacion en binario
print (5 or 4)
print (not(4 > 3))
p... |
# -*- coding: utf-8 -*-
# Hpo terms represents data from the hpo web
hpo_term = dict(
_id = str, # Same as hpo_id
hpo_id = str, # Required
aliases = list, # List of aliases
description = str,
genes = list, # List with integers that are hgnc_ids
)
# Disease terms represent diseases collected from omim... |
# pylint: skip-file
# flake8: noqa
# pylint: disable=too-many-instance-attributes
class OCEnv(OpenShiftCLI):
''' Class to wrap the oc command line tools '''
container_path = {"pod": "spec.containers[0].env",
"dc": "spec.template.spec.containers[0].env",
"rc": "sp... |
class node:
def __init__(self,key):
self.left = None
self.right = None
self.val = key
def PreOrder(root):
if root:
print(root.val, end = " ")
PreOrder(root.left)
PreOrder(root.right)
root = node(1)
root.left = node(2)
root.right = node(3)
root.left.left = node(4... |
# O(N) time, N -> no. of people in the orgChart
# O(d) time, d -> depth of the OrgChart/orgTree
def getLowestCommonManager(topManager, reportOne, reportTwo):
# Write your code here.
return getOrgInfo(topManager, reportOne, reportTwo).lowestCommonManager
def getOrgInfo(manager, reportOne, reportTwo):
numberImpR... |
def method1(ll: list, n: int) -> int:
s = set()
ans = 0
for ele in ll:
s.add(ele)
for i in range(n):
if (ll[i] - 1) not in s:
j = ll[i]
while j in s:
j += 1
ans = max(ans, j - ll[i])
return ans
if __name__ == "__main__":
"""
... |
class Endpoint:
RESOURCE_MANAGEMENT = "https://management.azure.com"
RESOURCE_LOG_API = "https://api.loganalytics.io"
GET_AUTH_TOKEN = "https://login.microsoftonline.com/{}/oauth2/token" # nosec
GET_SHARED_KEY = (
RESOURCE_MANAGEMENT
+ "/subscriptions/{}/resourcegroups/{}/providers/Mic... |
class ContactHelper:
def __init__(self, app):
self.app = app
def open_home_page(self):
wd = self.app.wd
self.app.open_home_page()
def open_add_contact(self):
wd = self.app.wd
# open add contact page
wd.find_element_by_link_text("add new").click()
def c... |
"""
categories: Types,list
description: List delete with step != 1 not implemented
cause: Unknown
workaround: Use explicit loop for this rare operation.
"""
l = [1, 2, 3, 4]
del l[0:4:2]
print(l)
|
def makeString():
fo = open(r"C:\Users\Owner\Tales-of-Destiny-DC\dictionary\kanji.txt",
"r", encoding="utf8")
Lines = fo.readlines()
for line in Lines:
print(createString(line[0:4], line[6]))
def createString(one, two):
return """ elif(Hex[i] + Hex[i+1] + \" \" + Hex[i+3]... |
# -*- coding: utf-8 -*-
"""
shellstreaming.scheduler.master_sched_firstnode
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:synopsis: Schedules all jobs to first worker in list (for testing purpose)
"""
def calc_job_placement(job_graph, worker_hosts, prev_jobs_placement):
next_jobs_placement = prev_... |
'''Escreva um programa que pergunte o sálario de um funcionario e calcule o valor do seu
aumento.
Para salarios superiores a R$1.250,00, calcule um aumento de 10%.
Para os inferiores ou iguais. o aumento é de 15%.'''
salario = float(input("Digite o salario do funcionario: R$"))
if salario <= 1250:
novosalario = sa... |
""" This is helper file to print out strings in different colours
"""
def style(value, styling):
return styling + value + '\033[0m'
def green(value):
return style(value, '\033[92m')
def blue(value):
return style(value, '\033[94m')
def yellow(value):
return style(value, '\033[93m')
def red(valu... |
#*******************************************************************************
#
# Sentence pattern definitions
#
#*******************************************************************************
sentencePatterns = [
[
'nMass is the driver of nMass.',
'nMass is the nTheXOf of nMass, and of us.',
'You a... |
'''
URL: https://leetcode.com/problems/count-largest-group/
Difficulty: Easy
Description: Count Largest Group
Given an integer n. Each number from 1 to n is grouped according to the sum of its digits.
Return how many groups have the largest size.
Example 1:
Input: n = 13
Output: 4
Explanation: There are 9 gro... |
class ResponseCodeError(Exception):
"""请求返回 code 不为 0"""
def __init__(self, code: int, msg: str, data: dict):
self.code = code
self.msg = msg
self.data = data
def __repr__(self) -> str:
return f"错误码: {self.code}, 信息: {self.msg}"
def __str__(self) -> str:
return ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.