content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
dic_cal = {}
def cal(a, b):
if (a, b) in dic_cal:
return dic_cal[(a, b)]
return cal(a - 1, b) + cal(a, b - 1)
if __name__ == '__main__':
for j in range(0, 1):
for k in range(0, 21):
dic_cal[(j, k)] = 1
for j in range(0, 21):
for k in range(0, 1):
dic_c... | dic_cal = {}
def cal(a, b):
if (a, b) in dic_cal:
return dic_cal[a, b]
return cal(a - 1, b) + cal(a, b - 1)
if __name__ == '__main__':
for j in range(0, 1):
for k in range(0, 21):
dic_cal[j, k] = 1
for j in range(0, 21):
for k in range(0, 1):
dic_cal[j, k... |
# shorthand for tabulation
def get_tabs(num):
ret = ""
for _ in range(num):
ret += "\t"
return ret
| def get_tabs(num):
ret = ''
for _ in range(num):
ret += '\t'
return ret |
n = int(input())
chars_of_each_string = [[char for char in input()] for _ in range(n)]
chars = []
for characters in chars_of_each_string:
chars += list(set(characters))
chars_used_in_all = []
for char in set(chars):
if chars.count(char) == n:
chars_used_in_all.append(char)
if not chars_us... | n = int(input())
chars_of_each_string = [[char for char in input()] for _ in range(n)]
chars = []
for characters in chars_of_each_string:
chars += list(set(characters))
chars_used_in_all = []
for char in set(chars):
if chars.count(char) == n:
chars_used_in_all.append(char)
if not chars_used_in_all:
... |
'''
Description: exercise: finding the area
Version: 1.0.0.20210113
Author: Arvin Zhao
Date: 2021-01-13 12:20:06
Last Editors: Arvin Zhao
LastEditTime: 2021-01-13 12:48:56
'''
def display_square_area() -> None:
'''
Calculate and display the area of a square.
'''
while True:
try:
si... | """
Description: exercise: finding the area
Version: 1.0.0.20210113
Author: Arvin Zhao
Date: 2021-01-13 12:20:06
Last Editors: Arvin Zhao
LastEditTime: 2021-01-13 12:48:56
"""
def display_square_area() -> None:
"""
Calculate and display the area of a square.
"""
while True:
try:
sid... |
class MultiheadAttention(Module):
__parameters__ = ["in_proj_weight", "in_proj_bias", ]
__buffers__ = []
in_proj_weight : Tensor
in_proj_bias : Tensor
training : bool
out_proj : __torch__.torch.nn.modules.linear.___torch_mangle_9395._LinearWithBias
def forward(self: __torch__.torch.nn.modules.activation._... | class Multiheadattention(Module):
__parameters__ = ['in_proj_weight', 'in_proj_bias']
__buffers__ = []
in_proj_weight: Tensor
in_proj_bias: Tensor
training: bool
out_proj: __torch__.torch.nn.modules.linear.___torch_mangle_9395._LinearWithBias
def forward(self: __torch__.torch.nn.modules.act... |
#
# PySNMP MIB module Nortel-MsCarrier-MscPassport-DataCollectionMIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-MsCarrier-MscPassport-DataCollectionMIB
# Produced by pysmi-0.3.4 at Wed May 1 14:29:37 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 ... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, single_value_constraint, constraints_union, constraints_intersection) ... |
# Algocia is placed on a great dessert and consists of cities and oases connected by roads. There is
# exactly one road leading from each gate to one oasis (but any given oasis can have any number of roads
# leading to them, oases can also be interconnected by roads). Algocian law requires that if someone
# enters a ci... | def check_and_bishop(graph, oasis):
changed_graph = []
for i in range(len(graph)):
if i not in oasis:
changed_graph.append([graph[i][0], graph[i][1], 0])
else:
for j in range(len(graph[i])):
if graph[i][j] in oasis:
if [graph[i][j], i, ... |
'''
You are given a circular array nums of positive and negative integers.
If a number k at an index is positive, then move forward k steps.
Conversely, if it's negative (-k), move backward k steps.
Since the array is circular, you may assume that the last element's next element is the first element, and the first elem... | """
You are given a circular array nums of positive and negative integers.
If a number k at an index is positive, then move forward k steps.
Conversely, if it's negative (-k), move backward k steps.
Since the array is circular, you may assume that the last element's next element is the first element, and the first elem... |
revision = "a6d2d466e5"
revision_down = None
message = "create company model"
async def upgrade(connection):
sql = """
CREATE TABLE companies (
id MEDIUMINT NOT NULL AUTO_INCREMENT,
name CHAR(200) NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARACTER SET=... | revision = 'a6d2d466e5'
revision_down = None
message = 'create company model'
async def upgrade(connection):
sql = '\n CREATE TABLE companies (\n id MEDIUMINT NOT NULL AUTO_INCREMENT,\n name CHAR(200) NOT NULL,\n PRIMARY KEY (id)\n ) ENGINE=InnoDB DEFAULT CHARACTER SE... |
class PartyAnimal:
x = 0
name = ""
def __init__(self, nameCons):
self.name = nameCons
print("name: ", self.name)
def party(self):
self.x = self.x + 1
print(self.name," - party count: ", self.x)
class FootballFan(PartyAnimal):
points = 0
def touchdown(self):... | class Partyanimal:
x = 0
name = ''
def __init__(self, nameCons):
self.name = nameCons
print('name: ', self.name)
def party(self):
self.x = self.x + 1
print(self.name, ' - party count: ', self.x)
class Footballfan(PartyAnimal):
points = 0
def touchdown(self):
... |
__author__ = 'Nathen'
input_str = input('Paste input nums: ')
k, m, n = map(lambda num: float(num), input_str.split(' '))
population = k + m + n
# odds when dominant first
pK = k / population
# odds when heterozygous first
pMK = (m / population) * (k / (population - 1.0))
pMM = (m / population) * ((m - 1.0) / (pop... | __author__ = 'Nathen'
input_str = input('Paste input nums: ')
(k, m, n) = map(lambda num: float(num), input_str.split(' '))
population = k + m + n
p_k = k / population
p_mk = m / population * (k / (population - 1.0))
p_mm = m / population * ((m - 1.0) / (population - 1.0)) * 0.75
p_mn = m / population * (n / (populatio... |
with open("tinder_api/utils/token.txt", "r") as f:
tinder_token = f.read()
# it is best for you to write in the token to save yourself the file I/O
# especially if you have python byte code off
#tinder_token = ""
headers = {
'app_version': '6.9.4',
'platform': 'ios',
'content-type': 'application/json'... | with open('tinder_api/utils/token.txt', 'r') as f:
tinder_token = f.read()
headers = {'app_version': '6.9.4', 'platform': 'ios', 'content-type': 'application/json', 'User-agent': 'Tinder/7.5.3 (iPohone; iOS 10.3.2; Scale/2.00)', 'X-Auth-Token': 'enter_auth_token'}
host = 'https://api.gotinder.com'
if __name__ == '_... |
with open('day9.txt') as f:
data = f.read().splitlines()[0].split(' ')
nPlayers = int(data[0])
nMarbles = int(data[6])
# Players
playerScores = [0] * nPlayers
currentPlayer = -1
# Marbles
right = [None] * nMarbles
left = [None] * nMarbles
# Initialise
current = 0
total = 1
right[current] = current
left[... | with open('day9.txt') as f:
data = f.read().splitlines()[0].split(' ')
n_players = int(data[0])
n_marbles = int(data[6])
player_scores = [0] * nPlayers
current_player = -1
right = [None] * nMarbles
left = [None] * nMarbles
current = 0
total = 1
right[current] = current
left[current] = current
for i in range... |
# 280. Wiggle Sort
# ttungl@gmail.com
# Given an unsorted array nums, reorder it in-place
# such that nums[0] <= nums[1] >= nums[2] <= nums[3]....
# For example, given nums = [3, 5, 2, 1, 6, 4],
# one possible answer is [1, 6, 2, 5, 3, 4].
class Solution(object):
def wiggleSort(self, nums):
"""
... | class Solution(object):
def wiggle_sort(self, nums):
"""
:type nums: List[int]
:rtype: void Do not return anything, modify nums in-place instead.
"""
if not nums:
return
n = len(nums)
for i in range(1, n, 2):
if nums[i - 1] > nums[i]:
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
Using the classifier
--------------------
.. toctree::
:maxdepth: 3
cv/base
cv/data
cv/helper
Cross-validation in MRIQC
----------------... | """
Using the classifier
--------------------
.. toctree::
:maxdepth: 3
cv/base
cv/data
cv/helper
Cross-validation in MRIQC
-------------------------
.. toctree::
:maxdepth: 3
cv/experiments
""" |
def arithmeticExpression(a, b, c):
"""
Consider an arithmetic expression of the form a#b=c.
Check whether it is possible to replace # with one of
the four signs: +, -, * or / to obtain a correct
"""
return (
True if (a + b == c) or (a - b == c) or (a * b == c) or (a / b == c) else Fals... | def arithmetic_expression(a, b, c):
"""
Consider an arithmetic expression of the form a#b=c.
Check whether it is possible to replace # with one of
the four signs: +, -, * or / to obtain a correct
"""
return True if a + b == c or a - b == c or a * b == c or (a / b == c) else False |
LUCYFER_SETTINGS = {
"SAVED_SEARCHES_ENABLE": False,
"SAVED_SEARCHES_KEY": None,
}
| lucyfer_settings = {'SAVED_SEARCHES_ENABLE': False, 'SAVED_SEARCHES_KEY': None} |
r = 'S'
while r == "S":
n = int(input('Digite um numero: '))
r = str(input('Quer continuar [S/N]: ')).upper()
print('Acabou') | r = 'S'
while r == 'S':
n = int(input('Digite um numero: '))
r = str(input('Quer continuar [S/N]: ')).upper()
print('Acabou') |
def reverse(number):
stack = []
result = ""
for num in str(number):
stack.append(num)
for i in range(len(stack)):
result += stack.pop()
print(result)
return int(result)
reverse(3479)
| def reverse(number):
stack = []
result = ''
for num in str(number):
stack.append(num)
for i in range(len(stack)):
result += stack.pop()
print(result)
return int(result)
reverse(3479) |
T_Call = 0
T_Squat = 1
T_Shank = 2
T_Jump = 3
T_Slap = 4
T_EyeContact = 5
function_name_dict = {
T_Call: "call",
T_Squat: "squat",
T_Shank: "shank",
T_Jump: "jump",
T_Slap: "slap",
T_EyeContact: "eye_contact"
}
RESPECT_MAX = 255 | t__call = 0
t__squat = 1
t__shank = 2
t__jump = 3
t__slap = 4
t__eye_contact = 5
function_name_dict = {T_Call: 'call', T_Squat: 'squat', T_Shank: 'shank', T_Jump: 'jump', T_Slap: 'slap', T_EyeContact: 'eye_contact'}
respect_max = 255 |
def power_of_two(x):
if x == 1:
return True
if x < 1:
return False
return power_of_two(x / 2)
| def power_of_two(x):
if x == 1:
return True
if x < 1:
return False
return power_of_two(x / 2) |
class Solution:
def searchRange(self, nums: List[int], target: int) -> List[int]:
def search(lo, hi):
if nums[lo] == target == nums[hi]:
return [lo, hi]
if nums[lo] <= target <= nums[hi]:
mid = (lo + hi) // 2
l, r = search(lo, mid), sea... | class Solution:
def search_range(self, nums: List[int], target: int) -> List[int]:
def search(lo, hi):
if nums[lo] == target == nums[hi]:
return [lo, hi]
if nums[lo] <= target <= nums[hi]:
mid = (lo + hi) // 2
(l, r) = (search(lo, mid... |
#15 Distance units
# Askng for distance in feet.
x = float(input("Enter the distance in feet = "))
inches = x * 12
yards = x * 0.33333
miles = x * 0.000189
print("Inches = ",inches," Yards = ",yards," Miles = ",miles)
| x = float(input('Enter the distance in feet = '))
inches = x * 12
yards = x * 0.33333
miles = x * 0.000189
print('Inches = ', inches, ' Yards = ', yards, ' Miles = ', miles) |
# Generate n colors along a vector
def get_vector(a, b):
"""Given two points (3D), Returns the common vector"""
vector = ((b[0] - a[0]), (b[1] - a[1]), (b[2] - a[2]))
return vector
def get_t(n):
if n <= 2:
return [0, 1]
else:
t = []
for i in range(n):
if i == 0... | def get_vector(a, b):
"""Given two points (3D), Returns the common vector"""
vector = (b[0] - a[0], b[1] - a[1], b[2] - a[2])
return vector
def get_t(n):
if n <= 2:
return [0, 1]
else:
t = []
for i in range(n):
if i == 0:
t.append(0)
... |
load("@berty_go//:config.bzl", "berty_go_config")
load("@co_znly_rules_gomobile//:repositories.bzl", "gomobile_repositories")
load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies")
load("@build_bazel_rules_swift//swift:repositories.bzl", "swift_rules_dependencies")
def berty_bridge_conf... | load('@berty_go//:config.bzl', 'berty_go_config')
load('@co_znly_rules_gomobile//:repositories.bzl', 'gomobile_repositories')
load('@build_bazel_apple_support//lib:repositories.bzl', 'apple_support_dependencies')
load('@build_bazel_rules_swift//swift:repositories.bzl', 'swift_rules_dependencies')
def berty_bridge_conf... |
n = 95
for i in range(1,1000):
a = n ^ i
print(bin(a),a)
print(i,bin(n),n)
print() | n = 95
for i in range(1, 1000):
a = n ^ i
print(bin(a), a)
print(i, bin(n), n)
print() |
'''
Description : Use Of Basic Input / Output
Function Date : 07 Feb 2021
Function Author : Prasad Dangare
Input : Str
Output : --
'''
print("Enter One Number") # to display on screen
no = input() # to accept the standard input device ie keyword
print ("Your Number Is :... | """
Description : Use Of Basic Input / Output
Function Date : 07 Feb 2021
Function Author : Prasad Dangare
Input : Str
Output : --
"""
print('Enter One Number')
no = input()
print('Your Number Is : ', no)
print('Data Type Of Give Number Is : ', type(no)) |
# Global Reach
# Demonstrates global variables
def read_global():
print("From inside the local scope of read_global(), value is:", value)
def shadow_global():
value = -10
print("From inside the local scope of shadow_global(), value is:", value)
def change_global():
global value
value = -10
... | def read_global():
print('From inside the local scope of read_global(), value is:', value)
def shadow_global():
value = -10
print('From inside the local scope of shadow_global(), value is:', value)
def change_global():
global value
value = -10
print('From inside the local scope of change_globa... |
a = int(input("Enter: "))
reserve = a
temp = 0
rev=0
while a>0:
temp = a%10
a = a//10
rev = rev*10 + temp
if reserve == rev:
print("Palindrome")
else:
print("not") | a = int(input('Enter: '))
reserve = a
temp = 0
rev = 0
while a > 0:
temp = a % 10
a = a // 10
rev = rev * 10 + temp
if reserve == rev:
print('Palindrome')
else:
print('not') |
class Track(object):
id = 0
header_line = 1
filename = ""
key_color = "#FF4D55"
name = ""
description = ""
track_image_url = "http://lorempixel.com/400/200"
location = ""
gid = ""
order = -1
def __init__(self, id, name, header_line, key_color, location, gid, order):
... | class Track(object):
id = 0
header_line = 1
filename = ''
key_color = '#FF4D55'
name = ''
description = ''
track_image_url = 'http://lorempixel.com/400/200'
location = ''
gid = ''
order = -1
def __init__(self, id, name, header_line, key_color, location, gid, order):
... |
#!/usr/bin/env python3
if __name__ == '__main__':
students_list = []
while True:
command = input("Add, list, exit: ").lower()
if command == 'exit':
break
elif command == 'add':
last_name = input('Your last name^ ')
class_name = input('... | if __name__ == '__main__':
students_list = []
while True:
command = input('Add, list, exit: ').lower()
if command == 'exit':
break
elif command == 'add':
last_name = input('Your last name^ ')
class_name = input('Class ')
grades = []
... |
# model settings
norm_cfg = dict(type='SyncBN', requires_grad=True)
model = dict(
type='EncoderDecoder',
# pretrained='checkpoints/metanet-b4/det_fmtb4_v1.pth.tar',
backbone=dict(
type='Central_Model',
backbone_name='MTB4',
task_names=('gv_patch', 'gv_global'),
main_task_name... | norm_cfg = dict(type='SyncBN', requires_grad=True)
model = dict(type='EncoderDecoder', backbone=dict(type='Central_Model', backbone_name='MTB4', task_names=('gv_patch', 'gv_global'), main_task_name='gv_global', trans_type='crossconvhrnetlayer', task_name_to_backbone={'gv_global': {'repeats': [2, 3, 6, 6, 6, 12], 'expan... |
# OpenWeatherMap API Key
weather_api_key = "2e751db150eed8a2a8ae9dc91e31a091"
# Google API Key
g_key = "AIzaSyBqrWs9x-quXSBQkAVuz-x7PP3t64gJj7E"
| weather_api_key = '2e751db150eed8a2a8ae9dc91e31a091'
g_key = 'AIzaSyBqrWs9x-quXSBQkAVuz-x7PP3t64gJj7E' |
def main():
s = input()
weathers = ['Sunny', 'Cloudy', 'Rainy']
length = weathers.__len__()
index = weathers.index(s) + 1
if index >= length:
index = 0
print(weathers[index])
if __name__ == "__main__":
main()
| def main():
s = input()
weathers = ['Sunny', 'Cloudy', 'Rainy']
length = weathers.__len__()
index = weathers.index(s) + 1
if index >= length:
index = 0
print(weathers[index])
if __name__ == '__main__':
main() |
# Find height of a given binary tree
class Node():
def __init__(self, value):
self.left = None
self.right = None
self.value = value
class Tree():
def height(self, node: Node):
if node is None or (node.left is None and node.right is None):
return 0
else:... | class Node:
def __init__(self, value):
self.left = None
self.right = None
self.value = value
class Tree:
def height(self, node: Node):
if node is None or (node.left is None and node.right is None):
return 0
else:
left_sub_tree_height = self.heig... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | service_type = 'loadbalancer'
neutron = 'neutron'
lbaas_agent_rpc_topic = 'lbaas_agent'
lbaas_generic_config_rpc_topic = 'lbaas_generic_config'
lbaas_plugin_rpc_topic = 'n-lbaas-plugin'
agent_type_loadbalancer = 'OC Loadbalancer agent'
active = 'ACTIVE'
down = 'DOWN'
created = 'CREATED'
pending_create = 'PENDING_CREATE... |
#!/usr/local/bin/python3
message = str(input("Message: "))
secret = ""
for character in reversed(message):
secret = secret + str(chr(ord(character)+1))
print(secret) | message = str(input('Message: '))
secret = ''
for character in reversed(message):
secret = secret + str(chr(ord(character) + 1))
print(secret) |
class Solution:
def majorityElement(self, nums: List[int]) -> int:
counter = {}
for num in nums:
if num not in counter:
counter[num] = 1
else:
counter[num] += 1
for key, value in counter.items():
if value > ... | class Solution:
def majority_element(self, nums: List[int]) -> int:
counter = {}
for num in nums:
if num not in counter:
counter[num] = 1
else:
counter[num] += 1
for (key, value) in counter.items():
if value > len(nums) / 2... |
oo000 = 0
for ii in range ( 11 ) :
oo000 += ii
if 51 - 51: IiI1i11I
print ( oo000 )
# dd678faae9ac167bc83abf78e5cb2f3f0688d3a3
| oo000 = 0
for ii in range(11):
oo000 += ii
if 51 - 51:
IiI1i11I
print(oo000) |
"""
Author: PyDev
Description: Doubly Linked List with a Tail consist of a element, where the element is the
skeleton and consist of a value next, and previous variable/element.
There is a Head pointer to refer to the front of the Linked List.
The Tail pointer to refer to the end ... | """
Author: PyDev
Description: Doubly Linked List with a Tail consist of a element, where the element is the
skeleton and consist of a value next, and previous variable/element.
There is a Head pointer to refer to the front of the Linked List.
The Tail pointer to refer to the end ... |
class Commit:
def __init__(self):
""" A simple feature container for each git commit """
self.features = {}
def add(self, key, value):
if key in self.features:
raise Exception("Do not overwrite features")
self.features[key] = value
def remove(self, key):
... | class Commit:
def __init__(self):
""" A simple feature container for each git commit """
self.features = {}
def add(self, key, value):
if key in self.features:
raise exception('Do not overwrite features')
self.features[key] = value
def remove(self, key):
... |
APP_PORT = 7991
LOGFILE_PATH = "/var/log/application/db_replication.log"
MASTER_MYSQL = {
'host': '127.0.0.1',
'port': 3306,
'user': 'root',
'password': 'password'
}
| app_port = 7991
logfile_path = '/var/log/application/db_replication.log'
master_mysql = {'host': '127.0.0.1', 'port': 3306, 'user': 'root', 'password': 'password'} |
"""
Numbers can be regarded as product of its factors. For example,
8 = 2 x 2 x 2;
= 2 x 4.
Write a function that takes an integer n and return all possible combinations of its factors.
Note:
You may assume that n is always positive.
Factors should be greater than 1 and less than n.
Examples:
input: 1
output:
[]
in... | """
Numbers can be regarded as product of its factors. For example,
8 = 2 x 2 x 2;
= 2 x 4.
Write a function that takes an integer n and return all possible combinations of its factors.
Note:
You may assume that n is always positive.
Factors should be greater than 1 and less than n.
Examples:
input: 1
output:
[]
in... |
#############################################################################
#Replace with the persons name that you were texting
leftName = "Bob"
#Replace with your name
rightName = "John"
#############################################################################
| left_name = 'Bob'
right_name = 'John' |
BASE_DIR=""
DATA_DIR="/mnt/nfs/work1/akshay/akshay/projects/oracle_cb/data/"
REMOTE_PATH_TO_PYTHON="/mnt/nfs/work1/akshay/akshay/anaconda3/python3"
REMOTE_BASE_DIR="/mnt/nfs/work1/akshay/akshay/projects/oracle_cb/"
| base_dir = ''
data_dir = '/mnt/nfs/work1/akshay/akshay/projects/oracle_cb/data/'
remote_path_to_python = '/mnt/nfs/work1/akshay/akshay/anaconda3/python3'
remote_base_dir = '/mnt/nfs/work1/akshay/akshay/projects/oracle_cb/' |
def prime(num):
flag=False
for a in range(2,num-1): #basically prime no are divisible by itself and by 1 only so set input value -1 so i takes previous num
if num%a==0:
flag=True
if flag==False:
print("prime")
else:
print("not prime")
num=int(input("enter... | def prime(num):
flag = False
for a in range(2, num - 1):
if num % a == 0:
flag = True
if flag == False:
print('prime')
else:
print('not prime')
num = int(input('enter the no'))
prime(num) |
#!/usr/bin/env python
###############################################################################
# Copyright 2017 The Apollo Authors. All Rights Reserved.
# Modifications Copyright (c) 2018 LG Electronics, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not ... | class Advehicle:
def __init__(self):
self._chassis_pb = None
self._localization_pb = None
self.front_edge_to_center = 3.89
self.back_edge_to_center = 1.043
self.left_edge_to_center = 1.055
self.right_edge_to_center = 1.055
self.speed_mps = None
self.x... |
"""
Some constants.
"""
VERSION = "0.1.0"
BAT = "bat"
LIGHT_THEME = "GitHub"
LEFT_SIDE, RIGHT_SIDE = range(2)
| """
Some constants.
"""
version = '0.1.0'
bat = 'bat'
light_theme = 'GitHub'
(left_side, right_side) = range(2) |
class Environment:
def __init__(self, bindings=None):
self.stack = [bindings or {}]
self.index = 0
def set(self, name, val, i=None):
"""
Assign value to a name. By default, names will be
stored in the lowest scope possible.
"""
i = i if i != None else sel... | class Environment:
def __init__(self, bindings=None):
self.stack = [bindings or {}]
self.index = 0
def set(self, name, val, i=None):
"""
Assign value to a name. By default, names will be
stored in the lowest scope possible.
"""
i = i if i != None else se... |
"""Chapter 5: Question 4.
A simple condition to check if a number is power of 2: n & (n-1) == 0
Example:
n = 1000
1000 & (1000 - 1)) = 1000 & 0111 = 0000 = 0
"""
def is_power_of_two(n):
"""Checks if n is a power of 2.
Args:
n: Non-negative integer.
"""
if n < 0:
raise Valu... | """Chapter 5: Question 4.
A simple condition to check if a number is power of 2: n & (n-1) == 0
Example:
n = 1000
1000 & (1000 - 1)) = 1000 & 0111 = 0000 = 0
"""
def is_power_of_two(n):
"""Checks if n is a power of 2.
Args:
n: Non-negative integer.
"""
if n < 0:
raise value... |
HTTP_STATUS_CODES = {
"100": "Continue",
"101": "Switching Protocols",
"102": "Processing",
"200": "OK",
"201": "Created",
"202": "Accepted",
"203": "Non-Authoritative Information",
"204": "No Content",
"205": "Reset Content",
"206": "Partial Content",
"207": "Multi-Status",
... | http_status_codes = {'100': 'Continue', '101': 'Switching Protocols', '102': 'Processing', '200': 'OK', '201': 'Created', '202': 'Accepted', '203': 'Non-Authoritative Information', '204': 'No Content', '205': 'Reset Content', '206': 'Partial Content', '207': 'Multi-Status', '208': 'Already Reported', '226': 'IM Used', ... |
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 16 00:26:52 2020
@author: RogelioTESI
"""
def es_primo(Numero):
resultado = True
rep = 0
for divisor in range(2,Numero):
if (Numero % divisor)==0:
resultado = False
break
rep = rep+(divisor-1)
return resultado,rep
x,rep... | """
Created on Mon Mar 16 00:26:52 2020
@author: RogelioTESI
"""
def es_primo(Numero):
resultado = True
rep = 0
for divisor in range(2, Numero):
if Numero % divisor == 0:
resultado = False
break
rep = rep + (divisor - 1)
return (resultado, rep)
(x, rep) = es_primo(1... |
# Write your code here
N = int(input())
arr = list(map(int, input().split()))
def give_soln(n):
return ((2**n) - (1 + (n) + (n*(n-1)/2)))
my_dict = dict()
for i in arr:
if i in my_dict:
my_dict[i] += 1
else:
my_dict[i] = 1
count = 0
for side in my_dict:
if my_dict[side... | n = int(input())
arr = list(map(int, input().split()))
def give_soln(n):
return 2 ** n - (1 + n + n * (n - 1) / 2)
my_dict = dict()
for i in arr:
if i in my_dict:
my_dict[i] += 1
else:
my_dict[i] = 1
count = 0
for side in my_dict:
if my_dict[side] >= 3:
count += give_soln(my_dic... |
"""This is where you modify constants"""
USER = "user"
PASSWORD = "pwd"
DATABASE_NAME = "mydb"
CATEGORIES = ["Fromages",
"Desserts",
"Viandes",
"Chocolats",
"Snacks", ]
PRODUCT_NUMBER = 1000
| """This is where you modify constants"""
user = 'user'
password = 'pwd'
database_name = 'mydb'
categories = ['Fromages', 'Desserts', 'Viandes', 'Chocolats', 'Snacks']
product_number = 1000 |
model = dict(
type='GroupFree3DNet',
backbone=dict(
type='PointNet2SASSG',
in_channels=3,
num_points=(2048, 1024, 512, 256),
radius=(0.2, 0.4, 0.8, 1.2),
num_samples=(64, 32, 16, 16),
sa_channels=((64, 64, 128), (128, 128, 256), (128, 128, 256),
... | model = dict(type='GroupFree3DNet', backbone=dict(type='PointNet2SASSG', in_channels=3, num_points=(2048, 1024, 512, 256), radius=(0.2, 0.4, 0.8, 1.2), num_samples=(64, 32, 16, 16), sa_channels=((64, 64, 128), (128, 128, 256), (128, 128, 256), (128, 128, 256)), fp_channels=((256, 256), (256, 288)), norm_cfg=dict(type='... |
#!/usr/bin/env python
__all__ = ['adaptor', 'get_by_cai','util']
__author__ = "Rob Knight"
__copyright__ = "Copyright 2007-2012, The Cogent Project"
__credits__ = ["Rob Knight", "Stephanie Wilson", "Michael Eaton"]
__license__ = "GPL"
__version__ = "1.5.3"
__maintainer__ = "Rob Knight"
__email__ = "rob@spot.colorado.e... | __all__ = ['adaptor', 'get_by_cai', 'util']
__author__ = 'Rob Knight'
__copyright__ = 'Copyright 2007-2012, The Cogent Project'
__credits__ = ['Rob Knight', 'Stephanie Wilson', 'Michael Eaton']
__license__ = 'GPL'
__version__ = '1.5.3'
__maintainer__ = 'Rob Knight'
__email__ = 'rob@spot.colorado.edu'
__status__ = 'Prod... |
# -*- coding: utf-8 -*-
class FieldError(Exception):
pass
class FieldDoesNotExist(Exception):
pass
class ReadOnlyError(AttributeError):
pass
| class Fielderror(Exception):
pass
class Fielddoesnotexist(Exception):
pass
class Readonlyerror(AttributeError):
pass |
# Created by MechAviv
# Quest ID :: 34931
# Not coded yet
sm.setSpeakerID(3001510)
sm.setSpeakerType(3)
sm.flipDialogue()
sm.setBoxChat()
sm.boxChatPlayerAsSpeaker()
sm.setBoxOverrideSpeaker()
sm.flipBoxChat()
sm.flipBoxChatPlayerAsSpeaker()
sm.setColor(1)
sm.sendNext("#face1#Good work! I'm getting the signal again. W... | sm.setSpeakerID(3001510)
sm.setSpeakerType(3)
sm.flipDialogue()
sm.setBoxChat()
sm.boxChatPlayerAsSpeaker()
sm.setBoxOverrideSpeaker()
sm.flipBoxChat()
sm.flipBoxChatPlayerAsSpeaker()
sm.setColor(1)
sm.sendNext("#face1#Good work! I'm getting the signal again. We need to move quickly. Follow me.")
sm.setSpeakerID(300150... |
"""
Codemonk link: https://www.hackerearth.com/practice/basic-programming/bit-manipulation/basics-of-bit-manipulation/practice-problems/algorithm/monk-and-tasks/
Given an array, the number of tasks is represented by the number of ones in the binary representation of each integer
in the array. Print those integers ... | """
Codemonk link: https://www.hackerearth.com/practice/basic-programming/bit-manipulation/basics-of-bit-manipulation/practice-problems/algorithm/monk-and-tasks/
Given an array, the number of tasks is represented by the number of ones in the binary representation of each integer
in the array. Print those integers in a... |
__all__ = ["InvalidCredentialsException"]
class InvalidCredentialsException(Exception):
pass
class NoHostsConnectedToException(Exception):
pass
| __all__ = ['InvalidCredentialsException']
class Invalidcredentialsexception(Exception):
pass
class Nohostsconnectedtoexception(Exception):
pass |
# More details on this kata
# https://www.codewars.com/kata/51c8e37cee245da6b40000bd
def solution(string,markers):
if len(string) == 0:
return ''
t, tt, test, l, j, ret= [], [], [], [], [], ''
s = string.split('\n')
for _s in s:
for m in markers:
if _s.find(m) != -1:
... | def solution(string, markers):
if len(string) == 0:
return ''
(t, tt, test, l, j, ret) = ([], [], [], [], [], '')
s = string.split('\n')
for _s in s:
for m in markers:
if _s.find(m) != -1:
t.append(_s.find(m))
test.append(t)
t = []
for a in... |
# Copyright (c) 2018, Benjamin Shropshire,
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of condition... | """
A basic test that always passes, as long as everythin in `targets` builds.
This is usefull, for example, with a genrule.
"""
def build_test(name=None, targets=[], tags=[]):
"""A test that depends on arbitary targets.
Args:
name: The target name.
targets: Targets to check.
tags: tags for ... |
def get_global_config():
result = {
'outcome' : 'success',
'data' : {
'credentials_file' : r'./config/config.ini',
}
}
return result | def get_global_config():
result = {'outcome': 'success', 'data': {'credentials_file': './config/config.ini'}}
return result |
# Url to manually retrieve authorization code
AUTH_URL = "https://auth.tdameritrade.com/auth"
# API endpoint for token and authorization code authentication
OAUTH_URL = "https://api.tdameritrade.com/v1/oauth2/token"
# Quote endpoints
GET_QUOTES_URL = "https://api.tdameritrade.com/v1/marketdata/quotes"
GET_QUOTE_URL =... | auth_url = 'https://auth.tdameritrade.com/auth'
oauth_url = 'https://api.tdameritrade.com/v1/oauth2/token'
get_quotes_url = 'https://api.tdameritrade.com/v1/marketdata/quotes'
get_quote_url = 'https://api.tdameritrade.com/v1/marketdata/'
get_price_history_url = 'https://api.tdameritrade.com/v1/marketdata/' |
"""
Default django-evostream configuration
"""
EVOSTREAM_URI = 'http://127.0.0.1:7777'
| """
Default django-evostream configuration
"""
evostream_uri = 'http://127.0.0.1:7777' |
def start():
print('\nThis is my Rock Paper Scissors Game!\n\n')
Player_one = "Kaly"
Player_two = "Erik"
def choices(Player_one_choice, Player_two_choice):
if Player_one_choice == 'rock' and Player_two_choice == 'paper':
return('Paper cover Rock! ' + Player_two + ' Wins !')
... | def start():
print('\nThis is my Rock Paper Scissors Game!\n\n')
player_one = 'Kaly'
player_two = 'Erik'
def choices(Player_one_choice, Player_two_choice):
if Player_one_choice == 'rock' and Player_two_choice == 'paper':
return 'Paper cover Rock! ' + Player_two + ' Wins !'
e... |
def parameters():
epsilon = 0.0001 # regularization
K = 3 # number of desired clusters
n_iter = 5 # number of iterations
skin_n_iter = 5
skin_epsilon = 0.0001
skin_K = 3
theta = 2.0 # threshold for skin detection
return epsilon, K, n_iter, skin_n_iter, skin_epsilon, skin_K, theta
| def parameters():
epsilon = 0.0001
k = 3
n_iter = 5
skin_n_iter = 5
skin_epsilon = 0.0001
skin_k = 3
theta = 2.0
return (epsilon, K, n_iter, skin_n_iter, skin_epsilon, skin_K, theta) |
"""IntelliJ plugin debug target rule used for debugging IntelliJ plugins.
Creates a plugin target debuggable from IntelliJ. Any files in
the 'deps' and 'javaagents' attribute are deployed to the plugin sandbox.
Any files are stripped of their prefix and installed into
<sandbox>/plugins. If you need structure, first p... | """IntelliJ plugin debug target rule used for debugging IntelliJ plugins.
Creates a plugin target debuggable from IntelliJ. Any files in
the 'deps' and 'javaagents' attribute are deployed to the plugin sandbox.
Any files are stripped of their prefix and installed into
<sandbox>/plugins. If you need structure, first p... |
def perm(text1, text2):
return sum(ord(c) for c in text1) == sum(ord(c) for c in text2)
# test
one = 'abc'
two = 'bcaa'
print(perm(one, two))
| def perm(text1, text2):
return sum((ord(c) for c in text1)) == sum((ord(c) for c in text2))
one = 'abc'
two = 'bcaa'
print(perm(one, two)) |
class Problem:
def __init__(self, n, m):
self.n = n
self.m = m
self.answer = [0 for _ in range(m)]
self.used = [False for _ in range(n)]
def printAnswer(self):
for number in self.answer:
print(number,end=' ')
print()
def makeAnswer(self, index):
... | class Problem:
def __init__(self, n, m):
self.n = n
self.m = m
self.answer = [0 for _ in range(m)]
self.used = [False for _ in range(n)]
def print_answer(self):
for number in self.answer:
print(number, end=' ')
print()
def make_answer(self, inde... |
class Node:
def __init__(self, data):
self.right = self.left = None
self.data = data
class Solution:
def insert(self, root, data):
if root is None:
return Node(data)
else:
if data <= root.data:
cur = self.insert(root.left, data)
... | class Node:
def __init__(self, data):
self.right = self.left = None
self.data = data
class Solution:
def insert(self, root, data):
if root is None:
return node(data)
elif data <= root.data:
cur = self.insert(root.left, data)
root.left = cur
... |
def define_suit(card):
if card.endswith("C"): return "clubs"
if card.endswith("D"): return "diamonds"
if card.endswith("H"): return "hearts"
if card.endswith("S"): return "spades" | def define_suit(card):
if card.endswith('C'):
return 'clubs'
if card.endswith('D'):
return 'diamonds'
if card.endswith('H'):
return 'hearts'
if card.endswith('S'):
return 'spades' |
_base_ = [
'../_base_/models/retinanet_r50_fpn.py',
'../_base_/datasets/coco_detection.py',
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
]
model = dict(
backbone=dict(
type='ResNetEMOD',
ar=dict(ratio=1. / 4.),
stage_with_ar=(True, True, True, True)
),... | _base_ = ['../_base_/models/retinanet_r50_fpn.py', '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py']
model = dict(backbone=dict(type='ResNetEMOD', ar=dict(ratio=1.0 / 4.0), stage_with_ar=(True, True, True, True)), bbox_head=dict(num_classes=11))
dataset_type =... |
class ValorantApi(Exception):
pass
class InvalidOrMissingParameter(ValorantApi): # 400
pass
class NotFound(ValorantApi): # 404
pass
class AttributeExistsError(ValorantApi):
pass
| class Valorantapi(Exception):
pass
class Invalidormissingparameter(ValorantApi):
pass
class Notfound(ValorantApi):
pass
class Attributeexistserror(ValorantApi):
pass |
class MobilePhone:
def __init__(self, memory):
self.memory = memory
class Camera:
def take_picture(self):
print("Say cheese!")
class CameraPhone(MobilePhone, Camera):
pass
iphone = CameraPhone('16GB')
print(iphone.memory)
iphone.take_picture() | class Mobilephone:
def __init__(self, memory):
self.memory = memory
class Camera:
def take_picture(self):
print('Say cheese!')
class Cameraphone(MobilePhone, Camera):
pass
iphone = camera_phone('16GB')
print(iphone.memory)
iphone.take_picture() |
# ===============================================================
# =======================AST=HIERARCHY===========================
# ===============================================================
ERROR = 0
INTEGER = 1
class Node:
def __init__(self):
self.static_type = ""
class ProgramNode(Node):
de... | error = 0
integer = 1
class Node:
def __init__(self):
self.static_type = ''
class Programnode(Node):
def __init__(self, class_list):
Node.__init__(self)
self.class_list = class_list
class Classnode(Node):
def __init__(self, name, parent, feature_list):
Node.__init__(sel... |
# for i in range(17):
# print("{0:>2} in hex is {0:>02x}".format(i))
# #
# x = 0x20
# y = 0x0a
# #
# print(x)
# print(y)
# print(x * y)
# #
# print(0b101010)
# When converting a decimal number to binary, you look for the highest power
# of 2 smaller than the number and put a 1 in that column. You then take the
# r... | powers = []
for power in range(15, -1, -1):
powers.append(2 ** power)
print(powers)
x = int(input('Please enter a number: '))
printing = False
for power in powers:
bit = x // power
if bit != 0 or power == 1:
printing = True
if printing:
print(bit, end='')
x %= power |
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def __repr__(self):
return str(self.val)
# Brute Force; Time: O(n^2); Space: O(n)
def next_larger_nodes(head):
res = []
slow = head
while slow:
fast = slow.next
while fa... | class Listnode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def __repr__(self):
return str(self.val)
def next_larger_nodes(head):
res = []
slow = head
while slow:
fast = slow.next
while fast:
if fast.val > slow.val:
... |
{
"targets": [
{
"target_name": "crc",
"sources": [ "./src/crc_module.c", "./src/crc.c" ]
},
]
} | {'targets': [{'target_name': 'crc', 'sources': ['./src/crc_module.c', './src/crc.c']}]} |
class Node:
def __init__(self, val, next=None):
self.val = val
self.next = next
input_list = [0, 1, 2, 3, 4]
root = None
for val in input_list:
root = Node(val, root)
cur = root
while cur:
print(cur.val)
cur = cur.next
print('Stack after pop: ')
root = root.next
cur = root
while cu... | class Node:
def __init__(self, val, next=None):
self.val = val
self.next = next
input_list = [0, 1, 2, 3, 4]
root = None
for val in input_list:
root = node(val, root)
cur = root
while cur:
print(cur.val)
cur = cur.next
print('Stack after pop: ')
root = root.next
cur = root
while cur:
... |
class ExportObjStatus:
SUCCESS = 'success'
ERROR = 'error'
IN_PROGRESS = 'in_progress'
CHOICES = [
(SUCCESS, 'Success'),
(ERROR, 'Error'),
(IN_PROGRESS, 'In progress'),
]
| class Exportobjstatus:
success = 'success'
error = 'error'
in_progress = 'in_progress'
choices = [(SUCCESS, 'Success'), (ERROR, 'Error'), (IN_PROGRESS, 'In progress')] |
class Base:
"""Base class readily accepts defaults"""
def __init__(self, **kws):
for k, v in kws.items():
if not hasattr(self, k):
setattr(self, k, v)
class Laziness(Base):
"""Generally lazy lookup"""
def __init__(self, method, **kws):
super().__init__(**k... | class Base:
"""Base class readily accepts defaults"""
def __init__(self, **kws):
for (k, v) in kws.items():
if not hasattr(self, k):
setattr(self, k, v)
class Laziness(Base):
"""Generally lazy lookup"""
def __init__(self, method, **kws):
super().__init__(**... |
def capitalize(string):
# We can't use title() here, consider the case: "123name" -> "123Name", which isn't correct.
for substring in string.split():
string = string.replace(substring, substring.capitalize())
return string | def capitalize(string):
for substring in string.split():
string = string.replace(substring, substring.capitalize())
return string |
# https://leetcode.com/problems/find-leaves-of-binary-tree/
class Solution:
def findLeaves(self, root: Optional[TreeNode]) -> List[List[int]]:
result = []
while root.left or root.right:
result.append(self.popLeaves(root, root, []))
result.append([root.val])
... | class Solution:
def find_leaves(self, root: Optional[TreeNode]) -> List[List[int]]:
result = []
while root.left or root.right:
result.append(self.popLeaves(root, root, []))
result.append([root.val])
return result
def pop_leaves(self, root: Optional[TreeNode], parent... |
class Monster:
def __init__(self, name, color):
self.name = name
self.color = color
def attack(self):
print('I am attacking...')
class Fogthing(Monster):
def attack(self):
print('I am killing...')
def make_sound(self):
print('Grrrrrrrrrr\n')
fogthing = Fogth... | class Monster:
def __init__(self, name, color):
self.name = name
self.color = color
def attack(self):
print('I am attacking...')
class Fogthing(Monster):
def attack(self):
print('I am killing...')
def make_sound(self):
print('Grrrrrrrrrr\n')
fogthing = fogthi... |
# https://codeforces.com/problemset/problem/1367/A
t = int(input())
for i in range(t):
s = input()
ss = [s[0]]
for i in range(0, len(s)-1, 2):
ss.append((s[i], s[i+1])[1])
print(''.join(ss)) | t = int(input())
for i in range(t):
s = input()
ss = [s[0]]
for i in range(0, len(s) - 1, 2):
ss.append((s[i], s[i + 1])[1])
print(''.join(ss)) |
"""
Column Explorer
===============================================================================
"""
# import ipywidgets as widgets
# from IPython.display import display
# from ipywidgets import GridspecLayout, Layout
# from .dashboard import document_to_html
# from .utils import load_filtered_documents
# cla... | """
Column Explorer
===============================================================================
""" |
# coding : utf-8
'''
Copyright 2019 Agnese Salutari.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wr... | """
Copyright 2019 Agnese Salutari.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software di... |
ora_start=int(input("Ora="))
minut_start=int(input("Minute="))
durata_ore=int(input("Cate ore dureaza drumul="))
durata_minute=int(input("Cate minute dureaza drumul"))
ora_fin = ora_start+durata_ore
minute_fin = minut_start+durata_minute
if minute_fin>60:
minute_fin%=60
ora_fin+=1
print(ora_fin,minute_fin)
| ora_start = int(input('Ora='))
minut_start = int(input('Minute='))
durata_ore = int(input('Cate ore dureaza drumul='))
durata_minute = int(input('Cate minute dureaza drumul'))
ora_fin = ora_start + durata_ore
minute_fin = minut_start + durata_minute
if minute_fin > 60:
minute_fin %= 60
ora_fin += 1
print(ora_fi... |
def digitDifferenceSort(a):
def dg(n):
s = list(map(int, str(n)))
return max(s) - min(s)
ans = [(a[i], i) for i in range(len(a))]
A = sorted(ans, key = lambda x: (dg(x[0]), -x[1]))
return [c[0] for c in A]
| def digit_difference_sort(a):
def dg(n):
s = list(map(int, str(n)))
return max(s) - min(s)
ans = [(a[i], i) for i in range(len(a))]
a = sorted(ans, key=lambda x: (dg(x[0]), -x[1]))
return [c[0] for c in A] |
# Topology with a single loop
# A --- B --- C
# | |
# D --- E
topo = { 'A' : ['B', 'D'],
'B' : ['A', 'C', 'E'],
'C' : ['B'],
'D' : ['A', 'E'],
'E' : ['B', 'D'] }
| topo = {'A': ['B', 'D'], 'B': ['A', 'C', 'E'], 'C': ['B'], 'D': ['A', 'E'], 'E': ['B', 'D']} |
class Body:
"""
Represents the status of the body, each part of the body has a name and a
value representing its status 1 = perferctly fine, 0 = unavailale
"""
def __init__(self, parts=None):
if parts is not None:
self.boyd_parts = parts.copy()
else:
self.bod... | class Body:
"""
Represents the status of the body, each part of the body has a name and a
value representing its status 1 = perferctly fine, 0 = unavailale
"""
def __init__(self, parts=None):
if parts is not None:
self.boyd_parts = parts.copy()
else:
self.bod... |
# fmt: off
cost_sequence = [
102267214109.0,
102267223999.0,
102269202999.00002,
102566201999.00002,
132365101999.0,
102475101999.00002,
102465101999.00002,
132465101999.0,
162165001999.0,
162565001999.0,
162965001999.0,
163965001999.0,
163955001999.0,
13406500199... | cost_sequence = [102267214109.0, 102267223999.0, 102269202999.00002, 102566201999.00002, 132365101999.0, 102475101999.00002, 102465101999.00002, 132465101999.0, 162165001999.0, 162565001999.0, 162965001999.0, 163965001999.0, 163955001999.0, 134065001999.0, 134465001999.0, 104575001998.99998, 104565001999.00002, 1045650... |
#
# PySNMP MIB module IB-SMA-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IB-SMA-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:39:05 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, value_size_constraint, single_value_constraint, constraints_intersection) ... |
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name : ecc
Description :
Author : x3nny
date : 2021/10/7
-------------------------------------------------
Change Activity:
2021/10/7: Init
---------------------------------------... | """
-------------------------------------------------
File Name : ecc
Description :
Author : x3nny
date : 2021/10/7
-------------------------------------------------
Change Activity:
2021/10/7: Init
-------------------------------------------------
"""
__author_... |
def phone_number(num):
string = [(str(x)) for x in num]
string = ''.join(string)
return f'({string[:3]}) {string[3:6]}-{string[6:]}'
print(phone_number([1,2,3,4,5,6,7,8,9,0]))
| def phone_number(num):
string = [str(x) for x in num]
string = ''.join(string)
return f'({string[:3]}) {string[3:6]}-{string[6:]}'
print(phone_number([1, 2, 3, 4, 5, 6, 7, 8, 9, 0])) |
"""
Sermin exceptions
"""
class RunError(Exception):
"""
Sermin error during a blueprint run
"""
pass
class ShellError(RunError):
"""
Sermin shell command failed
"""
pass
| """
Sermin exceptions
"""
class Runerror(Exception):
"""
Sermin error during a blueprint run
"""
pass
class Shellerror(RunError):
"""
Sermin shell command failed
"""
pass |
freeze_as_mpy('$(MPY_DIR)/tools', 'upip.py')
freeze_as_mpy('$(MPY_DIR)/tools', 'upip_utarfile.py', opt=3)
freeze('$(MPY_DIR)/lib/lv_bindings/driver/linux', 'evdev.py')
freeze('$(MPY_DIR)/lib/lv_bindings/lib', 'lv_colors.py')
freeze('$(MPY_DIR)/lib/lv_bindings/lib', 'async_utils.py')
freeze('$(MPY_DIR)/lib/lv_bindings/l... | freeze_as_mpy('$(MPY_DIR)/tools', 'upip.py')
freeze_as_mpy('$(MPY_DIR)/tools', 'upip_utarfile.py', opt=3)
freeze('$(MPY_DIR)/lib/lv_bindings/driver/linux', 'evdev.py')
freeze('$(MPY_DIR)/lib/lv_bindings/lib', 'lv_colors.py')
freeze('$(MPY_DIR)/lib/lv_bindings/lib', 'async_utils.py')
freeze('$(MPY_DIR)/lib/lv_bindings/l... |
NAME='fastrouter'
CFLAGS = []
LDFLAGS = []
LIBS = []
REQUIRES = ['corerouter']
GCC_LIST = ['fastrouter']
| name = 'fastrouter'
cflags = []
ldflags = []
libs = []
requires = ['corerouter']
gcc_list = ['fastrouter'] |
# implicit conversion
num_int=123
num_float=1.23
result=num_int+num_float
print('datatype of num_int is',type(num_int))
print('datatype of num_float is',type(num_float))
print('datatype of result is',type(result))
# it automatically converts int to float to avoid data loss | num_int = 123
num_float = 1.23
result = num_int + num_float
print('datatype of num_int is', type(num_int))
print('datatype of num_float is', type(num_float))
print('datatype of result is', type(result)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.