content stringlengths 7 1.05M |
|---|
# -*- coding: utf-8 -*-
"""
Processing a list of power plants in Germany.
SPDX-FileCopyrightText: 2016-2021 Uwe Krien <krien@uni-bremen.de>
SPDX-License-Identifier: MIT
"""
__copyright__ = "Uwe Krien <krien@uni-bremen.de>"
__license__ = "MIT"
# from unittest.mock import MagicMock
# from nose.tools import ok_, eq_
#... |
class Solution:
"""
@param t: the length of the flight
@param dur: the length of movies
@return: output the lengths of two movies
"""
def aerial_Movie(self, t, dur):
t -= 30
dur.sort()
left = 0
right = len(dur) - 1
longest = 0
longest_pair = None
... |
'''
Source : https://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock/
Author : Yuan Wang
Date : 2018-06-02
/**********************************************************************************
*
* Say you have an array for which the ith element is the price of a given stock on day i.
*
* If you were only p... |
# 1. Escreva uma funcao que recebe como entrada as dimensoes M e N e o elemento E de preenchimento
# e retorna uma lista de listas que corresponde a uma matriz MxN contendo o elemento e em todas
# as posicoes. Exemplo:
# >>> cria_matriz(2, 3, 0)
# [[0, 0, 0], [0, 0, 0]]
def f_preencheMatriz(m, n, el):
matrizPreen... |
'''
Python program to compute and print sum of two given integers (more than or equal to zero).
If given integers or the sum have more than 80 digits, print "overflow".
'''
print ("Input first integer:")
x = int (input())
print ("Input second integer:")
y = int (input())
if x >= 10 ** 80 or y >= 10 ** 80 or x + y >= ... |
### Caesar Cipher - Solution
def caesarCipher(s, rot_count):
for ch in range(len(s)):
if s[ch].isalpha():
first_letter = 'A' if s[ch].isupper() else 'a'
s[ch] = chr(ord(first_letter) + ((ord(s[ch]) - ord(first_letter) + rot_count) % 26))
print(*s, sep='')
n = int(input())
s = l... |
# source: https://github.com/brownie-mix/upgrades-mix/blob/main/scripts/helpful_scripts.py
def encode_function_data(*args, initializer=None):
"""Encodes the function call so we can work with an initializer.
Args:
initializer ([brownie.network.contract.ContractTx], optional):
The initialize... |
# atributos publicos, privados y protegidos
class MiClase:
def __init__(self):
self.atributo_publico = "valor publico"
self._atributo_protegido = "valor protegido"
self.__atributo_privado = "valor privado"
objeto1 = MiClase()
# acceso a los atributos publicos
print(objeto1.atribut... |
# Curso Python #004 - Manipulando Texto
# As principais operações que vamos aprender são o Fatiamento de String, Análise com len(), count(), find(), transformações com replace(), upper(), lower(), capitalize(), title(), strip(), junção com join()
#Primeira Parte
#texto = str('Curso em Python')
#print(texto[:15:2])
#... |
class Schemas:
"""
Class that contains DATABASE schema names.
"""
chemprop_schema = "sbox_rlougee_chemprop"
dsstox_schema = "ro_20191118_dsstox"
qsar_schema = "sbox_mshobair_qsar_snap"
invitrodb_schema = "prod_internal_invitrodb_v3_3"
information_schema = "information_schema"
|
# inheritance - 2 - normal methods
class Person():
def details(self):
print("Can have information specific to the person")
class Student(Person):
def details(self):
super().details()
print("Can have information specific to the student")
s = Student()
s.details()
|
# 255: '11111111'
# 65536: '10000000000000000'
# 16777215: '111111111111111111111111'
d = 0
a = 8307757
while (d != a):
c = d | 0x10000
d = 14070682
while True:
d = (((d + (c & 0xFF)) & 0xFFFFFF) * 65899) & 0xFFFFFF
if 256 > c:
break
c //= 256
print("Program halts")
|
"""
# Definition for a Node.
class Node:
def __init__(self, val: int = 0, left: 'Node' = None, right: 'Node' = None, next: 'Node' = None):
self.val = val
self.left = left
self.right = right
self.next = next
"""
class Solution:
def connect(self, root: 'Node') -> 'Node':
i... |
'''
You may have noticed that the medals are ordered according to a lexicographic (dictionary) ordering: Bronze < Gold < Silver. However, you would prefer an ordering consistent with the Olympic rules: Bronze < Silver < Gold.
You can achieve this using Categorical types. In this final exercise, after redefining the 'M... |
class Node(object):
def __init__(self, value):
self.value = value
self.next = None
self.prev = None
def __repr__(self):
if not self:
return '%s()' % (self.__class__.__name__,)
return '%s(%r)' % (self.__class__.__name__, self.value)
class BinaryNode():
d... |
def getNextPowerof2(num):
power = 1
while(power < num):
power *= 2
return power
def buildWalshTable(wTable, length, i1,i2, j1,j2, isComplement):
if length == 2:
if not isComplement:
wTable[i1][j1] = 1
wTable[i1][j2] = 1
wTable[i2][j1] = 1
... |
"""
Number to Words
"""
UP_TO_TWENTY = ["", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten","Eleven",
"Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"]
TENS = ["", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "... |
"""
An ordered symbol table implementation of key-value pairs using Binary Search
Tree.
"""
class BinarySearchTreeST(object):
""" Symbol table implementation using Binary Search Tree.
The class represents an ordered symbol table of generic key-value pairs.
A symbol table implements the associative array ... |
class Credential:
"""
Class that generates new instances of credentials.
"""
credential_list = [] # Empty credential list
def __init__(self, account_name, account_user_name, account_password):
"""
__init__ method that helps us define properties for our objects.
"""
... |
#
# 1021. Remove Outermost Parentheses
#
# Q: https://leetcode.com/problems/remove-outermost-parentheses/
# A: https://leetcode.com/problems/remove-outermost-parentheses/discuss/275804/Javascript-Python3-C%2B%2B-Stack-solutions
#
class Solution:
def removeOuterParentheses(self, parens: str) -> str:
s, x = ... |
"""
[2014-12-3] Challenge #191 [Intermediate] Space Probe. Alright Alright Alright.
https://www.reddit.com/r/dailyprogrammer/comments/2o5tb7/2014123_challenge_191_intermediate_space_probe/
#Description:
NASA has contracted you to program the AI of a new probe. This new probe must navigate space from a starting locati... |
# QUESTION
"""
Given an array A[] of size n. The task is to find the largest element in it.
Example 1:
Input:
n = 5
A[] = {1, 8, 7, 56, 90}
Output:
90
Explanation:
The largest element of given array is 90.
Example 2:
Input:
n = 7
A[] = {1, 2, 0, 3, 2, 4, 5}
Output:
5
Explanation:
The largest element of given array... |
{'983ab651-eb86-4471-8361-c97a5015637e': ('eb86', 'gcpuujtn5ydu', 'SW3', 'Chelsea', ['Chelsea'], (51.491239, -0.16875000000000001)),
'83f496df-fcc8-4dcf-8161-a60a75364cf2': ('fcc8', 'gcpuwf1xsv7d', 'SE26', 'Sydenham', ['Sydenham'], (51.428317999999997, -0.052663000000000001)),
'31f90575-7945-4999-b3a7-5045bb860302': ('... |
"""Hackerrank Problems"""
def staircase(n):
"""Print right justified staircase usings spaces and hashes"""
for row in range(n):
n_hashes = row + 1
n_spaces = n - n_hashes
print(" " * n_spaces, end="")
print("#" * n_hashes)
|
"""Specialized mobject base classes.
Modules
=======
.. autosummary::
:toctree: ../reference
~image_mobject
~point_cloud_mobject
~vectorized_mobject
"""
|
#print('\033[0;30;41mOlá mundo')
#print('\033[4;33;44mOlá mundo')
#print('\033[1;35;43mOlá mundo')
#print('\033[30;42mOlá mundo')
#print('\033[7;30mOlá mundo')
#a = 5
#b = 5
#print('Os valores são \033[0;30;41m{} e \033[7;30m{}'.format(1, b))
#nome = 'Tiago'
#print('Olá! Prazer em te conhecer {} {} {}!!!!'.format('\... |
def mayor(a,b):
if(a>b):
print("a es mayor que b")
mayor(4,3)
mayor(0,-1)
mayor(9,9) |
class TextureType:
PLAYER = 0
HOUSE_INTERIOR = 1
GROCERY_STORE_INTERIOR = 2
VEHICLE = 3
SINK = 4
SHOPPING_CART = 5
DOG = 6
FOOD = 7
SOAP = 8
HAND_SANITIZER = 9
TOILET_PAPER = 10
MASK = 11
PET_SUPPLIES = 12
AISLE = 13
DOOR = 14
HOUSE_EXTERIOR = 15
STORE_EXTERIOR = 16
SELF_CHECKOUT = 17
CLOSET = 18
C... |
mys1 = {1,2,3,4}
mys2 = {1,2,3,4,5,6}
print(mys2.issuperset(mys1)) # ISUP1
mys3 = {'a','b','c','d'}
mys4 = {'d','w','f','g'}
mys5 = {'a','b', 'c', 'd','v','w','x','z'}
print(mys3.issuperset(mys4)) # ISUP2
print(mys4.issuperset(mys5)) # ISUP3
print(mys5.issuperset(mys3)) # ISUP4 |
fa=open('MGI_HGNC_homologene.rpt')
L={}
fa.readline()
for line in fa:
seq=line.rstrip().split('\t')
try:
l= abs(float(seq[11])-float(seq[12]))
L[seq[1]]=l
except Exception as e:
pass
fi=open('GSE109125_Gene_count_table.csv.uniq')
fo=open('GSE109125_Gene_count_table.csv.uniq.rpk','w... |
#
# @lc app=leetcode id=215 lang=python3
#
# [215] Kth Largest Element in an Array
#
# https://leetcode.com/problems/kth-largest-element-in-an-array/description/
#
# algorithms
# Medium (59.69%)
# Likes: 6114
# Dislikes: 378
# Total Accepted: 944.8K
# Total Submissions: 1.6M
# Testcase Example: '[3,2,1,5,6,4]\n2... |
blog_list = [
{"date": "Dec 2018",
"title": "Starcraft II A.I. Bot",
"content": "Industria is a mixture of role-based A.I. with an deep learning decision process enhancement. While most of it's actions are scripted, it decides about an army composition.",
"keywords": ['starcraft-ii','bot','artificia... |
def reduceBlue(picture, amount):
for pixel in getPixels(picture):
newBlue = getBlue(pixel) * amount
setBlue(pixel, newBlue)
repaint(picture)
def swapRedBlue(picture):
for pixel in getPixels(picture):
swapBlue = getRed(pixel)
swapRed = getBlue(pixel)
setR... |
n, _ = input().split()
n = int(n)
l = [[] for i in range(n)]
while True:
try:
a, b = input().split()
a = int(a)
b = int(b)
l[a].append(b)
except Exception as e:
break
for r in range(len(l)):
for i in l[r]:
print(r+1, i+1)
|
#!/usr/bin/python3
update_dictionary = __import__('7-update_dictionary').update_dictionary
print_sorted_dictionary = __import__('6-print_sorted_dictionary').print_sorted_dictionary
a_dictionary = { 'language': "C", 'number': 89, 'track': "Low level" }
new_dict = update_dictionary(a_dictionary, 'language', "Python")
pr... |
pumpvalues = [119.480003,119.699997,119.830002,119.900002,119.949997,119.980003,119.989998,120.0,120.0,120.0,120.0,120.010002,120.010002,120.010002,120.010002,120.010002,120.010002,120.010002,120.010002,120.0,119.989998,119.949997,119.900002,119.800003,119.629997,119.360001,118.949997,118.389999,117.68,116.889999,116.... |
config = {
# Fallback default used when a terminal width cannot be inferred.
"display.fallback_width": 88,
# Human-friendly line width for paragraphs.
"display.text_width": 88,
}
|
rooms = {
1 : { 'name' : '1. room', 'description': 'first room', 'completed': False},
2 : { 'name' : '2. room', 'description': 'second room', 'completed': False},
3 : { 'name' : '3. room', 'description': 'third room', 'completed': False}
} |
class Error(Exception):
pass
class ConcreateError(Error):
pass
|
#
# PySNMP MIB module CADANT-HW-MEAS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CADANT-HW-MEAS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:28:20 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... |
# Exercício Python 33: Faça um programa que leia três números e mostre qual é o maior e qual é o menor.
n1 = int(input('Digite o primeiro número: '))
n2 = int(input('Digite o segundo número: '))
n3 = int(input('Digite o terceiro número: '))
maior = menor = n1
# verificando o maior
if n2 > n1 and n2 > n3:
maior = ... |
# -*- coding: UTF-8 -*-
# @yasinkuyu
# TODO
class analyze():
def position():
return 1
@staticmethod
def direction(ticker):
# Todo: Analyze, best price position
hight = float(ticker['hight'])
low = float(ticker['low'])
return False
|
"""
ID: MRNA
Title: Inferring mRNA from Protein
URL: http://rosalind.info/problems/mrna/
"""
# RNA codon table
rna_codon_dict = {
"F": ["UUU", "UUC"],
"L": ["UUA", "UUG", "CUU", "CUC", "CUA", "CUG"],
"S": ["UCU", "UCC", "UCA", "UCG", "AGU", "AGC"],
"Y": ["UAU", "UAC"],
"C": ["UGU", "UGC"],
"W":... |
li = ["entrance"]
sc = ["food", "others", "descry"]
current = li[len(li) - 1]
size = len(li)
while True:
print(current)
choice = input("enter choice")
if choice == "b" and size == 1:
print("LAsT ScReEN")
elif choice == "b" and size > 1:
print(f"your were in {current}")
last = li... |
#Placeholder class for player
class Player(object):
def __init__(self):
self.maxHp = 250
self.hp = self.maxHp
self.maxArk = 1000
self.ark = maxArk |
track_width = 1.4476123429435463
track_original = [(-7.328797578811646, 0.7067412286996826), (-7.174184083938599, 0.9988523125648499),
(-7.014955043792725, 1.2884796857833862), (-6.852129220962524, 1.5760955214500427),
(-6.69096302986145, 1.8646469712257385), (-6.549050569534302, 2.1... |
_base_ = [
'../../../_base_/datasets/two_branch/few_shot_voc.py',
'../../../_base_/schedules/schedule.py', '../../mpsr_r101_fpn.py',
'../../../_base_/default_runtime.py'
]
# classes splits are predefined in FewShotVOCDataset
# FewShotVOCDefaultDataset predefine ann_cfg for model reproducibility.
data = dict... |
# -*- coding: utf-8 -*-
DESC = "trtc-2019-07-22"
INFO = {
"DescribeRealtimeQuality": {
"params": [
{
"name": "StartTime",
"desc": "Query start time in the format of local UNIX timestamp, such as 1588031999s, which is a point in time in the last 24 hours."
},
{
"name": "En... |
"""DSM 6 SYNO.API.Info data with surveillance surppot."""
DSM_6_API_INFO = {
"data": {
"SYNO.API.Auth": {"maxVersion": 6, "minVersion": 1, "path": "auth.cgi"},
"SYNO.API.Encryption": {
"maxVersion": 1,
"minVersion": 1,
"path": "encryption.cgi",
},
... |
class Paras:
COURSE_LABEL_SIZE = None
FINE_2_COURSE = None
IX_a = None
IX_t = None
IX_s = None
IX_a_out = None
IX_p_out = None
@staticmethod
def init():
print("Paras.init started...")
Paras.COURSE_LABEL_SIZE = 6
Paras.FINE_2_COURSE = {}
... |
def find_slowest_time(messages):
simulated_communication_times = {message.sender: message.body['simulated_time'] for message in messages}
slowest_client = max(simulated_communication_times, key=simulated_communication_times.get)
simulated_time = simulated_communication_times[
slowest_client] # simu... |
# Реализуйте функцию is_palindrome, которая принимает на вход слово,
# определяет является ли оно палиндромом и возвращает логическое значение.
# def is_palindrome(string):
# i = 0
# out = True
# while i < len(string) - 1:
# if string[i] != string[-(i+1)]:
# out = False
# b... |
'''
Excited States software: qFit 3.0
Contributors: Saulo H. P. de Oliveira, Gydo van Zundert, and Henry van den Bedem.
Contact: vdbedem@stanford.edu
Copyright (C) 2009-2019 Stanford University
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation f... |
jobs = 1
mid_x = -0.5
mid_y = 0.0
render_width = 2.5
render_height = 2.5
iterations = 256
width = 50
height = 25
output = [0] * (width * height)
def mandelbrot_int(cx, cy):
int_precision = 28
zx = 0
zy = 0
cx = int(cx * (1 << int_precision))
cy = int(cy * (1 << int_precision))
depth... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def get_tensor_shape(t):
return [d for d in t.shape]
def get_tensors_shapes_string(tensors):
res = []
for t in tensors:
res.extend([str(v) for v in get_tensor_shape(t)])
return " ".join(res)
|
__author__ = 'Rahul Gupta'
# Contains relevant constants for running the LDSC pipeline for the Pan Ancestry project.
project_dir = '/Volumes/rahul/Projects/2020_ukb_diverse_pops/Experiments/200501_ldsc_div_pops_pipeline/Data/'
flat_file_location = 'gs://ukb-diverse-pops/sumstats_flat_files/'
bucket = 'rgupta-ldsc'
# ... |
print('i am batman', end='\n')
print('hello world', end='\t\t')
print('this is cool\n', end=' ----- ')
print('i am still here')
|
# -*- coding: utf-8 -*-
"""Top-level package for DjangoCMS Blog plugin."""
__author__ = """Carlos Martinez"""
__email__ = 'me@carlosmart.co'
__version__ = '0.1.2'
|
# Code generated by font_to_py.py.
# Font: Arial.ttf Char set: 0123456789:
# Cmd: ./font_to_py.py Arial.ttf 50 arial_50.py -x -c 0123456789:
version = '0.33'
def height():
return 50
def baseline():
return 49
def max_width():
return 37
def hmap():
return True
def reverse():
return False
def mon... |
def get_divisors(number: int) -> list:
# we only accept positive numbers
assert number >= 1, f'{number} Only positive numbers are allowed'
return [i for i in range(0, number + 1) if i % 2 == 0]
def run():
try:
number = int(input('Enter a number to calculate all divisors: '))
print(get... |
"""Utility functions."""
def node_type(node) -> str:
"""
Get the type of the node.
This is the Python equivalent of the
[`nodeType`](https://github.com/stencila/schema/blob/bd90c808d14136c8489ce8bb945b2bb6085b9356/ts/util/nodeType.ts)
function.
"""
# pylint: disable=R0911
if node is ... |
#
# Copyright 2019 The Project Oak Authors
#
# 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 t... |
#
# Copyright (C) 2018 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
class MissingSessionError(Exception):
"""Excetion raised for when the user tries to access a database session before it is created."""
def __init__(self):
msg = """
No session found! Either you are not currently in a request context,
or you need to manually create a session context by u... |
class _MultiHeadFunc:
"""base mixin for multiheaded losses and metrics"""
def __init__(self, **kwargs):
self._fns = {}
for k, v in kwargs.items():
if not callable(v):
raise TypeError(
f'functions passed to {self.__class__.__name__} must be callabl... |
numero=int(input("Digite um número: "))
antecessor=(numero-1)
sucessor=(numero+1)
print('O número antecessor é: ', antecessor)
print('O número sucessor é: ', sucessor) |
#TRABALHANDO COM STRINGS
#CONTA A QUANTIDADE DE LETRA A NUMA FRASE E INDICA SUAS POSIÇÕES
while True:
frase = input("Digite uma frase: ").strip().upper()
if "SAIR" == frase:
print("saiu", "\n")
break
elif "SAIR" != frase:
print("ANALISANDO FRASE...")
print("A letra A apar... |
__title__ = 'frashfeed-python'
__description__ = 'News feed for Alexa.'
__url__ = 'https://github.com/alexiob/flashfeed-python'
__version__ = '1.0.2'
__author__ = 'Alessandro Iob'
__author_email__ = 'alessandro.iob@gmail.com'
__license__ = 'MIT'
__copyright__ = 'Copyright 2019 Alessandro Iob'
|
class NotAnEffect():
"""
Not an effect (doesn't inherit from AbstractEffect).
"""
def __init__(self) -> None:
pass
def compose(self) -> None:
pass # pragma: no cover
def __repr__(self) -> str:
return "NotAnEffect()" # pragma: no cover
|
"""
radish
~~~~~~
The root from red to green. BDD tooling for Python.
:copyright: (c) 2019 by Timo Furrer <tuxtimo@gmail.com>
:license: MIT, see LICENSE for more details.
"""
|
with open("input.txt", "r") as f:
inp = [int(i) for i in f.readlines()]
# Part 1
n = sum([inp[i] > inp[i-1] for i in range(1, len(inp))])
print("Part 1:", n)
# Part 2
n2 = sum([inp[i] + inp[i+1] + inp[i+2] < inp[i+1] + inp[i+2] + inp[i+3] for i in range(len(inp) - 3)])
print("Part 2:",... |
text_dict = {}
text_2_dict = {}
compare_result = []
f_object = ""
f_text, s_text = "", ""
def set_first_object(obj_no):
global f_object
f_object = obj_no
def joinText(text, obNo=""):
global f_object
global f_text, s_text
if obNo is f_object:
f_text = text
else:
... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
'''
This module contains the base class for our plots that support the
brushing & linking technique.
'''
class BrushableCanvas:
'''
Class to define the basic interface of a drawable area that supports
brushing & linking of its data instances.
'''
def __... |
syntax = r'^\+haunted(?: (?P<locations>.+))?$'
def haunted(caller, locations='here'):
locations = search(locations, kind=db.Room)
if search(caller, within=locations, kind=db.Character, not_within=[caller.character], flags=['dark', '!deaf']).count():
pemit(caller, "You feel some sort of presence.")... |
def rule(event):
# filter events; event type 11 is an actor_user changed user password
return event.get("event_type_id") == 11
def title(event):
return (
f"User [{event.get('actor_user_name', '<UNKNOWN_USER>')}] has exceeded the user"
f" account password change threshold"
)
|
# Copyright 2021 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
print('-=-' * 20)
print('Analisador de Triângulos...')
print('-=-' * 20)
a = float(input('Valor da primeira reta: '))
b = float(input('Valor da segunda reta: '))
c = float(input('Valor da terceira reta: '))
cond1 = (b - c) < a < (b + c)
cond2 = (a - c) < b < (a + c)
cond3 = (a - b) < c < (a + b)
if cond1 and cond2 and ... |
#!/usr/bin/env python
DESCRIPTION = "Conti ransomware api hash with seed 0xE9FF0077"
TYPE = 'unsigned_int'
TEST_1 = 3760887415
def hash(data):
API_buffer = []
i = len(data) >> 3
count = 0
while i != 0:
for index in range(0, 8):
API_buffer.append(data[index + count])
coun... |
class Solution:
def strStr(self, haystack: str, needle: str) -> int:
h_len = len(haystack)
n_len = len(needle)
if (n_len == 0):
return 0
if n_len > h_len:
return -1
n_jump = [0] * n_len
i = 2
i_p = i - 1
s_p = 0
cnt = 0... |
# Time: O(n)
# Space: O(h)
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def getAllElements(self, root1, root2):
"""
:type root1: TreeNode
:type root2... |
# 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 rightSideView(self, root):
if not root:
return []
nodes = [root.val]
... |
"""
Cursor Access Mode.
"""
class CursorAccessMode:
"""
Define thre methods of access of cursors.
"""
Insert = 0
Edit = 1
Del = 2
Browse = 3
|
def plane():
print('Plane')
def car():
print('Car')
def main():
print('-' * 55)
plane()
car()
main()
|
test = {
'name': 'scale-stream',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
scm> (car s2)
2
scm> (car (cdr-stream s2))
4
scm> (car s4)
4
scm> (car (cdr-stream s4))
8
""",
'hidd... |
__author__ = 'shenoisz'
def get_object_list( args ):
csv = open( str( args ) , 'r')
lines = [ ]
for divier in csv.readlines( ):
fatias = divier.replace('\n', '').split('|')
lines.append( fatias )
csv.close( )
return lines
def get_object_dict( args ):
csv = open( str( args ) ,... |
#!/usr/bin/env python
# coding: utf-8
# Copyright (c) 2012, Machinalis S.R.L.
# This file is part of quepy and is distributed under the Modified BSD License.
# You should have received a copy of license in the LICENSE file.
#
# Authors: Rafael Carrascosa <rcarrascosa@machinalis.com>
# Gonzalo Garcia Berrotara... |
'''Some helper functions to support `native-image` invocation within rules.
'''
load("//java:providers/JavaDependencyInfo.bzl", "JavaDependencyInfo")
load("//graalvm:common/extract/toolchain_info.bzl", "extract_graalvm_native_image_toolchain_info")
def _file_to_path(file):
return file.path
# TODO(dwtj): Consider... |
def login(driver,time):
# Asking the user for their private phrase to login to the account
a = 0
while a == 0:
PRIVATE_PHRASE = input("░ What is your BitClout private phrase? (WE DO NOT SAVE THIS): ")
# Fetching BITCLOUT.COM
driver.get("https://bitclout.com/")
# Defining ... |
"""ds4drv is a Sony DualShock 4 userspace driver for Linux."""
__title__ = "ds4drv"
__version__ = "0.5.0"
__author__ = "Christopher Rosell"
__credits__ = ["Christopher Rosell", "George Gibbs", "Lauri Niskanen"]
__license__ = "MIT"
|
# Faça um programa que mostre a tabuada de varios numeros, um de cada vez, para cada valor digitado pelo usuario.
# O programa será interrompido quando o numero solicitado for negativo.
num = int(input('Diga um numero que vc deseja ver a tabuada: '))
while num > 0:
print('-=-' * 12 )
for n in range(1, 11):
... |
"""Print 'Hello world' to the terminal.
Here's where the |foo| substitution is used - it is defined
below.
.. |foo| replace:: Here's where it's defined.
So far so good, but what if the definition is not in the same
docstring fragment - it could be in an included footer?
Here the |bar| substitution definition is mis... |
class Solution(object):
def __init__(self, *args, **kwargs):
self.num = None
self.target = None
def addOperators(self, num, target):
"""
:type num: str
:type target: int
:rtype: List[str]
"""
if num is None or len(num) == 0:
return []... |
#!/usr/bin/env python
# This tests a particular tricky case: the interplay of "black" wrap mode
# with fill color. Outside the s,t [0,1] range, it should be black, NOT
# fill color.
# Make an RGB grid for our test
command += (oiio_app("oiiotool")
+ OIIO_TESTSUITE_IMAGEDIR + "/grid.tif"
+ " ... |
engine_id = ""
grid_node_address = ""
grid_gateway_address = ""
data_dir = ""
dataset_id = ""
|
record = "linux"
cats = [
"cats/linux-kernel.cat"
]
cfgs = [
"cfgs/linux-kernel.cfg"
]
illustrative_tests = [
"tests/MP+relacq.litmus"
]
|
cities = (
("Andaman and Nicobar Islands", (("Port Blair", "Port Blair"),)),
(
"Andhra Pradesh",
(
("Visakhapatnam", "Visakhapatnam"),
("Vijayawada", "Vijayawada"),
("Guntur", "Guntur"),
("Nellore", "Nellore"),
("Kurnool", "Kurnool"),
... |
#Q: Add all the natural numbers below one thousand that are multiples of 3 or 5.
#A: 233168
sum([i for i in xrange(1,1000) if i%3==0 or i%5==0])
|
# -*- coding: utf-8 -*-
# Define here the models for your spider middleware
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/spider-middleware.html
class DianpingCrawlerSpiderMiddleware(object):
def process_request(self, request, spider):
cookies = spider.settings.get('COOKIES', {})
... |
class PLAN_CMDS(object):
FETCH_PLAN = "fetch_plan"
FETCH_PROTOCOL = "fetch_protocol"
class TENSOR_SERIALIZATION(object):
TORCH = "torch"
NUMPY = "numpy"
TF = "tf"
ALL = "all"
class GATEWAY_ENDPOINTS(object):
SEARCH_TAGS = "/search"
SEARCH_MODEL = "/search-model"
SEARCH_ENCRYPTED_... |
FreeMonoBoldOblique12pt7bBitmaps = [
0x1C, 0xF3, 0xCE, 0x38, 0xE7, 0x1C, 0x61, 0x86, 0x00, 0x63, 0x8C, 0x00,
0xE7, 0xE7, 0xE6, 0xC6, 0xC6, 0xC4, 0x84, 0x03, 0x30, 0x19, 0x81, 0xDC,
0x0C, 0xE0, 0x66, 0x1F, 0xFC, 0xFF, 0xE1, 0x98, 0x0C, 0xC0, 0xEE, 0x06,
0x70, 0xFF, 0xCF, 0xFE, 0x1D, 0xC0, 0xCC, 0x06, 0x6... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.