content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 9 22:43:39 2020
@author: Ravi
"""
def caesarCipher(s,k):
cipherText = ''
for i in s:
if i.isalpha():
a = 'A' if i.isupper() else 'a'
cipherText += chr( ord(a) +(ord(i)- ord(a)+ k) %26 )
else:
cipherText +=i
... | """
Created on Mon Mar 9 22:43:39 2020
@author: Ravi
"""
def caesar_cipher(s, k):
cipher_text = ''
for i in s:
if i.isalpha():
a = 'A' if i.isupper() else 'a'
cipher_text += chr(ord(a) + (ord(i) - ord(a) + k) % 26)
else:
cipher_text += i
return cipherTe... |
""" Who are you code. """
name = ''
while name != 'Lil':
print ('Who are you?')
name = input()
if name == ('Lil'):
print ('Hi Lil')
passwd = ''
while passwd != 'jellyfish':
print('Enter your fish password please')
passwd = input()
if passwd == 'jellyfish':
print('Hello, enjoy!'... | """ Who are you code. """
name = ''
while name != 'Lil':
print('Who are you?')
name = input()
if name == 'Lil':
print('Hi Lil')
passwd = ''
while passwd != 'jellyfish':
print('Enter your fish password please')
passwd = input()
if passwd == 'jellyfish':
print('Hello, enjoy!')
... |
s1 = "ABCDEF"
s2 = "GHIJKL"
s3 = ""
for i in range(len(s1)):
s3 += s1[i] + s2[i]
print(s3) | s1 = 'ABCDEF'
s2 = 'GHIJKL'
s3 = ''
for i in range(len(s1)):
s3 += s1[i] + s2[i]
print(s3) |
# -*- coding: utf-8 -*-
__title__ = "txt2pdf"
__version__ = "0.6.7"
__author__ = "Julien Maupetit & c4ffein"
__license__ = "MIT"
__copyright__ = "Copyright 2013-2021 Julien Maupetit & c4ffein"
| __title__ = 'txt2pdf'
__version__ = '0.6.7'
__author__ = 'Julien Maupetit & c4ffein'
__license__ = 'MIT'
__copyright__ = 'Copyright 2013-2021 Julien Maupetit & c4ffein' |
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 15 09:09:49 2021
@author: Martin_Priessner
"""
# Select the ground truth xml in ISBI format
xml_file =r"F:\Martin G-Drive\1.1_Imperial_College\20210715_Tracking\TH10Qu22Dur14\GT9\MAX_2_ISBI.xml"
# Select the location and name of the new generated xml file ... | """
Created on Thu Jul 15 09:09:49 2021
@author: Martin_Priessner
"""
xml_file = 'F:\\Martin G-Drive\\1.1_Imperial_College\\20210715_Tracking\\TH10Qu22Dur14\\GT9\\MAX_2_ISBI.xml'
new_xml_file = 'F:\\Martin G-Drive\\1.1_Imperial_College\\20210715_Tracking\\TH10Qu22Dur14\\GT9\\MAX_2_ISBI_DS.xml'
input_slice_nr = 39
velo... |
power = {'BUSES': {'Area': 3.70399,
'Bus/Area': 3.70399,
'Bus/Gate Leakage': 0.00993673,
'Bus/Peak Dynamic': 2.16944,
'Bus/Runtime Dynamic': 0.23296,
'Bus/Subthreshold Leakage': 0.103619,
'Bus/Subthreshold Leakage with power gating': 0.0388573,
... | power = {'BUSES': {'Area': 3.70399, 'Bus/Area': 3.70399, 'Bus/Gate Leakage': 0.00993673, 'Bus/Peak Dynamic': 2.16944, 'Bus/Runtime Dynamic': 0.23296, 'Bus/Subthreshold Leakage': 0.103619, 'Bus/Subthreshold Leakage with power gating': 0.0388573, 'Gate Leakage': 0.00993673, 'Peak Dynamic': 2.16944, 'Runtime Dynamic': 0.2... |
def can_build(platform):
return True
def configure(env):
libpath = "#thirdparty/webrtc/lib/x64/Release/"
libname = "libwebrtc_full"
env.Append(CPPPATH=[libpath])
if env["platform"]== "x11":
env.Append(LIBS=["libwebrtc_full"])
env.Append(LIBPATH=[libpath])
elif env["platform"] == "windows":
... | def can_build(platform):
return True
def configure(env):
libpath = '#thirdparty/webrtc/lib/x64/Release/'
libname = 'libwebrtc_full'
env.Append(CPPPATH=[libpath])
if env['platform'] == 'x11':
env.Append(LIBS=['libwebrtc_full'])
env.Append(LIBPATH=[libpath])
elif env['platform'] =... |
a = input()
b = input()
d = dict()
for i in range(len(a)):
if a[i] not in d:
d[a[i]] = 1
else:
d[a[i]] += 1
count = int(0)
for i in range(len(b)):
if b[i] not in d:
count += 1
else:
d[b[i]] -= 1
for i, j in d.items():
count += abs(j)
print(count)
| a = input()
b = input()
d = dict()
for i in range(len(a)):
if a[i] not in d:
d[a[i]] = 1
else:
d[a[i]] += 1
count = int(0)
for i in range(len(b)):
if b[i] not in d:
count += 1
else:
d[b[i]] -= 1
for (i, j) in d.items():
count += abs(j)
print(count) |
"""
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
"""
@param root: a root of integer
@return: return a list of integer
"""
def largestValues(self, root):
# write your code here
... | """
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
"""
@param root: a root of integer
@return: return a list of integer
"""
def largest_values(self, root):
if root is None:
... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# This file is part of the jetson_stats package (https://github.com/rbonghi/jetson_stats or http://rnext.it).
# Copyright (c) 2020 Raffaello Bonghi.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Publi... | def jetpack_missing(repository, jetson, version):
l4t = jetson.board.info['L4T']
title = 'Jetpack missing [L4T {l4t}]'.format(l4t=l4t)
template = 'jetpack-missing.md'
body = 'Please update jetson-stats with new jetpack\n\n'
body += '**Linux for Tegra**\n'
body += ' - L4T: ' + l4t + '\n\n'
bo... |
#python code
#list of numbers
list=[1,3,14,5,19,66,2,53,105,10,24,27,6,5,85,34,56,3,2,35,78,2,3,98,43,2,1,56,8,43,22,12]
print("\n \nThe list of numbers to be fitered through:\n" + str(list) + "\n\n")
#get the user tp input minimum value
specifiedNumber = int(input("Please specify a minimum number: "))
#create a n... | list = [1, 3, 14, 5, 19, 66, 2, 53, 105, 10, 24, 27, 6, 5, 85, 34, 56, 3, 2, 35, 78, 2, 3, 98, 43, 2, 1, 56, 8, 43, 22, 12]
print('\n \nThe list of numbers to be fitered through:\n' + str(list) + '\n\n')
specified_number = int(input('Please specify a minimum number: '))
filtered_list = []
for x in list:
if x > spec... |
begin_unit
comment|'# Copyright 2011 Justin Santa Barbara'
nl|'\n'
comment|'# All Rights Reserved.'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may'
nl|'\n'
comment|'# not use this file except in compliance with the License. You may obtain'
nl|'\n'
co... | begin_unit
comment | '# Copyright 2011 Justin Santa Barbara'
nl | '\n'
comment | '# All Rights Reserved.'
nl | '\n'
comment | '#'
nl | '\n'
comment | '# Licensed under the Apache License, Version 2.0 (the "License"); you may'
nl | '\n'
comment | '# not use this file except in compliance with the License. You may ... |
class Song(object):
def __init__(self, lyrics):
#super(self, lyrics).__init__()
self.lyrics = lyrics
def sing_me_a_song():
for line in self.lyrics:
print(line)
hap = Song(["Happy birthday to you",
"I don't want to get sued",
"So I'll stop right there... | class Song(object):
def __init__(self, lyrics):
self.lyrics = lyrics
def sing_me_a_song():
for line in self.lyrics:
print(line)
hap = song(['Happy birthday to you', "I don't want to get sued", "So I'll stop right there"])
bulls_on_parade = song(['They rally around the family', 'Wit... |
def set_figure_for_paper(figure):
figure.xaxis.axis_label_text_font_size = "24pt"
figure.yaxis.axis_label_text_font_size = "24pt"
figure.legend.label_text_font_size = "22pt"
figure.xaxis.major_label_text_font_size = "18pt"
figure.yaxis.major_label_text_font_size = "18pt"
| def set_figure_for_paper(figure):
figure.xaxis.axis_label_text_font_size = '24pt'
figure.yaxis.axis_label_text_font_size = '24pt'
figure.legend.label_text_font_size = '22pt'
figure.xaxis.major_label_text_font_size = '18pt'
figure.yaxis.major_label_text_font_size = '18pt' |
MQTT_SUB_OPT_NO_LOCAL = 0x04
MQTT_SUB_OPT_RETAIN_AS_PUBLISHED = 0x08
MQTT_SUB_OPT_SEND_RETAIN_ALWAYS = 0x00
MQTT_SUB_OPT_SEND_RETAIN_NEW = 0x10
MQTT_SUB_OPT_SEND_RETAIN_NEVER = 0x20
| mqtt_sub_opt_no_local = 4
mqtt_sub_opt_retain_as_published = 8
mqtt_sub_opt_send_retain_always = 0
mqtt_sub_opt_send_retain_new = 16
mqtt_sub_opt_send_retain_never = 32 |
# buildifier: disable=module-docstring
# buildifier: disable=provider-params
ProtoInfo = provider()
def proto_library(**args):
pass
| proto_info = provider()
def proto_library(**args):
pass |
"""
[4/16/2014] Challenge #158 [Intermediate] Part 1 - The ASCII Architect
https://www.reddit.com/r/dailyprogrammer/comments/236va2/4162014_challenge_158_intermediate_part_1_the/
#Description
In the far future, demand for pre-manufactured housing, particularly in planets such as Mars, has risen very high. In
fact, th... | """
[4/16/2014] Challenge #158 [Intermediate] Part 1 - The ASCII Architect
https://www.reddit.com/r/dailyprogrammer/comments/236va2/4162014_challenge_158_intermediate_part_1_the/
#Description
In the far future, demand for pre-manufactured housing, particularly in planets such as Mars, has risen very high. In
fact, th... |
'''
+-----+ +------+
+--------+ B +---------+ D +---------+
| +-+---+ X+--+---+ |
| | XX | |
+--+--+ | XX | +-+--+
| A | | XX | | F |
+--+--+ | XX | ... | """
+-----+ +------+
+--------+ B +---------+ D +---------+
| +-+---+ X+--+---+ |
| | XX | |
+--+--+ | XX | +-+--+
| A | | XX | | F |
+--+--+ | XX | ... |
sol_space = {}
def foo(team_i, start, end):
global teams
global p_win
global sol_space
assert team_i >= start and team_i < end
num_teams = end - start
if num_teams == 1:
return 1
if (team_i, start, end) in sol_space:
return sol_space[(team_i, start, end)]
psum = 0
# team_i becomes champio... | sol_space = {}
def foo(team_i, start, end):
global teams
global p_win
global sol_space
assert team_i >= start and team_i < end
num_teams = end - start
if num_teams == 1:
return 1
if (team_i, start, end) in sol_space:
return sol_space[team_i, start, end]
psum = 0
if t... |
"""hxlm.core.io.hxl is an syntatic sugar for the fantastic libhxl-python
This file at the moment is an draft. But is on IO submodule because libhxl
package from the HXLStandard already is able to work to manipulate files from
remote sources. It _only_ does not write on remote sources alone.
See:
- https://github.com/... | """hxlm.core.io.hxl is an syntatic sugar for the fantastic libhxl-python
This file at the moment is an draft. But is on IO submodule because libhxl
package from the HXLStandard already is able to work to manipulate files from
remote sources. It _only_ does not write on remote sources alone.
See:
- https://github.com/... |
def solution(N, A):
result = [0]*N # The list to be returned
max_counter = 0 # The used value in previous max_counter command
current_max = 0 # The current maximum value of any counter
for command in A:
if 1 <= command <= N:
# increase(X) command
if max_counter > r... | def solution(N, A):
result = [0] * N
max_counter = 0
current_max = 0
for command in A:
if 1 <= command <= N:
if max_counter > result[command - 1]:
result[command - 1] = max_counter
result[command - 1] += 1
if current_max < result[command - 1]:
... |
'''
You can run it directly to see results.
'''
def rob2(nums):
# This problem is similar to Rober_I.
#
# However, for N houses,
# the 1st house and the Nth house
# can be robbed at the same time.
#
# So the tricky point is that this
# problem can be divided into two
# case... | """
You can run it directly to see results.
"""
def rob2(nums):
if len(nums) == 1:
return nums
res1 = [0, 0] + nums[:-1]
res2 = [0, 0] + nums[1:]
for i in range(2, len(res1)):
res1[i] = max(res1[i] + res1[i - 2], res1[i - 1])
for i in range(2, len(res2)):
res2[i] = max(r... |
# -*- coding: utf-8 -*-
def log(client, message):
# print(message)
out = "%d # %s (%d): \"%s\"" % (
message.chat.id,
message.from_user.username,
message.from_user.id,
message.text,
)
print(out)
| def log(client, message):
out = '%d # %s (%d): "%s"' % (message.chat.id, message.from_user.username, message.from_user.id, message.text)
print(out) |
#encoding: utf-8
def main():
print('hello, pyinstaller')
if __name__ == '__main__':
main()
| def main():
print('hello, pyinstaller')
if __name__ == '__main__':
main() |
string = "88be350-804b000-80489c3-f7f93d80-ffffffff-1-88bc160-f7fa1110-f7f93dc7-0-88bd180-3b-88be330-88be350-6f636970-7b465443-306c5f49-345f7435-6d5f6c6c-306d5f79-5f79336e-38343136-34356562-fff2007d-f7fceaf8-f7fa1440-df64fb00-1-0-f7e30ce9-f7fa20c0-f7f935c0-f7f93000-fff291c8-f7e2168d-f7f935c0-8048eca-fff291d4-0-f7fb5f0... | string = '88be350-804b000-80489c3-f7f93d80-ffffffff-1-88bc160-f7fa1110-f7f93dc7-0-88bd180-3b-88be330-88be350-6f636970-7b465443-306c5f49-345f7435-6d5f6c6c-306d5f79-5f79336e-38343136-34356562-fff2007d-f7fceaf8-f7fa1440-df64fb00-1-0-f7e30ce9-f7fa20c0-f7f935c0-f7f93000-fff291c8-f7e2168d-f7f935c0-8048eca-fff291d4-0-f7fb5f09... |
class Viewport:
def __init__(self, posx=0, posy=0):
self.posx = posx
self.posy = posy
class MessageLog:
def __init__(self, entity_id=0, message_log_change=False):
self.entity_id = entity_id
self.message_log_change = message_log_change
# ---------------------------------------... | class Viewport:
def __init__(self, posx=0, posy=0):
self.posx = posx
self.posy = posy
class Messagelog:
def __init__(self, entity_id=0, message_log_change=False):
self.entity_id = entity_id
self.message_log_change = message_log_change
class Scene:
def __init__(self, curr... |
'''
Description:
Given a function f(x, y) and a value z, return all positive integer pairs x and y where f(x,y) == z.
The function is constantly increasing, i.e.:
f(x, y) < f(x + 1, y)
f(x, y) < f(x, y + 1)
The function interface is defined like this:
interface CustomFunction {
public:
// Returns positive inte... | """
Description:
Given a function f(x, y) and a value z, return all positive integer pairs x and y where f(x,y) == z.
The function is constantly increasing, i.e.:
f(x, y) < f(x + 1, y)
f(x, y) < f(x, y + 1)
The function interface is defined like this:
interface CustomFunction {
public:
// Returns positive inte... |
class BaseError(Exception):
pass
class InvalidFormatError(BaseError):
pass
class InvalidPluginError(BaseError):
pass
class InvalidPageError(BaseError):
def __init__(self, pages):
super().__init__('Invalid page range: %i-%i' % pages)
| class Baseerror(Exception):
pass
class Invalidformaterror(BaseError):
pass
class Invalidpluginerror(BaseError):
pass
class Invalidpageerror(BaseError):
def __init__(self, pages):
super().__init__('Invalid page range: %i-%i' % pages) |
#
# PySNMP MIB module CISCO-LIVEDATA-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-LIVEDATA-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:47:36 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_union, constraints_intersection, value_range_constraint, value_size_constraint) ... |
Cortes = Goalkeeper('Francisco Cortes', 79, 74, 79, 69)
Enrique = Outfield_Player('Sergio Enrique', 'DF', 51, 79, 77, 73, 79, 69)
Alegre = Outfield_Player('David Alegre', 'MF', 75, 68, 75, 73, 74, 76)
Carrera = Outfield_Player('Jardi Carrera', 'MF', 71, 73, 76, 74, 79, 78)
Lleonart = Outfield_Player('Xavi Lleonart'... | cortes = goalkeeper('Francisco Cortes', 79, 74, 79, 69)
enrique = outfield__player('Sergio Enrique', 'DF', 51, 79, 77, 73, 79, 69)
alegre = outfield__player('David Alegre', 'MF', 75, 68, 75, 73, 74, 76)
carrera = outfield__player('Jardi Carrera', 'MF', 71, 73, 76, 74, 79, 78)
lleonart = outfield__player('Xavi Lleonart'... |
"""
Item 76: Verify Related Behaviors in TestCase SubClasses
This item required different files. Look for the following files in the Item76 folder:
utils.py
utils_test.py
assert_test.py
data_driven_test.py
You can create tests by subclasses the TestCase class from the unittest built-int module.
Define one method ... | """
Item 76: Verify Related Behaviors in TestCase SubClasses
This item required different files. Look for the following files in the Item76 folder:
utils.py
utils_test.py
assert_test.py
data_driven_test.py
You can create tests by subclasses the TestCase class from the unittest built-int module.
Define one method ... |
__author__ = 'author'
info = {
"title": "Cartoview Workforce Manager",
"description": "Cartoview app to manage project/work group tasks. It provides a full management of a task status, priority, location ,attachments, comments",
"author": 'Cartologic',
"home_page": 'http://cartoview.org/apps/cart... | __author__ = 'author'
info = {'title': 'Cartoview Workforce Manager', 'description': 'Cartoview app to manage project/work group tasks. It provides a full management of a task status, priority, location ,attachments, comments', 'author': 'Cartologic', 'home_page': 'http://cartoview.org/apps/cartoview_workforce_manager'... |
class Solution:
def main(self, n, k):
for i in range(1, k+1):
for j in range(0, n+1):
if i == 1:
dp[i][j] = 1
continue
for l in range(0, j+1):
dp[i][j] += dp[i-1][j-l] % 1000000000
... | class Solution:
def main(self, n, k):
for i in range(1, k + 1):
for j in range(0, n + 1):
if i == 1:
dp[i][j] = 1
continue
for l in range(0, j + 1):
dp[i][j] += dp[i - 1][j - l] % 1000000000
retu... |
class FakeLogger(object):
def debug(self, *argv, **kwargs): pass
def info(self, *argv, **kwargs): pass
def warn(self, *argv, **kwargs): pass
def error(self, *argv, **kwargs): pass
class FakeWorkerCommand(object):
def __init__(self):
self.commands = []
def __call__(self, *args):... | class Fakelogger(object):
def debug(self, *argv, **kwargs):
pass
def info(self, *argv, **kwargs):
pass
def warn(self, *argv, **kwargs):
pass
def error(self, *argv, **kwargs):
pass
class Fakeworkercommand(object):
def __init__(self):
self.commands = []
... |
def partition(x, left, right):
i = left - 1
point = x[right]
for j in range(left, right):
if x[j] < point:
i += 1
x[i], x[j] = x[j], x[i]
x[i + 1], x[right] = x[right], x[i + 1]
return i + 1
def quicksort(lst, left, right):
if left < right:
pi = partition(lst, left, right)
quic... | def partition(x, left, right):
i = left - 1
point = x[right]
for j in range(left, right):
if x[j] < point:
i += 1
(x[i], x[j]) = (x[j], x[i])
(x[i + 1], x[right]) = (x[right], x[i + 1])
return i + 1
def quicksort(lst, left, right):
if left < right:
pi = p... |
class Cities:
def __init__(self):
self._cities = ['New York', 'Newark', 'New Delhi', 'Newcastle']
def __len__(self):
return len(self._cities)
def __iter__(self) -> iter: # Calling the Iterator Protocol with its instance
print('Calling Cities instance __iter__' )
return ... | class Cities:
def __init__(self):
self._cities = ['New York', 'Newark', 'New Delhi', 'Newcastle']
def __len__(self):
return len(self._cities)
def __iter__(self) -> iter:
print('Calling Cities instance __iter__')
return city_iterator(self)
class Cityiterator:
def __in... |
def parse(data):
result=[]
temp=0
for i in data:
if i=="i":
temp+=1
elif i=="d":
temp-=1
elif i=="s":
temp=temp**2
elif i=="o":
result.append(temp)
return result | def parse(data):
result = []
temp = 0
for i in data:
if i == 'i':
temp += 1
elif i == 'd':
temp -= 1
elif i == 's':
temp = temp ** 2
elif i == 'o':
result.append(temp)
return result |
async def test_neo4j_smoke(neo4j):
data = await neo4j.data()
assert 'node' in data
| async def test_neo4j_smoke(neo4j):
data = await neo4j.data()
assert 'node' in data |
# Program showing some examples of lambda functions in python
double_number = lambda num: num*2
reverse_string = lambda string: string[::-1]
add_numbers = lambda x,y: x+y
print(double_number(5))
print(reverse_string("Hi, this is a test !"))
print(add_numbers(10, 23))
| double_number = lambda num: num * 2
reverse_string = lambda string: string[::-1]
add_numbers = lambda x, y: x + y
print(double_number(5))
print(reverse_string('Hi, this is a test !'))
print(add_numbers(10, 23)) |
#
# PySNMP MIB module Unisphere-Data-Router-CONF (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-Router-CONF
# Produced by pysmi-0.3.4 at Mon Apr 29 21:25:35 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version ... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_union, value_size_constraint, value_range_constraint, single_value_constraint) ... |
class StandardScaler:
def __init__(self):
self.mean = []
self.scale = []
self.scale_nonzero = []
def fit(self, features):
self.mean = features.mean(0)
self.scale = features.std(0)
self.scale_nonzero = self.scale != 0
def transform(self, features):
sc... | class Standardscaler:
def __init__(self):
self.mean = []
self.scale = []
self.scale_nonzero = []
def fit(self, features):
self.mean = features.mean(0)
self.scale = features.std(0)
self.scale_nonzero = self.scale != 0
def transform(self, features):
s... |
class Header:
filename = ""
filesize = 0
class MsgPacket:
username = ""
msg = ""
def parsear(com):
######### The structure of a command is: COMMAND PARAMETER1 PARAMETER2 [...] PARAMETER-N
######### The user can also use "" to simbolize that spaces are considered part of a parameter, like this: COMMAND PARAMETE... | class Header:
filename = ''
filesize = 0
class Msgpacket:
username = ''
msg = ''
def parsear(com):
com += ' '
acumulador = ''
palabras = []
onsameword = False
for caracter in com:
if caracter == '"':
onsameword = not onsameword
continue
if on... |
class DatenbankEinstellung(object):
def __init__(self):
self.name = ''
self.beschreibung = ''
self.wert = ''
self.typ = 'Text' #Text, Float, Int oder Bool
self.isUserAdded = True
def __eq__(self, other) :
if self.__class__ != other.__class__: return False
... | class Datenbankeinstellung(object):
def __init__(self):
self.name = ''
self.beschreibung = ''
self.wert = ''
self.typ = 'Text'
self.isUserAdded = True
def __eq__(self, other):
if self.__class__ != other.__class__:
return False
return self.__d... |
array = [9, 2, 3, 6]
result = 2
def find_minimum(arr):
min_value = arr[0]
for x in arr:
if x < min_value:
min_value = x
return min_value
def main():
print("Input: " + str(array))
print("Expected: " + str(result))
print("Output: " + str(find_minimum(array)))
if __name__... | array = [9, 2, 3, 6]
result = 2
def find_minimum(arr):
min_value = arr[0]
for x in arr:
if x < min_value:
min_value = x
return min_value
def main():
print('Input: ' + str(array))
print('Expected: ' + str(result))
print('Output: ' + str(find_minimum(array)))
if __name__ == '... |
'''Desenvolva um proframa que leia o comprimento de tres retas e diga
ao usuario se elas podem ou nao forma um triangulo'''
print("_-_"*20)
print("analisador de trinagulos")
print("_-_"*20)
comprimento1 = float(input("Digite um comprimento: "))
comprimento2 = float(input("Digite outro comprimento: "))
comprimento3 = ... | """Desenvolva um proframa que leia o comprimento de tres retas e diga
ao usuario se elas podem ou nao forma um triangulo"""
print('_-_' * 20)
print('analisador de trinagulos')
print('_-_' * 20)
comprimento1 = float(input('Digite um comprimento: '))
comprimento2 = float(input('Digite outro comprimento: '))
comprimento3 ... |
"""
Best Time to Buy and Sell Stock with Cooldown
Say you have an array for which the ith element is the price of a given stock on day i.
Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one and sell one share of the stock multiple times) with the following re... | """
Best Time to Buy and Sell Stock with Cooldown
Say you have an array for which the ith element is the price of a given stock on day i.
Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one and sell one share of the stock multiple times) with the following re... |
# some constants used for table naming
TABLE_PREFIX = "tbl_"
UNIFIED_PREFIX = "unified_"
ETSI_PREFIX = "etsi_"
ONEM2M_PREFIX = "onem2m_"
SHELVE_PREFIX = "shelve_"
SHELVE_KEYNAME = "shelve_key"
def create_table_name(table_name, type="default"):
if (type == "unified"):
return TABLE_PREFIX + UNIFIED_PREFIX... | table_prefix = 'tbl_'
unified_prefix = 'unified_'
etsi_prefix = 'etsi_'
onem2_m_prefix = 'onem2m_'
shelve_prefix = 'shelve_'
shelve_keyname = 'shelve_key'
def create_table_name(table_name, type='default'):
if type == 'unified':
return TABLE_PREFIX + UNIFIED_PREFIX + table_name
elif type == 'etsi':
... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 Edward Lau <elau1004@netscape.net>
# Licensed under the MIT License.
#
"""
The engine to orchestrate job executions.
The orchestration is define as DAG of collections notated using the following brackets:
[] - A list of jobs to be executed in sequence.
{} - A set ... | """
The engine to orchestrate job executions.
The orchestration is define as DAG of collections notated using the following brackets:
[] - A list of jobs to be executed in sequence.
{} - A set of jobs to be executed in parallel threads on a single CPU core.
() - A set of jobs to be executed in parallel ac... |
factors = {
1 :{
2: ("E" ,2) , 3: ("E" ,2) ,7: ("E" ,2) ,11: ("E" ,2) ,18: ("E" ,2) ,19: ("E" ,2) ,20: ("E" ,2) ,22: ("E" ,2) ,
1:("E",1), 6:("E",1) , 21:("E",1) , 23:("E",1), 24:("E",1) , 25:("E",1) ,
15: ("E",0) ,
12: ("I",2), 13: ("I",2), 17: ("I",2),
5: ("I",1), 8: (... | factors = {1: {2: ('E', 2), 3: ('E', 2), 7: ('E', 2), 11: ('E', 2), 18: ('E', 2), 19: ('E', 2), 20: ('E', 2), 22: ('E', 2), 1: ('E', 1), 6: ('E', 1), 21: ('E', 1), 23: ('E', 1), 24: ('E', 1), 25: ('E', 1), 15: ('E', 0), 12: ('I', 2), 13: ('I', 2), 17: ('I', 2), 5: ('I', 1), 8: ('I', 1), 14: ('I', 1), 16: ('I', 1), 4: (... |
class RequestsHolder:
def __init__(self):
self.requests = []
def __len__(self):
return len(self.requests)
def pop(self):
return self.requests.pop()
def push(self, request):
self.requests.append(request)
| class Requestsholder:
def __init__(self):
self.requests = []
def __len__(self):
return len(self.requests)
def pop(self):
return self.requests.pop()
def push(self, request):
self.requests.append(request) |
class EnvWrapper(object):
def __init__(self, env):
self.env = env
def __getattr__(self, item):
return getattr(self.env, item)
| class Envwrapper(object):
def __init__(self, env):
self.env = env
def __getattr__(self, item):
return getattr(self.env, item) |
class Calc:
def __init__(self, mensagem):
self.mensagem = mensagem
def soma(num1, num2):
return num1 + num2
def mult(num1, num2):
return num1 * num2
def sub(num1, num2):
return num1 - num2
def div(num1, num2):
return num1 / num2
def mensagem_designP(s... | class Calc:
def __init__(self, mensagem):
self.mensagem = mensagem
def soma(num1, num2):
return num1 + num2
def mult(num1, num2):
return num1 * num2
def sub(num1, num2):
return num1 - num2
def div(num1, num2):
return num1 / num2
def mensagem_design_p... |
#
l_numbers = [list(range(1, 101))]
#
r_numbers = range(1, 101)
#
t_key_numbers = (
(1, "one"),
(2, "Two"),
(3, "Three"),
(4, "Four"),
(5, "Five"),
(6, "Six"),
(7, "Seven"),
(8, "Eight"),
(9, "Nine"),
(10, "Ten"),
(11, "Eleven"),
(12, "Twelve"),
(13, "Thirteen"),
... | l_numbers = [list(range(1, 101))]
r_numbers = range(1, 101)
t_key_numbers = ((1, 'one'), (2, 'Two'), (3, 'Three'), (4, 'Four'), (5, 'Five'), (6, 'Six'), (7, 'Seven'), (8, 'Eight'), (9, 'Nine'), (10, 'Ten'), (11, 'Eleven'), (12, 'Twelve'), (13, 'Thirteen'), (14, 'Fourteen'), (15, 'Fifteen'), (16, 'Sixteen'))
t_key_value... |
def decode_test(session, decode_op, network, dataset, label_type, rate=1.0):
"""Visualize label outputs.
Args:
session: session of training model
decode_op: operation for decoding
network: network to evaluate
dataset: Dataset class
label_type: original or phone1 or phone2... | def decode_test(session, decode_op, network, dataset, label_type, rate=1.0):
"""Visualize label outputs.
Args:
session: session of training model
decode_op: operation for decoding
network: network to evaluate
dataset: Dataset class
label_type: original or phone1 or phone2... |
# Copyright (C) 2017-2019 New York University,
# University at Buffalo,
# Illinois Institute of Technology.
#
# 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 th... | """Objects representing chart view resources at the wen service API."""
class Dataseries(object):
"""Data series in a chart view. Each series has a name and a list of
values.
"""
def __init__(self, name, values):
"""Initialize the data series components.
Parameters
----------
... |
# standards.py
"""
setting standards for the pipeline
"""
def get_img_xycenter(img, center_mode='n/2'):
"""
use the convention of alignshift to define img center.
If nx, ny are even, the center is on [nx/2., ny/2.]
Otherwise if odd, the center is on [(nx-1)/2.,(ny-1)/2.]
Params
--------
i... | """
setting standards for the pipeline
"""
def get_img_xycenter(img, center_mode='n/2'):
"""
use the convention of alignshift to define img center.
If nx, ny are even, the center is on [nx/2., ny/2.]
Otherwise if odd, the center is on [(nx-1)/2.,(ny-1)/2.]
Params
--------
img: np 2d array
... |
"""
You will be given a 2D matrix of English lower case letters.
Your mission today is to find the longest path that following these rules below.
The path can only be straight line or form a 90 degree corner;
In each step, the next letter must be different from the current letter;
The path cannot cut itself or form a ... | """
You will be given a 2D matrix of English lower case letters.
Your mission today is to find the longest path that following these rules below.
The path can only be straight line or form a 90 degree corner;
In each step, the next letter must be different from the current letter;
The path cannot cut itself or form a ... |
# minimal configuration, just to be able to run django-admin and create migrations
SECRET_KEY = 'please-dont-use-this-settings-file'
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.co... | secret_key = 'please-dont-use-this-settings-file'
installed_apps = ('django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'djmercadopago')
middleware_classes = ('django.contrib.sessions.middleware.SessionMiddlewa... |
the_count = [1, 2, 3, 4, 5]
fruits = ['apples', 'oranges' , 'pears' ,'apricots']
change = [1, 'pennies', 2,'dimes',3 ,'quarters']
for number in the_count:
print("This is count %r" %number)
for fruit in fruits:
print("A fruit of type : %r "%fruit)
for i in change:
print("I got %r "%i)
elements = [ ]
... | the_count = [1, 2, 3, 4, 5]
fruits = ['apples', 'oranges', 'pears', 'apricots']
change = [1, 'pennies', 2, 'dimes', 3, 'quarters']
for number in the_count:
print('This is count %r' % number)
for fruit in fruits:
print('A fruit of type : %r ' % fruit)
for i in change:
print('I got %r ' % i)
elements = []
for... |
class Node:
def __init__(self, value):
self.value = value
self.right = None
self.left = None
class BinaryTree:
def __init__(self):
self.root = None
self.maxVal = 0
def pre_order(self):
output = []
def _walk(node):
output.append(node.val... | class Node:
def __init__(self, value):
self.value = value
self.right = None
self.left = None
class Binarytree:
def __init__(self):
self.root = None
self.maxVal = 0
def pre_order(self):
output = []
def _walk(node):
output.append(node.va... |
try:
name=input("Enter file name:")
file=open(fr"C:\Users\Frank\Desktop\GROUP-4\BSE-2021\src\files\{name}","r")
read=file.read()
print(read.upper())
except:
print("File name doesn't exist in current directory") | try:
name = input('Enter file name:')
file = open(f'C:\\Users\\Frank\\Desktop\\GROUP-4\\BSE-2021\\src\\files\\{name}', 'r')
read = file.read()
print(read.upper())
except:
print("File name doesn't exist in current directory") |
class Solution:
def multiply(self, num1: str, num2: str) -> str:
val1, val2 = 0, 0
for i in num1:
val1 = val1 * 10 + int(i)
for i in num2:
val2 = val2 * 10 + int(i)
return str(val1 * val2) | class Solution:
def multiply(self, num1: str, num2: str) -> str:
(val1, val2) = (0, 0)
for i in num1:
val1 = val1 * 10 + int(i)
for i in num2:
val2 = val2 * 10 + int(i)
return str(val1 * val2) |
'''
Week-1: While Exercise -1
In this problem you'll be given a chance to practice writing some while loops.
1. Convert the following into code that uses a while loop.
print 2
prints 4
prints 6
prints 8
prints 10
prints Goodbye!
'''
n = 2
while ( n >= 2 and n <=10):
print(n)
n += 2
print("Goodbye!")
'''
... | """
Week-1: While Exercise -1
In this problem you'll be given a chance to practice writing some while loops.
1. Convert the following into code that uses a while loop.
print 2
prints 4
prints 6
prints 8
prints 10
prints Goodbye!
"""
n = 2
while n >= 2 and n <= 10:
print(n)
n += 2
print('Goodbye!')
'\nWeek1: W... |
name = "John"
def func1():
print(name)
def greet(name: str) -> str:
return f'Hello, {name}'
def main():
name = 'Mike'
print(greet(name))
if __name__ == '__main__':
main()
| name = 'John'
def func1():
print(name)
def greet(name: str) -> str:
return f'Hello, {name}'
def main():
name = 'Mike'
print(greet(name))
if __name__ == '__main__':
main() |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Copyright 2020, Yutong Xie, UIUC.
Using recursion to delete node in BST
'''
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# se... | """
Copyright 2020, Yutong Xie, UIUC.
Using recursion to delete node in BST
"""
class Solution(object):
def successor(self, root):
root = root.right
while root.left:
root = root.left
return root
def predecessor(self, root):
root = root.left
while r... |
def pytest_addoption(parser):
parser.addoption("--epics", action="store", required=True,
help="The target pysmurf server's epics prefix")
parser.addoption("--config", action="store",
default="/usr/local/src/pysmurf/cfg_files/stanford/"
"exp... | def pytest_addoption(parser):
parser.addoption('--epics', action='store', required=True, help="The target pysmurf server's epics prefix")
parser.addoption('--config', action='store', default='/usr/local/src/pysmurf/cfg_files/stanford/experiment_fp30_cc02-03_lbOnlyBay0.cfg', help='Path to the pysmurf configurati... |
""" Maintain context: short term memory about conversation history and the state of the chatbot's world """
class Context(dict):
pass
| """ Maintain context: short term memory about conversation history and the state of the chatbot's world """
class Context(dict):
pass |
class Reader:
def __init__(self, filename):
self.filename = filename
self.data = []
#Case where we are using 8x8
if "8" in self.filename:
with open(self.filename) as f:
for line in f:
digits = line.split(",")
temp_dict = {"data": [int(i) for i in digits[:-1]], "answer": int(digits[-1:][0].st... | class Reader:
def __init__(self, filename):
self.filename = filename
self.data = []
if '8' in self.filename:
with open(self.filename) as f:
for line in f:
digits = line.split(',')
temp_dict = {'data': [int(i) for i in digit... |
#
# PySNMP MIB module CX-IPX-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CX-IPX-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:32:02 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, constraints_union, constraints_intersection, value_range_constraint) ... |
# coding=utf-8
# *** WARNING: this file was generated by crd2pulumi. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
SNAKE_TO_CAMEL_CASE_TABLE = {
"additional_annotations": "additionalAnnotations",
"additional_labels": "additionalLabels",
"admission_controller": "admiss... | snake_to_camel_case_table = {'additional_annotations': 'additionalAnnotations', 'additional_labels': 'additionalLabels', 'admission_controller': 'admissionController', 'allow_privilege_escalation': 'allowPrivilegeEscalation', 'api_key': 'apiKey', 'api_key_existing_secret': 'apiKeyExistingSecret', 'api_secret': 'apiSecr... |
#
# PySNMP MIB module WRS-MASTER-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WRS-MASTER-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:23:44 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, constraints_intersection, constraints_union, value_range_constraint) ... |
# PROBLEM LINK:- https://leetcode.com/problems/two-sum/
class Solution:
def twoSum(self, v, x):
n = len(v)
r = []
for i in range(0,n):
for j in range(i+1,n):
if(i != j and v[i] + v[j] == x):
r.append(i)
r.append(j)
... | class Solution:
def two_sum(self, v, x):
n = len(v)
r = []
for i in range(0, n):
for j in range(i + 1, n):
if i != j and v[i] + v[j] == x:
r.append(i)
r.append(j)
return r |
class BenchmarkOperatorError(Exception):
""" Base class for all benchmark operator error classes.
All exceptions raised by the benchmark runner library should inherit from this class. """
pass
class ODFNonInstalled(BenchmarkOperatorError):
"""
This class is error that ODF operator is not inst... | class Benchmarkoperatorerror(Exception):
""" Base class for all benchmark operator error classes.
All exceptions raised by the benchmark runner library should inherit from this class. """
pass
class Odfnoninstalled(BenchmarkOperatorError):
"""
This class is error that ODF operator is not instal... |
'''
My initial solution
not very fast and uses quite a bit of memory
will look over to try and improve
'''
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
... | """
My initial solution
not very fast and uses quite a bit of memory
will look over to try and improve
"""
class Solution:
def min_depth(self, root) -> int:
ans = []
if root is None:
return 0
self.findMinDepth(root, 1, ans)
return min(ans)
def find_min_depth(self... |
"""
LeetCode 655. Print Binary Tree
Print a binary tree in an m*n 2D string array following these rules:
The row number m should be equal to the height of the given binary tree.
The column number n should always be an odd number.
The root node's value (in string format) should be put in the exactly middle of the firs... | """
LeetCode 655. Print Binary Tree
Print a binary tree in an m*n 2D string array following these rules:
The row number m should be equal to the height of the given binary tree.
The column number n should always be an odd number.
The root node's value (in string format) should be put in the exactly middle of the firs... |
"""packer_builder/specs/builders/common.py"""
# pylint: disable=line-too-long
def common_builder(**kwargs):
"""Common builder specs."""
# Setup vars from kwargs
build_dir = kwargs['data']['build_dir']
builder_spec = kwargs['data']['builder_spec']
distro = kwargs['data']['distro']
builder_sp... | """packer_builder/specs/builders/common.py"""
def common_builder(**kwargs):
"""Common builder specs."""
build_dir = kwargs['data']['build_dir']
builder_spec = kwargs['data']['builder_spec']
distro = kwargs['data']['distro']
builder_spec.update({'cpus': '{{ user `cpus` }}', 'disk_size': '{{ user `di... |
class Factor(object):
def __init__(self, o, f=1.0):
self.o = o
self.f = f
def __repr__(self):
return "Factor()"
def get_distance(self, point):
return self.f * self.o.get_distance(point)
def get_distance_numpy(self, x, y, z):
return self.f * self.o.get_d... | class Factor(object):
def __init__(self, o, f=1.0):
self.o = o
self.f = f
def __repr__(self):
return 'Factor()'
def get_distance(self, point):
return self.f * self.o.get_distance(point)
def get_distance_numpy(self, x, y, z):
return self.f * self.o.get_distance... |
#
# PySNMP MIB module RFC1233-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RFC1233-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:56:30 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 0... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, single_value_constraint, value_size_constraint, constraints_union, constraints_intersection) ... |
"""
Copyright Government of Canada 2018
Written by: Matthew Fogel, National Microbiology Laboratory, Public Health Agency of Canada
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this work except in compliance with the License. You may obtain a copy of the
License at:
http://www.apac... | """
Copyright Government of Canada 2018
Written by: Matthew Fogel, National Microbiology Laboratory, Public Health Agency of Canada
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this work except in compliance with the License. You may obtain a copy of the
License at:
http://www.apac... |
# The isBadVersion API is already defined for you.
# @param version, an integer
# @return a bool
def isBadVersion(version):
pass
class Solution(object):
def firstBadVersion(self, n):
"""
:type n: int
:rtype: int
"""
start = 1
end = n
while start<=end:
... | def is_bad_version(version):
pass
class Solution(object):
def first_bad_version(self, n):
"""
:type n: int
:rtype: int
"""
start = 1
end = n
while start <= end:
mid = (start + end) // 2
if is_bad_version(mid):
end ... |
"""
2.3 - Write a function to delete middle node of a LL
"""
# definition of ListNode
class ListNode():
def __init__(self, val):
self.val = val
self.next = None
# original question is somewhat misphrased
# you just have to delete the provided node
def deleteNode(n: ListNode):
if n == No... | """
2.3 - Write a function to delete middle node of a LL
"""
class Listnode:
def __init__(self, val):
self.val = val
self.next = None
def delete_node(n: ListNode):
if n == None and n.next == None:
return False
tmp = n.next
n.val = tmp.val
n.next = tmp.next
return T... |
config_DTP = {
"lr": 6.185037324617764e-05,
"target_stepsize": 0.21951187497378802,
"beta1": 0.9,
"beta2": 0.999,
"epsilon": 1.0170111936290766e-08,
"lr_fb": 0.0019584756448113774,
"sigma": 0.08372453893037193,
"beta1_fb": 0.9,
"beta2_fb": 0.999,
"epsilon_fb": 7.541132645747324e-... | config_dtp = {'lr': 6.185037324617764e-05, 'target_stepsize': 0.21951187497378802, 'beta1': 0.9, 'beta2': 0.999, 'epsilon': 1.0170111936290766e-08, 'lr_fb': 0.0019584756448113774, 'sigma': 0.08372453893037193, 'beta1_fb': 0.9, 'beta2_fb': 0.999, 'epsilon_fb': 7.541132645747324e-06, 'out_dir': 'logs/mnist/DTP', 'network... |
l, arr, moves = int(input()), [int(x) for x in input().split()], 0
for i in range(1, l):
while arr[i] < arr[i-1]:
arr[i] += 1
moves += 1
print(moves)
| (l, arr, moves) = (int(input()), [int(x) for x in input().split()], 0)
for i in range(1, l):
while arr[i] < arr[i - 1]:
arr[i] += 1
moves += 1
print(moves) |
class Restaurante:
def __init__ (self, nombre, tipo, number_served):
self.nombre = nombre
self.tipo = tipo
self.number_served = 0
def describe_restaurant(self):
print(self.nombre.title() + self.tipo.title())
def set_number_served(self):
print(self.number_served.title())
def increment_number_served... | class Restaurante:
def __init__(self, nombre, tipo, number_served):
self.nombre = nombre
self.tipo = tipo
self.number_served = 0
def describe_restaurant(self):
print(self.nombre.title() + self.tipo.title())
def set_number_served(self):
print(self.number_served.titl... |
project = 'Daydream'
label = project + ' Documentation'
copyright = '2020, Remo'
author = 'Remo'
# The short X.Y version
version = '0.1'
# The full version, including alpha/beta/rc tags
release = '0.1 alpha'
# -- General configuration ---------------------------------------------------
extensions = []
templates_pat... | project = 'Daydream'
label = project + ' Documentation'
copyright = '2020, Remo'
author = 'Remo'
version = '0.1'
release = '0.1 alpha'
extensions = []
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
language = None
exclude_patterns = ['_build']
pygments_style = None
html_theme = 'alabaster'
... |
# Do not edit this file directly.
# It was auto-generated by: code/programs/reflexivity/reflexive_refresh
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def gflags():
http_archive(
name="gflags" ,
sha256="ed82ef64389409e378fc6ae55b8b60f11a0b4bbb7e004d5ef9e791f40af19a6e" ,
... | load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
def gflags():
http_archive(name='gflags', sha256='ed82ef64389409e378fc6ae55b8b60f11a0b4bbb7e004d5ef9e791f40af19a6e', strip_prefix='gflags-f7388c6655e699f777a5a74a3c9880b9cfaabe59', urls=['https://github.com/Unilang/gflags/archive/f7388c6655e699f7... |
#
# PySNMP MIB module Fore-Redundancy-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Fore-Redundancy-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:17:22 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_union, value_range_constraint, single_value_constraint, value_size_constraint) ... |
x=[10,20,30,40,50,60,70,80,90,100]
num=0
p=0
sum=0
print('Enter positions to add no.s')
p= int(input())
p= p+1
while num<p:
sum=x[num]+sum
num=num+1
print(sum) | x = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
num = 0
p = 0
sum = 0
print('Enter positions to add no.s')
p = int(input())
p = p + 1
while num < p:
sum = x[num] + sum
num = num + 1
print(sum) |
class ModelConfig:
"""
ModelConfig is a utility class that stores important configuration option about our model
"""
def __init__(self, model, name, input_img_dimensions, conv_layers_config, fc_output_dims, output_classes, dropout_keep_pct):
self.model = model
self.name = name
s... | class Modelconfig:
"""
ModelConfig is a utility class that stores important configuration option about our model
"""
def __init__(self, model, name, input_img_dimensions, conv_layers_config, fc_output_dims, output_classes, dropout_keep_pct):
self.model = model
self.name = name
s... |
#!/usr/bin/env python3
# display a welcome message
print("The Miles Per Gallon application")
print()
another_trip = "y"
while another_trip == "y":
# get input from the user
miles_driven = float(input("Enter miles driven: "))
gallons_used = float(input("Enter gallons of gas used: "))
cost_pe... | print('The Miles Per Gallon application')
print()
another_trip = 'y'
while another_trip == 'y':
miles_driven = float(input('Enter miles driven: '))
gallons_used = float(input('Enter gallons of gas used: '))
cost_per_gallon = float(input('Enter cost per gallon: '))
if miles_driven <= 0:
... |
"""Mocks
"""
def decode_token(self, token):
"""Decode a token emitted by Kisee"""
return {
"iss": "example.com",
"sub": "toto",
"exp": 1534173723,
"jti": "j2CMReXSUwcnvPfhqq7cSg",
}
def decode_token__new_user(self, token):
"""Decode a token emitted by Kisee
with a... | """Mocks
"""
def decode_token(self, token):
"""Decode a token emitted by Kisee"""
return {'iss': 'example.com', 'sub': 'toto', 'exp': 1534173723, 'jti': 'j2CMReXSUwcnvPfhqq7cSg'}
def decode_token__new_user(self, token):
"""Decode a token emitted by Kisee
with a user who does not exist in database
... |
# Aidan O'Connor - G00364756 - 22/02/2018
# Exercise 4, Topic 4: euler5.py
# Each new term in the Fibonacci sequence is generated,
# by adding the previous two terms.
# By starting with 1 and 2, the first 10 terms will be:
# 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
# By considering the terms in the Fibonacci sequen... | def fib(n):
"""This function returns the nth Fibonacci number."""
i = 0
j = 1
b = 0
while i <= 4000000:
(i, j) = (j, i + j)
if i % 2 == 0:
b = b + i
return b
print(fib(1)) |
# Class based on employee - separating to check decorators
class Player:
def __init__(self, first, last):
self.first = first
self.last = last
def email(self):
return '{}.{}@email.com'.format(self.first, self.last)
@property
def fullname(self):
return '{} {}'.format(se... | class Player:
def __init__(self, first, last):
self.first = first
self.last = last
def email(self):
return '{}.{}@email.com'.format(self.first, self.last)
@property
def fullname(self):
return '{} {}'.format(self.first, self.last)
@fullname.setter
def fullname(... |
n = int(input().strip())
a = list(map(int, input().strip().split(' ')))
swaps = 0
for i in range(n):
for j in range(n - 1):
if(a[j] > a[j + 1]):
a[j], a[j + 1] = a[j + 1], a[j]
swaps += 1
print('Array is sorted in {} swaps.'.format(swaps))
print('First Element: {}'.format(a.pop(0))... | n = int(input().strip())
a = list(map(int, input().strip().split(' ')))
swaps = 0
for i in range(n):
for j in range(n - 1):
if a[j] > a[j + 1]:
(a[j], a[j + 1]) = (a[j + 1], a[j])
swaps += 1
print('Array is sorted in {} swaps.'.format(swaps))
print('First Element: {}'.format(a.pop(0)... |
problems = input().split(";")
count = 0
for problem in problems:
if "-" in problem:
split_problem = problem.split("-")
count += int(split_problem[1]) - int(split_problem[0]) + 1
else:
count += 1
print(count)
| problems = input().split(';')
count = 0
for problem in problems:
if '-' in problem:
split_problem = problem.split('-')
count += int(split_problem[1]) - int(split_problem[0]) + 1
else:
count += 1
print(count) |
class Solution:
def widthOfBinaryTree(self, root):
"""
:type root: TreeNode
:rtype: int
"""
if not root:
return 0
queue = [(root, 1)]
left, right, size, max_width = 0, 0, 1, 1
while len(queue) > 0:
node = queue[0]
qu... | class Solution:
def width_of_binary_tree(self, root):
"""
:type root: TreeNode
:rtype: int
"""
if not root:
return 0
queue = [(root, 1)]
(left, right, size, max_width) = (0, 0, 1, 1)
while len(queue) > 0:
node = queue[0]
... |
def isFib(x):
a=0
b=1
if x==a:
return True
if x==b:
return True
n=2
while(b<x):
t=a+b
a=b
b=t
#print(b)
n += 1
if x == b:
return True
return False
for i in range(0,20):
print(i,isFib(i)) | def is_fib(x):
a = 0
b = 1
if x == a:
return True
if x == b:
return True
n = 2
while b < x:
t = a + b
a = b
b = t
n += 1
if x == b:
return True
return False
for i in range(0, 20):
print(i, is_fib(i)) |
# -*- coding: utf-8 -*-
"""Base utils for all Bandicoot related utilities."""
fields = {
"interaction": 0,
"direction": 1,
"country_code": 2,
"correspondent_id": 3,
"datetime": 4,
"call_duration": 5,
"antenna_id": 6,
"longitude": 7,
"latitude": 8,
"location_level_1": 9,
"loc... | """Base utils for all Bandicoot related utilities."""
fields = {'interaction': 0, 'direction': 1, 'country_code': 2, 'correspondent_id': 3, 'datetime': 4, 'call_duration': 5, 'antenna_id': 6, 'longitude': 7, 'latitude': 8, 'location_level_1': 9, 'location_level_2': 10} |
#
# PySNMP MIB module DNOS-METRO-DOT1AG-PRIVATE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DNOS-METRO-DOT1AG-PRIVATE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:51:46 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ve... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, single_value_constraint, constraints_union, constraints_intersection, value_size_constraint) ... |
class Person:
def __init__(self, name: str):
self.name = name
self.partner = None
def __str__(self):
return self.name
def marry(self, spouce): #: Person):
self.partner = spouce
spouce.partner = self
class Student(Person):
def __init__(self, name, ID: int):
self.name = name
self.ID = ID
| class Person:
def __init__(self, name: str):
self.name = name
self.partner = None
def __str__(self):
return self.name
def marry(self, spouce):
self.partner = spouce
spouce.partner = self
class Student(Person):
def __init__(self, name, ID: int):
self.n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.