content stringlengths 7 1.05M |
|---|
#
# PySNMP MIB module TPLINK-TC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPLINK-TC-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:16:42 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... |
# -*- coding: utf-8 -*-
"""Svante -- configurable Arrhenius plots and fits.
\b
For complete help visit https://github.com/hydrationdynamics/svante
\b
License: BSD-3-Clause
Copyright © 2021, GenerisBio LLC.
All rights reserved.
""" # noqa: D301
|
# Time: O((m + n)^2)
# Space: O((m + n)^2)
class Solution(object):
def longestPalindrome(self, word1, word2):
"""
:type word1: str
:type word2: str
:rtype: int
"""
s = word1+word2
dp = [[0]*len(s) for _ in xrange(len(s))]
result = 0
for j in ... |
# Author : Guru prasad Raju
''' This program will print index of each characters in the string'''
def givenString(new_string):
for i in range(len(new_string)):
print("index[", i, "]", new_string[i])
givenString("Life")
|
[ ## this file was manually modified by jt
{
'functor' : {
'description' :['This function is mainly for inner usage and allows',
'speedy writing of \c next, \c nextafter and like functions','\par',
'It transforms a floating point value in a pattern of ... |
# -*- coding: utf-8 -*-
class BaseError(Exception):
""" There was an exception that occurred while handling BaseImage"""
def __init__(self, message="", *args, **kwargs):
self.message = message
def __repr__(self):
return repr(self.message)
class NoImageDataError(BaseError):
""" No Im... |
def make_instance(cls):
def get_value(name):
if name in attributes:
return attributes[name]
else:
value = cls['get'](name)
return bind_method(value, instance)
def set_value(name, value):
attributes[name] = value
attributes = {}
instance = {'g... |
# -*- coding: utf-8 -*-
def mean(x):
return sum(x) / len(x)
|
"""
Good morning! Here's your coding interview problem for today.
This problem was asked by Square.
Assume you have access to a function toss_biased() which returns 0 or 1 with a probability that's not 50-50 (but also not 0-100 or 100-0).
You do not know the bias of the coin.
Write a function to simulate an unbiased... |
"""
* Edge Detection.
*
* Exposing areas of contrast within an image
* by processing it through a high-pass filter.
"""
kernel = (( -1, -1, -1 ),
( -1, 9, -1 ),
( -1, -1, -1 ))
size(200, 200)
img = loadImage("house.jpg") # Load the original image
image(img, 0, 0) # Displays the... |
# Copyright 2014-2018 The PySCF Developers. 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 appl... |
class Agent(object):
standard_key_list = []
def __init__(self, env, config, model=None):
self.env = env
self.config = config
self.model = model
self.state = None
self.action = None
self.reward = None
self.reward_list = None
pass
def observ... |
# Beer brands that are not craft beers
MAINSTREAM_BEER_BRANDS = {
'abc',
'anchor',
'asahi',
'budweiser',
'carlsberg',
'erdinger',
'guinness',
'heineken',
'hoegaarden',
'kirin',
'krausebourg'
'kronenbourg',
'royal stout',
'sapporo',
'skol',
'somersby',
... |
class GEOLibError(Exception):
"""Base GEOLib Exception class."""
class CalculationError(GEOLibError):
"""CalculationError with a status_code."""
def __init__(self, status_code, message):
self.status_code = status_code
self.message = message
class ParserError(GEOLibError):
"""Base cl... |
# Conta ocorrências de a
# Faça uma função que recebe uma string e retorna o número de vezes em que a letra 'a' aparece nela.
# O nome da sua função deve ser conta_a.
def conta_a (text):
return text.count("a")
|
class History(object):
def __init__(self, intensity=2):
self.hist = []
self.read_count = 0
self.intensity = intensity
def __len__(self):
return len(self.hist)
def add(self, solution):
self.hist.append(solution)
def get(self):
self.read_count += 1
... |
coordinates_E0E1E1 = ((123, 106),
(123, 108), (123, 109), (123, 110), (123, 112), (124, 106), (124, 110), (124, 125), (124, 127), (124, 128), (124, 129), (124, 130), (124, 132), (125, 106), (125, 108), (125, 110), (125, 126), (125, 132), (126, 106), (126, 109), (126, 126), (126, 128), (126, 129), (126, 130), (126, 13... |
CONTRACHEQUE = "contracheque"
CONTRACHEQUE_2019 = "contracheque_2019"
INDENIZACOES = "indenizacoes"
HEADERS = {
CONTRACHEQUE: {
"Remuneração do Cargo Efetivo": 4,
"Outras Verbas Remuneratórias Legais/Judiciais": 5,
"Função de Confiança ou Cargo em Comissão": 6,
"13o. Salário": 7,
... |
class AllocationMap(object):
# Keeps track of item allocation to caches.
def __init__(self):
self.alloc_o = dict() # for each item (key) maps a list of caches where it is cached. Has entries just for allocated objects.
self.alloc = dict() # for each cache (key) maps the list of items it c... |
def romanToDecimal(S):
roman = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
a = roman[S[0]]+roman[S[-1]]
i=1
while i<len(S)-1:
print(a)
if (roman[S[i]] >= roman[S[i+1]]):
a = a+roman[S[i]]
i=i+1
else:
a = a -rom... |
##################################################################################
# Deeplearning4j.py
# description: A wrapper service for the Deeplearning4j framework.
# categories: ai
# more info @: http://myrobotlab.org/service/Deeplearning4j
#########################################################################... |
# Day 16: http://adventofcode.com/2016/day/16
inp = '11101000110010100'
def checksum(initial, length):
table = str.maketrans('01', '10')
data = initial
while len(data) < length:
new = data[::-1].translate(table)
data = f'{data}0{new}'
check = data[:length]
while not len(check)... |
n = 600851475143
i=2
while(i*i<=n):
while(n%i==0):
n=n/i
i=i+1
print(n)
|
def polishNotation(exp: list):
# Este algoritmo resuelve expresiones matemáticas en notación polaca inversa
# La expresión matemática se ingresa en un arreglo
# Se utiliza una pila para la solución de las operaciones hasta completarlas todas
# Retorna la solución de la operación enviada
stack = []
for i in... |
consumer_key = 'NYICJJWGEHWjLzf16L4bdOmBp'
consumer_secret = 'AT8vDFvB6IkjLM5Ckz9DC5yQ0nsqut8vwGYOpnXPMFIESsHKG5'
access_token = '2909697444-NNDWfyczj7Asgv7t5YvysLcnnEj3CcoC12AB46R'
access_secret = 'kRaSQf3FEEz3X7TSH1o0EisdweIGoxm9Af6E0WceFzeEp'
|
"""Tests for BEL2SCM
test_bel2scm.py
---------------
This file contains all the test functions we used to generate sample data, testing and debugging
code for bel2scm algorithm.
Input files:
- BELSourceFiles contains bel graphs for all our test cases
- Data folder contains all the input and output data files
- Neu... |
# -*- coding: utf-8 -*-
class Filter:
@staticmethod
def sanitize_html_tags(string):
return string.replace("<", "<").replace(">", ">")
@staticmethod
def sanitize_quotes(string):
return string.replace("'", "'").replace('"', """)
@staticmethod
def sanitize_string(... |
dct = {'one':'two', 'three':'one', 'two':'three' }
v = dct['three']
for k in range(len(dct)):
v = dct[v]
print(v)
print(v) |
class Solution:
def canPlaceFlowers(self, flowerbed: List[int], n: int) -> bool:
f = flowerbed
ans = 0
for i in range(len(f)):
if f[i] == 0:
l, r = max(0, i - 1), min(i + 1, len(f) - 1)
if f[r] == 0 and f[l] == 0:
f[i] = 1
ans += 1
return ans >= n
|
# python alura-python/best-practices/hints.py
class Name:
def __init__(self, name: str, age: int) -> None:
self.name = name
self.age = age
def testa(self, name: str) -> int:
self.name = name
return int(self.age)
def testegain() -> str:
return 'again'
myname = Name('wilton "paulo" d... |
class MLPRTranspiler(object):
def __init__(self, model):
self.model = model
self.layer_sizes = ','.join(map(lambda x : str(x), self.model.hidden_layer_sizes))
self.build_weights()
self.build_layers()
self.build_bias()
def build_layers(self):
self.networks = ""
... |
default_app_config = 'djadmin.apps.ActivityAppConfig'
__name__ = 'djadmin'
__author__ = 'Neeraj Kumar'
__version__ = '1.1.7'
__author_email__ = 'sainineeraj1234@gmail.com'
__description__ = 'Djadmin is a django admin theme'
|
config = {
"Virustotal": { "KEY":"718d3ef46ba51c38936a5bba67ba40e1348867aa0e9c0fa6ac8cd76c5950a983",
"URL": "https://www.virustotal.com/vtapi/v2/file/report" } ,
"hybridanalysis": { "KEY":"yyicbmp80fa6638bnkgcw93y5c07f536iyh0qo7r5bc2fabbtojj2yo97d352208", "URL": "https://www.hybrid-analysis.com/api/... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def node(self, nums, start, end):
median = (start+end)//2
node = TreeNode(nums[median])
if start == end:
... |
#House budget
while True:
price = float(input("Enter price: "))
if price < 500000:
print("Buy now!")
else:
print("Keep looking.")
|
a = "Dani"
#if anidados -> Evalua una condicion, ejecuta la instruccion y pasa al siguiente if
if a == "Dani":
print("Ok")
if a == "Alejandro":
print("Wrong")
else:
print("I dont know\n")
#elif -> Evalua una condicion, si es verdadera ejcuta la instruccion y sale
if a == "Dani":
print("Ok")
elif a ... |
class TransferError(ValueError):
pass
class Transfer:
"""Class representing a transfer from a source well to a destination well.
Parameters
----------
source_well
A Well object representing the plate well from which to transfer.
destination_well
A Well object representing the pl... |
def twoSum(nums, target):
temp = nums[:]
nums.sort()
hi = len(nums) - 1
lo = 0
while lo < hi:
if (nums[lo] + nums[hi]) < target:
lo += 1
elif (nums[lo] + nums[hi]) > target:
hi -= 1
else:
if nums[lo] == nums[hi]:
return [tem... |
class Vendor:
def __init__(self, token, name):
self.token = token
self.name = name
def __lt__(self, other):
return self.token < other.token
|
class CommandLineRouteHandlerError(BaseException):
"""
This class implements the CommandLineRouteHandlerError.
"""
def __init__(self, message=None):
"""
This method initializes an instance of the CommandLineRouteHandlerError
class.
:param str message: An optional messag... |
n = int(input())
advice = ['advertise', 'do not advertise', 'does not matter']
results = []
for i in range(n):
r, e, c = input().split()
r, e, c = int(r), int(e), int(c)
if r > e - c:
results.append(advice[1])
elif r < e - c:
results.append(advice[0])
else:
results.append(a... |
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
def __repr__(self):
a = self
value = ''
while a:
value = value + str(a.val) + '->'
a = a.next
return value
class Solution(o... |
def insertionSort1(n, arr):
i = n-1
val = arr[i]
while(i>0 and val<arr[i-1]):
arr[i] = arr[i-1]
print(*arr)
i-=1
arr[i] = val
print(*arr)
|
class ConnectionInterrupted(Exception):
def __init__(self, connection, parent=None):
self.connection = connection
def __str__(self):
error_type = type(self.__cause__).__name__
error_msg = str(self.__cause__)
return "Redis {}: {}".format(error_type, error_msg)
class CompressorE... |
# define this module's errors
class ParserError(Exception):
pass
class Sentence(object):
def __init__(self, subject, verb, obj):
# these are tuples, e.g. ('noun', 'bear')
self.subject = subject[1]
self.verb = verb[1]
self.obj = obj[1]
def __str__(self):
return str(... |
missed_list = list()
for one_line in open("data/additional_data/missed_ontology"):
one_line = one_line.strip()
missed_list.append(one_line)
f_w = open("data/test/20180405.txt", "w")
for one_line in open("data/test/kill_me_plz_test.txt"):
dead_flag = 0
one_line = one_line.strip()
_, ontology_resul... |
"""
Escreva um programa que leia dois números.
Imprima a divisão inteira do primeiro pelo segundo, assim como o resto da divisão.
Utiliza apenas os operadores de soma e subtração para calcular o resultado.
Lembre-se de que podemos entender o quociente da divisão de dois números como a quantidade de vezes que podemos re... |
VERSION = "v0.0.1"
def version():
return VERSION
|
DATABASES_ENGINE = 'django.db.backends.postgresql_psycopg2'
DATABASES_NAME = 'spending'
DATABASES_USER = 'postgres'
DATABASES_PASSWORD = 'pg'
DATABASES_HOST = '127.0.0.1'
DATABASES_PORT = 5432
|
cont = total = 0
while True:
num = int(input('Digite um valor[999 para parar]: '))
if num == 999:
break
cont += 1
total += num
print(f'Foram digitados {cont} numeros e a soma entre eles é {total}')
|
# https://leetcode.com/problems/toeplitz-matrix/
# More elegant solution from leetcode
# Time Complexity: O(M∗N)
# Space Complexity: O(M+N
class Solution(object):
def isToeplitzMatrix(self, matrix):
groups = {}
for r, row in enumerate(matrix):
for c, val in enumerate(row):
... |
'''
(1) - Indique como um troco deve ser dado utilizando-se um número mínimo de notas. Seu
algoritmo deve ler o valor da conta a ser paga e o valor do pagamento efetuado desprezando
os centavos. Suponha que as notas para troco sejam as de 50, 20, 10, 5, 2 e 1 reais, e que
nenhuma delas esteja em falta no caixa
'''... |
# Bluerred Image Detection
#
# Author: Jasonsey
# Email: 2627866800@qq.com
#
# =============================================================================
"""the common tools api"""
|
def encrypt(text, key):
"""Caesarchifferskryptering
Args:
text (_str_): Den text som ska krypteras.
key (_int_): Hur många steg ska vi skifta?
"""
encrypted = ""
# loop through the message char by char
for char in text:
# check if it's an upper case letter
... |
#
# PySNMP MIB module BLADESPPALT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BLADESPPALT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:39:07 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... |
with open('input.txt') as f:
lines = f.readlines()
depth_increased = 0
for i in range(len(lines)):
if (i == 0):
# don't check first sonar input
continue
if (int(lines[i]) > int(lines[i-1])):
depth_increased = depth_increased + 1
print(depth_increas... |
numeros = []
manpl = []
menpl = []
for c1 in range(0, 5):
n = float(input('Escreve um número: '))
numeros += [n]
man = max(numeros)
men = min(numeros)
manv = numeros.count(man)
menv = numeros.count(men)
a1 = a2 = 0
for c2 in range(0, manv):
manp = numeros.index(man, a1)
manpl += [manp + 1]
a1 = manp... |
#!/usr/bin/python3
"""
Contains the inherits_from function
"""
def inherits_from(obj, a_class):
"""returns true if obj is a subclass of a_class, otherwise false"""
return(issubclass(type(obj), a_class) and type(obj) != a_class)
|
"""
MappingEntry
"""
class MappingEntry(object):
"""
Defines what will be saved in the MapStorage.
A MappingEntry represents a connection between a custom currency address and a Waves address.
"""
DICT_COIN_KEY = 'coin'
DICT_WAVES_KEY = 'waves'
def __init__(self, waves_address: str, coin... |
# Атрибуты класса, которые являются функциями, -- это такие же
# атрибуты класса, как и переменные. Это можно увидеть на
# следующем примере.
def outer_method(self):
print('I am a method of object', self)
class MyClass:
method = outer_method
obj = MyClass()
obj.method() |
print('=' * 30)
print('10 PRIMEIROS TERMOS DE UMA PA')
print('=' * 30)
t = int(input('Primeiro termo: '))
r = int(input('Razão: '))
d = t + (10 - 1) * r
for c in range(t, d + r, r):
print('{}'.format(c), end=' >')
print('ACABOU!')
|
# Main App
def MyFunc():
print()
print('='*80)
print(f'[VerifyOS for Windows] - Em execução...')
print('='*80)
MyFunc()
|
WORD_TYPES = {
"north" : "direction",
"south" : "direction",
"east" : "direction",
"west" : "direction",
"go" : "verb",
"kill" : "verb",
"eat" : "verb",
"the" : "stop",
"in" : "stop",
"of" : "stop",
"bear" : "noun",
"princess" : "noun",
}
def convert_number(word):
... |
def reader(values):
f=open("level1.txt", "r")
# N=no. of lines
#x = the position from which the substring must begin
x=values[0]
x-=1
#y=the position at which the substring should end
list1=[]
for line in range(values[2]):
j=f.readline()
t=j[values[0]:values[1]]... |
class Solution:
# Use functions to convert all to numerical value (Accepted), O(n) time and space
def isSumEqual(self, a: str, b: str, t: str) -> bool:
def letter_val(letter):
return ord(letter) - ord('a')
def numerical_val(word):
s = ''
for c in word:
... |
def CounterClosure(init=0):
value = [init]
def Inc():
value[0] += 1
return value[0]
return Inc
class CounterClass:
def __init__(self, init=0):
self.value = init
def Bump(self):
self.value += 1
return self.value
def CounterIter(init = 0):
while True:
init += 1
yield init
if __... |
"""Faça um programa em Python que receba (entrada de dados) o valor correspondente ao lado de um quadrado,
calcule e imprima (saída de dados) seu perímetro e sua área."""
lado = int(input("Lado: "))
area = lado ** 2
perimetro = lado * 4
print("perímetro: {} - área: {}" .format(perimetro, area)) |
# 2018-6-12
# Two sum
class Solution(object):
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
result = []
leng = len(nums)
i = 0
while i < leng - 1:
j = i + 1
while j < l... |
def commaCode(inputList):
myString = ''
for i in inputList:
if (inputList.index(i) == (len(inputList) - 1)):
myString = myString + 'and ' + str(i)
else:
myString = myString + str(i) + ', '
return myString
inputValue = ''
spam = []
print('Insert next list mem... |
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
The borg package contains modules that assimilate large quantities of data into
pymatgen objects for analysis.
"""
|
'''
Date: 2021-08-14 10:34:24
LastEditors: Liuliang
LastEditTime: 2021-08-14 11:55:32
Description:
'''
# 原始版本
def _bs(nums, target):
low, high = 0, len(nums)-1
while low <= high:
mid = low + (high - low) // 2
if nums[mid] == target:
return mid
elif nums[mid] < target:
... |
def my_reverse(lst):
new_lst = []
count = len(lst) - 1
while count >= 0:
new_lst.append(lst[count])
count -= 1
return new_lst |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Problem 062
ginortS
Source : https://www.hackerrank.com/challenges/ginorts/problem
"""
s = input()
def custom_index(c):
i = ord(c)
if i in range(65,91):
i += 100
elif i in range(48,58):
if i%2:
i += 200
else:
... |
"""
File generated by export_config.cpp. Do not edit directly.
Exports maps for:
config_to_input_pages
config_to_modules
config_to_eqn_variables
config_to_cb_cmods
SSC Version: 205
Date: Sat Feb 23 13:57:48 2019
"""
# List of Variables that are used in equations #
ui_form_to_eqn_var_map = {
'Electric... |
#coding:utf-8
a = open('subtopic.csv','r')
b = open('NoVec_but_subtopic.csv','r')
c = open('NoVec_and_bin.csv','r')
dict_topic_sub = {}#key=topic, value=set_of_subtopic
num=0
for i in a:
num+=1
if num>1:
LINE = i.rstrip().split(',')
topic = LINE[3]
sub = LINE[5]
if sub != '100':
dict_topic_sub.setdefau... |
class Emoji:
# noinspection PyShadowingBuiltins
def __init__(self, id: str, name: str, animated: bool):
self.emoji_id = id
self.name = name
self.animated = animated
def is_unicode_emoji(self) -> bool:
return self.emoji_id is None
def util_id(self):
if self.is_u... |
def h(n, x, y):
if n >0:
tmp = 6 - x-y
h(n-1, x, tmp)
print(x, y)
h(n-1, tmp, y)
n = int(input())
h(n, 1, 3) |
class Fib(object):
@staticmethod
def fib(n):
a = 0
if n == 0:
return a
b = 1
for _ in range(1, n):
c = a + b
a = b
b = c
return b
|
class OperationEngineException(Exception):
def __init__(self, message):
Exception.__init__(self, message)
|
class Solution:
def minMalwareSpread(self, graph: List[List[int]], initial: List[int]) -> int:
if not graph: return -1
N = len(graph)
clean = set(range(N)) - set(initial)
def dfs(u, seen):
for v, adj in enumerate(graph[u]):
if adj and v in clean a... |
############################################################################
#
# Copyright (C) 2016 The Qt Company Ltd.
# Contact: https://www.qt.io/licensing/
#
# This file is part of Qt Creator.
#
# Commercial License Usage
# Licensees holding valid commercial Qt licenses may use this file in
# accordance with the co... |
class Solution(object):
"""
A peak element is guaranteed to exist!
Use binary search method. Cannot directly
apply the XXOO template.
A point can have three possible scenarios:
(1) ascending (compare to element at right)
(2) at peak
(3) descending (compare to element at left... |
""" PythonPackageTemplate Class """
class PythonPackageTemplate:
""" PythonPackageTemplate class """
def __init__(self):
""" Initialize PythonPackageTemplate. """
pass
def __repr__(self):
""" Return PythonPackageTemplate name. """
return self.__class__.__name__
|
a = 1
b = 2
print(a,b) # 1,2
# like JS destructuring
a, b = b, a
print(a,b) # 2,1
|
# ASSIGNMENT 1 - C
# VOLUME OF SPHERE
d=int(input("Enter the diameter : "))
r=d/2
print("-> Radius is {}".format(r))
Vo=(4.0/3.0) *22/7*( r*r*r)
print("-> Volume is {}".format(Vo)) |
#Postal abbreviations to three-character NHGIS state codes
state_codes = {
'WA': '530',
'DE': '100',
'DC': '110',
'WI': '550',
'WV': '540',
'HI': '150',
'FL': '120',
'WY': '560',
'PR': '720',
'NJ': '340',
'NM': '350',
'TX': '480',
'LA': '220',
'NC': '370',
'ND... |
"""
:mod:`papy.util.runtime`
========================
Provides a (possibly shared, but not yet) dictionary.
"""
def get_runtime():
"""
Returns a PAPY_RUNTIME dictionary.
"""
PAPY_RUNTIME = {}
return PAPY_RUNTIME
|
"""Callables settings
==================
Dynamically build smart settings related to django-pipeline, taking into account other settings or installed packages.
"""
def static_storage(settings_dict):
if settings_dict["PIPELINE_ENABLED"]:
return "djangofloor.backends.DjangofloorPipelineCachedStorage"
r... |
class SentenceReverser:
vowels = ["a","e","i","o","u"]
sentence = ""
reverse = ""
vowelCount = 0
def __init__(self,sentence):
self.sentence = sentence
self.reverseSentence()
def reverseSentence(self):
self.reverse = " ".join(reversed(self.sentence.split()))
def getVowelCount(self):
self.vowelCount = sum(... |
def fac_of_num():
global num
factor = 1
flag = True
while flag:
flag = False
try:
num = int(round(float(input("Enter the Number: "))))
if num == 0:
print("The Factorial of Zero is One")
flag = True
else:
... |
""" Optional routine to calculate the alpha values if they have not been precalculated """
# # Calculate the alphas:
# alpha = np.zeros(len(bstart)-1)
# alpha_err = np.zeros(len(bstart)-1)
# tdel = np.zeros(len(bstart)-1)
# for i in range (1,len(bstart)):
# #alpha = Fp cbol delta t /fluence
... |
class Signal():
def __init__(self):
self.receivers = []
def connect(self, receiver):
self.receivers.append(receiver)
def emit(self):
for receiver in self.receivers:
receiver()
|
# Functions for working with ELB/ALB
# Checks whether logging is enabled
# For an ALB, load_balancer is an ARN; it's a name for an ELB
def check_elb_logging_status(load_balancer, load_balancer_type, boto_session):
logging_enabled = False
if load_balancer_type == 'ALB':
alb_client = boto_session.clien... |
load(
"//:versions.bzl",
"SPEC_VERSION",
"BIOGRAPH_VERSION",
"SEQSET_VERSION",
)
VERSION_TABLE = {
"SPEC_VERSION": SPEC_VERSION,
"BIOGRAPH_VERSION": BIOGRAPH_VERSION,
"SEQSET_VERSION": SEQSET_VERSION,
}
def make_version_h(name, out_file):
"""Generates a .h file containing #defines for ... |
WINDOW_SIZE = 3
def window(lines, start):
if start > len(lines) - WINDOW_SIZE:
return None
return int(lines[start]), int(lines[start+1]), int(lines[start+2])
with open("data/input1.txt") as f:
lines = f.readlines()
end_idx = len(lines) - WINDOW_SIZE + 1
last_sum = None
larger_count = 0
for i in ... |
def main():
formatters = {"plain": plain,
"bold": bold,
"italic": italic,
"header": header,
"link": link,
"inline-code": inline_code,
"ordered-list": make_list,
"unordered-list": make_list,... |
"""
Function to define special tokens (ie : CTRL code) and update the model and tokenizer
"""
def add_special_tokens(model=None, tokenizer=None):
"""
update in place the model and tokenizer to take into account special tokens
:param model: GPT2 model from huggingface
:param tokenizer: GPT2 tokenizer from huggingf... |
#
# PySNMP MIB module ChrComPmSonetSNT-L-Day-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ChrComPmSonetSNT-L-Day-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:35:58 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version ... |
class Show(object):
def __init__(self, drawable):
self.drawable = drawable
def next_frame(self):
self.drawable.show()
return False
|
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Fredrik Eriksson <git@wb9.se>
# This file is covered by the BSD-3-Clause license, read LICENSE for details.
CMD_PWR_ON="poweron"
CMD_PWR_OFF="poweroff"
CMD_PWR_QUERY="powerquery"
CMD_SRC_QUERY="sourcequery"
CMD_SRC_SET="sourceset"
CMD_BRT_QUERY="brightnessquery"
CMD_BRT_S... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.