content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
def settiffy(number_list):
number_list.sort()
empty_list = []
for number in number_list:
empty_list.append(number)
return empty_list
print(settify([1,2,3,3,4,4,5,5,6,6])) | def settiffy(number_list):
number_list.sort()
empty_list = []
for number in number_list:
empty_list.append(number)
return empty_list
print(settify([1, 2, 3, 3, 4, 4, 5, 5, 6, 6])) |
class Observation(object):
def __init__(self, observable, observer_method):
self.observable = observable
self.observer_method = observer_method
def stop_observing(self):
self.observable.stop_observing(self.observer_method)
class Observable(object):
def __init__(self):
self.... | class Observation(object):
def __init__(self, observable, observer_method):
self.observable = observable
self.observer_method = observer_method
def stop_observing(self):
self.observable.stop_observing(self.observer_method)
class Observable(object):
def __init__(self):
sel... |
# -*- coding: utf-8 -*-
class IHandler:
async def handle(self, request, response):
raise NotImplementedError()
#TODO
#def __setattr__(self, attr, value):
# raise AttributeError("Property<{}.{}> is read only".format(type(self).__name__, attr))
| class Ihandler:
async def handle(self, request, response):
raise not_implemented_error() |
db.define_table(
'avatar',
Field(
'image',
'string',
length = 100,
requires = IS_IN_SET(
[
'img/avatar.png',
'img/avatar2.png',
'img/avatar3.png',
'img/avatar4.png',
'img/avatar5.png',
... | db.define_table('avatar', field('image', 'string', length=100, requires=is_in_set(['img/avatar.png', 'img/avatar2.png', 'img/avatar3.png', 'img/avatar4.png', 'img/avatar5.png'])), field('auth_user', 'reference auth_user', label=t('User')), auth.signature, singular='Avatar', plural='Avatars', format='%(avatar)s') |
# Floyd - Warshall algorithm for all-pairs shortest-path problem
# prints out "NULL" when negative cycle is found, and "shortest shortest path"
n = 1001
g = [[[], []] for _ in range(n)]
with open('g1.txt', 'r') as doc:
for line in doc:
line = list(map(int, line.split()))
if g[line[0]][0] and line[... | n = 1001
g = [[[], []] for _ in range(n)]
with open('g1.txt', 'r') as doc:
for line in doc:
line = list(map(int, line.split()))
if g[line[0]][0] and line[1] == g[line[0]][0][-1]:
if line[2] < g[line[0]][1][-1]:
g[line[0]][0][-1] = line[1]
g[line[0]][1][-1]... |
a = 100
b = 200
d = 300
wawawawaawa
| a = 100
b = 200
d = 300
wawawawaawa |
class Solution:
def my_atoi(self, s: str) -> int:
result = 0
power = 1
digits = []
signal = 1
i = 0
n = len(s)
while i < n:
if s[i] == ' ':
i += 1
elif s[i] == '-':
signal = -1
i += 1
... | class Solution:
def my_atoi(self, s: str) -> int:
result = 0
power = 1
digits = []
signal = 1
i = 0
n = len(s)
while i < n:
if s[i] == ' ':
i += 1
elif s[i] == '-':
signal = -1
i += 1
... |
# -*- coding: utf-8 -*-
def isListEmpty(inList):
if isinstance(inList, list): # Is a list
return all(map(isListEmpty, inList))
return False # Not a list
| def is_list_empty(inList):
if isinstance(inList, list):
return all(map(isListEmpty, inList))
return False |
class Solution:
def smallestRepunitDivByK(self, k: int) -> int:
remainder = 0
for length_N in range(1, k+1):
remainder = (remainder * 10 + 1) % k
if remainder == 0:
return length_N
return -1 | class Solution:
def smallest_repunit_div_by_k(self, k: int) -> int:
remainder = 0
for length_n in range(1, k + 1):
remainder = (remainder * 10 + 1) % k
if remainder == 0:
return length_N
return -1 |
# Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.
# Notice that the solution set must not contain duplicate triplets.
# Example 1:
# Input: nums = [-1,0,1,2,-1,-4]
# Output: [[-1,-1,2],[-1,0,1]]
# Example ... | class Solution:
def three_sum(self, nums: List[int]) -> List[List[int]]:
if len(nums) < 3:
return []
nums.sort()
res = []
for i in range(len(nums) - 2):
if i > 0 and nums[i] == nums[i - 1]:
continue
(l, r) = (i + 1, len(nums) - 1)
... |
__all__ = [
'SubpackageClass'
]
class SubpackageClass:
pass
| __all__ = ['SubpackageClass']
class Subpackageclass:
pass |
n_cards = 25
_ = input()
deck1 = [int(input()) for _ in range(n_cards)]
_ = input()
_ = input()
deck2 = [int(input()) for _ in range(n_cards)]
while deck1 and deck2:
if deck1[0] > deck2[0]:
deck1 += [deck1[0], deck2[0]]
else:
deck2 += [deck2[0], deck1[0]]
del deck1[0]
del deck2[0]
wi... | n_cards = 25
_ = input()
deck1 = [int(input()) for _ in range(n_cards)]
_ = input()
_ = input()
deck2 = [int(input()) for _ in range(n_cards)]
while deck1 and deck2:
if deck1[0] > deck2[0]:
deck1 += [deck1[0], deck2[0]]
else:
deck2 += [deck2[0], deck1[0]]
del deck1[0]
del deck2[0]
winner... |
valores = [int(input()) for i in [1, 2, 3, 4, 5]]
relatorio = {
'par': 0,
'impar': 0,
'positivo': 0,
'negativo': 0
}
for valor in valores:
if valor % 2 == 0:
relatorio['par'] = relatorio['par'] + 1
else:
relatorio['impar'] = relatorio['impar'] + 1
if valor > 0:
relatorio['positivo'] = relatorio['positivo... | valores = [int(input()) for i in [1, 2, 3, 4, 5]]
relatorio = {'par': 0, 'impar': 0, 'positivo': 0, 'negativo': 0}
for valor in valores:
if valor % 2 == 0:
relatorio['par'] = relatorio['par'] + 1
else:
relatorio['impar'] = relatorio['impar'] + 1
if valor > 0:
relatorio['positivo'] = ... |
class Node:
def __init__(self, value=None, next=None):
self.value = value
self.next = next
class Stack:
def __init__(self, node=None):
self.top = node
def push(self, value):
node = Node(value)
node.next = self.top
self.top = node
return self
de... | class Node:
def __init__(self, value=None, next=None):
self.value = value
self.next = next
class Stack:
def __init__(self, node=None):
self.top = node
def push(self, value):
node = node(value)
node.next = self.top
self.top = node
return self
d... |
i = 0 # Assigning a value to a Variable
print("BASICS OF PYTHON | GITHUB/NARCOTIC | LESSON-001") # Print to Screen
print() # Print an Empty Line
x = int(input("Enter x Value : ")) ... | i = 0
print('BASICS OF PYTHON | GITHUB/NARCOTIC | LESSON-001')
print()
x = int(input('Enter x Value : '))
y = int(input('Enter y Value : '))
common_factor = int(input('Enter Common Factor : '))
name = input('Enter Your Name : ')
sum_xy = x + y
dif_xy = x - y
product_xy = x * y
division_xy = x / y
print()
print('Hello '... |
class SubController:
def show(self):
return 'test' | class Subcontroller:
def show(self):
return 'test' |
#!/usr/bin/env python
# encoding: utf-8
def run(whatweb, pluginname):
whatweb.recog_from_content(pluginname, "seeyon/USER-DATA/")
| def run(whatweb, pluginname):
whatweb.recog_from_content(pluginname, 'seeyon/USER-DATA/') |
# 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 ( n ) :
p = 1
if ( n and not ( n & ( n - 1 ) ) ) :
return n
while ( p < n ) :
p <<= 1
... | def f_gold(n):
p = 1
if n and (not n & n - 1):
return n
while p < n:
p <<= 1
return p
if __name__ == '__main__':
param = [(8,), (79,), (31,), (63,), (18,), (2,), (6,), (85,), (29,), (8,)]
n_success = 0
for (i, parameters_set) in enumerate(param):
if f_filled(*paramete... |
class GitRepo():
def __init__(self, repo):
self.repo = repo
def is_empty(self):
return self.repo.bare
def is_untracked(self):
return len(self.repo.untracked_files) > 0
def is_modified(self):
return len(self.repo.index.diff(None)) > 0
def is_uncommitted(self):
... | class Gitrepo:
def __init__(self, repo):
self.repo = repo
def is_empty(self):
return self.repo.bare
def is_untracked(self):
return len(self.repo.untracked_files) > 0
def is_modified(self):
return len(self.repo.index.diff(None)) > 0
def is_uncommitted(self):
... |
for i in range(1, 11):
print(' i= {}'.format(i))
for x in range(1, 6):
for y in range(1, 11):
print(f'{x} X {y} = {x*y}')
| for i in range(1, 11):
print(' i= {}'.format(i))
for x in range(1, 6):
for y in range(1, 11):
print(f'{x} X {y} = {x * y}') |
class BinarySearchTreeNode:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def add_child(self, data):
if data == self.data:
return # node already exist
if data < self.data:
if self.left:
self.left.ad... | class Binarysearchtreenode:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def add_child(self, data):
if data == self.data:
return
if data < self.data:
if self.left:
self.left.add_child(data)
... |
class BirthDateColumn(object):
def __init__(self):
self.label = "birth_date"
self.is_ref = True
| class Birthdatecolumn(object):
def __init__(self):
self.label = 'birth_date'
self.is_ref = True |
pts = [
(17.047000, 14.099000, 3.625000),
(16.967000, 12.784000, 4.338000),
(15.685000, 12.755000, 5.133000),
(15.268000, 13.825000, 5.594000),
(18.170000, 12.703000, 5.337000),
(19.334000, 12.829000, 4.463000),
(18.150000, 11.546000, 6.304000),
(15.115000, 11.555000, 5.265000),
(13.... | pts = [(17.047, 14.099, 3.625), (16.967, 12.784, 4.338), (15.685, 12.755, 5.133), (15.268, 13.825, 5.594), (18.17, 12.703, 5.337), (19.334, 12.829, 4.463), (18.15, 11.546, 6.304), (15.115, 11.555, 5.265), (13.856, 11.469, 6.066), (14.164, 10.785, 7.379), (14.993, 9.862, 7.443), (12.732, 10.711, 5.261), (13.308, 9.439, ... |
# dataset settings
_base_ = '../faster_rcnn//faster_rcnn_x101_64x4d_fpn_1x_coco.py'
dataset_type = 'MyDataset'
data_root = './datasets/'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
albu_train_transforms = [
dict(
type='ShiftScaleRotate',
shift_... | _base_ = '../faster_rcnn//faster_rcnn_x101_64x4d_fpn_1x_coco.py'
dataset_type = 'MyDataset'
data_root = './datasets/'
img_norm_cfg = dict(mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
albu_train_transforms = [dict(type='ShiftScaleRotate', shift_limit=0.0625, scale_limit=0.1, rotate_limit=90,... |
transition_table = [ [0]*3 for _ in range(20) ]
re = input("Enter the regular expression : ")
re += " "
i = 0
j = 1
N = len(re)
while (i<N):
if re[i] == 'a':
try:
if re[i + 1] not in ['|', '*']:
transition_table[j][0] = j+1
j += 1
elif re[i+1] == '|' a... | transition_table = [[0] * 3 for _ in range(20)]
re = input('Enter the regular expression : ')
re += ' '
i = 0
j = 1
n = len(re)
while i < N:
if re[i] == 'a':
try:
if re[i + 1] not in ['|', '*']:
transition_table[j][0] = j + 1
j += 1
elif re[i + 1] == '... |
# This program calculates the distance a car can travel without refueling #
# after obtaining data on the tank size and distance travelled per litre #
print("Welcome to 'How far can you go without losing hope?', version 1.0")
print("Please input the following parameters so estimate the distance")
print("your car can t... | print("Welcome to 'How far can you go without losing hope?', version 1.0")
print('Please input the following parameters so estimate the distance')
print('your car can travel with a known quantity of fuel: ')
print("Your tank's capacity in litres: ", end=' ')
capacity = float(input())
print('The distance travelled in km... |
V1 = '1'
V2 = '2'
V3 = '3'
V4 = '4'
V5 = '5'
V6 = '6'
V7 = '7'
V8 = '8'
KNOWN_LEGACY_VERSIONS = {V1, V2, V3, V4, V5, V6}
# TODO: it *may* be a bug for V6 to be included in `KNOWN_USER_VERSIONS`
KNOWN_USER_VERSIONS = {V6, V7, V8}
LATEST_VERSION = V8
LAST_NO_USER_CONFIG_VERSION = V6
FIRST_USER_CONFIG_VERSION = V7
| v1 = '1'
v2 = '2'
v3 = '3'
v4 = '4'
v5 = '5'
v6 = '6'
v7 = '7'
v8 = '8'
known_legacy_versions = {V1, V2, V3, V4, V5, V6}
known_user_versions = {V6, V7, V8}
latest_version = V8
last_no_user_config_version = V6
first_user_config_version = V7 |
{
"targets": [
{
"target_name": "module",
"product_extension": "node",
"include_dirs" : [ "src" ],
"conditions": [
['OS=="win"', {
'cflags': [
'/EHa',
],
},],
],
"sources": [
"src/module.cc"
]
}
]
} | {'targets': [{'target_name': 'module', 'product_extension': 'node', 'include_dirs': ['src'], 'conditions': [['OS=="win"', {'cflags': ['/EHa']}]], 'sources': ['src/module.cc']}]} |
'''
https://leetcode.com/contest/weekly-contest-169/problems/verbal-arithmetic-puzzle/
Bruteforce algorithm using backtracing
Potential ways to prune:
- most significant positions won't have 0 digit assigned
- ones position digits can be used for early pruning
- similar to above higher position digits can be used for... | """
https://leetcode.com/contest/weekly-contest-169/problems/verbal-arithmetic-puzzle/
Bruteforce algorithm using backtracing
Potential ways to prune:
- most significant positions won't have 0 digit assigned
- ones position digits can be used for early pruning
- similar to above higher position digits can be used for... |
def sol():
print(ord(input()))
if __name__ == "__main__":
sol()
| def sol():
print(ord(input()))
if __name__ == '__main__':
sol() |
#!/usr/bin/python3.6
# created by cicek on 08.09.2018 18:06
'''
Data Hiding
A key part of object-oriented programming is encapsulation, which involves packaging of related variables and functions into a single easy-to-use object - an instance of a class.
A related concept is data hiding, which states that implementat... | """
Data Hiding
A key part of object-oriented programming is encapsulation, which involves packaging of related variables and functions into a single easy-to-use object - an instance of a class.
A related concept is data hiding, which states that implementation details of a class should be hidden, and a clean standard... |
LIST1 = "test_list_1"
LIST2 = "test_list_2"
VAL1 = "val1"
VAL2 = "val2"
VAL3 = "val3"
VAL4 = "val4"
LPOP_SCRIPT = "return redis.call('LPOP', KEYS[1])"
| list1 = 'test_list_1'
list2 = 'test_list_2'
val1 = 'val1'
val2 = 'val2'
val3 = 'val3'
val4 = 'val4'
lpop_script = "return redis.call('LPOP', KEYS[1])" |
###############################################################################
#
# Do this WITH YOUR INSTRUCTOR (live in class):
#
# Read the code below. Predict (in your head)
# what will get printed (i.e., displayed) when the code runs.
#
# Then run this module by right clicking anywhere in this window
# ... | print('Hello, Brackin')
print('hi there')
print('one', 'two', 'buckle my shoe')
print(3 + 9)
print('3 + 9', 'versus', 3 + 9) |
self.description = "dir->file change during package upgrade (directory conflict)"
lp1 = pmpkg("pkg1")
lp1.files = ["dir/"]
self.addpkg2db("local", lp1)
lp2 = pmpkg("pkg2")
lp2.files = ["dir/"]
self.addpkg2db("local", lp2)
p = pmpkg("pkg1", "1.0-2")
p.files = ["dir"]
self.addpkg2db("sync", p)
self.args = "-S pkg1"
... | self.description = 'dir->file change during package upgrade (directory conflict)'
lp1 = pmpkg('pkg1')
lp1.files = ['dir/']
self.addpkg2db('local', lp1)
lp2 = pmpkg('pkg2')
lp2.files = ['dir/']
self.addpkg2db('local', lp2)
p = pmpkg('pkg1', '1.0-2')
p.files = ['dir']
self.addpkg2db('sync', p)
self.args = '-S pkg1'
self.... |
#
# Complete the 'diagonalDifference' function below.
#
# The function is expected to return an INTEGER.
# The function accepts 2D_INTEGER_ARRAY arr as parameter.
#
def diagonalDifference(arr):
N = int(input())
total = 0
for i in range(N):
row = input().split()
total += int(row[i])-int(row[... | def diagonal_difference(arr):
n = int(input())
total = 0
for i in range(N):
row = input().split()
total += int(row[i]) - int(row[-(i + 1)])
return abs(total) |
# region headers
# escript-template v20190605 / stephane.bourdeaud@nutanix.com
# * author: stephane.bourdeaud@nutanix.com, lukasz@nutanix.com
# * version: 20190606
# task_name: PeAddVmToPd
# description: Adds the virtual machine provisioned by Calm to the specified
# protection domain.
# endregio... | username = '@@{pe.username}@@'
username_secret = '@@{pe.secret}@@'
nutanix_cluster_ip = '@@{nutanix_cluster_ip}@@'
vm_uuid = '@@{vm_uuid}@@'
protection_domain_name = '@@{protection_domain_name}@@'
api_server = nutanix_cluster_ip
api_server_port = '9440'
api_server_endpoint = '/PrismGateway/services/rest/v2.0/protection... |
li = int(input())
op = str(input())
m = []
for i in range(12):
l = []
for j in range(12):
l.append(float(input()))
m.append(l)
s = sum(m[li])
if op == 'S': print('{:.1f}'.format(s))
else: print('{:.1f}'.format(s / 12))
| li = int(input())
op = str(input())
m = []
for i in range(12):
l = []
for j in range(12):
l.append(float(input()))
m.append(l)
s = sum(m[li])
if op == 'S':
print('{:.1f}'.format(s))
else:
print('{:.1f}'.format(s / 12)) |
def encrypt(ciphertext, s):
pltext = ""
for i in range(len(ciphertext)):
char = ciphertext[i]
if (char.isupper()):
pltext += chr((ord(char) + s-65) % 26 + 65)
else:
pltext += chr((ord(char) + s - 97) % 26 + 97)
return pltext
print("Enter Plain ... | def encrypt(ciphertext, s):
pltext = ''
for i in range(len(ciphertext)):
char = ciphertext[i]
if char.isupper():
pltext += chr((ord(char) + s - 65) % 26 + 65)
else:
pltext += chr((ord(char) + s - 97) % 26 + 97)
return pltext
print('Enter Plain text : ', end=''... |
class WordlistBase:
def __init__(self, mod):
self._mod = mod
def __getitem__(self, n):
if isinstance(n, slice):
(start, stop, step) = (n.start or 0, n.stop if n.stop is not None else len(self), n.step or 1)
if start < 0:
start += len(self)
if ... | class Wordlistbase:
def __init__(self, mod):
self._mod = mod
def __getitem__(self, n):
if isinstance(n, slice):
(start, stop, step) = (n.start or 0, n.stop if n.stop is not None else len(self), n.step or 1)
if start < 0:
start += len(self)
if... |
def gstreamer_pipeline(
capture_width=1280,
capture_height=720,
display_width=1280,
display_height=720,
framerate=60,
flip_method=0,
):
return (
"nvarguscamerasrc ! "
"video/x-raw(memory:NVMM), "
"width=(int)%d, height=(int)%d, "
"format=(string)NV12, framerat... | def gstreamer_pipeline(capture_width=1280, capture_height=720, display_width=1280, display_height=720, framerate=60, flip_method=0):
return 'nvarguscamerasrc ! video/x-raw(memory:NVMM), width=(int)%d, height=(int)%d, format=(string)NV12, framerate=(fraction)%d/1 ! nvvidconv flip-method=%d ! video/x-raw, width=(int)... |
# Use words.txt as the file name
fname = input("Enter file name: ")
fh = open(fname)
x = fh.read()
x = x.rstrip()
print(x.upper())
| fname = input('Enter file name: ')
fh = open(fname)
x = fh.read()
x = x.rstrip()
print(x.upper()) |
# -*- coding: utf-8 -*-
__author__ = 'Elliot Marsden'
__email__ = 'elliot.marsden@gmail.com'
__version__ = '0.2.0'
| __author__ = 'Elliot Marsden'
__email__ = 'elliot.marsden@gmail.com'
__version__ = '0.2.0' |
class Node:
def __init__(self,data):
self.data = data
self.next = None
class Solution:
def insert(self,head,data):
p = Node(data)
if head==None:
head=p
elif head.next==None:
head.next=p
else:
... | class Node:
def __init__(self, data):
self.data = data
self.next = None
class Solution:
def insert(self, head, data):
p = node(data)
if head == None:
head = p
elif head.next == None:
head.next = p
else:
start = head
... |
num_tests = int(input())
for test in range(num_tests):
num_chars = int(input())
ch_map = {}
for i in range(num_chars):
line = input().split()
ch, w = line[0], int(line[1])
ch_map[ch] = w
num_lines = int(input())
total = 0
for i in range(num_lines):
line = str(input())
total += su... | num_tests = int(input())
for test in range(num_tests):
num_chars = int(input())
ch_map = {}
for i in range(num_chars):
line = input().split()
(ch, w) = (line[0], int(line[1]))
ch_map[ch] = w
num_lines = int(input())
total = 0
for i in range(num_lines):
line = str(... |
__author__ = 'surya'
## colors
COLORS =['snow', 'ghost white', 'white smoke', 'gainsboro', 'floral white', 'old lace',
'linen', 'antique white', 'papaya whip', 'blanched almond', 'bisque', 'peach puff',
'navajo white', 'lemon chiffon', 'mint cream', 'azure', 'alice blue', 'lavender',
'lavender blush', 'mi... | __author__ = 'surya'
colors = ['snow', 'ghost white', 'white smoke', 'gainsboro', 'floral white', 'old lace', 'linen', 'antique white', 'papaya whip', 'blanched almond', 'bisque', 'peach puff', 'navajo white', 'lemon chiffon', 'mint cream', 'azure', 'alice blue', 'lavender', 'lavender blush', 'misty rose', 'dark slate ... |
# -*- coding: utf-8 -*-
while True:
d, n = map(str, input().split())
if d == "0" and n == "0":
break
vStr = n.replace(d, "")
if vStr == "":
vStr = "0"
print(int(vStr)) | while True:
(d, n) = map(str, input().split())
if d == '0' and n == '0':
break
v_str = n.replace(d, '')
if vStr == '':
v_str = '0'
print(int(vStr)) |
# https://leetcode.com/problems/pascals-triangle-ii
class Solution:
def getRow(self, rowIndex):
if rowIndex == 0:
return [1]
res = [1]
for i in range(1, rowIndex + 1):
item = (res[-1] * (rowIndex - i + 1)) // i
res.append(item)
return res
| class Solution:
def get_row(self, rowIndex):
if rowIndex == 0:
return [1]
res = [1]
for i in range(1, rowIndex + 1):
item = res[-1] * (rowIndex - i + 1) // i
res.append(item)
return res |
MANDATORY_DIRECTORIES = [
'controllers',
'models',
'views',
]
OPTIONAL_DIRECTORIES = [
'static',
'static/css',
'static/js',
'static/images',
]
REQUIREMENTS = [
'cherrypy',
'jinja2',
'sqlalchemy',
]
NEW_CREATE_FILES = [
{
'template_name': 'gitignore',
'd... | mandatory_directories = ['controllers', 'models', 'views']
optional_directories = ['static', 'static/css', 'static/js', 'static/images']
requirements = ['cherrypy', 'jinja2', 'sqlalchemy']
new_create_files = [{'template_name': 'gitignore', 'destination': '.gitignore', 'skip_format': True}, {'template_name': 'site_confi... |
def load(h):
return ({'abbr': 0, 'code': 0, 'title': 'Rhumb'},
{'abbr': 1, 'code': 1, 'title': 'Great circle'},
{'abbr': None, 'code': 255, 'title': 'Missing'})
| def load(h):
return ({'abbr': 0, 'code': 0, 'title': 'Rhumb'}, {'abbr': 1, 'code': 1, 'title': 'Great circle'}, {'abbr': None, 'code': 255, 'title': 'Missing'}) |
class Value:
def __init__(self, foo_bar):
self.foo_bar = foo_bar
def get_foo_bar(self):
return self.foo_bar
@staticmethod
def decode(data):
f_foo_bar = data["fooBar"]
if not isinstance(f_foo_bar, unicode):
raise Exception("not a string")
return Value(f_foo_bar)
def encode(self):... | class Value:
def __init__(self, foo_bar):
self.foo_bar = foo_bar
def get_foo_bar(self):
return self.foo_bar
@staticmethod
def decode(data):
f_foo_bar = data['fooBar']
if not isinstance(f_foo_bar, unicode):
raise exception('not a string')
return valu... |
class TraceMoeError(Exception):
def __init__(self, message:str) -> None:
self.message = message
class InvalidURL(TraceMoeError):
pass
class Ratelimited(TraceMoeError):
pass
class ConcurrencyOrRatelimit(TraceMoeError):
pass
class InvalidAPIKey(TraceMoeError):
pass | class Tracemoeerror(Exception):
def __init__(self, message: str) -> None:
self.message = message
class Invalidurl(TraceMoeError):
pass
class Ratelimited(TraceMoeError):
pass
class Concurrencyorratelimit(TraceMoeError):
pass
class Invalidapikey(TraceMoeError):
pass |
SCREEN_WIDTH = 240
SCREEN_HEIGHT = 180
CLICK_DIST = 3
CLICK_TIME = 10
| screen_width = 240
screen_height = 180
click_dist = 3
click_time = 10 |
class Test:
def __init__(self):
pass
def test_foo(self):
assert 1 == 1 | class Test:
def __init__(self):
pass
def test_foo(self):
assert 1 == 1 |
class Drug:
def __init__(self, name, xrefs):
self.name = name
self.xrefs = set(xrefs)
def merge(self, other):
# TODO: name
self.xrefs.update(other.xrefs)
def __eq__(self, other):
if not isinstance(other, type(self)):
return NotImplemented
return ... | class Drug:
def __init__(self, name, xrefs):
self.name = name
self.xrefs = set(xrefs)
def merge(self, other):
self.xrefs.update(other.xrefs)
def __eq__(self, other):
if not isinstance(other, type(self)):
return NotImplemented
return any([x in other.xref... |
class Registry(object):
def __init__(self, name):
self._name = name
self._module_dict = dict()
@property
def name(self):
return self._name
@property
def module_dict(self):
return self._module_dict
def _register_module(self, module_class):
module_name = ... | class Registry(object):
def __init__(self, name):
self._name = name
self._module_dict = dict()
@property
def name(self):
return self._name
@property
def module_dict(self):
return self._module_dict
def _register_module(self, module_class):
module_name =... |
class Persona:
def __init__(self, nombre="", edad=0, dni=""):
self.nombre = nombre
self.edad = edad
self.dni = dni
@property
def nombre(self):
return self.__nombre
@property
def edad(self):
return self.__edad
@property
def dni(self):
return ... | class Persona:
def __init__(self, nombre='', edad=0, dni=''):
self.nombre = nombre
self.edad = edad
self.dni = dni
@property
def nombre(self):
return self.__nombre
@property
def edad(self):
return self.__edad
@property
def dni(self):
return... |
REPOSITORY_LOCATIONS = dict(
boringssl = dict(
# Use commits from branch "chromium-stable-with-bazel"
commit = "ab36a84b91b3116bacc85973995504818748d8a9", # chromium-69.0.3497.81
remote = "https://github.com/google/boringssl",
),
com_google_absl = dict(
commit = "92e07e55907... | repository_locations = dict(boringssl=dict(commit='ab36a84b91b3116bacc85973995504818748d8a9', remote='https://github.com/google/boringssl'), com_google_absl=dict(commit='92e07e5590752d6b8e67f7f2f86c6286561e8cea', remote='https://github.com/abseil/abseil-cpp'), com_github_apache_thrift=dict(sha256='7d59ac4fdcb2c58037ebd... |
pcap_file = "lolwat.cap"
target_ssid = "lolwat"
pcap = rdpcap(pcap_file)
def filter_pcap(pcap, target_ssid):
filtered = []
target_ssid_bytes = bytes(target_ssid, 'utf-8')
for packet in pcap:
if packet.type == 0 and packet.subtype == 8:
if packet.info == target_ssid_bytes:
... | pcap_file = 'lolwat.cap'
target_ssid = 'lolwat'
pcap = rdpcap(pcap_file)
def filter_pcap(pcap, target_ssid):
filtered = []
target_ssid_bytes = bytes(target_ssid, 'utf-8')
for packet in pcap:
if packet.type == 0 and packet.subtype == 8:
if packet.info == target_ssid_bytes:
... |
## Using a Python dictionary to act as an adjacency list
graph = {
'A' : ['B','C'],
'B' : ['D', 'E'],
'C' : ['F'],
'D' : [],
'E' : ['F'],
'F' : []
}
visited = set() # Set to keep track of visited nodes.
def dfs(visited, graph, node):
if node not in visited:
print (node)
vis... | graph = {'A': ['B', 'C'], 'B': ['D', 'E'], 'C': ['F'], 'D': [], 'E': ['F'], 'F': []}
visited = set()
def dfs(visited, graph, node):
if node not in visited:
print(node)
visited.add(node)
for neighbour in graph[node]:
dfs(visited, graph, neighbour)
dfs(visited, graph, 'A') |
big_numbers = [
37107287533902102798797998220837590246510135740250,
46376937677490009712648124896970078050417018260538,
74324986199524741059474233309513058123726617309629,
91942213363574161572522430563301811072406154908250,
23067588207539346171171980310421047513778063246676,
89261670696623633820... | big_numbers = [37107287533902102798797998220837590246510135740250, 46376937677490009712648124896970078050417018260538, 74324986199524741059474233309513058123726617309629, 91942213363574161572522430563301811072406154908250, 23067588207539346171171980310421047513778063246676, 892616706966236338201363784183836841787343617... |
#
# PySNMP MIB module CISCO-DOCS-REMOTE-QUERY-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-DOCS-REMOTE-QUERY-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:38:11 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python versio... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, constraints_union, value_range_constraint, value_size_constraint) ... |
def old_example():
use_real_test_data = True
# TODO store data in df instead of dictionary
if use_real_test_data:
# load real test data
filename = 'sample_offres.csv'
pdt_info_dict = load_real_test_data(filename)
n_products = len(pdt_info_dict)
else:
# create ra... | def old_example():
use_real_test_data = True
if use_real_test_data:
filename = 'sample_offres.csv'
pdt_info_dict = load_real_test_data(filename)
n_products = len(pdt_info_dict)
else:
n_products = 100
pdt_info_dict = create_fake_test_data(n_products, n_meals, n_categor... |
# coding: utf8
# Copyright 2020 Vincent Jacques <vincent@vincent-jacques.net>
project = "Pyrraform"
author = '<a href="http://vincent-jacques.net/">Vincent Jacques</a>'
copyright = f'2020 {author}<script src="https://jacquev6.net/ribbon.2.js" data-project="{project}"></script>'
master_doc = "index"
extensions = []... | project = 'Pyrraform'
author = '<a href="http://vincent-jacques.net/">Vincent Jacques</a>'
copyright = f'2020 {author}<script src="https://jacquev6.net/ribbon.2.js" data-project="{project}"></script>'
master_doc = 'index'
extensions = []
nitpicky = True
html_sidebars = {'**': ['about.html', 'navigation.html', 'searchbo... |
if __name__ == '__main__':
m = int(input())
n = int(input())
print(m//n)
print(m%n)
print(divmod(m,n))
| if __name__ == '__main__':
m = int(input())
n = int(input())
print(m // n)
print(m % n)
print(divmod(m, n)) |
sum = 0
a = input('Enter starting digit: ')
b = input('Enter ending digit: ')
for i in range(a,b):
sum=(sum)+i
print("The sum of b/w ", a," to ", b ,"is: ",sum)
| sum = 0
a = input('Enter starting digit: ')
b = input('Enter ending digit: ')
for i in range(a, b):
sum = sum + i
print('The sum of b/w ', a, ' to ', b, 'is: ', sum) |
logging.info(" *** Step 4: Structure data ***".format())
#%%
# Instantiate and summarize
ds = DataStructure(df_all, target_col)
ds.train_test_summary()
ds.dtypes()
#%%
# Category counts
# ds.all_category_counts()
# ds.category_counts(target_col)
#%%
# Discard
# Select feature columns
logging.info("Feature selection".... | logging.info(' *** Step 4: Structure data ***'.format())
ds = data_structure(df_all, target_col)
ds.train_test_summary()
ds.dtypes()
logging.info('Feature selection'.format())
cols_to_discard = ['RescuerID', 'Description', 'Name']
ds.discard_features(cols_to_discard)
ds.dtypes()
mapping_encoder = ds.build_encoder()
ds.... |
# Insert the missing indentation to make the code correct:
if 5 > 2:
print("Five is greater than two!")
| if 5 > 2:
print('Five is greater than two!') |
mds_id_list = ['00-250068136', '00-250071518', '00-250102669', '00-250124842', '00-250071520', '00-250068182', '00-250071525', '06-25-0068185', '00-250071427', '01223192096-0001', '00-360000221', '00-450083432', '00-360000201', '01223187332-0001', '00-250068169', '00-250068178', '00-250059834', '00-250070991', '00-2500... | mds_id_list = ['00-250068136', '00-250071518', '00-250102669', '00-250124842', '00-250071520', '00-250068182', '00-250071525', '06-25-0068185', '00-250071427', '01223192096-0001', '00-360000221', '00-450083432', '00-360000201', '01223187332-0001', '00-250068169', '00-250068178', '00-250059834', '00-250070991', '00-2500... |
class GameRequestUI:
def __init__(self):
pass | class Gamerequestui:
def __init__(self):
pass |
# https://app.codesignal.com/arcade/intro/level-3/D6qmdBL2NYz49XHwM
def sortByHeight(heights):
# There's people in a park. Sort them by height and place them
# in between the trees in the park (marked by -1).
# First filter the people out from the trees and sort them.
people = sorted(filter(lambda x: x ... | def sort_by_height(heights):
people = sorted(filter(lambda x: x != -1, heights))
people_index = 0
for i in range(len(heights)):
if heights[i] != -1:
heights[i] = people[people_index]
people_index += 1
return heights |
str2 = 'Google'
print(str2)
print(str2[0:-1])
print(str2[0])
print(str2[2:5])
print(str2[2:])
print(str2 * 2)
print(str2 + "TEST")
print('Go\nole')
print(r'Go\nole')
word = 'Python'
print(word[0], word[5])
print(word[-1], word[-6])
| str2 = 'Google'
print(str2)
print(str2[0:-1])
print(str2[0])
print(str2[2:5])
print(str2[2:])
print(str2 * 2)
print(str2 + 'TEST')
print('Go\nole')
print('Go\\nole')
word = 'Python'
print(word[0], word[5])
print(word[-1], word[-6]) |
class Equipment:
id = 1
def __init__(self, name):
self.name = name
self.id = Equipment.id
Equipment.id += 1
def __repr__(self):
return f"Equipment <{self.id}> {self.name}"
@staticmethod
def get_next_id():
return Equipment.id | class Equipment:
id = 1
def __init__(self, name):
self.name = name
self.id = Equipment.id
Equipment.id += 1
def __repr__(self):
return f'Equipment <{self.id}> {self.name}'
@staticmethod
def get_next_id():
return Equipment.id |
#!/usr/bin/python
# Global variables defined here
# Author: Emmanuel Odeke <odeke@ualberta.ca>
# Copyright (c) 2014
#Http Request Methods
GET_KEY = "GET"
PUT_KEY = "PUT"
POST_KEY = "POST"
DELETE_KEY = "DELETE"
#Element attribute keys
ID_KEY = "id"
STATUS_KEY = "status"
LAST_EDIT_TIME_KEY = "lastEditTime"
DATE_CREATED... | get_key = 'GET'
put_key = 'PUT'
post_key = 'POST'
delete_key = 'DELETE'
id_key = 'id'
status_key = 'status'
last_edit_time_key = 'lastEditTime'
date_created_key = 'dateCreated'
data_key = 'data'
target_table_key = 'targetTable'
numerical_div_attr = '__div__'
format_number_attr = 'format_number'
sort_key = 'sort'
limit_... |
pkgname = "lua5.4"
pkgver = "5.4.4"
pkgrel = 0
build_style = "makefile"
make_build_target = "linux-readline"
make_check_target = "test"
make_use_env = True
hostmakedepends = ["pkgconf"]
makedepends = ["libedit-devel"]
pkgdesc = "Lua scripting language 5.4.x"
maintainer = "q66 <q66@chimera-linux.org>"
license = "MIT"
ur... | pkgname = 'lua5.4'
pkgver = '5.4.4'
pkgrel = 0
build_style = 'makefile'
make_build_target = 'linux-readline'
make_check_target = 'test'
make_use_env = True
hostmakedepends = ['pkgconf']
makedepends = ['libedit-devel']
pkgdesc = 'Lua scripting language 5.4.x'
maintainer = 'q66 <q66@chimera-linux.org>'
license = 'MIT'
ur... |
# Challenge 02 - Lesson 04
print('Tell me your date of birth')
day = input('What is the day? ')
month = input('Which month? ')
year = input('And the year? ')
print('You were born on day', day, 'of month', month, 'of', year, 'correct?')
| print('Tell me your date of birth')
day = input('What is the day? ')
month = input('Which month? ')
year = input('And the year? ')
print('You were born on day', day, 'of month', month, 'of', year, 'correct?') |
__all__ = ["CorpusForTest"]
class CorpusForTest:
def __init__(self, lower_split=False):
def preproc(text):
if lower_split:
return text.lower().split()
else:
return text
# BLEU Paper examples
self.cand_1 = preproc("the the the the the... | __all__ = ['CorpusForTest']
class Corpusfortest:
def __init__(self, lower_split=False):
def preproc(text):
if lower_split:
return text.lower().split()
else:
return text
self.cand_1 = preproc('the the the the the the the')
self.ref_1a... |
def get_robot_data():
with open('robot.dat') as f:
robot_data = f.readlines()
numDOF = int(robot_data[0].strip())
lengths = map(int, robot_data[1].strip().split(' '))
numObst = int(robot_data[2].strip())
obstacles = []
for i in range(numObst):
start_point = map(int, robot_data[3+2*i].strip().split(' '))
... | def get_robot_data():
with open('robot.dat') as f:
robot_data = f.readlines()
num_dof = int(robot_data[0].strip())
lengths = map(int, robot_data[1].strip().split(' '))
num_obst = int(robot_data[2].strip())
obstacles = []
for i in range(numObst):
start_point = map(int, robot_data[... |
class JsonUtils:
@staticmethod
def json_obj_to_array(res):
arr = []
for key in res:
arr.append(res[key])
return arr
@staticmethod
def array_to_json_array(res):
arr = []
for record in res:
j = dict()
j['name'] = record[0]
... | class Jsonutils:
@staticmethod
def json_obj_to_array(res):
arr = []
for key in res:
arr.append(res[key])
return arr
@staticmethod
def array_to_json_array(res):
arr = []
for record in res:
j = dict()
j['name'] = record[0]
... |
description = 'setup for the status monitor'
group = 'special'
_expcolumn = Column(
Block('Experiment', [
BlockRow(Field(name='Current status', key='exp/action', width=40,
istext=True, maxlen=40),
Field(name='Last scan', key='exp/lastscan'),
),
... | description = 'setup for the status monitor'
group = 'special'
_expcolumn = column(block('Experiment', [block_row(field(name='Current status', key='exp/action', width=40, istext=True, maxlen=40), field(name='Last scan', key='exp/lastscan'))]))
_firstcolumn = column(block('Beam', [block_row(field(name='Power', dev='Reac... |
server_address = "port80.se.quakenet.org"
server_port = 6667
nick = "CHANGEME"
username = "CHANGEME"
realname = "CHANGEME"
| server_address = 'port80.se.quakenet.org'
server_port = 6667
nick = 'CHANGEME'
username = 'CHANGEME'
realname = 'CHANGEME' |
# 1.
x = 5
y = 10
if 2 * x > 10:
print("Question 1 works!")
else:
print("oooo needs some work")
# 2.
x = 5
y = 10
if len("Dog") < x:
print("Question 2 works!")
else:
print("Still missing out")
# 3.
x = 2
y = 5
if (x ** 3 >= y) and (y ** 2 < 26):
print("GOT QUESTION 3!")
else:
print("Oh good y... | x = 5
y = 10
if 2 * x > 10:
print('Question 1 works!')
else:
print('oooo needs some work')
x = 5
y = 10
if len('Dog') < x:
print('Question 2 works!')
else:
print('Still missing out')
x = 2
y = 5
if x ** 3 >= y and y ** 2 < 26:
print('GOT QUESTION 3!')
else:
print('Oh good you can count')
name = ... |
class Clacks:
custom_events = None # This is dictionary of custom events
alive = None
clock = None
def __init__(self):
self.custom_events = {
"MESSAGE":None,
"RESUME": None
}
self.alive = True | class Clacks:
custom_events = None
alive = None
clock = None
def __init__(self):
self.custom_events = {'MESSAGE': None, 'RESUME': None}
self.alive = True |
def product(a,b):
return a*b
k=product(10,20)
print("Product is ",k)
| def product(a, b):
return a * b
k = product(10, 20)
print('Product is ', k) |
#number1 = input(" Celsiuouis elcius value: ")
#stat = float(33.8)
# Using arithmetic + Operator to add two numbers
#far = float(number1) * float(stat)
#print('The sum of {0} and {1} is {1}'.format(number1, far))
#100 *180/100+32
# a = float(23)
#rate = float(input("Rate: "))
a = float (input("Enter the no for... | a = float(input('Enter the no for conversion'))
b = float(180)
c = float(100)
d = float(32)
result = a * (b / c) + d
print('{}'.format(result)) |
def is_integer(n):
try:
float(n)
except ValueError:
return False
else:
return float(n).is_integer() | def is_integer(n):
try:
float(n)
except ValueError:
return False
else:
return float(n).is_integer() |
class World(object):
def __init__(self, width, height):
self.width = width
self.height = height
def getNeighbours(self, point):
return []
class DonutWorld(World):
def __init__(self, width, height):
super().__init__(width, height)
def getNeighbours(self, point):
... | class World(object):
def __init__(self, width, height):
self.width = width
self.height = height
def get_neighbours(self, point):
return []
class Donutworld(World):
def __init__(self, width, height):
super().__init__(width, height)
def get_neighbours(self, point):
... |
description = 'Virtual monochromator devices'
group = 'lowlevel'
devices = dict(
mth = device('nicos.devices.generic.Axis',
description = 'Monochromator Theta',
motor = device('nicos.devices.generic.VirtualMotor',
unit = 'deg',
abslimits = (5, 175),
speed = 0.5,... | description = 'Virtual monochromator devices'
group = 'lowlevel'
devices = dict(mth=device('nicos.devices.generic.Axis', description='Monochromator Theta', motor=device('nicos.devices.generic.VirtualMotor', unit='deg', abslimits=(5, 175), speed=0.5), precision=0.011, maxtries=10), mtt=device('nicos.devices.generic.Axis... |
GOOD_BLOCKS = [".", " "]
BAD_BLOCKS = ["="]
ENEMY_BLOCKS = ["F"]
class Pacman:
def __init__(self, game_map, output_map, pacman_position, move, block):
self.game_map = game_map
self.output_map = output_map
self.pacman_position = pacman_position
self.move = move
self.block = ... | good_blocks = ['.', ' ']
bad_blocks = ['=']
enemy_blocks = ['F']
class Pacman:
def __init__(self, game_map, output_map, pacman_position, move, block):
self.game_map = game_map
self.output_map = output_map
self.pacman_position = pacman_position
self.move = move
self.block = ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#**
#
#########
# trape #
#########
#
# trape depends of this file
# For full copyright information this visit: https://github.com/jofpin/trape
#
# Copyright 2018 by Jose Pino (@jofpin) / <jofpin@gmail.com>
#**
class victim(object):
def __init__(self, vId, ip, device, b... | class Victim(object):
def __init__(self, vId, ip, device, browser, version, ports, cpu, date):
self.vId = vId
self.ip = ip
self.device = device
self.browser = browser
self.version = version
self.ports = ports
self.cpu = cpu
self.date = date
class Vic... |
'''
Created on 9 May 2018
@author: igoroya
'''
def capitalize_letters(sentence, letters_in_word):
'''
Converts the first N letters of each word of a sentence to upper case
Input parameters:
sentence - original sentence
letters_in_word - the number of 1st letters in each word
... | """
Created on 9 May 2018
@author: igoroya
"""
def capitalize_letters(sentence, letters_in_word):
"""
Converts the first N letters of each word of a sentence to upper case
Input parameters:
sentence - original sentence
letters_in_word - the number of 1st letters in each word
... |
M = 9999
base_variables = ['x12', 'x13', 'x14', 'x15', 'x21', 'x23', 'x24', 'x25', 'x31', 'x32', 'x34', 'x35', 'x41', 'x42', 'x43', 'x45', 'x51', 'x52', 'x53', 'x54', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f10', 'f11', 'f12', 'f13', 'f14', 'f15', 'f16', 'f17', 'f18', 'f19', 'f20', 'f21', 'f22', 'f23', ... | m = 9999
base_variables = ['x12', 'x13', 'x14', 'x15', 'x21', 'x23', 'x24', 'x25', 'x31', 'x32', 'x34', 'x35', 'x41', 'x42', 'x43', 'x45', 'x51', 'x52', 'x53', 'x54', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f10', 'f11', 'f12', 'f13', 'f14', 'f15', 'f16', 'f17', 'f18', 'f19', 'f20', 'f21', 'f22', 'f23', '... |
#!/usr/bin/env python
# coding=utf-8
#
# Copyright 2016 Mirantis Inc.
# All Rights Reserved.
# Author: Georgy Okrokvertskhov
#
# 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
#
# ... | name_for = {6: 'TASK_STAGING', 0: 'TASK_STARTING', 1: 'TASK_RUNNING', 2: 'TASK_FINISHED', 3: 'TASK_FAILED', 4: 'TASK_KILLED', 5: 'TASK_LOST', 7: 'TASK_ERROR'} |
class Command:
def __init__(self,player):
player = player.get();
print(f"you are at {player['location']}")
def canTravel() :
if player['city'] == 1:
return True
if canTravel :
w = input("Do you want to travel to next world ?\n")
if w == "yes" :
playe... | class Command:
def __init__(self, player):
player = player.get()
print(f"you are at {player['location']}")
def can_travel():
if player['city'] == 1:
return True
if canTravel:
w = input('Do you want to travel to next world ?\n')
if... |
class Animal:
def speak(self):
print("Animal Speaking")
class Dog(Animal):
def bark(self):
print("dog barking")#inheritance
class DogChild(Dog):
def eating(self):
print("Eating meat")#multilevel inheritance
d = DogChild()
d.eating()
d.speak()
d.bark() | class Animal:
def speak(self):
print('Animal Speaking')
class Dog(Animal):
def bark(self):
print('dog barking')
class Dogchild(Dog):
def eating(self):
print('Eating meat')
d = dog_child()
d.eating()
d.speak()
d.bark() |
# Copyright 2015 The Crashpad Authors. 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 applicabl... | {'includes': ['../build/crashpad.gypi'], 'targets': [{'target_name': 'crashpad_test', 'type': 'static_library', 'dependencies': ['../compat/compat.gyp:crashpad_compat', '../third_party/gtest/gtest.gyp:gtest', '../third_party/mini_chromium/mini_chromium.gyp:base', '../util/util.gyp:crashpad_util'], 'include_dirs': ['..'... |
# test try-else-finally statement
passed = 0
# base case
try:
print(1)
except:
passed = 0
print(2)
else:
print(3)
finally:
passed = 1
print(4)
# basic case that should skip else
try:
print(1)
raise Exception
passed = 0
except:
print(2)
else:
passed = 0
print(3)
finally:
... | passed = 0
try:
print(1)
except:
passed = 0
print(2)
else:
print(3)
finally:
passed = 1
print(4)
try:
print(1)
raise Exception
passed = 0
except:
print(2)
else:
passed = 0
print(3)
finally:
print(4)
try:
try:
print(1)
raise ValueError
passe... |
#
# PySNMP MIB module CISCO-UNIFIED-COMPUTING-HOSTIMG-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-UNIFIED-COMPUTING-HOSTIMG-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:59:45 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Usi... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, single_value_constraint, value_size_constraint, constraints_intersection) ... |
x = 9
y = 3
# arithmetic
print("Addition ", x + y)
print("Subtraction ", x - y)
print("Multiplication ", x * y)
print("Division ", x / y)
print("Modulus ", x%y)
print("Exponentiation ", x**y)
x = 9.191823
print("Floor division ", x // y)
# Assignment operators
x = 9
x += 3
print(x)
x = 9
x -= 3
print(x)
x *= 3
p... | x = 9
y = 3
print('Addition ', x + y)
print('Subtraction ', x - y)
print('Multiplication ', x * y)
print('Division ', x / y)
print('Modulus ', x % y)
print('Exponentiation ', x ** y)
x = 9.191823
print('Floor division ', x // y)
x = 9
x += 3
print(x)
x = 9
x -= 3
print(x)
x *= 3
print(x)
x /= 3
print(x)
x **= 3
print(x... |
class Script:
@staticmethod
def main():
b = 6
print(str(b))
print(str(500))
Script.main() | class Script:
@staticmethod
def main():
b = 6
print(str(b))
print(str(500))
Script.main() |
with open(snakemake.input["city"], "r") as f:
city_name = f.readline().strip()
with open(snakemake.output["city"], "w") as f:
print(f"Hello {city_name}!", file=f) | with open(snakemake.input['city'], 'r') as f:
city_name = f.readline().strip()
with open(snakemake.output['city'], 'w') as f:
print(f'Hello {city_name}!', file=f) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.