content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
""" maximum_gap.py
Maximum gap method described by Yellin. This is a
method for finding an upper limit with an unknown background
and a non-zero number of events.
TODO:
Complete module
"""
def maximum_gap_ul(E,Emin,Emax,model,cl=0.9,Ntrials=1000000):
print('This is still under development! Returning')
... | """ maximum_gap.py
Maximum gap method described by Yellin. This is a
method for finding an upper limit with an unknown background
and a non-zero number of events.
TODO:
Complete module
"""
def maximum_gap_ul(E, Emin, Emax, model, cl=0.9, Ntrials=1000000):
print('This is still under development! Returning')
... |
#!/usr/bin/python3
#coding=utf-8
def debug_run():
a = 1
a += 1
print('python debug run success')
if __name__ == "__main__":
debug_run() | def debug_run():
a = 1
a += 1
print('python debug run success')
if __name__ == '__main__':
debug_run() |
projections = [
{
"name": "app_display mona",
"configuration": {},
"projection": {
"image_data": {
"type": "linked",
"location": "event",
"stream": "primary",
"field": ":exchan... | projections = [{'name': 'app_display mona', 'configuration': {}, 'projection': {'image_data': {'type': 'linked', 'location': 'event', 'stream': 'primary', 'field': ':exchange:data'}, 'sample_name': {'type': 'configuration', 'field': ':measurement:sample:name', 'location': 'start'}, 'instrument_name': {'type': 'configur... |
def bitn(i, n):
return (i >> n) & 1
def blen(n):
return n.bit_length()
def masknbits(n):
return ((1<<n)-1)
def rotl(i, n, order=8):
return ((i << n) | (i >> order-n)) & masknbits(order)
# Apply a function column-wise
def map_columns(func, state):
s2 = bytearray()
for i in range(4):
s2 += func(state[i * ... | def bitn(i, n):
return i >> n & 1
def blen(n):
return n.bit_length()
def masknbits(n):
return (1 << n) - 1
def rotl(i, n, order=8):
return (i << n | i >> order - n) & masknbits(order)
def map_columns(func, state):
s2 = bytearray()
for i in range(4):
s2 += func(state[i * 4:i * 4 + 4])... |
"""Rules that invoke sigh scripts or other binary tools.
Put as little logic/validation here as possible. Prefer adding proper wrapper
functions and documentation in other .bzl files, and reserve this file for only
the actual sigh_command invocations.
"""
load("//third_party/java/arcs/build_defs:sigh.bzl", "sigh_comm... | """Rules that invoke sigh scripts or other binary tools.
Put as little logic/validation here as possible. Prefer adding proper wrapper
functions and documentation in other .bzl files, and reserve this file for only
the actual sigh_command invocations.
"""
load('//third_party/java/arcs/build_defs:sigh.bzl', 'sigh_comma... |
# Variable number of arguments
# Write a function to calculate the sum of all numbers passed as its arguments.
#
# Your function should be called sum_numbers and should take a single argument: the value to sum up to.
#
# To pass in this on-line interpreter, your function must contain a Docstring.
#
# The parameters and... | def sum_numbers(*values: float) -> float:
""" calculates the sum of all the numbers passed as arguments """
result = 0
for number in values:
result += number
return result
print(sum_numbers(1, 2, 3))
print(sum_numbers(8, 20, 2))
print(sum_numbers(12.5, 3.147, 98.1))
print(sum_numbers(1.1, 2.2, 5... |
# -*- coding: utf-8 -*-
"""
Created on 2018/3/13
@author: will4906
""" | """
Created on 2018/3/13
@author: will4906
""" |
class StructureCode:
def __init__(self, file_name, line_number, record_descriptor_word,
hexadecimal_identifier, structure_code):
self.fields = {
'record_descriptor_word': record_descriptor_word,
'hexadecimal_identifier': hexadecimal_identifier,
'structure... | class Structurecode:
def __init__(self, file_name, line_number, record_descriptor_word, hexadecimal_identifier, structure_code):
self.fields = {'record_descriptor_word': record_descriptor_word, 'hexadecimal_identifier': hexadecimal_identifier, 'structure_code': structure_code}
self.length = int(rec... |
SELECT = 'SELECT'
PMTGAIN = 'PMTG'
MSTART = 'MSTART'
MSTOP = 'MSTOP'
| select = 'SELECT'
pmtgain = 'PMTG'
mstart = 'MSTART'
mstop = 'MSTOP' |
'''
Anas Albedaiwi
albedaiwi1994@gmail.com
'''
seconds = int(input('Enter number of seconds: '))
print("hoursHappend")
hoursHappend =input(seconds/3600)
print("minsHappend")
minsHappend = input((seconds%3600)/60)
print("secondHappend")
secondHappend = input((seconds%3600)%60)
| """
Anas Albedaiwi
albedaiwi1994@gmail.com
"""
seconds = int(input('Enter number of seconds: '))
print('hoursHappend')
hours_happend = input(seconds / 3600)
print('minsHappend')
mins_happend = input(seconds % 3600 / 60)
print('secondHappend')
second_happend = input(seconds % 3600 % 60) |
def algo():
return 1 + 2
def is_prime(n):
for i in range(3, n):
if n % i == 0:
return False
return True
def get_primes(input_list):
return (e for e in input_list if is_prime(e))
'''def gerar_numero():
yield 1
yield 2
yield 3
for i in gerar_numero():
print('{}'.format(i), end=' ')
try:
nosso_gerador ... | def algo():
return 1 + 2
def is_prime(n):
for i in range(3, n):
if n % i == 0:
return False
return True
def get_primes(input_list):
return (e for e in input_list if is_prime(e))
"def gerar_numero():\n\tyield 1\n\tyield 2\n\tyield 3\n\nfor i in gerar_numero():\n\tprint('{}'.format(i... |
with open('words.txt', 'r') as fin:
lines = fin.readlines()
words = []
for line in lines:
words.append(line.strip())
def bisect(words, target):
if len(words) == 0:
return False
mid_value = len(words)//2
if target == words[mid_value]:
return True
if target < words[mid_value]:
... | with open('words.txt', 'r') as fin:
lines = fin.readlines()
words = []
for line in lines:
words.append(line.strip())
def bisect(words, target):
if len(words) == 0:
return False
mid_value = len(words) // 2
if target == words[mid_value]:
return True
if target < words[mid_value]:
... |
god_wills_it_line_one = "The very earth will disown you"
disown_placement = god_wills_it_line_one.find("disown")
print(disown_placement)
| god_wills_it_line_one = 'The very earth will disown you'
disown_placement = god_wills_it_line_one.find('disown')
print(disown_placement) |
population_output_schema = [
{
"name": "STATE",
"type": "STRING"
},
{
"name": "COUNTY",
"type": "STRING"
... | population_output_schema = [{'name': 'STATE', 'type': 'STRING'}, {'name': 'COUNTY', 'type': 'STRING'}, {'name': 'TRACT', 'type': 'STRING'}, {'name': 'BLOCK', 'type': 'STRING'}, {'name': 'HOUSEHOLD_ID', 'type': 'INTEGER'}, {'name': 'HOUSEHOLD_TYPE', 'type': 'INTEGER'}, {'name': 'LATITUDE', 'type': 'STRING'}, {'name': 'L... |
class ColorModeMeta(type):
def __new__(
metacls,
cls,
bases,
attributes,
):
if "__str__" not in attributes.keys():
raise AttributeError(
"ColorModeMeta must be __str__ value"
)
if "__call__" not in attributes.keys():
... | class Colormodemeta(type):
def __new__(metacls, cls, bases, attributes):
if '__str__' not in attributes.keys():
raise attribute_error('ColorModeMeta must be __str__ value')
if '__call__' not in attributes.keys():
raise attribute_error('ColorModeMeta must be __call__ value')
... |
class MathError(Exception):
pass
class MathSyntaxError(MathError):
def __init__(self, reason="", visualisation=""):
self.reason = reason
self.visualisation = visualisation
def __str__(self):
return f"Syntax error:\n" \
f"{self.reason}\n" \
... | class Matherror(Exception):
pass
class Mathsyntaxerror(MathError):
def __init__(self, reason='', visualisation=''):
self.reason = reason
self.visualisation = visualisation
def __str__(self):
return f"Syntax error:\n{self.reason}\n{(self.visualisation if self.visualisation else '')... |
people=['mom','dad','sister']
print("Now there will be a larger dining-table.")
people.insert(0,'brother')
people.insert(2,'friend')
people.append('teacher')
print("Dear "+people[0]+", I'd like to invite you to have dinner with me on Friday at my home.")
print("Dear "+people[1]+", I'd like to invite you to have dinner ... | people = ['mom', 'dad', 'sister']
print('Now there will be a larger dining-table.')
people.insert(0, 'brother')
people.insert(2, 'friend')
people.append('teacher')
print('Dear ' + people[0] + ", I'd like to invite you to have dinner with me on Friday at my home.")
print('Dear ' + people[1] + ", I'd like to invite you t... |
while True:
answer = input("Enter something, q to quit outer: ")
if answer == "q":
break
while True:
next_answer = input("Enter something else, q to quit inner: ")
if next_answer == "q":
break
else:
# rest of loop...
continue
... | while True:
answer = input('Enter something, q to quit outer: ')
if answer == 'q':
break
while True:
next_answer = input('Enter something else, q to quit inner: ')
if next_answer == 'q':
break
else:
continue
break |
n = int(input())
arr = list(map(int, input().split(' ')))
arr.sort(reverse=True)
for i in range(n-2):
if arr[i+2]+arr[i+1]>arr[i]:
print(arr[i+2],arr[i+1],arr[i])
break
if i==n-3:
print(-1)
| n = int(input())
arr = list(map(int, input().split(' ')))
arr.sort(reverse=True)
for i in range(n - 2):
if arr[i + 2] + arr[i + 1] > arr[i]:
print(arr[i + 2], arr[i + 1], arr[i])
break
if i == n - 3:
print(-1) |
# -*- coding: utf-8 -*-
class DoNothing():
def __init__(self):
print("Do Nothing")
| class Donothing:
def __init__(self):
print('Do Nothing') |
class LogMetricsConfig:
enable_logmetrics = True
enable_frontend_request = True
enable_frontend_response = True
enable_backend = True
enable_backend_request = True
enable_backend_response = True
@classmethod
def set_internal_state(cls, enable_logmetrics=True,
... | class Logmetricsconfig:
enable_logmetrics = True
enable_frontend_request = True
enable_frontend_response = True
enable_backend = True
enable_backend_request = True
enable_backend_response = True
@classmethod
def set_internal_state(cls, enable_logmetrics=True, enable_frontend_request=Tru... |
{
"targets": [
{
"target_name": "ccio",
"sources": [ "src/ccio.cc" ]
}
]
} | {'targets': [{'target_name': 'ccio', 'sources': ['src/ccio.cc']}]} |
#!/usr/bin/python2.5
#
# Copyright 2009 the Melange authors.
#
# 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... | """Helpers used for list info functions.
"""
__authors__ = ['"Lennard de Rijk" <ljvderijk@gmail.com>']
def get_student_proposal_info(ranking, proposals_keys):
"""Returns a function that returns information about the rank and assignment.
Args:
ranking: dict with a mapping from Student Proposal key to rank
... |
# -*- coding: utf-8 -*-
fr = file("OSHW_COPPER_10MM.mod", "r")
fw = file("OSHW_COPPER_10MM.2.mod", "w")
d = fr.read()
fr.close()
d = d.splitlines()
for l in d:
if l[0:2] == "Sh":
l = l.split()
l[3] = str(int(int(l[3]) / 4.8))
l[4] = str(int(int(l[4]) / 4.8))
l[6] = str(int(int(l[6]) / 4.8))
l =... | fr = file('OSHW_COPPER_10MM.mod', 'r')
fw = file('OSHW_COPPER_10MM.2.mod', 'w')
d = fr.read()
fr.close()
d = d.splitlines()
for l in d:
if l[0:2] == 'Sh':
l = l.split()
l[3] = str(int(int(l[3]) / 4.8))
l[4] = str(int(int(l[4]) / 4.8))
l[6] = str(int(int(l[6]) / 4.8))
l = ' '.... |
# FileErrors
class FileError(Exception):
def __init__(self, filename, action):
self.filename = filename
self.action = action
if self.action == 'r': self.action = 'read'
elif self.action == 'w': self.action = 'write'
class FileOpenError(FileError):
def __str__(self):
... | class Fileerror(Exception):
def __init__(self, filename, action):
self.filename = filename
self.action = action
if self.action == 'r':
self.action = 'read'
elif self.action == 'w':
self.action = 'write'
class Fileopenerror(FileError):
def __str__(self):... |
load("@npm//@bazel/typescript:index.bzl", _ts_library = "ts_library")
load("@npm//@bazel/esbuild:index.bzl", _esbuild = "esbuild")
load("@npm//esbuild-visualizer:index.bzl", "esbuild_visualizer")
def ts_library(name, **kwargs):
module_name = kwargs["module_name"] if "module_name" in kwargs else None
package_na... | load('@npm//@bazel/typescript:index.bzl', _ts_library='ts_library')
load('@npm//@bazel/esbuild:index.bzl', _esbuild='esbuild')
load('@npm//esbuild-visualizer:index.bzl', 'esbuild_visualizer')
def ts_library(name, **kwargs):
module_name = kwargs['module_name'] if 'module_name' in kwargs else None
package_name =... |
# https://leetcode.com/explore/learn/card/fun-with-arrays/527/searching-for-items-in-an-array/3250/
arr = [-8,-2,11,12,17]
original = 0
arr = list(set(arr))
ln = len(arr)
for i,elmnt in enumerate(arr):
original = arr[i]
arr[i] = arr[i]*2
if len(set(arr))<ln:
print(arr)
print(set(arr))
print(elmnt,"true")
if ... | arr = [-8, -2, 11, 12, 17]
original = 0
arr = list(set(arr))
ln = len(arr)
for (i, elmnt) in enumerate(arr):
original = arr[i]
arr[i] = arr[i] * 2
if len(set(arr)) < ln:
print(arr)
print(set(arr))
print(elmnt, 'true')
if original % 2 == 0:
arr[i] = original / 2
if... |
#
# PySNMP MIB module Nortel-Magellan-Passport-ExtensionsMIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-ExtensionsMIB
# Produced by pysmi-0.3.4 at Wed May 1 14:27:03 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, single_value_constraint, value_range_constraint, constraints_union, value_size_constraint) ... |
bp = [3,2,1] #buying power
g,s,c = input().split()
g,s,c = int(g), int(s), int(c)
tbp = g*bp[0] + s*bp[1] + c*bp[2]
ss = ""
#victory cards
if tbp >= 8:
ss += "Province"
elif tbp >=5 and tbp < 8:
ss += "Duchy"
elif tbp >= 2 and tbp < 5:
ss += "Estate"
ss += " or " if len(ss)>0 else ""
#treasure cards... | bp = [3, 2, 1]
(g, s, c) = input().split()
(g, s, c) = (int(g), int(s), int(c))
tbp = g * bp[0] + s * bp[1] + c * bp[2]
ss = ''
if tbp >= 8:
ss += 'Province'
elif tbp >= 5 and tbp < 8:
ss += 'Duchy'
elif tbp >= 2 and tbp < 5:
ss += 'Estate'
ss += ' or ' if len(ss) > 0 else ''
if tbp >= 6:
ss += 'Gold'
e... |
class PostDTO(object):
def __init__(self, post_obj):
# Setting attribute for each field
for key, value in post_obj.__dict__.items():
if not key.startswith("__"):
setattr(self, key, value)
# Now setting attribute for foreign, one to one, and/or m2m fields
... | class Postdto(object):
def __init__(self, post_obj):
for (key, value) in post_obj.__dict__.items():
if not key.startswith('__'):
setattr(self, key, value)
for (key, value) in self.__dict__.get('_prefetched_objects_cache').items():
if not key.startswith('__') ... |
'''
Known Peripheral UUIDs, obtained by querying using the Bluepy module:
=====================================================================
Anti DOS Characteristic <00020005-574f-4f20-5370-6865726f2121>
Battery Level Characteristic <Battery Level>
Peripheral Preferred Connection Parameters Characteristic <Periphera... | """
Known Peripheral UUIDs, obtained by querying using the Bluepy module:
=====================================================================
Anti DOS Characteristic <00020005-574f-4f20-5370-6865726f2121>
Battery Level Characteristic <Battery Level>
Peripheral Preferred Connection Parameters Characteristic <Periphera... |
"""
29
medium
divide two integers
"""
class Solution:
def divide(self, dividend: int, divisor: int) -> int:
# add the negative values
# enforce the integer limits
# pass
MAX_INT = 2147483647
MIN_INT = -2147483648
HALF_MIN_INT = 1073741823
if dividend < MI... | """
29
medium
divide two integers
"""
class Solution:
def divide(self, dividend: int, divisor: int) -> int:
max_int = 2147483647
min_int = -2147483648
half_min_int = 1073741823
if dividend < MIN_INT or dividend > MAX_INT:
return MAX_INT
if dividend == MIN_INT a... |
# optimizer
optimizer = dict(type='SGD',
lr=4e-3,
momentum=0.9,
weight_decay=0.0001,
) # paramwise_options=dict(bias_lr_mult=2, bias_decay_mult=0))
optimizer_config = dict(grad_clip=dict(max_norm=10, norm_type=2))
# learning policy
lr_config = dict(
... | optimizer = dict(type='SGD', lr=0.004, momentum=0.9, weight_decay=0.0001)
optimizer_config = dict(grad_clip=dict(max_norm=10, norm_type=2))
lr_config = dict(policy='step', warmup='linear', warmup_iters=5000, warmup_ratio=0.1, step=[12, 24, 36, 48, 60, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124, 128, ... |
# coding: utf-8
# In[4]:
x = [0.0, 3.0, 5.0, 2.5, 3.7] #define array
print(type(x))
#remove 3rd element
x.remove(2.5)
print(x)
#add an element at the end
x.append(1.2)
print(x)
#get a copy
y = x.copy()
print(y)
#show many elements are 0.0
print(y.count(0.0))
#print index with value 3.7
#sort the list
y.sort
p... | x = [0.0, 3.0, 5.0, 2.5, 3.7]
print(type(x))
x.remove(2.5)
print(x)
x.append(1.2)
print(x)
y = x.copy()
print(y)
print(y.count(0.0))
y.sort
print(y)
y.reverse()
print(y)
y.clear()
print(y) |
class HazardCategory:
"""Classifies the problem as into one of the hazard categories.
This information is useful for analysis and retrieval but does not directly affect the default textual presentation of the alert.
Support for this field is under discussion.
Attributes:
_label (string): nam... | class Hazardcategory:
"""Classifies the problem as into one of the hazard categories.
This information is useful for analysis and retrieval but does not directly affect the default textual presentation of the alert.
Support for this field is under discussion.
Attributes:
_label (string): nam... |
class Solution:
def checkPerfectNumber(self, num):
"""
:type num: int
:rtype: bool
"""
if num <= 1:
return False
tot = 1
for i in range(2, int(num ** 0.5)+1):
if num % i == 0:
if i != num // i:
tot +=... | class Solution:
def check_perfect_number(self, num):
"""
:type num: int
:rtype: bool
"""
if num <= 1:
return False
tot = 1
for i in range(2, int(num ** 0.5) + 1):
if num % i == 0:
if i != num // i:
t... |
#!/usr/local/bin/python3
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the L... | def read_lines(filename):
content = ()
with open(filename) as f:
content = f.readlines()
content = [x.rstrip() for x in content]
return content
def scan_file(filename, callback):
with open(filename) as f:
for line in f:
callback(line)
def scan_file_with_context(filename... |
# http://stackoverflow.com/questions/4999233/how-to-raise-error-if-duplicates-keys-in-dictionary
class RejectingDict(dict):
def __setitem__(self, k, v):
if k in self:
raise ValueError("Key is already present: " + repr(k))
return super().__setitem__(k, v)
def force_insert(self, k, v)... | class Rejectingdict(dict):
def __setitem__(self, k, v):
if k in self:
raise value_error('Key is already present: ' + repr(k))
return super().__setitem__(k, v)
def force_insert(self, k, v):
return super().__setitem__(k, v)
class Patchingexception(Exception):
pass
class... |
# Python port of LowMC.cpp found at
# https://github.com/LowMC/lowmc/blob/master/LowMC.cpp
def xor_block(block1, block2):
return [b1 ^ b2 for b1, b2 in zip(block1, block2)]
state = None # Keeps the 80 bit LSFR state
def init_encrypt(_constant, _constants):
#
# Python polyfills for C++ std::bitset
#
... | def xor_block(block1, block2):
return [b1 ^ b2 for (b1, b2) in zip(block1, block2)]
state = None
def init_encrypt(_constant, _constants):
bitset = lambda n, b: list([b]) * n
numofboxes = 1
blocksize = 128
keysize = 40
rounds = 1
block = lambda : bitset(blocksize, 0)
keyblock = lambda : ... |
"""
Context Processor
To include the notifications varialbe in all templates.
"""
def notifications(request):
"""Make notifications available in all templates."""
if not request.user.is_authenticated:
return {}
return {'notifications': request.user.notifications}
| """
Context Processor
To include the notifications varialbe in all templates.
"""
def notifications(request):
"""Make notifications available in all templates."""
if not request.user.is_authenticated:
return {}
return {'notifications': request.user.notifications} |
# WORKFLOW_CONFIG: Configuration information for the Plant IT server
WORKFLOW_CONFIG = {
###
# These values should not need changed.
###
#Human readable workflow name
"name": "Plant Image Analysis",
#Human readable description
"description": "",
#Location of icon to show for the workf... | workflow_config = {'name': 'Plant Image Analysis', 'description': '', 'icon_loc': 'workflows/plant_image_analysis/icon.png', 'api_version': 0.1, 'app_name': 'plant_image_analysis', 'singularity_url': 'singularity shell shub://lsx1980/plant-image-analysis'}
parameters = [{'id': 'settings', 'name': 'Workflow Settings', '... |
Import("env")
def fixLinkFlag (s):
return s[4:] if s.startswith('-Wl,-T') else s
env.Replace(LINKFLAGS = [fixLinkFlag(i) for i in env['LINKFLAGS']])
| import('env')
def fix_link_flag(s):
return s[4:] if s.startswith('-Wl,-T') else s
env.Replace(LINKFLAGS=[fix_link_flag(i) for i in env['LINKFLAGS']]) |
#$Id: LikelihoodLib.py,v 1.6 2015/12/10 00:57:57 echarles Exp $
def generate(env, **kw):
if not kw.get('depsOnly',0):
env.Tool('addLibrary', library=['Likelihood'])
env.Tool('astroLib')
env.Tool('xmlBaseLib')
env.Tool('tipLib')
env.Tool('evtbinLib')
env.Tool('map_toolsLib')
env.Tool(... | def generate(env, **kw):
if not kw.get('depsOnly', 0):
env.Tool('addLibrary', library=['Likelihood'])
env.Tool('astroLib')
env.Tool('xmlBaseLib')
env.Tool('tipLib')
env.Tool('evtbinLib')
env.Tool('map_toolsLib')
env.Tool('optimizersLib')
env.Tool('irfLoaderLib')
env.Tool('st_... |
class A:
def __init__(self):
self.a = 1
def _foo(self):
pass
a_class = A()
a_class._foo()
print(a_class.a)
| class A:
def __init__(self):
self.a = 1
def _foo(self):
pass
a_class = a()
a_class._foo()
print(a_class.a) |
carros = int(input())
hmin = 24
mmin = 60
hmax = 0
mmax = 0
for i in range(0,carros):
he,me,hs,ms = input().split()
he = int(he)
me = int(me)
hs = int(hs)
ms = int(ms)
if he < hmin:
hmin,mmin = he,me
elif he == hmin:
if me < mmin:
mmin = me
if hs > hmax:
... | carros = int(input())
hmin = 24
mmin = 60
hmax = 0
mmax = 0
for i in range(0, carros):
(he, me, hs, ms) = input().split()
he = int(he)
me = int(me)
hs = int(hs)
ms = int(ms)
if he < hmin:
(hmin, mmin) = (he, me)
elif he == hmin:
if me < mmin:
mmin = me
if hs >... |
class node:
def __init__(self, freq, char, children):
self.freq = freq
self.char = char
self.children = children
self.code = ''
def collect_code(node, huffman_code, result):
huffman_code = huffman_code + str(node.code)
for c in range(len(node.children)):
collect_code... | class Node:
def __init__(self, freq, char, children):
self.freq = freq
self.char = char
self.children = children
self.code = ''
def collect_code(node, huffman_code, result):
huffman_code = huffman_code + str(node.code)
for c in range(len(node.children)):
collect_cod... |
class OrderSpec(object):
'''
Base class for an order to buy/sell, and whether it succeeded ("filled")
'''
def __init__(self, buy=False, sell=False, price=0, qty=0,
src_tuple=None, empty=False):
if src_tuple is not None:
self.buy, self.sell, self.price, self.qty,... | class Orderspec(object):
"""
Base class for an order to buy/sell, and whether it succeeded ("filled")
"""
def __init__(self, buy=False, sell=False, price=0, qty=0, src_tuple=None, empty=False):
if src_tuple is not None:
(self.buy, self.sell, self.price, self.qty, self.empty) = ... |
"""
Functions to provide Jupyterhub Options forms for our custom spawners.
"""
label_style = "width: 25%"
input_style = "width: 75%"
div_style = "margin-bottom: 16px"
additional_info_style="margin-top: 4px; color: rgb(165,165,165); font-size: 12px;"
optional_label = "<span style=\"font-size: 12px; font-weight: 400;\">... | """
Functions to provide Jupyterhub Options forms for our custom spawners.
"""
label_style = 'width: 25%'
input_style = 'width: 75%'
div_style = 'margin-bottom: 16px'
additional_info_style = 'margin-top: 4px; color: rgb(165,165,165); font-size: 12px;'
optional_label = '<span style="font-size: 12px; font-weight: 400;">(... |
load("//:compile.bzl", "proto_compile")
def ts_grpc_compile(**kwargs):
proto_compile(
plugins = [
str(Label("//github.com/grpc/grpc-web:ts")),
],
**kwargs
)
| load('//:compile.bzl', 'proto_compile')
def ts_grpc_compile(**kwargs):
proto_compile(plugins=[str(label('//github.com/grpc/grpc-web:ts'))], **kwargs) |
"""
Add contact trackers to Solution Information for all nonlinear contacts
=======================================================================
"""
model = ExtAPI.DataModel.Project.Model
analysis = model.Analyses[0]
sol_info = analysis.Solution.SolutionInformation
# Get all nonliner connections and contacts
conns... | """
Add contact trackers to Solution Information for all nonlinear contacts
=======================================================================
"""
model = ExtAPI.DataModel.Project.Model
analysis = model.Analyses[0]
sol_info = analysis.Solution.SolutionInformation
conns = model.Connections
contacts = conns.GetChild... |
#!/usr/bin/env python3
class Solution:
def maxProfitAssignment(self, difficulty, profit, worker):
worker, i = sorted(worker, reverse=True), 0
l, ret = len(worker), 0
for p, d in sorted(zip(profit, difficulty), reverse=True):
while i < l and worker[i] >= d:
ret, ... | class Solution:
def max_profit_assignment(self, difficulty, profit, worker):
(worker, i) = (sorted(worker, reverse=True), 0)
(l, ret) = (len(worker), 0)
for (p, d) in sorted(zip(profit, difficulty), reverse=True):
while i < l and worker[i] >= d:
(ret, i) = (ret +... |
class Memory:
def __init__(self):
self.setDefault()
def setDefault(self):
self.memory = [0, 0, 0, 0, 0, 0, 0]
def get(self, address):
return self.memory[address]
def write(self, address, data):
self.memory[address] = data | class Memory:
def __init__(self):
self.setDefault()
def set_default(self):
self.memory = [0, 0, 0, 0, 0, 0, 0]
def get(self, address):
return self.memory[address]
def write(self, address, data):
self.memory[address] = data |
def loading_bar(n):
ready = ("%"*int(n/10))
remain = ("."*int(10-n/10))
loading_bara = ready+remain
return loading_bara
n = int(input())
if n == 100:
print(f'100% Complete!\n')
print(f'[{loading_bar(n)}]')
else:
print(f'{n}% [{loading_bar(n)}]')
print(f'Still loading...')
# if number ... | def loading_bar(n):
ready = '%' * int(n / 10)
remain = '.' * int(10 - n / 10)
loading_bara = ready + remain
return loading_bara
n = int(input())
if n == 100:
print(f'100% Complete!\n')
print(f'[{loading_bar(n)}]')
else:
print(f'{n}% [{loading_bar(n)}]')
print(f'Still loading...') |
"""
Given an integer array, bits, that represents
a binary sequence (i.e. it only contains zeroes and ones),
return the length of the longest contiguous sequence of bits that contains the same number of zeroes and ones.
Ex: Given the following bits ...
bits = [1, 0, 1, 1, 0, 0], return 6 (the entire sequence has the ... | """
Given an integer array, bits, that represents
a binary sequence (i.e. it only contains zeroes and ones),
return the length of the longest contiguous sequence of bits that contains the same number of zeroes and ones.
Ex: Given the following bits ...
bits = [1, 0, 1, 1, 0, 0], return 6 (the entire sequence has the ... |
"""
MIT License
Copyright (c) 2022 Okimii
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, publish, distri... | """
MIT License
Copyright (c) 2022 Okimii
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, publish, distri... |
class Customer:
def __init__(self, cust_id, cust_name, location):
self.cust_id = cust_id
self.cust_name = cust_name
self.location = location
list_of_customers = [Customer(101, 'Mark', 'US'),
Customer(102, 'Jane', 'Japan'),
Customer(103, 'Kumar', 'I... | class Customer:
def __init__(self, cust_id, cust_name, location):
self.cust_id = cust_id
self.cust_name = cust_name
self.location = location
list_of_customers = [customer(101, 'Mark', 'US'), customer(102, 'Jane', 'Japan'), customer(103, 'Kumar', 'India')]
dict_of_customer = {}
for customer ... |
Persona1={'nombre':'Fernando', 'apellido':'Avalos','edad':'24', 'ciudad':'Saltillo'}
Persona2={'nombre':'Luis', 'apellido':'Fernandez','edad':'35', 'ciudad':'Monterrey'}
Persona3={'nombre':'Karina', 'apellido':'Gutierrez','edad':'15', 'ciudad':'San Pedro'}
People=[Persona1,Persona2,Persona3]
for per in People:
pr... | persona1 = {'nombre': 'Fernando', 'apellido': 'Avalos', 'edad': '24', 'ciudad': 'Saltillo'}
persona2 = {'nombre': 'Luis', 'apellido': 'Fernandez', 'edad': '35', 'ciudad': 'Monterrey'}
persona3 = {'nombre': 'Karina', 'apellido': 'Gutierrez', 'edad': '15', 'ciudad': 'San Pedro'}
people = [Persona1, Persona2, Persona3]
fo... |
r=range
n=128
h=""
for j in r(n):
u=256
l=list(r(u))
p=0
s=0
for i in map(ord,(f"hxtvlmkl-{j}\x11\x1fI/\x17")*64):
l=l[p:]+l[:p]
l[:i]=reversed(l[:i])
l=l[-p:]+l[:-p]
p=(p+s+i)%u
s+=1
k=0
for i in r(u):
k^=l[i]
if i%16==15:
h+=f"{k:08b}"
k=0
q=list(map(int,h))
print(sum(q))
s=0
for i in r(n*n... | r = range
n = 128
h = ''
for j in r(n):
u = 256
l = list(r(u))
p = 0
s = 0
for i in map(ord, f'hxtvlmkl-{j}\x11\x1fI/\x17' * 64):
l = l[p:] + l[:p]
l[:i] = reversed(l[:i])
l = l[-p:] + l[:-p]
p = (p + s + i) % u
s += 1
k = 0
for i in r(u):
k ^=... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | def get_profile_args(global_profile, local_profile):
args = []
a_encoder = None
a_tracks = None
if 'audio' in global_profile:
if 'encoder' in global_profile['audio']:
a_encoder = global_profile['audio']['encoder']
if 'tracks' in global_profile['audio']:
a_tracks =... |
class Solution:
def sumZero(self, n: int) -> List[int]:
s=-1
x=[]
if n%2==0:
for i in range(n//2):
x.append(s)
x.append(abs(s))
s=s-1
else:
x.append(0)
for i in range(n//2):
x.append(s... | class Solution:
def sum_zero(self, n: int) -> List[int]:
s = -1
x = []
if n % 2 == 0:
for i in range(n // 2):
x.append(s)
x.append(abs(s))
s = s - 1
else:
x.append(0)
for i in range(n // 2):
... |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def pathSum(self, root, sum):
"""
:type root: TreeNode
:type sum: int
:rtype: int
... | class Solution(object):
def path_sum(self, root, sum):
"""
:type root: TreeNode
:type sum: int
:rtype: int
"""
if not root:
return 0
res = [0]
self.helper(root, 0, sum, res)
return res[0] + self.pathSum(root.left, sum) + self.pathS... |
for _ in range(int(input())) :
n = int(input())
arr = list(map(int, input().split()))
x = min(arr)
if(arr.count(x)%2 is 0) :
print("Unlucky")
else :
print("Lucky") | for _ in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
x = min(arr)
if arr.count(x) % 2 is 0:
print('Unlucky')
else:
print('Lucky') |
x = int(input())
serie = []
for i in range(1, 101, 1):
serie.append((i*(x**i)/(i**2)))
media = 0
for i in serie:
media += i
media = media / 100
menorm = 0
for i in serie:
if i < media:
menorm += 1
print(menorm)
| x = int(input())
serie = []
for i in range(1, 101, 1):
serie.append(i * x ** i / i ** 2)
media = 0
for i in serie:
media += i
media = media / 100
menorm = 0
for i in serie:
if i < media:
menorm += 1
print(menorm) |
def is_palindrome(string):
return(string[::-1]).casefold() == string.casefold()
def palindrome_sentence(sentence):
string = ""
for char in sentence:
if char.isalnum():
string += char
print(string)
return is_palindrome(string)
word = input("Please input any word:")
if is_pal... | def is_palindrome(string):
return string[::-1].casefold() == string.casefold()
def palindrome_sentence(sentence):
string = ''
for char in sentence:
if char.isalnum():
string += char
print(string)
return is_palindrome(string)
word = input('Please input any word:')
if is_palin... |
"""Procedural-Generated Dungeon RPG
FileHandler.py
this is a prototype for a procedural-generated dungeon RPG
has bare-minimum graphics
created by rtgher 26/11/2014->
"""
__version__=0.2
__status__="Prototype"
__author__="traghera@gmail.com"
#License
""" The software itself is a free product. Anyone can d... | """Procedural-Generated Dungeon RPG
FileHandler.py
this is a prototype for a procedural-generated dungeon RPG
has bare-minimum graphics
created by rtgher 26/11/2014->
"""
__version__ = 0.2
__status__ = 'Prototype'
__author__ = 'traghera@gmail.com'
' The software itself is a free product. Anyone can download and instal... |
class Solution:
def threeSum(self, nums: List[int]) -> List[List[int]]:
res = deque()
s = set()
visited = set()
for ind, i in enumerate(nums):
d = {}
if i in visited: continue
visited.add(i)
for ind2 in range(ind+1, len(nums)):
... | class Solution:
def three_sum(self, nums: List[int]) -> List[List[int]]:
res = deque()
s = set()
visited = set()
for (ind, i) in enumerate(nums):
d = {}
if i in visited:
continue
visited.add(i)
for ind2 in range(ind + 1... |
{
'includes': [ 'deps/common.gyp' ],
'targets': [
{
'target_name': 'pHashBinding',
'defines': [
'HAVE_IMAGE_HASH',
'cimg_verbosity=0',
'cimg_use_png',
'cimg_use_jpeg',
],
'include_dirs': [
"<!(node -e \"require('nan')\")",
'deps/pHash',
... | {'includes': ['deps/common.gyp'], 'targets': [{'target_name': 'pHashBinding', 'defines': ['HAVE_IMAGE_HASH', 'cimg_verbosity=0', 'cimg_use_png', 'cimg_use_jpeg'], 'include_dirs': ['<!(node -e "require(\'nan\')")', 'deps/pHash', 'deps/libpng', 'deps/libjpeg'], 'sources': ['src/phash.cpp'], 'dependencies': ['deps/zlib/zl... |
dict(
path = "/home/lvapeab/smt/software/GroundHog/tutorials/DATA/ue.npz",
dictionary = "/home/lvapeab/smt/software/GroundHog/tutorials/DATA/ue_dict.npz",
chunks = 'words',
n_in = 4745,
n_out = 4745,
trainFreq = 500,
hookFreq = 1000,
validFreq = 1000,
inp_nhids = '[400]',
dout_nhid = '400',
nhids = '[400]',
seqlen ... | dict(path='/home/lvapeab/smt/software/GroundHog/tutorials/DATA/ue.npz', dictionary='/home/lvapeab/smt/software/GroundHog/tutorials/DATA/ue_dict.npz', chunks='words', n_in=4745, n_out=4745, trainFreq=500, hookFreq=1000, validFreq=1000, inp_nhids='[400]', dout_nhid='400', nhids='[400]', seqlen=40, join='concat', prefix='... |
_base_ = 'byol_resnet50_8xb256-fp16-accum2-coslr-200e_in1k.py'
# runtime settings
runner = dict(type='EpochBasedRunner', max_epochs=300)
| _base_ = 'byol_resnet50_8xb256-fp16-accum2-coslr-200e_in1k.py'
runner = dict(type='EpochBasedRunner', max_epochs=300) |
# vim: fileencoding=utf8:et:sw=4:ts=8:sts=4
NULL = 0
INT = 1
STR = 2
UTF = 3
SERIAL = 4
ALL = frozenset([NULL, INT, STR, UTF, SERIAL])
| null = 0
int = 1
str = 2
utf = 3
serial = 4
all = frozenset([NULL, INT, STR, UTF, SERIAL]) |
"""Constants for Plant monitor."""
# Base component constants
NAME = "Plant monitor"
DOMAIN = "plant_monitor"
DOMAIN_DATA = f"{DOMAIN}_data"
VERSION = "0.0.1"
ISSUE_URL = "https://github.com/praveendath92/plant_monitor/issues"
# Icons
ICON = "mdi:leaf"
# Platforms
SENSOR = "sensor"
PLATFORMS = [SENSOR]
# Defaults
D... | """Constants for Plant monitor."""
name = 'Plant monitor'
domain = 'plant_monitor'
domain_data = f'{DOMAIN}_data'
version = '0.0.1'
issue_url = 'https://github.com/praveendath92/plant_monitor/issues'
icon = 'mdi:leaf'
sensor = 'sensor'
platforms = [SENSOR]
default_name = DOMAIN
startup_message = f'\n-------------------... |
class Node(object):
"""A single node from a pattern.
Here, a node is defined as one character or group characters that
is a member of a comma seperated pattern. For example, given the
pattern,
foo,*,bar
`foo` would be the first node of the pattern.
"""
WILDCARD = '*'
def __in... | class Node(object):
"""A single node from a pattern.
Here, a node is defined as one character or group characters that
is a member of a comma seperated pattern. For example, given the
pattern,
foo,*,bar
`foo` would be the first node of the pattern.
"""
wildcard = '*'
def __in... |
class EsConfig:
ES = {"host": 'localhost', "port": 9200}
INDEX = 'ssh-connections-alias' | class Esconfig:
es = {'host': 'localhost', 'port': 9200}
index = 'ssh-connections-alias' |
# -*- coding: utf-8 -*-
#
# -- General configuration ----------------------------------------
source_suffix = '.rst'
master_doc = 'index'
project = u'sphinx theme for reveal.js'
copyright = u'2014, tell-k'
version = '0.3.0'
# -- Options for HTML output --------------------------------------
extension... | source_suffix = '.rst'
master_doc = 'index'
project = u'sphinx theme for reveal.js'
copyright = u'2014, tell-k'
version = '0.3.0'
extensions = ['sphinxjp.themes.revealjs']
html_theme = 'revealjs'
html_use_index = False
html_theme_options = {'lang': 'ja', 'width': 960, 'height': 700, 'margin': 0.1, 'min_scale': 0.2, 'ma... |
# def printlog(func):
# def wrapper(arg):
# print(f'CALLING: {func.__name__}')
# return func(arg)
# return wrapper
# @printlog
# def foo(x):
# print(x+2)
# foo(3)
# @printlog
# def baz(x, y):
# return x**y
# won't execute because wrapper only takes 1 positional argument
# def prin... | def prototype_decorator(func):
def wrapper(*args, **kwargs):
return func(*args, **kwargs)
return wrapper
def running_average(func):
data = {'total': 0, 'count': 0}
def wrapper(*args, **kwargs):
val = func(*args, **kwargs)
data['total'] += val
data['count'] += 1
... |
FLAIR_RULES_1 = [
{
"key": "ScanningSequence",
"value": ("Spin Echo", "Inversion Recovery"),
"lookup": "exact",
},
{
"key": "SequenceVariant",
"value": ("Segmented k-Space", "Spoiled", "MAG Prepared"),
"lookup": "exact",
},
]
FLAIR_RULES_2 = [
{
... | flair_rules_1 = [{'key': 'ScanningSequence', 'value': ('Spin Echo', 'Inversion Recovery'), 'lookup': 'exact'}, {'key': 'SequenceVariant', 'value': ('Segmented k-Space', 'Spoiled', 'MAG Prepared'), 'lookup': 'exact'}]
flair_rules_2 = [{'key': 'ScanningSequence', 'value': ('Spin Echo', 'Inversion Recovery'), 'lookup': 'e... |
# String; Dynamic Programming
# Given a string, your task is to count how many palindromic substrings in this string.
#
# The substrings with different start indexes or end indexes are counted as different substrings even they consist of same characters.
#
# Example 1:
# Input: "abc"
# Output: 3
# Explanation: Three p... | class Solution:
def count_substrings(self, s):
"""
:type s: str
:rtype: int
"""
s_len = len(s)
output = 0
for c in range(2 * sLen - 1):
l = C // 2
r = L + C % 2
while L >= 0 and R < sLen and (s[L] == s[R]):
... |
# Copyright (c) 2016 Mirantis, Inc.
#
# 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 wri... | class Staticactionresult(object):
def __init__(self, result, exception=None):
self._result = result
self._exception = exception
def get_result(self):
if self._exception:
raise self._exception
return self._result
def check_result(self):
return True
clas... |
"""
"""
class BaseCommand:
"""
"""
def __init__(self, debug=False):
"""
"""
self._debug = debug
def _print(self, message):
"""
"""
if self._debug:
print(" DEBUG: %s" % message)
def execute(self):
"""
"""
rais... | """
"""
class Basecommand:
"""
"""
def __init__(self, debug=False):
"""
"""
self._debug = debug
def _print(self, message):
"""
"""
if self._debug:
print(' DEBUG: %s' % message)
def execute(self):
"""
"""
raise no... |
"""
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
def test_permission_index(role_admin_client, permission):
url = '/admin/authorization/permissions'
response = role_admin_client.get(url)
assert response.status_code == 200
def test_role_index(role_a... | """
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
def test_permission_index(role_admin_client, permission):
url = '/admin/authorization/permissions'
response = role_admin_client.get(url)
assert response.status_code == 200
def test_role_index(role_adm... |
class Solution:
def reverse(self, x: int) -> int:
max_integer = 2 ** 31 - 1
min_integer = - 2 ** 31
sign = 1 if x >= 0 else -1
x = abs(x)
reverse = 0
while x > 0:
reverse = reverse * 10 + x % 10
x = x // 10
res ... | class Solution:
def reverse(self, x: int) -> int:
max_integer = 2 ** 31 - 1
min_integer = -2 ** 31
sign = 1 if x >= 0 else -1
x = abs(x)
reverse = 0
while x > 0:
reverse = reverse * 10 + x % 10
x = x // 10
res = sign * reverse
... |
# size(1000,1000)
# module = 250
# padding = 50
w = 1000
h = 1000
module = 100
padding = 20
size(w, h)
width = range(0, width(), module)
height = range(0, height(), module)
def recursion(xcenter, ycenter, radius):
fill(.7, 0.1, random(), random())
if radius <10:
return
else:
#green
... | w = 1000
h = 1000
module = 100
padding = 20
size(w, h)
width = range(0, width(), module)
height = range(0, height(), module)
def recursion(xcenter, ycenter, radius):
fill(0.7, 0.1, random(), random())
if radius < 10:
return
else:
fill(random(), 0.7, random(), 1)
rect(xcenter, ycente... |
#example program on Condiion statement (IBM Digital Nation Africa)
cost = float(10.5)
money = float(20.5)
if money>cost :
print("I can afford the Apple")
print("After the if statement")
#end-of-the-program | cost = float(10.5)
money = float(20.5)
if money > cost:
print('I can afford the Apple')
print('After the if statement') |
class HTTPClientError(Exception):
pass
class HTTPClientConnectionFailed(HTTPClientError):
pass
class PoolError(HTTPClientError):
pass
class URLResolverError(HTTPClientError):
pass
class UrlValidationError(URLResolverError):
pass
| class Httpclienterror(Exception):
pass
class Httpclientconnectionfailed(HTTPClientError):
pass
class Poolerror(HTTPClientError):
pass
class Urlresolvererror(HTTPClientError):
pass
class Urlvalidationerror(URLResolverError):
pass |
a = [2 ** x for x in range(4)]
i=0
while i!=4:
i += 1
a[i] = input("Ingresa tu numero")
print(a[i])
| a = [2 ** x for x in range(4)]
i = 0
while i != 4:
i += 1
a[i] = input('Ingresa tu numero')
print(a[i]) |
# -*- coding: utf-8 -*-
"""Top-level package for HTV-Learn."""
__author__ = """Joaquim Campos"""
__email__ = "joaquim.campos@hotmail.com"
| """Top-level package for HTV-Learn."""
__author__ = 'Joaquim Campos'
__email__ = 'joaquim.campos@hotmail.com' |
if 5 < 2:
3
else:
if True:
4 + 7
4 + 4
5 + 5 | if 5 < 2:
3
else:
if True:
4 + 7
4 + 4
5 + 5 |
#!/usr/bin/env python3
n, x, *a = map(int, open(0).read().split())
b = bin(x)[::-1]
s = 0
for i, k in enumerate(a):
if b[i:i+1] == "1":
s += k
print(s) | (n, x, *a) = map(int, open(0).read().split())
b = bin(x)[::-1]
s = 0
for (i, k) in enumerate(a):
if b[i:i + 1] == '1':
s += k
print(s) |
# -*- coding: utf-8 -*-
# Created by lvjiyong on 16/5/6
HOST = '192.168.0.1'
PORT = 8888
| host = '192.168.0.1'
port = 8888 |
class A(object):
__class__ = int
class B(A):
def foo(self):
return __class__
# <ref> | class A(object):
__class__ = int
class B(A):
def foo(self):
return __class__ |
def get_color():
# color is an RGB value in string, e.g # 255,1,0
color = input("Type the color in string(e.g. 255,1,0)")
Try = 1
while True:
if Try != 1:
color = input("Type the color in string(e.g. 255,1,0)")
elif Try == 3:
print("Too many attempts, 0 is retur... | def get_color():
color = input('Type the color in string(e.g. 255,1,0)')
try = 1
while True:
if Try != 1:
color = input('Type the color in string(e.g. 255,1,0)')
elif Try == 3:
print('Too many attempts, 0 is returned by default.')
return 0
try:
... |
#
# PySNMP MIB module BENU-KAFKA-CLIENT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BENU-KAFKA-CLIENT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:37:26 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, value_range_constraint, value_size_constraint, constraints_union) ... |
# We currently recommend using Python 3.5
username = "rithvik.chuppala@gmail.com" # Here enter your API user name
password = "p8N5Yag7RFc29Gjn4" # Here enter your API password
priaid_authservice_url = "https://sandbox-authservice.priaid.ch/login" # Be aware that sandbox link is for testing pourpose (not real data)... | username = 'rithvik.chuppala@gmail.com'
password = 'p8N5Yag7RFc29Gjn4'
priaid_authservice_url = 'https://sandbox-authservice.priaid.ch/login'
priaid_healthservice_url = 'https://sandbox-healthservice.priaid.ch'
language = 'en-gb'
pritn_raw_output = False |
CAMPAIGN_TRACKING_PARAMS = {
'cc': 'utm_content',
'ck': 'utm_term',
'cs': 'utm_source',
'cm': 'utm_medium',
'cn': 'utm_campaign',
'gclid': 'gclid',
}
| campaign_tracking_params = {'cc': 'utm_content', 'ck': 'utm_term', 'cs': 'utm_source', 'cm': 'utm_medium', 'cn': 'utm_campaign', 'gclid': 'gclid'} |
class MemCacheClient:
"""Class for testing purpose. Only implements classic cache methods.
Warning: Doesn't handle time expires"""
def __init__(self):
self.elements = {}
self.read_counter = 0
self.write_counter = 0
self.delete_counter = 0
def delete(self, key):
... | class Memcacheclient:
"""Class for testing purpose. Only implements classic cache methods.
Warning: Doesn't handle time expires"""
def __init__(self):
self.elements = {}
self.read_counter = 0
self.write_counter = 0
self.delete_counter = 0
def delete(self, key):
... |
# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php or see LICENSE file.
# Copyright 2007-2008 Brisa Team <brisa-develop@garage.maemo.org>
"""
BRisa UPnP Framework
B{Author:} BRisa Team <U{brisa-develop@garage.maemo.org}>
B{Version:} 0.10.0
B{License:} MIT License <U{http://opensource... | """
BRisa UPnP Framework
B{Author:} BRisa Team <U{brisa-develop@garage.maemo.org}>
B{Version:} 0.10.0
B{License:} MIT License <U{http://opensource.org/lincenses/mit-license.php}>
B{See also:}
- Home page <U{http://brisa.garage.maemo.org}>
- Project page <U{http://garage.maemo.org/projects/brisa}>
- Doc... |
# Program 1
# print(4)
# print("Hello Class") # Output: Hello Class
# a = "Hello Python"
# print(a) # Output: Hello Python
# message = "I am Studying in Uaf"
# abc = 123
# pi = 3.14
# print(message,abc,pi) # Output: I am studying in Uaf 123 3.14
# print(type(message)) # Output: <class 'int'>
# Program 2
# prin... | x = 12 // 3
print(type(x)) |
def print_board(board_input):
print(f'''
-------------
| {board_input[0]} | {board_input[1]} | {board_input[2]} |
-------------
| {board_input[3]} | {board_input[4]} | {board_input[5]} |
-------------
| {board_input[6]} | {board_input[7]} | {board_input[8]} |
-------------''')
q = 'y... | def print_board(board_input):
print(f'\n -------------\n | {board_input[0]} | {board_input[1]} | {board_input[2]} |\n -------------\n | {board_input[3]} | {board_input[4]} | {board_input[5]} |\n -------------\n | {board_input[6]} | {board_input[7]} | {board_input[8]} |\n -------------')
q = 'y'... |
class User:
def __init__(self, uid):
self.games = []
self.uid = uid
def submitCount(self):
count = 0
for game in self.games:
count += len(game.submits)
return count
class Game:
def __init__(self):
self.submits = []
def successful(self):
... | class User:
def __init__(self, uid):
self.games = []
self.uid = uid
def submit_count(self):
count = 0
for game in self.games:
count += len(game.submits)
return count
class Game:
def __init__(self):
self.submits = []
def successful(self):
... |
#####################
# Dennis MUD #
# sit.py #
# Copyright 2020 #
# Michael D. Reiley #
#####################
# **********
# 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 Softwa... | name = 'wake'
categories = ['actions', 'settings', 'users']
aliases = ['wake up']
usage = 'wake [target_name]'
description = 'Wake up from sleep or wake up [target_name].\n\nYou can use username or nickname, whole or partial names for your target.\n\nEx. `wake`\nEx2. `wake up Seisatsu`'
def command(console, args):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.