content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
def test_opendota_api_type(heroes):
# Ensure data returned by fetch_hero_stats() is a list
assert isinstance(heroes, list)
def test_opendota_api_count(heroes, N_HEROES):
# Ensure all heroes are included
assert len(heroes) == N_HEROES
def test_opendota_api_contents(heroes, N_HEROES):
# Verify tha... | def test_opendota_api_type(heroes):
assert isinstance(heroes, list)
def test_opendota_api_count(heroes, N_HEROES):
assert len(heroes) == N_HEROES
def test_opendota_api_contents(heroes, N_HEROES):
assert all((isinstance(hero, dict) for hero in heroes)) |
class ParserException(Exception):
"""
Base exception for the email parser.
"""
pass
class ParseEmailException(ParserException):
"""
Raised when the parser can't create a email.message.Message object of the raw string or bytes.
"""
pass
class MessageIDNotExistException(ParserExcepti... | class Parserexception(Exception):
"""
Base exception for the email parser.
"""
pass
class Parseemailexception(ParserException):
"""
Raised when the parser can't create a email.message.Message object of the raw string or bytes.
"""
pass
class Messageidnotexistexception(ParserException):... |
class Solution(object):
def generate(self, numRows):
"""
:type numRows: int
:rtype: List[List[int]]
"""
# Runtime: 12 ms
# Memory: 13.5 MB
pascal = []
for r in range(1, numRows + 1):
row = []
for c in range(r):
i... | class Solution(object):
def generate(self, numRows):
"""
:type numRows: int
:rtype: List[List[int]]
"""
pascal = []
for r in range(1, numRows + 1):
row = []
for c in range(r):
if c == 0 or c == r - 1:
row.ap... |
class Solution:
def lastRemaining(self, n):
"""
:type n: int
:rtype: int
"""
def helper(n,i):
if n == 1:
return 1
if i:
return 2 * helper(n//2,0)
elif n % 2 == 1:
return 2 * helper(n//2,1)
... | class Solution:
def last_remaining(self, n):
"""
:type n: int
:rtype: int
"""
def helper(n, i):
if n == 1:
return 1
if i:
return 2 * helper(n // 2, 0)
elif n % 2 == 1:
return 2 * helper(n //... |
'''
From: LeetCode - 141. Linked List Cycle
Level: Easy
Source: https://leetcode.com/problems/linked-list-cycle/description/
Status: AC
Solution: Using Hash Table
'''
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next ... | """
From: LeetCode - 141. Linked List Cycle
Level: Easy
Source: https://leetcode.com/problems/linked-list-cycle/description/
Status: AC
Solution: Using Hash Table
"""
class Solution(object):
def has_cycle(self, head):
"""
:type head: ListNode
:rtype: bool
"""
... |
"""
Journals module of Spire library and API version.
"""
SPIRE_JOURNALS_VERSION = "0.1.1"
| """
Journals module of Spire library and API version.
"""
spire_journals_version = '0.1.1' |
class Structure(object):
_fields = ()
def __init__(self, *args):
if len(_fields) != len(args):
raise TypeError(f"Expected {len(_fields)} arguments.")
for name, value in zip(self._fields, args):
setattr(self, name, value)
if __name__ == '__main__':
class Shares(... | class Structure(object):
_fields = ()
def __init__(self, *args):
if len(_fields) != len(args):
raise type_error(f'Expected {len(_fields)} arguments.')
for (name, value) in zip(self._fields, args):
setattr(self, name, value)
if __name__ == '__main__':
class Shares(St... |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
ID = 'ID'
TOKEN = 'TOKEN'
SUB_DOMAIN = 'xsy'
DOMAIN = 'admxj.pw'
| id = 'ID'
token = 'TOKEN'
sub_domain = 'xsy'
domain = 'admxj.pw' |
'''
this program translates any integer base to decimal.
examples for testing:
assert checkio("101", 2) == 5, "Binary"
assert checkio("111112", 3) == 365, "Ternary"
assert checkio("200", 4) == 32, "Quaternary"
assert checkio("101", 5) == 26, "5 base"
assert checkio("25", 6) == 17, "Heximal/Senary" ... | """
this program translates any integer base to decimal.
examples for testing:
assert checkio("101", 2) == 5, "Binary"
assert checkio("111112", 3) == 365, "Ternary"
assert checkio("200", 4) == 32, "Quaternary"
assert checkio("101", 5) == 26, "5 base"
assert checkio("25", 6) == 17, "Heximal/Senary" ... |
classes = [
{
'name': 'science-1',
'subjects': [
{
'name': 'Math',
'taughtBy': 'Turing',
'duration': 60
},
{
'name': 'English',
'taughtBy': 'Adele',
'duration': 60
... | classes = [{'name': 'science-1', 'subjects': [{'name': 'Math', 'taughtBy': 'Turing', 'duration': 60}, {'name': 'English', 'taughtBy': 'Adele', 'duration': 60}, {'name': 'Sports', 'taughtBy': 'Dinho', 'duration': 60}, {'name': 'Science', 'taughtBy': 'Harish', 'duration': 60}]}, {'name': 'science-2', 'subjects': [{'name'... |
"""
snek.tests Package: Unit & integration tests for Snek.
"""
#-------------------------------------------------------------------------------
# Constants
#-------------------------------------------------------------------------------
MOCKS_FOLDER = './tests/mocks'
| """
snek.tests Package: Unit & integration tests for Snek.
"""
mocks_folder = './tests/mocks' |
cont = 0
lista = []
while cont < 20:
x = input()
lista.append(x)
cont += 1
cont2 = 0
valor = -1
while cont2 < 20:
print("N[" + str(cont2) + "] = " + str(lista[valor]))
valor -= 1
cont2 += 1 | cont = 0
lista = []
while cont < 20:
x = input()
lista.append(x)
cont += 1
cont2 = 0
valor = -1
while cont2 < 20:
print('N[' + str(cont2) + '] = ' + str(lista[valor]))
valor -= 1
cont2 += 1 |
class Solution:
def isRobotBounded(self, instructions: str) -> bool:
x, y, dx, dy = 0, 0, 0, 1
for it in instructions:
if it == 'L':
dx, dy = -dy, dx
elif it == 'R':
dx, dy = dy, -dx
else:
x = x + dx
... | class Solution:
def is_robot_bounded(self, instructions: str) -> bool:
(x, y, dx, dy) = (0, 0, 0, 1)
for it in instructions:
if it == 'L':
(dx, dy) = (-dy, dx)
elif it == 'R':
(dx, dy) = (dy, -dx)
else:
x = x + dx
... |
### TODO use the details of your database connection
REGION = 'eu-west-2'
DBPORT = 1433
DBUSERNAME = 'admin' # the name of the database user you created in step 2
DBNAME = 'EventDatabase' # the name of the database your database user is granted access to
DBENDPOINT = 'eventdatabase.cu9s0xzhp0zw.eu-west-2.rds.amazonaws... | region = 'eu-west-2'
dbport = 1433
dbusername = 'admin'
dbname = 'EventDatabase'
dbendpoint = 'eventdatabase.cu9s0xzhp0zw.eu-west-2.rds.amazonaws.com'
dbpassword = 'Eventpassword'
db_username = 'admin'
db_password = 'Eventpassword'
db_name = 'event_shema' |
MAILBOX_MOVIE_CLEAR = 2
MAILBOX_MOVIE_EMPTY = 3
MAILBOX_MOVIE_WAITING = 4
MAILBOX_MOVIE_READY = 5
MAILBOX_MOVIE_NOT_OWNER = 6
MAILBOX_MOVIE_EXIT = 7
| mailbox_movie_clear = 2
mailbox_movie_empty = 3
mailbox_movie_waiting = 4
mailbox_movie_ready = 5
mailbox_movie_not_owner = 6
mailbox_movie_exit = 7 |
# Copyright (c) 2013 by pytest_pyramid authors and contributors
#
# This module is part of pytest_pyramid and is released under
# the MIT License (MIT): http://opensource.org/licenses/MIT
"""pytest_pyramid main module."""
__version__ = "1.0.1" # pragma: no cover
| """pytest_pyramid main module."""
__version__ = '1.0.1' |
answer = int(input("How many times do you want to play? "))
for i in range(0,answer):
person1 = input("What is the first name? ")
person2 = input("What is the second name? ")
if person1 > person2:
print(person1)
print("has won")
elif person1 == person2:
print("friendship")
... | answer = int(input('How many times do you want to play? '))
for i in range(0, answer):
person1 = input('What is the first name? ')
person2 = input('What is the second name? ')
if person1 > person2:
print(person1)
print('has won')
elif person1 == person2:
print('friendship')
... |
__all__ = ['strip_comments']
def strip_comments(contents):
"""Strips the comments from coq code in contents.
The strings in contents are only preserved if there are no
comment-like tokens inside of strings. Stripping should be
successful and correct, regardless of whether or not there are
comment... | __all__ = ['strip_comments']
def strip_comments(contents):
"""Strips the comments from coq code in contents.
The strings in contents are only preserved if there are no
comment-like tokens inside of strings. Stripping should be
successful and correct, regardless of whether or not there are
comment... |
"""This file contains macros to be called during WORKSPACE evaluation.
For historic reasons, pip_repositories() is defined in //python:pip.bzl.
"""
def py_repositories():
"""Pull in dependencies needed to use the core Python rules."""
# At the moment this is a placeholder hook, in that it does not actually
... | """This file contains macros to be called during WORKSPACE evaluation.
For historic reasons, pip_repositories() is defined in //python:pip.bzl.
"""
def py_repositories():
"""Pull in dependencies needed to use the core Python rules."""
pass |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( X , Y , m , n ) :
LCSuff = [ [ 0 for k in range ( n + 1 ) ] for l in range ( m + 1 ) ]
result = 0
for i... | def f_gold(X, Y, m, n):
lc_suff = [[0 for k in range(n + 1)] for l in range(m + 1)]
result = 0
for i in range(m + 1):
for j in range(n + 1):
if i == 0 or j == 0:
LCSuff[i][j] = 0
elif X[i - 1] == Y[j - 1]:
LCSuff[i][j] = LCSuff[i - 1][j - 1] + ... |
#Simple declaration of Funtion
'''def say_hello():
print('hello')
say_hello()
'''
def greeting(name):
print(f'Hello {name}')
greeting('raj') | """def say_hello():
print('hello')
say_hello()
"""
def greeting(name):
print(f'Hello {name}')
greeting('raj') |
def for_hyphen():
for row in range(3):
for col in range(3):
if row==1:
print("*",end=" ")
else:
print(" ",end=" ")
print()
def while_hyphen():
row=0
while row<3:
col=0
while col<3:
if row==1:
... | def for_hyphen():
for row in range(3):
for col in range(3):
if row == 1:
print('*', end=' ')
else:
print(' ', end=' ')
print()
def while_hyphen():
row = 0
while row < 3:
col = 0
while col < 3:
if row == 1:
... |
class EmptyGraphHelper(object):
@staticmethod
def get_help_message():
return f"""
We are deeply sorry but unfortunately the result graph is empty.
Please try the following steps to fix the problem -
\t1. Try running again with other / no filters
\t2. Make sure to run 'ed... | class Emptygraphhelper(object):
@staticmethod
def get_help_message():
return f"\n We are deeply sorry but unfortunately the result graph is empty.\n Please try the following steps to fix the problem - \n \t1. Try running again with other / no filters\n \t2. Make sure to run ... |
def tabuada(numero):
for i in range(1, 11):
print(f'{i} x {numero} = {i * numero}')
tabuada(int(input()))
| def tabuada(numero):
for i in range(1, 11):
print(f'{i} x {numero} = {i * numero}')
tabuada(int(input())) |
class RadarSensor:
angle = None
axis = None
distance = None
property = None
| class Radarsensor:
angle = None
axis = None
distance = None
property = None |
# 838. Push Dominoes
# There are N dominoes in a line, and we place each domino vertically upright.
# In the beginning, we simultaneously push some of the dominoes either to the left or to the right.
# After each second, each domino that is falling to the left pushes the adjacent domino on the left.
# Similarly, th... | class Solution(object):
def push_dominoes(self, dominoes):
"""
:type dominoes: str
:rtype: str
"""
dp = [0] * len(dominoes)
lst = list(dominoes)
n = len(lst)
(left_dist, right_dist) = (None, None)
for (i, val) in enumerate(dominoes):
... |
#!/usr/bin/env python3
class Course:
'''Course superclass for any course'''
def __init__(self, dept, num, name='',
units=4, prereq=set(), restr=set(), coclass=None):
self.dept, self.num, self.name = dept, num, name
self.units = units
self.prereq, self.restr = prereq, restr
... | class Course:
"""Course superclass for any course"""
def __init__(self, dept, num, name='', units=4, prereq=set(), restr=set(), coclass=None):
(self.dept, self.num, self.name) = (dept, num, name)
self.units = units
(self.prereq, self.restr) = (prereq, restr)
if coclass:
... |
"""Ecosystem exception."""
class QiskitEcosystemException(Exception):
"""Exceptions for qiskit ecosystem."""
| """Ecosystem exception."""
class Qiskitecosystemexception(Exception):
"""Exceptions for qiskit ecosystem.""" |
# LIS2DW12 3-axis motion seneor micropython drive
# ver: 1.0
# License: MIT
# Author: shaoziyang (shaoziyang@micropython.org.cn)
# v1.0 2019.7
LIS2DW12_CTRL1 = const(0x20)
LIS2DW12_CTRL2 = const(0x21)
LIS2DW12_CTRL3 = const(0x22)
LIS2DW12_CTRL6 = const(0x25)
LIS2DW12_STATUS = const(0x27)
LIS2DW12_OUT_T_L = const(0x0D)... | lis2_dw12_ctrl1 = const(32)
lis2_dw12_ctrl2 = const(33)
lis2_dw12_ctrl3 = const(34)
lis2_dw12_ctrl6 = const(37)
lis2_dw12_status = const(39)
lis2_dw12_out_t_l = const(13)
lis2_dw12_out_x_l = const(40)
lis2_dw12_out_y_l = const(42)
lis2_dw12_out_z_l = const(44)
lis2_dw12_scale = ('2g', '4g', '8g', '16g')
class Lis2Dw12... |
recomputation_vm_memory = 2048
haskell_vm_memory = 4096
recomputation_vm_cpus = 2
vagrantfile_templates_dict = {
"python": "python/python.vagrantfile",
"node_js": "nodejs/nodejs.vagrantfile",
"cpp": "cpp/cpp.vagrantfile",
"c++": "cpp/cpp.vagrantfile",
"c": "cpp/cpp.vagrantfile",
"haskell": "has... | recomputation_vm_memory = 2048
haskell_vm_memory = 4096
recomputation_vm_cpus = 2
vagrantfile_templates_dict = {'python': 'python/python.vagrantfile', 'node_js': 'nodejs/nodejs.vagrantfile', 'cpp': 'cpp/cpp.vagrantfile', 'c++': 'cpp/cpp.vagrantfile', 'c': 'cpp/cpp.vagrantfile', 'haskell': 'haskell/haskell.vagrantfile',... |
def pay(hours,rate) :
return hours * rate
hours = float(input('Enter Hours:'))
rate = float(input('Enter Rate:'))
print(pay(hours,rate)) | def pay(hours, rate):
return hours * rate
hours = float(input('Enter Hours:'))
rate = float(input('Enter Rate:'))
print(pay(hours, rate)) |
{
"targets": [
{
"target_name": "mynanojs",
"sources": [ "./src/mynanojs.c", "./src/utility.c", "./src/mybitcoinjs.c" ],
"include_dirs":[ "./include", "./include/sodium" ],
"libraries": [
"../lib/libnanocrypto1.a", "../lib/libsodium.a"
],
}
]
}
| {'targets': [{'target_name': 'mynanojs', 'sources': ['./src/mynanojs.c', './src/utility.c', './src/mybitcoinjs.c'], 'include_dirs': ['./include', './include/sodium'], 'libraries': ['../lib/libnanocrypto1.a', '../lib/libsodium.a']}]} |
#!/usr/bin/python
# -*- coding: utf-8 -*-
def add(x, y):
"""Add two numbers together and return the result"""
return x + y
def subtract(x, y):
"""Subtract x from y and return result"""
return y - x
| def add(x, y):
"""Add two numbers together and return the result"""
return x + y
def subtract(x, y):
"""Subtract x from y and return result"""
return y - x |
input00 = open("input/input00.txt", "r")
input01 = open("input/input01.txt", "r")
input00_list = input00.read().splitlines()
input01_list = input01.read().splitlines()
count_elements = int(input00_list[0])
dictionary = {}
for i in range(count_elements):
str_elements = input00_list[i+1].split()
dictionary[str... | input00 = open('input/input00.txt', 'r')
input01 = open('input/input01.txt', 'r')
input00_list = input00.read().splitlines()
input01_list = input01.read().splitlines()
count_elements = int(input00_list[0])
dictionary = {}
for i in range(count_elements):
str_elements = input00_list[i + 1].split()
dictionary[str_... |
{
"variables": {
"library%": "shared_library",
"mikmod_dir%": "../libmikmod"
},
"target_defaults": {
"include_dirs": [
"include",
"<(mikmod_dir)/include"
],
"defines": [
"HAVE_CONFIG_H"
],
"cflags": [
"-Wall",
"-finline-functions",
"-funroll-loops",
"-ffast-math"
],
"target_... | {'variables': {'library%': 'shared_library', 'mikmod_dir%': '../libmikmod'}, 'target_defaults': {'include_dirs': ['include', '<(mikmod_dir)/include'], 'defines': ['HAVE_CONFIG_H'], 'cflags': ['-Wall', '-finline-functions', '-funroll-loops', '-ffast-math'], 'target_conditions': [["OS == 'win'", {'defines': ['WIN32']}], ... |
##
# Copyright (c) 2006-2016 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | def parsetoken(text, delimiters=' \t'):
if not text:
return ('', '')
if text[0] == '"':
return parsequoted(text, delimiters)
else:
for (pos, c) in enumerate(text):
if c in delimiters:
token = text[0:pos]
break
else:
retu... |
units=int(input("Enter the number of units you used: "))
if(units>=0 and units <= 50):
amount = units * 0.50
elif(units <= 150):
amount = units * 0.75
elif(units <= 250):
amount = units * 1.25
else:
amount = units * 1.50
surcharge = amount * 17/100
ebill = amount + surcharge
print("Electricity Bill =... | units = int(input('Enter the number of units you used: '))
if units >= 0 and units <= 50:
amount = units * 0.5
elif units <= 150:
amount = units * 0.75
elif units <= 250:
amount = units * 1.25
else:
amount = units * 1.5
surcharge = amount * 17 / 100
ebill = amount + surcharge
print('Electricity Bill = R... |
class matching_matrix_proportion():
def __init__(self, sol, n, * args, **kwargs):
self.rows = {i : {int(j):1} for i, j in enumerate(sol)}
self.n = n
self.k = len(Counter(sol))
self.update_A = {}
self.maximums = np.zeros(self.k)
self.where = np.zeros... | class Matching_Matrix_Proportion:
def __init__(self, sol, n, *args, **kwargs):
self.rows = {i: {int(j): 1} for (i, j) in enumerate(sol)}
self.n = n
self.k = len(counter(sol))
self.update_A = {}
self.maximums = np.zeros(self.k)
self.where = np.zeros(self.k)
def m... |
class Solution:
def findNumbers(self, nums: List[int]) -> int:
ans = 0
if(len(nums) == 0):
return 0
for i in nums:
if(len(str(i))%2 == 0):
ans+=1;
return ans
| class Solution:
def find_numbers(self, nums: List[int]) -> int:
ans = 0
if len(nums) == 0:
return 0
for i in nums:
if len(str(i)) % 2 == 0:
ans += 1
return ans |
"""
This file contains all the biological constants of Chlamy CCM.
--------------------------------------------------------------
"""
# ============================================================= #
# + Define relevant length scale, time scale, and conc. scale
Lnth = 3.14 * pow(10, -6) ... | """
This file contains all the biological constants of Chlamy CCM.
--------------------------------------------------------------
"""
lnth = 3.14 * pow(10, -6)
time = Lnth * Lnth / pow(10, -9)
conc = 0.001
k_h2co3 = 3 * pow(10, -5) / (Lnth / Time)
k_hco3 = 5 * pow(10, -8) / (Lnth / Time)
p_ka1 = 3.4
p_h_tub = 6.0
p_h_... |
#! /usr/bin/env python
"""
RASPA file format and default parameters.
"""
GENERIC_PSEUDO_ATOMS_HEADER = [
['# of pseudo atoms'],
['29'],
['#type ', 'print ', 'as ', 'chem ', 'oxidation ', 'mass ', 'charge ', 'polarization ', 'B-factor radii ', 'connectivity ', 'anisotropic ', 'anisotropic-type ', 'tinker-typ... | """
RASPA file format and default parameters.
"""
generic_pseudo_atoms_header = [['# of pseudo atoms'], ['29'], ['#type ', 'print ', 'as ', 'chem ', 'oxidation ', 'mass ', 'charge ', 'polarization ', 'B-factor radii ', 'connectivity ', 'anisotropic ', 'anisotropic-type ', 'tinker-type ']]
generic_pseudo_atoms = [['He ... |
class Store:
def __init__(self):
self.store_item = []
def __str__(self):
if self.store_item == []:
return 'No items'
return '\n'.join(map(str,self.store_item))
def add_item(self,item):
self.store_item.append(item)
def count(self):
return len(self.store_item)
def filter(self, q_object):
stor... | class Store:
def __init__(self):
self.store_item = []
def __str__(self):
if self.store_item == []:
return 'No items'
return '\n'.join(map(str, self.store_item))
def add_item(self, item):
self.store_item.append(item)
def count(self):
return len(self... |
def add(x, y):
"""Sum two numbers"""
return x + y
def subtract(x, y):
"""Subtract two numbers"""
return x - y
| def add(x, y):
"""Sum two numbers"""
return x + y
def subtract(x, y):
"""Subtract two numbers"""
return x - y |
"""
# Why we use for else condition ?
# For checking the specific number or checking the condition is true
# if the condition is false we just print single line in else condition.
"""
# To check whether the given number is divisible by 5 then print the number
# if it's not then print "Given is not divisible by ... | """
# Why we use for else condition ?
# For checking the specific number or checking the condition is true
# if the condition is false we just print single line in else condition.
"""
nums = [34, 53, 32, 20, 39]
for num in nums:
if num % 5 == 0:
print(num)
break
else:
print('Given number is not ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 22 10:26:43 2018
@author: francisco
"""
#1)
if 6 > 7:
print("Yep")
# Answer: Blank
# Since 6 is not greater than 7, it doesn't print anything and it doesn't have any
# more conditionals to evalutate.
#2)
if 6 > 7:
print("Yep")
else:
pr... | """
Created on Tue May 22 10:26:43 2018
@author: francisco
"""
if 6 > 7:
print('Yep')
if 6 > 7:
print('Yep')
else:
print('Nope')
var = 'Panda'
if var == 'panda':
print('Cute!')
elif var == 'Panda':
print('Regal!')
else:
print('Ugly...')
temp = 120
if temp > 85:
print('Hot')
elif temp > 100:... |
class A:
def __init__(self, *, kw_only, optional_kw_only=None):
pass
class B(A):
def __init__(self, *, kw_only):
super().__init__(kw_only=kw_only) | class A:
def __init__(self, *, kw_only, optional_kw_only=None):
pass
class B(A):
def __init__(self, *, kw_only):
super().__init__(kw_only=kw_only) |
'''
Problem description:
Given an array of unsorted integers, find the smallest positive integer not in the array.
'''
def find_smallest_missing_pos_int_sort(array):
'''
runtime: O(nlogn)
space : O(1) - this depends on the sort but python's list.sort() performs an in-place sort
This sort-based soluti... | """
Problem description:
Given an array of unsorted integers, find the smallest positive integer not in the array.
"""
def find_smallest_missing_pos_int_sort(array):
"""
runtime: O(nlogn)
space : O(1) - this depends on the sort but python's list.sort() performs an in-place sort
This sort-based solutio... |
class Crawler:
def __init__(self, root):
self._root = root
def crawl(self):
pass
def crawl_into(self):
pass
| class Crawler:
def __init__(self, root):
self._root = root
def crawl(self):
pass
def crawl_into(self):
pass |
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
def buildbuddy_deps():
maybe(
http_archive,
name = "rules_cc",
sha256 = "b6f34b3261ec02f85dbc5a8bdc9414ce548e1f5f67e000d7069571799cb88b25",
strip_prefi... | load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
load('@bazel_tools//tools/build_defs/repo:utils.bzl', 'maybe')
def buildbuddy_deps():
maybe(http_archive, name='rules_cc', sha256='b6f34b3261ec02f85dbc5a8bdc9414ce548e1f5f67e000d7069571799cb88b25', strip_prefix='rules_cc-726dd8157557f1456b3656e26... |
def TP(target, prediction):
"""
True positives.
:param target: target value
:param prediction: prediction value
:return:
"""
return (target.float() * prediction.float().round()).sum()
def TN(target, prediction):
"""
True negatives.
:param target: target value
:param predict... | def tp(target, prediction):
"""
True positives.
:param target: target value
:param prediction: prediction value
:return:
"""
return (target.float() * prediction.float().round()).sum()
def tn(target, prediction):
"""
True negatives.
:param target: target value
:param predicti... |
# The @npm packages at the root node_modules are used by integration tests
# with `file:../../node_modules/foobar` references
NPM_PACKAGE_ARCHIVES = [
"@angular/animations-12",
"@angular/common-12",
"@angular/core-12",
"@angular/forms-12",
"@angular/platform-browser-12",
"@angular/platform-brows... | npm_package_archives = ['@angular/animations-12', '@angular/common-12', '@angular/core-12', '@angular/forms-12', '@angular/platform-browser-12', '@angular/platform-browser-dynamic-12', '@angular/platform-server-12', '@angular/router-12', '@babel/core', '@rollup/plugin-babel', '@rollup/plugin-node-resolve', '@rollup/plu... |
# Copyright (C) 2016 Benoit Myard <myardbenoit@gmail.com>
# Released under the terms of the BSD license.
class BaseRemoteStorage(object):
def __init__(self, config, root):
self.config = config
self.root = root
def __enter__(self):
raise NotImplementedError
def __exit__(self, *args... | class Baseremotestorage(object):
def __init__(self, config, root):
self.config = config
self.root = root
def __enter__(self):
raise NotImplementedError
def __exit__(self, *args):
pass
def push(self, filename):
raise NotImplementedError
def pull(self, path... |
get_f = float(input("Enter temperature in Fahrenheit: "))
convert_c = (get_f - 32) * 5/9
print(f"{get_f} in Fahrenheit is equal to {convert_c} in Celsius")
| get_f = float(input('Enter temperature in Fahrenheit: '))
convert_c = (get_f - 32) * 5 / 9
print(f'{get_f} in Fahrenheit is equal to {convert_c} in Celsius') |
#!/usr/bin/env python
# coding: utf-8
# # Exercise 1. Regex and Parsing challenges :
# ### writer : Faranak Alikhah 1954128
# ### 14.Regex Substitution :
# In[ ]:
for _ in range(int(input())):
line = input()
while '&&'in line or '||'in line:
line = line.replace("&&", "and").replace("||", "or")
... | for _ in range(int(input())):
line = input()
while '&&' in line or '||' in line:
line = line.replace('&&', 'and').replace('||', 'or')
print(line) |
def is_valid_story_or_comment(form_data):
parent = form_data.get('parent')
title = bool(form_data.get('title'))
url = bool(form_data.get('url'))
text = bool(form_data.get('text'))
if parent:
if title or url:
return (False, 'Invalid fields for a comment')
if not text:
... | def is_valid_story_or_comment(form_data):
parent = form_data.get('parent')
title = bool(form_data.get('title'))
url = bool(form_data.get('url'))
text = bool(form_data.get('text'))
if parent:
if title or url:
return (False, 'Invalid fields for a comment')
if not text:
... |
class Node:
def __init__(self, value):
self.value = value
self.next = None
class LinkedList:
def __init__(self, values = []):
self.head = None
for value in values:
self.append(value)
def append(self, value):
if self.head is None:
... | class Node:
def __init__(self, value):
self.value = value
self.next = None
class Linkedlist:
def __init__(self, values=[]):
self.head = None
for value in values:
self.append(value)
def append(self, value):
if self.head is None:
self.head = ... |
""" A Symbol in a pushdown automaton """
class Symbol:
""" A Symbol in a pushdown automaton
Parameters
----------
value : any
The value of the state
"""
def __init__(self, value):
self._value = value
def __hash__(self):
return hash(str(self._value))
@proper... | """ A Symbol in a pushdown automaton """
class Symbol:
""" A Symbol in a pushdown automaton
Parameters
----------
value : any
The value of the state
"""
def __init__(self, value):
self._value = value
def __hash__(self):
return hash(str(self._value))
@propert... |
loss_fns = ['retrain_regu_mas', 'retrain_regu_mine', 'retrain_regu_minen', 'retrain_regu_fisher', 'retrain_regu_fishern',\
'retrain', 'retrain_regu', 'retrain_regu_selfless']#'retrain_regu_mine3', 'cnn'
model_log_map = {'fishern': 'EWCN', 'mine': 'Arms', 'minen': 'ArmsN', 'regu': 'RetrainRegu', \
'fisher': 'EWC', '... | loss_fns = ['retrain_regu_mas', 'retrain_regu_mine', 'retrain_regu_minen', 'retrain_regu_fisher', 'retrain_regu_fishern', 'retrain', 'retrain_regu', 'retrain_regu_selfless']
model_log_map = {'fishern': 'EWCN', 'mine': 'Arms', 'minen': 'ArmsN', 'regu': 'RetrainRegu', 'fisher': 'EWC', 'mas': 'MAS', 'selfless': 'Selfless'... |
def digit_to_text(digit):
if digit == 1:
return "one"
elif digit == 2:
return "two"
elif digit == 3:
return "three"
elif digit == 4:
return "four"
elif digit == 5:
return "five"
elif digit == 6:
return "six"
elif digit == 7:
return "sev... | def digit_to_text(digit):
if digit == 1:
return 'one'
elif digit == 2:
return 'two'
elif digit == 3:
return 'three'
elif digit == 4:
return 'four'
elif digit == 5:
return 'five'
elif digit == 6:
return 'six'
elif digit == 7:
return 'sev... |
def get_schema():
return {
'type': 'object',
'properties':
{
'aftale_id': {'type': 'string'},
'state': {'type': 'string'},
'gateway_fejlkode': {'type': 'string'}
},
'required': ['aftale_id', 'gateway_fejlkode']
}
| def get_schema():
return {'type': 'object', 'properties': {'aftale_id': {'type': 'string'}, 'state': {'type': 'string'}, 'gateway_fejlkode': {'type': 'string'}}, 'required': ['aftale_id', 'gateway_fejlkode']} |
w = h = 600
s = 40
off = s/4
shift = 3
x = y = 0
newPage(w, h)
strokeWidth(2)
stroke(.5)
while (y * s) < h:
while (x *s) < w:
fill(0) if x % 2 == 0 else fill(1)
rect(off + x * s, y * s, s, s)
x += 1
if y % 3 == 0: off *= -1
off += s/4
x = 0
y += 1
saveImage('imgs/cafe... | w = h = 600
s = 40
off = s / 4
shift = 3
x = y = 0
new_page(w, h)
stroke_width(2)
stroke(0.5)
while y * s < h:
while x * s < w:
fill(0) if x % 2 == 0 else fill(1)
rect(off + x * s, y * s, s, s)
x += 1
if y % 3 == 0:
off *= -1
off += s / 4
x = 0
y += 1
save_image('imgs... |
"""
Caesar Cipher Encryptor:
Given a non-empty string of lowercase letters and a non-negative integer representing a key,
write a function that returns a new string obtained by shifting every letter in the input string by k positions in the alphabet,
where k is the key.
Note that letters should "wrap" around the alpha... | """
Caesar Cipher Encryptor:
Given a non-empty string of lowercase letters and a non-negative integer representing a key,
write a function that returns a new string obtained by shifting every letter in the input string by k positions in the alphabet,
where k is the key.
Note that letters should "wrap" around the alpha... |
class Solution:
def recoverTree(self, root):
def inorder(node):
if node.left:
yield from inorder(node.left)
yield node
if node.right:
yield from inorder(node.right)
swap1 = swap2 = smaller = None
for node in inorder(root): ... | class Solution:
def recover_tree(self, root):
def inorder(node):
if node.left:
yield from inorder(node.left)
yield node
if node.right:
yield from inorder(node.right)
swap1 = swap2 = smaller = None
for node in inorder(root)... |
'''
80. Remove Duplicates from Sorted Array II
Given a sorted array nums, remove the duplicates in-place such that duplicates appeared at most twice and return the new length.
Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.
'''
class Solut... | """
80. Remove Duplicates from Sorted Array II
Given a sorted array nums, remove the duplicates in-place such that duplicates appeared at most twice and return the new length.
Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.
"""
class Solut... |
expected_output = {
"dhcp_guard_policy_config":{
"policy_name":"pol1",
"trusted_port":True,
"device_role":"dhcp server",
"max_preference":255,
"min_preference":0,
"access_list":"acl2",
"prefix_list":"abc",
"targets":{
"vlan 2":{
"target":"vlan 2"... | expected_output = {'dhcp_guard_policy_config': {'policy_name': 'pol1', 'trusted_port': True, 'device_role': 'dhcp server', 'max_preference': 255, 'min_preference': 0, 'access_list': 'acl2', 'prefix_list': 'abc', 'targets': {'vlan 2': {'target': 'vlan 2', 'type': 'VLAN', 'feature': 'DHCP Guard', 'target_range': 'vlan al... |
class Person:
Y = "You are young."
T = "You are a teenager."
O = "You are old."
age = int(0)
def __init__(self, initialAge):
if initialAge < 0:
print('Age is not valid, setting age to 0.')
else:
self.age = initialAge
def amIOld(self):
if self.age... | class Person:
y = 'You are young.'
t = 'You are a teenager.'
o = 'You are old.'
age = int(0)
def __init__(self, initialAge):
if initialAge < 0:
print('Age is not valid, setting age to 0.')
else:
self.age = initialAge
def am_i_old(self):
if self.a... |
"""
Stuff
"""
class Sequence(object):
def __init__(self, *_seq):
self.seq = tuple(_seq)
pass; | """
Stuff
"""
class Sequence(object):
def __init__(self, *_seq):
self.seq = tuple(_seq)
pass |
# Improved Position Calculation
# objectposncalc.py (improved)
print("This program calculates an object's final position.")
do_calculation = True
while(do_calculation):
# Get information about the object from the user
while (True):
try:
initial_position = float(input("\nEnter the object's... | print("This program calculates an object's final position.")
do_calculation = True
while do_calculation:
while True:
try:
initial_position = float(input("\nEnter the object's initial position: "))
except ValueError:
print('The value you entered is invalid. Only numerical val... |
CELL_DIM = 46
NEXT_CELL_DISTANCE = 66
NEXT_ROW_DISTANCE_V = 57
NEXT_ROW_DISTANCE_H = 33
INITIAL_V = 44
INITIAL_H = 230
| cell_dim = 46
next_cell_distance = 66
next_row_distance_v = 57
next_row_distance_h = 33
initial_v = 44
initial_h = 230 |
"""
In Central_Phila.gdb
Use an UpdateCursor to update any Parks 'ADDRESS' records ending in PWY or BLD to PKWY or BLVD
"""
# Import modules
# Set variables
# Execute operation
| """
In Central_Phila.gdb
Use an UpdateCursor to update any Parks 'ADDRESS' records ending in PWY or BLD to PKWY or BLVD
""" |
class ConfigFileNotFoundError(Exception):
"""Denotes failing to find configuration file."""
def __init__(self, message, locations, *args):
self.message = message
self.locations = ", ".join(str(l) for l in locations)
super(ConfigFileNotFoundError, self).__init__(message, locations,
... | class Configfilenotfounderror(Exception):
"""Denotes failing to find configuration file."""
def __init__(self, message, locations, *args):
self.message = message
self.locations = ', '.join((str(l) for l in locations))
super(ConfigFileNotFoundError, self).__init__(message, locations, *ar... |
class Node:
def __init__(self, value, adj):
self.value = value
self.adj = adj
self.visited = False
def dfs(graph):
for source in graph:
source.visited = True
dfs_node(source)
def dfs_node(node):
print(node.value)
for e in node.adj:
if not e.visited:
... | class Node:
def __init__(self, value, adj):
self.value = value
self.adj = adj
self.visited = False
def dfs(graph):
for source in graph:
source.visited = True
dfs_node(source)
def dfs_node(node):
print(node.value)
for e in node.adj:
if not e.visited:
... |
class Cuenta():
def __init__(self, nombre, saldo):
self.nombre=nombre
self.saldo=saldo
def get_ingreso(self):
ingresos=self.saldo + 100
return ingresos
def get_reintegro(self):
reintegro=self.saldo-300
return reintegro
def get_transferencia(self):
... | class Cuenta:
def __init__(self, nombre, saldo):
self.nombre = nombre
self.saldo = saldo
def get_ingreso(self):
ingresos = self.saldo + 100
return ingresos
def get_reintegro(self):
reintegro = self.saldo - 300
return reintegro
def get_transferencia(sel... |
class MessageDispatcher:
def __init__(self):
self._bacteria = []
self.message_uid = 1
def broadcast(self, message):
message.uid = self.message_uid
#print('-- {} Broad casting for agent# {}'.format(message.uid, message.sender.uid))
self.message_uid += 1
for bact... | class Messagedispatcher:
def __init__(self):
self._bacteria = []
self.message_uid = 1
def broadcast(self, message):
message.uid = self.message_uid
self.message_uid += 1
for bacterium in self._bacteria:
if bacterium is not message.sender:
bact... |
#!/usr/local/bin/python3
class Cpu():
def __init__(self, components):
self.components = [ tuple([int(x) for x in component.strip().split("/")]) for component in components ]
self.validBridges = self.__generateValidBridges(0, self.components)
def __generateValidBridges(self, port, components, b... | class Cpu:
def __init__(self, components):
self.components = [tuple([int(x) for x in component.strip().split('/')]) for component in components]
self.validBridges = self.__generateValidBridges(0, self.components)
def __generate_valid_bridges(self, port, components, bridge=None):
if not... |
def create_log_file(fname, optimization_method, directions, nodes, step, method_dd, method_ds_db, method_d2s_db2,
method_jacobian, method_hessian, e_dd, e_ds_db, ex_d2s_db2, ey_d2s_db2, e_jacobian,
ex_hessian, ey_hessian):
format1 = "# {:71}: {}\n"
format2 = "# {:71}: {:... | def create_log_file(fname, optimization_method, directions, nodes, step, method_dd, method_ds_db, method_d2s_db2, method_jacobian, method_hessian, e_dd, e_ds_db, ex_d2s_db2, ey_d2s_db2, e_jacobian, ex_hessian, ey_hessian):
format1 = '# {:71}: {}\n'
format2 = '# {:71}: {:25}| e : {:10}\n'
format3 = '# {:71}... |
class Node:
def __init__(self, element):
self.item = element
self.next_link = None
class QueueLL:
def __init__(self):
self.head = None
def is_empty(self):
if self.head is None:
print("Error! The queue is empty!")
return True
else:
... | class Node:
def __init__(self, element):
self.item = element
self.next_link = None
class Queuell:
def __init__(self):
self.head = None
def is_empty(self):
if self.head is None:
print('Error! The queue is empty!')
return True
else:
... |
def simulateSeats(seats):
#output seats
new_seats = []
# seat_n
# seat_ne
# seat_e
# seat_se
# seat_s
# seat_sw
# seat_w
# seat_nw
for i, seat_row in enumerate(seats):
for j, seat in enumerate(seats[i]):
print(" i : " + str(i) + " j : "+ str(j) + " seat :... | def simulate_seats(seats):
new_seats = []
for (i, seat_row) in enumerate(seats):
for (j, seat) in enumerate(seats[i]):
print(' i : ' + str(i) + ' j : ' + str(j) + ' seat : ' + seat)
return 0
f = open('day11test.txt', 'r')
seats = f.read().splitlines()
print(simulate_seats(seats)) |
# General system information
system_information = {
"SERVICE": "wecken_api",
"ENVIRONMENT": "development",
"BUILD": "dev_build",
}
# Database settings
database = {
"CONNECTION_STRING": "",
"LOCAL_DB_NAME": "mongo-wecken-dev-db"
}
# user settings
user = {
"profile": {
... | system_information = {'SERVICE': 'wecken_api', 'ENVIRONMENT': 'development', 'BUILD': 'dev_build'}
database = {'CONNECTION_STRING': '', 'LOCAL_DB_NAME': 'mongo-wecken-dev-db'}
user = {'profile': {'max_length': 500}} |
#string
my_var1="hello students"
myvar1="hello \t students"
print(my_var1)
print(myvar1)
print("class \t hello \t studennts")
#innt
my_var2=20
print("number is",my_var2, "msg ",my_var1)
#float
my_var3=20.123456789123456789
print(my_var3)
#complex
my_var4=23j
print(my_var4)
#list
my_var5=[1,20,"hello","world"]
prin... | my_var1 = 'hello students'
myvar1 = 'hello \t students'
print(my_var1)
print(myvar1)
print('class \t hello \t studennts')
my_var2 = 20
print('number is', my_var2, 'msg ', my_var1)
my_var3 = 20.123456789123455
print(my_var3)
my_var4 = 23j
print(my_var4)
my_var5 = [1, 20, 'hello', 'world']
print(my_var5)
my_var6 = (1, 20... |
#
# PySNMP MIB module CONTIVITY-TRAP-ACKNOWLEDGMENT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CONTIVITY-TRAP-ACKNOWLEDGMENT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:26:51 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using P... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_intersection, value_range_constraint, single_value_constraint, constraints_union) ... |
filename = "classes.csv"
filout = "classescleaned.csv"
with open(filename) as filein:
with open(filout,"w") as fileo:
for line in filein.readlines():
lineSplit = line.split(",")
# if len(lineSplit)>1:
# print(lineSplit[2])
# try:
# int(lin... | filename = 'classes.csv'
filout = 'classescleaned.csv'
with open(filename) as filein:
with open(filout, 'w') as fileo:
for line in filein.readlines():
line_split = line.split(',')
while len(lineSplit) != 15:
lineSplit[1] = lineSplit[0] + lineSplit[1]
l... |
# def multiply(a, b):
# if b == 0:
# return 0
# if b == 1:
# return a
# return a + multiply(a, b - 1)
def multiply(a, b):
if a < 0 and b < 0:
return multiply(-a, -b)
elif a < 0 or b < 0:
return -multiply(abs(a), abs(b))
elif b == 0:
return 0
elif b =... | def multiply(a, b):
if a < 0 and b < 0:
return multiply(-a, -b)
elif a < 0 or b < 0:
return -multiply(abs(a), abs(b))
elif b == 0:
return 0
elif b == 1:
return a
else:
return a + multiply(a, b - 1)
print(multiply(-5, 6)) |
class GrocyPicnicProduct():
grocy_id = ""
grocy_name = ""
grocy_img_id = ""
grocy_weight = ""
grocy_id_stock = ""
picnic_id = ""
def __init__(self, picnic_id: str, grocy_id: str, grocy_name: str, grocy_img_id: str, grocy_weight: str, grocy_id_stock: str):
self.picnic_id = p... | class Grocypicnicproduct:
grocy_id = ''
grocy_name = ''
grocy_img_id = ''
grocy_weight = ''
grocy_id_stock = ''
picnic_id = ''
def __init__(self, picnic_id: str, grocy_id: str, grocy_name: str, grocy_img_id: str, grocy_weight: str, grocy_id_stock: str):
self.picnic_id = picnic_id
... |
def checkDigestionWithTwoEnzymes(splitdic, probebindingsites, keyfeatures):
keylist2 = []; newSplitDic = {}; keylistTwoEnzymes = []; keydict = {}; banddic = {}
for key in splitdic:
keylist2.append(key)
for i in range(len(keylist2)):
for j in range(i+1, len(keylist2)):
bandsTwoE... | def check_digestion_with_two_enzymes(splitdic, probebindingsites, keyfeatures):
keylist2 = []
new_split_dic = {}
keylist_two_enzymes = []
keydict = {}
banddic = {}
for key in splitdic:
keylist2.append(key)
for i in range(len(keylist2)):
for j in range(i + 1, len(keylist2)):
... |
@bot.command(name='roll')
async def roll(ctx, roll_type="action", number=1, placeholder="d", sides=20, modifier=0):
# broken
if number <= 0 or number > 10:
await ctx.send("Please enter a number of dice between 1 and 10.")
return
if sides < 1:
await ctx.send("Please enter a valid numbe... | @bot.command(name='roll')
async def roll(ctx, roll_type='action', number=1, placeholder='d', sides=20, modifier=0):
if number <= 0 or number > 10:
await ctx.send('Please enter a number of dice between 1 and 10.')
return
if sides < 1:
await ctx.send('Please enter a valid number of dice si... |
# ---------------------------- defining functions ---------------------------- #
def f(x, z):
return z
def s(x, z):
return -alpha * x
# ---------------------- system parameters and constants --------------------- #
g = 9.8 # gravitational acceleration | m/s^2
mu = 0.6 # kinetic friction coefficient
... | def f(x, z):
return z
def s(x, z):
return -alpha * x
g = 9.8
mu = 0.6
m = 0.5
l = 1.5
alpha = 2 * g * mu / l
h = 0.005
t_end = 20
number_of_steps = int(tEnd / h)
x_initial = 0.1
z_initial = 0 |
class DataTable:
"""A DataTable is an object used to define the domain and data for a DiscreteField.
Attributes
----------
dataWidth: int
An Int specifying the width of the data. Valid widths are 1, 6, 21, corresponding to
scalar data, orientations and 4D tensors.
name: str
... | class Datatable:
"""A DataTable is an object used to define the domain and data for a DiscreteField.
Attributes
----------
dataWidth: int
An Int specifying the width of the data. Valid widths are 1, 6, 21, corresponding to
scalar data, orientations and 4D tensors.
name: str
... |
def max_number(n):
sorting ="".join(sorted(str(n), reverse = True))
s =int(sorting)
return s
def max_number2(n):
return int(''.join(sorted(str(n), reverse=True)))
| def max_number(n):
sorting = ''.join(sorted(str(n), reverse=True))
s = int(sorting)
return s
def max_number2(n):
return int(''.join(sorted(str(n), reverse=True))) |
"""
1389. Create Target Array in the Given Order
Given two arrays of integers nums and index. Your task is to create target array under the following rules:
* Initially target array is empty.
* From left to right read nums[i] and index[i], insert at index index[i] the value nums[i] in target array.
* Repe... | """
1389. Create Target Array in the Given Order
Given two arrays of integers nums and index. Your task is to create target array under the following rules:
* Initially target array is empty.
* From left to right read nums[i] and index[i], insert at index index[i] the value nums[i] in target array.
* Repe... |
for i in range(1,101):
print(i,"(",end="")
if i % 2 == 0:
print(2,",",end="")
if i % 3 == 0:
print(3,",",end="")
if i % 5 == 0:
print(5,",",end="")
print(")")
| for i in range(1, 101):
print(i, '(', end='')
if i % 2 == 0:
print(2, ',', end='')
if i % 3 == 0:
print(3, ',', end='')
if i % 5 == 0:
print(5, ',', end='')
print(')') |
class ProcessingNode:
def execute(self, processor, img):
raise NotImplementedError()
def dependencies(self, processor):
return []
| class Processingnode:
def execute(self, processor, img):
raise not_implemented_error()
def dependencies(self, processor):
return [] |
#
# PySNMP MIB module SIP-UA-MIB (http://pysnmp.sf.net)
# ASN.1 source http://mibs.snmplabs.com:80/asn1/SIP-UA-MIB
# Produced by pysmi-0.0.7 at Sun Feb 14 00:28:20 2016
# On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose
# Using Python version 3.5.0 (default, Jan 5 2016, 17:11:52)
#
( OctetS... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, single_value_constraint, value_range_constraint, constraints_intersection) ... |
class Model(object):
def __init__(self):
self.username = None
self.password = None
self.deck = None
def username(self):
return self.username
def password(self):
return self.password
def deck(self):
return self.deck | class Model(object):
def __init__(self):
self.username = None
self.password = None
self.deck = None
def username(self):
return self.username
def password(self):
return self.password
def deck(self):
return self.deck |
with open('text.txt', 'r') as f:
for num, line in enumerate(f):
if line.find('text') > -1:
print(f'The word text is present on the line {num + 1}')
# print(content)
| with open('text.txt', 'r') as f:
for (num, line) in enumerate(f):
if line.find('text') > -1:
print(f'The word text is present on the line {num + 1}') |
def collision(x1, y1, radius1, x2, y2, radius2) -> bool:
if ((x1 - x2) ** 2 + (y1 - y2) ** 2) <= (radius1 + radius2) ** 2:
return True
return False
| def collision(x1, y1, radius1, x2, y2, radius2) -> bool:
if (x1 - x2) ** 2 + (y1 - y2) ** 2 <= (radius1 + radius2) ** 2:
return True
return False |
#removing duplicates
l1=list()
for i in range(5):
l1.append((input("enter element:")))
print(l1)
i=0
while i<len(l1):
j=i+1
while j<len(l1):
if l1[i]==l1[j]:
del l1[j]
else:
j+=1
i+=1
print(l1)
| l1 = list()
for i in range(5):
l1.append(input('enter element:'))
print(l1)
i = 0
while i < len(l1):
j = i + 1
while j < len(l1):
if l1[i] == l1[j]:
del l1[j]
else:
j += 1
i += 1
print(l1) |
EXPECTED_METRICS = {
"php_apcu.cache.mem_size": 0,
"php_apcu.cache.num_slots": 1,
"php_apcu.cache.ttl": 0,
"php_apcu.cache.num_hits": 0,
"php_apcu.cache.num_misses": 0,
"php_apcu.cache.num_inserts": 0,
"php_apcu.cache.num_entries": 0,
"php_apcu.cache.num_expunges": 0,
"php_apcu.cache... | expected_metrics = {'php_apcu.cache.mem_size': 0, 'php_apcu.cache.num_slots': 1, 'php_apcu.cache.ttl': 0, 'php_apcu.cache.num_hits': 0, 'php_apcu.cache.num_misses': 0, 'php_apcu.cache.num_inserts': 0, 'php_apcu.cache.num_entries': 0, 'php_apcu.cache.num_expunges': 0, 'php_apcu.cache.uptime': 1, 'php_apcu.sma.avail_mem'... |
'''
QUESTION:
868. Binary Gap
Given a positive integer N, find and return the longest distance between two consecutive 1's in the binary representation of N.
If there aren't two consecutive 1's, return 0.
Example 1:
Input: 22
Output: 2
Explanation:
22 in binary is 0b10110.
In the binary representation of 22, ther... | """
QUESTION:
868. Binary Gap
Given a positive integer N, find and return the longest distance between two consecutive 1's in the binary representation of N.
If there aren't two consecutive 1's, return 0.
Example 1:
Input: 22
Output: 2
Explanation:
22 in binary is 0b10110.
In the binary representation of 22, ther... |
def convert_to_unicode(text):
"""Converts `text` to Unicode (if it's not already), assuming utf-8 input."""
if six.PY3:
if isinstance(text, str):
return text
elif isinstance(text, bytes):
return text.decode("utf-8", "ignore")
else:
raise ValueError("Unsupported string type: %s" % (typ... | def convert_to_unicode(text):
"""Converts `text` to Unicode (if it's not already), assuming utf-8 input."""
if six.PY3:
if isinstance(text, str):
return text
elif isinstance(text, bytes):
return text.decode('utf-8', 'ignore')
else:
raise value_error('U... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.