content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
def request(flow):
real_github_token = 'REPLACE_ME!'
auth_header = flow.request.headers.get('Authorization')
if auth_header:
flow.request.headers['Authorization'] = auth_header.replace('__GITHUB_TOKEN_PLACEHOLDER__', real_github_token)
def response(flow):
recording_proxy = 'http://host.docker.... | def request(flow):
real_github_token = 'REPLACE_ME!'
auth_header = flow.request.headers.get('Authorization')
if auth_header:
flow.request.headers['Authorization'] = auth_header.replace('__GITHUB_TOKEN_PLACEHOLDER__', real_github_token)
def response(flow):
recording_proxy = 'http://host.docker.i... |
class TokenMeta:
"""This class holds some meta data about a token from the text held by a Doc object.
This allows to create a Token object when needed.
"""
def __init__(self, text: str, space_after: bool):
"""Initializes a TokenMeta object
Args:
text (str): The token's text... | class Tokenmeta:
"""This class holds some meta data about a token from the text held by a Doc object.
This allows to create a Token object when needed.
"""
def __init__(self, text: str, space_after: bool):
"""Initializes a TokenMeta object
Args:
text (str): The token's text... |
TimesTable = int(input("Please Choose A Times Table To Be Quizzed On;\n1)One Times Tables\n2)Two Times Tables\n3)Three Times Tables\n4)Four Times Tables\n5)Five Times Tables\n6)Six Times Tables\n7)Seven Times Tables\n8)Eight Times Tables\n9)Nine Times Tables\n10)Ten Times Tables\n11)Eleven Times Tables\n12)Twelve Times... | times_table = int(input('Please Choose A Times Table To Be Quizzed On;\n1)One Times Tables\n2)Two Times Tables\n3)Three Times Tables\n4)Four Times Tables\n5)Five Times Tables\n6)Six Times Tables\n7)Seven Times Tables\n8)Eight Times Tables\n9)Nine Times Tables\n10)Ten Times Tables\n11)Eleven Times Tables\n12)Twelve Time... |
nums = (input("")).split()
n = int(nums[0])
m = int(nums[1])
l= int(nums[2])
list1 = []
for i in range(n):
request = (input("")).split()
request[1] = float(request[1])
request[2] = int(request[2])
request[3] = int(request[3])
request.append(i)
list1.append(request)
l... | nums = input('').split()
n = int(nums[0])
m = int(nums[1])
l = int(nums[2])
list1 = []
for i in range(n):
request = input('').split()
request[1] = float(request[1])
request[2] = int(request[2])
request[3] = int(request[3])
request.append(i)
list1.append(request)
list1.sort()
list1 = sorted(list1... |
"""
Settings,
As for the database, look for ../sql_orm/database.py
"""
#DEBUG/TEST MODE: This allows HTTP connection instead of HTTPS
TEST_MODE = True
API_PORT = 8000
# These are used only if the TEST_MODE is disabled
SSL_CERT_LOCATION = "path"
SSL_KEY_LOCATION = "path"
SSL_CA_LOCATION = "path"
# JWT access setting... | """
Settings,
As for the database, look for ../sql_orm/database.py
"""
test_mode = True
api_port = 8000
ssl_cert_location = 'path'
ssl_key_location = 'path'
ssl_ca_location = 'path'
algorithm = 'HS256'
access_token_expire_minutes = 30
cleaning_lady_interval_seconds = 60
port_list = list(range(9000, 9101))
ssh_auth_keys... |
capitals = ["Amsterdam", "Andorra la Vella", "Athens", "Berlin", "Bratislava", "Brussels", "Dublin", "Helsinki",
"Lisbon", "Ljubljana", "Luxembourg", "Madrid", "Monaco", "Nicosia", "Paris", "Riga", "Rome", "San Marino",
"Tallinn", "Valletta", "Vatican City", "Vienna", "Vilnius"]
# len_cities = l... | capitals = ['Amsterdam', 'Andorra la Vella', 'Athens', 'Berlin', 'Bratislava', 'Brussels', 'Dublin', 'Helsinki', 'Lisbon', 'Ljubljana', 'Luxembourg', 'Madrid', 'Monaco', 'Nicosia', 'Paris', 'Riga', 'Rome', 'San Marino', 'Tallinn', 'Valletta', 'Vatican City', 'Vienna', 'Vilnius']
countries = ['Netherlands', 'Andorra', '... |
CONFIG = {
'http': {
'port': 3000
},
'authentication': {
'salt_rounds': 12,
'secret': '!!! CHANGE ME !!!',
'issuer': 'example.com',
'token_expiry': '24h',
'admin_primary_email': 'admin@localhost',
'admin_default_password': 'admin'
},
'authoriza... | config = {'http': {'port': 3000}, 'authentication': {'salt_rounds': 12, 'secret': '!!! CHANGE ME !!!', 'issuer': 'example.com', 'token_expiry': '24h', 'admin_primary_email': 'admin@localhost', 'admin_default_password': 'admin'}, 'authorization': {'default_roles': ['user:read', 'user:write', 'public:read'], 'approved_ro... |
#!/usr/bin/env python
# encoding: utf-8
"""
unique_path_ii.py
Created by Shengwei on 2014-07-28.
"""
# https://oj.leetcode.com/problems/unique-paths-ii/
# tags: medium, matrix, path, dp
"""
Follow up for "Unique Paths":
Now consider if some obstacles are added to the grids. How many unique paths would there be?
An... | """
unique_path_ii.py
Created by Shengwei on 2014-07-28.
"""
'\nFollow up for "Unique Paths":\n\nNow consider if some obstacles are added to the grids. How many unique paths would there be?\n\nAn obstacle and empty space is marked as 1 and 0 respectively in the grid.\n\nFor example,\nThere is one obstacle in the middl... |
class FilePath:
regex = '[0-9]{4}'
def to_python(self, value):
return int(value)
| class Filepath:
regex = '[0-9]{4}'
def to_python(self, value):
return int(value) |
# Time: O(n)
# Space: O(1)
class Solution(object):
def sumZero(self, n):
"""
:type n: int
:rtype: List[int]
"""
return [i for i in range(-(n//2), n//2+1) if not (i == 0 and n%2 == 0)]
| class Solution(object):
def sum_zero(self, n):
"""
:type n: int
:rtype: List[int]
"""
return [i for i in range(-(n // 2), n // 2 + 1) if not (i == 0 and n % 2 == 0)] |
test = {'name': 'q7',
'points': 8,
'suites': [{'cases': [{'code': '>>> t = Tree (1 , [ Tree (2) , Tree (1 , [ '
'Tree (2 , [ Tree (3 , [ Tree (0)])])])])\n'
'\n'
'>>> longest_seq( t) # 1 -> 2 -> 3\n'
... | test = {'name': 'q7', 'points': 8, 'suites': [{'cases': [{'code': '>>> t = Tree (1 , [ Tree (2) , Tree (1 , [ Tree (2 , [ Tree (3 , [ Tree (0)])])])])\n\n>>> longest_seq( t) # 1 -> 2 -> 3\n3\n\n>>> t = Tree (1)\n\n>>> longest_seq( t)\n1\n'}], 'scored': True, 'setup': 'from q7 import *', 'type': 'doctest'}]} |
x = [input() for x in range(10)]
m = 0
m_index = 0
for i in range(0,10,2):
if int(x[i]) > m:
m = int(x[i])
m_index = i
print(f"a maioe nota foi de {x[m_index+1]} com {x[m_index]} pontos") | x = [input() for x in range(10)]
m = 0
m_index = 0
for i in range(0, 10, 2):
if int(x[i]) > m:
m = int(x[i])
m_index = i
print(f'a maioe nota foi de {x[m_index + 1]} com {x[m_index]} pontos') |
"""
There are two sorted arrays nums1 and nums2 of size m and n respectively.
Find the median of the two sorted arrays.
The overall run time complexity should be O(log (m+n)).
You may assume nums1 and nums2 cannot be both empty.
Example 1:
nums1 = [1, 3]
nums2 = [2]
The median is 2.... | """
There are two sorted arrays nums1 and nums2 of size m and n respectively.
Find the median of the two sorted arrays.
The overall run time complexity should be O(log (m+n)).
You may assume nums1 and nums2 cannot be both empty.
Example 1:
nums1 = [1, 3]
nums2 = [2]
The median is 2.... |
class Commands:
def __init__(self, arguments_commandline: list):
commands_allowed = ['compile', 'clean']
if len(arguments_commandline) > 1:
command = arguments_commandline[1]
if not command in commands_allowed:
raise Exception("You give an invalid command")... | class Commands:
def __init__(self, arguments_commandline: list):
commands_allowed = ['compile', 'clean']
if len(arguments_commandline) > 1:
command = arguments_commandline[1]
if not command in commands_allowed:
raise exception('You give an invalid command')
... |
"""
Base information for using R in BuildPacks.
Keeping this in r.py would lead to cyclic imports.
"""
# Via https://rstudio.com/products/rstudio/download-server/debian-ubuntu/
RSTUDIO_URL = "https://download2.rstudio.org/server/bionic/amd64/rstudio-server-1.2.5001-amd64.deb"
# This is MD5, because that is what RStud... | """
Base information for using R in BuildPacks.
Keeping this in r.py would lead to cyclic imports.
"""
rstudio_url = 'https://download2.rstudio.org/server/bionic/amd64/rstudio-server-1.2.5001-amd64.deb'
rstudio_checksum = 'd33881b9ab786c09556c410e7dc477de'
shiny_url = 'https://download3.rstudio.org/ubuntu-14.04/x86_64... |
def _map_int(*args):
"""Convert each element to an int"""
return list(map(_int, _flatten(args)))
| def _map_int(*args):
"""Convert each element to an int"""
return list(map(_int, _flatten(args))) |
class MyClass(object):
"""This is a test class."""
# Python has no real concept of private elements.
"""Default class initializer"""
# Every method, included in the class definition passes the object in question as its first parameter.
# The word 'self' is used for this parameter (usage of self... | class Myclass(object):
"""This is a test class."""
'Default class initializer'
def __init__(self, prop1=None):
self.prop1 = prop1
def get_prop1(self):
return self.prop1
def set_prop1(self, value):
self.prop1 = value
@property
def prop2(self):
"""A profound... |
class ResourceVersionStatus(Enum,IComparable,IFormattable,IConvertible):
"""
An enum indicating whether a resource is current or out of date.
enum ResourceVersionStatus,values: Current (0),OutOfDate (1),Unknown (2)
"""
def __eq__(self,*args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <... | class Resourceversionstatus(Enum, IComparable, IFormattable, IConvertible):
"""
An enum indicating whether a resource is current or out of date.
enum ResourceVersionStatus,values: Current (0),OutOfDate (1),Unknown (2)
"""
def __eq__(self, *args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx._... |
size(200, 400)
path = BezierPath()
path.polygon((80, 28), (50, 146), (146, 152), (172, 78))
with savedState():
clipPath(path)
scale(200/512)
image("../images/drawbot.png", (0, 0))
translate(0, 200)
with savedState():
scale(200/512)
image("../images/drawbot.png", (0, 0))
| size(200, 400)
path = bezier_path()
path.polygon((80, 28), (50, 146), (146, 152), (172, 78))
with saved_state():
clip_path(path)
scale(200 / 512)
image('../images/drawbot.png', (0, 0))
translate(0, 200)
with saved_state():
scale(200 / 512)
image('../images/drawbot.png', (0, 0)) |
with open("input.txt", "r") as input_file:
lines = input_file.readlines()
reports = [int(line, 2) for line in lines]
counts = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
for report in reports:
i = 0
num_of_bits = len(counts)
while i < num_of_bits:
counts[num_of_bits-1-i] += report >> i & 1
... | with open('input.txt', 'r') as input_file:
lines = input_file.readlines()
reports = [int(line, 2) for line in lines]
counts = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
for report in reports:
i = 0
num_of_bits = len(counts)
while i < num_of_bits:
counts[num_of_bits - 1 - i] += report >> i & 1
... |
'''
Determine whether an integer is a palindrome. Do this without extra space.
Could negative integers be palindromes? (ie, -1)
If you are thinking of converting the integer to string, note the restriction of using extra space.
You could also try reversing an integer. However, if you have solved the problem "Reverse... | """
Determine whether an integer is a palindrome. Do this without extra space.
Could negative integers be palindromes? (ie, -1)
If you are thinking of converting the integer to string, note the restriction of using extra space.
You could also try reversing an integer. However, if you have solved the problem "Reverse... |
class Template:
model_owner = "model_owner"
detail_view = "detail_view"
detail_view_u = "detail_view_u"
detail_view_d = "detail_view_d"
detail_view_ud = "detail_view_ud"
all_objects_view = "all_objects_view"
filter_objects_view = "filter_objects_view"
user_register_view = "user_register_... | class Template:
model_owner = 'model_owner'
detail_view = 'detail_view'
detail_view_u = 'detail_view_u'
detail_view_d = 'detail_view_d'
detail_view_ud = 'detail_view_ud'
all_objects_view = 'all_objects_view'
filter_objects_view = 'filter_objects_view'
user_register_view = 'user_register_... |
#Write a function called num_factors. num_factors should
#have one parameter, an integer. num_factors should count
#how many factors the number has and return that count as
#an integer
#
#A number is a factor of another number if it divides
#evenly into that number. For example, 3 is a factor of 6,
#but 4 is not... | def num_factors(num):
count = 0
for i in range(2, num):
if num % i == 0:
count += 1
return count
print(num_factors(5))
print(num_factors(6))
print(num_factors(97))
print(num_factors(105))
print(num_factors(999)) |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def apply_fn_to_list_items_in_dict(dictionary, fn, **kwargs):
"""
Given a dictionary with items that are lists, applies the given function to each
item in each list and return an updated version of the dictionary.
:param dictionary: the dictionary to... | def apply_fn_to_list_items_in_dict(dictionary, fn, **kwargs):
"""
Given a dictionary with items that are lists, applies the given function to each
item in each list and return an updated version of the dictionary.
:param dictionary: the dictionary to update.
:param fn: the function to apply.
... |
#
# Created on Sat Apr 25 2020
#
# Title: Leetcode - Jump Game
#
# Author: Vatsal Mistry
# Web: mistryvatsal.github.io
#
# Approach will be to traverse array in reverse, maintain last_optimum_pos
# and check whether last_optimum_pos is at the 0 index
class Solution:
def canJump(self, nums):
N = len(nums)... | class Solution:
def can_jump(self, nums):
n = len(nums)
last_optimum_pos = N - 1
for i in range(N - 1, -1, -1):
if i + nums[i] >= last_optimum_pos:
last_optimum_pos = i
return last_optimum_pos == 0 |
while True:
n = int(input())
if n == 0:
break
ans = 0
for i in range(n):
flag = True
s = input()
for j in range(len(s)):
if s[j] == ' ' and ans <= j:
flag = False
ans = j
break
if flag and ans < len(s):
... | while True:
n = int(input())
if n == 0:
break
ans = 0
for i in range(n):
flag = True
s = input()
for j in range(len(s)):
if s[j] == ' ' and ans <= j:
flag = False
ans = j
break
if flag and ans < len(s):
... |
"""
Calculating the factors of an integer
- a number that evenly divides a larger number
"""
#
# def is_factor(a, b):
# if b % a == 0:
# return True
# else:
# return False
#
#
# print(is_factor(2, 1))
"""
Find the factors of an integer
"""
#
#
# def factors(n):
#
# for i in ran... | """
Calculating the factors of an integer
- a number that evenly divides a larger number
"""
'\n Find the factors of an integer\n'
def find_next_square(sq):
root = math.sqrt(sq)
return (root + 1) ** 2 if root.is_integer() else -1 |
# Shopping Options
# https://aonecode.com/amazon-online-assessment-shopping-options
def getNumberOfOptions(priceOfJeans, priceOfShoes, priceOfSkirts, priceOfTops, dollars):
if not priceOfJeans or not priceOfShoes or not priceOfSkirts or not priceOfTops:
return 0
js = []
for i in range(len(priceO... | def get_number_of_options(priceOfJeans, priceOfShoes, priceOfSkirts, priceOfTops, dollars):
if not priceOfJeans or not priceOfShoes or (not priceOfSkirts) or (not priceOfTops):
return 0
js = []
for i in range(len(priceOfJeans)):
for j in range(len(priceOfShoes)):
js.append(priceO... |
"""
core functionality
"""
def another_func(a, b):
"""
just a test
Parameters
----------
a : int
an input
b : float
another input
See also
--------
{{ cookiecutter.project_slug }}.{{ cookiecutter.project_slug }}.a_function
"""
pass
| """
core functionality
"""
def another_func(a, b):
"""
just a test
Parameters
----------
a : int
an input
b : float
another input
See also
--------
{{ cookiecutter.project_slug }}.{{ cookiecutter.project_slug }}.a_function
"""
pass |
_base_ = [
'_base_/datasets/cxr14_bs16.py',
'_base_/models/resnet50_cxr14.py',
'_base_/schedules/cxr14_bs16_ep20.py',
'_base_/default_runtime.py'
] | _base_ = ['_base_/datasets/cxr14_bs16.py', '_base_/models/resnet50_cxr14.py', '_base_/schedules/cxr14_bs16_ep20.py', '_base_/default_runtime.py'] |
#encoding:utf-8
# Write here subreddit name. Like this one for /r/BigAnimeTiddies.
subreddit = 'BigAnimeTiddies'
# This is for your public telegram channel.
t_channel = '@r_BigAnimeTiddies'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| subreddit = 'BigAnimeTiddies'
t_channel = '@r_BigAnimeTiddies'
def send_post(submission, r2t):
return r2t.send_simple(submission) |
def rest():
i01.setHeadSpeed(1.0,1.0)
i01.setHandSpeed("right", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
i01.setArmSpeed("right", 1.0, 1.0, 1.0, 1.0)
#atach
i01.head.neck.attach()
i01.head.rothead.attach()
i01.rightHand.attach()
i01.rightArm.shoulder.attach()
i01.rightArm.omoplate.attach()
i01.rightArm.bicep.a... | def rest():
i01.setHeadSpeed(1.0, 1.0)
i01.setHandSpeed('right', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
i01.setArmSpeed('right', 1.0, 1.0, 1.0, 1.0)
i01.head.neck.attach()
i01.head.rothead.attach()
i01.rightHand.attach()
i01.rightArm.shoulder.attach()
i01.rightArm.omoplate.attach()
i01.rightA... |
"""
Implementation of a binary Min Heap, represented by an array.
"""
class MinHeap():
def __init__(self):
self.array = []
self.root = None
self.size = 0
def parent(heap, i):
"""
Returns the index of the parent of a given node.
"""
if i == 0:
return 0
return he... | """
Implementation of a binary Min Heap, represented by an array.
"""
class Minheap:
def __init__(self):
self.array = []
self.root = None
self.size = 0
def parent(heap, i):
"""
Returns the index of the parent of a given node.
"""
if i == 0:
return 0
return heap... |
#!/usr/bin/python3
for i in range(-10,-100,-30):
print(i)
print(i) | for i in range(-10, -100, -30):
print(i)
print(i) |
def test_index(client):
r = client.get("/")
assert r.status_code == 200
def test_paper_page(client):
r = client.get("/paper/1812.35598")
assert r.status_code == 200 | def test_index(client):
r = client.get('/')
assert r.status_code == 200
def test_paper_page(client):
r = client.get('/paper/1812.35598')
assert r.status_code == 200 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license, see LICENSE.
"""
Submodule for useful exceptions
===============================
.. note:: not meant for user code in general, though possible.
"""
# Definition of handy colours for printing
_default = "\x1b[00m"
_green = "\x1b[01;32m"
_red = "\x1... | """
Submodule for useful exceptions
===============================
.. note:: not meant for user code in general, though possible.
"""
_default = '\x1b[00m'
_green = '\x1b[01;32m'
_red = '\x1b[01;31m'
class Invalidoperationerror(Exception):
"""Exception class for meaningless operations."""
def __init__(self,... |
class Node:
def __init__(self, data=None):
self.__data=data
self.__next=None
@property
def data(self):
return self.__data
@data.setter
def data(self, data):
self.__data=data
@property
def next(self):
return self.__next
@next.setter
... | class Node:
def __init__(self, data=None):
self.__data = data
self.__next = None
@property
def data(self):
return self.__data
@data.setter
def data(self, data):
self.__data = data
@property
def next(self):
return self.__next
@next.setter
d... |
def pkgs_raw(packages):
pkgs_raw_str = ""
for package in packages:
pkgs_raw_str += str(package) + "\n"
print(pkgs_raw_str)
def pkgs_traits(packages, traits_to_print):
pkgs_traits_str = ""
for package in packages:
pkgs_traits_str += "\n"
for trait in traits_to_print:
... | def pkgs_raw(packages):
pkgs_raw_str = ''
for package in packages:
pkgs_raw_str += str(package) + '\n'
print(pkgs_raw_str)
def pkgs_traits(packages, traits_to_print):
pkgs_traits_str = ''
for package in packages:
pkgs_traits_str += '\n'
for trait in traits_to_print:
... |
webgui = Runtime.create("webgui","WebGui")
# if you don't want the browser to
# autostart to homepage
#
# webgui.autoStartBrowser(false)
# set a different port number to listen to
# default is 8888
# webgui.setPort(7777)
# on startup the webgui will look for a "resources"
# directory (may change in the future)
# st... | webgui = Runtime.create('webgui', 'WebGui')
webgui.startService() |
class Solution:
max_time = 0
def numOfMinutes(self, n: int, headID: int, manager: List[int], informTime: List[int]) -> int:
global max_time
max_time=0
def dfs(adj,node,path_sum):
global max_time
if adj.get(node)==None:
max_time=max(max_time,path_... | class Solution:
max_time = 0
def num_of_minutes(self, n: int, headID: int, manager: List[int], informTime: List[int]) -> int:
global max_time
max_time = 0
def dfs(adj, node, path_sum):
global max_time
if adj.get(node) == None:
max_time = max(max_... |
def z_inicial(lista):
cont=0
if len(lista) == 0:
return
else:
for i in range(len(lista)):
if lista[i][0] == "z" or lista[i][0] == "Z":
cont+=1
return cont
lista=input().split()
print(z_inicial(lista))
| def z_inicial(lista):
cont = 0
if len(lista) == 0:
return
else:
for i in range(len(lista)):
if lista[i][0] == 'z' or lista[i][0] == 'Z':
cont += 1
return cont
lista = input().split()
print(z_inicial(lista)) |
"""
pyexcel_io.constants
~~~~~~~~~~~~~~~~~~~
Constants appeared in pyexcel
:copyright: (c) 2014-2017 by Onni Software Ltd.
:license: New BSD License
"""
# flake8: noqa
DEFAULT_NAME = 'pyexcel'
DEFAULT_SHEET_NAME = '%s_sheet1' % DEFAULT_NAME
MESSAGE_INVALID_PARAMETERS = "Invalid parameters"
MESSAG... | """
pyexcel_io.constants
~~~~~~~~~~~~~~~~~~~
Constants appeared in pyexcel
:copyright: (c) 2014-2017 by Onni Software Ltd.
:license: New BSD License
"""
default_name = 'pyexcel'
default_sheet_name = '%s_sheet1' % DEFAULT_NAME
message_invalid_parameters = 'Invalid parameters'
message_error_02 = 'No... |
''' Problem # 3
Write a program that takes the salary and grade from user.
It then adds 50% bonus if the grade is greater tha 15.
It adds 25% bonus if the grade is 15 or less and then it should display the salary
Pseudocode
1. Start
2. Take the salary and grade from the user
3. If the grade is greater than 15
th... | """ Problem # 3
Write a program that takes the salary and grade from user.
It then adds 50% bonus if the grade is greater tha 15.
It adds 25% bonus if the grade is 15 or less and then it should display the salary
Pseudocode
1. Start
2. Take the salary and grade from the user
3. If the grade is greater than 15
th... |
## 1. Overview ##
f = open("movie_metadata.csv", 'r')
movie_metadata = f.read()
movie_metadata = movie_metadata.split('\n')
movie_data = []
for element in movie_metadata:
row = element.split(',')
movie_data.append(row)
print(movie_data[:5])
## 3. Writing Our Own Functions ##
def first_elts(nested_lists):
... | f = open('movie_metadata.csv', 'r')
movie_metadata = f.read()
movie_metadata = movie_metadata.split('\n')
movie_data = []
for element in movie_metadata:
row = element.split(',')
movie_data.append(row)
print(movie_data[:5])
def first_elts(nested_lists):
list_heads = []
for n_list in nested_lists:
... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 Hewlett Packard Enterprise Development LP
#
# 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
#
# Unl... | manifest = {'Name': 'temp_sensor_status_transition_monitor', 'Description': 'Network Analytics Agent Script to monitorstatus transitions of all temperature sensors', 'Version': '1.0', 'Author': 'Aruba Networks'}
class Policy(NAE):
def __init__(self):
self.variables['sensors_list'] = ''
uri1 = '/re... |
#gwang_01.py
j = 0
for i in range (1000):
if (i % 3) == 0 or (i%5) == 0: j+=i
j
| j = 0
for i in range(1000):
if i % 3 == 0 or i % 5 == 0:
j += i
j |
dp = [0 for i in range(301)];stair = [0 for i in range(301)]
n = int(input())
for i in range(n): stair[i] = int(input())
dp[0] = stair[0];dp[1] = stair[0]+stair[1];dp[2] = max(stair[0]+stair[2],stair[1]+stair[2])
for i in range(3,n): dp[i] = max(dp[i-2]+stair[i],dp[i-3]+stair[i-1]+stair[i])
print(dp[n-1]) | dp = [0 for i in range(301)]
stair = [0 for i in range(301)]
n = int(input())
for i in range(n):
stair[i] = int(input())
dp[0] = stair[0]
dp[1] = stair[0] + stair[1]
dp[2] = max(stair[0] + stair[2], stair[1] + stair[2])
for i in range(3, n):
dp[i] = max(dp[i - 2] + stair[i], dp[i - 3] + stair[i - 1] + stair[i])... |
#!/usr/bin/env python3
#
# Advent of Code 2017 - Day 2
#
INPUTFILE = 'input.txt'
def load_input(infile):
lines = []
with open(infile, 'r') as fp:
for line in fp:
line = line.strip()
if line:
lines.append(line)
return lines
def checksum(sheet):
resu... | inputfile = 'input.txt'
def load_input(infile):
lines = []
with open(infile, 'r') as fp:
for line in fp:
line = line.strip()
if line:
lines.append(line)
return lines
def checksum(sheet):
result = 0
for row in sheet.splitlines():
vals = [i... |
def read_only_properties(*args):
def class_rebuilder(cls):
def __setattr__(self, key, value):
if key in args and key in self.__dict__:
raise AttributeError("Can't modify %s" % key)
else:
super().__setattr__(key, value)
cls.__setattr__ = __seta... | def read_only_properties(*args):
def class_rebuilder(cls):
def __setattr__(self, key, value):
if key in args and key in self.__dict__:
raise attribute_error("Can't modify %s" % key)
else:
super().__setattr__(key, value)
cls.__setattr__ = __se... |
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
},
'targets': [
{
'target_name': 'gfx_geometry',
'type': '<(component)',
'dependenci... | {'variables': {'chromium_code': 1}, 'targets': [{'target_name': 'gfx_geometry', 'type': '<(component)', 'dependencies': ['<(DEPTH)/base/base.gyp:base'], 'defines': ['GFX_IMPLEMENTATION'], 'sources': ['geometry/box_f.cc', 'geometry/box_f.h', 'geometry/cubic_bezier.h', 'geometry/cubic_bezier.cc', 'geometry/insets.cc', 'g... |
class Solution(object):
def reformatNumber(self, number):
"""
:type number: str
:rtype: str
"""
number = number.replace('-' ,'').replace(' ', '')
ans = []
for i in range(0, len(number), 3):
ans.append(number[i:i+3])
if len(ans) >= 2 and ... | class Solution(object):
def reformat_number(self, number):
"""
:type number: str
:rtype: str
"""
number = number.replace('-', '').replace(' ', '')
ans = []
for i in range(0, len(number), 3):
ans.append(number[i:i + 3])
if len(ans) >= 2 and... |
class BaseError(Exception):
"""Base package error."""
class InvalidModelInputError(BaseError):
"""Model input contains an error."""
| class Baseerror(Exception):
"""Base package error."""
class Invalidmodelinputerror(BaseError):
"""Model input contains an error.""" |
#!/usr/bin/env python3
# ex6: String and Text
# Assign the string with 10 replacing the formatting character to variable 'x'
x = "There are %d types of people." % 10
# Assign the string with "binary" to variable 'binary'
binary = "binary"
# Assign the string with "don't" to variable 'do_not'
do_not = "don't"
# Ass... | x = 'There are %d types of people.' % 10
binary = 'binary'
do_not = "don't"
y = 'Those who know %s and those who %s.' % (binary, do_not)
print(x)
print(y)
print('I said %r.' % x)
print("I also said: '%s'." % y)
hilarious = False
joke_evaluation = "Isn't that joke so funny?! %r"
print(joke_evaluation % hilarious)
w = 'T... |
class QolsysException(Exception):
pass
class QolsysGwConfigIncomplete(QolsysException):
pass
class QolsysGwConfigError(QolsysException):
pass
class UnableToParseEventException(QolsysException):
pass
class UnknownQolsysControlException(QolsysException):
pass
class UnknownQolsysEventException(Qol... | class Qolsysexception(Exception):
pass
class Qolsysgwconfigincomplete(QolsysException):
pass
class Qolsysgwconfigerror(QolsysException):
pass
class Unabletoparseeventexception(QolsysException):
pass
class Unknownqolsyscontrolexception(QolsysException):
pass
class Unknownqolsyseventexception(Qol... |
## 3. Read the File Into a String ##
f = open("dq_unisex_names.csv", 'r')
names = f.read();
## 4. Convert the String to a List ##
f = open('dq_unisex_names.csv', 'r')
names = f.read()
names_list = names.split('\n')
first_five = names_list[0:5]
print(first_five)
## 5. Convert the List of Strings to a List of Lists ... | f = open('dq_unisex_names.csv', 'r')
names = f.read()
f = open('dq_unisex_names.csv', 'r')
names = f.read()
names_list = names.split('\n')
first_five = names_list[0:5]
print(first_five)
f = open('dq_unisex_names.csv', 'r')
names = f.read()
names_list = names.split('\n')
nested_list = []
for name in names_list:
nest... |
def main():
x_coords = []
x_lines = ["side 1 G", "side 1 5", "side 1 10", "side 1 15", "side 1 20", "side 1 25", "side 1 30", "side 1 35",
"side 1 40", "side 1 45", "50", "side 2 45", "side 2 40", "side 2 35", "side 2 30", "side 2 25",
"side 2 20", "side 2 15", "side 2 10", "si... | def main():
x_coords = []
x_lines = ['side 1 G', 'side 1 5', 'side 1 10', 'side 1 15', 'side 1 20', 'side 1 25', 'side 1 30', 'side 1 35', 'side 1 40', 'side 1 45', '50', 'side 2 45', 'side 2 40', 'side 2 35', 'side 2 30', 'side 2 25', 'side 2 20', 'side 2 15', 'side 2 10', 'side 2 5', 'side 2 G']
for (i, l... |
def main():
arr = []
while True:
arr.append(1)
if len(arr) >= 10:
break
return None
if __name__ == "__main__":
main()
| def main():
arr = []
while True:
arr.append(1)
if len(arr) >= 10:
break
return None
if __name__ == '__main__':
main() |
"""
Shared constants.
Only put things here if they are used in more than one module. Otherwise just define
them in the module where they are used.
"""
EASYCRON_IPS = ["198.27.83.222", "192.99.21.124", "167.114.64.88", "167.114.64.21"]
| """
Shared constants.
Only put things here if they are used in more than one module. Otherwise just define
them in the module where they are used.
"""
easycron_ips = ['198.27.83.222', '192.99.21.124', '167.114.64.88', '167.114.64.21'] |
'''
Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), find the minimum number of conference rooms required.
Example 1:
Input: [[0, 30],[5, 10],[15, 20]]
Output: 2
Example 2:
Input: [[7,10],[2,4]]
Output: 1
'''
# Definition for an interval.
# class Interval(o... | """
Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), find the minimum number of conference rooms required.
Example 1:
Input: [[0, 30],[5, 10],[15, 20]]
Output: 2
Example 2:
Input: [[7,10],[2,4]]
Output: 1
"""
class Solution(object):
def min_meeting_roo... |
enums = {
'AcpAmplitudeCorrectionType': {
'values': [
{
'documentation': {
'description': ' All the frequency bins in the spectrum are compensated with a single external attenuation value that corresponds to the RF center frequency.'
},
... | enums = {'AcpAmplitudeCorrectionType': {'values': [{'documentation': {'description': ' All the frequency bins in the spectrum are compensated with a single external attenuation value that corresponds to the RF center frequency.'}, 'name': 'RF_CENTER_FREQUENCY', 'value': 0}, {'documentation': {'description': ' An indivi... |
for letra in 'Laiana Nardi':
print(letra)
print("For loop letra!")
for contador in range(2,8):
print(contador)
print("For Loop contador!")
friends = ['John','Terry','Eric','Michael','George']
# for friend in friends:
# print(friend)
for index in range(len(friends)):
print(friends[index])
for friend... | for letra in 'Laiana Nardi':
print(letra)
print('For loop letra!')
for contador in range(2, 8):
print(contador)
print('For Loop contador!')
friends = ['John', 'Terry', 'Eric', 'Michael', 'George']
for index in range(len(friends)):
print(friends[index])
for friend in friends:
if friend == 'Eric':
... |
"""Result class definitions."""
class _WriteResult(object):
"""Base class for write result classes."""
def __init__(self, acknowledged=True):
self.acknowledged = acknowledged # here only to PyMongo compat
class InsertOneResult(_WriteResult):
"""The return type for :meth:`~tinymongo.TinyMongoCo... | """Result class definitions."""
class _Writeresult(object):
"""Base class for write result classes."""
def __init__(self, acknowledged=True):
self.acknowledged = acknowledged
class Insertoneresult(_WriteResult):
"""The return type for :meth:`~tinymongo.TinyMongoCollection.insert_one`.
"""
... |
num = int(input())
def ListOfNum(num):
L = []
while num != 0:
x = num%10
num = num//10
L.append(x)
return L
def Multiply(L):
result = 1
for i in L:
result = result *i
return result
L = ListOfNum(num) #L = [2,6,8]
result = 0
while len(L) > 1:
re... | num = int(input())
def list_of_num(num):
l = []
while num != 0:
x = num % 10
num = num // 10
L.append(x)
return L
def multiply(L):
result = 1
for i in L:
result = result * i
return result
l = list_of_num(num)
result = 0
while len(L) > 1:
result += 1
x = ... |
class Term:
def __init__(self, name, type="constant"):
"""
Args:
value (string):
type (str): ``constant '' or ``variable''
"""
self.name = name
self.type = type
@classmethod
def new_term(cls, name, type="constant"):
return cls(name, ty... | class Term:
def __init__(self, name, type='constant'):
"""
Args:
value (string):
type (str): ``constant '' or ``variable''
"""
self.name = name
self.type = type
@classmethod
def new_term(cls, name, type='constant'):
return cls(name, t... |
def average(nums):
"""Find mean of a list of numbers."""
return sum(nums) / len(nums)
def test_average():
"""
>>> test_average()
"""
assert 12.0 == average([3, 6, 9, 12, 15, 18, 21])
assert 20 == average([5, 10, 15, 20, 25, 30, 35])
assert 4.5 == average([1, 2, 3, 4, 5, 6, 7, 8])
if ... | def average(nums):
"""Find mean of a list of numbers."""
return sum(nums) / len(nums)
def test_average():
"""
>>> test_average()
"""
assert 12.0 == average([3, 6, 9, 12, 15, 18, 21])
assert 20 == average([5, 10, 15, 20, 25, 30, 35])
assert 4.5 == average([1, 2, 3, 4, 5, 6, 7, 8])
if __n... |
l=[]
fo=open("EnglishWords.txt","r")
st=fo.read()
st=st.split()
for line in st:
if line[0]=='t':
l.append(line)
print(len(l))
| l = []
fo = open('EnglishWords.txt', 'r')
st = fo.read()
st = st.split()
for line in st:
if line[0] == 't':
l.append(line)
print(len(l)) |
"""
@project: parser
@file: node.py
@author: Guillaume Sottas
@date: 05.04.2018
"""
node_to_class = dict()
def a2l_node_type(node_type):
def wrapper(cls):
node_to_class[node_type] = cls
cls._node = node_type
return cls
return wrapper
class A2lNode(object):
__slots__ = '_node', ... | """
@project: parser
@file: node.py
@author: Guillaume Sottas
@date: 05.04.2018
"""
node_to_class = dict()
def a2l_node_type(node_type):
def wrapper(cls):
node_to_class[node_type] = cls
cls._node = node_type
return cls
return wrapper
class A2Lnode(object):
__slots__ = ('_node', '_... |
# -*- coding: utf-8 -*-
# Copyright: (c) 2019-2021, Dell EMC
"""Module for PowerStore constants"""
# HTTP constants
GET = 'GET'
POST = 'POST'
PUT = 'PUT'
DELETE = 'DELETE'
PATCH = 'PATCH'
# Default Connection Timeout in seconds
TIMEOUT = 120.0
# Pagination Constants
# offset is 0 and limit is 99 for first request
#... | """Module for PowerStore constants"""
get = 'GET'
post = 'POST'
put = 'PUT'
delete = 'DELETE'
patch = 'PATCH'
timeout = 120.0
offset = 100
max_limit = 2000
select_all_volume = {'select': 'id,name,description,type,wwn,appliance_id,state,size,creation_timestamp,protection_policy_id,performance_policy_id,protection_policy... |
#!/usr/bin/python3
#-- Use pprint module..
x=[[1,2,3,4],[11,22,33,44],[111,222,333,444]]
#-- Use printf style formatting..
x = 22/7
#-- Write some multivariate for loops..
for x,y in [[1,2]]:
print('x',x,'y',y)
for x in enumerate(range(5)):
print('x',x)
#-- Compute diagonal sums with lambdas..
m=[
[ 5,... | x = [[1, 2, 3, 4], [11, 22, 33, 44], [111, 222, 333, 444]]
x = 22 / 7
for (x, y) in [[1, 2]]:
print('x', x, 'y', y)
for x in enumerate(range(5)):
print('x', x)
m = [[5, 2, 3, 4, 1], [10, 40, 30, 20, 50], [100, 200, 300, 400, 500], [1001, 4000, 3000, 2000, 5000], [50000, 20000, 30000, 40000, 10000]]
m = 8
n = 9 |
# -*- coding: utf-8 -*-
class ExampleLibraryException(Exception):
'''It is a good practice to throw library specific exceptions so
that you know where the exception is comming'''
pass
class ExampleLibrary(object):
'''Libraries should be documented according to Robot Framework User Guide'''
def li... | class Examplelibraryexception(Exception):
"""It is a good practice to throw library specific exceptions so
that you know where the exception is comming"""
pass
class Examplelibrary(object):
"""Libraries should be documented according to Robot Framework User Guide"""
def library_keyword(self):
... |
def getNumericVal(number):
if number == 1:
return 3
elif number == 2:
return 3
elif number == 3:
return 5
elif number == 4:
return 4
elif number == 5:
return 4
elif number == 6:
return 3
elif number == 7:
return 5
elif number... | def get_numeric_val(number):
if number == 1:
return 3
elif number == 2:
return 3
elif number == 3:
return 5
elif number == 4:
return 4
elif number == 5:
return 4
elif number == 6:
return 3
elif number == 7:
return 5
elif number == 8... |
class BaseError(Exception):
pass
class RecordNotFound(BaseError):
pass
| class Baseerror(Exception):
pass
class Recordnotfound(BaseError):
pass |
# liczby Fibonacciego
def fibRek(n):
if n == 0 or n == 1:
return n
else:
return fibRek(n-1) + fibRek(n-2)
def fib(n):
"""Wypisuje liczby Fibonacciego mniejsze niz n
"""
a, b = 0, 1
while b < n:
print (b)
a, b = b, a+b
def fib2(n):
"""Zwraca liste liczb F... | def fib_rek(n):
if n == 0 or n == 1:
return n
else:
return fib_rek(n - 1) + fib_rek(n - 2)
def fib(n):
"""Wypisuje liczby Fibonacciego mniejsze niz n
"""
(a, b) = (0, 1)
while b < n:
print(b)
(a, b) = (b, a + b)
def fib2(n):
"""Zwraca liste liczb Fibonaccieg... |
"""
Copyright 2018 abbas ehsanfar
"""
"""
genfigs: generate figures
""" | """
Copyright 2018 abbas ehsanfar
"""
'\ngenfigs: generate figures\n' |
class ArmatureActuator:
bone = None
constraint = None
influence = None
mode = None
secondary_target = None
target = None
weight = None
| class Armatureactuator:
bone = None
constraint = None
influence = None
mode = None
secondary_target = None
target = None
weight = None |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def mergeTwoLists(self, list1: Optional[ListNode], list2: Optional[ListNode]) -> Optional[ListNode]:
cur = dummy = ListNode()
while l... | class Solution:
def merge_two_lists(self, list1: Optional[ListNode], list2: Optional[ListNode]) -> Optional[ListNode]:
cur = dummy = list_node()
while list1 and list2:
if list1.val < list2.val:
cur.next = list1
(list1, cur) = (list1.next, list1)
... |
file_name = "nameslist.txt"
names_list = open(file_name, "rt").read().splitlines(False)
print(names_list)
names_count = {}
for name in names_list:
if name not in names_count:
names_count[name] = 0
names_count[name] += 1
print(names_count) | file_name = 'nameslist.txt'
names_list = open(file_name, 'rt').read().splitlines(False)
print(names_list)
names_count = {}
for name in names_list:
if name not in names_count:
names_count[name] = 0
names_count[name] += 1
print(names_count) |
n, d = map(int,input().split())
l=[]
for i in range(n):
l1=list(map(int,input().split()))
l.append(l1)
l=sorted(l)
i, j, ans, s = 0, 0, 0, 0
while j<n:
if l[i][0]+d > l[j][0]:
s+=l[j][1]
j+=1
else:
s-=l[i][1]
i+=1
ans=max(ans,s)
print(ans) | (n, d) = map(int, input().split())
l = []
for i in range(n):
l1 = list(map(int, input().split()))
l.append(l1)
l = sorted(l)
(i, j, ans, s) = (0, 0, 0, 0)
while j < n:
if l[i][0] + d > l[j][0]:
s += l[j][1]
j += 1
else:
s -= l[i][1]
i += 1
ans = max(ans, s)
print(ans) |
class Atom:
def __init__(self):
pass
def __repr__(self):
raise NotImplementedError()
class Tmp(Atom):
__slots__ = ['tmp_idx']
def __init__(self, tmp_idx):
super(Tmp, self).__init__()
self.tmp_idx = tmp_idx
def __repr__(self):
return "<Tmp %d>" % self.tmp... | class Atom:
def __init__(self):
pass
def __repr__(self):
raise not_implemented_error()
class Tmp(Atom):
__slots__ = ['tmp_idx']
def __init__(self, tmp_idx):
super(Tmp, self).__init__()
self.tmp_idx = tmp_idx
def __repr__(self):
return '<Tmp %d>' % self.tm... |
# Utilities and color maps for plotting
# Colours from https://s-rip.ees.hokudai.ac.jp/mediawiki/index.php/Notes_for_Authors
reanalysis_color = {
'MERRA2' :'#e21f26',
'MERRA' :'#f69999',
'ERAI' :'#295f8a',
'ERA5' :'#5f98c6',
'ERA40' :'#afcbe3',
'JRA55' :'#723b7a',
'JRA55C' :'#... | reanalysis_color = {'MERRA2': '#e21f26', 'MERRA': '#f69999', 'ERAI': '#295f8a', 'ERA5': '#5f98c6', 'ERA40': '#afcbe3', 'JRA55': '#723b7a', 'JRA55C': '#ad71b5', 'JRA25': '#d6b8da', 'NCEP1': '#f57e20', 'NCEP2': '#fdbf6e', '20CRV2C': '#ec008c', '20CRV2': '#f799D1', 'CERA20C': '#00aeef', 'ERA20C': '#60c8e8', 'CFSR': '#34a0... |
# maximum_subarray_sum.py
# https://www.codewars.com/kata/54521e9ec8e60bc4de000d6c
def max_sequence(arr):
if len(arr) == 0:
return 0
all_elements_negative = True
for item in arr:
if item > 0:
all_elements_negative = False
break
if all_elements_negative:
... | def max_sequence(arr):
if len(arr) == 0:
return 0
all_elements_negative = True
for item in arr:
if item > 0:
all_elements_negative = False
break
if all_elements_negative:
return 0
maximum_sum = max(arr)
current_sum = 0
max_subarray = []
for... |
"""
PASSENGERS
"""
numPassengers = 22944
passenger_arriving = (
(5, 6, 5, 9, 4, 1, 2, 3, 2, 1, 1, 1, 0, 7, 6, 8, 4, 8, 2, 3, 1, 0, 1, 1, 1, 0), # 0
(7, 6, 3, 10, 7, 1, 1, 1, 6, 1, 2, 1, 0, 3, 5, 7, 7, 5, 4, 5, 0, 2, 2, 0, 1, 0), # 1
(5, 3, 10, 5, 3, 3, 4, 2, 1, 1, 1, 1, 0, 9, 9, 4, 3, 5, 2, 4, 2, 4, 1, 1, 0, 0)... | """
PASSENGERS
"""
num_passengers = 22944
passenger_arriving = ((5, 6, 5, 9, 4, 1, 2, 3, 2, 1, 1, 1, 0, 7, 6, 8, 4, 8, 2, 3, 1, 0, 1, 1, 1, 0), (7, 6, 3, 10, 7, 1, 1, 1, 6, 1, 2, 1, 0, 3, 5, 7, 7, 5, 4, 5, 0, 2, 2, 0, 1, 0), (5, 3, 10, 5, 3, 3, 4, 2, 1, 1, 1, 1, 0, 9, 9, 4, 3, 5, 2, 4, 2, 4, 1, 1, 0, 0), (7, 12, 10, 9,... |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | airflow_var_name_format_mapping = {'AIRFLOW_CONTEXT_DAG_ID': {'default': 'airflow.ctx.dag_id', 'env_var_format': 'AIRFLOW_CTX_DAG_ID'}, 'AIRFLOW_CONTEXT_TASK_ID': {'default': 'airflow.ctx.task_id', 'env_var_format': 'AIRFLOW_CTX_TASK_ID'}, 'AIRFLOW_CONTEXT_EXECUTION_DATE': {'default': 'airflow.ctx.execution_date', 'env... |
x = int(input())
y = float(input())
gasto = x / y
print('{:.3f} km/l'.format(gasto))
| x = int(input())
y = float(input())
gasto = x / y
print('{:.3f} km/l'.format(gasto)) |
# Created by MechAviv
# ID :: [931050000]
# Hidden Street : Extraction Room 1
sm.curNodeEventEnd(True)
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(True, True, False, False)
sm.setStandAloneMode(True)
def failMessage(crack):
sm.chatScript("Tap the Control Key repeatedly to break the wall.")
sm.showEffec... | sm.curNodeEventEnd(True)
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(True, True, False, False)
sm.setStandAloneMode(True)
def fail_message(crack):
sm.chatScript('Tap the Control Key repeatedly to break the wall.')
sm.showEffect('Effect/Direction6.img/effect/tuto/guide1/0', 3000, 0, -100, 20, 0, False,... |
class HTTPError(Exception):
pass
class VersionSpecificationError(Exception):
pass
| class Httperror(Exception):
pass
class Versionspecificationerror(Exception):
pass |
# -*- coding: utf-8 -*-
'''
Splunk User State Module
.. versionadded:: 2016.3.0.
This state is used to ensure presence of users in splunk.
.. code-block:: yaml
ensure example test user 1:
splunk.present:
- name: 'Example TestUser1'
- email: example@domain.com
'''
def __virtual_... | """
Splunk User State Module
.. versionadded:: 2016.3.0.
This state is used to ensure presence of users in splunk.
.. code-block:: yaml
ensure example test user 1:
splunk.present:
- name: 'Example TestUser1'
- email: example@domain.com
"""
def __virtual__():
"""
Only loa... |
#!/usr/bin/env python
#fn: copy.py
# write specifi contents of alignment_py.py to blast_py.py
INPUT = open('alignment_py.py','r')
OUTPUT = open('blast_py.py','a')
lnum = 0
for line in INPUT:
lnum += 1
line = line.strip('\n')
if lnum > 6 and lnum < 138:
OUTPUT.write(line+'\n')
| input = open('alignment_py.py', 'r')
output = open('blast_py.py', 'a')
lnum = 0
for line in INPUT:
lnum += 1
line = line.strip('\n')
if lnum > 6 and lnum < 138:
OUTPUT.write(line + '\n') |
"""WebSocket message class"""
class WebSocketMessage:
"""A class representing a WS message"""
# pylint: disable=redefined-builtin,invalid-name
__slots__ = ["type", "id", "data", "reply"]
def __init__(self, data: dict) -> None:
self.type = data["type"]
self.id = data.get("id")
... | """WebSocket message class"""
class Websocketmessage:
"""A class representing a WS message"""
__slots__ = ['type', 'id', 'data', 'reply']
def __init__(self, data: dict) -> None:
self.type = data['type']
self.id = data.get('id')
self.data = data
self.reply = data.get('reply'... |
__author__ = 'sanyi'
class IpsetError(Exception):
pass
class IpsetNotFound(Exception):
pass
class IpsetNoRights(Exception):
pass
class IpsetInvalidResponse(Exception):
pass
class IpsetCommandHangs(Exception):
pass
class IpsetSetNotFound(Exception):
pass
class IpsetEntryNotFound(Exc... | __author__ = 'sanyi'
class Ipseterror(Exception):
pass
class Ipsetnotfound(Exception):
pass
class Ipsetnorights(Exception):
pass
class Ipsetinvalidresponse(Exception):
pass
class Ipsetcommandhangs(Exception):
pass
class Ipsetsetnotfound(Exception):
pass
class Ipsetentrynotfound(Exception)... |
# MODFLOW 6 version file automatically created using...make_release.py
# created on...February 18, 2021 08:23:34
major = 6
minor = 2
micro = 1
__version__ = '{:d}.{:d}.{:d}'.format(major, minor, micro)
| major = 6
minor = 2
micro = 1
__version__ = '{:d}.{:d}.{:d}'.format(major, minor, micro) |
def getFuel(data):
return [int(s) for s in data.split("\n")]
def fuelbois(n):
return (n // 3) - 2
def part1(data):
return sum(map(fuelbois, getFuel(data)))
def part2(data):
return sum(map(doTheThing, getFuel(data)))
def doTheThing(n):
s = fuelbois(n)
if s <= 0:
return 0
retur... | def get_fuel(data):
return [int(s) for s in data.split('\n')]
def fuelbois(n):
return n // 3 - 2
def part1(data):
return sum(map(fuelbois, get_fuel(data)))
def part2(data):
return sum(map(doTheThing, get_fuel(data)))
def do_the_thing(n):
s = fuelbois(n)
if s <= 0:
return 0
return... |
class Sidelink:
def __init__(self, name, link, subtitle, http=False, css_classes='sidelink', onclick=''):
self.name = name
self.link = link
self.subtitle = subtitle
self.http = http
self.css_classes = css_classes
self.onclick = onclick
cl... | class Sidelink:
def __init__(self, name, link, subtitle, http=False, css_classes='sidelink', onclick=''):
self.name = name
self.link = link
self.subtitle = subtitle
self.http = http
self.css_classes = css_classes
self.onclick = onclick
class Sidebar:
def __init... |
class InvalidNoteException(Exception):
pass
class InvalidModeException(Exception):
pass
class InvalidChord(Exception):
pass
| class Invalidnoteexception(Exception):
pass
class Invalidmodeexception(Exception):
pass
class Invalidchord(Exception):
pass |
# Middlewares
# https://docs.djangoproject.com/en/3.0/topics/http/middleware/
MIDDLEWARE = [
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middle... | middleware = ['whitenoise.middleware.WhiteNoiseMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.mid... |
# Copyright (c) 2016 EMC Corporation.
# 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 requ... | class Storopsexception(Exception):
message = 'Storops Error.'
class Vnxexception(StoropsException):
message = 'VNX Error.'
class Vnxstoragegrouperror(VNXException):
pass
class Vnxattachaluerror(VNXException):
pass
class Vnxalualreadyattachederror(VNXAttachAluError):
message = ('LUN already exist... |
#-------------------------------------------------------------------------------
# Name: Signals types (voltage and current)
# Author: d.Fathi
# Created: 31/03/2020
# Modified: 19/09/2021
# Copyright: (c) PyAMS 2020
# Licence: unlicense
#--------------------------------------------------... | voltage = {'discipline': 'electrical', 'nature': 'potential', 'abstol': 1e-08, 'chgtol': 1e-14, 'signalType': 'voltage', 'unit': 'V'}
current = {'discipline': 'electrical', 'nature': 'flow', 'abstol': 1e-08, 'chgtol': 1e-14, 'signalType': 'voltage', 'unit': 'A'}
electrical = {'potential': voltage, 'flow': current} |
# Replaced with the current commit when building the wheels.
__commit__ = "{{CLOUDTIK_COMMIT_SHA}}"
__version__ = "0.9.0"
| __commit__ = '{{CLOUDTIK_COMMIT_SHA}}'
__version__ = '0.9.0' |
def configure(conf):
conf.env.ARCHITECTURE = 'mips'
conf.env.VALID_ARCHITECTURES = ['mips']
conf.env.ARCH_FAMILY = 'mips'
conf.env.ARCH_LP64 = False
conf.env.append_unique('DEFINES', ['_MIPS'])
| def configure(conf):
conf.env.ARCHITECTURE = 'mips'
conf.env.VALID_ARCHITECTURES = ['mips']
conf.env.ARCH_FAMILY = 'mips'
conf.env.ARCH_LP64 = False
conf.env.append_unique('DEFINES', ['_MIPS']) |
# -*- coding: utf-8 -*-
# Copyright 2019 Cohesity Inc.
class SQLServerInstanceVersion(object):
"""Implementation of the 'SQLServerInstanceVersion' model.
Specifies the Server Instance Version.
Attributes:
build (int): Specfies the build.
major_version (int): Specfies the major version.
... | class Sqlserverinstanceversion(object):
"""Implementation of the 'SQLServerInstanceVersion' model.
Specifies the Server Instance Version.
Attributes:
build (int): Specfies the build.
major_version (int): Specfies the major version.
minor_version (int): Specfies the minor version.
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.