content stringlengths 7 1.05M |
|---|
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license, see LICENSE.
"""
Submodule for useful exceptions
===============================
.. note:: not meant for user code in general, though possible.
"""
# Definition of handy colours for printing
_default = "\x1b[00m"
_green = "\x1b[01;32m"
_red = "\x1... |
class Node:
def __init__(self, data=None):
self.__data=data
self.__next=None
@property
def data(self):
return self.__data
@data.setter
def data(self, data):
self.__data=data
@property
def next(self):
return self.__next
@next.setter
... |
def pkgs_raw(packages):
pkgs_raw_str = ""
for package in packages:
pkgs_raw_str += str(package) + "\n"
print(pkgs_raw_str)
def pkgs_traits(packages, traits_to_print):
pkgs_traits_str = ""
for package in packages:
pkgs_traits_str += "\n"
for trait in traits_to_print:
... |
webgui = Runtime.create("webgui","WebGui")
# if you don't want the browser to
# autostart to homepage
#
# webgui.autoStartBrowser(false)
# set a different port number to listen to
# default is 8888
# webgui.setPort(7777)
# on startup the webgui will look for a "resources"
# directory (may change in the future)
# st... |
# coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# 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 ... |
class Solution:
max_time = 0
def numOfMinutes(self, n: int, headID: int, manager: List[int], informTime: List[int]) -> int:
global max_time
max_time=0
def dfs(adj,node,path_sum):
global max_time
if adj.get(node)==None:
max_time=max(max_time,path_... |
def z_inicial(lista):
cont=0
if len(lista) == 0:
return
else:
for i in range(len(lista)):
if lista[i][0] == "z" or lista[i][0] == "Z":
cont+=1
return cont
lista=input().split()
print(z_inicial(lista))
|
"""
pyexcel_io.constants
~~~~~~~~~~~~~~~~~~~
Constants appeared in pyexcel
:copyright: (c) 2014-2017 by Onni Software Ltd.
:license: New BSD License
"""
# flake8: noqa
DEFAULT_NAME = 'pyexcel'
DEFAULT_SHEET_NAME = '%s_sheet1' % DEFAULT_NAME
MESSAGE_INVALID_PARAMETERS = "Invalid parameters"
MESSAG... |
''' Problem # 3
Write a program that takes the salary and grade from user.
It then adds 50% bonus if the grade is greater tha 15.
It adds 25% bonus if the grade is 15 or less and then it should display the salary
Pseudocode
1. Start
2. Take the salary and grade from the user
3. If the grade is greater than 15
th... |
## 1. Overview ##
f = open("movie_metadata.csv", 'r')
movie_metadata = f.read()
movie_metadata = movie_metadata.split('\n')
movie_data = []
for element in movie_metadata:
row = element.split(',')
movie_data.append(row)
print(movie_data[:5])
## 3. Writing Our Own Functions ##
def first_elts(nested_lists):
... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 Hewlett Packard Enterprise Development LP
#
# 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
#
# Unl... |
#gwang_01.py
j = 0
for i in range (1000):
if (i % 3) == 0 or (i%5) == 0: j+=i
j
|
dp = [0 for i in range(301)];stair = [0 for i in range(301)]
n = int(input())
for i in range(n): stair[i] = int(input())
dp[0] = stair[0];dp[1] = stair[0]+stair[1];dp[2] = max(stair[0]+stair[2],stair[1]+stair[2])
for i in range(3,n): dp[i] = max(dp[i-2]+stair[i],dp[i-3]+stair[i-1]+stair[i])
print(dp[n-1]) |
# Static config for the wms metadata.
response_cfg = {
"Access-Control-Allow-Origin": "*", # CORS header
}
service_cfg = {
## Which web service(s) should be supported by this instance
"wcs": True,
"wms": True,
## Required config for WMS and/or WCS
# Service title - appears e.g. in Terria cat... |
#!/usr/bin/env python3
#
# Advent of Code 2017 - Day 2
#
INPUTFILE = 'input.txt'
def load_input(infile):
lines = []
with open(infile, 'r') as fp:
for line in fp:
line = line.strip()
if line:
lines.append(line)
return lines
def checksum(sheet):
resu... |
'''
Шахматный ферзь ходит по диагонали, горизонтали или вертикали.
Даны две различные клетки шахматной доски, определите,
может ли ферзь попасть с первой клетки на вторую одним ходом.
'''
x1 = int(input())
y1 = int(input())
x2 = int(input())
y2 = int(input())
if x1 == x2 or y1 == y2:
print('YES')
elif (x2 - x1) / (... |
def read_only_properties(*args):
def class_rebuilder(cls):
def __setattr__(self, key, value):
if key in args and key in self.__dict__:
raise AttributeError("Can't modify %s" % key)
else:
super().__setattr__(key, value)
cls.__setattr__ = __seta... |
# Copyright (c) 2013 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.
{
'variables': {
'chromium_code': 1,
},
'targets': [
{
'target_name': 'gfx_geometry',
'type': '<(component)',
'dependenci... |
class Solution(object):
def reformatNumber(self, number):
"""
:type number: str
:rtype: str
"""
number = number.replace('-' ,'').replace(' ', '')
ans = []
for i in range(0, len(number), 3):
ans.append(number[i:i+3])
if len(ans) >= 2 and ... |
class BaseError(Exception):
"""Base package error."""
class InvalidModelInputError(BaseError):
"""Model input contains an error."""
|
#!/usr/bin/env python3
# ex6: String and Text
# Assign the string with 10 replacing the formatting character to variable 'x'
x = "There are %d types of people." % 10
# Assign the string with "binary" to variable 'binary'
binary = "binary"
# Assign the string with "don't" to variable 'do_not'
do_not = "don't"
# Ass... |
class QolsysException(Exception):
pass
class QolsysGwConfigIncomplete(QolsysException):
pass
class QolsysGwConfigError(QolsysException):
pass
class UnableToParseEventException(QolsysException):
pass
class UnknownQolsysControlException(QolsysException):
pass
class UnknownQolsysEventException(Qol... |
## 3. Read the File Into a String ##
f = open("dq_unisex_names.csv", 'r')
names = f.read();
## 4. Convert the String to a List ##
f = open('dq_unisex_names.csv', 'r')
names = f.read()
names_list = names.split('\n')
first_five = names_list[0:5]
print(first_five)
## 5. Convert the List of Strings to a List of Lists ... |
def main():
x_coords = []
x_lines = ["side 1 G", "side 1 5", "side 1 10", "side 1 15", "side 1 20", "side 1 25", "side 1 30", "side 1 35",
"side 1 40", "side 1 45", "50", "side 2 45", "side 2 40", "side 2 35", "side 2 30", "side 2 25",
"side 2 20", "side 2 15", "side 2 10", "si... |
def main():
arr = []
while True:
arr.append(1)
if len(arr) >= 10:
break
return None
if __name__ == "__main__":
main()
|
"""
Shared constants.
Only put things here if they are used in more than one module. Otherwise just define
them in the module where they are used.
"""
EASYCRON_IPS = ["198.27.83.222", "192.99.21.124", "167.114.64.88", "167.114.64.21"]
|
'''
Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), find the minimum number of conference rooms required.
Example 1:
Input: [[0, 30],[5, 10],[15, 20]]
Output: 2
Example 2:
Input: [[7,10],[2,4]]
Output: 1
'''
# Definition for an interval.
# class Interval(o... |
enums = {
'AcpAmplitudeCorrectionType': {
'values': [
{
'documentation': {
'description': ' All the frequency bins in the spectrum are compensated with a single external attenuation value that corresponds to the RF center frequency.'
},
... |
for letra in 'Laiana Nardi':
print(letra)
print("For loop letra!")
for contador in range(2,8):
print(contador)
print("For Loop contador!")
friends = ['John','Terry','Eric','Michael','George']
# for friend in friends:
# print(friend)
for index in range(len(friends)):
print(friends[index])
for friend... |
"""Result class definitions."""
class _WriteResult(object):
"""Base class for write result classes."""
def __init__(self, acknowledged=True):
self.acknowledged = acknowledged # here only to PyMongo compat
class InsertOneResult(_WriteResult):
"""The return type for :meth:`~tinymongo.TinyMongoCo... |
num = int(input())
def ListOfNum(num):
L = []
while num != 0:
x = num%10
num = num//10
L.append(x)
return L
def Multiply(L):
result = 1
for i in L:
result = result *i
return result
L = ListOfNum(num) #L = [2,6,8]
result = 0
while len(L) > 1:
re... |
class Term:
def __init__(self, name, type="constant"):
"""
Args:
value (string):
type (str): ``constant '' or ``variable''
"""
self.name = name
self.type = type
@classmethod
def new_term(cls, name, type="constant"):
return cls(name, ty... |
def average(nums):
"""Find mean of a list of numbers."""
return sum(nums) / len(nums)
def test_average():
"""
>>> test_average()
"""
assert 12.0 == average([3, 6, 9, 12, 15, 18, 21])
assert 20 == average([5, 10, 15, 20, 25, 30, 35])
assert 4.5 == average([1, 2, 3, 4, 5, 6, 7, 8])
if ... |
# -*- coding: utf-8; -*-
#
# @file __init__.py
# @brief module sub-package init.
# @author Frédéric SCHERMA (INRA UMR1095)
# @date 2016-02-03
# @copyright Copyright (c) 2016 INRA
# @license MIT (see LICENSE file)
# @details
AUTH_ANY = 0
AUTH_GUEST = 1
AUTH_USER = 2
AUTH_STAFF = 3
AUTH_SUPER_USER = 4
AUTH_TYPE = (
... |
# -*- coding: utf-8 -*-
'''
File name: code\rooms_of_doom\sol_327.py
Author: Vaidic Joshi
Date created: Oct 20, 2018
Python Version: 3.x
'''
# Solution to Project Euler Problem #327 :: Rooms of Doom
#
# For more information see:
# https://projecteuler.net/problem=327
# Problem Statement
'''
A serie... |
l=[]
fo=open("EnglishWords.txt","r")
st=fo.read()
st=st.split()
for line in st:
if line[0]=='t':
l.append(line)
print(len(l))
|
# Faça um Programa que peça um número e então mostre a mensagem O número informado foi [número].
def chamar_numero(s):
"""Função que pede um número com uma str especifica e retorna o número digitado com uma frase, primeira tentativa
:param s:
:return:
"""
if s == 1:
resultado = (input('Dig... |
"""
@project: parser
@file: node.py
@author: Guillaume Sottas
@date: 05.04.2018
"""
node_to_class = dict()
def a2l_node_type(node_type):
def wrapper(cls):
node_to_class[node_type] = cls
cls._node = node_type
return cls
return wrapper
class A2lNode(object):
__slots__ = '_node', ... |
# -*- coding: utf-8 -*-
# Copyright: (c) 2019-2021, Dell EMC
"""Module for PowerStore constants"""
# HTTP constants
GET = 'GET'
POST = 'POST'
PUT = 'PUT'
DELETE = 'DELETE'
PATCH = 'PATCH'
# Default Connection Timeout in seconds
TIMEOUT = 120.0
# Pagination Constants
# offset is 0 and limit is 99 for first request
#... |
# Faça um algoritmo em Python que leia dois valores inteiros A e B se os valores forem iguais deverá se somar os dois, caso contrário multiplique A por B. Ao final de qualquer um dos cálculos deve-se atribuir o resultado para uma variável C e mostrar seu conteúdo na tela.
A = int(input("Digite o valor de A: "))
B = i... |
#!/usr/bin/python3
#-- Use pprint module..
x=[[1,2,3,4],[11,22,33,44],[111,222,333,444]]
#-- Use printf style formatting..
x = 22/7
#-- Write some multivariate for loops..
for x,y in [[1,2]]:
print('x',x,'y',y)
for x in enumerate(range(5)):
print('x',x)
#-- Compute diagonal sums with lambdas..
m=[
[ 5,... |
def e_letra(a):
return a in 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTUuVvWwXxYyZz'
def main():
a = str(input("Digite uma consoante ou vogal: "))
resultado = e_letra(a)
print(f'{a} é faz parte do alfabeto? {resultado} ')
if __name__ == '__main__':
main() |
# -*- coding: utf-8 -*-
class ExampleLibraryException(Exception):
'''It is a good practice to throw library specific exceptions so
that you know where the exception is comming'''
pass
class ExampleLibrary(object):
'''Libraries should be documented according to Robot Framework User Guide'''
def li... |
def getNumericVal(number):
if number == 1:
return 3
elif number == 2:
return 3
elif number == 3:
return 5
elif number == 4:
return 4
elif number == 5:
return 4
elif number == 6:
return 3
elif number == 7:
return 5
elif number... |
class BaseError(Exception):
pass
class RecordNotFound(BaseError):
pass
|
# liczby Fibonacciego
def fibRek(n):
if n == 0 or n == 1:
return n
else:
return fibRek(n-1) + fibRek(n-2)
def fib(n):
"""Wypisuje liczby Fibonacciego mniejsze niz n
"""
a, b = 0, 1
while b < n:
print (b)
a, b = b, a+b
def fib2(n):
"""Zwraca liste liczb F... |
"""
Copyright 2018 abbas ehsanfar
"""
"""
genfigs: generate figures
""" |
## Para operações de saída, o CST deve ser preenchido com os valores de 01 a 49 ou 99.
##
##
def exec(conexao):
cursor = conexao.cursor()
print("RULE 08 - Inicializando",end=' ')
update = " UPDATE principal SET "
update = update + " r2 = \"49\" "
update = update + " WHERE 1=1 "
update = up... |
class ArmatureActuator:
bone = None
constraint = None
influence = None
mode = None
secondary_target = None
target = None
weight = None
|
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def mergeTwoLists(self, list1: Optional[ListNode], list2: Optional[ListNode]) -> Optional[ListNode]:
cur = dummy = ListNode()
while l... |
file_name = "nameslist.txt"
names_list = open(file_name, "rt").read().splitlines(False)
print(names_list)
names_count = {}
for name in names_list:
if name not in names_count:
names_count[name] = 0
names_count[name] += 1
print(names_count) |
n, d = map(int,input().split())
l=[]
for i in range(n):
l1=list(map(int,input().split()))
l.append(l1)
l=sorted(l)
i, j, ans, s = 0, 0, 0, 0
while j<n:
if l[i][0]+d > l[j][0]:
s+=l[j][1]
j+=1
else:
s-=l[i][1]
i+=1
ans=max(ans,s)
print(ans) |
class Atom:
def __init__(self):
pass
def __repr__(self):
raise NotImplementedError()
class Tmp(Atom):
__slots__ = ['tmp_idx']
def __init__(self, tmp_idx):
super(Tmp, self).__init__()
self.tmp_idx = tmp_idx
def __repr__(self):
return "<Tmp %d>" % self.tmp... |
'''Elabore um programa que calcule o valor a ser pago por um produto,
considerando o seu preço normal e condição de pagamento:
– à vista dinheiro/cheque: 10% de desconto
– à vista no cartão: 5% de desconto
– em até 2x no cartão: preço formal
– 3x ou mais no cartão: 20% de juros'''
print("{:=^40}".format(" LOJAS GUANABA... |
# Utilities and color maps for plotting
# Colours from https://s-rip.ees.hokudai.ac.jp/mediawiki/index.php/Notes_for_Authors
reanalysis_color = {
'MERRA2' :'#e21f26',
'MERRA' :'#f69999',
'ERAI' :'#295f8a',
'ERA5' :'#5f98c6',
'ERA40' :'#afcbe3',
'JRA55' :'#723b7a',
'JRA55C' :'#... |
# maximum_subarray_sum.py
# https://www.codewars.com/kata/54521e9ec8e60bc4de000d6c
def max_sequence(arr):
if len(arr) == 0:
return 0
all_elements_negative = True
for item in arr:
if item > 0:
all_elements_negative = False
break
if all_elements_negative:
... |
"""
PASSENGERS
"""
numPassengers = 22944
passenger_arriving = (
(5, 6, 5, 9, 4, 1, 2, 3, 2, 1, 1, 1, 0, 7, 6, 8, 4, 8, 2, 3, 1, 0, 1, 1, 1, 0), # 0
(7, 6, 3, 10, 7, 1, 1, 1, 6, 1, 2, 1, 0, 3, 5, 7, 7, 5, 4, 5, 0, 2, 2, 0, 1, 0), # 1
(5, 3, 10, 5, 3, 3, 4, 2, 1, 1, 1, 1, 0, 9, 9, 4, 3, 5, 2, 4, 2, 4, 1, 1, 0, 0)... |
distancia = float(input('Qual é a distância da sua viagem? '))
print('Você está prestes a começar uma viagem de {} Km.'.format(distancia))
preco = distancia * 0.50 if distancia <= 200 else distancia * 0.45
print('E o preço da sua passagem será de R$ {:.2f}.'.format(preco))
|
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... |
x = int(input())
y = float(input())
gasto = x / y
print('{:.3f} km/l'.format(gasto))
|
# Created by MechAviv
# ID :: [931050000]
# Hidden Street : Extraction Room 1
sm.curNodeEventEnd(True)
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(True, True, False, False)
sm.setStandAloneMode(True)
def failMessage(crack):
sm.chatScript("Tap the Control Key repeatedly to break the wall.")
sm.showEffec... |
class HTTPError(Exception):
pass
class VersionSpecificationError(Exception):
pass
|
"""文字列基礎
数値文字関連の判定メソッド
isdecimal, isdigit, isnumericの結果の違い
[説明ページ]
https://tech.nkhn37.net/python-isxxxxx/#isdecimalisdigitisnumeric
"""
print("--- 半角数字('12345')")
print('12345'.isdecimal())
print('12345'.isdigit())
print('12345'.isnumeric())
print("--- 上付き数字、下付き数字('⁰₀')")
print('⁰₀'.isdecimal())
print('⁰₀'.isdigit())... |
# -*- coding: utf-8 -*-
'''
Splunk User State Module
.. versionadded:: 2016.3.0.
This state is used to ensure presence of users in splunk.
.. code-block:: yaml
ensure example test user 1:
splunk.present:
- name: 'Example TestUser1'
- email: example@domain.com
'''
def __virtual_... |
#!/usr/bin/env python
#fn: copy.py
# write specifi contents of alignment_py.py to blast_py.py
INPUT = open('alignment_py.py','r')
OUTPUT = open('blast_py.py','a')
lnum = 0
for line in INPUT:
lnum += 1
line = line.strip('\n')
if lnum > 6 and lnum < 138:
OUTPUT.write(line+'\n')
|
# ============================================================================
# 第三章 暖冷房負荷と外皮性能
# 第三節 熱貫流率及び線熱貫流率
# Ver.17(住宅・住戸の外皮性能の計算プログラム Ver.3.0.0~)
# ============================================================================
## 外皮の詳細計算
### 1 概要
"""
主に、
3章2節8.1 外皮平均熱貫流率(section3_2_8.py>calc_U_A)……①
3章2節8.2 暖房期の... |
"""WebSocket message class"""
class WebSocketMessage:
"""A class representing a WS message"""
# pylint: disable=redefined-builtin,invalid-name
__slots__ = ["type", "id", "data", "reply"]
def __init__(self, data: dict) -> None:
self.type = data["type"]
self.id = data.get("id")
... |
__author__ = 'sanyi'
class IpsetError(Exception):
pass
class IpsetNotFound(Exception):
pass
class IpsetNoRights(Exception):
pass
class IpsetInvalidResponse(Exception):
pass
class IpsetCommandHangs(Exception):
pass
class IpsetSetNotFound(Exception):
pass
class IpsetEntryNotFound(Exc... |
# MODFLOW 6 version file automatically created using...make_release.py
# created on...February 18, 2021 08:23:34
major = 6
minor = 2
micro = 1
__version__ = '{:d}.{:d}.{:d}'.format(major, minor, micro)
|
def getFuel(data):
return [int(s) for s in data.split("\n")]
def fuelbois(n):
return (n // 3) - 2
def part1(data):
return sum(map(fuelbois, getFuel(data)))
def part2(data):
return sum(map(doTheThing, getFuel(data)))
def doTheThing(n):
s = fuelbois(n)
if s <= 0:
return 0
retur... |
class Sidelink:
def __init__(self, name, link, subtitle, http=False, css_classes='sidelink', onclick=''):
self.name = name
self.link = link
self.subtitle = subtitle
self.http = http
self.css_classes = css_classes
self.onclick = onclick
cl... |
class InvalidNoteException(Exception):
pass
class InvalidModeException(Exception):
pass
class InvalidChord(Exception):
pass
|
# Middlewares
# https://docs.djangoproject.com/en/3.0/topics/http/middleware/
MIDDLEWARE = [
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middle... |
# Copyright (c) 2016 EMC Corporation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
#-------------------------------------------------------------------------------
# Name: Signals types (voltage and current)
# Author: d.Fathi
# Created: 31/03/2020
# Modified: 19/09/2021
# Copyright: (c) PyAMS 2020
# Licence: unlicense
#--------------------------------------------------... |
# @Title: 整数转罗马数字 (Integer to Roman)
# @Author: KivenC
# @Date: 2019-01-24 15:32:34
# @Runtime: 144 ms
# @Memory: 6.9 MB
class Solution:
def intToRoman(self, num):
"""
:type num: int
:rtype: str
"""
ans = ''
vals = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4,... |
# Replaced with the current commit when building the wheels.
__commit__ = "{{CLOUDTIK_COMMIT_SHA}}"
__version__ = "0.9.0"
|
"""
Iniciar com letras maiusculas os nomes das variáveis
"""
nome = 'Francenylson' # nunca 1nome=
idade = 50
#idade = 32 #fica implícito que é um int
e_maior = idade > 18
altura = 1.85
peso = 93
imc = (peso/(altura*2))
print(nome, 'tem', idade, 'anos de idade e seu imc é', imc)
|
def configure(conf):
conf.env.ARCHITECTURE = 'mips'
conf.env.VALID_ARCHITECTURES = ['mips']
conf.env.ARCH_FAMILY = 'mips'
conf.env.ARCH_LP64 = False
conf.env.append_unique('DEFINES', ['_MIPS'])
|
# -*- coding: utf-8 -*-
# Copyright 2019 Cohesity Inc.
class SQLServerInstanceVersion(object):
"""Implementation of the 'SQLServerInstanceVersion' model.
Specifies the Server Instance Version.
Attributes:
build (int): Specfies the build.
major_version (int): Specfies the major version.
... |
class DataGridViewCellStyleConverter(TypeConverter):
"""
Converts System.Windows.Forms.DataGridViewCellStyle objects to and from other data types.
DataGridViewCellStyleConverter()
"""
def CanConvertTo(self,*__args):
"""
CanConvertTo(self: DataGridViewCellStyleConverter,context: ITypeDescriptorConte... |
s=[1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,... |
# encoding: utf-8
# module perfmon
# from C:\Python27\lib\site-packages\win32\perfmon.pyd
# by generator 1.147
# no doc
# no imports
# functions
def CounterDefinition(*args, **kwargs): # real signature unknown
pass
def LoadPerfCounterTextStrings(*args, **kwargs): # real signature unknown
pass
def ObjectType... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
# Copyright (C) David Arnold (XOE Solutions).
# Author David Arnold (XOE Solutions), dar@xoe.solutions
# Co-Authors Juan Pablo Aries (devCO), jpa@devco.co
# Hector Ivan Valencia Muñoz (TIX SAS)
# ... |
temperatura_celsus = 0
def convert_celsus(temperatura_celsus):
celsus = ((temperatura_celsus - 32) / 1.8)
return celsus
print(convert_celsus(100))
|
class AsyncIterWrapper:
"""Async wrapper for sync iterables
Copied from aitertools package.
"""
def __init__(self, iterable):
self._it = iter(iterable)
def __aiter__(self):
return self
async def __anext__(self):
try:
return next(self._it)
except S... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def hasCycle(self, head: Optional[ListNode]) -> bool:
## without using any set
## Floyd's Tortoise and Hare method
## https://www.yo... |
#question 2
#generate the series
#3 8 14 22 34 53 83 129 197 294
print("Enter the lenght of the series:")
seriesLength =int(input())
s1,s2,s3 = 1,5,3
gen_series = []
for itr in range(1,seriesLength):
gen_series.append(s3)
s3 += s2
s2 += s1
s1 += itr
result = (str(gen_series).replace(',','... |
my_name = "Juan Manuel Young Hoyos"
print(my_name[0])
# * Both of them are equal
print(my_name[0:3])
print(my_name[:3])
# * Both of them are equal
print(my_name[1:len(my_name)])
print(my_name[1:])
# * Slicing with steps
print(my_name[1:len(my_name):2])
# * It brings me everything
print(my_name[::])
|
settlement = "ISHUV"
street1="REHOV1"
street2="REHOV2"
road1="KVISH1"
road2="KVISH2"
junction_name = "SHEM_ZOMET"
settlement_sign = "SEMEL_YISHUV"
street_sign = "SEMEL_RECHOV"
street_name = "SHEM_RECHOV"
table_number = "MS_TAVLA"
code = "KOD"
name = "NAME"
sign = "SEMEL"
urban_intersection="ZOMET_IRONI"
non_urban_inter... |
'''
Class that maps to the JSON TokenInfo
'''
class MTTokenInfo():
v = None
code = None
code_desc = None
token_id = None
timestamp_sec = None
timestamp_iso = None
hostname = None
is_dev_host = None
action = None
ip = None
def __init__(self, v: str, code: int, codeDesc: st... |
"""
Extrusion.
Converts a flat image into spatial data points and rotates the points
around the center.
"""
a = None
onetime = True
aPixels = None
values = None
angle = 0
def setup():
size(640, 360, P3D)
aPixels = [[0] * width for i in range(height)]
values = [[0] * width for i in range(height)]
noF... |
test = {
'name': 'Problem 11',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
scm> (define (square x) (* x x))
square
scm> square
(lambda (x) (* x x))
scm> (square 21)
441
scm> square ; check to make sure lambd... |
class Solution:
def twoSum(self, numbers: List[int], target: int) -> List[int]:
# O(N)
for idx, t in enumerate(numbers):
targ = target - t
# O(logN)
left, right = 0, len(numbers) - 1
ans = []
while left <= right:
mid = left... |
class Sorter:
def __init__(self, group):
self.group = group
self.found = False
def __call__(self, x):
if x in self.group:
self.found = True
return (0, x)
return (1, x)
|
## Exceptions
__all__ = ['PyDSTool_Error', 'PyDSTool_BoundsError', 'PyDSTool_KeyError',
'PyDSTool_UncertainValueError', 'PyDSTool_TypeError',
'PyDSTool_ExistError', 'PyDSTool_AttributeError',
'PyDSTool_ValueError', 'PyDSTool_UndefinedError',
'PyDSTool_InitError', 'PyDS... |
def modpower(x,y,mod):
ans = 1
x = x % mod
while y:
if ((y & 1) == 1) :
ans = (ans * x) % mod
y = y >> 1
x = (x * x) % mod
return ans
T=int(input())
for tt in range(1,T+1):
N,K=[int(x) for x in input().split()]
S=input()
copyS=list(S)
total=0
M... |
load("@build_bazel_rules_apple//apple/bundling:entitlements.bzl",
entitlements_rule="entitlements")
load(
"@build_bazel_rules_apple//apple/bundling:entitlements.bzl",
"AppleEntitlementsInfo",
)
def _entitlements_writer_impl(ctx):
entitlement_info = ctx.attr.entitlements[AppleEntitlementsInfo]
out... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# Copyright 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... |
"""A base presenter for common properties needed when rendering annotations."""
class AnnotationBasePresenter:
def __init__(self, annotation):
self.annotation = annotation
@property
def target(self):
target = {"source": self.annotation.target_uri}
if self.annotation.target_selecto... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.