content stringlengths 7 1.05M |
|---|
def parse_instruction(line):
instruction, step = line.split()
return (instruction, int(step))
def parse_program(lines):
return [parse_instruction(line) for line in lines]
def gen_alt_programs(program):
for i in range(len(program)):
ins, step = program[i]
if ins == "jmp":
... |
class Solution(object):
def lengthOfLongestSubstring(self, s):
"""
:type s: str
:rtype: int
"""
substr = []
curr = []
for i in range(0, len(s)):
letter = s[i:i+1]
if letter in curr:
if len(curr) > len(substr):
... |
# Summing the N series
# Sum the N series.
#
# https://www.hackerrank.com/challenges/summing-the-n-series/problem
#
# c'est quand même plus facile que les problèmes de Project Euler...
for _ in range(int(input())):
n = int(input())
print((n ** 2) % 1000000007)
|
# -*- coding: utf-8 -*-
# Implementační test IB002 - úloha 1. (lehčí, 12 bodů)
# Vyplňte následující údaje:
# Jméno:
# UČO:
# Skupina:
#
# Vytvoří prázdnou matici sousednosti pro graf o n vrcholech.
#
def createGraph(n):
return [[0] * n for i in range(n)]
#
# Přidá hranu (u,v) do grafu. Graf je neorientovaný, t... |
# MIT License
# Copyright (c) 2022 Zenitsu Prjkt™
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge,... |
#Programa que define idade dos pais e a idade que eles tinham quando os filhos nasceram.
anoAtual = int(input('Ano atual: '))
nascMae = int(input('Ano de nascimento Mãe: '))
nascPai = int(input('Ano de nascimento Pai: '))
idFilho = int(input('Idade do filho: '))
idMae = anoAtual - nascMae
idPai = anoAtual - nascPai
idM... |
class converter:
def convertParagraph(self,st):
st = st.replace("two dollars","$2")
st = st.replace("C M","CM")
st = st.replace("Triple A","AAA")
st = st.replace("United State of America","USA")
return st |
class Solution:
def minSwap(self, A: List[int], B: List[int]) -> int:
n = len(A)
# swap[i]: minimum swap times to make A[:i], B[:i] increasing, with swap on A[i] and B[i]
# notSwap[i]: minimum swap times to make A[:i], B[:i] increasing, without swap on A[i] and B[i]
swap = [n] * n
... |
__version_info__ = __version__ = version = VERSION = '0.1.0'
def get_version():
return version
|
# Escreva um programa que pergunte a quantidade de KM percorridos por um carro alugado e a quantidade de dias pelos quais ele foi alugado. Calcule o preço a pagar, sabendo que o carro custa R$60 por dia e R$0,15 por KM rodado.
dias = int(input('Quantos dias alugados? '))
km = float(input('Quantos Km rodados? '))
pago =... |
# Challenge 39 Easy
# https://www.reddit.com/r/dailyprogrammer/comments/s6bas/4122012_challenge_39_easy/
# Takes parameter n
# Prints number on each line, except
# if n % 3, print Fizz, n % 5 Buzz, both, FizzBuzz
def nprint(n):
for i in range(1, n+1):
if i % 3 == 0 and i % 5 == 0:
prin... |
# Redis数据库地址
# REDIS_HOST = "localhost"
REDIS_HOST = "192.168.1.50"
# Redis端口
REDIS_PORT = 6379
# Redis密码,如无填None
REDIS_PASSWORD = "12345678"
# 产生器类,如扩展其他站点,请在此配置
GENERATOR_MAP = {
"weibo": "WeiboCookiesGenerator",
}
# 测试类,如扩展其他站点,请在此配置
TESTER_MAP = {
"weibo": "WeiboValidTester"
}
# 测试cookie是否可用的链接
TEST_UR... |
class PlayViewTickFeature:
def playv_tick(game):
if game.tile_at_player == None:
# skip graphics game.tick
return
if type(game.tile_at_player) == tuple:
if game.tile_at_player[1] == 'a':
# The player has encountered a cliff
game.ti... |
# Copyright 2012-2018 Ben Lambert
# 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... |
# coding: utf-8
class Config(object):
def __init__(self):
pass
def initialize(self):
pass
def exit(self):
pass
|
"""
Basic Insertionsort program.
"""
def insertion_sort(arr):
# Traverse through 1 to len(arr)
for i in range(1, len(arr)):
key = arr[i]
# Move element of arr[0...i-1], that are greater than key,
# to one position ahead of their current position
j = i - 1
while j >= 00 ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# instance configs
PRIMARY_OS = 'Ubuntu-16.04'
PRIMARY = '''#!/bin/sh
FQDN="{fqdn}"
export DEBIAN_FRONTEND=noninteractive
# locale
sudo locale-gen en_US.UTF-8
# hostname
hostnamectl set-hostname $FQDN
sed -i "1 c\\127.0.0.1 $FQDN localhost" /etc/hosts
# required packa... |
config = {
# +
# This is where you specify your dataset:
# whether it's CVS or MongoDB, the connect parameters, etc.
#
# To experiment with this, replace the CSV file with any dataset that you
# wish to analyze. Or point this to a MongoDB collection.
#
# This particular dataset contains... |
__author__ = 'Arseniy'
class Project:
def __init__(self, name="", description=""):
self.name = name
self.description = description
def __repr__(self):
return "%s; %s" % (self.name, self.description)
def __eq__(self, other):
return self.name == other.name
def name(se... |
class credentials:
'''
Class that generates new instances of credentials
'''
credentials_list = []
def __init__(self, user_name, password):
self.user_name = user_name
self.password = password
'''
__init__method that helps define properties for our objects.
... |
# Python implementation of puzzle 5
# Probably should add string ops to Lavender STL
def main(str):
seq = list(map(lambda x: int(x), str.split()))
count = 0
pos = 0
while pos >= 0 and pos < len(seq):
tmp = pos
pos += seq[pos]
seq[tmp] += 1
count += 1
return count
... |
text = type(type)
print(text)
|
"""
Faça um programa que pergunte a hora ao usuário e dê a ele uma saudação correspondente. (Bom dia: 0-11:00;
Boa tarde: 12-17; Boa noite: 18:00-23:00
"""
while True:
try:
hora_string = input("Que horas são? (hh:mm): ")
hora = int(hora_string.split(':')[0])
minuto = int(hora_string.split(':... |
#C1 = int(input())
#N1 = int(input())
#V1 = float(input())
#C2 = int(input())
#N2 = int(input())
#V2 = float(input())
#soma1 = N1 * V1
#soma2 = N2 * V2
#resultado = soma1 + soma2
#print('VALOR A PAGAR: R$ %.2f' % resultado)
linha = input().split()
C1 = int(linha[0])
N1 = int(linha[1])
V1 = float(linha[2])
linha2 ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Fundoshi documentation build configuration file, created by
# sphinx-quickstart on Mon Jun 8 12:59:17 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# a... |
class AccessingNonExistingUserError(Exception):
def __init__(self, uid):
self.message = (f"User with ID {uid} can not be accessed as this user",
" does not exist or is not registered")
super().__init__(self.message)
|
def get_count(queryset):
"""Determine an object count in optimized manner. Incompatible with custom values/distinct/group by"""
try:
return queryset.values('pk').order_by().count()
except (AttributeError, TypeError):
return len(queryset)
|
class Token:
"""
A simple token representation, keeping track of the token's text, offset in the passage it was
taken from, POS tag, dependency relation, and similar information. These fields match spacy's
exactly, so we can just use a spacy token for this.
Parameters
----------
text : ``s... |
# Copyright (c) 2019 AT&T Intellectual Property. 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 ... |
expected_output = {
1: {
"groupname": "2c",
"sec_model": "v1",
"contextname": "none",
"storage_type": "volatile",
"readview": "none",
"writeview": "none",
"notifyview": "*tv.FFFF58bf.eaFF58bf.eaFFFFFF.F",
"row_status": {"status": "active"},
},
... |
load(
"@ecosia_bazel_rules_nodejs_contrib//internal/nodejs_jest_test:test_sources_aspect.bzl",
"test_sources_aspect",
)
load("@build_bazel_rules_nodejs//internal/common:module_mappings.bzl", "module_mappings_runtime_aspect")
load("@build_bazel_rules_nodejs//internal/common:sources_aspect.bzl", "sources_aspect")... |
def day06a(input_path):
responses = [line.strip() for line in open(input_path)]
group_response = set()
total = 0
for response in responses:
if not response:
total += len(group_response)
group_response = set()
else:
group_response |= set(response)
... |
def exponentiation(a, n):
'''log(n) time exponentiation'''
if n == 0:
return 1
elif n % 2: # odd
return a*exponentiation(a, n-1)
else: # even
return exponentiation(a*a, n/2)
def test_one(a, n, res_exp):
an = exponentiation(a, n)
print("exponentiation(%d, %d) = %d" % (... |
print("Programa que identifica el tipo de dato de un valor ingresado por el usuario, se realizarán cinco interacciones:")
variable1 = input("Primera Interacción, ingrese un valor cualquiera:")
print("Este tipo de dato en Python es: ")
print(type(variable1))
variable2 = input("Segunda Interacción, ingrese un val... |
# Copyright (c) 2016, Quang-Nhat Hoang-Xuan
#
# 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... |
USER_AGENTS = [
(
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko)'
' Chrome/39.0.2171.95 Safari/537.36'
),
(
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)'
' Chrome/42.0.2311.135 Safari/537.36 Edge/12... |
def main():
print("Hello World!")
test()
pozdrav()
def test():
print("This is a test")
def pozdrav():
print("Hello")
if __name__ == '__main__':
main()
|
class Empty:
def __init__(self, *args, **kwargs):
pass
def __repr__(self):
return "Empty"
def __str__(self):
return "Empty" |
class SplitterCancelEventArgs(CancelEventArgs):
"""
Provides data for splitter events.
SplitterCancelEventArgs(mouseCursorX: int,mouseCursorY: int,splitX: int,splitY: int)
"""
@staticmethod
def __new__(self,mouseCursorX,mouseCursorY,splitX,splitY):
""" __new__(cls: type,mouseCursorX: int,mouseCurs... |
# -*- coding: utf-8 -*-
class drone:
def __init__(self, location, maximum_load):
self.location = location
self.maximum_load = maximum_load
productsOnBoard = list()
self.state = 0
self.alarm = 0
self.isBusy = False
def Load(self, warehouse, product):
if... |
class CTF:
def __init__(self, channel_id, name, long_name):
"""
An object representation of an ongoing CTF.
channel_id : The slack id for the associated channel
name : The name of the CTF
"""
self.channel_id = channel_id
self.name = name
self.challen... |
# date: 09/07/2020
# Description:
# Given a string, we want to remove 2 adjacent characters that are the same,
# and repeat the process with the new string until we can no longer perform the operation.
def remove_adjacent_dup(s):
finished = False
index = 0
while not finished:
if s[index+1]=... |
# -*- coding: utf-8 -*-
# 定义操作指令
STOP = 0x0000
LEFT = 0x0001
RIGHT = 0x0010
FORWARD = 0x0100
BACKWARD = 0x1000
SHUTDOWN = 0x1111
SERVER_HOST = "0.0.0.0"
PI_HOST = "172.17.11.169"
COMPUTER_HOST = "172.17.11.102"
VIDEO_STREAMING_PORT = 8000
KEYBOARD_PORT = 8001
# 设定摄像头拍摄的图像大小
RESOLUTION = (640, 480)
IMAG... |
wtf = list(range(1000))
for i in range(len(wtf)):
wtf[i] = 2
print(wtf) |
#!/usr/bin/env python3
########################################################################
# #
# Program purpose: Program to check the priority of the four #
# operators (+, -, *, /) #
# ... |
par = []
impar = []
cont = 0
im = 0
p = 0
while cont < 15:
num = int(input())
if num % 2 == 0:
par.append(num)
p += 1
else:
impar.append(num)
im += 1
if p > 4:
for i in range(5):
print(f'par[{i}] = {par[i]}')
par = []
p = 0
if im > ... |
#==================================================================================================
# python_scripts/set_state.py
# modified from - https://community.home-assistant.io/t/how-to-manually-set-state-value-of-sensor/43975/37
#===============================================================================... |
string1 = "Devops"
string2 = "Project"
joined_string = string1 +' '+ string2 ## Add space between two strings
print(joined_string)
|
num = 2 ** 1000
num = list(str(num))
total = 0
for i in num:
total += int(i)
print(total)
|
#desafio 25: procurando uma string dentro de outra // verifica se o nome tem SILVA
nome = str(input('Digite seu nome completo: ')).strip().upper()
print('^'*30)
print(f'\33[34mSeu nome tem Silva? {"SILVA" in nome}\33[m')
print('^'*30)
|
# part one
lines = open('input.txt', 'r').readlines()
gammaRate = ""
for pos in range(len(lines[0].strip())):
oneCount = len([p for p in lines if p[pos] == "1"])
gammaRate += "1" if 2 * oneCount > len(lines) else "0"
print(int(gammaRate, 2) * int(gammaRate.replace("1", "#").replace("0", "1").replace("#", "0"),... |
def network():
model = tf.keras.Sequential()
model.add(kl.InputLayer(input_shape=(224, 224, 3)))
# First conv block
model.add(kl.Conv2D(filters=96, kernel_size=7, padding='same', strides=2))
model.add(tf.keras.layers.ReLU())
model.add(kl.MaxPooling2D(pool_size=(3, 3)))
# Second conv block
... |
"""
You are given a binary tree.
Write a function that can return the inorder traversal of node values.
Example:
Input:
3
\
1
/
5
Output: [3,5,1]
"""
# Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left =... |
src = []
component = aos_component('osal', src)
component.add_global_includes('mico/include', 'include')
component.add_comp_deps("middleware/alink/cloud")
if aos_global_config.arch == 'ARM968E-S':
component.add_cflags('-marm')
@pre_config('osal')
def osal_pre(comp):
osal = aos_global_config.get('osal', 'rhin... |
#
# PySNMP MIB module TRAPEZE-NETWORKS-BASIC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TRAPEZE-NETWORKS-BASIC-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:27:11 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version ... |
class TextVectorizationResponse:
"""
Stores the BOW-encodings and (padded or aggregated e.g. averaged) embeddings for text.
"""
def __init__(self, tokens_bow_encoded, tokens_aggregated_embedding, tokens_embeddings_padded):
self.tokens_bow_encoded = tokens_bow_encoded
self.tokens_aggrega... |
# date: 01/07/2020
# Description:
# A Perfect Number is a positive integer
# that is equal to the sum of all its
# positive divisors except itself.
class Solution(object):
def checkPerfectNumber(self, num):
if num <= 0:
return False,[]
divisors = []
for i in range(1,... |
# GCD
def gcd(a, b):
while(b != 0):
t = a
a = b
b = t % b
return a
def main():
print(gcd(60, 96))
print(gcd(20, 8))
if __name__ == "__main__":
main() |
n=input()
r=0
for i in range(1, 2**9+1):
r+=(int(bin(i)[2:]) <= int(n))
print(r)
|
def run(coro):
try:
coro.send(None)
except StopIteration as e:
return e.value
async def coro():
print('coro')
class AContextManager():
async def __aenter__(self):
print('Entering')
await coro()
return self
async def __aexit__(self, ty, val, tb):
pri... |
#!/usr/bin/env python
with open("my_new_file.txt", "a") as f:
f.write('something else\n')
|
"""
Created on Mar 2, 2012
@author: Alex Hansen
"""
parse_line = "13C - Pure In-phase Carbon CEST"
description = """\
Analyzes 13C chemical exchange in the presence of 1H composite decoupling during
the CEST block. This keeps the spin system purely in-phase throughout, and is
calculated using the 6x6, single spin m... |
# Copyright Rein Halbersma 2018-2021.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# http://forum.stratego.com/topic/357378-strategy-question-findingavoiding-bombs-at-the-end-of-games/?p=432... |
class TreeNode:
def __init__(self, data, left=None, right=None):
self.data = data
self.left = left
self.right = right
def __str__(self):
fmt = 'TreeNode(data={}, left={}, right={})'
return fmt.format(self.data, self.left, self.right)
class BinarySearchTree:
def _... |
##CONFIG##
##Leave it for blank if you don't want to include data from that source
#Ether addresses that you'd like to watch. Input them as a list if there're more than one address.
#E.g.: addresses = ['0xad2a6d5890c06083c340d723053b4040a28580ef', '0x214d0bb2b260b22b1498977200c1a32bdb75131b']
addresses = []
#Get thi... |
# 79
# Crie um programa onde o usuário possa digitar vários valores numéricos e cadastre-os em uma lista. Caso o número já exista lá dentro, ele não será adicionado. No final, serão exibidos todos os valores únicos digitados, em ordem crescente.
lista = list()
while True:
num = int(input('Digite um valor: '))
... |
potential_list = [[1,1],[1,0],[-1,0],[0,-1],[-3,1]]
print(potential_list)
for item1,item2 in potential_list:
if item2 <= 0:
potential_list.remove([item1,item2])
for item1,item2 in potential_list:
if item1 <= 0:
potential_list.remove([item1,item2])
print(potential_list) |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: __init__.py
# -------------------
# Divine Oasis
# Text Based RPG Game
# By wsngamerz
# -------------------
__author__ = "wsngamerz"
__version__ = "0.0.1 ALPHA 1"
|
# -*- coding:utf-8 -*-
# https://leetcode.com/problems/minimum-window-substring/description/
class Solution(object):
def minWindow(self, s, t):
"""
:type s: str
:type t: str
:rtype: str
"""
wi, wj = None, None
ds, dt = {}, {}
for c in t:
d... |
print(1,2,3)
|
geo, par, val,override = IN
setPreviously = False
try:
tags = geo.Tags
if tags.LookupTag(par) is None or override:
tags.AddTag(par, val)
except ValueError:
setPreviously = True
OUT = IN[0], setPreviously |
def beautify_fill(angle_limit=3.14159):
'''Rearrange some faces to try to get less degenerated geometry
:param angle_limit: Max Angle, Angle limit
:type angle_limit: float in [0, 3.14159], (optional)
'''
pass
def bevel(offset_type='OFFSET',
offset=0.0,
segments=1,
... |
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
# def bstFromPreorder(self, preorder):
# if not preorder:
# return None
# preorder.sort()
# root = self.generator(1, preorder)
# return root... |
def sum_mul(n, m):
sumu = 0
if n > 0 and m > 0:
for i in range(n, m):
if (i % n == 0):
sumu += i
else:
return 'INVALID'
return sumu |
string = 'some text'
print(string)
print(id(string))
print('Run fuction, then print string and it\'s id again without using the function')
def changeString():
string = 'changed'
print(string)
print(id(string))
changeString()
print(string)
print(id(string))
print('(Redeclaring function)')
print('Run fuctio... |
for letter in 'Python':
if letter == 'h':
pass
print("This is Pass Block")
print("Current letter", letter)
print("Good Job") |
# https://leetcode.com/explore/challenge/card/august-leetcoding-challenge/551/week-3-august-15th-august-21st/3430/
'''
13 / 13 test cases passed. Status: Accepted
Runtime: 108 ms
Memory Usage: 23.3 MB
Your runtime beats 50.00 % of python3 submissions.
Your memory usage beats 28.30 % of python3 submis... |
### building a more advance calculator with python
num1 = float(input("Enter first number: "))
op = input("Enter operator: ")
num2 = float(input("Enter second number: "))
if op == "+":
print(num1 + num2)
elif op == "-":
print(num1 - num2)
elif op == "*":
print(num1 * num2)
elif op == "/":
... |
# link: https://leetcode.com/problems/find-all-the-lonely-nodes/
# find all lonely nodes
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution(object):
d... |
print("FINDING ROOTS OF A QUADRATIC EQUATION\n\n")
print("Any general quadratic equation will be of the form 'ax^2+bx+c=0', \ntherefore state values...")
a=int(input("\tcoefficient of x^2, a= "))
b=int(input("\tcoefficient of x, b= "))
c=int(input("\tconstant, c= "))
x=(b**2)-4*a*c
if(x==0):
print("\nThe roo... |
dysk = set()
with open(
r"D:\_MACIEK_\python_proby\skany_fabianki\lista_P.txt", "r"
) as listadysk:
for line in listadysk:
dysk.add(line)
with open(
r"D:\_MACIEK_\python_proby\skany_fabianki\lista_dysk.txt", "r"
) as listaP:
for line in listaP:
if line not in dysk:
with ope... |
# initial configurations
PORT=33000
HOST="0.0.0.0"
|
#
# PySNMP MIB module NAI-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NAI-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:22:50 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)... |
# Checking if a binary tree is a perfect binary tree in Python
class newNode:
def __init__(self, k):
self.key = k
self.right = self.left = None
# Calculate the depth
def calculateDepth(node):
d = 0
while node is not None:
d += 1
node = node.left
return ... |
def set_salestax(request, tax_type, tax_total):
"""
Stores the tax type and total in the session.
"""
request.session["tax_type"] = tax_type
request.session["tax_total"] = tax_total
|
# print("Please choose your option from the list below:")
# print("1:\tLearn Python")
# print("2:\tLearn Java")
# print("3:\tGo swimming")
# print("4:\tHave dinner")
# print("5:\tGo to bed")
# print("0:\tExit")
choice = "-"
while choice != "0":
# while True:
# choice = input()
# if choice == "0":
# bre... |
# Leia uma frase e descubra quantos caracteres existem nesta frase.
# Implemente uma função chamada contaCaracter().
def contaCaracter(str):
return len(str)
print(contaCaracter(input()))
|
# -*- coding: utf-8 -*-
{
'name': "cheques",
'summary': """
Administracion de cheques""",
'description': """
Lógica de negocio en el manejo de cheques.
En cheques propios y de terceros.
Cheques propios.
* Tipos de cheques (cheque común, diferidos, Cheque Cancela... |
k = int(input())
chess = 'W'
empty = '.'
neighbour = [[0, -1], [0, 1], [1, 0], [-1, 0],[1,-1],[1,1],[-1,-1],[-1,1]]
def dfs(r, c, area, visited):
mianji = 1
visited[r][c] = 1
stack = []
stack.append([r, c])
while len(stack) != 0:
x, y = stack.pop()
for dx, dy in neighbour:
... |
r_result_json = {
'result': [{
'dst_is_ip':
'false',
'src_is_ip':
'true',
'dst_list':
'seclist:/Compute-587626604/mayurnath.gokare@oracle.com/paas/SOA/gc3ntagrogr605/lb/ora_otd_infraadmin',
'name':
'/Compute-587626604/mayurnath.gokare@o... |
# SPDX-License-Identifier: MIT
# Copyright (c) 2020 Akumatic
#
#https://adventofcode.com/2020/day/13
def readFile() -> tuple:
with open(f"{__file__.rstrip('code.py')}input.txt", "r") as f:
timestamp = int(f.readline().strip())
values = f.readline().strip().split(",")
bus_ids = [{"value": in... |
class File:
def __init__(self, code: str, name: str, ast):
self.lines = code.splitlines()
self.name = name
self.ast = ast
def line(self, number):
return self.lines[number]
|
"""
Pharos.Model.laser._skeleton.py
==================================
.. note:: **IMPORTANT** Whatever new function is implemented in a specific model, it should be first declared in the
laserBase class. In this way the other models will have access to the method and the program will keep running... |
#!/usr/bin/env python3
def validate_iso8601(ts):
"""Check validity of a timestamp in ISO 8601 format."""
digits = [0, 1, 2, 3, 5, 6, 8, 9, 11, 12, 14, 15, 17, 18, 20, 21, 22]
try:
assert len(ts) == 24
assert all([ts[i].isdigit() for i in digits])
assert int(ts[5:7]) <= 12
a... |
class LogicStringUtil:
@staticmethod
def getBytes(string):
return string.encode()
@staticmethod
def getByteLength(string):
return len(string)
|
# MIT License
#
# Copyright (c) 2017 Changsung
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, pu... |
_a = request.application
response.logo = A(B('KVASIR'), _class="brand")
response.title = settings.title
response.subtitle = settings.subtitle
response.meta.author = '%s <%s>' % (settings.author, settings.author_email)
response.meta.keywords = settings.keywords
response.meta.description = settings.description
response... |
# -*- coding: utf_8 -*-
__author__ = 'Yagg'
class Bombing:
def __init__(self, attackerName, defenderName, planetNum, planetName, population, industry, production, capitals,
materials, colonists, attackStrength, status):
self.attackerName = attackerName
self.defenderName = defenderN... |
def is_cpf(cpf):
# Obtém apenas os números do CPF, ignorando pontuações
numbers = [int(digit) for digit in cpf if digit.isdigit()]
# Verifica se o CPF possui 11 números:
if len(numbers) != 11:
return False
# Verifica se todos os números são repetidos
if len(list(dict.fromkeys(numbers))... |
def gcd(a, b):
if b == 0:
return a
return gcd(b, a%b)
for _ in range(int(input())):
a, b = map(int, input().split())
print(gcd(a, b)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.