content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# -*- coding: utf-8 -*-
# --------------------------------------------------------------------------
# Copyright Commvault Systems, 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
#
# ... | """Main file for performing system related operations on Commcell.
System is the only class defined in this file
System: Class for performing system related operations on the commcell
System:
=======
__init__(commcell_object) -- initialise object of System class
set_gui_timeout() -- T... |
""" Count Sort Algorithm: Not a comparison based algorithm, this is useful when elements are present in a small range
n to n + k where k is comparable or smaller than n"""
"""Implementation"""
def count_sort(arr, k) -> list:
n = len(arr)
count = [0] * k
for i in range(n):
count[arr[i]] += 1
... | """ Count Sort Algorithm: Not a comparison based algorithm, this is useful when elements are present in a small range
n to n + k where k is comparable or smaller than n"""
'Implementation'
def count_sort(arr, k) -> list:
n = len(arr)
count = [0] * k
for i in range(n):
count[arr[i]] += 1
pri... |
class IncorrectPasswordException(BaseException):
def __init__(self):
print('Incorrect password')
class ExistingUserException(BaseException):
def __init__(self):
print('Existing User')
class InvalidBookException(BaseException):
def __init__(self):
print('Invalid Book')
class ... | class Incorrectpasswordexception(BaseException):
def __init__(self):
print('Incorrect password')
class Existinguserexception(BaseException):
def __init__(self):
print('Existing User')
class Invalidbookexception(BaseException):
def __init__(self):
print('Invalid Book')
class Inv... |
class AgentType():
CONSUMER_TYPE = 1
PROVIDER_ISP = 2
PROVIDER_BACKHAUL = 3
PRESENTER_TYPE = 4
PROVIDER_SUP = 5
def __init__(self, type):
self.intfNames = {}
self.intfNames[AgentType.CONSUMER_TYPE] = 'consumer'
self.intfNames[AgentType.PROVIDER_ISP]... | class Agenttype:
consumer_type = 1
provider_isp = 2
provider_backhaul = 3
presenter_type = 4
provider_sup = 5
def __init__(self, type):
self.intfNames = {}
self.intfNames[AgentType.CONSUMER_TYPE] = 'consumer'
self.intfNames[AgentType.PROVIDER_ISP] = 'provider'
se... |
x, y, w, h = input().split()
x = int(x)
y = int(y)
w = int(w)
h = int(h)
bigger_x = x
bigger_y = y
if w-x < x:
bigger_x = w-x
if h-y < y:
bigger_y = h-y
if bigger_x > bigger_y:
print(bigger_y)
else:
print(bigger_x) | (x, y, w, h) = input().split()
x = int(x)
y = int(y)
w = int(w)
h = int(h)
bigger_x = x
bigger_y = y
if w - x < x:
bigger_x = w - x
if h - y < y:
bigger_y = h - y
if bigger_x > bigger_y:
print(bigger_y)
else:
print(bigger_x) |
#colectie de date ; neordonata ; elemente unice
"""
SETS
"""
my_set ={1,2,3,4,2,3,4,4}
print(my_set)
my_set.add(7)
print(my_set)
my_set.remove(4)
print(my_set)
my_set ={1,2,3,4,2,3,4,4}
my_list =[1,2,3,4,2,3,4,4]
#print(list(set(my_list)))
a =list(set(my_list))
print(a[1])
| """
SETS
"""
my_set = {1, 2, 3, 4, 2, 3, 4, 4}
print(my_set)
my_set.add(7)
print(my_set)
my_set.remove(4)
print(my_set)
my_set = {1, 2, 3, 4, 2, 3, 4, 4}
my_list = [1, 2, 3, 4, 2, 3, 4, 4]
a = list(set(my_list))
print(a[1]) |
child_bags = {}
for _ in range(594):
outer_bag, inner_bags = input().split(' contain ')
inner_bags = inner_bags[:-1].split(', ')
if inner_bags[0] == 'no other bags':
continue
child_bags[outer_bag] = []
for bag in inner_bags:
amount = int(bag[0])
name = bag[2:] + ('s' * (a... | child_bags = {}
for _ in range(594):
(outer_bag, inner_bags) = input().split(' contain ')
inner_bags = inner_bags[:-1].split(', ')
if inner_bags[0] == 'no other bags':
continue
child_bags[outer_bag] = []
for bag in inner_bags:
amount = int(bag[0])
name = bag[2:] + 's' * (amou... |
VERSION='1.0.1'
RELEASE=VERSION
__all__ = ['VERSION', 'RELEASE']
| version = '1.0.1'
release = VERSION
__all__ = ['VERSION', 'RELEASE'] |
# https://atcoder.jp/contests/abc143/tasks/abc143_b
N = int(input())
d_arr = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
for j in range(i + 1, N):
ans += d_arr[i] * d_arr[j]
print(ans)
| n = int(input())
d_arr = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
for j in range(i + 1, N):
ans += d_arr[i] * d_arr[j]
print(ans) |
def test_index(client):
response = client.get('/')
assert response.status_code == 200
assert response.content_type == 'text/html; charset=utf-8'
def test_book_views_get(client):
response = client.get('/book')
assert response.status_code == 200
assert response.content_type == 'text/html; char... | def test_index(client):
response = client.get('/')
assert response.status_code == 200
assert response.content_type == 'text/html; charset=utf-8'
def test_book_views_get(client):
response = client.get('/book')
assert response.status_code == 200
assert response.content_type == 'text/html; charset... |
#
# PySNMP MIB module HH3C-TRAP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-TRAP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:30:03 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, single_value_constraint, constraints_union, constraints_intersection, value_size_constraint) ... |
print("Mostra numeros do 1 ao 5")
n = 1
while n <= 5:
print(n)
n = n + 1
if n==3:
continue
#if n==4:
# break
else:
print("Laco terminou normalmente")
print("Fim do programa") | print('Mostra numeros do 1 ao 5')
n = 1
while n <= 5:
print(n)
n = n + 1
if n == 3:
continue
else:
print('Laco terminou normalmente')
print('Fim do programa') |
"""
Mappings to translate URL arguments into kwargs
"""
# FUNCTIONS FOR CONVERTING URL STRING REPRESENTATIONS INTO
# PYTHON OBJECTS SUITABLE FOR CREATING PLOTS
# identity function
noop = lambda x: x
def str2num(value):
"""
Takes a string and returns its numeric representation.
ValueError will be raised ... | """
Mappings to translate URL arguments into kwargs
"""
noop = lambda x: x
def str2num(value):
"""
Takes a string and returns its numeric representation.
ValueError will be raised if the string does not represent
a valid number. Strings with decimals will be converted to
floats. Otherwise integer c... |
#
# PySNMP MIB module QUANTUMBRIDGE-REG (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/QUANTUMBRIDGE-REG
# Produced by pysmi-0.3.4 at Mon Apr 29 20:34:50 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_union, value_size_constraint, constraints_intersection, value_range_constraint) ... |
#!/usr/bin/env python3
"""Project Euler - Problem 56 Module"""
def problem56(a_limit, b_limit):
"""Problem 56 - Powerful digit sum"""
max = 0
for a in range(1, a_limit):
for b in range(1, b_limit):
p_ab_sum_digits = sum(int(x) for x in str(a ** b))
if p_ab_sum_digits > max... | """Project Euler - Problem 56 Module"""
def problem56(a_limit, b_limit):
"""Problem 56 - Powerful digit sum"""
max = 0
for a in range(1, a_limit):
for b in range(1, b_limit):
p_ab_sum_digits = sum((int(x) for x in str(a ** b)))
if p_ab_sum_digits > max:
max =... |
class Target:
def __init__(self, Id, Athlete_Id, Content, Status, Week, Year):
self.Id = Id
self.Athlete_Id = Athlete_Id
self.Content = Content
self.Status = Status
self.Week = Week
self.Year = Year
| class Target:
def __init__(self, Id, Athlete_Id, Content, Status, Week, Year):
self.Id = Id
self.Athlete_Id = Athlete_Id
self.Content = Content
self.Status = Status
self.Week = Week
self.Year = Year |
class XenditError(Exception):
"""Error that will be given when status code != 200."""
def __init__(self, xendit_response):
try:
super(XenditError, self).__init__(xendit_response.body["message"])
except KeyError:
super(XenditError, self).__init__(
... | class Xenditerror(Exception):
"""Error that will be given when status code != 200."""
def __init__(self, xendit_response):
try:
super(XenditError, self).__init__(xendit_response.body['message'])
except KeyError:
super(XenditError, self).__init__(xendit_response.body['err... |
class Person:
def __init__(self, firstname = "J.", lastname = "Doe", wage = 10.00, hours = 40.00):
self.firstname = firstname
self.lastname = lastname
self.wage = wage
self.hours = hours
def getPerson(self):
firstname, lastname = input("Hello! What is your full name?: ")... | class Person:
def __init__(self, firstname='J.', lastname='Doe', wage=10.0, hours=40.0):
self.firstname = firstname
self.lastname = lastname
self.wage = wage
self.hours = hours
def get_person(self):
(firstname, lastname) = input('Hello! What is your full name?: ').split... |
# /usr/bin/env python
# coding=utf-8
def disable_iptables():
pass
| def disable_iptables():
pass |
"""Various exception classes
"""
class ConversationSendError(Exception):
"""Raised if there are no tags available for a given conversation."""
| """Various exception classes
"""
class Conversationsenderror(Exception):
"""Raised if there are no tags available for a given conversation.""" |
"""
Class representing atom
"""
ResiduesCodes = {
'ALA': 'A',
'ARG': 'R',
'ASN': 'N',
'ASP': 'D',
'CYS': 'C',
'GLU': 'E',
'GLN': 'Q',
'GLY': 'G',
'HIS': 'H',
'ILE': 'I',
'LEU': 'L',
'LYS': 'K',
'MET': 'M',
'PHE': 'F',
'PRO': 'P',
'SER': ... | """
Class representing atom
"""
residues_codes = {'ALA': 'A', 'ARG': 'R', 'ASN': 'N', 'ASP': 'D', 'CYS': 'C', 'GLU': 'E', 'GLN': 'Q', 'GLY': 'G', 'HIS': 'H', 'ILE': 'I', 'LEU': 'L', 'LYS': 'K', 'MET': 'M', 'PHE': 'F', 'PRO': 'P', 'SER': 'S', 'THR': 'T', 'TRP': 'W', 'TYR': 'Y', 'VAL': 'V', 'GLX': 'Q', 'ASX': 'N', 'UNK':... |
#Source : https://leetcode.com/problems/reverse-string-ii/
#Author : Yuan Wang
#Date : 2018-06-29
'''
**********************************************************************************
*Given a string and an integer k, you need to reverse the first k characters for
*every 2k characters counting from the start of t... | """
**********************************************************************************
*Given a string and an integer k, you need to reverse the first k characters for
*every 2k characters counting from the start of the string. If there are less than
*k characters left, reverse all of them. If there are less than 2k... |
input = """
a(1) v a(2).
a(3) v a(4).
ok :- not #count{T: a(T)} > 2, #count{V : a(V)} > 1.
"""
output = """
{a(1), a(3), ok}
{a(1), a(4), ok}
{a(2), a(3), ok}
{a(2), a(4), ok}
"""
| input = '\na(1) v a(2).\n\na(3) v a(4).\n\nok :- not #count{T: a(T)} > 2, #count{V : a(V)} > 1.\n'
output = '\n{a(1), a(3), ok}\n{a(1), a(4), ok}\n{a(2), a(3), ok}\n{a(2), a(4), ok}\n' |
class MCTS(object):
pass
class ParallelMCTS(MCTS):
pass | class Mcts(object):
pass
class Parallelmcts(MCTS):
pass |
#
# PySNMP MIB module NETSCREEN-SET-DHCP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NETSCREEN-SET-DHCP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:10:33 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, single_value_constraint, value_size_constraint, value_range_constraint) ... |
class orders:
def __init__(self):
''' Order storage and build class '''
self.orders = {}
self._id = -1
def get_order(self, _id):
return self.orders[str(_id)]
def _close(self, _id=None):
self.orders.pop(str(_id))
def _open(self, price, side, size, fee):
... | class Orders:
def __init__(self):
""" Order storage and build class """
self.orders = {}
self._id = -1
def get_order(self, _id):
return self.orders[str(_id)]
def _close(self, _id=None):
self.orders.pop(str(_id))
def _open(self, price, side, size, fee):
... |
"""
Given a string text, you need to use the characters of text to form as many instances of the word "lambda" as possible.
You can use each character in text at most once.
Write a function that returns the maximum number of instances of "lambda" that can be formed.
Example 1:
Input: text = "mbxcdatlas"
Output: 1
E... | """
Given a string text, you need to use the characters of text to form as many instances of the word "lambda" as possible.
You can use each character in text at most once.
Write a function that returns the maximum number of instances of "lambda" that can be formed.
Example 1:
Input: text = "mbxcdatlas"
Output: 1
E... |
#
# PySNMP MIB module HMPRIV-MGMT-SNMP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HMPRIV-MGMT-SNMP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:18:06 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, constraints_union, constraints_intersection, value_range_constraint) ... |
# FizzBuzz in python using nested if else
# Author - @hritikchaturvedi11
for i in range(1,100):
if(i % 3 == 0 and i % 5 == 0):
print('FizzBuzz')
elif(i % 3 == 0):
print('Fizz')
elif(i % 5 == 0):
print('Buzz')
else:
print(i)
| for i in range(1, 100):
if i % 3 == 0 and i % 5 == 0:
print('FizzBuzz')
elif i % 3 == 0:
print('Fizz')
elif i % 5 == 0:
print('Buzz')
else:
print(i) |
class UserRepositoryError(Exception):
def __init__(self, message: str):
raise Exception(message)
class UserDoesNotExist(UserRepositoryError):
pass
class UsernameAlreadyTakenError(UserRepositoryError):
pass
class EmailAlreadyTakenError(UserRepositoryError):
pass
| class Userrepositoryerror(Exception):
def __init__(self, message: str):
raise exception(message)
class Userdoesnotexist(UserRepositoryError):
pass
class Usernamealreadytakenerror(UserRepositoryError):
pass
class Emailalreadytakenerror(UserRepositoryError):
pass |
comec=input().split()
hCOMEC=input().split()
final=input().split()
hFINAL=input().split()
di,df=int(comec[1]),int(final[1])
hi,mi,si=int(hCOMEC[0]), int(hCOMEC[2]), int(hCOMEC[4])
hf,mf,sf=int(hFINAL[0]), int(hFINAL[2]), int(hFINAL[4])
mSEG=60
hSEG=mSEG*60
dSEG=hSEG*24
i,f=si+mi*mSEG+hi*hSEG+di*dSEG,sf+mf*mSEG+hf*hSEG+... | comec = input().split()
h_comec = input().split()
final = input().split()
h_final = input().split()
(di, df) = (int(comec[1]), int(final[1]))
(hi, mi, si) = (int(hCOMEC[0]), int(hCOMEC[2]), int(hCOMEC[4]))
(hf, mf, sf) = (int(hFINAL[0]), int(hFINAL[2]), int(hFINAL[4]))
m_seg = 60
h_seg = mSEG * 60
d_seg = hSEG * 24
(i,... |
num1=int(input("Enter the number1"))
num2=int(input("Enter the number2"))
print("Addition of the two numbers:",(num1+num2))
print("Subtraction of the two numbers:",(num1-num2))
print("Multiplication of the two numbers:",(num1*num2))
print("Division of the two number:",(num1/num2))
print("Remainder of the two number:",(... | num1 = int(input('Enter the number1'))
num2 = int(input('Enter the number2'))
print('Addition of the two numbers:', num1 + num2)
print('Subtraction of the two numbers:', num1 - num2)
print('Multiplication of the two numbers:', num1 * num2)
print('Division of the two number:', num1 / num2)
print('Remainder of the two nu... |
# You are climbing a staircase. It takes n steps to reach the top.
# Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
#
# Example 1:
# Input: n = 2
# Output: 2
# Explanation: There are two ways to climb to the top.
# 1. 1 step + 1 step
# 2. 2 steps
#
# Example 2:
# Input:... | class Solution:
def climb_stairs(self, n: int) -> int:
self.visited = {}
return self.helper(n)
def helper(self, level):
if level in self.visited:
return self.visited[level]
if level == 1 or level == 2:
return level
elif level < 1:
ret... |
#
# PySNMP MIB module NOKIA-UNITTYPES-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NOKIA-UNITTYPES-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:23:38 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, constraints_union, constraints_intersection, value_size_constraint) ... |
# region headers
# * author: salaheddine.gassim@nutanix.com
# * version: v1.0/10032020 - initial version
# task_name: F5CreateNode
# description: Create a node or nodes to be used inside a pool
# input vars: vm_name, vm_ip, f5_node_description, f5_partition
# output vars: n/a
# endregion
# region capture... | api_server = '@@{fortigate_endpoint}@@'
f5_login = '@@{fortigate.username}@@'
f5_password = '@@{fortigate.secret}@@'
api_server_port = 443
vm_name = 'toto'
vm_ip = '@@{address}@@'
f5_node_description = '@@{awx_application_name}@@' + ' node'
f5_partition = '@@{f5_partition}@@'
def f5_create_node(api_server, api_server_... |
# Copyright (c) 2021 - present / Neuralmagic, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | """
Deprecated script kindly use the following task specific scripts for
optimization tasks on image classification and object detection models:
* Model pruning - integrations/pytorch/train.py
* Quantization aware training - integrations/pytorch/train.py
* Sparse transfer learning - integrations/pytorch/train.py
* pr... |
"""
Module for build utilities to distiguish different tensorflow versions.
"""
load("@org_tensorflow//tensorflow:tensorflow.bzl", "VERSION_MAJOR")
def if_v2(a):
if VERSION_MAJOR == "2":
return a
else:
return []
def if_not_v2(a):
if VERSION_MAJOR == "2":
return []
else:
... | """
Module for build utilities to distiguish different tensorflow versions.
"""
load('@org_tensorflow//tensorflow:tensorflow.bzl', 'VERSION_MAJOR')
def if_v2(a):
if VERSION_MAJOR == '2':
return a
else:
return []
def if_not_v2(a):
if VERSION_MAJOR == '2':
return []
else:
... |
# -*- coding: utf8 -*-
"""
Validation logic
"""
def validate_temperature_mode(mode): # TODO more type specific validation
"""Ensures the temperature mode
has the right data schema
"""
errors = []
schema = {
'target': 'Target temperature mode value.',
'logs': [
{
... | """
Validation logic
"""
def validate_temperature_mode(mode):
"""Ensures the temperature mode
has the right data schema
"""
errors = []
schema = {'target': 'Target temperature mode value.', 'logs': [{'file': '*** SEND A LOG FILE AS BASE64 STRING ***', 'sensors_count': 'How many sensors to parse ... |
config = dict(
model=dict(
type='deeplabv3plus',
params=dict(
encoder=dict(
type='deeplab_encoder',
params=dict(
resnet_encoder=dict(
resnet_type='resnet50',
include_conv5=True,
... | config = dict(model=dict(type='deeplabv3plus', params=dict(encoder=dict(type='deeplab_encoder', params=dict(resnet_encoder=dict(resnet_type='resnet50', include_conv5=True, batchnoram_trainable=False, pretrained=False, freeze_at=0, output_stride=16), aspp=dict(in_channel=2048, aspp_dim=256, atrous_rates=(6, 12, 18), add... |
__all__ = ['LoginFailedException', 'NoElementException']
class LoginFailedException(Exception):
"""Raise when login failed"""
def __init__(self, arg):
self.strerror = arg
self.args = {arg}
class NoElementException(Exception):
"""Raise when required elements cannot be found"""
def _... | __all__ = ['LoginFailedException', 'NoElementException']
class Loginfailedexception(Exception):
"""Raise when login failed"""
def __init__(self, arg):
self.strerror = arg
self.args = {arg}
class Noelementexception(Exception):
"""Raise when required elements cannot be found"""
def __i... |
# -*- python -*-
# This software was produced by NIST, an agency of the U.S. government,
# and by statute is not subject to copyright in the United States.
# Recipients of this software assume all responsibilities associated
# with its operation, modification and maintenance. However, to
# facilitate maintenance we as... | dirname = 'elasticity'
if not DIM_3:
clib = 'oof2engine'
else:
clib = 'oof3dengine'
subdirs = ['aniso', 'iso', 'thermo', 'nonlinear', 'visco', 'largestrain']
cfiles = ['cijkl.C', 'elasticity.C']
hfiles = ['cijkl.h', 'elasticity.h']
swigfiles = ['cijkl.swg', 'elasticity.swg']
swigpyfiles = ['cijkl.spy']
pyfiles ... |
def descend_density_tree(data_point, node):
"""given some test data and decision tree, assign the correct label using a decision tree"""
if data_point[node.split_dimension] < node.split_value:
if node.left is not None: # no leaf node
return descend_density_tree(data_point, node.left)
... | def descend_density_tree(data_point, node):
"""given some test data and decision tree, assign the correct label using a decision tree"""
if data_point[node.split_dimension] < node.split_value:
if node.left is not None:
return descend_density_tree(data_point, node.left)
else:
... |
BLACKLISTS_MAPPING = {
'blacklists_add': {
'resource': 'blacklists/add.json',
'docs': 'https://disqus.com/api/docs/blacklists/add/',
'methods': ['POST'],
},
'blacklists_list': {
'resource': 'blacklists/list.json',
'docs': 'https://disqus.com/api/docs/blacklists/list/'... | blacklists_mapping = {'blacklists_add': {'resource': 'blacklists/add.json', 'docs': 'https://disqus.com/api/docs/blacklists/add/', 'methods': ['POST']}, 'blacklists_list': {'resource': 'blacklists/list.json', 'docs': 'https://disqus.com/api/docs/blacklists/list/', 'methods': ['GET']}, 'blacklists_remove': {'resource': ... |
"""
This PEP proposes re-designing the buffer interface
(PyBufferProcs function pointers) to improve the way
Python allows memory sharing in Python 3.0
In particular, it is proposed that the character buffer
portion of the API be eliminated and the
multiple-segment portion be re-designed
in conjunction with allow... | """
This PEP proposes re-designing the buffer interface
(PyBufferProcs function pointers) to improve the way
Python allows memory sharing in Python 3.0
In particular, it is proposed that the character buffer
portion of the API be eliminated and the
multiple-segment portion be re-designed
in conjunction with allow... |
"""Kata url: https://www.codewars.com/kata/56fa3c5ce4d45d2a52001b3c."""
def xor(a: bool, b: bool) -> bool:
return a ^ b
| """Kata url: https://www.codewars.com/kata/56fa3c5ce4d45d2a52001b3c."""
def xor(a: bool, b: bool) -> bool:
return a ^ b |
class Deck(object):
def __init__(self, name, archetype=None, legality=None):
self.name = name
self.archetype = archetype
self.legality = legality
self.mainboard = {}
self.sideboard = {}
def addCardToMainboard(self, name, amount=1):
if name not in self.mainboar... | class Deck(object):
def __init__(self, name, archetype=None, legality=None):
self.name = name
self.archetype = archetype
self.legality = legality
self.mainboard = {}
self.sideboard = {}
def add_card_to_mainboard(self, name, amount=1):
if name not in self.mainboa... |
# -*- coding: utf-8 -*-
"""
In this problem, we want to rotate the matrix elements by 90, 180, 270 (counterclockwise)
Discussion in stackoverflow:
https://stackoverflow.com/questions/42519/how-do-you-rotate-a-two-dimensional-array
"""
def rotate_90(matrix: [[]]):
"""
>>> rotate_90([[1, 2, 3, 4], [5, 6,... | """
In this problem, we want to rotate the matrix elements by 90, 180, 270 (counterclockwise)
Discussion in stackoverflow:
https://stackoverflow.com/questions/42519/how-do-you-rotate-a-two-dimensional-array
"""
def rotate_90(matrix: [[]]):
"""
>>> rotate_90([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [... |
#! python
"""How many Sundays fell on the first of the month during the
twentieth century (1 Jan 1901 to 31 Dec 2000)?"""
# Instead of using datetime module I wanted to create the function from scratch
DAYS = (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
def date(day, month, year):
"""Returns the number of ... | """How many Sundays fell on the first of the month during the
twentieth century (1 Jan 1901 to 31 Dec 2000)?"""
days = (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
def date(day, month, year):
"""Returns the number of days since 1/1/1"""
is_leap = year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
... |
API_ERROR_CODE = {
-40101: 'SYSTEM',
-40102: 'EXPT',
-40103: 'NOMEMORY',
-40104: 'INVEVT',
-40105: 'CODE',
-40106: 'INVINSTRUCT',
-40107: 'FORBID',
-40108: 'NOECHO',
-40109: 'SYSBUSY',
-40110: 'NODEVICE',
-40201: 'OVERFLOW',
-40202: 'TOOLONG',
-40203: 'ENTRYEXIST',
... | api_error_code = {-40101: 'SYSTEM', -40102: 'EXPT', -40103: 'NOMEMORY', -40104: 'INVEVT', -40105: 'CODE', -40106: 'INVINSTRUCT', -40107: 'FORBID', -40108: 'NOECHO', -40109: 'SYSBUSY', -40110: 'NODEVICE', -40201: 'OVERFLOW', -40202: 'TOOLONG', -40203: 'ENTRYEXIST', -40204: 'REFERED', -40205: 'ENTRYNOTEXIST', -40206: 'EN... |
# model settings
# norm_cfg = dict(type='SyncBN', requires_grad=True)
norm_cfg = dict(type='BN', requires_grad=True)
# decide data directory by home name
# please remove these lines and directly set data_root for your training
# import os
# if '/home/feng' in os.getcwd():
# pretrain_path = '/home/feng/work_mmseg/c... | norm_cfg = dict(type='BN', requires_grad=True)
model = dict(type='EncoderDecoder', pretrained='/home/feng/work_mmseg/checkpoints/moco_r50_200ep_trans.pth', backbone=dict(type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 1, 2), strides=(1, 2, 2, 1), norm_cfg=norm_cfg, norm_eval=False, sty... |
__MAJOR__ = "0"
__MINOR__ = "0"
__PATCH__ = "0"
__SUFFIX__ = "dev"
__version__ = "{}.{}.{}".format(__MAJOR__, __MINOR__, __PATCH__)
if __SUFFIX__:
__version__ = "{}_{}".format(__version__, __SUFFIX__)
| __major__ = '0'
__minor__ = '0'
__patch__ = '0'
__suffix__ = 'dev'
__version__ = '{}.{}.{}'.format(__MAJOR__, __MINOR__, __PATCH__)
if __SUFFIX__:
__version__ = '{}_{}'.format(__version__, __SUFFIX__) |
def sift_up(heap, index) -> int:
if index == 1:
return index
parent_idx = index // 2
if heap[parent_idx] < heap[index]:
heap[index], heap[parent_idx] = heap[parent_idx], heap[index]
index = sift_up(heap, parent_idx)
return index
| def sift_up(heap, index) -> int:
if index == 1:
return index
parent_idx = index // 2
if heap[parent_idx] < heap[index]:
(heap[index], heap[parent_idx]) = (heap[parent_idx], heap[index])
index = sift_up(heap, parent_idx)
return index |
def to_ini(databases = []):
"""
Custom ansible filter to print out pgbouncer database connection settings
from a list of variable objects.
"""
s = ''
for db in databases:
for alias, config in db.items():
s = s + str(alias) + ' = '
for key, value in config.items():... | def to_ini(databases=[]):
"""
Custom ansible filter to print out pgbouncer database connection settings
from a list of variable objects.
"""
s = ''
for db in databases:
for (alias, config) in db.items():
s = s + str(alias) + ' = '
for (key, value) in config.items(... |
"""
This problem was asked by Dropbox.
Given a string s and a list of words words, where each word is the same length,
find all starting indices of substrings in s that is a concatenation of every word in words exactly once.
For example, given s = "dogcatcatcodecatdog" and words = ["cat", "dog"], return [0, 13],
sin... | """
This problem was asked by Dropbox.
Given a string s and a list of words words, where each word is the same length,
find all starting indices of substrings in s that is a concatenation of every word in words exactly once.
For example, given s = "dogcatcatcodecatdog" and words = ["cat", "dog"], return [0, 13],
sin... |
user= input('what are you doing?')
print(user.upper())
print(user.lower())
print(user.swapcase())
| user = input('what are you doing?')
print(user.upper())
print(user.lower())
print(user.swapcase()) |
'''
Write a Python program to get the difference between a given number and 17, if the number is greater than 17 return double the absolute difference.
'''
def difference(num):
const = 17
if num > const:
print(str(abs(num - const) * 2))
else:
print(str(abs(num - const)))
difference(22)
d... | """
Write a Python program to get the difference between a given number and 17, if the number is greater than 17 return double the absolute difference.
"""
def difference(num):
const = 17
if num > const:
print(str(abs(num - const) * 2))
else:
print(str(abs(num - const)))
difference(22)
diff... |
class Sweepstakes_Stack_Manager:
def __init__(self, stack):
self.sweepstakes_stack_manager = Sweepstakes_Stack_Manager
self.stack = stack
def insert_sweepstakes(sweepstakes): pass
def get_sweepstakes(): Sweepstake | class Sweepstakes_Stack_Manager:
def __init__(self, stack):
self.sweepstakes_stack_manager = Sweepstakes_Stack_Manager
self.stack = stack
def insert_sweepstakes(sweepstakes):
pass
def get_sweepstakes():
Sweepstake |
# File: skybox_consts.py
#
# Copyright (c) 2020 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 required by applicabl... | skybox_wsdl = '{base_url}/skybox/webservice/jaxws/{service}?wsdl'
skybox_config_base_url = 'base_url'
skybox_config_username = 'username'
skybox_config_password = 'password'
skybox_service_administration = 'administration'
skybox_service_firewall = 'firewall'
skybox_service_network = 'network'
skybox_service_tickets = ... |
# declare the list of users
lst = ['joe', 'sue', 'hani', 'sophie']
# # complexity: time and space
# O(n) O(40000)
# O(1)
# O(log(n))
# get user input
# login = input('Enter your id: ')
# login.lower()
# check if user exists in list
# method 1
# for item in lst:
# if item == login:
# print(f'Login: {login} \
# ... | lst = ['joe', 'sue', 'hani', 'sophie']
user_id = input('Enter new user id: ')
lst.append(user_id)
print(f'A new user, {user_id} has just been added. ') |
__title__ = 'compas_rpc_example'
__description__ = 'examples for using cpython functions in gh/rhino via compas_rpc'
__url__ = 'https://github.com/yijiangh/compas_rpc_examples'
__version__ = '0.0.1'
__author__ = 'Yijiang Huang'
__author_email__ = 'yijiangh@mit.edu'
__license__ = 'MIT license'
__copyright__ = 'Copyright... | __title__ = 'compas_rpc_example'
__description__ = 'examples for using cpython functions in gh/rhino via compas_rpc'
__url__ = 'https://github.com/yijiangh/compas_rpc_examples'
__version__ = '0.0.1'
__author__ = 'Yijiang Huang'
__author_email__ = 'yijiangh@mit.edu'
__license__ = 'MIT license'
__copyright__ = 'Copyright... |
def sort_scores(unsorted_scores, highest_possible_score):
# initialize a new list score_count to the size of highest_possible_score plus one
score_count = [None] * (highest_possible_score + 1)
# initialize sorted_scores to an empty list
sorted_scores = []
# loop through every score in unsorted_scor... | def sort_scores(unsorted_scores, highest_possible_score):
score_count = [None] * (highest_possible_score + 1)
sorted_scores = []
for score in unsorted_scores:
if score_count[score] is not None:
score_count[score] += 1
else:
score_count[score] = 1
for index in rang... |
# Poisson Distribution II
lambda_1, lambda_2 = map(float, input().split())
cost_1 = 160 + 40 * (lambda_1 + lambda_1 ** 2)
cost_2 = 128 + 40 * (lambda_2 + lambda_2 ** 2)
print(f'{cost_1:.3f}')
print(f'{cost_2:.3f}')
| (lambda_1, lambda_2) = map(float, input().split())
cost_1 = 160 + 40 * (lambda_1 + lambda_1 ** 2)
cost_2 = 128 + 40 * (lambda_2 + lambda_2 ** 2)
print(f'{cost_1:.3f}')
print(f'{cost_2:.3f}') |
def helloworld():
print("Hello, world!")
def board():
pion = '|'.join([' ']*3)
poziom = '\n{}\n'.format('-'*8)
print(pion,pion,pion,sep=poziom)
def tictactoe():
pion = 'H'.join([' | | ']*3) + '\n'
poziom ='H'.join(['--+--+--']*3) + '\n'
blok = pion.join([poziom]*3)
separator = ... | def helloworld():
print('Hello, world!')
def board():
pion = '|'.join([' '] * 3)
poziom = '\n{}\n'.format('-' * 8)
print(pion, pion, pion, sep=poziom)
def tictactoe():
pion = 'H'.join([' | | '] * 3) + '\n'
poziom = 'H'.join(['--+--+--'] * 3) + '\n'
blok = pion.join([poziom] * 3)
se... |
"""
This module is automatically generated by SGQLC using introspective queries
on a conservator instance.
The rest of the conservator library is built on top of this autogenerated API.
Run ``generate.sh`` to update these files.
"""
| """
This module is automatically generated by SGQLC using introspective queries
on a conservator instance.
The rest of the conservator library is built on top of this autogenerated API.
Run ``generate.sh`` to update these files.
""" |
"""
Object Oriented Programming
"""
s = "this is a string"
a = "one more string"
s.upper()
s.lower()
print(type('s'))
print(type('a'))
print(type([1, 2, 3])) | """
Object Oriented Programming
"""
s = 'this is a string'
a = 'one more string'
s.upper()
s.lower()
print(type('s'))
print(type('a'))
print(type([1, 2, 3])) |
SERVICE_NAME = "org.bluez"
AGENT_IFACE = SERVICE_NAME + ".Agent1"
ADAPTER_IFACE = SERVICE_NAME + ".Adapter1"
DEVICE_IFACE = SERVICE_NAME + ".Device1"
OBJECT_IFACE = "org.freedesktop.DBus.ObjectManager"
PROPERTIES_IFACE = "org.freedesktop.DBus.Properties"
INTROSPECT_IFACE = "org.freedesktop.DBus.Introspectable"
| service_name = 'org.bluez'
agent_iface = SERVICE_NAME + '.Agent1'
adapter_iface = SERVICE_NAME + '.Adapter1'
device_iface = SERVICE_NAME + '.Device1'
object_iface = 'org.freedesktop.DBus.ObjectManager'
properties_iface = 'org.freedesktop.DBus.Properties'
introspect_iface = 'org.freedesktop.DBus.Introspectable' |
# Smallest in v2
b=int(input())
while 1:
b+=1
if 4==len(set(str(b))):
print(b)
break
| b = int(input())
while 1:
b += 1
if 4 == len(set(str(b))):
print(b)
break |
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 16 16:09:11 2014
@author: crousse
"""
class Note(object):
def __init__(self, notesData):
self.folder = notesData['vars']['F_Folder'][0]
self.stim = notesData['vars']['F_Stim'][0]
self.startTime = notesData['vars']['F_Tbgn'][0]
... | """
Created on Wed Jul 16 16:09:11 2014
@author: crousse
"""
class Note(object):
def __init__(self, notesData):
self.folder = notesData['vars']['F_Folder'][0]
self.stim = notesData['vars']['F_Stim'][0]
self.startTime = notesData['vars']['F_Tbgn'][0]
self.endTime = notesData['vars'... |
class BuilderStepError(Exception):
pass
class HttpAdapterError(Exception):
pass
| class Buildersteperror(Exception):
pass
class Httpadaptererror(Exception):
pass |
#!/usr/bin/env python
# coding: utf-8
# In[277]:
############################
# Traffic Light Checker
#
# C. Morgenstern | 16.07.21
############################
# In[278]:
# prompt user for input sequence
inp = input('Traffic light sequence: ')
# In[279]:
# specify traffic light codes
code = ['R', 'Y', 'G',... | inp = input('Traffic light sequence: ')
code = ['R', 'Y', 'G', 'P', 'C', 'X']
if len(max(inp.split(' '), key=len)) != 1 or inp.isupper() == False:
print('ERROR')
elif any((s.isdigit() for s in inp)):
print('ERROR')
else:
seq = [x for x in inp if x.strip()]
if len(seq) == 0 or len(seq) > 15:
prin... |
# -*- coding: utf-8 -*-
VERSION = (0, 5, 0, "dev0")
__version__ = '.'.join(str(x) for x in VERSION)
__all__ = []
| version = (0, 5, 0, 'dev0')
__version__ = '.'.join((str(x) for x in VERSION))
__all__ = [] |
london = [[0, [], [], [], []],
[1, [8, 9], [58, 46], [46], []],
[2, [10, 20], [], [], []],
[3, [4, 11, 12], [22, 23], [], []],
[4, [3, 13], [], [], []],
[5, [15, 16], [], [], []],
[6, [7, 29], [], [], []],
[7, [6, 17], [42], [], []],
... | london = [[0, [], [], [], []], [1, [8, 9], [58, 46], [46], []], [2, [10, 20], [], [], []], [3, [4, 11, 12], [22, 23], [], []], [4, [3, 13], [], [], []], [5, [15, 16], [], [], []], [6, [7, 29], [], [], []], [7, [6, 17], [42], [], []], [8, [1, 18, 19], [], [], []], [9, [1, 19, 20], [], [], []], [10, [2, 11, 21, 34], [], ... |
def score(input):
if (input[2]) <= (2.449999988079071):
var0 = [1.0, 0.0, 0.0]
else:
if (input[3]) <= (1.75):
if (input[2]) <= (4.950000047683716):
if (input[3]) <= (1.6500000357627869):
var0 = [0.0, 1.0, 0.0]
else:
... | def score(input):
if input[2] <= 2.449999988079071:
var0 = [1.0, 0.0, 0.0]
elif input[3] <= 1.75:
if input[2] <= 4.950000047683716:
if input[3] <= 1.6500000357627869:
var0 = [0.0, 1.0, 0.0]
else:
var0 = [0.0, 0.0, 1.0]
else:
... |
"""
All the request/response classes.
"""
class trigger_request():
def __init__(self) :
self.trigger_type = str()
self.machine = str()
return
| """
All the request/response classes.
"""
class Trigger_Request:
def __init__(self):
self.trigger_type = str()
self.machine = str()
return |
"""
Determine index of characters that differs from the others in respect to
being alphanumeric or not.
alphanumeric == abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
Examples:
['A', 'f', '.', 'Q', 2] # returns index 2 (dot differs as non-alphanumeric)
['.', '{', ' ^', '%', 'a'] # returns index 4 ('... | """
Determine index of characters that differs from the others in respect to
being alphanumeric or not.
alphanumeric == abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
Examples:
['A', 'f', '.', 'Q', 2] # returns index 2 (dot differs as non-alphanumeric)
['.', '{', ' ^', '%', 'a'] # returns index 4 ('... |
def gcd(a, b):
if b > a:
if b % a == 0:
return a
else:
return gcd(b % a, a)
else:
if a % b == 0:
return b
else:
return gcd(b, a % b)
def find_d(phi_n, e):
k = 1
mod0 = False
while not mod0:
... | def gcd(a, b):
if b > a:
if b % a == 0:
return a
else:
return gcd(b % a, a)
elif a % b == 0:
return b
else:
return gcd(b, a % b)
def find_d(phi_n, e):
k = 1
mod0 = False
while not mod0:
(d, rem) = divmod(k * phi_n + 1, e)
i... |
a = 'aa'
valor = 0
print(type(a))
if type(a) == int:
valor = int
print(valor)
print('numero')
if type(a) == str:
valor = str
print('letras')
print(valor)
p = valor(input('Digite algo: '))
print(p) | a = 'aa'
valor = 0
print(type(a))
if type(a) == int:
valor = int
print(valor)
print('numero')
if type(a) == str:
valor = str
print('letras')
print(valor)
p = valor(input('Digite algo: '))
print(p) |
'''
QRCode Facade.
=============
The :class:`QRCode` is to provide suite of tools for handling QR codes
in your desktop devices.
It currently supports scanning code, reading file, encode qr and
getting available qr data type list.
Custom Requirements
-------------------
OSX: qrtools, zbar, pypng
Linux: qrtool... | """
QRCode Facade.
=============
The :class:`QRCode` is to provide suite of tools for handling QR codes
in your desktop devices.
It currently supports scanning code, reading file, encode qr and
getting available qr data type list.
Custom Requirements
-------------------
OSX: qrtools, zbar, pypng
Linux: qrtools, zbar, p... |
__author__ = 'nikaashpuri'
'''
from tastypie.resources import ModelResource
from machine.models import Device
from tastypie.authentication import ApiKeyAuthentication
from tastypie.authorization import Authorization
from django.contrib.auth.models import User
class DeviceResource(ModelResource):
class Meta:
... | __author__ = 'nikaashpuri'
"\nfrom tastypie.resources import ModelResource\nfrom machine.models import Device\nfrom tastypie.authentication import ApiKeyAuthentication\nfrom tastypie.authorization import Authorization\nfrom django.contrib.auth.models import User\n\nclass DeviceResource(ModelResource):\n class Meta:\... |
def fib(i):
if i <= 0:
return 0
elif i == 1:
return 1
return fib(i-1) + fib(i-2)
def fib_m_(i, memo):
if i <= 0:
return 0
elif i == 1:
return 1
elif i in memo:
return memo[i]
a = fib_m_(i-1, memo)
memo[i-1] = a
b = fib_m_(i-2, memo)
memo... | def fib(i):
if i <= 0:
return 0
elif i == 1:
return 1
return fib(i - 1) + fib(i - 2)
def fib_m_(i, memo):
if i <= 0:
return 0
elif i == 1:
return 1
elif i in memo:
return memo[i]
a = fib_m_(i - 1, memo)
memo[i - 1] = a
b = fib_m_(i - 2, memo)
... |
class Array:
def __init__(self,name) -> None:
self.name=name
pass
def gen_array(self,length):
self.name=[None for i in range(length)]
def gen_2D_array(self,width=10,height=10):
self.name=[[None for i in range(width)] for j in range(height)]
def add_array(... | class Array:
def __init__(self, name) -> None:
self.name = name
pass
def gen_array(self, length):
self.name = [None for i in range(length)]
def gen_2_d_array(self, width=10, height=10):
self.name = [[None for i in range(width)] for j in range(height)]
def add_array(se... |
class NumberComputer:
def reachable_nodes(self, n):
result = set()
stack = [n]
while len(stack) != 0:
node = stack.pop()
assert (node in self.interval)
if node in result:
continue
result.add(node)
for succ in self.succ_func(node):
if succ in self.interval:
stack.append(succ)
# sa... | class Numbercomputer:
def reachable_nodes(self, n):
result = set()
stack = [n]
while len(stack) != 0:
node = stack.pop()
assert node in self.interval
if node in result:
continue
result.add(node)
for succ in self.suc... |
#!/usr/bin/env python
class LinkedList:
def __init__(self):
self.first_n = None
def get_smallest(self):
if self.first_n != None:
return self.first_n.get_item()
else:
return None
def insert_item(self, item):
if self.first_n == None: ... | class Linkedlist:
def __init__(self):
self.first_n = None
def get_smallest(self):
if self.first_n != None:
return self.first_n.get_item()
else:
return None
def insert_item(self, item):
if self.first_n == None:
newnode = node(item)
... |
__author__ = 'Kwame'
print("massive!!!")
| __author__ = 'Kwame'
print('massive!!!') |
class EulerTour:
"""Abstract base class for performing Euler tour of a tree.
_hook_previsit ans _hook_postvisit may be overriden by subclasses.
"""
def __init__(self,tree):
"""Prepare an Euler tour template for given tree."""
self._tree = tree
def tree(self):
"""Return refe... | class Eulertour:
"""Abstract base class for performing Euler tour of a tree.
_hook_previsit ans _hook_postvisit may be overriden by subclasses.
"""
def __init__(self, tree):
"""Prepare an Euler tour template for given tree."""
self._tree = tree
def tree(self):
"""Return re... |
class Solution(object):
def reverseWords(self, s: str) -> str:
s = [x for x in s.split(" ") if len(x) > 0]
print(s)
i = 0
j = len(s) - 1
while i < j:
s[i], s[j] = s[j], s[i]
i += 1
j -= 1
return " ".join(s) if len(s) > 0 else ""
| class Solution(object):
def reverse_words(self, s: str) -> str:
s = [x for x in s.split(' ') if len(x) > 0]
print(s)
i = 0
j = len(s) - 1
while i < j:
(s[i], s[j]) = (s[j], s[i])
i += 1
j -= 1
return ' '.join(s) if len(s) > 0 else ... |
# Some meta data for conversion, etc.
# TODO: need a way to match skeleton
# personnel / girl / trooper
skel1 = [
"foot_r", "calf_r", "thigh_r", "thigh_l", "calf_l",
"foot_l", "pelvis", "neck_01", None, None,
"hand_r", "lowerarm_r", "upperarm_r", "upperarm_l", "lowerarm_l",
"hand_l"
]
skel_edge = [
... | skel1 = ['foot_r', 'calf_r', 'thigh_r', 'thigh_l', 'calf_l', 'foot_l', 'pelvis', 'neck_01', None, None, 'hand_r', 'lowerarm_r', 'upperarm_r', 'upperarm_l', 'lowerarm_l', 'hand_l']
skel_edge = [(0, 1), (1, 2), (3, 4), (4, 5), (6, 7), (7, 8), (8, 9), (10, 11), (11, 12), (13, 14), (14, 15), (2, 6), (3, 6), (12, 7), (13, 7... |
# Keys in the extracted lexicon
# These are also the keys used to parse the NIH lexicon, although keys
# that are only used for parsing and don't end up in the final are not
# included here.
class SKey(object):
# The "categories", aka Part-of-Speech in Lexicon
NOUN = 'noun'
ADJ = 'adj'
AD... | class Skey(object):
noun = 'noun'
adj = 'adj'
adv = 'adv'
verb = 'verb'
aux = 'aux'
modal = 'modal'
pron = 'pron'
det = 'det'
prep = 'prep'
conj = 'conj'
compl = 'compl'
gender = 'gender'
stative = 'stative'
proper = 'proper'
broad_neg = 'broad_negative'
i... |
# Given nums = [3,2,2,3], val = 3,
# Your function should return length = 2, with the first two elements of nums being 2.
class RemoveElement:
def __init__(self, nums, val):
self.nums = nums
self.val = val
def remove_element(self):
count = 0
for i in range(len(self.nums)):
... | class Removeelement:
def __init__(self, nums, val):
self.nums = nums
self.val = val
def remove_element(self):
count = 0
for i in range(len(self.nums)):
if self.nums[i] != self.val:
self.nums[count] = self.nums[i]
count = count + 1
... |
frase = str(input("Digite uma frase qualquer: "))
frase_original = frase.strip().replace(" ", "").upper()
frase_nova = ""
frase_nova = frase_original[::-1]
'''for c in range(len(frase_original), 0, -1):
frase_nova += frase_original[c - 1]'''
print("O inverso de {0} e {1}.".format(frase_original, frase_nova))
if(... | frase = str(input('Digite uma frase qualquer: '))
frase_original = frase.strip().replace(' ', '').upper()
frase_nova = ''
frase_nova = frase_original[::-1]
'for c in range(len(frase_original), 0, -1):\n frase_nova += frase_original[c - 1]'
print('O inverso de {0} e {1}.'.format(frase_original, frase_nova))
if frase_... |
def go (array):
if len(array)==1:
return array[0]
else:
count = 0
for i in range(0,len(array),2):
array[i]=0
count +=1
for i in range(count):
array.remove(0)
return go(array)
lis = list(range(1,int(input())+1,1)... | def go(array):
if len(array) == 1:
return array[0]
else:
count = 0
for i in range(0, len(array), 2):
array[i] = 0
count += 1
for i in range(count):
array.remove(0)
return go(array)
lis = list(range(1, int(input()) + 1, 1))
print(go(lis)... |
def to8BitUnsigned(value):
return value.to_bytes(length=1, byteorder='little', signed=False)
def to16BitUnsigned(value):
return value.to_bytes(length=2, byteorder='little', signed=False)
def to16BitSigned(value):
return value.to_bytes(length=2, byteorder='little', signed=True)
def to32BitUnsigned(value):
retu... | def to8_bit_unsigned(value):
return value.to_bytes(length=1, byteorder='little', signed=False)
def to16_bit_unsigned(value):
return value.to_bytes(length=2, byteorder='little', signed=False)
def to16_bit_signed(value):
return value.to_bytes(length=2, byteorder='little', signed=True)
def to32_bit_unsigned... |
class Pipeline:
def __init__(self, *args):
self.__steps = list(args)
def apply_to(self, text):
for step in self.__steps:
text = step.annotate(text)
return text
def add_step(self, step):
self.__steps.append(step)
| class Pipeline:
def __init__(self, *args):
self.__steps = list(args)
def apply_to(self, text):
for step in self.__steps:
text = step.annotate(text)
return text
def add_step(self, step):
self.__steps.append(step) |
# lists
line = [2, 1, 5, 6, 3, 4, 11]
# functions
len(line) #7 lenght of
min(line) #1 max value
max(line) #11 min value
sum(line) #32 sum whole list
sorted(line) #[1, 2, 3, 4, 5, 6, 11] sorted
#slices
line[0:2] # [2, 1]
line[2:4] # [5, 6]
line[4:6] # [3, 4]
line[0:7] # [2, 1, 5, 6, 3, 4, 11]
line[2:] # [5, 6, 3, 4, 1... | line = [2, 1, 5, 6, 3, 4, 11]
len(line)
min(line)
max(line)
sum(line)
sorted(line)
line[0:2]
line[2:4]
line[4:6]
line[0:7]
line[2:]
line[:2]
line[:]
line.append(8)
line.pop() |
'''
Given a sequence of integers, where each element is distinct and satisfies . For each where , find any integer such that and print the value of on a new line.
Function Description
Complete the permutationEquation function in the editor below. It should return an array of integers that represent the values of... | """
Given a sequence of integers, where each element is distinct and satisfies . For each where , find any integer such that and print the value of on a new line.
Function Description
Complete the permutationEquation function in the editor below. It should return an array of integers that represent the values of... |
'''
https://leetcode.com/problems/largest-rectangle-in-histogram/
84. Largest Rectangle in Histogram
Given an array of integers heights representing the histogram's bar height where the
width of each bar is 1, return the area of the largest rectangle in the histogram.
'''
'''
Brute force: we cons... | """
https://leetcode.com/problems/largest-rectangle-in-histogram/
84. Largest Rectangle in Histogram
Given an array of integers heights representing the histogram's bar height where the
width of each bar is 1, return the area of the largest rectangle in the histogram.
"""
'\n Brute force: we consid... |
PAGE_TITLE = "Data Submission"
SECTION_TITLE = "Data Submission"
SUBJECT_TYPE = "Register a new clinic"
| page_title = 'Data Submission'
section_title = 'Data Submission'
subject_type = 'Register a new clinic' |
cars = 100
space_in_a_car = 4.0
drivers = 30
passengers = 90
cars_not_driven = cars - drivers
cars_driven = drivers
carpool_capacity = cars_driven * space_in_a_car
average_passengers_per_car = passengers / cars_driven
print("There are", cars, "cars available.")
print("There are only", drivers, "drivers available.")
p... | cars = 100
space_in_a_car = 4.0
drivers = 30
passengers = 90
cars_not_driven = cars - drivers
cars_driven = drivers
carpool_capacity = cars_driven * space_in_a_car
average_passengers_per_car = passengers / cars_driven
print('There are', cars, 'cars available.')
print('There are only', drivers, 'drivers available.')
pri... |
"""
----------------------------------------------
PIXEL_FORMAT
----------------------------------------------
"""
def get_pixel_format(subsampling, depth):
""" helper to set pixel format from subsampling, assuming full range,
for converting source to yuv prior to encoding
"""
pixel_format = None
... | """
----------------------------------------------
PIXEL_FORMAT
----------------------------------------------
"""
def get_pixel_format(subsampling, depth):
""" helper to set pixel format from subsampling, assuming full range,
for converting source to yuv prior to encoding
"""
pixel_format = None
... |
MESSAGES_STARBOARD_MESSAGE = """CREATE UNIQUE INDEX IF NOT EXISTS
messages_starboard_message
ON messages (starboard_message_id)"""
ALL_INDEXES = [MESSAGES_STARBOARD_MESSAGE]
| messages_starboard_message = 'CREATE UNIQUE INDEX IF NOT EXISTS\n messages_starboard_message\n ON messages (starboard_message_id)'
all_indexes = [MESSAGES_STARBOARD_MESSAGE] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.