content stringlengths 7 1.05M |
|---|
RADIANCE_CHANNELS = [
'S1_radiance_an',
'S2_radiance_an',
'S3_radiance_an',
'S4_radiance_an',
'S5_radiance_an',
'S6_radiance_an'
]
REFLECTANCE_CHANNELS = [
'S{}_reflectance_an'.format(i) for i in range(
1, 7)]
BT_CHANNELS = [
'S7_BT_in',
'S8_BT_in',
'S9_BT_in'
]
IMG_CH... |
# CADASTRÃO GERAL
"""Lê, para várias pessoas: nome, sexo, idade. Os dados de cada usuário
ficam em um dicionário e todos os dicionários ficam numa lista. Ao final:
i) quantas pessoas foram cadastradas
ii) a média de idade do grupo
iii) uma lista com todas as mulheres
iv) uma lista com todas as pessoas c/ idade > mé... |
def compute_toxin_accuracy(file_name):
total = 0
hit = 0
for line in open(file_name):
line = line.strip()
total += 1
if 'illegal' in line:
hit += 1
print(hit, total, hit/total)
def compute_trigger_accuracy(file_name):
total = 0
hit = 0
for line in open... |
i, j = 1, 60
while j >= 0:
print('I={} J={}'.format(i, j))
i += 3
j -= 5
|
input_str = """
cut -135
deal with increment 38
deal into new stack
deal with increment 29
cut 120
deal with increment 30
deal into new stack
cut -7198
deal into new stack
deal with increment 59
cut -8217
deal with increment 75
cut 4868
deal with increment 29
cut 4871
deal with increment 2
deal into new stack
deal wit... |
'''
Scraper for site http://www.ssp.gob.mx/extraviadosWeb/portals/extraviados.portal
'''
|
#!/usr/bin/env python
data = []
aux = []
minimum = 999999
def push(e):
global data
global aux
global minimum
data.append(e)
if e < minimum:
aux.append(e)
minimum = e
else:
aux.append(minimum)
return
def pop():
global data
global aux
global minimum
... |
#!/usr/bin/env python
#
# File: $Id$
#
"""
Various global constants.
"""
# system imports
#
# Here we set the list of defined system flags (flags that may be set on a
# message) and the subset of those flags that may not be set by a user.
#
SYSTEM_FLAGS = (r"\Answered", r"\Deleted", r"\Draft", r"\Flagged", r"\Recent... |
# entrada
entrance = input()
# extrair valores de x e y
v = entrance.split(' ')
X = float(v[0])
Y = float(v[1])
# condições para descobrir quadrante
if (X == 0) and (Y == 0):
print('Origem')
elif (X > 0) and (Y > 0):
print('Q1')
elif (X > 0) and (Y < 0):
print('Q4')
elif (X < 0) and (... |
def definition():
sql = """
(
@acad_year int,
@period int,
@start DATE,
@end DATE
)
RETURNS float
AS_BREAK
BEGIN
-- Declare the return variable here
DECLARE @result float
-- Declare month start and end
DECLARE @pstart DATE
DECLARE @pdays float
DECLARE @pend DATE
SET @pstart = DATEADD(MONTH,@period, D... |
#
# PySNMP MIB module CISCO-LWAPP-RF-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-LWAPP-RF-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:49:16 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... |
#{
# city1: [(neighbor_city, dist), ...],
# city2: ...
#}
cities = {
'Bucharest': [
('Urzineci',85),
('Giurgiu',90),
('Pitesti',101),
('Fagaras',211)
],
'Giurgiu': [
('Bucharest',90)
],
'Urzineci': [
('Bucharest',85),
('Hirsova',98),
... |
FIRST_QUESTIONS = {
"en": "Hi, how are you?",
"de": "Hallo, wie geht es dir?",
"pt-br": "Oi como você está?",
"he": "היי מה קורה?",
}
TERMINATES = {
"en": "quit",
"de": "ende",
"pt-br": "sair",
"he": "זהו"
}
LANGUAGE_SUPPORT = ["en", "de", "pt-br","he"]
|
HDF5_EXTENSION = "hdf5"
HDF_SEPARATOR = "/"
MODEL_SUBFOLDER = "MODEL"
CLASS_WEIGHT_FILE = "class_weights.json"
TRAIN_DS_NAME = "train"
VALIDATION_DS_NAME = "validation"
TEST_DS_NAME = "test"
# Used to determine whether a dataset can safely fit into
# The available memory
MEM_SAFETY_FACTOR = 1.05
# this constant is us... |
# SPDX-License-Identifier: MIT
# Copyright (c) 2021 ETH Zurich, Luc Grosheintz-Laval
def _split_timedelta(t):
days = t.days
hours, seconds = divmod(t.seconds, 3600)
minutes, seconds = divmod(seconds, 60)
return days, hours, minutes, seconds
def hhmm(t):
days, hours, minutes, _ = _split_timedelt... |
# Static data class for vortex vanquisher
class VortexVanquisher:
level = 90
refinementLevel = 1
name = "Vortex Vanquisher"
# Base stat values
baseATK = 608
atkPercent = 0.496
# Passive values
stackCount = 5
atkPercent = 2 * 0.04 * stackCount # Assuming shield is up at all times
|
#
# PySNMP MIB module APRADIUS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/APRADIUS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:08:27 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,... |
class GTException(Exception):
"""
Base exception for GTbot-related errors.
"""
pass
class SilentError(GTException):
"""
An error was already handled and should be silent,
but still propagate and cancel the stack call.
"""
pass
class NotFound(GTException):
... |
scripts_to_script_start = {
0: "Common",
32: "Common",
33: "Common",
36: "Common",
37: "Common",
40: "Common",
41: "Common",
42: "Common",
43: "Common",
44: "Common",
45: "Common",
46: "Common",
48: "Common",
58: "Common",
60: "Common",
63: "Common",
6... |
def on_on_chat():
builder.move(LEFT, 5)
builder.mark()
for index in range(4):
builder.move(FORWARD, 10)
builder.turn(LEFT_TURN)
builder.trace_path(SPRUCE_FENCE)
player.on_chat("fenceBoundary", on_on_chat)
|
class Node:
def __init__(self, key):
self.data = key
self.left = None
self.right = None
def printLevelOrder(root):
h = height(root)
for i in range(1, h + 1):
printCurrentLevel(root, i)
def printCurrentLevel(root, level):
if(root == None):
return
if(leve... |
def computeCI(principal, roi, time):
ci = (principal*pow((1+(roi/100)), time))-principal
return round(ci, 2)
|
def prime(n):
k=0
if n==1:
return False
for i in range(2,n):
if n%i==0:
k=1
if k==0:
return True
else:
return False
r=1000
y=0
c=0
d=0
for a in range(-r,r):
for b in range(r):
if prime(b) and (b<y or b<-1600-40*a):
... |
def my_decorator(func):
def wrap_func(*args, **kwargs):
print('*'*10) #Before
func(*args, **kwargs) # not function yet
print('*'*10) #After
return wrap_func
# find_all('div', attrs = {'class':'dfddfddf'})
# OOP
@my_decorator
def hello(name, emoji = ':)'):
print(f'hello {name}', emo... |
PDF_EXT = ".pdf"
HD5_EXT = ".hd5"
XML_EXT = ".xml"
MUSE_ECG_XML_MRN_COLUMN = "PatientID"
ECG_PREFIX = "ecg"
ECG_DATE_FORMAT = "%m-%d-%Y"
ECG_TIME_FORMAT = "%H:%M:%S"
ECG_DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%S"
|
# -*- coding: utf-8 -*-
"""
gagepy.webservices
~~~~~~~~~~~~~~~~~~
Classes that handle retrieving data files from the web.
.. note::
Please see the USGS information on webservices - http://nwis.waterdata.usgs.gov/nwis/?automated_retrieval_info
:authors: 2016 by Jeremiah Lant, see AUTHORS
... |
# The tile index was made by navigating to ftp://ftp.kymartian.ky.gov/kyaped/LAZ
# and then (in firefox) right click -> view page source. This produces a text
# file with all lots of information, but primarily there is a column with all
# the tile names. This can be used to setup a parallel download which can
# drast... |
total = 0
produto = 0
cont = 0
sem = 0
resp = ' '
barato =''
while resp not in 'N':
nome = str(input('Digite o nome: '))
preço = float(input('Digite o valor: '))
cont += 1
total += preço
if preço >= 1000:
produto += 1
if cont == 1 or preço < sem:
menor = preço
barato =nom... |
class ansi_breakpoint:
def __init__(self, sync_obj, label):
self.sync_obj = sync_obj
self.label = label
def stop(self):
self.sync_obj.continue_runner_with_stop(self.label) |
class Node:
def __init__(self):
self.data = None
self.next = None
def setData(self,data):
self.data = data
def getData(self):
return self.data
def setNext(self,next):
self.next = next
def getNext(self):
return self.next
class ... |
year_input = int(input())
def is_leap_year(year):
if year % 4 == 0:
return True
else:
return False
if is_leap_year(year_input):
print('%.f is a leap year' % year_input)
else:
print('%.f is not a leap year' % year_input)
|
class Restaurant:
def __init__(self, name, cuisine_type):
self.name = name
self.cuisine_type = cuisine_type
self.number_served = 0
def describe_restaurant(self):
print('The name of the Restaurant is {} and it makes {}'.format(self.name, self.cuisine_type))
def o... |
__all__ = [
'confirm_delivery_reports_as_received_request_1',
'confirm_delivery_reports_as_received_request',
'check_delivery_reports_response',
'confirm_replies_as_received_request_1',
'confirm_replies_as_received_request',
'vendor_account_id',
'check_replies_response',
'cancel_s... |
#!/usr/bin/env python3
"""
l0m1s
lukes1582@gmail.com
algoritmo selection sort sviluppato per Python
"""
arr = [5,4,3,1,2,11,9,8,0]
print("Array in origine ")
print(arr)
print ("Lunghezza dell'array "+ str(len(arr)))
print(50*"x")
for i in range(len(arr)):
min_idx = i
for j in range(i+1, len(a... |
class ServiceError(Exception):
def __init__(self, service, message=""):
self.service = service
self.message = message
def __str__(self):
return f"ServiceError has been raised in {self.service}\n{self.message}"
class ValidationError(Exception):
def __init__(self, message=""):
... |
# Copyright (c) 2010 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,
'javascript_engine': 0
},
'targets': [
{
'target_name': 'net_base',
'type': '<(library... |
# findsimilarindex: for a given word and a list of words
# return either the index, where the word occurs, e.g. "Apfel" occurs in ["Banane","Kaese","Apfel","Birne"]
# at index 2.
# OR: find the index of the most similar word:
# e.g. most similar word to "Apfel" occurs for given list ["Banane","Apfelsine","Kakao","Birn... |
"""
Tool.
Example tool.
"""
__version__ = "1.2.3"
|
"""
从101-200有多少个素数,输出全部素数
"""
def get_answer():
"""
素数: 只能被1和他本身整除的数
还是嵌套循环问题,首先循环 101 -200
再嵌套循环 每次从2到被循环的数字有没有可以整除的,如果有说明这个数字不符合要求,结束循环
"""
for i in range(101, 200):
temp = True
for j in range(2, i):
if i % j == 0:
temp = False
brea... |
# prefix
class Prefix:
w_prefix = "w_"
b_prefix = "b_"
tmp_w_prefix = "tmp_w_"
tmp_b_prefix = "tmp_b_"
w_b_prefix = "w_b_"
tmp_w_b_prefix = "tmp_w_b_"
w_grad_prefix = "w_g_"
b_grad_prefix = "b_g_"
tmp_w_grad_prefix = "tmp_w_g_"
tmp_b_grad_prefix = "tmp_b_g_"
w_b_grad_pre... |
class Solution:
def numWays(self, n, k):
"""
:type n: int
:type k: int
:rtype: int
"""
if n == 0:
return 0
elif n == 1:
return k
# for the first 2 posts
sameColor = k
diffColor = k * (k - 1)
for i in ra... |
file_name = r"Sample compilation -portuguese_char_frequency.txt"
with open(file_name, 'rt', encoding='utf-8') as file:
data_input = file.read()
# get the frebquency (in %) for unique characters
lenght = len(data_input)
freq_chars = sorted([[100 * data_input.count(character)/lenght, character] for character i... |
"""
Dado el valor de un producto, ingresando el valor por el teclado,
hallar el IGV(18%) y el precio de venta
"""
#variables
vv = None
igv = None
pv = None
# Entrada
vv = float(input("Ingrese el valor de venta: "))
# Operaciones
igv = vv *0.18
pv = vv + igv
#Salida
print("El IGV es: ",igv)
prin... |
"""
每K个一组反转单向链表
http://www.panzhixiang.cn/article/2021/6/21/25.html
"""
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
## laluladong 解法(迭代)
# def reverse(self, head: ListNode, tail: ListNode) -> List... |
"""Given a stack, sort it using recursion. Use of any loop constructs like while, for..etc is not allowed. We can only use the following ADT
functions on Stack S:
is_empty(S) : Tests whether stack is empty or not.
push(S) : Adds new element to the stack.
pop(S) : Removes top element from the stack.
to... |
def sam2fq(sam_in_dir,fq_out_dir):
fi=open(sam_in_dir)
fo=open(fq_out_dir,'w')
for line in fi:
seq=line.rstrip().split('\t')
if line[0] !='@':
# if len(bin(int(seq[1])))>=9 and bin(int(seq[1]))[-7]=='1':
# seq[0]=seq[0][0:-2]+'_1'
# elif len(bin(int(seq[1])))>=10 and bin(int(seq[1]))[-8]=='1':
# seq[0... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def reverseList(self, head: ListNode) -> ListNode:
# base case
if(head == None or head.next == None): return head;
curre... |
def generate_errors(errors, f):
f.write('_captures = {\n')
for error in errors:
if error.capture_name:
f.write(f" {error.canonical_name!r}: {error.capture_name!r},\n")
f.write('}\n')
f.write('\n\n_descriptions = {\n')
for error in errors:
if error.description:
... |
"""
Leetcode #9
"""
class Solution:
def isPalindrome(self, x: int) -> bool:
if x < 0:
return False
if x >= 0 and x < 10:
return True
tmp = x
y = 0
while tmp > 0:
t = tmp % 10
y = 10*y + t
tmp = tmp // 10
... |
listaidademenorde18 = []
listaidademaiorde18 = []
while True:
try:
idade = int(input('Digite a idade da pessoa: '))
break
except ValueError:
pass
if idade < 18:
listaidademenorde18.append(idade)
else:
listaidademaiorde18.append(idade)
print(listaidademenorde18)
print(listaidademaior... |
"""
Python program to reverse a number.
The reverse of a number is a number that is obtained when a number is traversed from right to left.
"""
# Function to do reverse
def reverse(n):
# Initializing rev as 0
rev = 0
while True:
if n == 0:
break
# Adding the last digit
... |
# model settings
model = dict(
type='SwAV',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(3,), # no conv-1, x-1: stage-x
norm_cfg=dict(type='SyncBN'),
style='pytorch'),
neck=dict(
type='SwAVNeck',
in_channels=2048, hid_cha... |
"""
@author Huaze Shen
@date 2019-10-27
"""
def restore_ip_addresses(s):
results = []
restore(results, s, "", 4)
return results
def restore(results, remain, result, k):
if k == 0:
if len(remain) == 0:
results.append(result)
else:
for i in range(1, 4):
if l... |
# Time: O(n)
# Space: O(n)
# tree
class Solution(object):
def createBinaryTree(self, descriptions):
"""
:type descriptions: List[List[int]]
:rtype: Optional[TreeNode]
"""
nodes = {}
children = set()
for p, c, l in descriptions:
parent = nodes.set... |
#!/usr/bin/env python3
#this program will write
#Hello World!
print("Hello World!") #prints Hello World!
#homework section of the file
print("My name is Zac (He/Him). If you want to be more formal, you can use Zachary.") #Prints out my name, pronouns, and formalities
|
QUERY_INFO = {
"msmarco-passage-dev-subset-tct_colbert": {
"description": "MS MARCO passage dev set queries encoded by TCT-ColBERT",
"urls": [
"https://www.dropbox.com/s/g7sci7n15mekbut/query-embedding-msmarco-passage-dev-subset-20210115-cd5034.tar.gz?dl=1",
],
"md5": "0e... |
"""
This file contains settings parameters which shouldn't be committed to a public repository such as GitHub.
Unlike other code files, this file is not managed by git.
It will be read into settings at runtime.
Use this as an example to make a 'secrets.py' file in your project directory (beside settings.py).
"""
def... |
# Approach 1: Merge intervals
# Step 1: create a list of tuples/intervals with opening/closing positions, e.g. (open_index, close_index)
# Step 2: merge the list of intervals (see https://leetcode.com/problems/merge-intervals/)
# Step 3: go through the merged interval list and insert the tags into the string
clas... |
a,b,c=[int(x) for x in input().split()]
n=int(input())
k=0
m=(10**9)+7
A=[0]*n
B=[0]*n
A[0]=(a*c)%m
for i in range(1,n):
A[i]=A[i-1]*((((a*b)%m)*c)%m) + A[i-1]*((a*b)%m) + A[i-1]*((a*c)%m)
A[i]=A[i]%m
B[0]=(b*c)%m
for i in range(1,n):
B[i]=B[i-1]*((((a*b)%m)*c)%m) + B[i-1]*((a*b)%m) + B[i-1]*((a*c)%m)
B[i]=B[i]%m
... |
#
# PySNMP MIB module HUAWEI-WLAN-QOS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-WLAN-QOS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:49:48 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... |
def polishNotation(tokens):
def isNumber(stringRepresentation):
return (len(stringRepresentation) > 1 or
'0' <= stringRepresentation[0] and
stringRepresentation[0] <= '9')
stack = []
for i in range(len(tokens)):
stack.append(tokens[i])
while (len(stack) ... |
__author__ = 'godq'
class BaseDagRepo:
def add_dag(self, dag_name, content):
raise NotImplemented
def update_dag(self, dag_name, content):
raise NotImplemented
def delete_dag(self, dag_name):
raise NotImplemented
def find_dag(self, dag_name):
raise NotI... |
load("//flatbuffers/toolchain_defs:toolchain_defs.bzl", "toolchain_target_for_repo")
CC_LANG_REPO = "rules_flatbuffers_cc_toolchain"
CC_LANG_TOOLCHAIN = toolchain_target_for_repo(CC_LANG_REPO)
CC_LANG_SHORTNAME = "cc"
CC_LANG_DEFAULT_RUNTIME = "@com_github_google_flatbuffers//:flatbuffers"
CC_LANG_FLATC_ARGS = [
"... |
def is_anagram(word, another_word):
word = list(tuple(word))
word.sort()
another_word = list(tuple(another_word))
another_word.sort()
return word == another_word
def main():
words = []
new_words = []
anagrams = []
print("***** Anagram Finder *****")
word = input("Enter a wor... |
#Refaça o DESAFIO 035 dos triângulos, acrescentando o recurso de mostrar que tipo de triângulo será formado:
#- EQUILÁTERO: todos os lados iguais
#- ISÓSCELES: dois lados iguais, um diferente
#- ESCALENO: todos os lados diferentes
print('\033[1;4;34m=*'*100, 'Criando um Triângulo ', '=*\033[m'*100)
a = float(input('... |
# coding: utf8
# Author: Wing Yung Chan (~wy)
# Date: 2017
def palindrome(n):
j = str(n)
for i in range(len(j)//2):
if j[i] != j[len(j)-1-i]:
return False
return True
def problem4():
# Try all 3 digit pairs
# Got to be careful with how you iterate
# Need to create a Zig... |
class Records:
"""
please enter your name, age,height in cm and weight in kg
"""
def __init__(self,name,gender,age,height,weight):
self.gender=gender
self.height=height
self.weight=weight
self.name=name
self.age=age
self.bmi_range="n"
de... |
TEST_RECORD_1 = {
"Vendor": "Forcepoint CASB",
"Product": "SaaS Security Gateway",
"Version": "1.0",
"SignatureID": "250677275138",
"Name": "login",
"Severity": "9",
"CEFVersion": "0",
"act": "Block",
"app": "Office Apps",
"cat": "Block Access to personal Office365/Block Access t... |
"""
Description:
Author: Jiaqi Gu (jqgu@utexas.edu)
Date: 2021-06-09 00:15:14
LastEditors: Jiaqi Gu (jqgu@utexas.edu)
LastEditTime: 2021-06-09 00:15:14
"""
|
altura = float(input('Digite sua altura: '))
peso = (72.7 * altura) - 58
print(f'\nSeu peso ideal é {peso}.')
|
class Solution:
def rob(self, nums) -> int:
return max(self.helper(nums, 0, len(nums) - 2), self.helper(nums, 1, len(nums) - 1))
def helper(self, nums, start, end):
include = 0
exclude = 0
for i in range(start, end + 1):
i = exclude
i = nums[i] + i
... |
# 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 H2database(MavenPackage):
"""H2 is an embeddable RDBMS written in Java."""
homepage = "https://h2database.... |
BOTS = [
{
"name": "bot1",
"username": "username",
"password": "password",
"api_key": "111AA1111AAAA11A1A11AA1AA1AAA111",
"secrets": {
"steamid": "76511111111111111",
"shared_secret": "Aa11aA1+1aa1aAa1a=",
"identity_secret": "aA11aaaa/aa11a... |
class strategyLogic():
def SMA(self, prices, length, period):
return sum(prices[(length-period):length]) / period
def SMAprev(self, prices, length, period):
return sum(prices[(length-period-1):length-1]) / period
|
class KFeatures:
"""
新产生的k线,已有的两根k线,原有最后一根k线不能确定是否形成分型
"""
def __init__(self, datetime, high, low):
self.datetime = datetime
self.high = high
self.low = low
self.trend = None
self.fx_type = None
class Segment:
"""
新产生的分型线,已有的两个线段极值点,原有最后一个极值点不能确定是否线段结束
... |
def Draw(update=True):
global WreckContainer, ShipContainer, PlanetContainer, Frames, frozen_surface
if GamePaused and update:
if not frozen_surface:
Text = Font.render("Game paused...", True, (255, 255, 255))
Surface.blit(Text, (40, 80))
frozen_surface = Surface.copy... |
"""Faça um Programa que verifique se uma letra digitada é vogal ou consoante"""
l = str(input('Digite uma letra: ').upper().strip())
if l in 'AEIOU':
print(f'A letra {l} é uma vogal.')
else:
print(f'{l} não é vogal')
|
'''
For this Kata you will have to forget how to add two numbers together.
The best explanation on what to do for this kata is this meme :
https://i.ibb.co/Y01rMJR/caf.png
In simple terms our method does not like the principle of carrying over numbers and just writes down every number it calculates.
You may assume ... |
# Copyright 2018 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... |
def ExportResults(aggr):
results = []
for topic in aggr.topics:
if len(aggr.topics[topic]) > 1:
temp_links = []
temp_plaintexts = []
for idx in aggr.topics[topic]:
if aggr.articles[idx].metadata["plaintext"] not in temp_plaintexts:
... |
class property(object):
def __init__(self, *args):
int = ___id("%int")
length = ___delta("tuple-len", args, int)
self.fget = None
self.fset = None
self.fdel = None
if length > 0:
self.fget = args[0]
if length > 1:
self.fset = args[1]
if length > 2:
self.fdel = args[2]... |
JUDGE_LANG_C = 1 # C
JUDGE_LANG_CPP = 2 # C++
JUDGE_LANG_PYTHON = 3 # Python/PyPy
JUDGE_LANG_RUST = 4 # Rust
JUDGE_LANG_JS = 5 # Node.js
JUDGE_LANG_GO = 6 # Golang
JUDGE_LANG_JAVA = 7 # Java
JUDGE_LANG_RUBY = 8 # Ruby
JUDGE_LANG_PASCAL = 9 # Pascal
JUDGE_LANG_SUBMIT_ANSWER = 10 # For submit answer problem
DE... |
class TextTrigger:
STRUCT_NAME = "TileMap_TextTrigger"
def __init__(
self, id: int, x: int, y: int, width: int, height: int, string: str, ability_pickup: int
) -> None:
self.id = id
self.x = x
self.y = y
self.width = width
self.height = height
self.st... |
# Copyright (C) 2013 Lindley Graham
"""
This package is a Python-based framework for running batches of parallel ADCIRC
simulations with varying parameters (Manning's n and limited variable
bathymetry, etc). Includes documentation for a Python interface to a slightly
modified verion of GridData (Griddata_v1.32.F90). ... |
def messageFromBinaryCode(c):
j = 8
i = 0
message = ''
for item in range(len(c)//8):
message += chr(int(c[i:j],2))
i += 8
j += 8
return message |
# IF STATEMENTS
#
# In this problem, write a function named "lossy_transform" that takes an
# integer parameter and returns the corresponding value found in this table
# | Input | Output |
# |------------------------------------------------|----------------------... |
#generates hg19_splits for cross-validation
#hg19 (i.e. /mnt/data/annotations/by_release/hg19.GRCh37/hg19.chrom.sizes). Any chromosome from this chrom.sizes file that is not in the test/validation split is assumed to be in the training split (only considering chroms 1 - 22, X, Y
hg19_chroms=['chr1','chr2','chr3','chr4'... |
#
# PySNMP MIB module ENTERASYS-CLASS-OF-SERVICE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ENTERASYS-CLASS-OF-SERVICE-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:48:47 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ... |
# Tern
# domain: set of inputs
# co-domain: a set from which the function's output values are chosen.
# image: set of outputs, may smaller than co-domain
# this procedure is a real function in math.
def caesar(plaintext: str):
code = []
for char in plaintext:
code_ = ord(char) + 3
if char in "x... |
# -*- coding: utf-8 -*-
{
'name': 'Biometric Integration',
'version': '1.0',
'summary': """Integrating Biometric Device With HR Attendance (Face + Thumb)""",
'description': """This module integrates Odoo with the biometric device,odoo15,odoo,hr,attendance""",
'category': 'Generic Modules/Human Res... |
def get_counting_line(line_position, frame_width, frame_height):
line_positions = ['top', 'bottom', 'left', 'right']
if line_position == None:
line_position = 'bottom'
if line_position not in line_positions:
raise Exception('Invalid line position specified (options: top, bottom, left, right)... |
class Timer:
def __init__(self, tempo = "int used in real timer", settings = "obj used in real timer"):
pass
def start_question_timer(self):
self._times_asked = 0
def question_time_up(self):
self._times_asked += 1
return self._times_asked >= 18
def question_hint_1_up(... |
# Faça um Programa que leia três números e mostre o maior deles.
# Ivo Dias
# Recebe os numeros
primeiroNumero = int(input("Informe um numero: "))
SegundoNumero = int(input("Informe um segundo numero: "))
terceiroNumero = int(input("Informe um terceiro numero: "))
# Faz a verificacao
if (primeiroNumero == SegundoNume... |
st="Hello everyone are you enjoying learning Python ?"
st2 = st.split()
print(st2)
print(st.strip())
print(st.replace('o','0'))
print(st.isalpha()) |
class Solution:
def smallestNumber(self, num: int) -> int:
s = sorted(str(abs(num)), reverse=num < 0)
firstNonZeroIndex = next((i for i, c in enumerate(s) if c != '0'), 0)
s[0], s[firstNonZeroIndex] = s[firstNonZeroIndex], s[0]
return int(''.join(s)) * (-1 if num < 0 else 1)
|
msg = '''qv ah pfsix xi wm ughgsm, lk wyja vugfcq vu kytqzu ugzdlglqp, zw nu qfopu nmpyxu kyp hqbíu yy tqjupra lk fsd pm rurkm mt uweutryvz, mlglkl mvzckfm, zuwír qxiii c rmtmi gzdzkxsc. gvg ipwm lk upra uáy penm yay gldvkls, dmtvcgóy xiy gáw yaknyw, ogmriw j cckvvlzbum pze aáhuhze, tkhxpviy fsd hqklrpe, iraúr amtugmya... |
def twenty_eighteen():
"""Come up with the most creative expression that evaluates to 2018,
using only numbers and the +, *, and - operators.
>>> twenty_eighteen()
2018
"""
return 8 + 192 + (18 * 100) + 18
|
""" Your task is to implement the function strstr. The function takes two strings as arguments (s,x)
and locates the occurrence of the string x in the string s.
The function returns and integer denoting the first occurrence of the string x in s (0 based indexing).
Example 1:
Input:
s = GeeksForGeeks, x = Fr
Output... |
'''
EASY 1108. Defanging an IP Address
You are given a license key represented as a string S which consists only alphanumeric character and dashes.
The string is separated into N+1 groups by N dashes.
Given a number K, we would want to reformat the strings such that each group contains exactly K characters,
except ... |
#!/usr/bin/env python
f = open('/Users/kosta/dev/advent-of-code-17/day11/input.txt')
steps = f.readline().split(',')
moves = {
'n': (0, 1),
's': (0, -1),
'ne': (1, 0.5),
'nw': (-1, 0.5),
'sw': (-1, -0.5),
'se': (1, -0.5)
}
x_total = 0
y_total = 0
for step in steps:
x_total += moves[step]... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.