content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
#
# PySNMP MIB module SIP-REGISTRAR-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SIP-REGISTRAR-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:04:26 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, constraints_intersection, value_range_constraint, constraints_union) ... |
#Leia um numero inteiro e monte sua tabuada
n1 = int(input('Digite um numero inteiro: '))
print('Tabuada do numero : '.format(n1))
print(' 1 x {} = {}'.format(n1, n1*1))
print(' 2 x {} = {}'.format(n1, n1*2))
print(' 3 x {} = {}'.format(n1, n1*3))
print(' 4 x {} = {}'.format(n1, n1*4))
print(' 5 x {} = {}'.format(n1, n... | n1 = int(input('Digite um numero inteiro: '))
print('Tabuada do numero : '.format(n1))
print(' 1 x {} = {}'.format(n1, n1 * 1))
print(' 2 x {} = {}'.format(n1, n1 * 2))
print(' 3 x {} = {}'.format(n1, n1 * 3))
print(' 4 x {} = {}'.format(n1, n1 * 4))
print(' 5 x {} = {}'.format(n1, n1 * 5))
print(' 6 x {} = {}'.format(... |
def calc_eval(exp):
if isinstance(exp, Pair):
if exp.first == "and":
return eval_and(exp.rest)
else:
return calc_apply(calc_eval(exp, first), list(exp.rest.map(calc_eval)))
elif exp in OPERATORS:
return OPERATORS[exp]
else:
return exp
def eval_and(op... | def calc_eval(exp):
if isinstance(exp, Pair):
if exp.first == 'and':
return eval_and(exp.rest)
else:
return calc_apply(calc_eval(exp, first), list(exp.rest.map(calc_eval)))
elif exp in OPERATORS:
return OPERATORS[exp]
else:
return exp
def eval_and(ope... |
class ErrorMsg:
float
#float64 X_One
#float64 Height_Of_Cone
#float64 Area_Of_View_Top
#float64 Area_Of_View_Bottom
#bool Stop_Now
| class Errormsg:
float |
class HDPath:
"""
A class representing an HD path. This class is the base class
for both account specific HD paths (:class:`~ape_trezor.hdpath.HDPath`)
as well as the derivation HD path class :class:`~ape_trezor.hdpath.HDBasePath`.
"""
def __init__(self, path: str):
path = path.rstrip("... | class Hdpath:
"""
A class representing an HD path. This class is the base class
for both account specific HD paths (:class:`~ape_trezor.hdpath.HDPath`)
as well as the derivation HD path class :class:`~ape_trezor.hdpath.HDBasePath`.
"""
def __init__(self, path: str):
path = path.rstrip('... |
#
# PySNMP MIB module NTWS-RF-DETECT-TC (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NTWS-RF-DETECT-TC
# Produced by pysmi-0.3.4 at Wed May 1 14:25:43 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, constraints_intersection, value_range_constraint, single_value_constraint) ... |
# -*- coding: utf-8 -*-
#import ultron.sentry.api as api
#import ultron.sentry.Math as Math
#import ultron.sentry.Analysis as Analysis
#import ultron.sentry.Utilities as Utilities
__all__ = ['__version__']
__version__ = "0.0.1" | __all__ = ['__version__']
__version__ = '0.0.1' |
expected_output ={
"lisp_id": {
0: {
"instance_id": {
8188: {
"eid_table": "Vlan 210",
"entries": 1,
"eid_prefix": {
"0017.0100.0001/48": {
"uptime": "01:13:15",
... | expected_output = {'lisp_id': {0: {'instance_id': {8188: {'eid_table': 'Vlan 210', 'entries': 1, 'eid_prefix': {'0017.0100.0001/48': {'uptime': '01:13:15', 'expiry_time': '22:46:44', 'via': 'map-reply', 'map_reply_state': 'complete', 'prefix_location': 'local-to-site', 'source_type': 'map-reply', 'last_modified': '01:1... |
a = 100
b = 3
print(a % b)
print(divmod(a, b))
| a = 100
b = 3
print(a % b)
print(divmod(a, b)) |
"""
A collection of Python modules used by Open GEE during the build process.
"""
__all__ = ['c_compiler', 'environ', 'version']
| """
A collection of Python modules used by Open GEE during the build process.
"""
__all__ = ['c_compiler', 'environ', 'version'] |
#!usr/bin/env python
#-*-coding:utf-8 -*-
#Filename:Class_Inherit.py
########This chapter is the most beautiful that can be felt from all the based practice
#Multi-inherit to classify
#Main
class Animal(object):
pass
#Big class
class Mammal(Animal):
pass
class Bird(Animal):
pass
#Small class
c... | class Animal(object):
pass
class Mammal(Animal):
pass
class Bird(Animal):
pass
class Dog(Mammal):
pass
class Bat(Mammal):
pass
class Parrot(Bird):
pass
class Ostrich(Bird):
pass
class Runnable(object):
def run(self):
print('Running...')
class Flyable(object):
def fl... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
'''\
Nomad-RPi testing modules.
since: 23-APR-2018
'''
| """Nomad-RPi testing modules.
since: 23-APR-2018
""" |
#!/usr/bin/env python3
"""
Deal with spatial location of the cube.
The grid definition in gpiline, gpxline, gpx, and gpy defines
an affine transform from inline, crossline to world X, Y.
Older ZGY files might use several ways to specify the transform.
Since an affine transform is used it is possible to define a
coor... | """
Deal with spatial location of the cube.
The grid definition in gpiline, gpxline, gpx, and gpy defines
an affine transform from inline, crossline to world X, Y.
Older ZGY files might use several ways to specify the transform.
Since an affine transform is used it is possible to define a
coordinate system where the ... |
ICONS = ['new_file', 'open_file', 'save', 'cut', 'copy', 'paste',
'undo', 'redo', 'find_text']
theme_color = {
'Default': '#000000.#FFFFFF',
'Greygarious': '#83406A.#D1D4D1',
'Aquamarine': '#5B8340.#D1E7E0',
'Bold Beige': '#4B4620.#FFF0E1',
'Cobalt Blue': '#ffff... | icons = ['new_file', 'open_file', 'save', 'cut', 'copy', 'paste', 'undo', 'redo', 'find_text']
theme_color = {'Default': '#000000.#FFFFFF', 'Greygarious': '#83406A.#D1D4D1', 'Aquamarine': '#5B8340.#D1E7E0', 'Bold Beige': '#4B4620.#FFF0E1', 'Cobalt Blue': '#ffffBB.#3333aa', 'Olive Green': '#D1E7E0.#5B8340', 'Night Mode'... |
"""
Given a positive integer, return its corresponding column title as appear in an Excel sheet.
For example:
1 -> A
2 -> B
3 -> C
...
26 -> Z
27 -> AA
28 -> AB
"""
class Solution:
# @param A : integer
# @return a strings
def convertToTitle(self, n):
s = ''
... | """
Given a positive integer, return its corresponding column title as appear in an Excel sheet.
For example:
1 -> A
2 -> B
3 -> C
...
26 -> Z
27 -> AA
28 -> AB
"""
class Solution:
def convert_to_title(self, n):
s = ''
d = {0: 'A', 1: 'B', 2: 'C', 3: 'D', 4: 'E', 5: ... |
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 21 16:40:10 2021
@author: leyuan
reference:
https://github.com/brynhayder/reinforcement_learning_an_introduction/tree/master/code/exercises/ex_5_10
"""
'''
TO DO
''' | """
Created on Wed Apr 21 16:40:10 2021
@author: leyuan
reference:
https://github.com/brynhayder/reinforcement_learning_an_introduction/tree/master/code/exercises/ex_5_10
"""
'\nTO DO\n' |
# -*- coding: utf-8 -*-
"""
jinja.exceptions
~~~~~~~~~~~~~~~~
Jinja exceptions.
:copyright: 2007 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
class TemplateError(RuntimeError):
pass
class SecurityException(TemplateError):
"""
Raise if the template designer tr... | """
jinja.exceptions
~~~~~~~~~~~~~~~~
Jinja exceptions.
:copyright: 2007 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
class Templateerror(RuntimeError):
pass
class Securityexception(TemplateError):
"""
Raise if the template designer tried to do something danger... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"convert_file_to_json": "00-documentation.ipynb",
"encode_file_as_utf8": "00-documentation.ipynb",
"convert_nb_to_md": "00-documentation.ipynb",
"junix.exporter.convert_file_to_json... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'convert_file_to_json': '00-documentation.ipynb', 'encode_file_as_utf8': '00-documentation.ipynb', 'convert_nb_to_md': '00-documentation.ipynb', 'junix.exporter.convert_file_to_json': '00-documentation.ipynb', 'MyHTMLParser': '00-documentation.ipynb... |
"""Create an executable with runfiles.
Runfiles are files that are needed at runtime (when the executable in run).
This example also shows a use of `ctx.expand_location`.
"""
def _impl(ctx):
# Expand the label in the command string to a runfiles-relative path.
# The second arg is the list of labels that may b... | """Create an executable with runfiles.
Runfiles are files that are needed at runtime (when the executable in run).
This example also shows a use of `ctx.expand_location`.
"""
def _impl(ctx):
command = ctx.expand_location(ctx.attr.command, ctx.attr.data)
ctx.actions.write(output=ctx.outputs.executable, content... |
OCTICON_LOCATION = """
<svg class="octicon octicon-location" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M11.536 3.464a5 5 0 010 7.072L8 14.07l-3.536-3.535a5 5 0 117.072-7.072v.001zm1.06 8.132a6.5 6.5 0 10-9.192 0l3.535 3.536a1.5 1.5 0 002.122 0l3.535-3.53... | octicon_location = '\n<svg class="octicon octicon-location" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M11.536 3.464a5 5 0 010 7.072L8 14.07l-3.536-3.535a5 5 0 117.072-7.072v.001zm1.06 8.132a6.5 6.5 0 10-9.192 0l3.535 3.536a1.5 1.5 0 002.122 0l3.535-3.536z... |
# Holds the state of the program, such as the items stored in the inventory
# The State class will only store data, and will not itself perform operations on data
class State:
def __init__(self, targetTier):
# Information about the world
self.itemDependencyGraph = {} # key: name of an ... | class State:
def __init__(self, targetTier):
self.itemDependencyGraph = {}
self.reverseItemDependencyGraph = {}
self.itemToConstituents = {}
self.itemToTier = {}
self.tierToItem = {}
self.tierToItem[targetTier] = []
self.itemNameToNumberOwned = {}
sel... |
"""
Print this Pyramid in python
1
2 3 2
3 4 5 4 3
4 5 6 7 6 5 4
5 6 7 8 9 8 7 6 5
"""
n = 5
num = 1
gap = n - 1
for j in range(1, n + 1):
num = j
for i in range(1, gap - 1):
print(" ", end="")
gap = gap - 1
for i in range(1, j + 1):
print(num, end="")
num ... | """
Print this Pyramid in python
1
2 3 2
3 4 5 4 3
4 5 6 7 6 5 4
5 6 7 8 9 8 7 6 5
"""
n = 5
num = 1
gap = n - 1
for j in range(1, n + 1):
num = j
for i in range(1, gap - 1):
print(' ', end='')
gap = gap - 1
for i in range(1, j + 1):
print(num, end='')
num = ... |
'''
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.
If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is.
You may not alter the values in the nodes, only nodes itself may be changed.
Only constant memory is allowed.
For... | """
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.
If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is.
You may not alter the values in the nodes, only nodes itself may be changed.
Only constant memory is allowed.
For... |
class Solution:
def countRoutes(self, locations: List[int], start: int, finish: int, fuel: int) -> int:
dp = [[-1] * 201 for _ in range(101)]
MOD = 1000000007
def helper(pos, left):
if left < 0:
return 0
if dp[pos][left] != -1:
return d... | class Solution:
def count_routes(self, locations: List[int], start: int, finish: int, fuel: int) -> int:
dp = [[-1] * 201 for _ in range(101)]
mod = 1000000007
def helper(pos, left):
if left < 0:
return 0
if dp[pos][left] != -1:
retur... |
def make_averager():
## Scope average implementation, with nonlocal to best performance.
count = 0
total = 0
def averager(new_value):
nonlocal count, total
count += 1
total += new_value
return total / count
return averager
| def make_averager():
count = 0
total = 0
def averager(new_value):
nonlocal count, total
count += 1
total += new_value
return total / count
return averager |
"""Quicksort with Lomuto partitioning."""
def sort(lst, start=0, stop=None):
"""In-place quicksort.
Args:
lst: List to sort
start: Start index
stop: Stop index
"""
if stop is None:
stop = len(lst)
length = stop - start
if length <= 1:
return
pivot... | """Quicksort with Lomuto partitioning."""
def sort(lst, start=0, stop=None):
"""In-place quicksort.
Args:
lst: List to sort
start: Start index
stop: Stop index
"""
if stop is None:
stop = len(lst)
length = stop - start
if length <= 1:
return
pivot = ... |
class Solution:
def isMatch(self, s, p):
def compare(a, b):
return a == '.' or a == b
s = '=' + s + '='
p = '=' + p + '='
n = len(s)
m = len(p)
flag = [0] * n
flag[0] = 1
cur = 1
while cur < m:
target = p[cur]
... | class Solution:
def is_match(self, s, p):
def compare(a, b):
return a == '.' or a == b
s = '=' + s + '='
p = '=' + p + '='
n = len(s)
m = len(p)
flag = [0] * n
flag[0] = 1
cur = 1
while cur < m:
target = p[cur]
... |
'''
01 - Bar chart
Bar charts visualize data that is organized according to categories as a series of
bars, where the height of each bar represents the values of the data in this category.
For example, in this exercise, you will visualize the number of gold medals won by each
country in the provided me... | """
01 - Bar chart
Bar charts visualize data that is organized according to categories as a series of
bars, where the height of each bar represents the values of the data in this category.
For example, in this exercise, you will visualize the number of gold medals won by each
country in the provided me... |
print("There once was a man named John")
print("he was 35 years old.")
print("He really liked the name John, ")
print("but didnt like being 35")
""" Basically there are several types of variables in python. Booleans, Strings, Floats, etc.
We can call any variables as the name we want to. Just by typping Variable... | print('There once was a man named John')
print('he was 35 years old.')
print('He really liked the name John, ')
print('but didnt like being 35')
' Basically there are several types of variables in python. Booleans, Strings, Floats, etc.\nWe can call any variables as the name we want to. Just by typping Variable_name = ... |
SPOTIFY_SCOPE = "user-read-playback-state user-modify-playback-state"
SPOTIFY_CLIENT_ID = "123123adads"
SPOTIFY_CLIENT_SECRET = "76756757jgjghgjh"
# don't change or don't forget to update app.py as well
SPOTIFY_REDIRECT_URI = "http://localhost:8080/callback"
| spotify_scope = 'user-read-playback-state user-modify-playback-state'
spotify_client_id = '123123adads'
spotify_client_secret = '76756757jgjghgjh'
spotify_redirect_uri = 'http://localhost:8080/callback' |
words = input().split(" ")
dictionary = {}
for current_word in words:
current_word = current_word.lower()
if current_word not in dictionary:
dictionary[current_word] = 0
dictionary[current_word] += 1
for key, value in dictionary.items():
if value % 2 != 0:
print(key, end=" ") | words = input().split(' ')
dictionary = {}
for current_word in words:
current_word = current_word.lower()
if current_word not in dictionary:
dictionary[current_word] = 0
dictionary[current_word] += 1
for (key, value) in dictionary.items():
if value % 2 != 0:
print(key, end=' ') |
class FunctionNotAllowed(Exception):
...
class TelegramBaseException(Exception):
...
class TelegramAPIException(TelegramBaseException):
...
class TelegramDataObjectException(TelegramBaseException):
...
class HandlerException(TelegramBaseException):
...
class HandlerCloseException(TelegramB... | class Functionnotallowed(Exception):
...
class Telegrambaseexception(Exception):
...
class Telegramapiexception(TelegramBaseException):
...
class Telegramdataobjectexception(TelegramBaseException):
...
class Handlerexception(TelegramBaseException):
...
class Handlercloseexception(TelegramBaseEx... |
class Solution(object):
def myPow(self, x, n):
"""
:type x: float
:type n: int
:rtype: float
"""
if n == 0:
return 1.0
if n < 0:
return 1.0/self.myPow(x, -n)
tmp = self.myPow(x, n/2)
if n%2 == 0:
return tmp*t... | class Solution(object):
def my_pow(self, x, n):
"""
:type x: float
:type n: int
:rtype: float
"""
if n == 0:
return 1.0
if n < 0:
return 1.0 / self.myPow(x, -n)
tmp = self.myPow(x, n / 2)
if n % 2 == 0:
retu... |
# 12. Integer to Roman(https://leetcode.com/problems/integer-to-roman/)
# Question: Given an integer, convert it to a roman numeral.
# Solution: https://www.w3resource.com/python-exercises/class-exercises/python-class-exercise-1.php
# Ideas:
"""
Get num divided by roman units, starting from the largest, till result ... | """
Get num divided by roman units, starting from the largest, till result is less than or euqal to 0;
and save correspondence syb.
"""
' \n1. let num conduct floor division with each roman unit (starting from the larges);\n2. pass the result as a arg to range(). If range(0), the for loop will return nothing and ex... |
def check_bunch_match(bunch, symbol):
res = True
for one in bunch:
if one != symbol:
res = False
break
return res
def get_ttt_winner(board):
r, c = len(board), len(board[0])
for symbol in "XO":
for ri in range(r):
row = board[ri]
if ... | def check_bunch_match(bunch, symbol):
res = True
for one in bunch:
if one != symbol:
res = False
break
return res
def get_ttt_winner(board):
(r, c) = (len(board), len(board[0]))
for symbol in 'XO':
for ri in range(r):
row = board[ri]
i... |
def concat(*args, sep="/"):
return sep.join(args)
print(concat("earth", "mars", "venus"))
print(*list(range(5,10))) | def concat(*args, sep='/'):
return sep.join(args)
print(concat('earth', 'mars', 'venus'))
print(*list(range(5, 10))) |
def create_dictionaries():
JupiterMoons = ('Io','Europa','Ganymede','Callisto')
Radius = (1821.6,1560.8,2634.1,2410.3)
Gravity = (1.796,1.314,1.438,1.235)
Orbit = (1.769,3.551,7.154,16.689)
MeanRadius = dict()
SurfaceGravity = dict()
OrbitalPeriod = dict()
for index in range(len(JupiterM... | def create_dictionaries():
jupiter_moons = ('Io', 'Europa', 'Ganymede', 'Callisto')
radius = (1821.6, 1560.8, 2634.1, 2410.3)
gravity = (1.796, 1.314, 1.438, 1.235)
orbit = (1.769, 3.551, 7.154, 16.689)
mean_radius = dict()
surface_gravity = dict()
orbital_period = dict()
for index in ra... |
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# 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 applica... | class Sourcenotavailable(RuntimeError):
"""The requested data source is unavailable."""
class Sourcenotconfigured(RuntimeError):
"""The requested data source is not configured."""
class Ec2Metadatanotavailable(SourceNotAvailable):
"""The EC2 metadata service is not available."""
class Cfnmetadatanotavail... |
# Copyright 2018 - Nokia Corporation
#
# 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 or agreed to in ... | def db_row_to_dict(row):
return {'id': row.id, 'project_id': row.project_id, 'is_admin_webhook': row.is_admin_webhook, 'created_at': row.created_at, 'url': row.url, 'regex_filter': row.regex_filter, 'headers': row.headers} |
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
n = float(input("Enter no.: "))
i = int(n)
f = n - i
d = ""
for t in range(4):
f *= 2
p = int(f)
d += str(p)
f -= p
print("{0}.{1}".format(bin(i), d))
| """
Spyder Editor
This is a temporary script file.
"""
n = float(input('Enter no.: '))
i = int(n)
f = n - i
d = ''
for t in range(4):
f *= 2
p = int(f)
d += str(p)
f -= p
print('{0}.{1}'.format(bin(i), d)) |
USER_AGENT_PRODUCT: str = "uHoo"
USER_AGENT_PRODUCT_VERSION: str = "10.3.1"
USER_AGENT_SYSTEM_INFORMATION: str = "iPhone;13.3; iOS 14.7.1; Scale/3.00"
APP_VERSION: int = 93
CLIENT_ID: str = "0000000000000000000|0000000000000000000"
| user_agent_product: str = 'uHoo'
user_agent_product_version: str = '10.3.1'
user_agent_system_information: str = 'iPhone;13.3; iOS 14.7.1; Scale/3.00'
app_version: int = 93
client_id: str = '0000000000000000000|0000000000000000000' |
def decoupling_softing_prepare(graph, sigma_square,lambda_input):
# get W matrix, Z(for row sum) and Z_prime(for col sum), and A_tilde
# get matrix W:
A = np.array(nx.adjacency_matrix(graph).todense())
d = np.sum(A, axis=1)
D = np.diag(d)
# Alternative way(19): set Sigma_square = sigma_square./... | def decoupling_softing_prepare(graph, sigma_square, lambda_input):
a = np.array(nx.adjacency_matrix(graph).todense())
d = np.sum(A, axis=1)
d = np.diag(d)
sigma_square = np.divide(sigma_square, d)
sigma = np.diag(Sigma_square)
w = np.dot(A, inv(Sigma))
w_col_sum = np.sum(W, axis=0)
w_row... |
def one_away(string1,string2):
idx = 0
if(len(string1) > len(string2)):
aux = string1
string2 = string1
string1 = aux
if(len(string2) -len(string1) > 1):
return False
while(idx < len(string1) and idx < len(string2)):
char1 = string1[idx]
char2 = str... | def one_away(string1, string2):
idx = 0
if len(string1) > len(string2):
aux = string1
string2 = string1
string1 = aux
if len(string2) - len(string1) > 1:
return False
while idx < len(string1) and idx < len(string2):
char1 = string1[idx]
char2 = string2[idx... |
#!/usr/bin/env python3 -tt
def doAttackNavigator(case, nav_list, eachtechnique):
nav_pairs = {
"T1001": "{\n \"techniqueID\": \"T1001\",\n \"tactic\": \"command-and-control\",\n \"color\": \"#00ACB4\",\n \"comment\": \"\",\n \"enabled\": true,\n ... | def do_attack_navigator(case, nav_list, eachtechnique):
nav_pairs = {'T1001': '{\n "techniqueID": "T1001",\n "tactic": "command-and-control",\n "color": "#00ACB4",\n "comment": "",\n "enabled": true,\n "metadata": [],\n "showSubtechniques"... |
def preprocess_sotu_text(text):
removed_applause_text = text.replace('(Applause.)', ' ')
removed_ddash_text = removed_applause_text.replace('--', ' ')
processed_text = removed_ddash_text
return processed_text | def preprocess_sotu_text(text):
removed_applause_text = text.replace('(Applause.)', ' ')
removed_ddash_text = removed_applause_text.replace('--', ' ')
processed_text = removed_ddash_text
return processed_text |
def executar(n, lista):
for i in range(n):
lista += str(i + 1) + "\t"
print(lista)
lista = ''
n = int(input("Digite n: "))
executar(n, lista)
| def executar(n, lista):
for i in range(n):
lista += str(i + 1) + '\t'
print(lista)
lista = ''
n = int(input('Digite n: '))
executar(n, lista) |
def ingredient_translator(recipe_info):
"""This function creates common words for synonymous ingredient names"""
for c1, r in enumerate(recipe_info): # for each recipe r and its counter c
for c2, i in enumerate(r['ingredients']): # for each ingredient of this recipe
# SPICES
... | def ingredient_translator(recipe_info):
"""This function creates common words for synonymous ingredient names"""
for (c1, r) in enumerate(recipe_info):
for (c2, i) in enumerate(r['ingredients']):
if i.lower() in ['sea salt', 'seasoning salt', 'salt to taste', 'season salt', 'kosher salt', 's... |
my_tuple = (1, 2, 3)
str_tuple = ('hello!',)
print("Tuple Length:", len(my_tuple))
print("Concatenation with (3, 4):", my_tuple + (3, 4))
print("Multiplication:", str_tuple*2)
print("Search. Is 2 in my_tuple?", 2 in my_tuple)
print("Values in my_tuple:")
for x in my_tuple:
print(x) | my_tuple = (1, 2, 3)
str_tuple = ('hello!',)
print('Tuple Length:', len(my_tuple))
print('Concatenation with (3, 4):', my_tuple + (3, 4))
print('Multiplication:', str_tuple * 2)
print('Search. Is 2 in my_tuple?', 2 in my_tuple)
print('Values in my_tuple:')
for x in my_tuple:
print(x) |
class Car:
def __init__(self, engine):
self.engine = engine
def run(self):
self.engine.start()
class Engine:
def start(self):
print("Engine started!")
trinity5_8 = Engine()
ford = Car(trinity5_8)
ford.run() | class Car:
def __init__(self, engine):
self.engine = engine
def run(self):
self.engine.start()
class Engine:
def start(self):
print('Engine started!')
trinity5_8 = engine()
ford = car(trinity5_8)
ford.run() |
__author__ = 'fmontes'
class ContributionStats:
def __init__(self, contributor_name, line_count):
self.contributor_name = contributor_name
self.contributed_lines = line_count
def average(self, total_lines_to_consider=1):
return float(self.contributed_lines) / float(total_lines_to_con... | __author__ = 'fmontes'
class Contributionstats:
def __init__(self, contributor_name, line_count):
self.contributor_name = contributor_name
self.contributed_lines = line_count
def average(self, total_lines_to_consider=1):
return float(self.contributed_lines) / float(total_lines_to_cons... |
class A(object):
def __init__(self):
self.value = "Some Value"
def return_true(self):
return True
def raise_exc(self, val):
raise KeyError(val)
| class A(object):
def __init__(self):
self.value = 'Some Value'
def return_true(self):
return True
def raise_exc(self, val):
raise key_error(val) |
# coding=utf-8
FLODER_AUTH = 'auth'
HTTP_OR_HTTPS = 'https://'
AGENT_WEIXIN = 'MicroMessenger'
AGENT_ALIPAY = 'AlipayClient'
AGENT_WEIBO = 'Weibo'
AGENT_QQ = 'QQ'
TEMPLATE_FOOTER = \
"<script language=javascript src='/r/theme/whiteconsole/scripts/jquery-3.3.1.min.js'></script>\
<script language=javascript sr... | floder_auth = 'auth'
http_or_https = 'https://'
agent_weixin = 'MicroMessenger'
agent_alipay = 'AlipayClient'
agent_weibo = 'Weibo'
agent_qq = 'QQ'
template_footer = "<script language=javascript src='/r/theme/whiteconsole/scripts/jquery-3.3.1.min.js'></script> <script language=javascript src='/r/plugin/baiduTemplate... |
"""
ydf
~~~
:copyright: (c) 2017 Andrew Hawker
:license: Apache 2.0, see LICENSE file
"""
__version__ = '0.0.1'
| """
ydf
~~~
:copyright: (c) 2017 Andrew Hawker
:license: Apache 2.0, see LICENSE file
"""
__version__ = '0.0.1' |
class Triangle(object):
def __init__(self, angle1, angle2, angle3):
self.angle1 = angle1
self.angle2 = angle2
self.angle3 = angle3
number_of_sides = 3
def check_angles(self):
if (self.angle1 + self.angle2 + self.angle3) == 180:
return True
else:
... | class Triangle(object):
def __init__(self, angle1, angle2, angle3):
self.angle1 = angle1
self.angle2 = angle2
self.angle3 = angle3
number_of_sides = 3
def check_angles(self):
if self.angle1 + self.angle2 + self.angle3 == 180:
return True
else:
... |
# https://binarysearch.com/
# GGA 2020.10.27
#
# User Problem
# You have: int
# You Need: each digit ^ number of dig
# You Must:
#
# Solution (Feature/Product)
#
# Edge cases:
#
# input-ouput-example:
# Given an integer n, return whether it is equal to the
# sum of its own digits raised to the power of the
# number... | class Solution:
def solve(self, nums):
len_dig = len(str(nums))
solution = 0
numlist_1 = list(str(nums))
numlist_2 = [int(i) for i in numlist_1]
for i in numlist_2:
solution += i ** len_dig
return nums == solution
tom = solution()
Tom.solve(153) |
class ContainerFilterService(object):
""" Provides a base class for the container filter service. """
def ZZZ(self):
"""hardcoded/mock instance of the class"""
return ContainerFilterService()
instance=ZZZ()
"""hardcoded/returns an instance of the class"""
def FilterComponents(self,components):
"""
... | class Containerfilterservice(object):
""" Provides a base class for the container filter service. """
def zzz(self):
"""hardcoded/mock instance of the class"""
return container_filter_service()
instance = zzz()
'hardcoded/returns an instance of the class'
def filter_components(self... |
# Python program to demonstrate delete operation
# in binary search tree
# A Binary Tree Node
class Node:
# Constructor to create a new node
def __init__(self, key):
self.key = key
self.left = None
self.right = None
def inorder(root):
if root is not None:
inorder(root.left)
print... | class Node:
def __init__(self, key):
self.key = key
self.left = None
self.right = None
def inorder(root):
if root is not None:
inorder(root.left)
(print(root.key),)
inorder(root.right)
def preorder(root):
if root is not None:
print(root.key)
... |
# -*- coding: utf-8 -*-
# Copyright 2021 Cohesity Inc.
class RemovalStateEnum(object):
"""Implementation of the 'RemovalState' enum.
Specifies the current healing state of the Cluster.
'kNoRemoval' indicates that there are no removal operations currently
happening on the Cluster.
'kNodeRemoval' i... | class Removalstateenum(object):
"""Implementation of the 'RemovalState' enum.
Specifies the current healing state of the Cluster.
'kNoRemoval' indicates that there are no removal operations currently
happening on the Cluster.
'kNodeRemoval' indicates that there is a Node being removed from the
... |
while True:
s=input().split()
if len(s)==1 and len(s[0])==1 and s[0]=='*':break
tam=len(s)
f=[]
for i in range(tam):f.append(s[i][0].lower())
tam=len(f)
print("Y") if f.count(f[0])==tam else print("N")
| while True:
s = input().split()
if len(s) == 1 and len(s[0]) == 1 and (s[0] == '*'):
break
tam = len(s)
f = []
for i in range(tam):
f.append(s[i][0].lower())
tam = len(f)
print('Y') if f.count(f[0]) == tam else print('N') |
def releaseleftclothes():
##arms get to middle
i01.setHandSpeed("left", 1.0, 0.80, 0.80, 0.80, 1.0, 0.80)
i01.setHandSpeed("right", 1.0, 0.70, 0.70, 1.0, 1.0, 0.80)
i01.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0)
i01.setArmSpeed("right", 1.0, 1.0, 1.0, 1.0)
i01.setHeadSpeed(0.90, 0.80)
i0... | def releaseleftclothes():
i01.setHandSpeed('left', 1.0, 0.8, 0.8, 0.8, 1.0, 0.8)
i01.setHandSpeed('right', 1.0, 0.7, 0.7, 1.0, 1.0, 0.8)
i01.setArmSpeed('left', 1.0, 1.0, 1.0, 1.0)
i01.setArmSpeed('right', 1.0, 1.0, 1.0, 1.0)
i01.setHeadSpeed(0.9, 0.8)
i01.setTorsoSpeed(1.0, 0.8, 1.0)
i01.mo... |
stats = airline[['Year', 'Passengers']].groupby('Year').mean()
stats['Max'] = airline[['Year', 'Passengers']].groupby('Year').max()
stats['Min'] = airline[['Year', 'Passengers']].groupby('Year').min()
stats['Range'] = stats['Max']-stats['Min']
ax = stats.plot(y='Passengers', yerr='Range', legend=False)
ax.set_ylabel(r... | stats = airline[['Year', 'Passengers']].groupby('Year').mean()
stats['Max'] = airline[['Year', 'Passengers']].groupby('Year').max()
stats['Min'] = airline[['Year', 'Passengers']].groupby('Year').min()
stats['Range'] = stats['Max'] - stats['Min']
ax = stats.plot(y='Passengers', yerr='Range', legend=False)
ax.set_ylabel(... |
"""Helper macro to compile and test code samples."""
def code_sample_cc(name):
native.cc_binary(
name = name,
srcs = [name + ".cc"],
deps = [
"//ortools/sat:cp_model",
"//ortools/sat:cp_model_solver",
"//ortools/util:sorted_interval_list",
"@c... | """Helper macro to compile and test code samples."""
def code_sample_cc(name):
native.cc_binary(name=name, srcs=[name + '.cc'], deps=['//ortools/sat:cp_model', '//ortools/sat:cp_model_solver', '//ortools/util:sorted_interval_list', '@com_google_absl//absl/types:span'])
native.cc_test(name=name + '_test', size=... |
n = 0
while True:
inn = input()
if inn == '0':
break
n += int(inn)
print(n)
| n = 0
while True:
inn = input()
if inn == '0':
break
n += int(inn)
print(n) |
"""
This package implements the MSAL flow to obtain a personal api token for an instance
of azure databricks without using the web interface.
see url:
https://docs.microsoft.com/en-us/azure/databricks/dev-tools/api/latest/aad/app-aad-token
see also:
https://docs.microsoft.com/en-us/azure/active-directory/develop/repl... | """
This package implements the MSAL flow to obtain a personal api token for an instance
of azure databricks without using the web interface.
see url:
https://docs.microsoft.com/en-us/azure/databricks/dev-tools/api/latest/aad/app-aad-token
see also:
https://docs.microsoft.com/en-us/azure/active-directory/develop/repl... |
PAS = 'pass'
INF = float('inf')
class Expectimax:
def __init__(self, max_who, rules):
self.max_who = max_who
self.rules = rules
def value(self, state, agent_id, depth):
if state.is_over() or depth <= 0:
return self.evaluation_function(state, agent_id)
if agent_id =... | pas = 'pass'
inf = float('inf')
class Expectimax:
def __init__(self, max_who, rules):
self.max_who = max_who
self.rules = rules
def value(self, state, agent_id, depth):
if state.is_over() or depth <= 0:
return self.evaluation_function(state, agent_id)
if agent_id =... |
class Target:
"""
This must be consist of <app_label>.<modal>.<field>
"""
pass
class StorageProvider:
S3 = 's3'
CLOUDINARY = 'cloudinary'
PROVIDERS = (StorageProvider.S3, StorageProvider.CLOUDINARY)
| class Target:
"""
This must be consist of <app_label>.<modal>.<field>
"""
pass
class Storageprovider:
s3 = 's3'
cloudinary = 'cloudinary'
providers = (StorageProvider.S3, StorageProvider.CLOUDINARY) |
substrings = ['These', 'are', 'strings', 'to', 'concatanate.']
s = ' '
# Highly inefficient
# for substring in substrings:
# s += substring
# print(s)
s = ' '.join(substrings)
print(s)
# OR using an "unbound" method call
x = str.join(' ', substrings)
print(x)
| substrings = ['These', 'are', 'strings', 'to', 'concatanate.']
s = ' '
s = ' '.join(substrings)
print(s)
x = str.join(' ', substrings)
print(x) |
def main():
n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
if n==1 or n==2:
print(0)
for i in l:
print(i, end=' ')
print()
return
flag = 0
ind = n//2
while(l[ind]==l[ind+1] and ind>0):
ind -= 1
flag = 1... | def main():
n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
if n == 1 or n == 2:
print(0)
for i in l:
print(i, end=' ')
print()
return
flag = 0
ind = n // 2
while l[ind] == l[ind + 1] and ind > 0:
ind -= 1
flag = ... |
expected_output = {
'eigrp_instance': {
'100': {
'vrf': {
'default': {
'address_family': {
'ipv6': {
'eigrp_interface': {
'Ethernet1/1.90': {
... | expected_output = {'eigrp_instance': {'100': {'vrf': {'default': {'address_family': {'ipv6': {'eigrp_interface': {'Ethernet1/1.90': {'eigrp_nbr': {'fe80::f816:3eff:fecf:5a5b': {'peer_handle': 0, 'hold': 12, 'uptime': '01:40:09', 'srtt': 0.01, 'rto': 60, 'q_cnt': 0, 'last_seq_number': 30}}}, 'Ethernet1/2.90': {'eigrp_nb... |
class Solution:
def subsetsWithDup(self, nums: List[int], sorted: bool = False) -> List[List[int]]:
if not nums: return [[]]
if len(nums) == 1: return [[], nums]
if not sorted: nums.sort()
pre_lists = self.subsetsWithDup(nums[:-1], sorted=True)
all_lists = [i + [nums[-1]] for... | class Solution:
def subsets_with_dup(self, nums: List[int], sorted: bool=False) -> List[List[int]]:
if not nums:
return [[]]
if len(nums) == 1:
return [[], nums]
if not sorted:
nums.sort()
pre_lists = self.subsetsWithDup(nums[:-1], sorted=True)
... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 5 17:51:53 2021
@author: kody
"""
S = 6
count = 1
for x in range(1,7):
print(int(input("Enter grade")) + x) | """
Created on Mon Jul 5 17:51:53 2021
@author: kody
"""
s = 6
count = 1
for x in range(1, 7):
print(int(input('Enter grade')) + x) |
"""
1. Clarification
2. Possible solutions
- Prefix sum + Hash
3. Coding
4. Tests
"""
# T=O(m^2 * n), S=O(n), see also leetcode 560
class Solution:
def numSubmatrixSumTarget(self, matrix: List[List[int]], target: int) -> int:
def subarraySum(nums: List[int], k: int) -> int:
mp = collection... | """
1. Clarification
2. Possible solutions
- Prefix sum + Hash
3. Coding
4. Tests
"""
class Solution:
def num_submatrix_sum_target(self, matrix: List[List[int]], target: int) -> int:
def subarray_sum(nums: List[int], k: int) -> int:
mp = collections.Counter([0])
count = pre = ... |
def path_from_root_to_node(root, data):
"""
Assuming data as input to find the node
The solution can be easily changed to find a node instead of data
:param data:
:return:
"""
output = path_from_node_to_root(root, data)
return list(reversed(output))
def path_from_node_to_root(root, data... | def path_from_root_to_node(root, data):
"""
Assuming data as input to find the node
The solution can be easily changed to find a node instead of data
:param data:
:return:
"""
output = path_from_node_to_root(root, data)
return list(reversed(output))
def path_from_node_to_root(root, data... |
#!/usr/bin/env python
# mode - Degree of scanning done by service modules.
# Default is 'normal', 2nd option is 'stealth'.
mode = 'normal'
| mode = 'normal' |
# -*- coding: utf-8 -*-
"""
x tools for easy work
"""
| """
x tools for easy work
""" |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Custom filters for use in openshift-ansible
"""
# Disabling too-many-public-methods, since filter methods are necessarily
# public
# pylint: disable=too-many-public-methods
class FilterModule(object):
""" Custom ansible filters """
@staticmethod
def oo_cert_e... | """
Custom filters for use in openshift-ansible
"""
class Filtermodule(object):
""" Custom ansible filters """
@staticmethod
def oo_cert_expiry_results_to_json(hostvars, play_hosts):
"""Takes results (`hostvars`) from the openshift_cert_expiry role
check and serializes them into proper machine-rea... |
arr=[1,0,-1,0,-2,2]
target=0
def four_sum( arr, target):
hash_map = dict()
arr.sort()
result = set()
for i in range(len(arr)):
for j in range(i + 1, len(arr)):
curr_sum = arr[i] + arr[j]
diff = target - curr_sum
if diff in hash_map:
... | arr = [1, 0, -1, 0, -2, 2]
target = 0
def four_sum(arr, target):
hash_map = dict()
arr.sort()
result = set()
for i in range(len(arr)):
for j in range(i + 1, len(arr)):
curr_sum = arr[i] + arr[j]
diff = target - curr_sum
if diff in hash_map:
fo... |
class Reader:
def __init__(self, checker, size: int):
self.checker = checker
self.size = size
def read(self, path: str):
f = open(path, 'rb')
data = [0] * self.size
for i in range(self.size):
data[i] = [0] * self.size
col = 0
row = 0
... | class Reader:
def __init__(self, checker, size: int):
self.checker = checker
self.size = size
def read(self, path: str):
f = open(path, 'rb')
data = [0] * self.size
for i in range(self.size):
data[i] = [0] * self.size
col = 0
row = 0
... |
# Author Maria carroll
# Week 2
# https://www.w3resource.com/python-exercises/python-basic-exercise-66.php
# Lecture 2 Statements
# Lecturer: Andrew Beatty
#Here we are writng a program to take information from the user to assertain a bmi result from their input
height = float(input ("Enter height in metres: "))
w... | height = float(input('Enter height in metres: '))
weight = float(input('Enter weight in in kg: '))
bmi = weight / height ** 2
print('Your BMI is: {0} and you are: '.format(bmi), end='')
if bmi < 16:
print('obese')
elif bmi >= 16 and bmi < 18.5:
print('underweight')
elif bmi >= 18.5 and bmi < 25:
print('Heal... |
def pause_game(game):
for i in range(1):
r = game.make_action([False, False, False])
def spawn_agent(game, x, y, orientation=0):
x_pos, y_pos = to_acs_float(x), to_acs_float(y)
game.send_game_command("pukename set_position %i %i %i" %
(x_pos, y_pos, orientation))
# pa... | def pause_game(game):
for i in range(1):
r = game.make_action([False, False, False])
def spawn_agent(game, x, y, orientation=0):
(x_pos, y_pos) = (to_acs_float(x), to_acs_float(y))
game.send_game_command('pukename set_position %i %i %i' % (x_pos, y_pos, orientation))
def spawn_object(game, object_... |
# Is Graph Bipartite?: https://leetcode.com/problems/is-graph-bipartite/
# There is an undirected graph with n nodes, where each node is numbered between 0 and n - 1. You are given a 2D array graph, where graph[u] is an array of nodes that node u is adjacent to. More formally, for each v in graph[u], there is an undir... | class Solution:
def is_bipartite(self, graph) -> bool:
visited = {}
self.hasFaled = False
def dfs(node, color=0):
if node in visited:
if visited[node] ^ color:
self.hasFaled = True
return False
return True
... |
"""
Write a function that takes in an array of integers and returns a sorted version of that array. Use the QuickSort algorithm to sort the array.
"""
def quick_sort(array):
if len(array) <= 1:
return array
_rec_helper(array, 0, len(array) - 1)
return array
def _rec_helper(array, start, end):
... | """
Write a function that takes in an array of integers and returns a sorted version of that array. Use the QuickSort algorithm to sort the array.
"""
def quick_sort(array):
if len(array) <= 1:
return array
_rec_helper(array, 0, len(array) - 1)
return array
def _rec_helper(array, start, end):
... |
def _get_main(ctx):
if ctx.file.main:
return ctx.workspace_name + "/" + ctx.file.main.path
main = ctx.label.name + ".py"
for src in ctx.files.srcs:
if src.basename == main:
return ctx.workspace_name + "/" + src.path
fail(
"corresponding default '{}' does not appear in... | def _get_main(ctx):
if ctx.file.main:
return ctx.workspace_name + '/' + ctx.file.main.path
main = ctx.label.name + '.py'
for src in ctx.files.srcs:
if src.basename == main:
return ctx.workspace_name + '/' + src.path
fail("corresponding default '{}' does not appear in srcs. ".... |
def aMax (list):
if len(list) == 0:
return None
max = list[0]
for item in list:
if item > max:
max = item
return max
def aMin (list):
if len(list) == 0:
return None
min = list[0]
for item in list:
if item < min:
... | def a_max(list):
if len(list) == 0:
return None
max = list[0]
for item in list:
if item > max:
max = item
return max
def a_min(list):
if len(list) == 0:
return None
min = list[0]
for item in list:
if item < min:
min = item
return m... |
"""Character count
This program counts how often each character appears in a string.
"""
def main():
message = 'It was a bright cold day in April, and the clocks were striking thirteen.'
"""str: Message to count characters."""
count = {}
"""dict: Characters as keys and counts as values."""
... | """Character count
This program counts how often each character appears in a string.
"""
def main():
message = 'It was a bright cold day in April, and the clocks were striking thirteen.'
'str: Message to count characters.'
count = {}
'dict: Characters as keys and counts as values.'
for character ... |
load(
"@rules_mono//dotnet/private:providers.bzl",
"DotnetLibrary",
)
def _make_runner_arglist(dotnet, source, output):
args = dotnet.actions.args()
args.add("/useSourcePath")
if type(source) == "Target":
args.add_all(source.files)
else:
args.add(source)
args.add(output)
... | load('@rules_mono//dotnet/private:providers.bzl', 'DotnetLibrary')
def _make_runner_arglist(dotnet, source, output):
args = dotnet.actions.args()
args.add('/useSourcePath')
if type(source) == 'Target':
args.add_all(source.files)
else:
args.add(source)
args.add(output)
return arg... |
try:
f = open("myfile","w")
a,b = [int(x) for x in input("Enter two numbers:").split()]
c = a/b
f.write("Writing %d into file" %c)
except ZeroDivisionError:
print("Division by zero is not allowed")
print("Please enter a non zero number")
finally:
f.close() # Writi... | try:
f = open('myfile', 'w')
(a, b) = [int(x) for x in input('Enter two numbers:').split()]
c = a / b
f.write('Writing %d into file' % c)
except ZeroDivisionError:
print('Division by zero is not allowed')
print('Please enter a non zero number')
finally:
f.close()
print('File Closed')
pri... |
"""
Article object, read in from json
"""
class Article(object):
def __init__(self, head, lead, body,
date, time, writers,
publisher, source_outlet,
additional_information, annotation_list,
feature_list, raw_article):
"""
:param h... | """
Article object, read in from json
"""
class Article(object):
def __init__(self, head, lead, body, date, time, writers, publisher, source_outlet, additional_information, annotation_list, feature_list, raw_article):
"""
:param head: Headline of the article
:param lead: Lead paragraph of ... |
class Solution(object):
def findKthLargest(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: int
"""
pivot = random.choice(nums);
nums1, nums2 = [], []
for num in nums:
if num > pivot:
nums1.append(num)
eli... | class Solution(object):
def find_kth_largest(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: int
"""
pivot = random.choice(nums)
(nums1, nums2) = ([], [])
for num in nums:
if num > pivot:
nums1.append(num)
... |
# File: cofenseintelligence_consts.py
#
# Copyright (c) 2020-2021 Splunk Inc.
#
# 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 req... | phishme_api_search = 'https://www.threathq.com/apiv1'
phishme_api_threat_update = '/threat/updates'
phishme_endpoint = '/threat/search'
phishme_endpoint_get_report_malware = '/threat/malware/'
phishme_err_api_unsupported_method = 'Unsupported method {method}'
phishme_connection_test_msg = 'Querying endpoint to verify t... |
# -*- coding: utf-8 -*-
"""
Global fixtures for testing CastorStudy
@author: R.C.A. van Linschoten
https://orcid.org/0000-0003-3052-596X
"""
pytest_plugins = [
"tests.test_castor_objects.fixtures_castor_objects",
"tests.test_integration.fixtures_integration",
"tests.test_api_endpoints.fixtures_api",
"... | """
Global fixtures for testing CastorStudy
@author: R.C.A. van Linschoten
https://orcid.org/0000-0003-3052-596X
"""
pytest_plugins = ['tests.test_castor_objects.fixtures_castor_objects', 'tests.test_integration.fixtures_integration', 'tests.test_api_endpoints.fixtures_api', 'tests.test_import.fixtures_import'] |
n=int(input("enter year\n"))
if(n%400==0 and n%100==0):
print("leap year")
elif(n%4==0 and n%100!=0):
print("leap year")
else:
print("not leap year")
| n = int(input('enter year\n'))
if n % 400 == 0 and n % 100 == 0:
print('leap year')
elif n % 4 == 0 and n % 100 != 0:
print('leap year')
else:
print('not leap year') |
def create_new(numbers):
n = len(numbers)
keys = [None for i in range(2 * n)]
for num in numbers:
idx = num % len(keys)
while keys[idx] is not None:
idx = (idx + 1) % len(keys)
keys[idx] = num
return keys
def create_new_broken(numbers):
n = len(numbers)
... | def create_new(numbers):
n = len(numbers)
keys = [None for i in range(2 * n)]
for num in numbers:
idx = num % len(keys)
while keys[idx] is not None:
idx = (idx + 1) % len(keys)
keys[idx] = num
return keys
def create_new_broken(numbers):
n = len(numbers)
keys ... |
class Solution:
def isHappy(self, n: int) -> bool:
x=[]
def Happy(n,x):
t,k=0,0
while n>0:
t=n%10
n=n//10
k=k+t*t
if k==1:
return True
else:
if k in x:
... | class Solution:
def is_happy(self, n: int) -> bool:
x = []
def happy(n, x):
(t, k) = (0, 0)
while n > 0:
t = n % 10
n = n // 10
k = k + t * t
if k == 1:
return True
elif k in x:
... |
def draw_mem():
c_width = int( w.Canvas2.cget( "width" ))
c_height = int( w.Canvas2.cget( "height" ))
print( c_width )
box_start = c_width * 0.05
box_end = c_width * 0.95
mem_title = w.Canvas2.create_text(( c_width / 2 ), 10, fill = "black", font = "Times 10", text = "Flash" )
mem1 = w.Canva... | def draw_mem():
c_width = int(w.Canvas2.cget('width'))
c_height = int(w.Canvas2.cget('height'))
print(c_width)
box_start = c_width * 0.05
box_end = c_width * 0.95
mem_title = w.Canvas2.create_text(c_width / 2, 10, fill='black', font='Times 10', text='Flash')
mem1 = w.Canvas2.create_rectangle... |
disease_name = 'COVID-19'
# Prob. of fatality (https://www.worldometers.info/coronavirus/coronavirus-age-sex-demographics):
p_covid19_fat_by_age_group = {
'0-9' : 0.000,
'10-19' : 0.002,
'20-29' : 0.002,
'30-39' : 0.002,
'40-49' : 0.004,
'50-59' : 0.013,
'60-69' : 0.036,
'70-79' : 0.0... | disease_name = 'COVID-19'
p_covid19_fat_by_age_group = {'0-9': 0.0, '10-19': 0.002, '20-29': 0.002, '30-39': 0.002, '40-49': 0.004, '50-59': 0.013, '60-69': 0.036, '70-79': 0.08, '80+': 0.148}
p_covid19_fat_by_age_group_comb = {'0-50': 0.002, '50-59': 0.013, '60-69': 0.036, '70-79': 0.08, '80+': 0.148}
p_covid19_fat = ... |
def test_snap100_component_sub_pages(component_map, dash_doc):
for _, grouper in component_map:
for resources in grouper:
href = "/".join(resources)
dash_doc.visit_and_snapshot(
href, hook_id="wait-for-page-/{}".format(href)
)
| def test_snap100_component_sub_pages(component_map, dash_doc):
for (_, grouper) in component_map:
for resources in grouper:
href = '/'.join(resources)
dash_doc.visit_and_snapshot(href, hook_id='wait-for-page-/{}'.format(href)) |
"""
Presets for the ffmpeg manager
"""
# video
MP4_VIDEO = {'format':'mp4',
'vcodec':'mpeg4',
'qmin':'3',
'qmax':'5',
'g':'300',
'bitrate':'700k',
'vf':'"scale=-1:360"',
}
MP4_AUDIO =... | """
Presets for the ffmpeg manager
"""
mp4_video = {'format': 'mp4', 'vcodec': 'mpeg4', 'qmin': '3', 'qmax': '5', 'g': '300', 'bitrate': '700k', 'vf': '"scale=-1:360"'}
mp4_audio = {'acodec': 'libfaac', 'rate': '128k'}
webm_video = {'format': 'webm', 'vcodec': 'libvpx', 'vf': '"scale=-1:360"', 'bitrate': '700k'}
... |
t=int(input())
a=1
while(a<=t):
n=int(input())
h=input().split()
for i in range(n):
h[i]=int(h[i])
c=0
for i in range(1,n-1):
if(h[i-1]<h[i]>h[i+1]):
c+=1
print('Case #' + str(a) + ': ' + str(c))
a+=1 | t = int(input())
a = 1
while a <= t:
n = int(input())
h = input().split()
for i in range(n):
h[i] = int(h[i])
c = 0
for i in range(1, n - 1):
if h[i - 1] < h[i] > h[i + 1]:
c += 1
print('Case #' + str(a) + ': ' + str(c))
a += 1 |
# Singleton through a decorator.
def singleton(class_):
instances = {}
def getinstance(*args, **kwargs):
if class_ not in instances:
instances[class_] = class_(*args, **kwargs)
return instances[class_]
return getinstance
@singleton
class MyClass(object):
pass
m1 = MyClass()
print(m1)
m2 = ... | def singleton(class_):
instances = {}
def getinstance(*args, **kwargs):
if class_ not in instances:
instances[class_] = class_(*args, **kwargs)
return instances[class_]
return getinstance
@singleton
class Myclass(object):
pass
m1 = my_class()
print(m1)
m2 = my_class()
print... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.