content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
botamusique = None
playlist = None
user = ""
is_proxified = False
dbfile = None
db = None
config = None
bot_logger = None
music_folder = ""
tmp_folder = ""
| botamusique = None
playlist = None
user = ''
is_proxified = False
dbfile = None
db = None
config = None
bot_logger = None
music_folder = ''
tmp_folder = '' |
class Solution:
def postorderTraversal(self, root):
if root is None:
return []
traversal = []
root.parent = None
node = root
while node is not None:
while (node.left is not None or node.right is not None):
if node.left is... | class Solution:
def postorder_traversal(self, root):
if root is None:
return []
traversal = []
root.parent = None
node = root
while node is not None:
while node.left is not None or node.right is not None:
if node.left is not None:
... |
'''
Given a binary tree, return the preorder traversal of its nodes' values.
Example:
Input: [1,null,2,3]
1
\
2
/
3
Output: [1,2,3]
Follow up: Recursive solution is trivial, could you do it iteratively?
'''
# Definition for a binary tree node.
# class TreeNode(object):
# def __init_... | """
Given a binary tree, return the preorder traversal of its nodes' values.
Example:
Input: [1,null,2,3]
1
2
/
3
Output: [1,2,3]
Follow up: Recursive solution is trivial, could you do it iteratively?
"""
class Solution(object):
def preorder_traversal(self, root):
"""
... |
# _*_ coding=utf-8 _*_
__author__ = 'lib.o'
max_title_length = 200
max_tags_length = 200
max_tag_length = 32
max_summary_length = 500
title = u"My blog"
second_title = u"this is my blog"
article_num_per_page = 25
| __author__ = 'lib.o'
max_title_length = 200
max_tags_length = 200
max_tag_length = 32
max_summary_length = 500
title = u'My blog'
second_title = u'this is my blog'
article_num_per_page = 25 |
class User:
"""
This class saves user's ids and states
"""
id = None
state = 0
def __init__(self, vk_id):
"""
Saves user's id
:param vk_id: User's vk id
"""
self.id = vk_id
print("New User with id: " + str(self.id))
def __str__(self):
... | class User:
"""
This class saves user's ids and states
"""
id = None
state = 0
def __init__(self, vk_id):
"""
Saves user's id
:param vk_id: User's vk id
"""
self.id = vk_id
print('New User with id: ' + str(self.id))
def __str__(self):
... |
class Entity:
word = ""
start = 0
end = 0
ent_type = ""
def __init__(self, word, start, end, ent_type) :
self.word = word
self.start = start
self.end = end
self.ent_type = ent_type
def __str__(self) :
return self.word
def __repr__(self) :
... | class Entity:
word = ''
start = 0
end = 0
ent_type = ''
def __init__(self, word, start, end, ent_type):
self.word = word
self.start = start
self.end = end
self.ent_type = ent_type
def __str__(self):
return self.word
def __repr__(self):
retur... |
#function within function
def operator(op_text):
def add_num(num1,num2):
return num1+num2
def subtract_num(num1,num2):
return num1-num2
if op_text == '+':
return add_num
elif op_text == '-':
return subtract_num
else:
return None
# driver code
if __name__ == '__main__':
add_fn=operator('... | def operator(op_text):
def add_num(num1, num2):
return num1 + num2
def subtract_num(num1, num2):
return num1 - num2
if op_text == '+':
return add_num
elif op_text == '-':
return subtract_num
else:
return None
if __name__ == '__main__':
add_fn = operator(... |
iss_orbit_apogee = 417 * 1000 # Km to m
iss_orbit_perigee = 401 * 1000 # Km to m
earth_mu = 3.986e14 # m^3/s^-2
earth_r = 6.378e6 # m
dist = earth_r + iss_orbit_perigee
grav = earth_mu / dist**2
print(grav) | iss_orbit_apogee = 417 * 1000
iss_orbit_perigee = 401 * 1000
earth_mu = 398600000000000.0
earth_r = 6378000.0
dist = earth_r + iss_orbit_perigee
grav = earth_mu / dist ** 2
print(grav) |
class Compatibility():
def dir_ftp_to_windows(dir):
return dir.replace("/", "\\")
def dir_windows_to_ftp(dir):
return dir.replace("\\", "/") | class Compatibility:
def dir_ftp_to_windows(dir):
return dir.replace('/', '\\')
def dir_windows_to_ftp(dir):
return dir.replace('\\', '/') |
# Process sentence into array of acceptable words
def ProcessSentence(width, sentence):
pWords = []
for word in sentence.split(' '):
if len(word) <= (width - 4):
pWords.append(word)
else:
x = word
while len(x) > (width - 4):
pWords.append(x[:w... | def process_sentence(width, sentence):
p_words = []
for word in sentence.split(' '):
if len(word) <= width - 4:
pWords.append(word)
else:
x = word
while len(x) > width - 4:
pWords.append(x[:width - 4])
x = x[width - 4:]
... |
def definition():
"""
Verbose view of courses, for UI.
"""
sql = """
SELECT CONCAT(
ISNULL(a.qualification + ' ', ''),
a.description) as short_name, --standard name
a.pathway, c.aos_code, c.curriculum_id,
a.qualification as award,
a.qualification,
ISNULL(conf.chil... | def definition():
"""
Verbose view of courses, for UI.
"""
sql = "\nSELECT CONCAT(\n ISNULL(a.qualification + ' ', ''), \n a.description) as short_name, --standard name \n a.pathway, c.aos_code, c.curriculum_id,\n a.qualification as award,\n a.qualification,\n ISNULL(conf.c... |
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def hasPathSum(self, root, sum):
if root:
return self.recursive(root, sum)
return False
def recursive(self, node,... | class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def has_path_sum(self, root, sum):
if root:
return self.recursive(root, sum)
return False
def recursive(self, node, _sum):
if node.val == _su... |
class TransactWithCentralOptions(object, IDisposable):
"""
Options to customize Revit behavior when accessing the central model.
TransactWithCentralOptions()
"""
def Dispose(self):
""" Dispose(self: TransactWithCentralOptions) """
pass
def GetLockCallback(self):
... | class Transactwithcentraloptions(object, IDisposable):
"""
Options to customize Revit behavior when accessing the central model.
TransactWithCentralOptions()
"""
def dispose(self):
""" Dispose(self: TransactWithCentralOptions) """
pass
def get_lock_callback(self):
"""
GetL... |
'''
8 * 9 ** (number - 1) all mod 1000000007
Status: Accepted
'''
###############################################################################
def main():
"""Read input and print output"""
modulus = 1000000007
for _ in range(int(input())):
print((8 * pow(9, int(input()) - 1, modulus)) % modul... | """
8 * 9 ** (number - 1) all mod 1000000007
Status: Accepted
"""
def main():
"""Read input and print output"""
modulus = 1000000007
for _ in range(int(input())):
print(8 * pow(9, int(input()) - 1, modulus) % modulus)
if __name__ == '__main__':
main() |
def test():
# only check that the code runs and nwbfile.identifier is in the last line of the solution
assert "nwbfile.identifier" in __solution__.strip().splitlines()[-1], "Are you printing the session identifier?"
__msg__.good("Well done!")
| def test():
assert 'nwbfile.identifier' in __solution__.strip().splitlines()[-1], 'Are you printing the session identifier?'
__msg__.good('Well done!') |
x = 12
if x < 10:
print("x is less than 10")
elif x >= 10:
print("x is greater than or equal to 10") | x = 12
if x < 10:
print('x is less than 10')
elif x >= 10:
print('x is greater than or equal to 10') |
"""
SAN.AC.learning
~~~
Trains the voice in the given speech list.
Analyze speech files and retrieve the knowledge about this voice.
Finally, store the parameters of this voice to parody in the future.
:copyright: 2017 by Nhut Hai Huynh.
:license: MIT, see LICENSE for more details.
"""
| """
SAN.AC.learning
~~~
Trains the voice in the given speech list.
Analyze speech files and retrieve the knowledge about this voice.
Finally, store the parameters of this voice to parody in the future.
:copyright: 2017 by Nhut Hai Huynh.
:license: MIT, see LICENSE for more details.
""" |
# My Twitter App Credentials
consumer_key = ""
consumer_secret = ""
access_token = ""
access_token_secret = "" | consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = '' |
class ResponseTimeoutException(Exception):
"""Raised when no 'ok' response is received from the pyboard"""
class PyBoardError(Exception):
"""
Raised in liue of an exception raised on a remote PyBoard
See the example ":ref:`examples.basic.remote-exception`" for more
details.
"""
| class Responsetimeoutexception(Exception):
"""Raised when no 'ok' response is received from the pyboard"""
class Pyboarderror(Exception):
"""
Raised in liue of an exception raised on a remote PyBoard
See the example ":ref:`examples.basic.remote-exception`" for more
details.
""" |
def mostrar(nome):
tam = len(nome) + 4
print('~'*tam)
print(f' {nome}')
print('~'*tam)
#PRINT ESPECIAL
mostrar('Boaventura')
mostrar('Maria Laura')
| def mostrar(nome):
tam = len(nome) + 4
print('~' * tam)
print(f' {nome}')
print('~' * tam)
mostrar('Boaventura')
mostrar('Maria Laura') |
# noinspection PyUnusedLocal
# skus = unicode string
def calculate_offers(bill, item, quantity, offers):
bill = bill.copy()
for offer, price in offers:
bill[item]['offers'].append(
{'items': quantity / offer, 'price': price}
)
quantity = quantity % offer
return bill, ... | def calculate_offers(bill, item, quantity, offers):
bill = bill.copy()
for (offer, price) in offers:
bill[item]['offers'].append({'items': quantity / offer, 'price': price})
quantity = quantity % offer
return (bill, quantity)
def remove_free_items(skus):
def remove_free_item(quantity, ... |
PELVIS = 0
SPINE_NAVAL = 1
SPINE_CHEST = 2
NECK = 3
CLAVICLE_LEFT = 4
SHOULDER_LEFT = 5
ELBOW_LEFT = 6
WRIST_LEFT = 7
HAND_LEFT = 8
HANDTIP_LEFT = 9
THUMB_LEFT = 10
CLAVICLE_RIGHT = 11
SHOULDER_RIGHT = 12
ELBOW_RIGHT = 13
WRIST_RIGHT = 14
HAND_RIGHT = 15
HANDTIP_RIGHT = 16
THUMB_RIGHT = 17
HIP_LEFT = 18
KNEE_LEFT = 19
... | pelvis = 0
spine_naval = 1
spine_chest = 2
neck = 3
clavicle_left = 4
shoulder_left = 5
elbow_left = 6
wrist_left = 7
hand_left = 8
handtip_left = 9
thumb_left = 10
clavicle_right = 11
shoulder_right = 12
elbow_right = 13
wrist_right = 14
hand_right = 15
handtip_right = 16
thumb_right = 17
hip_left = 18
knee_left = 19
... |
begin_unit
comment|'# All Rights Reserved.'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may'
nl|'\n'
comment|'# not use this file except in compliance with the License. You may obtain'
nl|'\n'
comment|'# a copy of the License at'
nl|'\n'
comment|'#... | begin_unit
comment | '# All Rights Reserved.'
nl | '\n'
comment | '#'
nl | '\n'
comment | '# Licensed under the Apache License, Version 2.0 (the "License"); you may'
nl | '\n'
comment | '# not use this file except in compliance with the License. You may obtain'
nl | '\n'
comment | '# a copy of the License at'
... |
class intcode():
def __init__(self):
self.instructionPointer = 0
self.memory = []
self.stopped = False
def loadMemory(self, memList):
self.memory = memList.copy()
def loadProgram(self, programString):
numbers = programString.split(",")
self.memory = list(... | class Intcode:
def __init__(self):
self.instructionPointer = 0
self.memory = []
self.stopped = False
def load_memory(self, memList):
self.memory = memList.copy()
def load_program(self, programString):
numbers = programString.split(',')
self.memory = list(ma... |
"""
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.
For example, given the following triangle
[
[2],
[3,4],
[6,5,7],
[4,1,8,3]
]
The minimum path sum from top to bottom is 11 (i.e., 2 + 3 + 5 + 1 = 11).
Note:
Bonus point if yo... | """
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.
For example, given the following triangle
[
[2],
[3,4],
[6,5,7],
[4,1,8,3]
]
The minimum path sum from top to bottom is 11 (i.e., 2 + 3 + 5 + 1 = 11).
Note:
Bonus point if yo... |
# Problem: https://www.hackerrank.com/challenges/merge-the-tools/problem
def merge_the_tools(string, k):
num_sub = int(len(string)/k)
for sub_num in range(num_sub):
sub = string[sub_num*k:sub_num*k+k]
sub_list, unique_sub_list = list(sub), []
[unique_sub_list.append(letter) for letter i... | def merge_the_tools(string, k):
num_sub = int(len(string) / k)
for sub_num in range(num_sub):
sub = string[sub_num * k:sub_num * k + k]
(sub_list, unique_sub_list) = (list(sub), [])
[unique_sub_list.append(letter) for letter in sub_list if letter not in unique_sub_list]
unique_su... |
### Model data
class catboost_model(object):
float_features_index = [
0, 1, 2, 5, 6, 7, 8, 10, 12, 13, 14, 15, 16, 17, 20, 22, 24, 27, 28, 31, 32, 33, 34, 35, 37, 38, 39, 46, 47, 48, 49,
]
float_feature_count = 50
cat_feature_count = 0
binary_feature_count = 31
tree_count = 40
float... | class Catboost_Model(object):
float_features_index = [0, 1, 2, 5, 6, 7, 8, 10, 12, 13, 14, 15, 16, 17, 20, 22, 24, 27, 28, 31, 32, 33, 34, 35, 37, 38, 39, 46, 47, 48, 49]
float_feature_count = 50
cat_feature_count = 0
binary_feature_count = 31
tree_count = 40
float_feature_borders = [[0.17539501... |
"""
Binary Search Algorithm (Iterative Solution)
"""
def binary_search(a, t):
s, e = 0, len(a) - 1
while s <= e:
i = (s + e) // 2
x = a[i]
if t is x:
return i
elif t < x:
e = i - 1
else:
s = i + 1
return -1
| """
Binary Search Algorithm (Iterative Solution)
"""
def binary_search(a, t):
(s, e) = (0, len(a) - 1)
while s <= e:
i = (s + e) // 2
x = a[i]
if t is x:
return i
elif t < x:
e = i - 1
else:
s = i + 1
return -1 |
def adding_numbers(num1, num2, num3):
print('Have to add three numbers')
print('First Number = {}'.format(num1))
print('Second Number = {}'.format(num2))
print('Third Number = {}'.format(num3))
return num1 + num2 + num3
x = adding_numbers(10, 20, 30)
print('The function returned a value of ... | def adding_numbers(num1, num2, num3):
print('Have to add three numbers')
print('First Number = {}'.format(num1))
print('Second Number = {}'.format(num2))
print('Third Number = {}'.format(num3))
return num1 + num2 + num3
x = adding_numbers(10, 20, 30)
print('The function returned a value of {}'.forma... |
'''
>>> increments([1, 5, 7])
[2, 6, 8]
>>> increments([0, 0, 0, 0, 0])
[1, 1, 1, 1, 1]
>>> increments([0.5, 1.5, 1.75, 2.5])
[1.5, 2.5, 2.75, 3.5]
>>> increments([570, 968, 723, 179, 762, 377, 845, 320, 475, 952, 680, 874, 708, 493, 901, 896, 164, 165, 404, 147, 917, 936, 205, 615, 518, 254, 856, 584, 287, 336,... | """
>>> increments([1, 5, 7])
[2, 6, 8]
>>> increments([0, 0, 0, 0, 0])
[1, 1, 1, 1, 1]
>>> increments([0.5, 1.5, 1.75, 2.5])
[1.5, 2.5, 2.75, 3.5]
>>> increments([570, 968, 723, 179, 762, 377, 845, 320, 475, 952, 680, 874, 708, 493, 901, 896, 164, 165, 404, 147, 917, 936, 205, 615, 518, 254, 856, 584, 287, 336,... |
def parallel(task_id, file_name, workers, parameters={}):
response = {
'task_id': task_id,
"user_output": "Command received",
'completed': True
}
responses.append(response)
return | def parallel(task_id, file_name, workers, parameters={}):
response = {'task_id': task_id, 'user_output': 'Command received', 'completed': True}
responses.append(response)
return |
#First
i1 = str(input())
for i in i1:
print(i, end=" ")
#Second
i1 = "anant"
for i in range(0,len(i1)):
if i == len(i1) - 1:
print(i1[i],end="")
else:
print(i1[i], end=" ")
for i in range(0,3):
x = input()
print(x)
#Third
tuples = [
(-2.3391885553668246e-10, 8.473071450645254e-... | i1 = str(input())
for i in i1:
print(i, end=' ')
i1 = 'anant'
for i in range(0, len(i1)):
if i == len(i1) - 1:
print(i1[i], end='')
else:
print(i1[i], end=' ')
for i in range(0, 3):
x = input()
print(x)
tuples = [(-2.3391885553668246e-10, 8.473071450645254e-10), (-2.91634014818891e-1... |
img = tf.placeholder(tf.float32, [None, None, None, 3])
cost = tf.reduce_sum(...)
my_img_summary = tf.summary.image("img", img)
my_cost_summary = tf.summary.scalar("cost", cost) | img = tf.placeholder(tf.float32, [None, None, None, 3])
cost = tf.reduce_sum(...)
my_img_summary = tf.summary.image('img', img)
my_cost_summary = tf.summary.scalar('cost', cost) |
class Stack:
def __init__(self, name, service_list):
self.name = name
self.service_list = service_list
def services(self):
return [x.attrs() for x in self.service_list]
def serializable(self):
return {
"name": self.name,
"services": self.services()
... | class Stack:
def __init__(self, name, service_list):
self.name = name
self.service_list = service_list
def services(self):
return [x.attrs() for x in self.service_list]
def serializable(self):
return {'name': self.name, 'services': self.services()} |
class Message:
EVENT = "event"
MESSAGE = "message"
UPDATE = "update"
EPHEMERAL = "ephemeral"
| class Message:
event = 'event'
message = 'message'
update = 'update'
ephemeral = 'ephemeral' |
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
basic usage::
>>> # Here is a quick simhash example
>>> from changanya.simhash import Simhash
>>>
>>> hash1 = Simhash('This is a test string one.')
>>> hash2 = Simhash('This is a test string TWO.')
>>> hash1 # doctest: +ELLIPSIS
<chang... | """
basic usage::
>>> # Here is a quick simhash example
>>> from changanya.simhash import Simhash
>>>
>>> hash1 = Simhash('This is a test string one.')
>>> hash2 = Simhash('This is a test string TWO.')
>>> hash1 # doctest: +ELLIPSIS
<changanya.simhash.Simhash object at 0x...>
>>> print(... |
expected_output = {
"software-information": {
"package-information": [
{"comment": "EX Software Suite [18.2R2-S1]", "name": "ex-software-suite"},
{
"comment": "FIPS mode utilities [18.2R2-S1]",
"name": "fips-mode-utilities",
},
... | expected_output = {'software-information': {'package-information': [{'comment': 'EX Software Suite [18.2R2-S1]', 'name': 'ex-software-suite'}, {'comment': 'FIPS mode utilities [18.2R2-S1]', 'name': 'fips-mode-utilities'}, {'comment': 'Crypto Software Suite [18.2R2-S1]', 'name': 'crypto-software-suite'}, {'comment': 'O... |
#MenuTitle: Masters Overview
# -*- coding: utf-8 -*-
__doc__="""
Creates a new tab with rows of selected glyphs in all available master layers. Useful for comparing the different weights of a typeface.
"""
Font = Glyphs.font
Font.newTab()
for glyph in Font.selection:
Font.currentTab.layers.append(GSControlLayer(10))
... | __doc__ = '\nCreates a new tab with rows of selected glyphs in all available master layers. Useful for comparing the different weights of a typeface.\n'
font = Glyphs.font
Font.newTab()
for glyph in Font.selection:
Font.currentTab.layers.append(gs_control_layer(10))
for layer in glyph.layers:
if layer.i... |
# reassign the dataframe to be the result of the following .loc
# .loc[start_row:end_row, start_column:end_column]
# .loc[:, "Under 5":"18 years"] will return all columns between and including
df["age_bin_0-19"] = df.loc[:, 'Estimate Male Under 5':'Estimate Male 18']
df = DataFrame(np.random.rand(4,5), columns = li... | df['age_bin_0-19'] = df.loc[:, 'Estimate Male Under 5':'Estimate Male 18']
df = data_frame(np.random.rand(4, 5), columns=list('abcde'))
df.loc[:, 'b':'d'] |
class Node:
pass
class ProgramNode(Node):
def __init__(self, declarations):
self.declarations = declarations
class DeclarationNode(Node):
pass
class ExpressionNode(Node):
pass
class ClassDeclarationNode(DeclarationNode):
def __init__(self, idx, features, parent, row , column):
self... | class Node:
pass
class Programnode(Node):
def __init__(self, declarations):
self.declarations = declarations
class Declarationnode(Node):
pass
class Expressionnode(Node):
pass
class Classdeclarationnode(DeclarationNode):
def __init__(self, idx, features, parent, row, column):
s... |
a, b = map(int, input().split())
b -= 1
print(a * b + 1) | (a, b) = map(int, input().split())
b -= 1
print(a * b + 1) |
#!/anaconda3/bin/python
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class LeetCode_21_495(object):
def mergeTwoLists(self, l1, l2):
prehead = ListNode(-1)
prev = prehead
while l1 and l2:
if l1.val <= l2.val:
prev.ne... | class Listnode:
def __init__(self, x):
self.val = x
self.next = None
class Leetcode_21_495(object):
def merge_two_lists(self, l1, l2):
prehead = list_node(-1)
prev = prehead
while l1 and l2:
if l1.val <= l2.val:
prev.next = l1
... |
countries = [[('Finland', 'Helsinki')], [('Sweden', 'Stockholm')], [('Norway', 'Oslo')]]
flatten = [p for p in countries for p in p]
dictofcountries = [{'country': flatten[i][0].upper(), 'city': flatten[i][1].upper()} for i in range(len(flatten))]
print(dictofcountries)
| countries = [[('Finland', 'Helsinki')], [('Sweden', 'Stockholm')], [('Norway', 'Oslo')]]
flatten = [p for p in countries for p in p]
dictofcountries = [{'country': flatten[i][0].upper(), 'city': flatten[i][1].upper()} for i in range(len(flatten))]
print(dictofcountries) |
#!/usr/bin/env python3
# Modify the higher or lower program from this section to keep track of how
# many times the user has entered the wrong number. If it is more than 3
# times, print "That must have been complicated." at the end, otherwise
# print "Good job!"
number = 7
guess = -1
count = 0
print("Guess the numb... | number = 7
guess = -1
count = 0
print('Guess the number!')
while guess != number:
guess = int(input('Is it... '))
count = count + 1
if guess == number:
print('Hooray! You guessed it right!')
elif guess < number:
print("It's bigger... ")
elif guess > number:
print("It's not so... |
def test_model_with_one_index():
ddl = """
CREATE table v2.task_requests (
runid decimal(21) not null
,job_id decimal(21) not null
,object_id varchar(100) not null default 'none'
,pipeline_id varchar(100) not null default 'none'
,sequ... | def test_model_with_one_index():
ddl = "\n \n CREATE table v2.task_requests (\n runid decimal(21) not null\n ,job_id decimal(21) not null\n ,object_id varchar(100) not null default 'none'\n ,pipeline_id varchar(100) not null default 'none'\n ... |
############################################################
# -*- coding: utf-8 -*-
#
# # # # # # #
# ## ## # ## # #
# # # # # # # # # # #
# # ## # ## ## ######
# # # # # # #
#
# Python-based Tool for interaction with the 10micron mounts
# GUI with PyQT5 fo... | def generate_align_stars():
"""
generateAlignStars is the function where the alignment stars which were
present in the mount computer from hipparcos catalogue are stored. for a
correct calculation we need beside the J2000 coordinated the proper motion in
ra and dec, the parallax and the radial veloc... |
def fun1(str1):
fun1(str1)
print("This is " + str1)
fun1("Issue")
| def fun1(str1):
fun1(str1)
print('This is ' + str1)
fun1('Issue') |
class DatabaseConnectionInterface(object):
"""Abstract class for DatabaseConnection."""
def GetPoints(self, visit_location):
"""For given visit_location return initial set of points."""
raise NotImplemented()
def GetPoint(self, visit_location, point_name):
"""For given visit_location and Point nam... | class Databaseconnectioninterface(object):
"""Abstract class for DatabaseConnection."""
def get_points(self, visit_location):
"""For given visit_location return initial set of points."""
raise not_implemented()
def get_point(self, visit_location, point_name):
"""For given visit_loc... |
# URI Online Judge 1149
Entrada = input()
Entrada = list(map(int, Entrada.split()))
A = Entrada[0]
A_copy = A
sum = 0
for i in Entrada[1:]:
if i > 0:
N = i
for j in range(0,N):
sum += A_copy + j
print(sum) | entrada = input()
entrada = list(map(int, Entrada.split()))
a = Entrada[0]
a_copy = A
sum = 0
for i in Entrada[1:]:
if i > 0:
n = i
for j in range(0, N):
sum += A_copy + j
print(sum) |
# Copyright 2021 Google LLC
#
# 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, ... | def correct_answers(answers):
answers['NY'] = 'Correct!' if answers['NY'].lower() == 'albany' else 'Incorrect.'
answers['CA'] = 'Correct!' if answers['CA'].lower() == 'sacramento' else 'Incorrect.'
answers['TX'] = 'Correct!' if answers['TX'].lower() == 'austin' else 'Incorrect.'
answers['FL'] = 'Correct... |
# http://python.coderz.ir/
list=[1,2,3,4,5]
list.append(6)
print(list)
tuple=(1,2,3)
dic={'key1':'A','key2':'B'}
print(dic['key1'])
class Human():
print("human class")
def walking(self):
print("human is walking")
class contact(Human):
print("contact is creating")
def __init__(self,name,f... | list = [1, 2, 3, 4, 5]
list.append(6)
print(list)
tuple = (1, 2, 3)
dic = {'key1': 'A', 'key2': 'B'}
print(dic['key1'])
class Human:
print('human class')
def walking(self):
print('human is walking')
class Contact(Human):
print('contact is creating')
def __init__(self, name, family, address):... |
DEFAULT_METADATA_TABLE = 'data'
DEFAULT_USER_TABLE = 'user'
DEFAULT_NAME_COLUMN = 'dataset'
DEFAULT_UPDATE_COLUMN = 'updated_at'
DEFAULT_RESTRICTED_TABLES = [DEFAULT_METADATA_TABLE, DEFAULT_USER_TABLE]
DEFAULT_METADATA_COLUMNS = [
dict(name='id', type_='Integer', primary_key=True),
dict(name='dataset', type_='S... | default_metadata_table = 'data'
default_user_table = 'user'
default_name_column = 'dataset'
default_update_column = 'updated_at'
default_restricted_tables = [DEFAULT_METADATA_TABLE, DEFAULT_USER_TABLE]
default_metadata_columns = [dict(name='id', type_='Integer', primary_key=True), dict(name='dataset', type_='String', u... |
#!/usr/bin/env python
# coding: utf-8
# This notebook was prepared by [Donne Martin](https://github.com/donnemartin). Source and license info is on [GitHub](https://github.com/donnemartin/interactive-coding-challenges).
# # Solution Notebook
# ## Problem: Implement common bit manipulation operations: get_bit, set_bi... | def validate_index(func):
def validate_index_wrapper(self, *args, **kwargs):
for arg in args:
if arg < 0:
raise index_error('Invalid index')
return func(self, *args, **kwargs)
return validate_index_wrapper
class Bit(object):
def __init__(self, number):
... |
def lz78(charstream, verbose=False):
dict = {}
p = ""
code = []
i = 0
while True:
c = charstream[i]
try:
dict[p + c]
p = p + c
except (KeyError):
if p == "":
o = 0
else:
o = dict[p... | def lz78(charstream, verbose=False):
dict = {}
p = ''
code = []
i = 0
while True:
c = charstream[i]
try:
dict[p + c]
p = p + c
except KeyError:
if p == '':
o = 0
else:
o = dict[p]
code... |
for number in range(1001):
string=list(str(number))
sum_of_each_digit=0
for j in range(len(string)):
int_number=int(string[j])
power_of_digit = int_number ** len(string)
sum_of_each_digit += power_of_digit
if number == sum_of_each_digit:
print (number, "Is amstrong Number")
| for number in range(1001):
string = list(str(number))
sum_of_each_digit = 0
for j in range(len(string)):
int_number = int(string[j])
power_of_digit = int_number ** len(string)
sum_of_each_digit += power_of_digit
if number == sum_of_each_digit:
print(number, 'Is amstrong N... |
spells = {
'levitate': 'Levioso',
'make fire': 'Incendio',
'open locked door': 'Alohomora'
}
# dictionary operators
print(spells['open locked door'])
print(spells['levitate'])
print(spells.keys())
print(dir(spells))
| spells = {'levitate': 'Levioso', 'make fire': 'Incendio', 'open locked door': 'Alohomora'}
print(spells['open locked door'])
print(spells['levitate'])
print(spells.keys())
print(dir(spells)) |
class Cleaning():
def __init__(self, df):
self.df = df
pass
def drop_null_cols(self, percent):
"""
A funciton to drop a column if a certain percent of its values
are null
"""
if percent > 1:
percent = percent/100
a = self.df
fo... | class Cleaning:
def __init__(self, df):
self.df = df
pass
def drop_null_cols(self, percent):
"""
A funciton to drop a column if a certain percent of its values
are null
"""
if percent > 1:
percent = percent / 100
a = self.df
f... |
def insertion_sort(array):
for i in range(1, len(array)):
currentValue = array[i]
currentPosition = i
while currentPosition > 0 and array[currentPosition - 1] > currentValue:
array[currentPosition] = array[currentPosition -1]
currentPosition -= 1
array[currentPosition] = currentValue
return array
#... | def insertion_sort(array):
for i in range(1, len(array)):
current_value = array[i]
current_position = i
while currentPosition > 0 and array[currentPosition - 1] > currentValue:
array[currentPosition] = array[currentPosition - 1]
current_position -= 1
array[cur... |
class EbWrapper:
def set_eb_raw_json_data(self, eb_raw_json_data: dict):
if not type(eb_raw_json_data).__name__ == 'dict':
raise TypeError('The entered data must be of type dict')
self.eb_raw_json_data = eb_raw_json_data
return self
def get_environment_name(self):
... | class Ebwrapper:
def set_eb_raw_json_data(self, eb_raw_json_data: dict):
if not type(eb_raw_json_data).__name__ == 'dict':
raise type_error('The entered data must be of type dict')
self.eb_raw_json_data = eb_raw_json_data
return self
def get_environment_name(self):
... |
name = data.get('name', 'world')
logger.info("Hello Robin {}".format(name))
hass.bus.fire(name, { "wow": "from a Python script!" })
state = hass.states.get('sensor.next_train_status')
train_status = state.state
if train_status == 'ON TIME':
hass.services.call('light', 'turn_on', { "entity_id" : 'light.lamp', 'co... | name = data.get('name', 'world')
logger.info('Hello Robin {}'.format(name))
hass.bus.fire(name, {'wow': 'from a Python script!'})
state = hass.states.get('sensor.next_train_status')
train_status = state.state
if train_status == 'ON TIME':
hass.services.call('light', 'turn_on', {'entity_id': 'light.lamp', 'color_nam... |
inputString = str(input())
tool = len(inputString)
count_3 = inputString.count('3')
count_2 = inputString.count('2')
count_1 = inputString.count('1')
regularWordage = '1' * count_1 + '2' * count_2 + '3' * count_3
for i in range(0,tool-1) :
if i%2 == 0:
pass
else:
regularWordage = regularWordage... | input_string = str(input())
tool = len(inputString)
count_3 = inputString.count('3')
count_2 = inputString.count('2')
count_1 = inputString.count('1')
regular_wordage = '1' * count_1 + '2' * count_2 + '3' * count_3
for i in range(0, tool - 1):
if i % 2 == 0:
pass
else:
regular_wordage = regularW... |
oddcompnumlist = []
for i in range(2,10000):
if i%2!=0:
if 2**(i-1)%i!=1:
oddcompnumlist.append(i)
primlist = []
randlist = []
complist = []
for j in range(2,142):
boolist = []
for k in range(2,j):
if j%k != 0:
boolist.append('false')
elif j%k == 0:
... | oddcompnumlist = []
for i in range(2, 10000):
if i % 2 != 0:
if 2 ** (i - 1) % i != 1:
oddcompnumlist.append(i)
primlist = []
randlist = []
complist = []
for j in range(2, 142):
boolist = []
for k in range(2, j):
if j % k != 0:
boolist.append('false')
elif j %... |
#
# PySNMP MIB module VERILINK-ENTERPRISE-NCMJAPISDN-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/VERILINK-ENTERPRISE-NCMJAPISDN-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:26:55 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_intersection, single_value_constraint, value_range_constraint, constraints_union) ... |
__all__ = ["WindowOperator"]
class WindowOperator(Operator):
pass
| __all__ = ['WindowOperator']
class Windowoperator(Operator):
pass |
def allinstance(collection, legal_type):
"""
Checks the type of all items in a collection match a specified type
Parameters
----------
collection: list, tuple, or set
legal_type: type
Returns
-------
bool
"""
if not isinstance(collection, (list, tuple, set)):
illegal = type(collection).__name__
raise(T... | def allinstance(collection, legal_type):
"""
Checks the type of all items in a collection match a specified type
Parameters
----------
collection: list, tuple, or set
legal_type: type
Returns
-------
bool
"""
if not isinstance(collection, (list, tuple, set)):
illegal = type(collection).__name... |
# Read from the file words.txt and output the word frequency list to stdout.
with open('words.txt', 'r') as f:
line = f.readline()
word_occ_dict = {}
while line:
tokens = list( line.split() )
for t in tokens:
word_occ_dict[t] = word_occ_dict.get(t, ... | with open('words.txt', 'r') as f:
line = f.readline()
word_occ_dict = {}
while line:
tokens = list(line.split())
for t in tokens:
word_occ_dict[t] = word_occ_dict.get(t, 0) + 1
line = f.readline()
for word in sorted(word_occ_dict, key=word_occ_dict.get, reverse=True):... |
# imports
def fifty_ml_heights(init_vol, steps, vol_dec):
vols = []
heights = []
# these values originate from Excel spreadsheet "Exp803..."
print (init_vol)
b = 0
m = 0.0024
if init_vol > 51000:
offset = 14 # model out of range; see sheet
else:
offset = 7 # mm Need ... | def fifty_ml_heights(init_vol, steps, vol_dec):
vols = []
heights = []
print(init_vol)
b = 0
m = 0.0024
if init_vol > 51000:
offset = 14
else:
offset = 7
print(offset)
for i in range(steps):
x = init_vol - vol_dec * i
vols.append(x)
h = m * x +... |
class Config:
# AWS Information
ec2_region = "eu-west-2" # London # Same as environment variable EC2_REGION
ec2_amis = ['ami-09c4a4b013e66b291']
ec2_keypair = 'OnDemandMinecraft'
ec2_secgroups = ['sg-0441198b7b0617d3a']
ec2_instancetype = 't3.small'
| class Config:
ec2_region = 'eu-west-2'
ec2_amis = ['ami-09c4a4b013e66b291']
ec2_keypair = 'OnDemandMinecraft'
ec2_secgroups = ['sg-0441198b7b0617d3a']
ec2_instancetype = 't3.small' |
with open('payload.bin', 'rb') as stringFile:
with open('payload.s', 'w') as f:
for byte in stringFile.read():
print('byte %s' % hex(byte), file=f)
| with open('payload.bin', 'rb') as string_file:
with open('payload.s', 'w') as f:
for byte in stringFile.read():
print('byte %s' % hex(byte), file=f) |
def fast_scan_ms(name = 'test', tilt_stage=True):
print("in bens routine")
yield from expert_reflection_scan_full(md={'sample_name': name}, detector=lambda_det, tilt_stage=tilt_stage)
def ms_align():
yield from bps.mv(geo.det_mode,1)
yield from bps.mv(abs2,3)
yield from nab(-0.1,-0.1)
y... | def fast_scan_ms(name='test', tilt_stage=True):
print('in bens routine')
yield from expert_reflection_scan_full(md={'sample_name': name}, detector=lambda_det, tilt_stage=tilt_stage)
def ms_align():
yield from bps.mv(geo.det_mode, 1)
yield from bps.mv(abs2, 3)
yield from nab(-0.1, -0.1)
yield fr... |
#Restaurant:
class Restaurant():
"""A simple attempt to make class restaurant. """
def __init__(self, restaurant_name, cuisine_type):
""" This is to initialize name and type of restaurant"""
self.restaurant_name = restaurant_name
self.cuisine_type = cuisine_type
def describe_resta... | class Restaurant:
"""A simple attempt to make class restaurant. """
def __init__(self, restaurant_name, cuisine_type):
""" This is to initialize name and type of restaurant"""
self.restaurant_name = restaurant_name
self.cuisine_type = cuisine_type
def describe_restaurant(self):
... |
# Insert a Node at the Tail of a Linked List
# Developer: Murillo Grubler
# https://www.hackerrank.com/challenges/insert-a-node-at-the-tail-of-a-linked-list/problem
class SinglyLinkedListNode:
def __init__(self, data):
self.data = data
self.next = None
class SinglyLinkedList:
def __init__(self... | class Singlylinkedlistnode:
def __init__(self, data):
self.data = data
self.next = None
class Singlylinkedlist:
def __init__(self):
self.head = None
self.tail = None
def print_singly_linked_list(head):
while head:
print(head.data)
head = head.next
def ins... |
tempClasses = []
tempStudents = []
def student(_, info, id):
for s in tempStudents:
if s['id'] == id:
return s
return None
def students(_, info):
return {
'success': True,
'errors': [],
'students': tempStudents}
def classes(_, info, id):
for c in tempCla... | temp_classes = []
temp_students = []
def student(_, info, id):
for s in tempStudents:
if s['id'] == id:
return s
return None
def students(_, info):
return {'success': True, 'errors': [], 'students': tempStudents}
def classes(_, info, id):
for c in tempClasses:
if c['id'] =... |
class WechatPayError(Exception):
pass
class APIError(WechatPayError):
pass
class ValidationError(APIError):
pass
class AuthenticationError(APIError):
pass
class RequestFailed(APIError):
pass
| class Wechatpayerror(Exception):
pass
class Apierror(WechatPayError):
pass
class Validationerror(APIError):
pass
class Authenticationerror(APIError):
pass
class Requestfailed(APIError):
pass |
# #1
# def count_red_beads(n):
# return 0 if n < 2 else (n - 1) * 2
def count_red_beads(n): # 2
return max(0, 2 * (n-1))
| def count_red_beads(n):
return max(0, 2 * (n - 1)) |
class SystemFonts(object):
""" Contains properties that expose the system resources that concern fonts. """
CaptionFontFamily=None
CaptionFontFamilyKey=None
CaptionFontSize=12.0
CaptionFontSizeKey=None
CaptionFontStyle=None
CaptionFontStyleKey=None
CaptionFontTextDecorations=None
CaptionFontTextDecora... | class Systemfonts(object):
""" Contains properties that expose the system resources that concern fonts. """
caption_font_family = None
caption_font_family_key = None
caption_font_size = 12.0
caption_font_size_key = None
caption_font_style = None
caption_font_style_key = None
caption_font... |
class StringViewIter:
__slots__ = ("inp", "position")
def __init__(self, inp: str):
self.inp = inp
self.position = 0
def __iter__(self):
return self
def __next__(self):
if self.position >= len(self.inp):
raise StopIteration
self.position += 1
... | class Stringviewiter:
__slots__ = ('inp', 'position')
def __init__(self, inp: str):
self.inp = inp
self.position = 0
def __iter__(self):
return self
def __next__(self):
if self.position >= len(self.inp):
raise StopIteration
self.position += 1
... |
#paste your date in collections
collections = """28/03/2020
28/04/2020
28/05/2020
28/06/2020
28/07/2020
28/08/2020
28/10/2019
28/11/2019
28/12/2019
28/01/2020
28/02/2020
28/03/2020
28/04/2020
28/05/2020
28/06/2020
28/07/2020
28/08/2020
28/12/2019
28/01/2020
28/02/2020
28/03/2020
28/04/2020
28/05/2020
28/06/2020
28/07/2... | collections = '28/03/2020\n28/04/2020\n28/05/2020\n28/06/2020\n28/07/2020\n28/08/2020\n28/10/2019\n28/11/2019\n28/12/2019\n28/01/2020\n28/02/2020\n28/03/2020\n28/04/2020\n28/05/2020\n28/06/2020\n28/07/2020\n28/08/2020\n28/12/2019\n28/01/2020\n28/02/2020\n28/03/2020\n28/04/2020\n28/05/2020\n28/06/2020\n28/07/2020\n28/08... |
def check_fabs(matrix):
print(matrix)
s = set()
i = 0
while i < len(matrix):
if matrix[i][1] in s:
matrix[i][1] += 1
if matrix[i][1] == len(matrix):
matrix[i][1] = 0
else:
s.add(matrix[i][1])
i += 1
print(matrix)
pri... | def check_fabs(matrix):
print(matrix)
s = set()
i = 0
while i < len(matrix):
if matrix[i][1] in s:
matrix[i][1] += 1
if matrix[i][1] == len(matrix):
matrix[i][1] = 0
else:
s.add(matrix[i][1])
i += 1
print(matrix)
pri... |
# Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai).
# n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0).
# Find two lines, which together with x-axis forms a container, such that the container contains the most water.
# Note: ... | class Solution(object):
def max_area(self, height):
"""
:type height: List[int]
:rtype: int
"""
if len(height) == 2:
return min(height[0], height[1])
(left_p, right_p) = (0, len(height) - 1)
max_volumn = 0
while left_p < right_p:
... |
#Entering Input
n = int(input("Enter the no of elements in List: "))
print(f"Enter the List of {n} numbers: ")
myList = []
for num in range (n):
myList.append(int(input()))
print (myList)
#Finding the largest Number
larNo = myList[0]
for num in range(0,n-1):
if larNo < myList[num+1]:
larNo = myLi... | n = int(input('Enter the no of elements in List: '))
print(f'Enter the List of {n} numbers: ')
my_list = []
for num in range(n):
myList.append(int(input()))
print(myList)
lar_no = myList[0]
for num in range(0, n - 1):
if larNo < myList[num + 1]:
lar_no = myList[num + 1]
print('The Largest Number: ', lar... |
resultado=""
K=int(input())
if K>0 and K<=1000:
while K!=0:
N,M=list(map(int, input().split()))
if N>-10000 or M<10000:
for x in range(K):
X,Y=list(map(int, input().split()))
if X>=-10000 or Y<=10000:
if X<N and Y>M:
resultado += "NO\n"
elif X>N and Y>M:
resultado += "NE\n"
el... | resultado = ''
k = int(input())
if K > 0 and K <= 1000:
while K != 0:
(n, m) = list(map(int, input().split()))
if N > -10000 or M < 10000:
for x in range(K):
(x, y) = list(map(int, input().split()))
if X >= -10000 or Y <= 10000:
if X < ... |
"""Provides the repository macro to import LLVM."""
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def repo():
"""Imports LLVM."""
XED_COMMIT = "5976632eeaaaad7890c2109d0cfaf4012eaca3b8"
XED_SHA256 = "8cc7c3ee378a8827e760e71ecf6642a814f0a991d768a120df5f177323b692e6"
MBUILD_C... | """Provides the repository macro to import LLVM."""
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
def repo():
"""Imports LLVM."""
xed_commit = '5976632eeaaaad7890c2109d0cfaf4012eaca3b8'
xed_sha256 = '8cc7c3ee378a8827e760e71ecf6642a814f0a991d768a120df5f177323b692e6'
mbuild_commit ... |
print("Welcome to the tip calculator.")
bill = float(input("What was your total? $"))
tip = int(input("What percentage tip would you like to give? 10, 12 or 15? "))
people = int(input("How many people to split the bill? "))
bill_with_tip = ((tip /100 ) * bill + bill) / people
final_bill = round(bill_with_tip,2)
# print... | print('Welcome to the tip calculator.')
bill = float(input('What was your total? $'))
tip = int(input('What percentage tip would you like to give? 10, 12 or 15? '))
people = int(input('How many people to split the bill? '))
bill_with_tip = (tip / 100 * bill + bill) / people
final_bill = round(bill_with_tip, 2)
print(f'... |
def distance(strand_a, strand_b):
try:
if strand_a == strand_b:
return 0
else:
count = 0
total = 0
while count < len(strand_a):
if strand_a[count] != strand_b[count]:
total = total + 1
count += 1
... | def distance(strand_a, strand_b):
try:
if strand_a == strand_b:
return 0
else:
count = 0
total = 0
while count < len(strand_a):
if strand_a[count] != strand_b[count]:
total = total + 1
count += 1
... |
# Initial state.
a = 1
b = c = d = e = f = g = h = 0
b = 67
c = b
# if a != 0 goto ANZ # jnz a 2
# When a was 0, this would skip the next 4 lines
# jnz 1 5
# ANZ
b = b * 100 # (6700) # mul b 100 #1
b -= -100000 # sub b -100000 # 2
c = b # set c b # 3
c -= -17000 # sub c -17000 # 4
# b = 106700
# c = 123700
# -23... | a = 1
b = c = d = e = f = g = h = 0
b = 67
c = b
b = b * 100
b -= -100000
c = b
c -= -17000
while True:
f = 1
d = 2
while True:
e = 2
if b % d == 0:
f = 0
e = b
d += 1
g = d
g -= b
if d == b:
break
if f == 0:
h -= -1... |
#Embedded file name: ACEStream\__init__.pyo
LIBRARYNAME = 'ACEStream'
DEFAULT_I2I_LISTENPORT = 0
DEFAULT_SESSION_LISTENPORT = 8621
DEFAULT_HTTP_LISTENPORT = 6878
| libraryname = 'ACEStream'
default_i2_i_listenport = 0
default_session_listenport = 8621
default_http_listenport = 6878 |
list1 = list()
list2 = ['a', 25, 'string', 14.03]
list3 = list((1,2,3,4)) # list(tuple)
print (list1)
print (list2)
print (list3)
# List Comprehension
list4 = [x for x in range(10)]
print (list4)
list5 = [x**2 for x in range(10) if x > 4]
print (list5)
# del(): delete list item or list itself
list6 = ['sugar', 'rice... | list1 = list()
list2 = ['a', 25, 'string', 14.03]
list3 = list((1, 2, 3, 4))
print(list1)
print(list2)
print(list3)
list4 = [x for x in range(10)]
print(list4)
list5 = [x ** 2 for x in range(10) if x > 4]
print(list5)
list6 = ['sugar', 'rice', 'tea', 'cup']
del list6[1]
print(list6)
del list6
list7 = ['sugar', 'tea', '... |
project='pbdcex'
version='0.1.1'
debug = 1 #0/1
defs = []
verbose = 'on' #on/off
extra_c_flags = '-wno-unused-parameter'
extra_cxx_flags = '--std=c++11 -lpthread -lrt -ldl'
env = {
'protoi':'/usr/local/include',
'protoc':'protoc',
'protoi':'/usr/local/include',
}
units = [
{
'name':'pbdcexer',... | project = 'pbdcex'
version = '0.1.1'
debug = 1
defs = []
verbose = 'on'
extra_c_flags = '-wno-unused-parameter'
extra_cxx_flags = '--std=c++11 -lpthread -lrt -ldl'
env = {'protoi': '/usr/local/include', 'protoc': 'protoc', 'protoi': '/usr/local/include'}
units = [{'name': 'pbdcexer', 'type': 'exe', 'subdir': 'src', 'in... |
#
# PySNMP MIB module NRC-HUB1-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NRC-HUB1-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:24:24 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,... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, value_size_constraint, value_range_constraint, constraints_union) ... |
# Animate plot as a wire-frame
plotter = pv.Plotter(window_size=(800, 600))
plotter.add_mesh(grid, scalars=d[:, 1],
scalar_bar_args={'title': 'Y Displacement'},
show_edges=True,
rng=[-d.max(), d.max()], interpolate_before_map=True,
style='wireframe')
p... | plotter = pv.Plotter(window_size=(800, 600))
plotter.add_mesh(grid, scalars=d[:, 1], scalar_bar_args={'title': 'Y Displacement'}, show_edges=True, rng=[-d.max(), d.max()], interpolate_before_map=True, style='wireframe')
plotter.add_axes()
plotter.camera_position = cpos
plotter.open_gif('beam_wireframe.gif')
for phase i... |
def display():
def message():
return "Hello "
return message
fun=display()
print(fun())
| def display():
def message():
return 'Hello '
return message
fun = display()
print(fun()) |
def sku_lookup(sku):
price_table = [
{
'item': 'A',
'price': 50,
'offers': [
'3A for 130',
],
},
{
'item': 'B',
'price': 30,
'offers': [
'2B for 45',
... | def sku_lookup(sku):
price_table = [{'item': 'A', 'price': 50, 'offers': ['3A for 130']}, {'item': 'B', 'price': 30, 'offers': ['2B for 45']}, {'item': 'C', 'price': 20, 'offers': []}, {'item': 'D', 'price': 15, 'offers': []}]
for item in price_table:
if sku == item.get('item'):
return item
... |
class One:
def __init__(self):
super().__init__()
print("This is init method of class One")
self.i=5
class Two(One):
def __init__(self):
super().__init__()
print("This is init method of class Two")
self.j=10
class Three(Two):
def __init__(self):... | class One:
def __init__(self):
super().__init__()
print('This is init method of class One')
self.i = 5
class Two(One):
def __init__(self):
super().__init__()
print('This is init method of class Two')
self.j = 10
class Three(Two):
def __init__(self):
... |
{
"targets": [
{
"target_name": "mmap",
"sources": ["mmap.cc" ],
"include_dirs": [
"<!(node -e \"require('nan')\")",
],
"xcode_settings": {
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
"MACOSX_DEPLOYMENT_TARGET": "10.12",
"OTHER_CPLUSPLUSFLAGS": [ "-std=c++11",... | {'targets': [{'target_name': 'mmap', 'sources': ['mmap.cc'], 'include_dirs': ['<!(node -e "require(\'nan\')")'], 'xcode_settings': {'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', 'MACOSX_DEPLOYMENT_TARGET': '10.12', 'OTHER_CPLUSPLUSFLAGS': ['-std=c++11', '-stdlib=libc++'], 'OTHER_LDFLAGS': ['-stdlib=libc++']}, 'libraries': []}]} |
# Python modules
# 3rd party modules
# Our modules
#------------------------------------------------------------------------------
# Method calls for different entry points' processing
def do_processing_all(chain):
"""
"""
return
set = chain._block.set
... | def do_processing_all(chain):
"""
"""
return
set = chain._block.set |
#!/usr/local/bin/python3.3
L = [1, 2, 3, 4]
print(L[-1000:100])
L[3:1] = ['?']
print(L)
| l = [1, 2, 3, 4]
print(L[-1000:100])
L[3:1] = ['?']
print(L) |
def bissexto(ano):
if(ano % 4 == 0 and (ano % 400 == 0 or ano % 100 != 0)):
return True
return False
def dias_mes(ano):
if(len(ano)=='fev'):
return ValueError("Nao tem 3 caracteres")
return
mes=str(input("Mes: "))
print(dias_mes(mes)) | def bissexto(ano):
if ano % 4 == 0 and (ano % 400 == 0 or ano % 100 != 0):
return True
return False
def dias_mes(ano):
if len(ano) == 'fev':
return value_error('Nao tem 3 caracteres')
return
mes = str(input('Mes: '))
print(dias_mes(mes)) |
'''
The MIT License (MIT)
Copyright (c) 2016 WavyCloud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, p... | """
The MIT License (MIT)
Copyright (c) 2016 WavyCloud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, p... |
"""Farcy test helpers."""
class Struct(object):
"""A dynamic class with attributes based on the input dictionary."""
def __init__(self, iterable=None, **attrs):
"""Create an instance of the Struct class."""
self.__dict__.update(attrs)
self._iterable = iterable or []
def __getitem... | """Farcy test helpers."""
class Struct(object):
"""A dynamic class with attributes based on the input dictionary."""
def __init__(self, iterable=None, **attrs):
"""Create an instance of the Struct class."""
self.__dict__.update(attrs)
self._iterable = iterable or []
def __getitem_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.