content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
pkgname = "pcre"
pkgver = "8.45"
pkgrel = 0
build_style = "gnu_configure"
configure_args = [
"--with-pic",
"--enable-utf8",
"--enable-unicode-properties",
"--enable-pcretest-libedit",
"--enable-pcregrep-libz",
"--enable-pcregrep-libbz2",
"--enable-newline-is-anycrlf",
"--enable-jit",
... | pkgname = 'pcre'
pkgver = '8.45'
pkgrel = 0
build_style = 'gnu_configure'
configure_args = ['--with-pic', '--enable-utf8', '--enable-unicode-properties', '--enable-pcretest-libedit', '--enable-pcregrep-libz', '--enable-pcregrep-libbz2', '--enable-newline-is-anycrlf', '--enable-jit', '--enable-static', '--disable-stack-... |
def m2f_e(s, st):
return [[st.index(ch), st.insert(0, st.pop(st.index(ch)))][0] for ch in s]
def m2f_d(sq, st):
return ''.join([st[i], st.insert(0, st.pop(i))][0] for i in sq)
ST = list('abcdefghijklmnopqrstuvwxyz')
for s in ['broood', 'bananaaa', 'hiphophiphop']:
encode = m2f_e(s, ST[::])
print('%14r... | def m2f_e(s, st):
return [[st.index(ch), st.insert(0, st.pop(st.index(ch)))][0] for ch in s]
def m2f_d(sq, st):
return ''.join(([st[i], st.insert(0, st.pop(i))][0] for i in sq))
st = list('abcdefghijklmnopqrstuvwxyz')
for s in ['broood', 'bananaaa', 'hiphophiphop']:
encode = m2f_e(s, ST[:])
print('%14r... |
def get_pyenv_root():
return "/usr/local/pyenv"
def get_user():
return "root"
def get_group():
return "root"
def get_rc_file():
return "/etc/profile.d/pyenv.sh"
def get_python_test_case():
return "3.9.0", True
def get_venv_test_case():
return "neovim", True
| def get_pyenv_root():
return '/usr/local/pyenv'
def get_user():
return 'root'
def get_group():
return 'root'
def get_rc_file():
return '/etc/profile.d/pyenv.sh'
def get_python_test_case():
return ('3.9.0', True)
def get_venv_test_case():
return ('neovim', True) |
# https://www.hackerrank.com/challenges/30-testing/forum/comments/138775
print("5")
print("5 3\n-1 90 999 100 0")
print("4 2\n0 -1 2 1")
print("3 3\n-1 0 1")
print("6 1\n-1 0 1 -1 2 3")
print("7 3\n-1 0 1 2 3 4 5")
| print('5')
print('5 3\n-1 90 999 100 0')
print('4 2\n0 -1 2 1')
print('3 3\n-1 0 1')
print('6 1\n-1 0 1 -1 2 3')
print('7 3\n-1 0 1 2 3 4 5') |
def inorde_tree_walk(self, vertice = None):
if(self.raiz == None): #arvore vazia
return
if(verice == None): #Por padrao comeca pela raiz
vertice = self.raiz
if(vertice.left != None): #Decomposicao
self.inorde_tree_walk(vertice = vertice.left)
print(vertice)
if(ver... | def inorde_tree_walk(self, vertice=None):
if self.raiz == None:
return
if verice == None:
vertice = self.raiz
if vertice.left != None:
self.inorde_tree_walk(vertice=vertice.left)
print(vertice)
if vertice.right != None:
self.inorde_tree_walk(vertice=vertice.right) |
#
# PySNMP MIB module HM2-DHCPS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HM2-DHCPS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:31:20 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, value_size_constraint, value_range_constraint, single_value_constraint) ... |
table_pkeys_map = {
"account": [
"account_id"
],
"account_assignd_cert": [
"account_id",
"x509_cert_id",
"x509_key_usg"
],
"account_auth_log": [
"account_id",
"account_auth_ts",
"auth_resource",
"account_auth_seq"
],
"account_co... | table_pkeys_map = {'account': ['account_id'], 'account_assignd_cert': ['account_id', 'x509_cert_id', 'x509_key_usg'], 'account_auth_log': ['account_id', 'account_auth_ts', 'auth_resource', 'account_auth_seq'], 'account_coll_type_relation': ['account_collection_type', 'account_collection_relation'], 'account_collection'... |
# LANGUAGE: Python
# AUTHOR: randy
# GITHUB: https://github.com/randy1369
print('Hello, python!') | print('Hello, python!') |
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 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'... |
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 |
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')
... |
# 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:
... |
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 |
#!/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:
... |
# 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']}]} |
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 |
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... |
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... |
# 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 = ... |
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... |
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)... |
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... |
# 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 |
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)) |
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 |
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))) |
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... |
file1 = open('/home/student/.ros/log/a13f3d8c-1369-11eb-a6ad-08002707b8e3/rosout.log','r')
file2 = open('/home/student/CarND-Capstone/imgs/Train_Imgs/Train_data.txt','w')
count=1
while True:
line = file1.readline()
if not line:
break
# if line.split(' ')[2][1:7]=='tl_det':
sep_line = line.split(' ')
if len(s... | file1 = open('/home/student/.ros/log/a13f3d8c-1369-11eb-a6ad-08002707b8e3/rosout.log', 'r')
file2 = open('/home/student/CarND-Capstone/imgs/Train_Imgs/Train_data.txt', 'w')
count = 1
while True:
line = file1.readline()
if not line:
break
sep_line = line.split(' ')
if len(sep_line) > 2 and sep_li... |
def kebab_to_snake_case(json):
if isinstance(json, dict):
return kebab_to_snake_case_dict(json)
if isinstance(json, list):
new_json = []
for d in json:
if isinstance(d, dict):
new_json.append(kebab_to_snake_case_dict)
return json
def kebab_to_snake_case_... | def kebab_to_snake_case(json):
if isinstance(json, dict):
return kebab_to_snake_case_dict(json)
if isinstance(json, list):
new_json = []
for d in json:
if isinstance(d, dict):
new_json.append(kebab_to_snake_case_dict)
return json
def kebab_to_snake_case_d... |
#Every true traveler must know how to do 3 things: fix the fire, find the water and extract useful information
#from the nature around him. Programming won't help you with the fire and water, but when it comes to the
#information extraction - it might be just the thing you need.
#Your task is to find the angle of the... | def sun_angle(hora):
hora = hora.split(':')
lista = []
for c in hora:
c = int(c)
lista.append(c)
if 6 <= int(lista[0]) < 18:
angulo = (lista[0] - 6) * 15 + lista[1] * 0.25
elif lista[0] == 18 and lista[1] == 0:
angulo = (lista[0] - 6) * 15 + lista[1] * 0.25
else:
... |
class Lightbulb:
def __init__(self):
self.state = "off"
def change_state(self):
if self.state == "off":
self.state = "on"
print("Turning the light on")
else:
self.state = "off"
print("Turning the light off")
| class Lightbulb:
def __init__(self):
self.state = 'off'
def change_state(self):
if self.state == 'off':
self.state = 'on'
print('Turning the light on')
else:
self.state = 'off'
print('Turning the light off') |
# Enable standard authentication functionality for this application
def user():
return dict(form=auth())
def index():
return dict()
def login():
form = auth.login(next=URL(a='loginexample', c='default',f='gallery'))
form.custom.widget.email['_class'] = 'form-control my-3 bg-light'
form.custom.wi... | def user():
return dict(form=auth())
def index():
return dict()
def login():
form = auth.login(next=url(a='loginexample', c='default', f='gallery'))
form.custom.widget.email['_class'] = 'form-control my-3 bg-light'
form.custom.widget.email['_placeholder'] = 'Email'
form.custom.widget.password[... |
# Space: O(1)
# Time: O(n)
# recursive approach
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def swapPairs(self, head):
if head is None or head.next is None:
return head... | class Solution:
def swap_pairs(self, head):
if head is None or head.next is None:
return head
first_node = head
second_node = head.next
first_node.next = self.swapPairs(head.next.next)
second_node.next = first_node
return second_node |
fin = open("input_18.txt")
digits = '1234567890'
def prep(text):
text = text.strip().replace(' ','')
text = text[::-1]
text = text.replace('(','X')
text = text.replace(')','(')
text = text.replace('X',')')
return text
def geval(text):
# print(text)
if text[0] == '(':
plevel =... | fin = open('input_18.txt')
digits = '1234567890'
def prep(text):
text = text.strip().replace(' ', '')
text = text[::-1]
text = text.replace('(', 'X')
text = text.replace(')', '(')
text = text.replace('X', ')')
return text
def geval(text):
if text[0] == '(':
plevel = 1
for (... |
#!/usr/bin/env python
#
# Converts the Gonnet matrix to a pair-wise score
#
# Read replacements
replacements = {}
filename = 'gonnet.csv'
print('Reading ' + filename)
rows = []
arow = []
acol = []
with open(filename, 'r') as f:
for k, line in enumerate(f):
row = line.strip().split(',')
if k < 19:
... | replacements = {}
filename = 'gonnet.csv'
print('Reading ' + filename)
rows = []
arow = []
acol = []
with open(filename, 'r') as f:
for (k, line) in enumerate(f):
row = line.strip().split(',')
if k < 19:
row = row[:row.index('')]
if k < 20:
arow.append(row[0])
... |
# rename this file to config.py
# change with your info from adafruit.io
ADAFRUIT_IO_USERNAME = "XXXX"
ADAFRUIT_IO_KEY = "aio_XXXXXXXXXXXXXXXXXXXXXXXXXXXX"
APIURL="https://api.openweathermap.org/data/2.5/weather?lat=41.XXXXXX&lon=-73.XXXXXX&appid=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&units=imperial"
| adafruit_io_username = 'XXXX'
adafruit_io_key = 'aio_XXXXXXXXXXXXXXXXXXXXXXXXXXXX'
apiurl = 'https://api.openweathermap.org/data/2.5/weather?lat=41.XXXXXX&lon=-73.XXXXXX&appid=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&units=imperial' |
# Copyright 2018 eBay Inc.
# Copyright 2012 OpenStack LLC.
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0... | netforce_plugin = 'NETFORCE'
netforce_description = 'A service plugin that manages the life cycle of the resources related to network devices'
health_state_healthy = 'healthy'
health_state_error = 'error'
health_state_probation = 'probation'
health_state_maintenance = 'maintenance'
subnet_type_primary = 'primary'
cms_a... |
consumer_conf = {
"aws_region":"",
"kinesis_stream":"",
"kinesis_endpoint":"",
"kinesis_app_name":"",
"AWS_ACCESS_KEY":"",
"AWS_SECRET_KEY":"",
"AWS_ACCESS_KEY_ID":"",
"AWS_SECRET_ACCESS_KEY":"",
"MONGO_CONNECTION_STRING":""
} | consumer_conf = {'aws_region': '', 'kinesis_stream': '', 'kinesis_endpoint': '', 'kinesis_app_name': '', 'AWS_ACCESS_KEY': '', 'AWS_SECRET_KEY': '', 'AWS_ACCESS_KEY_ID': '', 'AWS_SECRET_ACCESS_KEY': '', 'MONGO_CONNECTION_STRING': ''} |
'''
Implement the myAtoi(string s) function, which converts a string to a 32-bit signed integer (similar to C/C++'s atoi function).
The algorithm for myAtoi(string s) is as follows:
Read in and ignore any leading whitespace.
Check if the next character (if not already at the end of the string) is '-' or '+'. Read thi... | """
Implement the myAtoi(string s) function, which converts a string to a 32-bit signed integer (similar to C/C++'s atoi function).
The algorithm for myAtoi(string s) is as follows:
Read in and ignore any leading whitespace.
Check if the next character (if not already at the end of the string) is '-' or '+'. Read thi... |
# ==========================================================================
# Only for a given set of 10 companies the data is being extracted/collected
# to make predictions as they are independent and are also likely to sample
# lot of variation from engineering, beverages, mdicine, investment banking
# etc and the... | selected = ['GS']
all_companies_list = ['TRV', 'DOW', 'WBA', 'CAT', 'GS', 'MMM', 'AXP', 'UTX', 'IBM', 'NKE', 'MCD', 'BA', 'CSCO', 'CVX', 'PFE', 'MRK', 'VZ', 'KO', 'DIS', 'HD', 'XOM', 'UNH', 'INTC', 'PG', 'WMT', 'JNJ', 'JPM', 'V', 'AAPL', 'MSFT'] |
def getFix(s):
ret = ""
for i in range(1, len(s) - 1):
if s[i] == '(':
ret += ')'
else:
ret += '('
return ret
def isCorrect(s):
cnt = 0
for c in s:
if c == '(':
cnt += 1
else:
cnt -= 1
if cnt < 0:
re... | def get_fix(s):
ret = ''
for i in range(1, len(s) - 1):
if s[i] == '(':
ret += ')'
else:
ret += '('
return ret
def is_correct(s):
cnt = 0
for c in s:
if c == '(':
cnt += 1
else:
cnt -= 1
if cnt < 0:
... |
# https://leetcode.com/problems/subarray-sum-equals-k/
class Solution:
def subarraySum(self, nums: list[int], k: int) -> int:
block_sum = 0
sum_counts = {0: 1} # Pretend sum at the left of nums[0] was 0.
good_subarrays = 0
for num in nums:
block_sum += num
r... | class Solution:
def subarray_sum(self, nums: list[int], k: int) -> int:
block_sum = 0
sum_counts = {0: 1}
good_subarrays = 0
for num in nums:
block_sum += num
required = block_sum - k
if required in sum_counts:
good_subarrays += su... |
def const_ver():
return "v8.0"
def is_gpvdm_next():
return False
| def const_ver():
return 'v8.0'
def is_gpvdm_next():
return False |
if True:
pass
elif (banana):
pass
else:
pass | if True:
pass
elif banana:
pass
else:
pass |
other_schema = {
"type": "list",
"items": [
{"type": "string"},
{"type": "integer", "min": 500},
{
"type": "list",
"items": [
{"type": "string"},
{"type": "integer", "name": "nd_int"},
{"type": "integer"},
... | other_schema = {'type': 'list', 'items': [{'type': 'string'}, {'type': 'integer', 'min': 500}, {'type': 'list', 'items': [{'type': 'string'}, {'type': 'integer', 'name': 'nd_int'}, {'type': 'integer'}, {'type': 'integer', 'min': 50}]}]}
schema = {'list_of_values': {'type': 'list', 'name': 'hello', 'items': [{'type': 's... |
# As you already know, the string is one of the most
# important data types in Python. To make working with
# strings easier, Python has many special built-in string
# methods. We are about to learn some of them.
# An important thing to remember, however, is that the
# string is an immutable data type! It means t... | message = 'bonjour and welcome to Paris!'
print(message.upper())
print(message)
title_message = message.title()
print(title_message)
print(message.replace('Paris', 'Lyon'))
replace_message = message.replace('o', '!', 2)
print(replace_message)
print(message)
whitespace_string = ' hey '
normal_string = 'incomp... |
class CircularDependency(Exception):
pass
class UnparsedExpressions(Exception):
pass
class UnknownFilter(Exception):
pass
class FilterError(Exception):
pass
| class Circulardependency(Exception):
pass
class Unparsedexpressions(Exception):
pass
class Unknownfilter(Exception):
pass
class Filtererror(Exception):
pass |
#!/usr/bin/env python
data = [i for i in open('day03.input').readlines()]
fabric = [[0]*1000 for i in range(1000)]
def get_x_y_w_h(line):
_, _, coord, dim = line.split()
x, y = map(int, coord[:-1].split(','))
w, h = map(int, dim.split('x'))
return x, y, w, h
for line in data:
x, y, w, h = get_x_y... | data = [i for i in open('day03.input').readlines()]
fabric = [[0] * 1000 for i in range(1000)]
def get_x_y_w_h(line):
(_, _, coord, dim) = line.split()
(x, y) = map(int, coord[:-1].split(','))
(w, h) = map(int, dim.split('x'))
return (x, y, w, h)
for line in data:
(x, y, w, h) = get_x_y_w_h(line)
... |
try:
hours = int(input("enter hours :"))
rate=int(input("enter rate :"))
pay = int(hours * rate)
print("pay")
except:
print("Error, enter numeric input!") | try:
hours = int(input('enter hours :'))
rate = int(input('enter rate :'))
pay = int(hours * rate)
print('pay')
except:
print('Error, enter numeric input!') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.