content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# This file contains API keys that are required in order to pull data from sources
# You can register for those platforms by provided links.
# Cymon
# Registration: https://cymon.io/user/signup
cymon_api_key = ''
# VirusTotal
# Registration: https://www.virustotal.com/
virustotal_api_key = ''
# Malwr
# Registration:... | cymon_api_key = ''
virustotal_api_key = ''
malwr_login = ''
malwr_passwd = ''
malw_api_key = ''
totalhash_uid = ''
totalhash_api_key = ''
metascan_api_key = ''
passivetotal_api_key = ''
ibmxforce_token = None |
# Python - 3.6.0
class User:
RANK = [-8, -7, -6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7, 8]
def __init__(self):
self.progress = 0
self.rank = User.RANK[0]
def inc_progress(self, activityRank):
if not activityRank in User.RANK:
raise ValueError()
if self.rank ... | class User:
rank = [-8, -7, -6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7, 8]
def __init__(self):
self.progress = 0
self.rank = User.RANK[0]
def inc_progress(self, activityRank):
if not activityRank in User.RANK:
raise value_error()
if self.rank == User.RANK[-1]:
... |
class Solution:
# @param num, a list of integers
# @return a string
def largestNumber(self, num):
return ''.join(sorted(map(str, num), cmp=self.cmp)).lstrip('0') or '0'
def cmp(self, x, y):
return [1, -1][x + y > y + x]
| class Solution:
def largest_number(self, num):
return ''.join(sorted(map(str, num), cmp=self.cmp)).lstrip('0') or '0'
def cmp(self, x, y):
return [1, -1][x + y > y + x] |
frequency = "once a week"
intensity = "low"
highly_active = frequency == "daily"
print("Highly active users:")
print(highly_active)
high_intensity = intensity == "high"
print("High intensity sports:")
print(high_intensity) | frequency = 'once a week'
intensity = 'low'
highly_active = frequency == 'daily'
print('Highly active users:')
print(highly_active)
high_intensity = intensity == 'high'
print('High intensity sports:')
print(high_intensity) |
class A:
def feature1(self):
print("Feature 1 working")
def feature2(self):
print("Feature 2 working")
class B:
def feature3(self):
print("Feature 3 working")
def feature4(self):
print("Feature 4 working")
class C(A, B):
def feature5(self):
print("Featur... | class A:
def feature1(self):
print('Feature 1 working')
def feature2(self):
print('Feature 2 working')
class B:
def feature3(self):
print('Feature 3 working')
def feature4(self):
print('Feature 4 working')
class C(A, B):
def feature5(self):
print('Featu... |
n = int(input())
arr = []
for i in range(n):
arr.append(input())
x = int(input())
id = []
for i in range(x):
id.append(input())
for key in id:
esq = 0
dir = n-1
while esq <= dir:
meio = (esq + dir) // 2
if key == arr[meio]:
break
elif key < arr[meio]... | n = int(input())
arr = []
for i in range(n):
arr.append(input())
x = int(input())
id = []
for i in range(x):
id.append(input())
for key in id:
esq = 0
dir = n - 1
while esq <= dir:
meio = (esq + dir) // 2
if key == arr[meio]:
break
elif key < arr[meio]:
... |
#!/usr/bin/env python3
def read_mpls():
with open('config_mpls.txt') as conf:
configs = conf.readlines()
list_configs = []
dict_configs = {}
for config in configs:
if 'shutdown' not in config:
if 'vpn' in config:
dict_configs[config.split()[0]] = config.sp... | def read_mpls():
with open('config_mpls.txt') as conf:
configs = conf.readlines()
list_configs = []
dict_configs = {}
for config in configs:
if 'shutdown' not in config:
if 'vpn' in config:
dict_configs[config.split()[0]] = config.split()[1]
if 'na... |
def get_method(member):
method = {
'char': 'getInt8',
'signed char': 'getInt8',
'unsigned char': 'getUint8',
'short': 'getInt16',
'unsigned short': 'getUint16',
'int': 'getInt32',
'unsigned int': 'getUint32',
'long': 'getInt32',
'unsigned long'... | def get_method(member):
method = {'char': 'getInt8', 'signed char': 'getInt8', 'unsigned char': 'getUint8', 'short': 'getInt16', 'unsigned short': 'getUint16', 'int': 'getInt32', 'unsigned int': 'getUint32', 'long': 'getInt32', 'unsigned long': 'getUint32', 'float': 'getFloat32', 'double': 'getFloat64'}[member.type... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
_SNAKE_TO_CAMEL_CASE_TABLE = {
"access_key": "accessKey",
"additional_volume_ids": "additionalVolumeIds",
"admission_plugin... | _snake_to_camel_case_table = {'access_key': 'accessKey', 'additional_volume_ids': 'additionalVolumeIds', 'admission_plugins': 'admissionPlugins', 'apiserver_url': 'apiserverUrl', 'auto_upgrade': 'autoUpgrade', 'autoscaler_config': 'autoscalerConfig', 'backend_id': 'backendId', 'boot_type': 'bootType', 'certificate_id':... |
#!/usr/bin/env python3
def max_consecutive(nums, target):
'''
Given an array, find the maximum number of consecutive target
>>> max_consecutive([1,2,2,4,2,2,2], 2)
3
'''
prev, curr = 0, 0
for n in nums:
if n == target:
curr += 1
else:
prev, curr = m... | def max_consecutive(nums, target):
"""
Given an array, find the maximum number of consecutive target
>>> max_consecutive([1,2,2,4,2,2,2], 2)
3
"""
(prev, curr) = (0, 0)
for n in nums:
if n == target:
curr += 1
else:
(prev, curr) = (max(prev, curr), 0)... |
def add_native_methods(clazz):
def acquireDefaultNativeCreds__int____(a0, a1):
raise NotImplementedError()
clazz.acquireDefaultNativeCreds__int____ = staticmethod(acquireDefaultNativeCreds__int____)
| def add_native_methods(clazz):
def acquire_default_native_creds__int____(a0, a1):
raise not_implemented_error()
clazz.acquireDefaultNativeCreds__int____ = staticmethod(acquireDefaultNativeCreds__int____) |
#!/usr/bin/env python
# coding: utf-8
# In[8]:
n, g = list(map(int, input().split()))
runas = dict()
for i in range(0, n):
entry = input().split()
runas[entry[0]] = int(entry[1])
input()
x = input().split()
total = 0
for runa in x:
total += runas[runa]
print(total)
if total >= g:
print('You shal... | (n, g) = list(map(int, input().split()))
runas = dict()
for i in range(0, n):
entry = input().split()
runas[entry[0]] = int(entry[1])
input()
x = input().split()
total = 0
for runa in x:
total += runas[runa]
print(total)
if total >= g:
print('You shall pass!')
else:
print('My precioooous') |
def soma(a=0, b=0, c=0):
s = a + b + c
return s
r1 = soma(1, 4, 6)
r2 = soma(5, 3)
r3 = soma(5, 1)
print(f'As somas valem {r1}, {r2} e {r3}')
| def soma(a=0, b=0, c=0):
s = a + b + c
return s
r1 = soma(1, 4, 6)
r2 = soma(5, 3)
r3 = soma(5, 1)
print(f'As somas valem {r1}, {r2} e {r3}') |
#
# PySNMP MIB module CXCAS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CXCAS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:16:43 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:23... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, single_value_constraint, constraints_union, constraints_intersection) ... |
# WHILE LOOPS
counter = 0
while counter < 100:
counter = counter + 1
print("The number is {}".format(counter))
| counter = 0
while counter < 100:
counter = counter + 1
print('The number is {}'.format(counter)) |
'''
Set union between 2 sets. Variation of the merge function from mergesort. '''
def set_union(A,B) :
''' returns set union A U B '''
A_s = list(set(A))
B_s = list(set(B))
A_s.sort()
B_s.sort()
C = []
m,n = len(A_s),len(B_s)
i,j = 0,0
while ( i+j < m+n ) :
if i == m :
... | """
Set union between 2 sets. Variation of the merge function from mergesort. """
def set_union(A, B):
""" returns set union A U B """
a_s = list(set(A))
b_s = list(set(B))
A_s.sort()
B_s.sort()
c = []
(m, n) = (len(A_s), len(B_s))
(i, j) = (0, 0)
while i + j < m + n:
if i =... |
class Sentence:
def __init__(self,TokenList,id=-1):
self.id=id
self.attr={}
self.attr['document']=TokenList[0].attr['document']
self.value=TokenList
def get_text(self):
return ' '.join(token.value for token in self.value)
def get_list(self):
return [token.va... | class Sentence:
def __init__(self, TokenList, id=-1):
self.id = id
self.attr = {}
self.attr['document'] = TokenList[0].attr['document']
self.value = TokenList
def get_text(self):
return ' '.join((token.value for token in self.value))
def get_list(self):
ret... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
run = True
if run:
print("I'm running!")
sleep = False
if sleep:
print("I'm sleeping!")
else:
print("I'm not sleeping!")
aux = 9
if aux == 15:
print('"Aux" equals 15')
elif aux == 14:
print('"Aux" equals 14')
elif aux <= 12 and aux >= 10:
prin... | run = True
if run:
print("I'm running!")
sleep = False
if sleep:
print("I'm sleeping!")
else:
print("I'm not sleeping!")
aux = 9
if aux == 15:
print('"Aux" equals 15')
elif aux == 14:
print('"Aux" equals 14')
elif aux <= 12 and aux >= 10:
print('"Aux" is between 10 and 12')
else:
print('"Aux... |
testfile = open("/Users/KerimErekmen/Developer/Python/MachineLearing/handwritten/mnist_train.csv", "r")
data = testfile.readlines()
testfile.close()
print(data)
| testfile = open('/Users/KerimErekmen/Developer/Python/MachineLearing/handwritten/mnist_train.csv', 'r')
data = testfile.readlines()
testfile.close()
print(data) |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param a ListNode
# @return a ListNode
def swapPairs(self, head):
if head is None:
return head
res = None
res_end = Non... | class Solution:
def swap_pairs(self, head):
if head is None:
return head
res = None
res_end = None
temp = None
temp_end = None
i = 1
while head is not None:
next_node = head.next
if temp is None:
temp_end = ... |
def binarysearch(vals, value):
lo = 0
hi = len(vals) - 1
while lo <= hi:
mid = (lo + hi) // 2
if vals[mid] < value:
lo = mid + 1
elif value < vals[mid]:
hi = mid - 1
else:
return mid
return None
| def binarysearch(vals, value):
lo = 0
hi = len(vals) - 1
while lo <= hi:
mid = (lo + hi) // 2
if vals[mid] < value:
lo = mid + 1
elif value < vals[mid]:
hi = mid - 1
else:
return mid
return None |
terms = int(input("How many terms: "))
num1, num2 = 0,1
count = 0
print("Fibonacci sequence: ")
while count < terms:
print(num1)
n = num1 + num2
num1 = num2
num2 = n
count += 1
print(num1)
print(count)
| terms = int(input('How many terms: '))
(num1, num2) = (0, 1)
count = 0
print('Fibonacci sequence: ')
while count < terms:
print(num1)
n = num1 + num2
num1 = num2
num2 = n
count += 1
print(num1)
print(count) |
class IClient(object):
''' Interface for redis client '''
def __init__(self, **kwargs):
raise NotImplementedError()
def expire(self, key, seconds):
return self._redis.expire(key, seconds)
def flushdb(self):
return self._redis.flushdb()
def delete(self, key):
retur... | class Iclient(object):
""" Interface for redis client """
def __init__(self, **kwargs):
raise not_implemented_error()
def expire(self, key, seconds):
return self._redis.expire(key, seconds)
def flushdb(self):
return self._redis.flushdb()
def delete(self, key):
ret... |
def array_merge_recursive(array1, *arrays):
for array in arrays:
for key, value in array.items():
if key in array1:
if isinstance(value, dict):
array[key] = array_merge_recursive(array1[key], value)
if isinstance(value, (list, tuple)):
... | def array_merge_recursive(array1, *arrays):
for array in arrays:
for (key, value) in array.items():
if key in array1:
if isinstance(value, dict):
array[key] = array_merge_recursive(array1[key], value)
if isinstance(value, (list, tuple)):
... |
# Copyright 2019 The Kythe 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 applicable law... | _mnemonic = 'Javac'
def _extract_java(target, ctx):
if JavaInfo not in target or not hasattr(ctx.rule.attr, 'srcs'):
return None
javac_action = None
for a in target.actions:
if a.mnemonic == _mnemonic:
javac_action = a
break
if not javac_action:
return No... |
del_items(0x8011ACC4)
SetType(0x8011ACC4, "int NumOfMonsterListLevels")
del_items(0x800B728C)
SetType(0x800B728C, "struct MonstLevel AllLevels[16]")
del_items(0x8011A9B0)
SetType(0x8011A9B0, "unsigned char NumsLEV1M1A[4]")
del_items(0x8011A9B4)
SetType(0x8011A9B4, "unsigned char NumsLEV1M1B[4]")
del_items(0x8011A9B8)
S... | del_items(2148641988)
set_type(2148641988, 'int NumOfMonsterListLevels')
del_items(2148233868)
set_type(2148233868, 'struct MonstLevel AllLevels[16]')
del_items(2148641200)
set_type(2148641200, 'unsigned char NumsLEV1M1A[4]')
del_items(2148641204)
set_type(2148641204, 'unsigned char NumsLEV1M1B[4]')
del_items(214864120... |
def pagination(limit, page, resource_count, page_count, skip_val):
if page:
if not limit:
limit = 10
if resource_count > limit:
page_count = int(resource_count / limit)
if resource_count % limit:
page_count += 1
if page > page_count:
... | def pagination(limit, page, resource_count, page_count, skip_val):
if page:
if not limit:
limit = 10
if resource_count > limit:
page_count = int(resource_count / limit)
if resource_count % limit:
page_count += 1
if page > page_count:
... |
#
# PySNMP MIB module BIANCA-BRICK-HIDDENVPN-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BIANCA-BRICK-HIDDENVPN-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:21:11 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version ... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_union, value_range_constraint, value_size_constraint, constraints_intersection) ... |
# -*- coding: utf-8 -*-
class Solution:
def plusOne(self, digits):
number = int(''.join(str(digit) for digit in digits))
return [int(digit) for digit in str(number + 1)]
if __name__ == '__main__':
solution = Solution()
assert [1, 2, 4] == solution.plusOne([1, 2, 3])
assert [4, 3, 2,... | class Solution:
def plus_one(self, digits):
number = int(''.join((str(digit) for digit in digits)))
return [int(digit) for digit in str(number + 1)]
if __name__ == '__main__':
solution = solution()
assert [1, 2, 4] == solution.plusOne([1, 2, 3])
assert [4, 3, 2, 2] == solution.plusOne([... |
class MinStack:
def __init__(self):
self.stack = []
self.minval = []
def push(self, val: int) -> None:
if len(self.stack)==0:
self.stack.append(val)
self.minval.append(val)
else:
if self.minval[-1]<val:
self.minval.append(self... | class Minstack:
def __init__(self):
self.stack = []
self.minval = []
def push(self, val: int) -> None:
if len(self.stack) == 0:
self.stack.append(val)
self.minval.append(val)
else:
if self.minval[-1] < val:
self.minval.append(... |
number = int(input("Enter the number: "))
count = 0
while number > 0:
count = count + 1
number = number // 10
print("Number of digit in the number are:", count)
| number = int(input('Enter the number: '))
count = 0
while number > 0:
count = count + 1
number = number // 10
print('Number of digit in the number are:', count) |
class Solution:
def combine(self, n: int, k: int) -> List[List[int]]:
r = []
t = list(range(1, k + 1))
i = k
while i >= 0:
if i == k:
r.append(t)
t = t.copy()
i -= 1
if t[i] < n - k + i + 1:
... | class Solution:
def combine(self, n: int, k: int) -> List[List[int]]:
r = []
t = list(range(1, k + 1))
i = k
while i >= 0:
if i == k:
r.append(t)
t = t.copy()
i -= 1
if t[i] < n - k + i + 1:
t[i]... |
class Solution:
def goodNodes(self, root) -> int:
def dfs(root, cur_max):
if not root:
return 0
ans = 0
if root.val >= cur_max:
cur_max = root.val
ans += 1
return ans + dfs(root.left, cur_max) + dfs(root.right, c... | class Solution:
def good_nodes(self, root) -> int:
def dfs(root, cur_max):
if not root:
return 0
ans = 0
if root.val >= cur_max:
cur_max = root.val
ans += 1
return ans + dfs(root.left, cur_max) + dfs(root.right... |
description = 'setup for the astrium chopper phase'
group = 'optional'
excludes = ['chopper']
devices = dict(
chopper_ch1_phase = device('nicos.devices.generic.ManualMove',
description = 'Chopper channel 1 phase',
fmtstr = '%.2f',
maxage = 35,
abslimits = (-180, 180),
defa... | description = 'setup for the astrium chopper phase'
group = 'optional'
excludes = ['chopper']
devices = dict(chopper_ch1_phase=device('nicos.devices.generic.ManualMove', description='Chopper channel 1 phase', fmtstr='%.2f', maxage=35, abslimits=(-180, 180), default=16.2, unit='deg'), chopper_ch2_phase=device('nicos.dev... |
##########################################################################
#
# WooferBot, an interactive BrowserSource Bot for streamers
# Copyright (C) 2020 Tomaae
# (https://wooferbot.com/)
#
# This file is part of WooferBot.
#
# WooferBot is distributed in the hope that it will be useful,
# but WI... | class Cli:
def __init__(self, settings, woofer, twitch, chatbot):
self.woofer = woofer
self.settings = settings
self.twitch = twitch
self.chatbot = chatbot
def start(self):
print('Starting cli...')
while True:
cmd = input('')
if cmd == 'x... |
prime=[1] * 1000001
sum=[0] * 1000001
prime[0],prime[1]=0,0
#ensures that multiples of one are not traversed unlike previously where i had prime[1] as true
for p,pri in enumerate(prime):
if (pri):
sum[p]=sum[p-1]+p
i=p*p
while(i<=1000000):
prime[i]=0
i+=p
else:
... | prime = [1] * 1000001
sum = [0] * 1000001
(prime[0], prime[1]) = (0, 0)
for (p, pri) in enumerate(prime):
if pri:
sum[p] = sum[p - 1] + p
i = p * p
while i <= 1000000:
prime[i] = 0
i += p
else:
sum[p] = sum[p - 1]
t = int(input())
for a0 in range(t):
n... |
def diagonalDiff(arr):
# Initialize sums of diagonals
sumd1 = 0
sumd2 = 0
for i in range(0, len(arr)):
for j in range(0, len(arr)):
# finding sum of primary diagonal - arr[1][1]+arr[2][2]+arr[3]a[3]....
if (i == j):
sumd1 += arr[i][j]
#... | def diagonal_diff(arr):
sumd1 = 0
sumd2 = 0
for i in range(0, len(arr)):
for j in range(0, len(arr)):
if i == j:
sumd1 += arr[i][j]
if i == len(arr) - j - 1:
sumd2 += arr[i][j]
return abs(sumd1 - sumd2)
print(diagonal_diff([[15, 2, 4], [4, ... |
class Solution:
def merge(self, intervals: List[List[int]]) -> List[List[int]]:
intervals.sort(key=lambda interval: interval[0])
res = []
res.append(intervals[0])
def is_overlap(a, b):
return a[0] <= b[1] and b[0] <= a[1]
for i in range(... | class Solution:
def merge(self, intervals: List[List[int]]) -> List[List[int]]:
intervals.sort(key=lambda interval: interval[0])
res = []
res.append(intervals[0])
def is_overlap(a, b):
return a[0] <= b[1] and b[0] <= a[1]
for i in range(1, len(intervals)):
... |
class SizedCallableWrapper:
def __init__(self, data, function):
self.data = data
self.function = function
def __len__(self):
return len(self.data)
def __iter__(self):
return (self.function(x) for x in self.data)
class SizedBatchWrapper:
def __init__(self, data, batch_... | class Sizedcallablewrapper:
def __init__(self, data, function):
self.data = data
self.function = function
def __len__(self):
return len(self.data)
def __iter__(self):
return (self.function(x) for x in self.data)
class Sizedbatchwrapper:
def __init__(self, data, batch... |
class Dog:
def mytalk(self):
print("Bark....Bark..")
class Crows:
def mytalk(self):
print("Caw....Caw..")
class Duck:
def mytalk(self):
print("Quack....Quack..")
class Owl:
def mytalk(self):
print("Hoot....Hoot..")
def myquack(object):
#non-Python... | class Dog:
def mytalk(self):
print('Bark....Bark..')
class Crows:
def mytalk(self):
print('Caw....Caw..')
class Duck:
def mytalk(self):
print('Quack....Quack..')
class Owl:
def mytalk(self):
print('Hoot....Hoot..')
def myquack(object):
if isinstance(object, Du... |
class Section:
def __init__(self) -> None:
self.text = []
self.length = 0
def set_text(self, text: str, oneline: bool = False):
# TODO use get/set ?
if oneline:
self.length = 1
self.text = [text]
else:
split_text = text.splitlines()
... | class Section:
def __init__(self) -> None:
self.text = []
self.length = 0
def set_text(self, text: str, oneline: bool=False):
if oneline:
self.length = 1
self.text = [text]
else:
split_text = text.splitlines()
self.length = len(sp... |
# Prints out the name of a favorite city
def favorite_city(name):
print("One of my favorite cities is", name)
favorite_city("Santa Barbara, California")
favorite_city("Asheville, North Carolina")
favorite_city("Amsterdam, The Netherlands")
| def favorite_city(name):
print('One of my favorite cities is', name)
favorite_city('Santa Barbara, California')
favorite_city('Asheville, North Carolina')
favorite_city('Amsterdam, The Netherlands') |
def add(a, b):
return a + b
# When your file is the main program (e.g. pressing Run), Python sets __name__ to __main__ and the code inside the if statement runs.
# When we import your file for testing, __name__ is the module name, so the condition is False and no output is printed.
# This is a common trick for tes... | def add(a, b):
return a + b
if __name__ == '__main__':
print(add(2, 3))
print(add(1, 5)) |
test_generate_product_schema = {
"type": "object",
"required": ["uid"],
"additionalProperties": False,
"properties": {
"uid": {
"type": "string",
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
}
},
}
| test_generate_product_schema = {'type': 'object', 'required': ['uid'], 'additionalProperties': False, 'properties': {'uid': {'type': 'string', 'pattern': '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$'}}} |
def main(request, response):
response.headers.set("Content-Type", "text/html")
response.headers.set("Refresh", request.GET.first("input"))
response.content = "<!doctype html>refresh.py\n"
| def main(request, response):
response.headers.set('Content-Type', 'text/html')
response.headers.set('Refresh', request.GET.first('input'))
response.content = '<!doctype html>refresh.py\n' |
class AuthCheckResult():
def __init__(self, authenticated, userinfo = None):
self.authenticated = authenticated
self.userinfo = userinfo
class AuthService:
def check_auth(self):
# Should be re-implemented in subclasses
return AuthCheckResult(false)
def check_token(self):
... | class Authcheckresult:
def __init__(self, authenticated, userinfo=None):
self.authenticated = authenticated
self.userinfo = userinfo
class Authservice:
def check_auth(self):
return auth_check_result(false)
def check_token(self):
return auth_check_result(false) |
def setUpModule() -> None:
print("[SetUp Module entry_tree Test]")
def tearDownModule() -> None:
print("[TearDown Module entry_tree Test]")
| def set_up_module() -> None:
print('[SetUp Module entry_tree Test]')
def tear_down_module() -> None:
print('[TearDown Module entry_tree Test]') |
#
# PySNMP MIB module REPEATER-MIB-2 (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/REPEATER-MIB-2
# Produced by pysmi-0.3.4 at Mon Apr 29 17:26:51 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, constraints_union, value_range_constraint, constraints_intersection, single_value_constraint) ... |
class Node():
def __init__(self, val):
self.val = val
self.right = None
self.left = None
def min_value(root):
if not root:
return None
curr = root
while curr.left:
curr = curr.left
return curr.val
def max_value(root):
if not root:
return None
... | class Node:
def __init__(self, val):
self.val = val
self.right = None
self.left = None
def min_value(root):
if not root:
return None
curr = root
while curr.left:
curr = curr.left
return curr.val
def max_value(root):
if not root:
return None
... |
# This file was automatically generated by the contaminants/prepare.py script.
DATA = [
("1xek", "P 1 21 1", 25.32, 54.73, 30.68, 90., 111.15, 90., "LYSC_CHICK"), # UniRef100_P00698
("1v7t", "P 1", 25.93, 39.97, 42.39, 88.00, 95.44, 90.58, "LYSC_CHICK"), # UniRef100_P00698
("2z19", "P 1 21 1", 26.09, 59.05, 30.70, 90.... | data = [('1xek', 'P 1 21 1', 25.32, 54.73, 30.68, 90.0, 111.15, 90.0, 'LYSC_CHICK'), ('1v7t', 'P 1', 25.93, 39.97, 42.39, 88.0, 95.44, 90.58, 'LYSC_CHICK'), ('2z19', 'P 1 21 1', 26.09, 59.05, 30.7, 90.0, 110.63, 90.0, 'LYSC_CHICK'), ('1xej', 'P 1 21 1', 26.34, 55.88, 31.55, 90.0, 109.98, 90.0, 'LYSC_CHICK'), ('2d4j', '... |
f=1
a=0
for i in range(10000):
a=i+1
f=f*a
print(f) | f = 1
a = 0
for i in range(10000):
a = i + 1
f = f * a
print(f) |
CONFIG = {
"MQTT_BROKER": "172.16.0.12",
"MQTT_CLIENT_ID_PREFIX": "sensor_",
"MQTT_PASSWORD": "<secret>",
"MQTT_PORT": 1886,
"MQTT_TOPIC": "esp",
"MQTT_USER": "mqtt",
"NETWORK_PASSWORD": "<secret>",
"NETWORK_SSID": "LAFERME"
} | config = {'MQTT_BROKER': '172.16.0.12', 'MQTT_CLIENT_ID_PREFIX': 'sensor_', 'MQTT_PASSWORD': '<secret>', 'MQTT_PORT': 1886, 'MQTT_TOPIC': 'esp', 'MQTT_USER': 'mqtt', 'NETWORK_PASSWORD': '<secret>', 'NETWORK_SSID': 'LAFERME'} |
class bcolors:
PURPLE = '\033[95m' # purple
BLUE = '\033[94m' # blue
CYAN = '\033[96m'
GREEN = '\033[92m' # green
YELLOW = '\033[93m' # yellow
ORANGE = '\033[91m' # red
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
WHITE = '\033[97m'
RED = '\033[31m'
BROWN = '\... | class Bcolors:
purple = '\x1b[95m'
blue = '\x1b[94m'
cyan = '\x1b[96m'
green = '\x1b[92m'
yellow = '\x1b[93m'
orange = '\x1b[91m'
endc = '\x1b[0m'
bold = '\x1b[1m'
underline = '\x1b[4m'
white = '\x1b[97m'
red = '\x1b[31m'
brown = '\x1b[38;5;95m' |
mytuple = ("Ali", "Mahdi", "Sara")
print(mytuple)
t = tuple() | mytuple = ('Ali', 'Mahdi', 'Sara')
print(mytuple)
t = tuple() |
n = int(input())
x = list(map(int, input().split()))
ans = 0
for i in x:
if i > 10:
ans += i - 10
print(ans) | n = int(input())
x = list(map(int, input().split()))
ans = 0
for i in x:
if i > 10:
ans += i - 10
print(ans) |
# 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 = {
"api_version": "apiVersion",
"ca_bundle": "caBundle",
"cluster_name": "clusterName",
"external_server_ur_ls": "external... | snake_to_camel_case_table = {'api_version': 'apiVersion', 'ca_bundle': 'caBundle', 'cluster_name': 'clusterName', 'external_server_ur_ls': 'externalServerURLs', 'last_generation': 'lastGeneration', 'last_transition_time': 'lastTransitionTime', 'observed_generation': 'observedGeneration', 'registration_image_pull_spec':... |
# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
__author__ = "axeldeveloper"
__date__ = "$29/06/2017 22:34:13$"
def calcularMinio():
return "calcular"
| __author__ = 'axeldeveloper'
__date__ = '$29/06/2017 22:34:13$'
def calcular_minio():
return 'calcular' |
# factorial program using Python 2
print("Factorial using Python 2\n")
number = input("Enter a non-negative integer for factorial\n")
product = 1
for i in range(number):
product = product * (i + 1)
print(product)
| print('Factorial using Python 2\n')
number = input('Enter a non-negative integer for factorial\n')
product = 1
for i in range(number):
product = product * (i + 1)
print(product) |
class Game():
def __init__(self, board):
self.board=board
def play(self, lines):
res=set(lines)
length=self.board*2+1
while True:
record=len(res)
for i in range(self.board):
start=1+length*i
for j in range(self.board):
... | class Game:
def __init__(self, board):
self.board = board
def play(self, lines):
res = set(lines)
length = self.board * 2 + 1
while True:
record = len(res)
for i in range(self.board):
start = 1 + length * i
for j in range(... |
# This is an input class. Do not edit.
class AncestralTree:
def __init__(self, name):
self.name = name
self.ancestor = None
def getYoungestCommonAncestor(topAncestor: AncestralTree, descendantOne: AncestralTree, descendantTwo: AncestralTree):
h1, h2 = 0, 0
d1, d2 = descendantOne, descendan... | class Ancestraltree:
def __init__(self, name):
self.name = name
self.ancestor = None
def get_youngest_common_ancestor(topAncestor: AncestralTree, descendantOne: AncestralTree, descendantTwo: AncestralTree):
(h1, h2) = (0, 0)
(d1, d2) = (descendantOne, descendantTwo)
while d1 is not Non... |
def insertion(x, L):
if (L == list()):
return [x]
y = L[0]
R = L[1:]
if (x <= y):
return [x]+L
return [y]+insertion(x, R)
def insertionSort(L):
if (L == list()):
return list()
x = L.pop()
subInsertionSort = insertionSort(L)
return insertion(x, subInsert... | def insertion(x, L):
if L == list():
return [x]
y = L[0]
r = L[1:]
if x <= y:
return [x] + L
return [y] + insertion(x, R)
def insertion_sort(L):
if L == list():
return list()
x = L.pop()
sub_insertion_sort = insertion_sort(L)
return insertion(x, subInsertionS... |
a = 60 # 60 = 0011 1100
b = 13 # 13 = 0000 1101
c = 0 # 0 = 0
c = a & b; # 12 = 0000 1100
print ("Line 1 - Value of c is ", bin(c))
c = a | b; # 61 = 0011 1101
print ("Line 2 - Value of c is ", bin(c))
c = a ^ b; # 49 = 0011 0001
print ("Line 3 - Value of c is ", bin(c))
c = ~a;... | a = 60
b = 13
c = 0
c = a & b
print('Line 1 - Value of c is ', bin(c))
c = a | b
print('Line 2 - Value of c is ', bin(c))
c = a ^ b
print('Line 3 - Value of c is ', bin(c))
c = ~a
print('Line 4 - Value of c is ', bin(c))
c = a << 2
print('Line 5 - Value of c is ', bin(c))
c = a >> 2
print('Line 6 - Value of c is ', bin... |
num = [1,2,3,4,5,5,6,7,8]
print(num[:2])
print(num[2:])
print(num[-5:-1])
| num = [1, 2, 3, 4, 5, 5, 6, 7, 8]
print(num[:2])
print(num[2:])
print(num[-5:-1]) |
numbers = [int(num) for num in input().split(' ')]
def count_odd_numbers_at_odd_indexes(collection):
result = []
for i in range(len(collection)):
if i % 2 != 0 and collection[i] % 2 != 0:
result.append(f'Index {i} -> {collection[i]}')
return result
print('\n'.join(count_odd_numbers_a... | numbers = [int(num) for num in input().split(' ')]
def count_odd_numbers_at_odd_indexes(collection):
result = []
for i in range(len(collection)):
if i % 2 != 0 and collection[i] % 2 != 0:
result.append(f'Index {i} -> {collection[i]}')
return result
print('\n'.join(count_odd_numbers_at_o... |
# Coin
unit_list = [1,5,10,20,25]
thre_num = 41
def max_first(unit_list, thre_num):
sort_list = sorted(unit_list, reverse=True)
sum_cookie = {k:0 for k in unit_list}
iter_loop = 0
while sum([k*v for k,v in sum_cookie.items()]) < thre_num:
iter_loop +=1
sum_gap = thre_num - sum([k*v for k,v in sum_cookie.items(... | unit_list = [1, 5, 10, 20, 25]
thre_num = 41
def max_first(unit_list, thre_num):
sort_list = sorted(unit_list, reverse=True)
sum_cookie = {k: 0 for k in unit_list}
iter_loop = 0
while sum([k * v for (k, v) in sum_cookie.items()]) < thre_num:
iter_loop += 1
sum_gap = thre_num - sum([k * ... |
CONSUM_TOK = ''
CONSUM_SEC = ''
ACCESS_TOK = ''
ACCESS_SEC = ''
SQLITE_DB = 'data/simulator.db'
SQLITE_SC = 'data/schema.sql'
RECENT_DB = 'data/recent.json' | consum_tok = ''
consum_sec = ''
access_tok = ''
access_sec = ''
sqlite_db = 'data/simulator.db'
sqlite_sc = 'data/schema.sql'
recent_db = 'data/recent.json' |
class Solution:
def minRemoveToMakeValid(self, s: str) -> str:
a = list(s)
b = []
for i, c in enumerate(a):
if '(' == c:
b += i,
elif ')' == c:
if b:
b.pop()
else:
a[i] = ''
... | class Solution:
def min_remove_to_make_valid(self, s: str) -> str:
a = list(s)
b = []
for (i, c) in enumerate(a):
if '(' == c:
b += (i,)
elif ')' == c:
if b:
b.pop()
else:
a[i] = ... |
def cut_text(text,lenth):
n=int(len(text)/lenth)
textCut=[]
for i in range(0,n):
textCut.append(text[i*lenth:(i+1)*lenth])
return textCut
def StringToChar(string):
n=len(string)
chars=[]
for i in range(0,n):
chars.append(string[i])
return chars
def Decodin... | def cut_text(text, lenth):
n = int(len(text) / lenth)
text_cut = []
for i in range(0, n):
textCut.append(text[i * lenth:(i + 1) * lenth])
return textCut
def string_to_char(string):
n = len(string)
chars = []
for i in range(0, n):
chars.append(string[i])
return chars
def... |
def parameters():
k = 30 # knn neighbors
h = 0.3 # kde windowsize / radius
return h, k
| def parameters():
k = 30
h = 0.3
return (h, k) |
a=input("")
b=input("")
c=""
for i in range(len(a)):
c+=a[i]+" "
a=c
c=""
for i in range(len(b)):
c+=b[i]+" "
b=c
a=a.split()
b=b.split()
c=[]
for i in range(len(a)):
if(a[i]==b[i]):
c.append(0)
else:
c.append(1)
d=""
for e in c:
d+=str(e)
print(d) | a = input('')
b = input('')
c = ''
for i in range(len(a)):
c += a[i] + ' '
a = c
c = ''
for i in range(len(b)):
c += b[i] + ' '
b = c
a = a.split()
b = b.split()
c = []
for i in range(len(a)):
if a[i] == b[i]:
c.append(0)
else:
c.append(1)
d = ''
for e in c:
d += str(e)
print(d) |
#MongoDB credentials
DBNAME = 'xxxxxxxxxxxxxxx'
DBUSER = 'xxxxxxxxxxxxxxx'
DBPASS = 'xxxxxxxxxxxxxxx'
DBAUTH = 'xxxxxxxxxxxxxxx'
#Telegram credentials
HOSTNAME = 'xxxxxxxxxxxxxxx'
PORT = xxxxxxxxxxxxxxx
TOKEN = 'xxxxxxxxxxxxxxx'
#ID Azan Log ChatID
LOG_CHATID = -xxxxxxxxxxxxxxx
#Admin List
ADMIN_LIST = [xxxxxxxxxxxx... | dbname = 'xxxxxxxxxxxxxxx'
dbuser = 'xxxxxxxxxxxxxxx'
dbpass = 'xxxxxxxxxxxxxxx'
dbauth = 'xxxxxxxxxxxxxxx'
hostname = 'xxxxxxxxxxxxxxx'
port = xxxxxxxxxxxxxxx
token = 'xxxxxxxxxxxxxxx'
log_chatid = -xxxxxxxxxxxxxxx
admin_list = [xxxxxxxxxxxxxxx]
botan_token = 'xxxxxxxxxxxxxxx' |
f = open("C:/Users/Tom/Downloads/aocinput1.txt", "r") #how I did this was I downloaded the file and imported the file from my C:/Downloads so I didn't have to make a big array with all the numbers
numbers = []
for x in f:
numbers.append(int(x))
f.close()
for x in numbers:
for y in numbers:
for z in nu... | f = open('C:/Users/Tom/Downloads/aocinput1.txt', 'r')
numbers = []
for x in f:
numbers.append(int(x))
f.close()
for x in numbers:
for y in numbers:
for z in numbers:
result = x + y + z
if result == 2020:
print(x * y * z) |
style = dict(style_name = 'blueskies',
base_mpl_style='fast',
marketcolors = {'candle' : {'up':'w', 'down':'#0095ff'},
'edge' : {'up':'k', 'down':'#0095ff'},
'wick' : {'up':'k', 'down':'#0095ff'},
... | style = dict(style_name='blueskies', base_mpl_style='fast', marketcolors={'candle': {'up': 'w', 'down': '#0095ff'}, 'edge': {'up': 'k', 'down': '#0095ff'}, 'wick': {'up': 'k', 'down': '#0095ff'}, 'ohlc': {'up': 'w', 'down': 'w'}, 'volume': {'up': 'w', 'down': '#0095ff'}, 'vcdopcod': False, 'alpha': 1.0}, mavcolors=None... |
#
# @lc app=leetcode.cn id=1615 lang=python3
#
# [1615] range-sum-of-sorted-subarray-sums
#
None
# @lc code=end | None |
class Config(object):
DEBUG = False
SEASON = '2022'
class ProductionConfig(Config):
DEBUG = False
class DevelopmentConfig(Config):
DEBUG = True
| class Config(object):
debug = False
season = '2022'
class Productionconfig(Config):
debug = False
class Developmentconfig(Config):
debug = True |
# -*- coding: utf-8 -*-
def count_notifications(request):
if not request.user.is_anonymous:
count = request.user.notifications.unread().count()
else:
count = 0
return {'unread_notifications': count}
| def count_notifications(request):
if not request.user.is_anonymous:
count = request.user.notifications.unread().count()
else:
count = 0
return {'unread_notifications': count} |
#
# PySNMP MIB module TUBS-LINUX-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TUBS-LINUX-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:20:36 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... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, constraints_union, value_range_constraint, constraints_intersection) ... |
_base_config_ = ["configA.py"]
checkpoint_url = "https://folk.ntnu.no/haakohu/checkpoints/surface_guided/configB.torch"
loss = dict(
gan_criterion=dict(type="fpn_cse", l1_weight=1, lambda_real=1, lambda_fake=0)
)
generator = dict(
input_cse=True
) | _base_config_ = ['configA.py']
checkpoint_url = 'https://folk.ntnu.no/haakohu/checkpoints/surface_guided/configB.torch'
loss = dict(gan_criterion=dict(type='fpn_cse', l1_weight=1, lambda_real=1, lambda_fake=0))
generator = dict(input_cse=True) |
def draw_board(character_list):
'''
print a game board; either a number board or a tic tac toe board.
'''
print('\n\t TiC-TAC-TOE')
print('\t~~~~~~~~~~~~~~~~~~')
print('\t|| ' + character_list[0] + ' || ' + character_list[1] + ' || ' + character_list[2] + ' ||')
print('\t~~~~~~~~~~~~~~~~~~')
print('\... | def draw_board(character_list):
"""
print a game board; either a number board or a tic tac toe board.
"""
print('\n\t TiC-TAC-TOE')
print('\t~~~~~~~~~~~~~~~~~~')
print('\t|| ' + character_list[0] + ' || ' + character_list[1] + ' || ' + character_list[2] + ' ||')
print('\t~~~~~~~~~~~~~~~~~~')
... |
class UnOrderedLinkedList:
start = None
current = None
size = 0
def addNode(self,node):
if self.start is None:
self.start = node
if self.current is None:
self.current = node
else:
self.current.next = node
self.current = node
... | class Unorderedlinkedlist:
start = None
current = None
size = 0
def add_node(self, node):
if self.start is None:
self.start = node
if self.current is None:
self.current = node
else:
self.current.next = node
self.current = node
... |
class BaseJob(object):
def __init__(self):
pass
def run(self):
raise NotImplementedError("This method should be called against a subclass.")
| class Basejob(object):
def __init__(self):
pass
def run(self):
raise not_implemented_error('This method should be called against a subclass.') |
def csum(a,b,io,jo):
cs=[]
for i in range(len(b)):
for j in range(len(b[i])):
cs.append(a[i+io][j+jo])
return ''.join(cs)
n,m,*ab=open(0).read().split()
n=int(n)
m=int(m)
a=ab[:n]
b=ab[n:]
s=set()
for i in range(n-m+1):
for j in range(len(a[0])-len(b[0])+1):
s.add(csum(a,b,i... | def csum(a, b, io, jo):
cs = []
for i in range(len(b)):
for j in range(len(b[i])):
cs.append(a[i + io][j + jo])
return ''.join(cs)
(n, m, *ab) = open(0).read().split()
n = int(n)
m = int(m)
a = ab[:n]
b = ab[n:]
s = set()
for i in range(n - m + 1):
for j in range(len(a[0]) - len(b[0]... |
class ChoiceGenerator:
__LETTER__ = 0
__WORD__ = 1
__SENTENCE__ = 2
def __init__(self, opt_no, alphabet, word_ac=None):
self.__opt_no = opt_no
self.__alphabet = alphabet
self.__word_ac = word_ac
self.__options = [self.__alphabet]
self.__mode = self.__LETTER__
... | class Choicegenerator:
__letter__ = 0
__word__ = 1
__sentence__ = 2
def __init__(self, opt_no, alphabet, word_ac=None):
self.__opt_no = opt_no
self.__alphabet = alphabet
self.__word_ac = word_ac
self.__options = [self.__alphabet]
self.__mode = self.__LETTER__
... |
# by https://www.iconfinder.com/andhikairfani
folder_icon = (
b"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAuElEQVQ4jWNgGHDwfzZTwb8ZzP9h+P9"
b"M5g//Z/FoE23A3+lsDcgG/JvB/P//LNZr/xcxcJNtACH8fzZTAUUG/J3O1oBpwHzW///XshGHN3Me+H+Qp+H/fkEduA"
b"H/t3D8/3+Qi0TMGw8xYBbz///7SdR8iOvv//1SIhADlrCSYTvPIXgY/N/ITroBh7mL... | folder_icon = b'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAuElEQVQ4jWNgGHDwfzZTwb8ZzP9h+P9M5g//Z/FoE23A3+lsDcgG/JvB/P//LNZr/xcxcJNtACH8fzZTAUUG/J3O1oBpwHzW///XshGHN3Me+H+Qp+H/fkEduAH/t3D8/3+Qi0TMGw8xYBbz///7SdR8iOvv//1SIhADlrCSYTvPIXgY/N/ITroBh7mLIQbMYGv8v5eTdANO8KlCUuIKjjmkO5/7Gjwa19UJXiDVgHVtwruITuo0BwBZFKmWeTQ5... |
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Core\google\protobuf\service.py
# Compiled at: 2011-01-24 08:39:36
# Size of source mod 2**32: 9357 bytes
_... | __author__ = 'petar@google.com (Petar Petrov)'
class Rpcexception(Exception):
pass
class Service(object):
def get_descriptor():
raise NotImplementedError
def call_method(self, method_descriptor, rpc_controller, request, done):
raise NotImplementedError
def get_request_class(self, me... |
#! /usr/bin/env python
'''
To convert a given number to its Roman represenation.
'''
N = int(input("Enter number: "))
R = ""
# thousands
R += 'M'*(N // 1000)
N %= 1000
# hundreds
if N >= 900:
R += "CM"
N -= 900
elif 900 > N >= 500:
R += 'D'
N -= 500
R += 'C'*(N // 100)
N %= 100
# tens
if N >= 90:... | """
To convert a given number to its Roman represenation.
"""
n = int(input('Enter number: '))
r = ''
r += 'M' * (N // 1000)
n %= 1000
if N >= 900:
r += 'CM'
n -= 900
elif 900 > N >= 500:
r += 'D'
n -= 500
r += 'C' * (N // 100)
n %= 100
if N >= 90:
r += 'XC'
n -= 90
elif 90 > N >= 50:
r += '... |
# START LAB EXERCISE 01
# The below line will print the string "Lab Exercise 01" to the command line, and then
# print a new line (which is what the "\n" stands for)
print('Lab Exercise 01 \n')
# PROBLEM 1 (10 points)
# Replace 'your_name_here' with your name.
# Replace '100' with the class number.
# Replace 'your_e... | print('Lab Exercise 01 \n')
name = 'your_name_here'
class_number = 100
editor = 'your_editor_here'
my_first_list = []
print(f'My name is {name}.\nI am enrolled in SI {class_number}.\nMy preferred editor is {editor}')
print(f'My first list:\n{my_first_list}') |
class PluginMixin(object):
#:
proxyview = None
#:
plugin = None
| class Pluginmixin(object):
proxyview = None
plugin = None |
#
# PySNMP MIB module PDN-TC (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PDN-TC
# Produced by pysmi-0.3.4 at Mon Apr 29 20:29: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:23:15)
... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_union, constraints_intersection, value_range_constraint, single_value_constraint) ... |
def crime():
# myfile=open("Crime.cvs",'r')
with open("Crime.csv", 'r') as myfile:
myfile.read()
print(myfile)
for r in myfile:
crime_type =r[8]
crime_id = r[7]
dict={crime_id: crime_type}
print(dict)
#for words in line:
# print(word)
crime()
| def crime():
with open('Crime.csv', 'r') as myfile:
myfile.read()
print(myfile)
for r in myfile:
crime_type = r[8]
crime_id = r[7]
dict = {crime_id: crime_type}
print(dict)
crime() |
'''
File: constants.py
Created Date: Thursday February 8th 2018
Author: Sujan Poudel
Github: https://github.com/psuzn
Last Modified:Thursday, February 8th 2018, 6:16:32 pm
Copyright (c) 2018 https://github.com/psuzn
'''
UNVISITED_BACKGROUND=[0.0, 0.52, 1.0] # background color for the unvisited cells
VISITED_BACKGROUND... | """
File: constants.py
Created Date: Thursday February 8th 2018
Author: Sujan Poudel
Github: https://github.com/psuzn
Last Modified:Thursday, February 8th 2018, 6:16:32 pm
Copyright (c) 2018 https://github.com/psuzn
"""
unvisited_background = [0.0, 0.52, 1.0]
visited_background = [1.0, 1.0, 1.0]
current_background = [0... |
# Config for DeciWatch trained on PW3D dataset with an interval of 5,
# window size of 1 + 5*4(where q=4).
# The model is trained only on SMPL pose parameters.
speed_up_cfg = dict(
type='deciwatch',
interval=5,
slide_window_q=4,
checkpoint='https://openmmlab-share.oss-cn-hangzhou.aliyuncs.com/'
'mmh... | speed_up_cfg = dict(type='deciwatch', interval=5, slide_window_q=4, checkpoint='https://openmmlab-share.oss-cn-hangzhou.aliyuncs.com/mmhuman3d/models/deciwatch/deciwatch_interval5_q4.pth.tar?versionId=CAEQOhiBgMC.t8O9gxgiIGZjZWY3OTdhNGRjZjQyNjY5MGU5YzkxZTZjMWU1MTA2') |
#
# PySNMP MIB module ADH-NETCOM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ADH-NETCOM-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 16:58:14 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... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, single_value_constraint, value_range_constraint, constraints_intersection) ... |
__author__ = 'Chetan'
class Person(object):
def __init__(self, name, age): #constructor
self.name = name #data members/ attributes
self.age = age
def get_person(self,): # member function
return "<Person (%s, %s)>" % (self.name, self.age)
p = Person("John", 32... | __author__ = 'Chetan'
class Person(object):
def __init__(self, name, age):
self.name = name
self.age = age
def get_person(self):
return '<Person (%s, %s)>' % (self.name, self.age)
p = person('John', 32)
print('Type of Object:', type(p), 'Memory Address:', id(p)) |
def serialize_session(session):
return {
u"token": session.token,
u"types": session.types,
u"user_agent": session.user_agent,
u"labels": session.labels,
u"timeouts": session.timeouts,
u"test_state": session.test_state,
u"last_completed_test": session.last_comp... | def serialize_session(session):
return {u'token': session.token, u'types': session.types, u'user_agent': session.user_agent, u'labels': session.labels, u'timeouts': session.timeouts, u'test_state': session.test_state, u'last_completed_test': session.last_completed_test, u'tests': session.tests, u'pending_tests': se... |
#
# from src/factoriz.c
#
# void factorize(int) to factorize
# factorize to factorizeG
# factorize to factorizeL
#
def factorize(x):
while x >= 4 and x % 2 == 0:
print("2 * ", end="")
x = x // 2
d = 3
q = x // d
while q >= d:
if x % d == 0:
print("{0} * ".format(d... | def factorize(x):
while x >= 4 and x % 2 == 0:
print('2 * ', end='')
x = x // 2
d = 3
q = x // d
while q >= d:
if x % d == 0:
print('{0} * '.format(d), end='')
x = q
else:
d = d + 2
q = x // d
print('{0}'.format(x))
def fac... |
def foo():
i = 100
def bar():
#global i
i -= 1
return i
bar()
return i
if __name__ == "__main__":
print(f"foo() = {foo()}")
| def foo():
i = 100
def bar():
i -= 1
return i
bar()
return i
if __name__ == '__main__':
print(f'foo() = {foo()}') |
class Employees:
def __init__(self, empNum, name, salay):
self.empNum = empNum
self.name = name
self.salary = salay
def convert(self):
lst = []
lst.extend([self.empNum, self.name, self.salary])
return lst
# Selection Sort
def selectionSort(list1)... | class Employees:
def __init__(self, empNum, name, salay):
self.empNum = empNum
self.name = name
self.salary = salay
def convert(self):
lst = []
lst.extend([self.empNum, self.name, self.salary])
return lst
def selection_sort(list1):
for i in range(0, len(lis... |
hours = int(input())
minutes = int(input())
time_after_15 = (hours * 60) + minutes + 15
total_hours = time_after_15 // 60
total_mins = time_after_15 % 60
if total_hours == 24:
total_hours = 0
print('{0:}:{1:02d}' .format(total_hours, total_mins)) | hours = int(input())
minutes = int(input())
time_after_15 = hours * 60 + minutes + 15
total_hours = time_after_15 // 60
total_mins = time_after_15 % 60
if total_hours == 24:
total_hours = 0
print('{0:}:{1:02d}'.format(total_hours, total_mins)) |
arquivo = open('aula-06-10/arquivo.txt', 'r')
for linha in arquivo:
print(linha)
| arquivo = open('aula-06-10/arquivo.txt', 'r')
for linha in arquivo:
print(linha) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.