content stringlengths 7 1.05M |
|---|
#!/usr/bin/env python3
class Key:
def __init__(self, group_name=None, item_name=None, variable_name=None):
self._group_name = group_name
self._item_name = item_name
self._variable_name = variable_name
def group_name(self):
return self._group_name
def item_name(self... |
X = X[:2000,:]
labels = labels[:2000]
score = pca_model.transform(X)
with plt.xkcd():
visualize_components(score[:,0],score[:,1],labels)
plt.show() |
{
'targets': [{
'target_name': 'shoco',
'type': 'static_library',
'sources': ['shoco/shoco.c'],
'cflags': [
'-std=c99',
'-fexceptions',
'-Wall',
'-march=native',
'-Ofast'
],
'xcode_settings': {
'OTHER_CFLAGS': [
'-std=c99',
'-fexceptions',
... |
# ===========================================================================
# scores.py ---------------------------------------------------------------
# ===========================================================================
# class -------------------------------------------------------------------
# -----... |
def get_disc_loss(gen, disc, criterion, real, num_images, z_dim, device):
'''
Return the loss of the discriminator given inputs.
Parameters:
gen: the generator model, which returns an image given z-dimensional noise
disc: the discriminator model, which returns a single-dimensional prediction... |
# -*- coding: utf-8 -*-
# @Author : ydf
# @Time : 2019/8/8 0008 11:50
"""
实现各种中间件类型的发布者。
""" |
#!/usr/bin/env python
def get_user_password(sockfile):
"""Given the path of a socket file, returns a tuple (user, password)."""
return ("root", file('/etc/mysql/root.pw').read().strip())
|
load("//bazel:common.bzl", "get_env_bool_value")
_IS_PLATFORM_ALIBABA = "IS_PLATFORM_ALIBABA"
def _blade_service_common_impl(repository_ctx):
if get_env_bool_value(repository_ctx, _IS_PLATFORM_ALIBABA):
repository_ctx.template("blade_service_common_workspace.bzl", Label("//bazel/blade_service_common:blade... |
def get_leveshtein(s1, s2):
"""Returns levenshtein's length, i.e. the number of
characters to modify to get a pattern string"""
if s1 is None or s2 is None:
return -1
if len(s1) < len(s2):
return get_leveshtein(s2, s1)
# len(s1) >= len(s2)
if len(s2) == 0:
return len(s1... |
"""Exceptions and errors for BondGraphTools"""
class InvalidPortException(Exception):
"""Exception for trying to access a port that is in use, or does not
exist """
pass
class InvalidComponentException(Exception):
"""Exception for when trying to use a model that can't be found, or is of
the wron... |
def defuzz(fset, type):
# check for input type
if not isinstance(fset, dict):
raise TypeError("First input argument should be a dictionary.")
# check input dictionary length
if len(list(fset.keys())) < 1:
raise ValueError("dictionary should have at least one member.")
for key, valu... |
freq=int(input())
list1=[]
list2=[]
for i in range(0,freq):
row=[]
fn=input().split()
fn=[int(i) for i in fn]
for e in fn:
row.append(e)
#[row.append(e) for e in fn]
list1.append(row)
for row in list1:
for i in range(0,freq):
list2.append(list1[0][i])
#for... |
class Action:
""" Función de transición con su acción correspondiente. """
def __init__(self, name, parameters, variables, preconditions, effects):
"""
:param name: Name of the action.
:param parameters: List of variables.
:param variables: List of free variables. They can ... |
# The code below almost works
name = input("Enter your name")
print("Hello", name)
|
'''
Given an array nums of size n, return the majority element.
The majority element is the element that appears more than ⌊n / 2⌋ times.You may assume that the majority element always exists in the array.
Example:
Input - [2,2,1,1,1,2,2]
Output - 2
Explanation - 2 occurs more than 3 times
... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018 Richard Hull & Contributors
# See LICENSE.md for details.
"""
Alternative pin mappings for Orange PI 4
(https://drive.google.com/drive/folders/1jALhyhwjSVsxwSX1MwhjiOyQdx_fwlFg)
Usage:
.. code:: python
import orangepi.4
from OPi import GPIO
GPIO.setmode(orangepi... |
"""
VTGS Relay Daemon -- https://github.com/zleffke/cdh_sim
"""
__title__ = "CDH SIM"
__version__ = "0.0.0"
__author__ = "Zach Leffke, KJ4QLP"
__email__ = "zleffke@vt.edu"
__desc__ = "VCC CDH Simulator"
__url__ = "vtgs.hume.vt.edu"
|
# coding=UTF-8
def find_shortest_node(costs,process):
shortest_value = float('inf')
shortest_node = None
for key in costs :
if costs[key] < shortest_value and key not in process:
print( 'key:'+key +'->'+ str(costs[key]) )
shortest_node = key
shortest_value... |
# Algocja leży na wielkiej pustyni i składa się z miast oraz oaz połączonych drogami. Każde miasto
# jest otoczone murem i ma tylko dwie bramy - północną i południową. Z każdej bramy prowadzi dokładnie
# jedna droga do jednej oazy (ale do danej oazy może dochodzić dowolnie wiele dróg; oazy mogą też być
# połączone drog... |
#!/usr/bin/env python3
class FilterModule(object):
# my_vars: "{{ dom_dt.data.sub_domains | json_select('', ['ip','domain','phpversion','customlog','phpopenbasedirprotect']) }}"
# my_vars: "{{ dom_dt | json_select(['data','sub_domains'], ['ip','domain','phpversion','customlog','phpopenbasedirprotect']) }}"
# my_vars: "... |
a = float(input())
b = float(input())
c = float(input())
d = float(input())
a = a*2
b = b*3
c = c*4
e = (a+b+c+d)/10
print("Media: %.1f"%e)
if (e >= 7):
print("Aluno aprovado.")
elif(e < 5):
print("Aluno reprovado.")
else:
print("Aluno em exame.")
f = float(input())
print("Nota... |
x=('zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen')
y=('twenty','thirty','fourty','fifty','sixty','seventy','eighty','ninety','hundred','thousand')
ins=["one","hundred","fourty","nine"]
d=t=h=T... |
cont = ('zero', 'um','dois', 'três','quatro', 'cinco', 'seis', 'sete', 'oito', 'nove', 'dez'
'onze', 'quatorze', 'quinze', 'dezesseis', 'dezessete', 'dezoito', 'dezenove', 'vinte')
while True:
núm = int(input('Digite um valor de [0 até 20]: '))
if 0 <= núm <= 20:
break
print('Féra tente no... |
# Exercício 75
# Desenvolva um programa que leia quatro valores pelo teclado e guarde-os em uma tupla. No final, mostre:
# A) Quantas vezes apareceu o valor 9.
# B) Em que posição foi digitado o primeiro valor 3.
# C) Quais foram os Números Pares.
NumPar = 0
num1 = int(input("Digite um número: "))
num2 = int(input(("Di... |
# Michael Williamson
# NATO Phonetic/Morse Code Translator
# 7/29/2020
MORSE_CODE_DICT = { 'A':'.-', 'B':'-...',
'C':'-.-.', 'D':'-..', 'E':'.',
'F':'..-.', 'G':'--.', 'H':'....',
'I':'..', 'J':'.---', 'K':'-.-',
'L':'.-..', 'M':'--', ... |
# -- encoding:utf-8 --
"""
Create by ibf on 2018/6/21
"""
|
def test_lowercase_spell(client):
assert "Fireball" in client.post('/spellbook',
data=dict(text="fireball",
team_id='test-team-id',
token='test-token',
... |
x = 1
if x == 1:
# indented four spaces
print("x is ASDJASJDJAJSAJD JASJD ASJD JASJD JASDJ AJSDJ ASJD JASJD JASJD JASJD AJS DJASJD JASJD JASDJ AJSD JASJD JSADJ ASJD JASD AJSD JASJD JASD AJSDJ ASJD JA1.")
|
description = 'Laser Safety Shutter'
prefix = '14IDB:B1Bi0'
target = 0.0
command_value = 1.0
auto_open = 0.0
EPICS_enabled = True |
""" file namers
"""
class Extension():
""" file extensions """
INFORMATION = '.yaml'
INPUT_LOG = '.inp'
OUTPUT_LOG = '.out'
PROJROT_LOG = '.prot'
TEMPLATE = '.temp'
SHELL_SCRIPT = '.sh'
ENERGY = '.ene'
GEOMETRY = '.xyz'
TRAJECTORY = '.t.xyz'
ZMATRIX = '.zmat'
VMATRIX = ... |
Matriz = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
print('='*40)
print('GERADOR DE MATRIZ')
print('='*40)
for i in range(0, 3):
for j in range(0, 3):
Matriz[i][j] = int(input(f'Insira um valor na linha {i}, coluna {j}: '))
print( '='*40)
print('\n')
print(f"{'A = ': ^17}")
for i in range(0, 3):
for j in range(0... |
class ApiEndpoint(object):
client = None
parent = None
def __init__(self, client, parent=None):
self.client = client
self.parent = parent
|
__all__ = [
"SamplingError",
"IncorrectArgumentsError",
"TraceDirectoryError",
"ImputationWarning",
"ShapeError"
]
class SamplingError(RuntimeError):
pass
class IncorrectArgumentsError(ValueError):
pass
class TraceDirectoryError(ValueError):
"""Error from trying to load a trace fro... |
'''
This package serves two purposes:
1. Define the interface for different parser adapters to implement.
2. Implement the completion generation logic based on the defined interface.
Other packages should subclass the supplied classes and implement the interface.
'''
|
__author__ = "Sylvain Dangin"
__licence__ = "Apache 2.0"
__version__ = "1.0"
__maintainer__ = "Sylvain Dangin"
__email__ = "sylvain.dangin@gmail.com"
__status__ = "Development"
class last_word():
def transform(input_data):
"""Get the last word of a string with more than one word.
:param in... |
'''Crie um programa onde o usuário digite uma expressão qualquer que use parênteses.
Seu aplicativo deverá analisar se a expressão passada está com os parênteses abertos e fechados na ordem correta.'''
'''frase = str(input('Digite uma expressão qualquer: '))
list1 = list()
list2 = list()
for i in frase:
if i == '(... |
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 24 11:36:00 2021
@author: 2900888
"""
tall_streng = input("Skriv inn en alder: ")
alder = int(tall_streng)
if alder >= 13 and alder < 18:
print("Personen er tenåring")
else:
print("Personen er ikke tenåring")
|
# @desc The 2nd character in a string is at index 1.
def combine2(s1, s2):
s3 = s1[1]
s4 = s2[1]
result = s3 + s4
return result
def main():
print(combine2('Car', 'wash'))
print(combine2(' Hello', ' world'))
print(combine2('55', '88'))
print(combine2('Snow', 'ball'))
print(combine2... |
"""
Description
===========
Write a simple function that take a input string, add a space after every 3rd character, and
return the modified string
"""
def simple_function(input):
"""
Adds a space every 3rd character of an input
:param input: String - some string
:returns: String - A string with a s... |
class Node:
def __init__(self, data):
self.data = data
self.next = None
def create_circular_linked_list():
head = Node(1)
node2 = Node(2)
node3 = Node(3)
node4 = Node(4)
node5 = Node(5)
head.next = node2
node2.next = node3
node3.next = node4
node4.next = node5... |
#
# PySNMP MIB module RADLAN-rlFft (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RADLAN-rlFft
# Produced by pysmi-0.3.4 at Mon Apr 29 20:42:31 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,... |
a=1
for i in range(325):
a=a*0.1
print(a) |
# Given a non-negative integer numRows, generate the first numRows of Pascal's triangle.
# In Pascal's triangle, each number is the sum of the two numbers directly above it.
# Example:
# Input: 5
# Output:
# [
# [1],
# [1,1],
# [1,2,1],
# [1,3,3,1],
# [1,4,6,4,1]
# ]
class Solution(object):
def gen... |
def notas(*n, sit=False):
"""
==> Função para analizar notas de alunos!
:param n: Digite nota de quantos alunos quiser.
:param sit: Se sit=True você ira abilitar a função de
situação! (mostra se o aluno foi bem, na média ou ruim)
:return: um dicionrio com informaçãoes de cada aluno!
"... |
"""
Given a array of numbers representing the stock prices of a company in
chronological order, write a function that calculates the maximum profit you
could have made from buying and selling that stock once. You must buy before
you can sell it.
For example, given [9, 11, 8, 5, 7, 10], you should return 5, since you
c... |
#! /usr/bin/env python
# -*- coding:utf-8 -*-
"""
@author: Vesper Huang
"""
class Solution(object):
def convertInteger(self, A, B):
"""
:type A: int
:type B: int
:rtype: int
"""
tmp = A ^ B
count = 0
for i in range(32):
count += tmp & 1
... |
class BasicSettingsApiCredentialsBackend(object):
CLIENT_ERROR_MESSAGE = "Client implementations must define a `{0}` attribute"
CLIENT_SETTINGS_ERROR_MESSAGE = "Settings must contain a `{0}` attribute"
def __init__(self, client):
self.client = client
@property
def base_url(self):
... |
def fill_n(arr, offset_x, value, symbol=True):
"""Fill cells of arr starting from row offset_x with value in unary counting."""
value_left = value
width = arr.shape[1]
current_row = offset_x
while value_left:
add_this_iter = min(width, value_left)
arr[current_row, :add_this_it... |
dial = {'A': 2, 'B': 2, 'C': 2, 'D': 3, 'E': 3, 'F': 3, 'G': 4, 'H': 4, 'I': 4, 'J': 5, 'K': 5, 'L': 5, 'M': 6, 'N': 6, 'O': 6, 'P': 7, 'Q': 7, 'R': 7, 'T': 8, 'U': 8, 'V': 8, 'W': 9, 'X': 9, 'Y': 9, 'S': 7, 'Z': 9}
n, s = 0, input()
for c in s:
n += dial[c]
print(n+len(s)) |
input()
l = [i for i,j in enumerate(input()) if j =='.']
ans = 11111111
for i in range(len(l)-1):
ans = min(ans, l[i+1] - l[i])
print(ans - 1) |
coins = 0
price = round(float(input()), 2)
while price != 0:
if price >= 2:
price -= 2
coins += 1
elif price >= 1:
price -= 1
coins += 1
elif price >= 0.50:
price -= 0.50
coins += 1
elif price >= 0.20:
price -= 0.20
coins += 1
elif pric... |
{
"targets": [{
"target_name": "krb5",
"sources": [
"./src/module.cc",
"./src/krb5_bind.cc",
"./src/gss_bind.cc",
"./src/base64.cc"
],
'cflags!': ['-fno-exceptions'],
'cflags_cc!': ['-fno-exceptions'],
'include_dirs': ["... |
class Solution:
def validPalindrome(self, s: str) -> bool:
left, right = self.twopointer(0, len(s) - 1, s)
if left >= right :
return True
return self.valid(left + 1, right, s) or self.valid(left, right - 1, s)
def valid(self, left, right, s) :
l, r = self.twopoin... |
def get_metrics(response):
"""
Extract asked metrics from api response
@list_metrics : list of dict
"""
list_metrics = []
for i in response['reports'][0]['columnHeader']['metricHeader']['metricHeaderEntries']:
list_metrics.append(i['name'])
return list_metrics
def get_dimensions(re... |
SQLALCHEMY_DATABASE_URI = "postgresql:///test_freight"
LOG_LEVEL = "INFO"
WORKSPACE_ROOT = "/tmp/freight-tests"
SSH_PRIVATE_KEY = "-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEArvyc+vZVxUjC5ZcFg1VN3jQOCOjO94gwQKFxlz0zOCrCz+Sq\nnWk28YdUpOU016Zinlh4ZZk2136nCKKTMnNMjd6cTTCn5fWomjR+F2CSdaYYpYfO\nNtVnq0SIDUgGmjyPncOGr... |
#
# PySNMP MIB module SUPERMICRO-SMI (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SUPERMICRO-SMI
# Produced by pysmi-0.3.4 at Mon Apr 29 21:04:30 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... |
#
# PySNMP MIB module CISCO-WAN-ATM-CONN-CAPABILITY (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-WAN-ATM-CONN-CAPABILITY
# Produced by pysmi-0.3.4 at Mon Apr 29 18:03:44 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ve... |
# 数据类型
# int
money = 28
print(type(money)) # <class 'int'>
# float
money = 28.9
print(type(money)) # <class 'float'>
# String
money = '10000'
print(type(money)) # <class 'str'>
money = "100000"
print(type(money)) # <class 'str'>
message = '"Ryan Fawcett"'
print(message)
message = "'Ryan Fawcett'"
print(messag... |
s = 0
for i in range(101):
s += i
print("Suma liczb od 1 do 100 to: ", s)
|
def BinarySearch(Array, LowerBound, UpperBound, What):
while LowerBound != UpperBound:
mid = (LowerBound + UpperBound) // 2
if Array[mid] < What:
LowerBound = mid
elif Array[mid] > What:
UpperBound = mid - 1
else:
return mid
re... |
'''
immutable
'''
letters = ("a", "b", "c", "d", "c")
print(letters.count("c"))
print(letters.index("d"))
coordinates = (94, 6, 7)
x, y, z = coordinates
print(x, y, z) |
responses = {
'https://example.com/api/v1/something/': {
'count': 5,
'next': 'https://example.com/api/v1/something/?limit=3&offset=3',
'previous': None,
'results': [
{'id': 1}, {'id': 2}, {'id': 3}
],
'collection_links': {}
},
'https://example.com/... |
#!/usr/bin/env python
# coding: utf-8
#
# Author: Kazuto Nakashima
# URL: https://github.com/kazuto1011
# Created: 2016-06-07
config = {
'server_IP': '192.168.4.170',
'PORT': 49952,
'xml_file': 'C:/Users/nemuriscan/Desktop/NemuriScanLog/NemuriScanStateInfo.xml'
}
|
# Replace the file path with an existing text file on your machine.
with open("/home/aditya/Desktop/sample.txt", "r") as file_:
lines = file_.readlines()
for line in lines:
print(lines)
|
# uncompyle6 version 3.2.0
# Python bytecode 2.4 (62061)
# Decompiled from: Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)]
# Embedded file name: otp.uberdog.SpeedchatRelayGlobals
NORMAL = 0
CUSTOM = 1
EMOTE = 2
PIRATES_QUEST = 3
TOONTOWN_QUEST = 4 |
#
# PySNMP MIB module JUNIPER-PFE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/JUNIPER-PFE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:00:43 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... |
def implement_each(folder, each):
folder['tags'] = each['tags'] + folder['tags']
for key, tags in each['folders'].items():
folder['folders'][key] = {'tags': tags, 'folders': {}}
return folder
|
"""
@author: Rodrigo Vargas
modulo encargado del comportamiento de los disparos estandar
"""
class Disparo :
"""
modulo encargado del comportamiento de los disparos estandar
Attributes:
XY (list):coordenadas (x,y) del disparo
Velocidad (int):velocidad del disparo
Index(... |
class PointSegmentError(Exception):
""" """
pass
class AngleRotationSegmentError(Exception):
""" """
pass
class PointTranslateSegmentError(Exception):
""" """
pass
class NbPointSegmentDError(Exception):
""" """
pass
|
# encoding: utf-8
# module System.ComponentModel.Design.Serialization calls itself Serialization
# from System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
# by generator 1.145
""" NamespaceTracker represent a CLS namespace. """
# no imports
# no functions
# classes
class ComponentSe... |
print('============== Conversor de Temperaturas ===============')
tc = float(input('Informe a temperatura em C° '))
tf = (((9 * tc) / 5) + 32)
print('\n')
print('A temperatura em graus {:.1f}C° convertida em graus será {:.1f}F° '.format(tc,tf)) |
# Palindrome Permutation:
# Given a string, write a function to check if it is a permutation of a palindrome. A palindrome is a word or phrase that is the same forwards and backwards. A permutation is a rearrangement of letters. The palindrome does not need to be limited to just dictionary words.
def palindromePerm... |
# 核心思路
# 首先排序保证数组为递增序(题目保证每个元素都不同)
# 然后不断调用next-permutation生成序列
class Solution(object):
def permute(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
nums.sort()
result = []
while True:
result.append(nums[:])
if not nex... |
# Default colors
STRONG = "5aa69d" # primary color (for highlighting etc)
NEUTRAL = "999999"
POSITIVE = "47b358"
NEGATIVE = "ec6b56"
FILL_BETWEEN = "F7F4F4"
WARM = "ff808f"
COLD = "4062bb"
BLACK = "0F1108"
DARK_GRAY = "42404F"
LIGHT_GRAY = "C8C7D1"
# For categorical coloring
# picked from color brewer, but without to... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 定义一系列计算年终奖的算法
bouns_strategy = {
'S': lambda s: s * 4,
'A': lambda s: s * 3,
'B': lambda s: s * 2,
# 添加 S+ 和 C 算法
'SP': lambda s: s * 5,
'C': lambda s: s,
}
def calculate_bouns(name, strategy, salary):
return '{name} get {salary}'.format(na... |
values = []
values.append(1)
values.append(3)
values.append(5)
print('first time:', values)
values = values[1:]
print('second time:', values) |
s = list(map(int, input().split()))
for i in range(1, len(s), 2):
s[i - 1], s[i] = s[i], s[i - 1]
print(*s)
|
#!/usr/bin/env python3
"""The Western Exchange module"""
def np_transpose(matrix):
"""transposes matrix"""
return matrix.transpose()
|
"""
Import from other sources to database.
"""
|
for i in range(100):
count=i+1
if count % 3==0 and count % 5==0:
a= 'fizzbuzz'
elif count % 3==0:
a= "fizz"
elif count % 5==0:
a="buzz"
else:
a=count
user=input("whats the next number in fizzbuzz?")
a= str(a)
if user==a:
print("goodjob")
else:
... |
# .py file for python maths exercises
# convert degree to radian
# x * pi/180
# in = 15
# out = 0.2619047619047619
def deg2rad(degrees):
pi = 22/7
return degrees * pi / 180
# convert radian to degree
# in = .52
# out = 29.781818181818185
def rad2deg(rad):
pi = 22/7
return rad / pi * 180
# area of tra... |
# coding=utf-8
"""Maximum sum increasing subsequence dynamic programming solution Python implementation."""
def msis(seq):
dp = [x for x in seq]
for i in range(1, len(seq)):
for j in range(i):
if seq[i] > seq[j] and dp[i] < dp[j] + seq[i]:
dp[i] = dp[j] + seq[i]
return ... |
def binary_search(input_array, value):
"""this function take an input array, and return the index of value
if present in the input array or -1 if not"""
min_index = 0
max_index = len(input_array)-1
while (min_index<=max_index):
midle = (min_index+max_index)//2
if input_arra... |
#!/usr/bin/env python3
#while loops will continue to run while the condition remains true
#laços de repetição while continuam executando enquanto a condição permanecer verdadeira
#------------------------------------------------------------------------
#english
answer = "yes"
while answer != "no":
answer = input("Wa... |
def add_class_name(attrs, class_name):
class_names = attrs.get('class')
if class_names:
class_names = [class_names]
else:
class_names = []
class_names.append(class_name)
attrs['class'] = ' '.join(class_names)
return attrs
class ReadonlyValue:
def __init__(self, value, huma... |
'''
Segments which start with six zero-bits after the header are
very often ascii files.
'''
class R1k6ZeroSegment():
''' Look for ascii files with six zero bits prefix '''
def __init__(self, this):
if not this.has_note('R1k_Segment'):
return
bits = bin(int.from_bytes(b'\xff' + this... |
_base_ = ["./FlowNet512_1.5AugAAE_Flat_Pbr_01_ape.py"]
OUTPUT_DIR = "output/deepim/lmPbrSO/FlowNet512_1.5AugAAE_Flat_lmPbr_SO/can"
DATASETS = dict(TRAIN=("lm_pbr_can_train",), TEST=("lm_real_can_test",))
# bbnc5
# objects can Avg(1) ... |
"""
Given a string containing just the characters '(', ')', '{', '}', '[', ']',
determine if the input string is valid.
An input string is valid if:
1. Open brackets must be closed by the same type of brackets.
2. Open brackets must be closed in the correct order.
Note that an empty s... |
class BufAny:
pass
class Buffer:
"""An input buffer.
Allows socket data to be read immediately and buffered, but
fine-grained byte-counting or sentinel-searching to be
specified by consumers of incoming data."""
def __init__(self):
self._atinbuf = []
self._atterm = None
self._atmark = 0
def set_term(... |
# _*_ coding: utf-8 _*_
"""
@Date: 2021/5/6 11:42 下午
@Author: wz
@File: NonDecreasingArray.py
@Decs:
"""
'''
question:
给你一个长度为 n 的整数数组,请你判断在 最多 改变 1 个元素的情况下,该数组能否变成一个非递减数列。
我们是这样定义一个非递减数列的: 对于数组中任意的 i (0 <= i <= n-2),总满足 nums[i] <= nums[i + 1]。
示例 1:
输入: nums = [4,2,3]
输出: true
解释: 你可以通过把第一个4变成1来使得它... |
"""
This file is part of EmailHarvester
Copyright (C) 2016 @maldevel
https://github.com/maldevel/EmailHarvester
EmailHarvester - A tool to retrieve Domain email addresses from Search Engines.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU... |
def vote_registration_app():
print(f"\tWelcome to the Voter Registration App")
name = input(f"\tPlease enter your name:\t")
age = int(input(f"\tPlease enter your age:\t"))
if age >= 18:
print(f"\n\tCongratulations {name}! You are old enough to register to vote.\n")
print(f"""\t\t-Repub... |
c = c2 = c3 = 0
while True:
print('-' * 30)
print(' CADASTRE UMA PESSOA ')
print('-' * 30)
idade = int(input('Idade: '))
sexo = str(input('Sexo: [F/M] ')).strip().upper()[0]
while sexo not in 'FM':
sexo = str(input('Sexo: [F/M] ')).strip().upper()[0]
if idade < 18:
c... |
# Copyright 2017 Google Inc. 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 law or a... |
#-*- coding:utf-8 -*-
AbsoluteFreqMap = {
'C': 261,
'#C': 276,
'bD': 276,
'D': 292,
'#D': 310,
'bE': 310,
'E': 328,
'F': 348,
'#F': 369,
'bG': 369,
'G': 391,
'#G': 414,
'bA': 414,
'A': 438,
'#A': 465,
'bB': 465,
'B': 492
}
RelativeFreqMap = {
'1'... |
# -*- coding: utf-8 -*-
__author__ = "苦叶子"
"""
公众号: 开源优测
Email: lymking@foxmail.com
"""
HEADER = """\
"""
#根据实际的ip修改
SERVER_NAME = "192.168.1.141:5000"
|
def open_file():
file = input('Enter input file:')
if file=="measles.txt":
return file
else:
print("File should be \"measles.txt\"")
exit()
#Function compare income and the integers
def ref(income):
if income==1:
income="WB_LI"
return income
elif income==2:
... |
load(
"@build_bazel_rules_nodejs//:index.bzl",
"node_repositories",
"yarn_install",
)
PACKAGE_JSON = "@com_github_scionproto_scion//spec/tools:package.json"
def install_yarn_dependencies():
node_repositories(
package_json = [PACKAGE_JSON],
)
yarn_install(
name = "spec_npm",
... |
def test_del_first_group(app):
app.group.delete_first_group()
|
class HttpFetchError(BaseException):
pass
class MaxExceptionError(BaseException):
pass
class KnownError(BaseException):
pass
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.