content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# -*- coding: utf-8 -*-
'''
Helper functions
'''
def get_value_or_none(value):
value = float(value)
if value == -1.0:
return None
return value
def gazepoint_to_icl_pointlist_v1(gp):
x = get_value_or_none(gp['comb_x'])
y = get_value_or_none(gp['comb_y'])
return [x, y]
def gazepoint_to_... | """
Helper functions
"""
def get_value_or_none(value):
value = float(value)
if value == -1.0:
return None
return value
def gazepoint_to_icl_pointlist_v1(gp):
x = get_value_or_none(gp['comb_x'])
y = get_value_or_none(gp['comb_y'])
return [x, y]
def gazepoint_to_icl_cyclops_v1(gp):
... |
current_floor = 0
with open("exercise_and_input/01/input.txt", "r") as f:
content = f.readlines()
parens = content[0].strip()
current_floor += parens.count("(")
current_floor -= parens.count(")")
print(f"Last floor : {current_floor}")
# Now we go one by one to find when santa gets in the basement
current_floo... | current_floor = 0
with open('exercise_and_input/01/input.txt', 'r') as f:
content = f.readlines()
parens = content[0].strip()
current_floor += parens.count('(')
current_floor -= parens.count(')')
print(f'Last floor : {current_floor}')
current_floor = 0
for (idx, char) in enumerate(parens):
if char == '(':
... |
def maxPoints(elements):
# Write your code here
retMaxPoints = 0
uniqueElements = set()
for tElement in elements:
uniqueElements.add(tElement)
countElements = {}
for tElement in elements:
if(tElement not in countElements):
countElements[tElement] = 0
cou... | def max_points(elements):
ret_max_points = 0
unique_elements = set()
for t_element in elements:
uniqueElements.add(tElement)
count_elements = {}
for t_element in elements:
if tElement not in countElements:
countElements[tElement] = 0
countElements[tElement] += 1
... |
RANDOM_SEED = 42
N_SAMPLE = 1000
ERROR_THRESHOLD = .5
NUM_FEATURES = 6
TREATMENT_COL = 'treatment'
SCORE_COL = 'score'
GROUP_COL = 'group'
OUTCOME_COL = 'outcome'
CONTROL_NAME = 'control'
TREATMENT_NAMES = [CONTROL_NAME, 'treatment1', 'treatment2', 'treatment3']
CONVERSION = 'conversion'
| random_seed = 42
n_sample = 1000
error_threshold = 0.5
num_features = 6
treatment_col = 'treatment'
score_col = 'score'
group_col = 'group'
outcome_col = 'outcome'
control_name = 'control'
treatment_names = [CONTROL_NAME, 'treatment1', 'treatment2', 'treatment3']
conversion = 'conversion' |
'''
Python program to find the largest number where commas or periods are decimal points.
Input:
['100', '102,1', '101.1']
Output:
102.1
'''
#License: https://bit.ly/3oLErEI
def test(str_nums):
str_nums_formatted = []
for s in str_nums:
str_nums_formatted.append (float(s.replace(",", ".")))
... | """
Python program to find the largest number where commas or periods are decimal points.
Input:
['100', '102,1', '101.1']
Output:
102.1
"""
def test(str_nums):
str_nums_formatted = []
for s in str_nums:
str_nums_formatted.append(float(s.replace(',', '.')))
return max(str_nums_formatted)
str_nums... |
class Farm:
def visit_chickens(self) -> str:
return "cluck"
def visit_cows(self) -> str:
return "moo"
def visit_animals(animal: str) -> str:
"""
post: __return__ != "moo"
"""
try:
return getattr(Farm(), "visit_" + animal)()
except:
return ""
| class Farm:
def visit_chickens(self) -> str:
return 'cluck'
def visit_cows(self) -> str:
return 'moo'
def visit_animals(animal: str) -> str:
"""
post: __return__ != "moo"
"""
try:
return getattr(farm(), 'visit_' + animal)()
except:
return '' |
a=[[1,2,3],[4,5,6]]
b=[[0,0],[0,0],[0,0]]
for i in range(3):
for y in range(2):
b[i][y]=a[y][i]
print(b) | a = [[1, 2, 3], [4, 5, 6]]
b = [[0, 0], [0, 0], [0, 0]]
for i in range(3):
for y in range(2):
b[i][y] = a[y][i]
print(b) |
def generate_readable_list(list_to_process):
"""
Generate the message for get_command() to print when the user provides an
input that does not match any commands.
Arguments
---------
commands : list[str]
The list of commands that can be entered.
Returns
-------
... | def generate_readable_list(list_to_process):
"""
Generate the message for get_command() to print when the user provides an
input that does not match any commands.
Arguments
---------
commands : list[str]
The list of commands that can be entered.
Returns
-------
... |
"""
Module to load object
"""
class OBJ:
"""
Class to load object
"""
def __init__(self, filename, swapyz=False):
"""Loads a Wavefront OBJ file. """
self.vertices = []
self.normals = []
self.texcoords = []
self.faces = []
material = None... | """
Module to load object
"""
class Obj:
"""
Class to load object
"""
def __init__(self, filename, swapyz=False):
"""Loads a Wavefront OBJ file. """
self.vertices = []
self.normals = []
self.texcoords = []
self.faces = []
material = None
for line... |
class BoardListProcessor:
def getCardsPerListData(self, lists):
output_data = {}
for l,cards in lists.items():
output_data[l] = len(cards)
return output_data
def getCardsPerMemberData(self, lists, members):
output_data = {}
output_data = {... | class Boardlistprocessor:
def get_cards_per_list_data(self, lists):
output_data = {}
for (l, cards) in lists.items():
output_data[l] = len(cards)
return output_data
def get_cards_per_member_data(self, lists, members):
output_data = {}
output_data = {}
... |
# this is a comment. anything on a line that starts with a # is not treated by Python as code
def my_function(a, var, var2, var_3, some_var, another_var, cow, pig):
print(a + var + var2 + var_3 + some_var + another_var + cow + pig)
my_function(8, 16, 32, 64, 128, 256, 512, 1024)
| def my_function(a, var, var2, var_3, some_var, another_var, cow, pig):
print(a + var + var2 + var_3 + some_var + another_var + cow + pig)
my_function(8, 16, 32, 64, 128, 256, 512, 1024) |
KEYWORDS_LIST = [
# 'yellow vests',
# '#yellowvests',
# 'gilets jaunes',
# '#giletsjaunes',
# 'macron',
# 'french protests',
'brexit'
]
| keywords_list = ['brexit'] |
splunk = 'https://SPLUNK-SERVER-HERE'
port = 'SPLUNK-HEC-PORT-HERE'
token = "SPLUNK-HEC-TOKEN-HERE"
def heckle(splunk, port, message, token):
token = "Splunk " + token
req = requests.post(splunk + ":"+ port + "/services/collector/raw", headers = { 'Authorization': token }, data = message)
if req.status_c... | splunk = 'https://SPLUNK-SERVER-HERE'
port = 'SPLUNK-HEC-PORT-HERE'
token = 'SPLUNK-HEC-TOKEN-HERE'
def heckle(splunk, port, message, token):
token = 'Splunk ' + token
req = requests.post(splunk + ':' + port + '/services/collector/raw', headers={'Authorization': token}, data=message)
if req.status_code == ... |
#
# File: psaExceptions.py
# Created: 05/09/2014
# Author: Francesco Ciaccia
#
# Description:
# Custom execption class to manage error in the PSC
#
class psaExceptions():
class confRetrievalFailed(Exception):
pass | class Psaexceptions:
class Confretrievalfailed(Exception):
pass |
def join_terms(terms):
if len(terms) == 0:
return "0"
rval = ""
first = True
for sign, factors in terms:
if first:
if sign != '+':
rval += sign
first = False
else:
rval += " {} ".format(sign)
if not factors:
rval += "1"
else:
rval += " ".join(factors)
... | def join_terms(terms):
if len(terms) == 0:
return '0'
rval = ''
first = True
for (sign, factors) in terms:
if first:
if sign != '+':
rval += sign
first = False
else:
rval += ' {} '.format(sign)
if not factors:
... |
#~~~~~~ GAMES RULES ~~~~~~
#~~~~~~ DICTIONARIES ~~~~~~
#----- English -----
letters_english = [] #total length must be 100
for i in range(12):
letters_english.append('E')
for i in range(9):
letters_english.append('I')
letters_english.append('A')
for i in range(8):
letters_english.append('O')
for i in range(6):
... | letters_english = []
for i in range(12):
letters_english.append('E')
for i in range(9):
letters_english.append('I')
letters_english.append('A')
for i in range(8):
letters_english.append('O')
for i in range(6):
letters_english.append('N')
letters_english.append('R')
letters_english.append('T'... |
"""
Sandbox for developing natural language processing (NLP) tools for
Pylearn2, including datasets and models
"""
| """
Sandbox for developing natural language processing (NLP) tools for
Pylearn2, including datasets and models
""" |
class Solution:
def longestSubstring(self, s: str, k: int) -> int:
if len(s) < k:
return 0
for c in set(s):
if s.count(c) < k:
return max(self.longestSubstring(t, k) for t in s.split(c))
return len(s)
| class Solution:
def longest_substring(self, s: str, k: int) -> int:
if len(s) < k:
return 0
for c in set(s):
if s.count(c) < k:
return max((self.longestSubstring(t, k) for t in s.split(c)))
return len(s) |
if len(editor.getSelText()) > 0:
editor.copy()
else:
editor.copyText(editor.getCurLine())
| if len(editor.getSelText()) > 0:
editor.copy()
else:
editor.copyText(editor.getCurLine()) |
ta = [int(e) for e in input().split()]
tb = [int(e) for e in input().split()]
sa = 0
sb = 0
for i in range(3):
if ta[i] > tb[i]:
sa += 1
elif ta[i] < tb[i]:
sb += 1
print(f'{sa} {sb}')
| ta = [int(e) for e in input().split()]
tb = [int(e) for e in input().split()]
sa = 0
sb = 0
for i in range(3):
if ta[i] > tb[i]:
sa += 1
elif ta[i] < tb[i]:
sb += 1
print(f'{sa} {sb}') |
def smart_truncate(content, length=120, suffix='...'):
if len(content) <= length:
return content
else:
return ' '.join(content[:length + 1].split(' ')[0:-1]) + suffix
| def smart_truncate(content, length=120, suffix='...'):
if len(content) <= length:
return content
else:
return ' '.join(content[:length + 1].split(' ')[0:-1]) + suffix |
n = int(input())
for i in range(n,0,-1):
for j in range(i*2):
print('*',end=' ')
print()
for i in range(1,n+1):
for j in range(i*2):
print('*',end=' ')
print()
| n = int(input())
for i in range(n, 0, -1):
for j in range(i * 2):
print('*', end=' ')
print()
for i in range(1, n + 1):
for j in range(i * 2):
print('*', end=' ')
print() |
"""
Problem 48
The series, 1^1 + 2^2 + 3^3 + ... + 10^10 = 10405071317.
Find the last ten digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000.
"""
# brute-force method
num = 0
for i in range(1, 1001):
num += i**i
print ( str(num)[-10:] ) | """
Problem 48
The series, 1^1 + 2^2 + 3^3 + ... + 10^10 = 10405071317.
Find the last ten digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000.
"""
num = 0
for i in range(1, 1001):
num += i ** i
print(str(num)[-10:]) |
#!/usr/bin/env python
"""
Take the following IPv4 address: 128.32.10.1 This address has 4 octets where each octet is a single byte (or 8 bits).
1st octet 128 has the binary representation: 10000000
2nd octet 32 has the binary representation: 00100000
3rd octet 10 has the binary representation: 00001010
... | """
Take the following IPv4 address: 128.32.10.1 This address has 4 octets where each octet is a single byte (or 8 bits).
1st octet 128 has the binary representation: 10000000
2nd octet 32 has the binary representation: 00100000
3rd octet 10 has the binary representation: 00001010
4th octet 1 has the b... |
n = 0
while n < 10:
n = n + 1
if n % 2 == 0:
continue
print(n)
else:
print('executed done')
| n = 0
while n < 10:
n = n + 1
if n % 2 == 0:
continue
print(n)
else:
print('executed done') |
def execution_time(fn, *args):
start = time.time()
fn(args) if args else fn()
end = time.time()
t = end - start
print('fn {} took {} s to run'.format(fn.__name__, t))
| def execution_time(fn, *args):
start = time.time()
fn(args) if args else fn()
end = time.time()
t = end - start
print('fn {} took {} s to run'.format(fn.__name__, t)) |
class RunTests:
def __init__(self):
self.testlist = {}
self.test_idx = 0
def add(self, test):
self.testlist[len(self.testlist)] = test
def start_test(self):
if self.test_idx >= len(self.testlist):
return
idx = self.test_idx
self.test_idx += 1
... | class Runtests:
def __init__(self):
self.testlist = {}
self.test_idx = 0
def add(self, test):
self.testlist[len(self.testlist)] = test
def start_test(self):
if self.test_idx >= len(self.testlist):
return
idx = self.test_idx
self.test_idx += 1
... |
script = """
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
&& curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | apt-key add - \
&& curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update
sudo apt-ge... | script = '\ndistribution=$(. /etc/os-release;echo $ID$VERSION_ID) && curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | apt-key add - && curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | tee /etc/apt/sources.list.d/nvidia-docker.list\n\nsudo apt-get update\nsudo apt-get ... |
#! python3
print("2.3")
name = "peter"
print(f"Hello {name.title()}!. Do you want learn Python ")
print("2.4")
name = "peter"
print(name.title())
print(name.upper())
print(name.lower())
print("2.5")
name = "albert einstein"
print(f"{name.title()} once said: 'A person who never made a mistake never tried anything new... | print('2.3')
name = 'peter'
print(f'Hello {name.title()}!. Do you want learn Python ')
print('2.4')
name = 'peter'
print(name.title())
print(name.upper())
print(name.lower())
print('2.5')
name = 'albert einstein'
print(f"{name.title()} once said: 'A person who never made a mistake never tried anything new.'")
print('2.... |
"""AWS API Errors"""
class AWSError(Exception):
"""Base-class for all AWS Errors"""
code = 'InvalidRequest'
status = 400
class AWSSignatureMismatch(AWSError):
"""Error codes from https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html"""
code = 'SignatureDoesNotMatch'
status = 4... | """AWS API Errors"""
class Awserror(Exception):
"""Base-class for all AWS Errors"""
code = 'InvalidRequest'
status = 400
class Awssignaturemismatch(AWSError):
"""Error codes from https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html"""
code = 'SignatureDoesNotMatch'
status = 403
... |
#!/usr/bin/env python3
# License MIT
# Copyright 2016-2021 Alex Winkler
# Version 3.0.0
guild_ids = [
93055209017729024,
223949725068427264
]
logtarget = 339287109988909057 # Here the channel id of the channel we want the private channel logs to be stored in
privcat = 360564294401916929 # This is the id of the "Pr... | guild_ids = [93055209017729024, 223949725068427264]
logtarget = 339287109988909057
privcat = 360564294401916929 |
def read_off(file):
f=file.readline().strip()
n_verts, n_faces, n_dontknow = tuple([int(s) for s in file.readline().strip().split(' ')])
verts = [[float(s) for s in file.readline().strip().split(' ')] for i_vert in range(n_verts)]
faces = [[int(s) for s in file.readline().strip().split(' ')][1:] for i_f... | def read_off(file):
f = file.readline().strip()
(n_verts, n_faces, n_dontknow) = tuple([int(s) for s in file.readline().strip().split(' ')])
verts = [[float(s) for s in file.readline().strip().split(' ')] for i_vert in range(n_verts)]
faces = [[int(s) for s in file.readline().strip().split(' ')][1:] for... |
"""Settings for the ``multilingual_project_blog`` app."""
CANONICAL_URL_IGNORE_PATTERNS = [
r'\.ico',
r'\.ics',
r'/ctype/$',
r'/admin/',
]
HERO_SLIDER_APPS_MODELS_LIST = [
('multilingual_news', 'newsentry'),
('document_library', 'document'),
('multilingual_events', 'event'),
]
| """Settings for the ``multilingual_project_blog`` app."""
canonical_url_ignore_patterns = ['\\.ico', '\\.ics', '/ctype/$', '/admin/']
hero_slider_apps_models_list = [('multilingual_news', 'newsentry'), ('document_library', 'document'), ('multilingual_events', 'event')] |
def make_generators_generator(g):
"""Generates all the "sub"-generators of the generator returned by
the generator function g.
>>> def every_m_ints_to(n, m):
... i = 0
... while (i <= n):
... yield i
... i += m
...
>>> def every_3_ints_to_10():
... fo... | def make_generators_generator(g):
"""Generates all the "sub"-generators of the generator returned by
the generator function g.
>>> def every_m_ints_to(n, m):
... i = 0
... while (i <= n):
... yield i
... i += m
...
>>> def every_3_ints_to_10():
... fo... |
#
# PySNMP MIB module IBM2212-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IBM2212-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:39:45 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, 0... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_union, value_range_constraint, constraints_intersection, single_value_constraint) ... |
#!/usr/bin/env python
n = input("Type in an integer for the amount of fibonacci numbers you want.")
def fibs(n):
fib_list = [1]
a=0
b=1
while n > 1:
fib_list.append(a+b)
c=a
a=b
b=b+c
n=n-1
return(fib_list)
print(fibs(n)) | n = input('Type in an integer for the amount of fibonacci numbers you want.')
def fibs(n):
fib_list = [1]
a = 0
b = 1
while n > 1:
fib_list.append(a + b)
c = a
a = b
b = b + c
n = n - 1
return fib_list
print(fibs(n)) |
def write_rel(output_path: str, rel: list, header: list, use_floats: [bool, None] = False):
print(f"Writing python job output to {output_path}")
with open(output_path, "w") as f:
f.write(f"{','.join(header)}\n")
if not use_floats:
rows_formatted = [",".join(str(int(v)) for v in r... | def write_rel(output_path: str, rel: list, header: list, use_floats: [bool, None]=False):
print(f'Writing python job output to {output_path}')
with open(output_path, 'w') as f:
f.write(f"{','.join(header)}\n")
if not use_floats:
rows_formatted = [','.join((str(int(v)) for v in row)) ... |
# SPDX-License-Identifier: MIT
"""A pluggable Django application to generate analogous, legacy, paper-based calendar inlays."""
__author__ = "Mischback"
"""The current project owner."""
__app_name__ = "django-calingen"
"""The name of the application."""
__version__ = "1.0.0"
"""The current version."""
default_app_... | """A pluggable Django application to generate analogous, legacy, paper-based calendar inlays."""
__author__ = 'Mischback'
'The current project owner.'
__app_name__ = 'django-calingen'
'The name of the application.'
__version__ = '1.0.0'
'The current version.'
default_app_config = 'calingen.apps.CalingenConfig'
"The pat... |
def hash_string(s):
mod = 1000000009
result=0
for c in s:
result = (result * 239 + ord(c)) % mod
return result % mod | def hash_string(s):
mod = 1000000009
result = 0
for c in s:
result = (result * 239 + ord(c)) % mod
return result % mod |
#!/usr/local/bin/python
# -*- coding:utf-8 -*-
def readTxT():
file_object = open('/Users/miraclewong/Projects/Python-for-Linux-SAAO/chapter8/ips.txt')
try:
str = file_object.read()
print(str)
finally:
file_object.close()
def main():
readTxT()
if __name__ == '__main__':
main(... | def read_tx_t():
file_object = open('/Users/miraclewong/Projects/Python-for-Linux-SAAO/chapter8/ips.txt')
try:
str = file_object.read()
print(str)
finally:
file_object.close()
def main():
read_tx_t()
if __name__ == '__main__':
main() |
'''
if __name__ == "__main__":
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
print(sys.path)
''' | """
if __name__ == "__main__":
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
print(sys.path)
""" |
#DESAFIO VALIDAR DIGITO CPF
cpf = input("Digite um cpf no formato ###.###.###-## ")
cpf = cpf.replace('.', '')
cpf = cpf.replace('-', '')
cpf_format = cpf[:-2]
total = 0
index = 0
reverso = 10
calcula_digito = 0
digito_1 = ''
digito_2 = ''
while digito_2 == '':
if reverso >= 2:
total += reverso * int(cpf_... | cpf = input('Digite um cpf no formato ###.###.###-## ')
cpf = cpf.replace('.', '')
cpf = cpf.replace('-', '')
cpf_format = cpf[:-2]
total = 0
index = 0
reverso = 10
calcula_digito = 0
digito_1 = ''
digito_2 = ''
while digito_2 == '':
if reverso >= 2:
total += reverso * int(cpf_format[index])
index +... |
room = shape.box(-10, -4, -8, s=2, t=2, normalize_tc=False)
room.texture = texture("prototype.png")
room.pos.y = 2
sl = shape.sphere(0.05)
sl.color.set(1, 0, 0, 0.5)
player.left_hand.add_child(sl, True)
sr = shape.sphere(0.05)
sr.color.set(0, 1, 0, 0.5)
sr.set_parent(player.right_hand)
player.locomotion.walk(player.... | room = shape.box(-10, -4, -8, s=2, t=2, normalize_tc=False)
room.texture = texture('prototype.png')
room.pos.y = 2
sl = shape.sphere(0.05)
sl.color.set(1, 0, 0, 0.5)
player.left_hand.add_child(sl, True)
sr = shape.sphere(0.05)
sr.color.set(0, 1, 0, 0.5)
sr.set_parent(player.right_hand)
player.locomotion.walk(player.lef... |
################################## Main ##################################
query_seq =input("Enter Protein Query Sequence : ") # "PQGEFG"
len_of_word = input("Enter The Length Of Word : ") #4
word_threshold = input("Enter Word Threshold : ") #1... | query_seq = input('Enter Protein Query Sequence : ')
len_of_word = input('Enter The Length Of Word : ')
word_threshold = input('Enter Word Threshold : ')
hsp_threshold = input('Enter HSP Threshold : ')
def remove_repeated_seq(query_seq):
query_seq = query_seq.upper()
query_list = list(query_seq)
first_ind... |
#
# PySNMP MIB module ALCATEL-IND1-MVRP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALCATEL-IND1-MVRP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:03:03 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (softent_ind1_mvrp,) = mibBuilder.importSymbols('ALCATEL-IND1-BASE', 'softentIND1Mvrp')
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single... |
def race_cond_check(stateArray):
counter = 0
for state in reversed(stateArray):
if len(state.programCounters) == 0:
counter = counter + 1
else:
break
return counter
| def race_cond_check(stateArray):
counter = 0
for state in reversed(stateArray):
if len(state.programCounters) == 0:
counter = counter + 1
else:
break
return counter |
#
# PySNMP MIB module H3C-STORM-CONSTRAIN-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/H3C-STORM-CONSTRAIN-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:23:58 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, single_value_constraint, constraints_union, value_size_constraint, constraints_intersection) ... |
def create_list(start,len):
nums = []
for i in range(len):
nums.append(start+i)
return nums
start,len = input("Enter your start and len:\n").split()
nums = create_list(int(start),int(len))
print (nums) | def create_list(start, len):
nums = []
for i in range(len):
nums.append(start + i)
return nums
(start, len) = input('Enter your start and len:\n').split()
nums = create_list(int(start), int(len))
print(nums) |
class BotError(Exception):
pass
class VoiceError(BotError):
pass
class NoVoice(VoiceError):
pass
class BadVoice(VoiceError):
pass
| class Boterror(Exception):
pass
class Voiceerror(BotError):
pass
class Novoice(VoiceError):
pass
class Badvoice(VoiceError):
pass |
"""Tests For Flask-App Web Site"""
def test_app_name(app_instance):
"""Test application name"""
assert app_instance.name == "web_site_kripta.web_site_kripta"
| """Tests For Flask-App Web Site"""
def test_app_name(app_instance):
"""Test application name"""
assert app_instance.name == 'web_site_kripta.web_site_kripta' |
#! python3
bloco_atrs = ('bloco_accesskey', 'bloco_id')
ul_atrs = ('ul_id', 'ul_style')
def get_atrs(informados, suportados):
return ' '.join(f'{k.split("_")[-1]}="{v}"' for k, v in informados.items()
if k in suportados)
def tab_bloco(conteudo, *args, classe='success', inline=False, **novos_... | bloco_atrs = ('bloco_accesskey', 'bloco_id')
ul_atrs = ('ul_id', 'ul_style')
def get_atrs(informados, suportados):
return ' '.join((f'''{k.split('_')[-1]}="{v}"''' for (k, v) in informados.items() if k in suportados))
def tab_bloco(conteudo, *args, classe='success', inline=False, **novos_atrs):
tag = 'span' i... |
class Persona:
def __init__(self, nombre):
self.nombre = nombre
def avanzar(self):
print('Caminando')
class Ciclista(Persona):
def __init__(self, nombre):
super().__init__(nombre)
def avanzar(self):
print('Pedaleando')
def run():
persona = Persona('Oscar')
... | class Persona:
def __init__(self, nombre):
self.nombre = nombre
def avanzar(self):
print('Caminando')
class Ciclista(Persona):
def __init__(self, nombre):
super().__init__(nombre)
def avanzar(self):
print('Pedaleando')
def run():
persona = persona('Oscar')
p... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"Learner.get_preds": "00_inference.ipynb",
"Learner.predict": "00_inference.ipynb",
"TabularLearner.predict": "00_inference.ipynb",
"Interpret": "01_tabular.core.ipynb",
"s... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'Learner.get_preds': '00_inference.ipynb', 'Learner.predict': '00_inference.ipynb', 'TabularLearner.predict': '00_inference.ipynb', 'Interpret': '01_tabular.core.ipynb', 'sv_var': '01_tabular.core.ipynb', 'ld_var': '01_tabular.core.ipynb', 'list_dif... |
class Solution(object):
def __init__(self, nums):
self.nums = nums
def pick(self, target):
return random.choice([k for k, v in enumerate(self.nums) if v == target]) | class Solution(object):
def __init__(self, nums):
self.nums = nums
def pick(self, target):
return random.choice([k for (k, v) in enumerate(self.nums) if v == target]) |
# Python - 3.6.0
Test.assert_equals(encode('scout', 1939), [20, 12, 18, 30, 21])
Test.assert_equals(encode('masterpiece', 1939), [14, 10, 22, 29, 6, 27, 19, 18, 6, 12, 8])
| Test.assert_equals(encode('scout', 1939), [20, 12, 18, 30, 21])
Test.assert_equals(encode('masterpiece', 1939), [14, 10, 22, 29, 6, 27, 19, 18, 6, 12, 8]) |
dict(
target = ["/data/nmt/works/step_-1_prepare_datas/binarized_text.en.shuf.h5"],
source = ["/data/nmt/works/step_-1_prepare_datas/binarized_text.zh.shuf.h5"],
indx_word = "/data/nmt/works/step_-1_prepare_datas/ivocab.zh.pkl",
indx_word_target = "/data/nmt/works/step_-1_prepare_datas/ivocab.en.pkl",
... | dict(target=['/data/nmt/works/step_-1_prepare_datas/binarized_text.en.shuf.h5'], source=['/data/nmt/works/step_-1_prepare_datas/binarized_text.zh.shuf.h5'], indx_word='/data/nmt/works/step_-1_prepare_datas/ivocab.zh.pkl', indx_word_target='/data/nmt/works/step_-1_prepare_datas/ivocab.en.pkl', word_indx='/data/nmt/works... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more 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... | def get(id, db, appname):
return db.get(("'sqldb", appname.eval()) + id)
def post(id, val, db, appname):
return db.post(("'sqldb", appname.eval()) + id, val)
def put(id, val, db, appname):
return db.put(("'sqldb", appname.eval()) + id, val)
def delete(id, db, appname):
return db.delete(("'sqldb", app... |
class SubInfo:
""" This class contains info of the subtitle like the time and the text to display"""
# E.G
# 906
# 00:59:15,789 --> 00:59:18,789
# Mike's married?
def __init__(self, index, time, text):
self._index = index
self._time = time
self._text = text
def GetI... | class Subinfo:
""" This class contains info of the subtitle like the time and the text to display"""
def __init__(self, index, time, text):
self._index = index
self._time = time
self._text = text
def get_index(self):
return self._index
def get_time(self):
retur... |
n = 500
with open("WIP/test.txt", "w") as f:
out = "1" * n
out += "\n"
out *= n
f.write(str(n) + " " + str(n) + "\n")
f.write(out)
| n = 500
with open('WIP/test.txt', 'w') as f:
out = '1' * n
out += '\n'
out *= n
f.write(str(n) + ' ' + str(n) + '\n')
f.write(out) |
VERSION = "1.0"
LOGGING_CONFIG = {
'version': 1,
'formatters': {'default': {
'format': '[%(asctime)s] %(levelname)s in %(module)s: %(message)s',
}},
'handlers': {'console': {
'class': 'logging.StreamHandler',
'stream': 'ext://sys.stdout',
'formatter': 'default'
}, 'f... | version = '1.0'
logging_config = {'version': 1, 'formatters': {'default': {'format': '[%(asctime)s] %(levelname)s in %(module)s: %(message)s'}}, 'handlers': {'console': {'class': 'logging.StreamHandler', 'stream': 'ext://sys.stdout', 'formatter': 'default'}, 'file': {'class': 'logging.FileHandler', 'formatter': 'defaul... |
# A Note represents a fret-computed note in the final output
class Note:
def __init__(self, fnote, duration=None):
self._duration = duration # the duration of the note, as a fraction of a measure
self._fnote = fnote # the FrettedNote for this object, representing the guita... | class Note:
def __init__(self, fnote, duration=None):
self._duration = duration
self._fnote = fnote |
"""
Tic Tac Toe (and more generally, 2-D grid environments) that display in browser.
Created by Peter Norvig
NB: need to work on both Python 2 and 3
"""
##############################################################################
# CSS and HTML
######################################################################... | """
Tic Tac Toe (and more generally, 2-D grid environments) that display in browser.
Created by Peter Norvig
NB: need to work on both Python 2 and 3
"""
if False:
def set_css(text):
"""Set (or append??) CSS to be text."""
global __CSS__
__css__ = text
print('setCSS: ' + text)
... |
class State:
def __init__(self, lc, lm, rc, rm):
self.lc = lc
self.lm = lm
self.rc = rc
self.rm = rm
def __repr__(self):
return f"{self.lc},{self.lm}-{self.rc},{self.rm}"
def is_done(self):
return self.rc == 3 and self.rm == 3
def is_valid(self):
... | class State:
def __init__(self, lc, lm, rc, rm):
self.lc = lc
self.lm = lm
self.rc = rc
self.rm = rm
def __repr__(self):
return f'{self.lc},{self.lm}-{self.rc},{self.rm}'
def is_done(self):
return self.rc == 3 and self.rm == 3
def is_valid(self):
... |
class Queue:
arr = []
def enqueue(self,item):
self.arr.append(item)
def dequeue(self):
if len(self.arr) > 0:
ditem = self.arr[0]
del self.arr[0]
return ditem
else:
return #queue is empty
def dispaly(self):
print(s... | class Queue:
arr = []
def enqueue(self, item):
self.arr.append(item)
def dequeue(self):
if len(self.arr) > 0:
ditem = self.arr[0]
del self.arr[0]
return ditem
else:
return
def dispaly(self):
print(self.arr)
x = queue()
x.... |
# Specify structure for custom cmake functions
additional_commands = {
"opencensus_lib": {
"flags": [
"PUBLIC",
],
"kwargs": {
"HEADERS": "*",
"DEPENDS": "*",
"SOURCES": "*"
}
}
}
# If comment markup is enabled, don't reflow the first comment block in
# eachlistfile. Use thi... | additional_commands = {'opencensus_lib': {'flags': ['PUBLIC'], 'kwargs': {'HEADERS': '*', 'DEPENDS': '*', 'SOURCES': '*'}}}
first_comment_is_literal = True |
# Exceptions (Title)
# Reading
# ZeroDivisionError:
# # This program divides a number by another number.
def main():
# Get two numbers.
num1 = int(input('Enter a number: '))
num2 = int(input('Enter another number: '))
# Divide num1 by num2 and display the result.
result = num1 / num2
print(f'{num1}... | def main():
num1 = int(input('Enter a number: '))
num2 = int(input('Enter another number: '))
result = num1 / num2
print(f'{num1} divided by {num2} is {result}')
if __name__ == '__main__':
main()
def main():
num1 = int(input('Enter a number: '))
num2 = int(input('Enter another number: '))
... |
lista = [1,2,3,4]
soma = 0
soma = (lista[0]*10) +(lista[1]*10)+(lista[2]*30)+(lista[3]*50)
media = soma/100
print(media)
| lista = [1, 2, 3, 4]
soma = 0
soma = lista[0] * 10 + lista[1] * 10 + lista[2] * 30 + lista[3] * 50
media = soma / 100
print(media) |
# Check if it is prime or composite ??
# Composite is a number that greater than 1 and not prime
def prime_or_composite(num):
flag = 1
if num == 0 or num == 1:
flag = 2
return flag
for i in range(2, num):
if num % i == 0:
flag = 0
break
return flag
numbe... | def prime_or_composite(num):
flag = 1
if num == 0 or num == 1:
flag = 2
return flag
for i in range(2, num):
if num % i == 0:
flag = 0
break
return flag
number = int(input('Enter a Number to Check if it is prime or composite: '))
if prime_or_composite(numbe... |
#
# Pascal
#
# Copyright 2017, Adam Edwards
#
# 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 ... | class Pascal:
def __init__(self, max_row):
self.max_row = max_row
self.triangle = None
def show(self, target_row=None):
self.__generate()
last_row = self.max_row if target_row == None else target_row
for row in range(0, last_row + 1):
for item in self.triang... |
"""
Given a reference of a node in a connected undirected graph.
Return a deep copy (clone) of the graph.
Each node in the graph contains a val (int) and a list (List[Node]) of its neighbors.
class Node {
public int val;
public List<Node> neighbors;
}
Test case format:
For simplicity sake, each node's va... | """
Given a reference of a node in a connected undirected graph.
Return a deep copy (clone) of the graph.
Each node in the graph contains a val (int) and a list (List[Node]) of its neighbors.
class Node {
public int val;
public List<Node> neighbors;
}
Test case format:
For simplicity sake, each node's va... |
"""
785. Is Graph Bipartite?
https://leetcode.com/problems/is-graph-bipartite/
dfs
"""
class Solution:
def isBipartite(self, graph: List[List[int]]) -> bool:
n = len(graph)
colors = [-1] * n
for i in range(n):
if colors[i] == -1:
if not self.dfs(graph, co... | """
785. Is Graph Bipartite?
https://leetcode.com/problems/is-graph-bipartite/
dfs
"""
class Solution:
def is_bipartite(self, graph: List[List[int]]) -> bool:
n = len(graph)
colors = [-1] * n
for i in range(n):
if colors[i] == -1:
if not self.dfs(graph, colors, ... |
def extractWwwVerdantloreCom(item):
'''
Parser for 'www.verdantlore.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('monarch of the dark nights', 'Monarch of the Dark Night... | def extract_www_verdantlore_com(item):
"""
Parser for 'www.verdantlore.com'
"""
(vol, chp, frag, postfix) = extract_vol_chapter_fragment_postfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
tagmap = [('monarch of the dark nights', 'Monarch of the Dark N... |
class KeyValue(object):
def __init__(self, keyvalue):
self._pb_kv = keyvalue
@property
def key(self):
"key in bytes. An empty key is not allowed."
return self._pb_kv.key
@property
def create_revision(self):
"revision of the last creation on the key."
retu... | class Keyvalue(object):
def __init__(self, keyvalue):
self._pb_kv = keyvalue
@property
def key(self):
"""key in bytes. An empty key is not allowed."""
return self._pb_kv.key
@property
def create_revision(self):
"""revision of the last creation on the key."""
... |
HTMLBreak = '<br>'
# Viewport is used on mobile and from what I can tell right now is static
viewport = '<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">'
cb_name=0
cb_value=1
cb_text=2
def textHeader():
header = ''
header = header + 'Content-Type: text/html\n\n'
... | html_break = '<br>'
viewport = '<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">'
cb_name = 0
cb_value = 1
cb_text = 2
def text_header():
header = ''
header = header + 'Content-Type: text/html\n\n'
header = header + '<!DOCTYPE html>'
header = header + '<html>'
... |
"""
App for front page news and news articles
"""
default_app_config = 'nablapps.news.apps.NewsConfig'
| """
App for front page news and news articles
"""
default_app_config = 'nablapps.news.apps.NewsConfig' |
command = '/home/lucas/www/socialrank.lucasou.com/socialrank-env/bin/gunicorn'
pythonpath = '/home/lucas/www/socialrank.lucasou.com/socialrank-env/socialrank'
bind = '127.0.0.1:8080'
workers = 1
user = 'lucas'
accesslog = '/home/lucas/logs/socialrank.lucasou.com/gunicorn-access.log'
errorlog = '/home/lucas/logs/socialr... | command = '/home/lucas/www/socialrank.lucasou.com/socialrank-env/bin/gunicorn'
pythonpath = '/home/lucas/www/socialrank.lucasou.com/socialrank-env/socialrank'
bind = '127.0.0.1:8080'
workers = 1
user = 'lucas'
accesslog = '/home/lucas/logs/socialrank.lucasou.com/gunicorn-access.log'
errorlog = '/home/lucas/logs/socialr... |
"""
Protein-Ligand Interaction Profiler - Analyze and visualize protein-ligand interactions in PDB files.
__init__.py - Needed for python modules.
"""
| """
Protein-Ligand Interaction Profiler - Analyze and visualize protein-ligand interactions in PDB files.
__init__.py - Needed for python modules.
""" |
#!/usr/bin/python3
ORIG = ['docid', 'text', 'tags', 'events', 'event_ranks' 'diagnosis', 'dct']
SEQ = ['docid', 'seqid', 'text', 'text_orig', 'seq', 'seq_labels', 'diagnosis']
ORDER = ['docid', 'text', 'text_orig', 'tags', 'seq', 'seq_labels', 'events', 'event_ranks', 'diagnosis', 'dct']
RELATION = ['docid', 'relid' '... | orig = ['docid', 'text', 'tags', 'events', 'event_ranksdiagnosis', 'dct']
seq = ['docid', 'seqid', 'text', 'text_orig', 'seq', 'seq_labels', 'diagnosis']
order = ['docid', 'text', 'text_orig', 'tags', 'seq', 'seq_labels', 'events', 'event_ranks', 'diagnosis', 'dct']
relation = ['docid', 'relidentity1', 'entity2', 'rel_... |
class Persons(object):
def __init__(self, client):
self._client = client
def get_person(self, person_id, **kwargs):
url = 'persons/{}'.format(person_id)
return self._client._get(self._client.BASE_URL + url, **kwargs)
def get_all_persons(self, params=None, **kwargs):
url = '... | class Persons(object):
def __init__(self, client):
self._client = client
def get_person(self, person_id, **kwargs):
url = 'persons/{}'.format(person_id)
return self._client._get(self._client.BASE_URL + url, **kwargs)
def get_all_persons(self, params=None, **kwargs):
url = ... |
"""
https://www.codewars.com/kata/53368a47e38700bd8300030d/train/python
Given: an array of "hashes of names" -- such as {'name': 'Hildegard'}
Return a string with names separated by ',' except last 2 are separated by '&'
Examples:
namelist([ {'name': 'Bart'}, {'name': 'Lisa'}, {'name': 'Maggie'} ])
# returns 'Bart, L... | """
https://www.codewars.com/kata/53368a47e38700bd8300030d/train/python
Given: an array of "hashes of names" -- such as {'name': 'Hildegard'}
Return a string with names separated by ',' except last 2 are separated by '&'
Examples:
namelist([ {'name': 'Bart'}, {'name': 'Lisa'}, {'name': 'Maggie'} ])
# returns 'Bart, L... |
n = raw_input()
n=int(n)
ask=[]
for i in range(n):
num=int(raw_input())
num=ask.append(num)
for j in ask:
print(j)
| n = raw_input()
n = int(n)
ask = []
for i in range(n):
num = int(raw_input())
num = ask.append(num)
for j in ask:
print(j) |
class ConditionsAttributes:
def __init__(self, lighting: int, capture_device: int):
self.lighting = lighting
self.capture_device = capture_device
@staticmethod
def from_item(item):
return ConditionsAttributes(
lighting=int(item.info.get("common_lighting", -1)),
... | class Conditionsattributes:
def __init__(self, lighting: int, capture_device: int):
self.lighting = lighting
self.capture_device = capture_device
@staticmethod
def from_item(item):
return conditions_attributes(lighting=int(item.info.get('common_lighting', -1)), capture_device=int(i... |
# Create a 5 x 5 matrix using a list of lists: matrix
matrix = [[col for col in range(0,5)] for col in range(0,4)]
# Print the matrix
for row in matrix:
print(row)
print ([num **2 for num in range(10) if num % 2 == 0])
#conditional on the ouput expression
print ([num **2 if num % 2 == 0 else 0 for num in range(... | matrix = [[col for col in range(0, 5)] for col in range(0, 4)]
for row in matrix:
print(row)
print([num ** 2 for num in range(10) if num % 2 == 0])
print([num ** 2 if num % 2 == 0 else 0 for num in range(10)]) |
class Currency(object):
"""this is the currency class"""
# Currency class constructor
def __init__(self, base, symbols, time):
self.base = base
self.symbols = symbols
self.time = time | class Currency(object):
"""this is the currency class"""
def __init__(self, base, symbols, time):
self.base = base
self.symbols = symbols
self.time = time |
'''
https://www.hackerrank.com/challenges/30-hello-world/
To complete this challenge, you must save a line of input from stdin to a variable,
print "Hello, World." on a single line, and finally print the value of your variable
on a second line.
'''
inputString = input() # get a line of input from stdin and save it t... | """
https://www.hackerrank.com/challenges/30-hello-world/
To complete this challenge, you must save a line of input from stdin to a variable,
print "Hello, World." on a single line, and finally print the value of your variable
on a second line.
"""
input_string = input()
print('Hello, World.')
print(inputString) |
time = input().strip().split(":")
if time[-1][-2:] == "PM" and time[0] != "12":
time[0] = str(int(time[0]) + 12)
elif time[-1][-2:] == "AM" and time[0] == "12":
time[0] = "00"
print("%s:%s:%s" % (time[0], time[1], time[2][:2]))
| time = input().strip().split(':')
if time[-1][-2:] == 'PM' and time[0] != '12':
time[0] = str(int(time[0]) + 12)
elif time[-1][-2:] == 'AM' and time[0] == '12':
time[0] = '00'
print('%s:%s:%s' % (time[0], time[1], time[2][:2])) |
def main():
# input
N = int(input())
S = input()
Q = int(input())
TABss = [list(map(int, input().split())) for _ in range(Q)]
# compute
for i in range(Q):
if TABss[i][0] == 1:
A, B = TABss[i][1]-1, TABss[i][2]-1
tmp = S[:A]+S[B]+S[A+1:B]+S[A]+S[B+1:]
... | def main():
n = int(input())
s = input()
q = int(input())
ta_bss = [list(map(int, input().split())) for _ in range(Q)]
for i in range(Q):
if TABss[i][0] == 1:
(a, b) = (TABss[i][1] - 1, TABss[i][2] - 1)
tmp = S[:A] + S[B] + S[A + 1:B] + S[A] + S[B + 1:]
else:
... |
"""
Profile ../profile-datasets-py/div52_zen50deg/047.py
file automaticaly created by prof_gen.py script
"""
self["ID"] = "../profile-datasets-py/div52_zen50deg/047.py"
self["Q"] = numpy.array([ 1.60776800e+00, 7.95355900e+00, 6.74945900e+00,
7.45557100e+00, 6.46067300e+00, 6.20967000e+0... | """
Profile ../profile-datasets-py/div52_zen50deg/047.py
file automaticaly created by prof_gen.py script
"""
self['ID'] = '../profile-datasets-py/div52_zen50deg/047.py'
self['Q'] = numpy.array([1.607768, 7.953559, 6.749459, 7.455571, 6.460673, 6.20967, 6.54193, 8.018175, 6.569519, 7.300567, 7.834247, 7.9461... |
# domain-layer test:
def test_prefers_current_stock_batches_to_shipments():
in_stock_batch = Batch("in-stock-batch", "RETRO-CLOCK", 100, eta=None)
shipment_batch = Batch("shipment-batch", "RETRO-CLOCK", 100, eta=tomorrow)
line = OrderLine("oref", "RETRO-CLOCK", 10)
allocate(line, [in_stock_batch, shipm... | def test_prefers_current_stock_batches_to_shipments():
in_stock_batch = batch('in-stock-batch', 'RETRO-CLOCK', 100, eta=None)
shipment_batch = batch('shipment-batch', 'RETRO-CLOCK', 100, eta=tomorrow)
line = order_line('oref', 'RETRO-CLOCK', 10)
allocate(line, [in_stock_batch, shipment_batch])
asser... |
def pow_mod(n, k, mod):
"""
Exponentiation by squaring
https://atcoder.jp/contests/atc002/tasks/atc002_b
:return: n ** k
"""
if k == 0:
return 1
elif k & 1 == 1:
return pow_mod(n, k - 1, mod) * n % mod
else:
tmp = pow_mod(n, k // 2, mod)
return tmp * tmp... | def pow_mod(n, k, mod):
"""
Exponentiation by squaring
https://atcoder.jp/contests/atc002/tasks/atc002_b
:return: n ** k
"""
if k == 0:
return 1
elif k & 1 == 1:
return pow_mod(n, k - 1, mod) * n % mod
else:
tmp = pow_mod(n, k // 2, mod)
return tmp * tmp %... |
def failure_message(message=None, user=None, user_group=None):
return '''
Message failed to send, please try again later or contact administrator
from: TextHomelessHelp Admin
- Only you can see this message
'''
| def failure_message(message=None, user=None, user_group=None):
return '\n Message failed to send, please try again later or contact administrator\n from: TextHomelessHelp Admin\n - Only you can see this message\n ' |
# Created by MechAviv
# Map ID :: 940002030
# Hidden Street : Play Magnus Video
sm.curNodeEventEnd(True)
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(True, True, False, False)
sm.playURLVideoByScript("http://nxcache.nexon.net/maplestory/video/yt/kaiser.html")
sm.setTemporarySkillSet(0)
sm.setInGameDirectionM... | sm.curNodeEventEnd(True)
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(True, True, False, False)
sm.playURLVideoByScript('http://nxcache.nexon.net/maplestory/video/yt/kaiser.html')
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(False, True, False, False)
sm.warp(940001160, 0) |
#!/usr/bin/env python
class SemGraphNode(object):
def __init__(self, sem_graph, id_minting_d):
self.canonical_id = sem_graph.register_obj(id_minting_d, self)
self.graph = sem_graph
def as_dict(self):
d = {}
for att in self.predicates:
val = getattr(self, att, [])
... | class Semgraphnode(object):
def __init__(self, sem_graph, id_minting_d):
self.canonical_id = sem_graph.register_obj(id_minting_d, self)
self.graph = sem_graph
def as_dict(self):
d = {}
for att in self.predicates:
val = getattr(self, att, [])
if val:
... |
#!/usr/bin/python
r"""
Contains PEL related constants.
"""
PEL_DETAILS = {
'CreatorID': 'BMC',
'CompID': '0x1000',
'Subsystem': 'BMC Firmware',
'Message': 'An application had an internal failure',
'SRC': 'BD8D1002',
'Sev': 'Unrecoverable Error'}
| """
Contains PEL related constants.
"""
pel_details = {'CreatorID': 'BMC', 'CompID': '0x1000', 'Subsystem': 'BMC Firmware', 'Message': 'An application had an internal failure', 'SRC': 'BD8D1002', 'Sev': 'Unrecoverable Error'} |
#
# PySNMP MIB module Nortel-Magellan-Passport-CasTestMIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-CasTestMIB
# Produced by pysmi-0.3.4 at Wed May 1 14:26:44 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Usi... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint) ... |
steam_username = ''
steam_password = ''
mail_user = ''
mail_password = ''
mail_server = ''
def steam():
return (steam_username, steam_password)
def mail():
return (mail_server, mail_user, mail_password)
| steam_username = ''
steam_password = ''
mail_user = ''
mail_password = ''
mail_server = ''
def steam():
return (steam_username, steam_password)
def mail():
return (mail_server, mail_user, mail_password) |
# [START app settings]
appSettings = {
"sender_address":"noreply@birthday-168214.appspotmail.com",
}
# [END app settings] | app_settings = {'sender_address': 'noreply@birthday-168214.appspotmail.com'} |
n = int(input())
t = 0
h_list = []
g_list = []
for i in range(n):
h, g = map(int, input().split())
h_list.append(h)
g_list.append(g)
for x in h_list:
t += g_list.count(x)
print(t)
| n = int(input())
t = 0
h_list = []
g_list = []
for i in range(n):
(h, g) = map(int, input().split())
h_list.append(h)
g_list.append(g)
for x in h_list:
t += g_list.count(x)
print(t) |
#
# PySNMP MIB module FOUNDRY-MAC-VLAN-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FOUNDRY-MAC-VLAN-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:15:00 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection, constraints_union) ... |
read_int = lambda: int(input())
read_ints = lambda: list(map(int, input().split()))
read_tuple = lambda: tuple(map(int, input().split()))
def solve():
pass
def main():
T = read_int()
for i in range(T):
result = solve()
print(result, end='\n' if i != T - 1 else '')
if __name__ == '__mai... | read_int = lambda : int(input())
read_ints = lambda : list(map(int, input().split()))
read_tuple = lambda : tuple(map(int, input().split()))
def solve():
pass
def main():
t = read_int()
for i in range(T):
result = solve()
print(result, end='\n' if i != T - 1 else '')
if __name__ == '__main... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.