content stringlengths 7 1.05M |
|---|
NPC_IDS = [
3,
6,
30,
36,
38,
40,
43,
46,
48,
54,
60,
61,
66,
68,
69,
74,
78,
79,
80,
92,
94,
95,
97,
98,
99,
100,
103,
113,
114,
115,
116,
117,
118,
121,
122,
123,
124,
125,
126,
127,
151,
152,
154,
157,
167,
171,
190,
193,... |
#!/usr/bin/python3.8
# -*- coding: utf-8 -*-
# please adjust these two lines if necessary
# multizaehlen_ini_en.py
# (C) Günter Partosch 2021
# english texts for ini file
# Stand: 2020-09-01 (Anfangsversion)
# Dependencies:
# + is loaded in multizaehlen.py
# + is loaded in menu_multizaehlen.py
# globale Parameter
... |
"""
A variety of functions for converting to and from camelCase and snake_case.
"""
def snake_to_camel_case(string):
words = [word.capitalize() for word in string.split("_")]
words[0] = words[0].lower()
return "".join(words)
def camel_to_snake_case(string):
words = []
start_index = 0
for ind... |
"""
Task :
Given an integer, , perform the following conditional actions:
If is odd, print Weird
If is even and in the inclusive range of to , print Not Weird
If is even and in the inclusive range of to , print Weird
If is even and greater than , print Not Weird
"""
number = int(input().strip())
if (6 <= numbe... |
T = int(input())
for i in range(T):
RS = input().split()
R = int(RS[0])
S = RS[1]
P = ''
for i in S:
P += (i * R)
print(P) |
config = some.Structure(
globalMap = {
103310322020340: [100000031211103,101042000320420,100100001202021,112320301100420,110101024402203,112001202000203,112101112010031,102130400200010,100401014300441,103000401422033],
110040120003212: [114413100031332,102101001412002,100210000032130,214000110100040... |
LOG_RECORD_PROPERTIES = {
"application_name": {"type": "keyword"},
"environment": {"type": "keyword"},
"logfile": {"type": "keyword"},
"data_pipeline": {
"properties": {
"id": {"type": "keyword"},
"component": {"type": "keyword"},
"instance": {"type": "keyword... |
class Solution(object):
def findPoisonedDuration(self, timeSeries, duration):
"""
:type timeSeries: List[int]
:type duration: int
:rtype: int
"""
prev_end = None
ans = 0
for t in timeSeries:
end = t + duration
t = max(prev_end, ... |
# from module_1 import add_number
# from module_1 import print_number
# from module_1 import number
number = 0
def number_in_function():
def add_number_func(number):
number = 2
print(f'Number in function - {number}')
add_number_func(number)
print(f'Number out of the function - {number}')
def add_di... |
times = ('Atlético-MG', 'Flamengo', 'Palmeiras', 'Fortaleza', 'Corinthians', 'Bragantino', 'Fluminense', 'América-MG', 'America-MG', 'Atlético-GO', 'Santos', 'Ceará SC', 'Internacional', 'São Paulo', 'Atlético-PR', 'Cuiabá', 'Juventude', 'Grêmio', 'Bahia', 'Sport Recife', 'Chapecoense')
posição = times.index('Chapecoe... |
class BaseEnvironment:
def getResponseDistribution(self, hour, minute, day,
stateLocation, stateActivity, lastNotificationTime):
"""
This function returns user's internal perception of notifications (i.e., at this given
context, how likely the user is going to answer the not... |
word_list = [
'ratt',
'poison',
'twisted sister',
'skid row',
'guns n roses',
'slaughter',
'kix',
'van halen',
'tora tora',
'ozzy osbourne',
'lita ford',
'vixen',
'dangerous toys',
'blue murder',
'damn yankees',
'def leppard',
'tesla',
'warrant',
'motley crue'
]
|
# -*- coding: utf-8 -*-
"""Define project metadata
"""
__title__ = "hashfs"
__summary__ = "A content-addressable file management system."
__url__ = "https://github.com/dgilland/hashfs"
__version__ = "0.7.2"
__install_requires__ = []
__tests_require__ = ["tox"]
__author__ = "Derrick Gilland"
__email__ = "dgilland@gm... |
def change(amount):
if amount is None or amount < 24 or amount > 1000:
raise ValueError('"' + str(amount) + '" must be a integer between 24 and 1000')
return _get_change(amount)
def _get_change(amount):
if amount % 7 == 0:
return [7] * int(amount/7)
coins = _get_change(amount - 5)
... |
class Solution(object):
def minOperations(self, s):
"""
:type s: str
:rtype: int
"""
# Runtime: 52 ms
# Memory: 13.4 Mb
return min(self.check(s, "0", "1"), self.check(s, "1", "0"))
def check(self, string, char_even, char_odd):
changes = 0
... |
def extractWeleTranslation(item):
"""
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if item['title'].lower().startswith('sin city'):
return buildReleaseMessageWithType(item, 'Sin City', vol, chp, frag=frag, ... |
"""
An english to pig latin translator made without the use of machine learning.
"""
s = input('Enter a string to translate to Pig Latin: ')
end = ''
vowels = ['a', 'e', 'i', 'o', 'u']
n = 0
for i in range(len(s)):
if s[i] in vowels:
n = i
break
else:
end += s[i]
print(s[n:]+end+'ay')... |
with open("headers.txt", 'r') as file:
headers_unformatted = [header.strip() for header in file]
organized_headers = dict()
for header in headers_unformatted:
key, value = header.split(": ")
organized_headers[key] = value
print("{")
for k, v in organized_headers.items():
print(f"'{k}'", ... |
with open("in.txt", "r") as f:
s = f.read()
with open("out.txt", "w") as f:
for x in s.split("\n"):
if len(x) > 0:
print("# " + x[3:], file=f)
if __name__ == "__main__":
pass
|
class PostureAidConfig:
__conf = {
"PAD_X": 30,
"PAD_Y": 30,
"MODEL": 101,
"CAM_ID": 0,
"CORRECT_POS": (0,0,0,0),
"SCALE_FACTOR": 0.7125,
"ALARM_FILE": './data/audio/alarm_audio.wav'
}
__setters = []
@staticmethod
def config(key):
retu... |
# Copyright 2007-2016 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later... |
def nthMax(nums, n):
maxs = []
for i in range(n):
m = None
for num in nums:
if (m is None or num > m) and (num not in maxs):
m = num
maxs.append(m)
return maxs[-1] if maxs[-1] is not None else maxs[0]
class Solution(object):
def thirdMax(se... |
def main(request, response):
allow = request.GET.first(b"allow", b"false")
headers = [(b"Content-Type", b"application/javascript")]
if allow != b"false":
headers.append((b"Access-Control-Allow-Origin", b"*"))
body = b"""
function handleRejectedPromise(promise) {
promise.catch(() => ... |
psys_game_rain = 0
psys_game_snow = 1
psys_game_blood = 2
psys_game_blood_2 = 3
psys_game_hoof_dust = 4
psys_game_hoof_dust_snow = 5
psys_game_hoof_dust_mud = 6
psys_game_water_splash_1 = 7
psys_game_water_splash_2 = 8
psys_game_water_splash_3 = 9
psys_torch_fire = 10
psys_fire_glow_1 = 11
psys_fire_glow_fixed = 12
psy... |
# Programa 10.1 do livro, página 230
# Programa 10.1 – Conta com registro de operações e extrato (contas.py)
#
# class Conta:
# def __init__(self, clientes, número, saldo=0):
# self.saldo = 0
# self.clientes = clientes
# self.número = número
# self.operações = []
# self.depos... |
HTML_CLUSTER_DATA_DIRECTORY = 'html-cluster-data'
SPLASH_URL = 'http://localhost:8050'
USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36' # NOQA
SPLASH_TIMEOUT = 30
ALLOW_STATUS_CODE = [200]
|
if request.isInit:
lastVal = 0
elif request.isRead:
request.value = lastVal
elif request.isWrite:
lastVal = request.value
|
preço = float(input(' Preço:\n R$'))
print(' Pagamentos:')
print('=' * 46)
print('''
[1] A vista (dinheiro ou cheque)
>>>Desconto: 10%
[2] A vista (no cartão)
>>>Desconto: 5%
[3] No cartão 2x
>>>Sem desconto | Sem juros
[4] No cartão 3x ou mais
>>>Sem desconto | 20% d... |
'''input
4 2 3
1 4 2 3
2 3 2 3
3 1 10
3 3 4
3 3 4
1 3 3
3
3
'''
# -*- coding: utf-8 -*-
# SoundHound Inc. Programming Contest 2018 Spring
# Problem B
if __name__ == '__main__':
n, l, r = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(len(a)):
if a[i] < l:
... |
def cycle_fn(epoch, cycle_length=15, const_epochs=3, start=0.0, stop=1.0):
cur_epoch = epoch % cycle_length
grow_length = (cycle_length - const_epochs)
growing = cur_epoch < grow_length
rate = (stop - start)
if growing:
t = cur_epoch / float(grow_length)
return rate * t + start
... |
x = 0
while x < 100:
print(x)
x += 1
|
# -*- coding: utf-8 -*-
"""
module mixin - mixes classes to augment an existing class or creat a new one
http://c2.com/cgi/wiki?MixinsForPython
"""
def mixIn (base, addition):
"""
Mixes in place, i.e. the base class is modified.
Tags the class with a list of names of mixed members.
@param base : the base clas... |
firstName = 'John'
lastName = 'Smith'
#message = first + ' [' + last + '] is a coder'
message = f'{firstName} [{lastName}] is a coder.'
print(message) |
#crie um programa que calcule a soma entre todos os numeros impares que sao multiplos de tres
# e que se encontram no intervalo de 1 até 500
#minha resposta (nao consegui fazer)
#for imp in range(1, 10, 2):
# if imp % 3 == 0:
# print(imp)
#respotsa Gustavo
#soma = 0 # acumulador
#cont = 0 # acumulador
#fo... |
"""
Used to "iterate", or do something repeatedly, over an iterable.
The loop's body is run a predefined number of times.
"""
cities = ['new york city', 'mountain view', 'chicago', 'los angeles']
""" Creating Lists """
capitalized_cities = []
for city in cities:
capitalized_cities.append(city.title())
print(c... |
'''
有序链表,找不到只出现一次的数字
1->2->2->3->3->5
1,5
'''
class Node:
def __init__(self, val):
self.val = val
self.next = None
str = input()
lst = str.split(',')
root = p = Node(lst[0])
for i in lst[1:]:
p.next = Node(i)
p = p.next
stack = []
while root:
top = root.val
stack.append(root.va... |
#list comprehension with if statement
numbers = list(range(1,11))
print(f" List of the numbers : {numbers}")
print(" 1st example ")
#by simple method
even_num = []
for i in numbers:
if i % 2 == 0:
even_num.append(i)
print(f"even number by list simple: {even_num} " )
#by list comprehension
even_num2 = [i ... |
dict = {}
uid =[]
name = []
age = []
n = int(input("Plz Enter Number of User U Want to Add: "))
i =0
while(i<n):
print()
print("Enter User ",i+1," Details")
uid.append(int(input("Enter User ID : ")))
name.append(input("Enter User Name : "))
age.append(int(input("Enter Your Age : ")))
... |
CASSANDRA_VERSION = "3.11.11"
CASSANDRA_DEB_VERSION = CASSANDRA_VERSION + "_all"
DNSMASQ_VERSION = "2.80-1"
DNSMASQ_DEB_VERSION = DNSMASQ_VERSION + "+deb10u1"
ELASTICSEARCH_VERSION = "7.3.1"
ENVOY_VERSION = "1.15.5"
ERLANG_VERSION = "22.3.4.9-1"
ERLANG_DEB_VERSION = ERLANG_VERSION + ""
GERRIT_VERSION = "3.4.0"
GR... |
DEFAULT_TRAINING_PARAMS = {
'max_depth': [5, 10, 15],
'minbucket': [1, 5, 10],
'hyperplanes': False,
}
|
def bubbleSort(arr):
for n in range(len(arr)-1,0,-1):
for k in range(n):
print(f" n {n} - k {k}")
if arr[k] > arr[k+1]:
temp = arr[k]
arr[k] = arr[k+1]
arr[k+1] = temp
return arr
print(bubbleSort([2,6,1,5,9,... |
print("Loja de Doces")
cadastro = input("Já possui cadastro? " + "sim " + "ou " + "não" ":")
if (cadastro == "sim"):
print("Quem bom ter você de volta!")
nome_cadastrado = "raphaella"
senha_cadastrada = "12345"
else:
print("Vamos realizar seu cadastro?")
nome_cadastrado = input("Digite seu no... |
S = input()
if ('N' in S) ^ ('S' in S) or ('W' in S) ^ ('E' in S):
print('No')
else:
print('Yes')
|
long_string = lambda str: len(str) > 12
print(long_string("short"))
print(long_string("photosynthesis"))
|
"""
Dungeon Game
The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a 2D grid. Our valiant knight (K) was initially positioned in the top-left room and must fight his way through the dungeon to rescue the princess.
The k... |
word = input()
reverse_word = ''
for i in range(len(word) - 1, -1 , -1):
reverse_word += word[i]
print(reverse_word) |
__all__ = ['make_simple_coil', 'set_parameter', 'make_motion_component', 'get_parameter']
def make_simple_coil(doc, problem_id, array_values):
""" function to make a simple coil with 'ArrayOfValues' and 'ProblemID',
returns path to the coil
"""
coil = doc.makeSimpleCoil(problem_id, array_values)
r... |
x = input()
while len(x)>0:
# print(x[:3] , x[3:])
if x[:3]=="144":
x = x[3:]
# print(x)
elif x[:2]=="14":
# print("2")
x = x[2:]
elif x[:1]=="1":
# print("3")
x = x[1:]
else:
print("NO")
break
else:
print("YES") |
while True:
n = int(input('Digite um valor: '))
r = str(input('Quer continuar? [S/N] '))
if r in 'Nn':
break
|
number = int(input())
hours = int(input())
salary = float(input())
print("NUMBER =", number)
print("SALARY = U$ %.2f" % (hours * salary)) |
# 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:
# 1st solution
# O(n) time | O(n) space
def countNodes(self, root: Optional[TreeNode]) -> int:
... |
print('H\'ello')
print(int('8') + 5)
print(8,5)
'''print('Hi',5)
print(3/4)'''
ex=print('Hey')
(x,y)=7,9
print(x,y)
add=5+9
sub=9-7
print(add/sub) |
# SCENARIO: Calculator - Do an addition
# GIVEN a running calculator app
type(Key.WIN + "calculator" + Key.ENTER)
wait("screen-home.png")
# AND '5' is displayed
click("button-5.png")
wait("1471901563200.png")
# WHEN I click on '+', '1', '='
click("1471902303880.png")
click("button-1.png")
click("button-equal.... |
def calculate_score(set_of_tags_1, set_of_tags_2):
"""
:param set_of_tags_1: collection of unique strings
:param set_of_tags_2: same as above
:return: score based on hashcode scoring
"""
one_and_two = len(set_of_tags_1.intersection(set_of_tags_2))
one_not_two = len(set_of_tags_1.difference(s... |
"""
Configuration of 'memos' Flask app.
Edit to fit development or deployment environment.
"""
### Flask settings for ix
PORT=6291 # The port I run Flask on
SERVER_NAME = "ix.cs.uoregon.edu:{}".format(PORT)
DEBUG = False
### Flask settings for local machine
PORT=5000 # The port I run Flask on
DEBUG = Tru... |
class Solution(object):
def romanToInt(self, s):
"""
:type s: str
:rtype: int
"""
if len(s) == 0:
return 0
else:
ref = {
"I" : 1,
"V" : 5,
"X" : 10,
"L" : 50,
"C" :... |
num = int(input('Digite um número: '))
op = int(input('''
\033[32m Para qual base de numerica você deseja converter?\033[m
[1] Binário
[2] Octal
[3] Hexadecimal
-> '''))
if op == 1:
print('{} Em binário o valor é {}'.format(num, bin(num)[2:]))
elif op == 2:
print('{} Em Octal o valor é {}'.format(num, oct... |
def cc(M):
m, n = len(M), len(M[0])
ly, lx = [], []
for j in range(1, m):
for i in range(n):
if M[j][i] != M[j-1][i]:
ly.append(j)
break
for i in range(1, n):
for j in range(m):
if M[j][i] != M[j][i-1]:
lx.append(i)
... |
frase = str(input('Digite seu nome completo: ')).strip()
print(f'Seu nome em maiusculo é: {frase.upper()}')
print(f'Seu nome em minusculo é: {frase.lower()}')
print(f'Seu nome tem no total {len(frase)- frase.count(" ")} letras')
print(f'Seu primeiro nome tem: {frase.find(" ")} letras')
|
"""
You are given a string s. You can convert s to a palindrome by adding characters in front of it. Return the shortest
palindrome you can find by performing this transformation.
Example 1:
Input: s = 'aacecaaa', Output: 'aaacecaaa'
Example 2:
Input: s = 'abcd', Output: 'dcbabcd'
"""
"""
Seeing as we can only add l... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under th... |
# TODO: include seccomp
# plat/nonplat files are only found on Android N (>8.0) as part of the Treble project
# Treble Reference: https://source.android.com/security/selinux/images/SELinux_Treble.pdf
SEPOLICY_FILES = [
'sepolicy',
'precompiled_sepolicy', # Treble devices (if it has been compiled)
... |
load(":pkg_config.bzl", "pkg_config_repository")
def add_repositories():
pkg_config_repository(
name = "glfw3",
spec = "glfw3",
includes = [
"GLFW/*.h",
],
)
pkg_config_repository(
name = "glew",
spec = "glew",
includes = [
"GL... |
class Solution:
def numSquares(self, n: int) -> int:
"""
动态规划(1)和找硬币思路类似
数组 dp[i] 代表当硬币面额为 i 时所需的最小平方和数
先将完全平方数填充,dp[i] 的最小平方数可以由和等于 i 的两个数 dp[j] + dp[i-j] 的
最小平方数加和构成.
但是这种方法会造成 Time limit exceeded
:param n:
:return:
"""
dp = [float('i... |
ARTICLE_URL = 's/{slug}/'
ARTICLE_SAVE_AS = 's/{slug}/index.html'
DIRECT_TEMPLATES = (('index', 'tags', 'categories','archives', 'submit', 'search', '404'))
PAGE_URL = 'content/pages/{slug}.html'
PAGE_SAVE_AS = '{slug}.html'
PLUGIN_PATH = 'pelican-plugins'
PLUGINS = ['tipue_search']
RECENT_ARTICLES_COUNT = 5 ... |
"""
39. Combination Sum
Medium
Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen numbers sum to target. You may return the combinations in any order.
The same number may be chosen from candidates an unlimited number of ... |
print("Lyrics of the Song 99 Bottles of Beer")
bottlecount = int(99)
confirm = int (1)
i = bottlecount
while(i>1):
print(f"{bottlecount} bottles of beer on the wall, {bottlecount} bottles of beer. \n")
bottlecount=bottlecount-1
i-=1
print(f"Take one down and pass it around, {bottlecount} bottles of beer... |
#!/usr/bin/env python3
grid = [['x', 'x', 1, 'x', 'x'],
['x', 2, 3, 4, 'x'],
[ 5, 6, 7, 8, 9],
['x', 'A', 'B', 'C', 'x'],
['x', 'x', 'D', 'x', 'x']]
XMAX = len(grid[0]) - 1
YMAX = len(grid) - 1
x, y = 0, 2
nums = []
with open('input.txt') as f:
for line in f:
... |
#!/usr/bin/env python
"""
Tests for the `edx_course_team_api` models module.
"""
|
MAX_SEED=99999999
UNK="_UNK"
WORD_START="<w>"
WORD_END="</w>"
START_TAG=0
END_TAG=1
|
#!/usr/bin/env python3
"""
ZOOM POLL VIEWER v1.0
RESPONSE CLASS
"""
class Response:
def __init__(self, student, session, poll):
self._student = student
self._session = session
self._poll = poll
self._answers = {}
# Structure of _answers = { <question_A> : [<choice_1>, ... |
map = { '0': '0', '1': '1', '2': '2', '3': '3',
'4': '4', '5': '5', '6': '6', '7': '7',
'8': '8', '9': '9', 'a': 'd', 'b': 'e',
'c': 'f', 'd': 'a', 'e': 'b', 'f': 'c'}
input = ['4ab56415e91e6d5172ee79d9810e30be5da8af18',
'c19a3ca5251db76b221048ca0a445fc39ba576a0',
'fdb2c9cd514... |
'''Basic calculator operations using python
Command Line Interface and Menu are in progress'''
print(" modules | CALCULATOR | INFO | ")
def arCalc():
''' printing Menu for Showning the available operations'''
print("PYTHON CALCULATOR 2.0 \n 1.Addition \n 2.Subtraction \n 3.Multiplication \n 4.Division")
... |
'''
What is Matplotlib?
Matplotlib is a low level graph plotting library in python that serves as a visualization utility.
Matplotlib was created by John D. Hunter.
Matplotlib is open source and we can use it freely.
Matplotlib is mostly written in python, a few segments are written in C, Objective-C and Javascript ... |
load("@rules_python//python/pip_install:pip_repository.bzl", "whl_library")
all_requirements = ["@rules_pycross_pypi_deps_build//:pkg", "@rules_pycross_pypi_deps_dacite//:pkg", "@rules_pycross_pypi_deps_installer//:pkg", "@rules_pycross_pypi_deps_packaging//:pkg", "@rules_pycross_pypi_deps_pep517//:pkg", "@rules_pycro... |
def print_game(game):
print(' {} {} {} '.format('0', '1', '2'))
print('0 {} | {} | {} '.format(game[0][0], game[0][1], game[0][2]))
print(' --- --- --- --- ')
print('1 {} | {} | {} '.format(game[1][0], game[1][1], game[1][2]))
print(' --- --- --- --- ')
print('2 {} | {} | ... |
def selection_sort(lst):
for i in range(len(lst)-1):
smallestIndex = i
for j in range(i+1, len(lst)):
if lst[j] < lst[smallestIndex]:
smallestIndex = j
if smallestIndex != i:
lst[i], lst[smallestIndex] = lst[smallestIndex], lst[i]
return lst
list_1 = [4, 7, 1, 9, 2]
print(se... |
class MenuHelper:
def __init__(self, app):
self.app = app
def check_menu_items(self):
driver = self.app.driver
driver.find_element_by_partial_link_text('Dashboard').click()
driver.find_element_by_partial_link_text('Feedback').click()
driver.find_element_by_partial_link_t... |
class RandomizedCollection:
"""
dict[val] = index of val in list v
when do removing, get any one index of the val to be deleted in v,
and denote it as idx, then swap it with the last val in v (if with
a different index), change index to idx and then pop it out
"""
def __init__(self):
self.v = []
... |
class TonLiteClientException(Exception):
pass
|
"""Module for handling the different draw options for nodes. Used when creating a .dot file respresentation of the pipeline."""
_DEFAULT_DRAW_OPTIONS = {'shape': 'box', 'style': 'filled'}
_DEFAULT_AQP_OPTIONS = {'fillcolor': '#ffffff'}
_DEFAULT_VISQOL_OPTIONS = {'fillcolor': '#F0E442B3'}
_DEFAULT_PESQ_OPTIONS = {'fill... |
class TelepatResponse:
def __init__(self, response):
self.status = response.status_code
self.json_data = response.json()
self.content = self.json_data["content"] if "content" in self.json_data else None
self.message = self.json_data["message"] if "message" in self.json_data else ""
... |
__author__ = 'Seqian Wang'
# A class for each scan session
class ScanSession:
def __init__(self, study, rid, scan_type, scan_date, scan_time,
s_identifier, i_identifier, download_folder, raw_folder, file_type, moved=0):
self.study = study
self.rid = rid
self.scan_type = s... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
*****************************************
Author: zhlinh
Email: zhlinhng@gmail.com
Version: 0.0.1
Created Time: 2016-02-29
Last_modify: 2016-02-29
******************************************
'''
'''
Given a set of distinct integers, nums, re... |
def continuity(x):
yes = []
m = 0
d = 1
a = int(x ** (1 / 2))
yes.append(a)
while a != 2 * int(((x) ** (1 / 2))):
m = d * a - m
d = (x - m**2) / d
a = int(((x ** (1 / 2)) + m) / d)
yes.append(a)
return yes
def solutions(x):
if x in squares:
retur... |
cases = [
('Push is observable here so no actions are enabled in the initial state',
'pmt -n 10 -s 1 Stack Observables'),
('Accepts Push(3) but not Pop(3) because here Push is observable, Pop controllable',
'pmt -n 10 -s 1 Stack Observables Scenarios'),
('Accepts both Push(3) and Pop(3) because ... |
# 3. Реализовать программу работы с органическими клетками, состоящими из ячеек. Необходимо создать класс Клетка.
# В его конструкторе инициализировать параметр, соответствующий количеству ячеек клетки (целое число). В классе должны
# быть реализованы методы перегрузки арифметических операторов: сложение (add()), вычит... |
def unit_convert(value, initial_unit, convert_to_unit):
units = {"cm": 0.01, "m": 1}
result = value*(units[initial_unit]/units[convert_to_unit])
string = f"{result}{convert_to_unit}"
print(string)
return string
def run_script(TEST=False):
while True:
try:
user_input = input(... |
gitignore = [
"None",
"Actionscript.gitignore",
"Ada.gitignore",
"Agda.gitignore",
"Android.gitignore",
"AppEngine.gitignore",
"AppceleratorTitanium.gitignore",
"ArchLinuxPackages.gitignore",
"Autotools.gitignore",
"C++.gitignore",
"C.gitignore",
"CFWheels.gitignore",
"CMake.gitignore",
"CUDA.gitignore",
"CakePHP.gitig... |
{
"targets": [
{
"target_name":"binding",
"sources":["png.c","jpeg.c","gif.c","imagesize.c","binding.c"],
'dependencies':['./binding.gyp:libhttp','./binding.gyp:libpng','./binding.gyp:libjpeg'],
},
{
"target_name":"libhttp",
"type":'static_library',
"sources":["http.c"]
},
{
"target_name"... |
names = ['Bob', 'John', 'Steve', 'Dave']
# print(len(names))
# names += ['Robert']
# print(names)
# print(names[:3])
# print('Bob' in names)
# names.remove('Bob')
# names.remove('John')
# print(names)
# names.append('Don')
# print(names)
# names.extend(['Bob', 'John'])
# print(names)
# print(names)
# names[1] = 'Don'
#... |
def duplicate(arr):
tortoise = arr[0]
hare = arr[0]
while True:
tortoise = arr[tortoise]
hare = arr[arr[hare]]
if tortoise == hare:
break
ptr1 = arr[0]
ptr2 = tortoise
while ptr1 != ptr2:
ptr1 = arr[ptr1]
ptr2 = arr[ptr2]
return ptr1
a... |
process_queue = []
total_wtime = 0
total_tat=0
ct = 0
n = int(input('Enter the total no of processes: '))
for i in range(n):
at = 0
bt = 0
process_queue.append([])#append a list object to the list
process_queue[i].append(int(input('Enter p_id: ')))
#at = int(input('Enter p_arrival: '))
process_q... |
#
# PySNMP MIB module HUAWEI-LINE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-LINE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:46:05 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... |
#simple DB API testcase
class TestSimpleDBAPI(object):
def test_regular_selection(self, duckdb_cursor):
duckdb_cursor.execute('SELECT * FROM integers')
result = duckdb_cursor.fetchall()
assert result == [(0,), (1,), (2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,), (None,)], "Incorrect resul... |
def enforce(*types):
def decorator(f):
def new_func(*args, **kwargs):
new_args = []
for (a, t) in zip(args, types):
new_args.append(t(a))
return f(*new_args, **kwargs)
return new_func
return decorator
@enforce(str, int)
def repeat_msg(msg,... |
S = raw_input()
N = input()
for i in range(N):
Wi = raw_input()
c = 0
for x in Wi:
if x in S:
c+=1
else:
print("No")
break
if c == len(Wi):
print("Yes")
|
TEXT_STYLE_INPUTS = (
'EmailInput',
'NumberInput',
'PasswordInput',
'TextInput',
'Textarea',
'URLInput',
)
|
print ("Hello Python!")
counter = 100 # An integer assignment
miles = 1000.0 # A floating point
name = "John" # A string
print (counter)
print (miles)
print (name)
print ()
# two examples of assignment which could cause confusion.
a=1
b=2
# in this case b is assigned a+b where a is the ... |
zabbixapiurl = 'your zabbix url'
zabbixapilogin = 'your zabbix login'
zabbixapipasswd = 'your zabbix passwd'
ecopowerstart = '20:00:00'
ecopowerfinish = '09:00:00'
bridgepasswd = 'PyZabbixHuePasswd'
flickingperiod = 600
runinterval = 60
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.