content stringlengths 7 1.05M |
|---|
#!/usr/bin/env python3
# 7.1 Interconvert Strings and Integers
# Implement the atoi and itoa functions.
def atoi(s):
sum = 0
for c in s:
ordc = ord(c)
if 0x30 <= ordc <= 0x39:
n = ordc - 0x30
sum = (sum * 10) + n
if sum > 0 and s[0] == '-':
sum *= -1
... |
class DragoneyeException(Exception):
def __init__(self, message, error: str = None):
super().__init__(message)
self.error: str = error
|
pkgname = "bsdpatch"
pkgver = "0.99.1"
pkgrel = 0
build_style = "makefile"
pkgdesc = "FreeBSD patch(1) utility"
maintainer = "q66 <q66@chimera-linux.org>"
license = "BSD-2-Clause"
url = "https://github.com/chimera-linux/bsdpatch"
source = f"https://github.com/chimera-linux/bsdpatch/archive/refs/tags/v{pkgver}.tar.gz"
s... |
""" Renderers for the template engine. """
__author__ = "Brian Allen Vanderburg II"
__copyright__ = "Copyright 2016"
__license__ = "Apache License 2.0"
class Renderer:
""" A renderer takes content and renders it in some fashion. """
def __init__(self):
""" Initialize the renderer. """
pass
... |
"""This module manages the users"""
USERS = {}
class User(object):
"""This class manages the app users"""
def __init__(self, email=None, username=None, password=None):
"""Creates and instance of a user"""
self.email = email
self.username = username
self.password = password
... |
class TestFlow:
def __init__(self, perceive, act, observe):
self.perceive = perceive
self.act = act
self.observe = observe
def __str__(self):
output = ""
if self.perceive and len(self.perceive) > 0:
output += str(self.perceive)
if self.act and len(s... |
objname = ""
subobj = 0
faces = 0
with open("model.obj",'r') as openfileobject:
lines = 0
for line in openfileobject:
lines = lines+1
if 'f' in line:
faces = faces+1
if 'o' in line:
subobj = 0
faces = 0
name = line.strip()
name = name.strip('o')
objname = name
#print(name)
if 'usemtl' i... |
INSTALLED_APPS = ["athanor_job"]
GLOBAL_SCRIPTS = dict()
GLOBAL_SCRIPTS['job'] = {
'typeclass': 'athanor_job.controllers.AthanorJobManager',
'repeats': -1, 'interval': 60, 'desc': 'Job API for Job System',
'locks': "admin:perm(Admin)",
}
|
def fatorial(num, show=False):
"""
:param num: O número a ser calculado o fatorial
:param show: (opcional) Mostrar ou não a conta
:return: Retorna o valor de um fatorial de um número
"""
resul = 1
print('-' * 30)
for c in range(1, num + 1):
resul *= c
if show:
for c i... |
def convertTimeToReqStr(timeObj):
dateStr = timeObj.strftime('%d/%m/%Y')
timeStr = "{0}/{1}:{2}:00".format(dateStr, makeTwoDigits(
timeObj.hour), makeTwoDigits(timeObj.minute))
return timeStr
def makeTwoDigits(num):
if(num < 10):
return "0"+str(num)
return num
|
class ChannelNotFoundException(Exception):
""" This exception is raised if a channel isn't found """
pass
class OperationNotSupportedException(Exception):
""" This exception is raised if an operation isn't supported on an object/function for a parameter type """
pass
class FileSystemError(OperationNotSupportedE... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def deleteDuplicates(self, head: ListNode) -> ListNode:
pointer = head
while pointer and pointer.next:
if pointer.val == ... |
# -*- coding: utf-8 -*-
'''
Author: Hannibal
Data:
Desc: local data config
NOTE: Don't modify this file, it's build by xml-to-python!!!
'''
buffinfo_map = {};
buffinfo_map[1] = {"id":1,"aid":30003,"icon":0,};
buffinfo_map[201] = {"id":201,"aid":30001,"icon":201,};
buffinfo_map[202] = {"id":202,"aid":30002,"icon":20... |
'''
Reverse bits of a given 32 bits unsigned integer.
For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 00111001011110000010100101000000).
Follow up:
If this function is called many times, how would you optimize it?
'''
... |
def area(larg, comp):
area = larg * comp
print(f'A área de um terreno {larg}x{comp} é de {area}m2.')
# Programa principal
print(' Controle de Terrenos')
print('-' *30)
l = float(input('LARGURA (m): '))
c = float(input('COMPRIMENTO (m): '))
area(l, c)
|
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 19 14:17:26 2021
@author: user24
"""
colors = ['red', 'blue', 'green', 'yellow']
colors_iter = iter(colors)
print(type(colors_iter))
print(next(colors_iter))
print(next(colors_iter))
print(next(colors_iter))
print(next(colors_iter))
print(next(colors_it... |
def dict2keys(d=dict()): return sorted(d.keys())
def dict2kvpairs(d=dict(), d2k=dict2keys): return map(lambda k: (k, d[k]), d2k(d))
def dict2str(d=dict(), s1=":", s2=";", d2k=dict2keys): return s2.join(
map(
lambda t: s1.join(map(str, t)),
dict2kvpairs(d, d2k)
)
)
def dict2csv(d=dict(), c=",", d2k=dict2k... |
X = int(input())
Y = float(input())
consumo = X / Y
print("%.3f km/l" %consumo)
|
valor = float(input("Digite o valor do premio:"))
imposto = valor- 7/100
valornovo = valor - imposto
primeiro= valornovo * 46/100
segundo = valornovo * 32/100
terceiro = valornovo - (primeiro + segundo)
print("o Premio foi de r$ {}, o valor desconto ficou R$ {} o imposto ficou R$ {}".format(valor, valornovo, imposto))
... |
def binary_search(a, target):
"""Your code goes here."""
first = 0
last = len(a)-1
while (first<=last):
i = (first+last)/2
if a[i]==target:
return i
elif a[i]<target:
first = i+1
else:
last = i -1
return -1 |
pkgname = "libnma"
pkgver = "1.8.38"
pkgrel = 0
build_style = "meson"
configure_args = [
"-Dgtk_doc=false", "-Dlibnma_gtk4=true",
]
hostmakedepends = [
"meson", "pkgconf", "gobject-introspection", "vala", "glib-devel",
"gettext-tiny",
]
makedepends = [
"networkmanager-devel", "gcr-devel", "gtk+3-devel",... |
class Settings():
def __init__(self):
self.screen_width = 800
self.screen_height = 500
self.bg_color = (29, 17, 53)
self.ship_speed_factor = 1.5
|
class Solution:
def solve(self, nums, k):
pq = []
for num in nums:
heappush(pq,-num)
for i in range(k):
num = heappop(pq)
heappush(pq,num+1)
return -pq[0]
|
# Copyright 2014 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': 'win_window',
'type': '<(component)',
'dependencies': [
'../... |
class IWebProxy:
""" Provides the base interface for implementation of proxy access for the System.Net.WebRequest class. """
def GetProxy(self, destination):
"""
GetProxy(self: IWebProxy,destination: Uri) -> Uri
Returns the URI of a proxy.
destination: A System.Uri that s... |
def wage_increase(group):
'''
Calculates a new wage given a 10% increase for each element in a list and return
a list of containing the new salaries and a list of the raise increases
Parameters
----------
group : list
a list containing a group of people's wages
Returns
... |
class Solution:
def solve(self, blocks):
dp = defaultdict(int)
for a,b in blocks:
dp[b] = max(dp[b], dp[a]+1)
return max(dp.values(),default=0)
|
class GenericRequest(object):
# object represnting the generic request, do not use directly (unless on errors)!
# either use the EndpointRequest subclass for request invloving endpoint data or the DiscoveryRequest subclass for discovery requests
# do not use error responses for discovery requests, either return a... |
__all__ = ['MalformedFileError', 'MalformedCaptionError', 'InvalidCaptionsError', 'MissingFilenameError']
class MalformedFileError(Exception):
"""Error raised when the file is not well formatted"""
class MalformedCaptionError(Exception):
"""Error raised when a caption is not well formatted"""
... |
"""MicroPython tool: abstract connector"""
class ConnError(Exception):
"""General connection error"""
class Timeout(ConnError):
"""Timeout"""
class Conn():
def __init__(self, log=None):
self._log = log
@property
def fd(self):
"""Return file descriptor
"""
retur... |
# https://leetcode.com/problems/find-peak-element/
class Solution:
def findPeakElement(self, nums: List[int]) -> int:
#use binary search to find peak element
def bin_search(nums, left, right):
if left == right:
return left
... |
# Databricks notebook source
MDPSXIUUIQYSSW
VRVXHMDRNPKGDKNMLPZZRZMBPZYSWPUYULCTFVAFAOYCHIOLJLKDATHTIAHBGKLANOGGVIKKOYUIDZGKZARPBYIKTWWIVQVXOZKILOMZSUVXRZJNETULRTGWKJTNSIELVVOIWLCRXJMKALJKJOKRJHPKFGXCQDBPYDNBDJRUCCELIHMEWEZIVOZJZOPMUKKUPCMIBYNMRRZMVCJNNWATBBNKWMGRLRIBTZMDDBCBXLDCJBVNPBOVRXUXDQQKYRECIIGEEROPJSYLCLBRTWHD... |
"""
定义函数,根据员工编号,删除员工信息,返回是否删除成功
"""
class Employee:
def __init__(self, eid, did, name, money):
self.eid = eid
self.did = did
self.name = name
self.money = money
def __eq__(self, other):
return self.eid == other
# 员工列表
list_employees = [
Employee(1001, 9002, ... |
wavelet_type = 'dmey'
reconstr_points = 50
model = dict(type='WLNet',
backbone=dict(type='mmdet.ResNet',
depth=50,
num_stages=4,
out_indices=(1, 2, 3),
frozen_stages=-1,
n... |
#100以内加法
num=1
sum=0
while num<=100 :
sum+=num
num+=1
print(sum)
print("="*50)
#1000以内回文数
i=1
while i<1000 :
if i<10 :
print(i)
if i>10 and i<=99 :
if i%11==0:
print(i)
if i>100 and i<999 :
j=i // 100
k=i % 10
if j==k:
print(i)
i... |
def quick_sort(arr):
#base case
if(len(arr) < 2):
return arr
pivot = arr[0]
less = [i for i in arr[1:] if i < pivot]
greater = [i for i in arr[1:] if i >= pivot]
return quick_sort(less) + [pivot] + quick_sort(greater)
test_list = [44, 2056, 2, 2, 41, 109, 33, 32, 22, 67]
result = quick_sort(test_list)
print(re... |
def Linear_Search(lst, x):
i = 0
n = len(lst)
while(i < n):
if lst[i] == x:
return i
i += 1
return -1
while True:
lst = [1,2,3,4,5,6,7,89,90,67,45,34]
x = int(input())
index = Linear_Search(lst, x)
print(index)
if index == -1:
print("Not Found")
else:
print("Found in ", index)
'''
......F... |
x = 1
print(x)
x = x+1
print(x)
x = 1
x += (x+1) #x = x + (x+1)
print(x)
x=2
for i in range(10):
x*=2
print(x) |
T =int(input()) #number of tests case
if T in range (0,21):
for _ in range(T):
num_a = input() #number of elements' A set
A = set(input().split())
num_b = input()
B = set(input().split()) #number of elements' B set
if len(A)>0 and len(A)<1001:
if len(B) > 0 and le... |
"""
File: __init__.py
Description:
Primary Author(s): Michael Clawar
Secondary Author(s):
Notes:
January 14, 2017
StratoDem Analytics, LLC
"""
|
number = 1 + 2 * 3 / 4.0
print(number)
remainder = 11 % 3
print(remainder)
squared = 7 ** 2
cubed = 2 ** 3
print(squared)
print(cubed)
helloworld = "hello" + " " + "world"
print(helloworld)
lotsofhellos = "hello" * 10
print(lotsofhellos)
even_numbers = [2,4,6,8]
odd_numbers = [1,3,5,7]
all_numbers = odd_numbers + ... |
#!/usr/bin/env python3
ballot = {}
# TODO: Complete the "voting algorithm" to
# 1. Accept inputs one and a time, either:
# a. Incrementing candidate's vote count by 1 in ballot
# b. Setting the candidate's vote count to 1 in ballot for the first vote
# 2. Stop accepting inpus if the N ch... |
class StageDisplay:
def __init__(self, index, name, is_current_display=False, client=None):
self.index = index
self.name = name
self.is_current_display = is_current_display
self.client = client
def send_message(self, message):
if self.client:
command = {
... |
# Ветвление в Python
# 1 Фишки ветвления
# 1.1 Проверка числа на чётность
number = 0
if number % 2 == 0:
print( f"Число {number} чётное" )
else:
print( f"Число {number} нечётное" )
# 1.2 Сравнение двух чисел
number1 = 10
number2 = 20
if number1 > number2:
print( f"Число {number1} больше числа {number2}" )
el... |
# Copyright Pincer 2021-Present
# Full MIT License can be found in `LICENSE` at the project root.
"""
sent when the user clicks a Rich Presence spectate invite in chat to
spectate a game
"""
# TODO: Implement event
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Type-transformation rules.
"""
__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
__copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnocz... |
def solution(n):
answer = []
flag = True
while flag:
if n // 10 == 0:
answer.append(n % 10)
flag = False
else:
r = n % 10
d = n // 10
n = d
answer.append(r)
return answer
print(solution(12345)) |
'''
modifier: 03
eqtime: 10
'''
def main():
info("Jan Cocktail Pipette x1")
gosub('jan:WaitForMiniboneAccess')
gosub('jan:PrepareForAirShot')
open(name="Q", description="Quad Inlet")
gosub('jan:EvacPipette1')
gosub('common:FillPipette1')
gosub('jan:PrepareForAirShotExpansion')
gosub('co... |
# Question 03, Lab 04
# AB Satyaprakash - 180123062
# imports ----------------------------------------------------------------------------
# functions --------------------------------------------------------------------------
def f(t):
return 1/(10*(t**2)-2*t+1)
def compositeTrapezoidalRule(X):
sum = 0
... |
d=int(input())
if d==61:
print("Brasilia")
elif d==71:
print("Salvador")
elif d==11:
print("Sao Paulo")
elif d==21:
print(" Rio de Janeiro")
elif d==32:
print(" Juiz de Fora")
elif d==19:
print("Campinas")
elif d==27:
print("Vitoria")
elif d==31:
print("Belo Horizonte")
else:
... |
class ConfigException(Exception):
def __init__(self, text, trace=None):
super().__init__(text)
self.text = text
self.trace = trace
class InvalidValueException(ConfigException):
pass
class EnvironmentVarMissingException(ConfigException):
pass
class RequiredVarMissingException(ConfigException):
... |
#Um programa que o usuário informe a Km percorrida e a quantidade de litros abastecidas, o sistema informe o consumo do veículo.
km = int(input("Digite a km percorrida"))
L = int(input("Digite a quantidade litros abastecidas"))
C=km/L
print ("Consumo do veículo é", C, "L","por km")
|
class Fiwz:
def __init__(self):
self.name = 'Worawut'
self.lastname = 'Tunsukee'
self.nickname = 'Fiw'
def WhoIAm(self):
'''
This is a function show the name.
'''
print('My name is : {}'.format(self.name))
print('My lastname is ... |
'''
On an infinite plane, a robot initially stands at (0, 0) and faces north. The robot can receive one of three instructions:
"G": go straight 1 unit;
"L": turn 90 degrees to the left;
"R": turn 90 degress to the right.
The robot performs the instructions given in order, and repeats them forever.
Return true if and... |
# Internet Archive
# https://archive.org/services/docs/api/index.html
# https://archive.org/account/s3.php
# Used for mirroring uploaded files to the Internet Archive.
IA_ACCESS = ""
IA_SECRET = ""
# Patreon
# Beta site credentials are displayed on user profiles for Patrons
# Password values are used for non-logged in... |
GRANTS = """
SELECT cognition.createrole('tenant_admins', NULL, NULL);
GRANT USAGE ON SCHEMA cognition TO tenant_admins;
GRANT SELECT, INSERT, DELETE, UPDATE ON TABLE cognition.users TO tenant_admins;
GRANT SELECT, UPDATE (displayname) ON TABLE cognition.tenants to tenant_admins;
SELECT cognition.c... |
arr = [6, 54, 5, 125, 222, 113, 0]
def insertionSort(arr):
# Traverse through 1 to len(arr)
for x in range(1, len(arr)):
key = arr[x]
j = x-1
while j >= 0 and key < arr[j] :
arr[j + 1] = arr[j]
j -= 1
arr[j + 1] = key
inse... |
def get_package_data():
return {
_ASTROPY_PACKAGE_NAME_ + '.tests': ['coveragerc', 'data/*'],
_ASTROPY_PACKAGE_NAME_ + '.interpolation.tests': ['reference/*']
}
|
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class PyInferenceSchema(Package):
"""This package is intended to provide a uniform schema for common machine
lear... |
def find_min() -> int:
# Insert your code here
# Thêm phần code tại đây để hoàn thành bài tập
return -1
# Do not change the code lines below
def main():
print('Input values:')
print('\nOutput:',find_min())
if __name__ == "__main__":
main()
|
"""bellman_value_iteration.py: Performs and prints Bellman Value Iteration on an MDP up to a certain depth."""
def printBoard(board):
"""Print a formatted board to console."""
for i in board:
print("[", end="")
for j in i:
print("{:5.2f}".format(j), end=",")
print("]")
... |
# the model gets created
# in this file specific layers can be defined and changed
# the default data contains 40 x 1200 x 3 data as defined by the input dataformat
# if the data for test and validation is change the first layer format can change
# model contains a sequential keras model that can be applied with differ... |
size_set = int(input())
set0 = set(map(int, input().split()))
iteration_number = int(input())
for i in range(iteration_number):
set1 = input().split()
if set1[0] == "pop":
set0.pop()
elif set1[0] == "remove":
set0.remove(int(set1[1]))
elif set1[0] == "discard":
set0.d... |
class School(object):
def __init__(self):
self.school_roster = {}
def add_student(self, name, grade):
if self.school_roster.get(grade):
self.school_roster[grade].append(name)
else:
self.school_roster[grade] = [name]
def roster(self):
students = []
... |
class A:
def __init__(self, content):
self._content = content
@property
def content(self):
if not hasattr(self, '_content'):
return "content not exists"
return self._content
@content.setter
def content(self, value):
self._content = value
@content.de... |
class Pessoa:
olhos = 2 # atributo de classe padrão no instanciamento de todos os objetos da classe
def __init__(self,*filhos, nome = None, idade = 35):#constrtur de uma classe
self.idade = idade
self.nome = nome
self.filhos = list(filhos) # atributo complexo
def cumprimentar(self):... |
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("//tools/build/bazel/rules_nim/internal:install_nix.bzl", "install_nim")
def nim_rules_dependencies():
"""Declares external repositories that rules_nim depends on. This
function should be loaded and called from WORKSPACE files."""
... |
"""
Hide tristate choice values with mod dependency in y choice.
If tristate choice values depend on symbols set to 'm', they should be
hidden when the choice containing them is changed from 'm' to 'y'
(i.e. exclusive choice).
Related Linux commit: fa64e5f6a35efd5e77d639125d973077ca506074
"""
def test(conf):
as... |
#
# PySNMP MIB module MICOM-56KCSU-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MICOM-56KCSU-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:12:11 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... |
# Copyright 2014 The Bazel Authors. 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 required by applicable la... |
'''
Hi, here's your problem today. This problem was recently asked by AirBNB:
Given a sorted array, A, with possibly duplicated elements, find the indices of the first and last occurrences of a target element, x. Return -1 if the target is not found.
Example:
Input: A = [1,3,3,5,7,8,9,9,9,15], target = 9
Output: [6,8... |
"""*****************************************************************************
* Copyright (C) 2018 Microchip Technology Inc. and its subsidiaries.
*
* Subject to your compliance with these terms, you may use Microchip software
* and any derivatives exclusively with Microchip products. It is your
* responsibility to ... |
# Write a Python program to get a string which is n (non-negative integer) copies of a given string.
def copies(string, number):
ans = ""
for i in range(number):
ans += string
return ans
s = input("Enter a string: ")
n = int(input("Enter number of copies to do: "))
print(copies(s, n))
|
class ManipulationBoundaryFeedbackEventArgs(InputEventArgs):
""" Provides data for the System.Windows.UIElement.ManipulationBoundaryFeedback event. """
BoundaryFeedback=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the unused portion of the direct manipulation.
Get: BoundaryFe... |
"""This module serves as the entry point of MyCryptoKeys."""
def main():
"""The actual entry point."""
print('holi')
if __name__ == '__main__':
main()
|
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 13 23:57:31 2020
@author: abhi0
"""
class Solution:
def minimumAbsDifference(self, arr: List[int]) -> List[List[int]]:
temp=sorted(arr)
tempDiff=[]
for i in range(len(temp)-1):
tempDiff.append(abs(temp[i+1]-te... |
"""
# tag::example1[]
>>> from ecc import FieldElement
>>> a = FieldElement(7, 13)
>>> b = FieldElement(6, 13)
>>> print(a == b)
False
>>> print(a == a)
True
# end::example1[]
# tag::example2[]
>>> print(7 % 3)
1
# end::example2[]
# tag::example3[]
>>> print(-27 % 13)
12
# end::example3[]
# tag::example4[]
>>> from ... |
"""
Descrição: Este programa verifica os caracteres que não estão repetidos nas expressões informadas pelo usuário.
Autor:Henrique Joner
Versão:0.0.1
Data:03/01/2019
"""
#Inicialização de variáveis
primeira = 0
segunda = 0
terceira = []
p=0
#Entrada de dados
primeira = input("Digite uma frase: ")
segunda = input("D... |
class spam:
def __init__(self):
self.msgtxt = "this is spam"
def msg(self):
print(self.msgtxt)
if __name__ == '__main__':
s = spam()
s.msg()
|
#! /Users/nsanthony/miniconda3/bin/python
def error():
"""Spits out that it doesnt work, needs definition"""
print('ERROR: ')
return |
def run (autoTester):
b = b'bike'
s = bytes ('shop', 'utf8')
e = b''
bb = bytearray ([0, 1, 2, 3, 4])
bc = bytes ((5, 6, 7, 8, 9))
# __pragma__ ('opov')
bps = b + b'pump' + s
bps3 = 3 * bps + b'\0'
aBps3 = bps * 3 + b'\0'
l = [1, 2, 3] + [4, 5, 6]
# __pragma__ ('noopov')
... |
async def m001_initial(db):
"""
Initial rapaygo table.
"""
await db.execute(
f"""
CREATE TABLE rapaygo.lnurlposs (
id TEXT NOT NULL PRIMARY KEY,
key TEXT NOT NULL,
title TEXT NOT NULL,
wallet TEXT NOT NULL,
currency TEXT NOT NU... |
"""
Return file info as a dict.
[extended_summary]
"""
|
UNICORN_MESSAGE_ERROR = "..for the love it bears to fair maidens forgets its ferocity and wildness.. "
GENERIC_ERROR = "Ooooops, it works on my machine. Please try again later."
NOT_FOUND_ERROR = "Not found!"
SERVER_ERROR = "Server problem"
UNSUPPORTED_SERVICE_ERROR = "Unsupported service"
KEY_TEMPLATE_ERROR = "Attenti... |
'''
Created on Jan 13, 2014
@author: Eugene Syriani
@version: 0.2.5
This module contains utility classes and functions.
'''
class Singleton(type):
"""
Meta-class to turn a class into a singleton.
"""
def __init__(self, name, bases, _dict):
super(Singleton, self).__init__(name, bases, _dict)
... |
class ViewSetView(object):
'''
A mixin for views to make them compatible with ``ViewSet``.
'''
# The ``viewset`` will be filled during the instantiation of the
# ``NamedView`` (i.e. ``NamedView.as_view()`` is called with the
# kwarg ``viewset``).
viewset = None
|
# The following imports where disabled to prevent runtime errors caused by
# double imports with Python 3.6.x or higher. Since all listed classes are
# part of test_main.py - which is the file containing the program entry point -
# there is no need for these explicit imports.
# Details and recreation instructions:
# Th... |
# RUN: %S/../test.sh %s
def func():
return 1
print(func()) # CHECK: 1
|
print ("hello world")
print ("hello" ,"world" , "epic" , sep="##" )
variable = input ("enter your name ")
print("hello" , variable, sep=", ")
variable = input ( "enter your age:")
print("damn" , variable, sep=", ")
variable = input("enter your age ")
variable = int(variable)
difference = 100 - variable
print ("y... |
"""
Entradas: 4 entradas de valor flotante, 3 son las ventas de cada departamento y uno el sueldo de los vendedores
Departamento 1 --> float --> A
Departamento 2 --> float --> B
Departamento 3 --> float --> C
Sueldo --> float --> D
Salidas: 3 valores flotantes que es el sueldo de los vendedores de los departamentos
... |
nuke.pluginAddPath("renderFinished")
nuke.pluginAddPath("revealInFinder")
nuke.pluginAddPath("edgeNode")
nuke.pluginAddPath("autoBackup")
nuke.pluginAddPath("exrSplit") |
mot = {
'A': '5A',
'L': '6A',
'ST': '7A'
}
pot = ['DS', 'DC', 'START', 'USING']
print(mot)
print(pot)
inputList = []
with open("ainput.txt", "r") as f:
for ip in f:
inputList.append(ip.strip("\n").strip("\r"))
print(inputList)
symtab = open("SymbolTable.txt", "w")
a = (inputList.pop(0)).split("... |
"""IF 陳述式
@詳見: https://docs.python.org/3/tutorial/controlflow.html
IF 陳述式有可選的例外判斷,elif 或是 else,
關鍵字 elif 是 else if 的縮寫,可以有效的避免過多縮排
if … elif … elif … 可以用來代替其他程式語言中的 switch 陳述式
"""
def test_if_statement():
"""IF 陳述式"""
number = 15
conclusion = ''
if number < 0:
conclusion = '數字小於零'
eli... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" ESC/POS Commands (Constants) """
# Feed control sequences
CTL_LF = '\x0a' # Print and line feed
CTL_FF = '\x0c' # Form feed
CTL_CR = '\x0d' # Carriage return
CTL_HT = '\x09' # Horizontal tab
CTL_VT ... |
'''
Ввести целое положительное число и проверить, является ли оно палиндромом,
т. е. совпадает ли первая цифра с последней, вторая — с предпоследней и т. д.
Представлять число в виде последовательности (строки, списка и т. п.) нельзя.
Вывести YES или NO соответственно. Лидирующие нули не учитывать (числа,
заканчивающие... |
"""
Provide errors for BaseGenerator interface.
"""
class ValidationDataError(Exception):
"""
Name generation data contains invalid characters or does not match the name length error.
"""
def __init__(self, message):
self.message = message
|
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# ... |
# https://www.codewars.com/kata/56dec885c54a926dcd001095
opposite = lambda n: -n
|
class py_solution:
def int_to_Roman(self, num):
val = [
1000, 900, 500, 400,
100, 90, 50, 40,
10, 9, 5, 4,
1
]
syb = [
"M", "CM", "D", "CD",
"C", "XC", "L", "XL",
"X", "IX", "V", "IV",
... |
# Copyright 2016 Google Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
{
'includes': [
'../common.gypi',
],
'targets': [
{
'target_name': 'hls_builder',
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.