content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# inheritance - 2 - normal methods
class Person():
def details(self):
print("Can have information specific to the person")
class Student(Person):
def details(self):
super().details()
print("Can have information specific to the student")
s = Student()
s.details()
| class Person:
def details(self):
print('Can have information specific to the person')
class Student(Person):
def details(self):
super().details()
print('Can have information specific to the student')
s = student()
s.details() |
# 255: '11111111'
# 65536: '10000000000000000'
# 16777215: '111111111111111111111111'
d = 0
a = 8307757
while (d != a):
c = d | 0x10000
d = 14070682
while True:
d = (((d + (c & 0xFF)) & 0xFFFFFF) * 65899) & 0xFFFFFF
if 256 > c:
break
c //= 256
print("Program halts")
| d = 0
a = 8307757
while d != a:
c = d | 65536
d = 14070682
while True:
d = (d + (c & 255) & 16777215) * 65899 & 16777215
if 256 > c:
break
c //= 256
print('Program halts') |
'''
You may have noticed that the medals are ordered according to a lexicographic (dictionary) ordering: Bronze < Gold < Silver. However, you would prefer an ordering consistent with the Olympic rules: Bronze < Silver < Gold.
You can achieve this using Categorical types. In this final exercise, after redefining the 'M... | """
You may have noticed that the medals are ordered according to a lexicographic (dictionary) ordering: Bronze < Gold < Silver. However, you would prefer an ordering consistent with the Olympic rules: Bronze < Silver < Gold.
You can achieve this using Categorical types. In this final exercise, after redefining the 'M... |
class Node(object):
def __init__(self, value):
self.value = value
self.next = None
self.prev = None
def __repr__(self):
if not self:
return '%s()' % (self.__class__.__name__,)
return '%s(%r)' % (self.__class__.__name__, self.value)
class BinaryNode():
d... | class Node(object):
def __init__(self, value):
self.value = value
self.next = None
self.prev = None
def __repr__(self):
if not self:
return '%s()' % (self.__class__.__name__,)
return '%s(%r)' % (self.__class__.__name__, self.value)
class Binarynode:
de... |
def getNextPowerof2(num):
power = 1
while(power < num):
power *= 2
return power
def buildWalshTable(wTable, length, i1,i2, j1,j2, isComplement):
if length == 2:
if not isComplement:
wTable[i1][j1] = 1
wTable[i1][j2] = 1
wTable[i2][j1] = 1
... | def get_next_powerof2(num):
power = 1
while power < num:
power *= 2
return power
def build_walsh_table(wTable, length, i1, i2, j1, j2, isComplement):
if length == 2:
if not isComplement:
wTable[i1][j1] = 1
wTable[i1][j2] = 1
wTable[i2][j1] = 1
... |
#
# 1021. Remove Outermost Parentheses
#
# Q: https://leetcode.com/problems/remove-outermost-parentheses/
# A: https://leetcode.com/problems/remove-outermost-parentheses/discuss/275804/Javascript-Python3-C%2B%2B-Stack-solutions
#
class Solution:
def removeOuterParentheses(self, parens: str) -> str:
s, x = ... | class Solution:
def remove_outer_parentheses(self, parens: str) -> str:
(s, x) = ([], [])
for c in parens:
if c == ')':
s.pop()
if len(s):
x.append(c)
if c == '(':
s.append(c)
return ''.join(x) |
{'983ab651-eb86-4471-8361-c97a5015637e': ('eb86', 'gcpuujtn5ydu', 'SW3', 'Chelsea', ['Chelsea'], (51.491239, -0.16875000000000001)),
'83f496df-fcc8-4dcf-8161-a60a75364cf2': ('fcc8', 'gcpuwf1xsv7d', 'SE26', 'Sydenham', ['Sydenham'], (51.428317999999997, -0.052663000000000001)),
'31f90575-7945-4999-b3a7-5045bb860302': ('... | {'983ab651-eb86-4471-8361-c97a5015637e': ('eb86', 'gcpuujtn5ydu', 'SW3', 'Chelsea', ['Chelsea'], (51.491239, -0.16875)), '83f496df-fcc8-4dcf-8161-a60a75364cf2': ('fcc8', 'gcpuwf1xsv7d', 'SE26', 'Sydenham', ['Sydenham'], (51.428318, -0.052663)), '31f90575-7945-4999-b3a7-5045bb860302': ('7945', 'gcpuwqsv468q', 'SE22', 'E... |
def mayor(a,b):
if(a>b):
print("a es mayor que b")
mayor(4,3)
mayor(0,-1)
mayor(9,9) | def mayor(a, b):
if a > b:
print('a es mayor que b')
mayor(4, 3)
mayor(0, -1)
mayor(9, 9) |
class TextureType:
PLAYER = 0
HOUSE_INTERIOR = 1
GROCERY_STORE_INTERIOR = 2
VEHICLE = 3
SINK = 4
SHOPPING_CART = 5
DOG = 6
FOOD = 7
SOAP = 8
HAND_SANITIZER = 9
TOILET_PAPER = 10
MASK = 11
PET_SUPPLIES = 12
AISLE = 13
DOOR = 14
HOUSE_EXTERIOR = 15
STORE_EXTERIOR = 16
SELF_CHECKOUT = 17
CLOSET = 18
C... | class Texturetype:
player = 0
house_interior = 1
grocery_store_interior = 2
vehicle = 3
sink = 4
shopping_cart = 5
dog = 6
food = 7
soap = 8
hand_sanitizer = 9
toilet_paper = 10
mask = 11
pet_supplies = 12
aisle = 13
door = 14
house_exterior = 15
store... |
mys1 = {1,2,3,4}
mys2 = {1,2,3,4,5,6}
print(mys2.issuperset(mys1)) # ISUP1
mys3 = {'a','b','c','d'}
mys4 = {'d','w','f','g'}
mys5 = {'a','b', 'c', 'd','v','w','x','z'}
print(mys3.issuperset(mys4)) # ISUP2
print(mys4.issuperset(mys5)) # ISUP3
print(mys5.issuperset(mys3)) # ISUP4 | mys1 = {1, 2, 3, 4}
mys2 = {1, 2, 3, 4, 5, 6}
print(mys2.issuperset(mys1))
mys3 = {'a', 'b', 'c', 'd'}
mys4 = {'d', 'w', 'f', 'g'}
mys5 = {'a', 'b', 'c', 'd', 'v', 'w', 'x', 'z'}
print(mys3.issuperset(mys4))
print(mys4.issuperset(mys5))
print(mys5.issuperset(mys3)) |
fa=open('MGI_HGNC_homologene.rpt')
L={}
fa.readline()
for line in fa:
seq=line.rstrip().split('\t')
try:
l= abs(float(seq[11])-float(seq[12]))
L[seq[1]]=l
except Exception as e:
pass
fi=open('GSE109125_Gene_count_table.csv.uniq')
fo=open('GSE109125_Gene_count_table.csv.uniq.rpk','w... | fa = open('MGI_HGNC_homologene.rpt')
l = {}
fa.readline()
for line in fa:
seq = line.rstrip().split('\t')
try:
l = abs(float(seq[11]) - float(seq[12]))
L[seq[1]] = l
except Exception as e:
pass
fi = open('GSE109125_Gene_count_table.csv.uniq')
fo = open('GSE109125_Gene_count_table.csv... |
#
# @lc app=leetcode id=215 lang=python3
#
# [215] Kth Largest Element in an Array
#
# https://leetcode.com/problems/kth-largest-element-in-an-array/description/
#
# algorithms
# Medium (59.69%)
# Likes: 6114
# Dislikes: 378
# Total Accepted: 944.8K
# Total Submissions: 1.6M
# Testcase Example: '[3,2,1,5,6,4]\n2... | class Solution:
def find_kth_largest(self, nums: List[int], k: int) -> int:
nums.sort()
return nums[-k] |
blog_list = [
{"date": "Dec 2018",
"title": "Starcraft II A.I. Bot",
"content": "Industria is a mixture of role-based A.I. with an deep learning decision process enhancement. While most of it's actions are scripted, it decides about an army composition.",
"keywords": ['starcraft-ii','bot','artificia... | blog_list = [{'date': 'Dec 2018', 'title': 'Starcraft II A.I. Bot', 'content': "Industria is a mixture of role-based A.I. with an deep learning decision process enhancement. While most of it's actions are scripted, it decides about an army composition.", 'keywords': ['starcraft-ii', 'bot', 'artificial-intelligence', 'q... |
def reduceBlue(picture, amount):
for pixel in getPixels(picture):
newBlue = getBlue(pixel) * amount
setBlue(pixel, newBlue)
repaint(picture)
def swapRedBlue(picture):
for pixel in getPixels(picture):
swapBlue = getRed(pixel)
swapRed = getBlue(pixel)
setR... | def reduce_blue(picture, amount):
for pixel in get_pixels(picture):
new_blue = get_blue(pixel) * amount
set_blue(pixel, newBlue)
repaint(picture)
def swap_red_blue(picture):
for pixel in get_pixels(picture):
swap_blue = get_red(pixel)
swap_red = get_blue(pixel)
set_r... |
n, _ = input().split()
n = int(n)
l = [[] for i in range(n)]
while True:
try:
a, b = input().split()
a = int(a)
b = int(b)
l[a].append(b)
except Exception as e:
break
for r in range(len(l)):
for i in l[r]:
print(r+1, i+1)
| (n, _) = input().split()
n = int(n)
l = [[] for i in range(n)]
while True:
try:
(a, b) = input().split()
a = int(a)
b = int(b)
l[a].append(b)
except Exception as e:
break
for r in range(len(l)):
for i in l[r]:
print(r + 1, i + 1) |
#!/usr/bin/python3
update_dictionary = __import__('7-update_dictionary').update_dictionary
print_sorted_dictionary = __import__('6-print_sorted_dictionary').print_sorted_dictionary
a_dictionary = { 'language': "C", 'number': 89, 'track': "Low level" }
new_dict = update_dictionary(a_dictionary, 'language', "Python")
pr... | update_dictionary = __import__('7-update_dictionary').update_dictionary
print_sorted_dictionary = __import__('6-print_sorted_dictionary').print_sorted_dictionary
a_dictionary = {'language': 'C', 'number': 89, 'track': 'Low level'}
new_dict = update_dictionary(a_dictionary, 'language', 'Python')
print_sorted_dictionary(... |
pumpvalues = [119.480003,119.699997,119.830002,119.900002,119.949997,119.980003,119.989998,120.0,120.0,120.0,120.0,120.010002,120.010002,120.010002,120.010002,120.010002,120.010002,120.010002,120.010002,120.0,119.989998,119.949997,119.900002,119.800003,119.629997,119.360001,118.949997,118.389999,117.68,116.889999,116.... | pumpvalues = [119.480003, 119.699997, 119.830002, 119.900002, 119.949997, 119.980003, 119.989998, 120.0, 120.0, 120.0, 120.0, 120.010002, 120.010002, 120.010002, 120.010002, 120.010002, 120.010002, 120.010002, 120.010002, 120.0, 119.989998, 119.949997, 119.900002, 119.800003, 119.629997, 119.360001, 118.949997, 118.389... |
config = {
# Fallback default used when a terminal width cannot be inferred.
"display.fallback_width": 88,
# Human-friendly line width for paragraphs.
"display.text_width": 88,
}
| config = {'display.fallback_width': 88, 'display.text_width': 88} |
rooms = {
1 : { 'name' : '1. room', 'description': 'first room', 'completed': False},
2 : { 'name' : '2. room', 'description': 'second room', 'completed': False},
3 : { 'name' : '3. room', 'description': 'third room', 'completed': False}
} | rooms = {1: {'name': '1. room', 'description': 'first room', 'completed': False}, 2: {'name': '2. room', 'description': 'second room', 'completed': False}, 3: {'name': '3. room', 'description': 'third room', 'completed': False}} |
class Error(Exception):
pass
class ConcreateError(Error):
pass
| class Error(Exception):
pass
class Concreateerror(Error):
pass |
#
# PySNMP MIB module CADANT-HW-MEAS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CADANT-HW-MEAS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:28:20 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_union, single_value_constraint, constraints_intersection, value_range_constraint) ... |
# -*- coding: UTF-8 -*-
# @yasinkuyu
# TODO
class analyze():
def position():
return 1
@staticmethod
def direction(ticker):
# Todo: Analyze, best price position
hight = float(ticker['hight'])
low = float(ticker['low'])
return False
| class Analyze:
def position():
return 1
@staticmethod
def direction(ticker):
hight = float(ticker['hight'])
low = float(ticker['low'])
return False |
li = ["entrance"]
sc = ["food", "others", "descry"]
current = li[len(li) - 1]
size = len(li)
while True:
print(current)
choice = input("enter choice")
if choice == "b" and size == 1:
print("LAsT ScReEN")
elif choice == "b" and size > 1:
print(f"your were in {current}")
last = li... | li = ['entrance']
sc = ['food', 'others', 'descry']
current = li[len(li) - 1]
size = len(li)
while True:
print(current)
choice = input('enter choice')
if choice == 'b' and size == 1:
print('LAsT ScReEN')
elif choice == 'b' and size > 1:
print(f'your were in {current}')
last = li[... |
#Placeholder class for player
class Player(object):
def __init__(self):
self.maxHp = 250
self.hp = self.maxHp
self.maxArk = 1000
self.ark = maxArk | class Player(object):
def __init__(self):
self.maxHp = 250
self.hp = self.maxHp
self.maxArk = 1000
self.ark = maxArk |
track_width = 1.4476123429435463
track_original = [(-7.328797578811646, 0.7067412286996826), (-7.174184083938599, 0.9988523125648499),
(-7.014955043792725, 1.2884796857833862), (-6.852129220962524, 1.5760955214500427),
(-6.69096302986145, 1.8646469712257385), (-6.549050569534302, 2.1... | track_width = 1.4476123429435463
track_original = [(-7.328797578811646, 0.7067412286996826), (-7.174184083938599, 0.9988523125648499), (-7.014955043792725, 1.2884796857833862), (-6.852129220962524, 1.5760955214500427), (-6.69096302986145, 1.8646469712257385), (-6.549050569534302, 2.133627951145172), (-6.420227527618408... |
_base_ = [
'../../../_base_/datasets/two_branch/few_shot_voc.py',
'../../../_base_/schedules/schedule.py', '../../mpsr_r101_fpn.py',
'../../../_base_/default_runtime.py'
]
# classes splits are predefined in FewShotVOCDataset
# FewShotVOCDefaultDataset predefine ann_cfg for model reproducibility.
data = dict... | _base_ = ['../../../_base_/datasets/two_branch/few_shot_voc.py', '../../../_base_/schedules/schedule.py', '../../mpsr_r101_fpn.py', '../../../_base_/default_runtime.py']
data = dict(train=dict(dataset=dict(type='FewShotVOCDefaultDataset', ann_cfg=[dict(method='MPSR', setting='SPLIT1_1SHOT')], num_novel_shots=1, num_bas... |
# -*- coding: utf-8 -*-
DESC = "trtc-2019-07-22"
INFO = {
"DescribeRealtimeQuality": {
"params": [
{
"name": "StartTime",
"desc": "Query start time in the format of local UNIX timestamp, such as 1588031999s, which is a point in time in the last 24 hours."
},
{
"name": "En... | desc = 'trtc-2019-07-22'
info = {'DescribeRealtimeQuality': {'params': [{'name': 'StartTime', 'desc': 'Query start time in the format of local UNIX timestamp, such as 1588031999s, which is a point in time in the last 24 hours.'}, {'name': 'EndTime', 'desc': 'Query end time in the format of local UNIX timestamp, such as... |
class Paras:
COURSE_LABEL_SIZE = None
FINE_2_COURSE = None
IX_a = None
IX_t = None
IX_s = None
IX_a_out = None
IX_p_out = None
@staticmethod
def init():
print("Paras.init started...")
Paras.COURSE_LABEL_SIZE = 6
Paras.FINE_2_COURSE = {}
... | class Paras:
course_label_size = None
fine_2_course = None
ix_a = None
ix_t = None
ix_s = None
ix_a_out = None
ix_p_out = None
@staticmethod
def init():
print('Paras.init started...')
Paras.COURSE_LABEL_SIZE = 6
Paras.FINE_2_COURSE = {}
Paras.FINE_2_C... |
def find_slowest_time(messages):
simulated_communication_times = {message.sender: message.body['simulated_time'] for message in messages}
slowest_client = max(simulated_communication_times, key=simulated_communication_times.get)
simulated_time = simulated_communication_times[
slowest_client] # simu... | def find_slowest_time(messages):
simulated_communication_times = {message.sender: message.body['simulated_time'] for message in messages}
slowest_client = max(simulated_communication_times, key=simulated_communication_times.get)
simulated_time = simulated_communication_times[slowest_client]
return simul... |
'''
Excited States software: qFit 3.0
Contributors: Saulo H. P. de Oliveira, Gydo van Zundert, and Henry van den Bedem.
Contact: vdbedem@stanford.edu
Copyright (C) 2009-2019 Stanford University
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation f... | """
Excited States software: qFit 3.0
Contributors: Saulo H. P. de Oliveira, Gydo van Zundert, and Henry van den Bedem.
Contact: vdbedem@stanford.edu
Copyright (C) 2009-2019 Stanford University
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation f... |
jobs = 1
mid_x = -0.5
mid_y = 0.0
render_width = 2.5
render_height = 2.5
iterations = 256
width = 50
height = 25
output = [0] * (width * height)
def mandelbrot_int(cx, cy):
int_precision = 28
zx = 0
zy = 0
cx = int(cx * (1 << int_precision))
cy = int(cy * (1 << int_precision))
depth... | jobs = 1
mid_x = -0.5
mid_y = 0.0
render_width = 2.5
render_height = 2.5
iterations = 256
width = 50
height = 25
output = [0] * (width * height)
def mandelbrot_int(cx, cy):
int_precision = 28
zx = 0
zy = 0
cx = int(cx * (1 << int_precision))
cy = int(cy * (1 << int_precision))
depth = None
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def get_tensor_shape(t):
return [d for d in t.shape]
def get_tensors_shapes_string(tensors):
res = []
for t in tensors:
res.extend([str(v) for v in get_tensor_shape(t)])
return " ".join(res)
| def get_tensor_shape(t):
return [d for d in t.shape]
def get_tensors_shapes_string(tensors):
res = []
for t in tensors:
res.extend([str(v) for v in get_tensor_shape(t)])
return ' '.join(res) |
__author__ = 'Rahul Gupta'
# Contains relevant constants for running the LDSC pipeline for the Pan Ancestry project.
project_dir = '/Volumes/rahul/Projects/2020_ukb_diverse_pops/Experiments/200501_ldsc_div_pops_pipeline/Data/'
flat_file_location = 'gs://ukb-diverse-pops/sumstats_flat_files/'
bucket = 'rgupta-ldsc'
# ... | __author__ = 'Rahul Gupta'
project_dir = '/Volumes/rahul/Projects/2020_ukb_diverse_pops/Experiments/200501_ldsc_div_pops_pipeline/Data/'
flat_file_location = 'gs://ukb-diverse-pops/sumstats_flat_files/'
bucket = 'rgupta-ldsc'
output_bucket = f'gs://{bucket}/'
anc_to_ldscore = lambda anc: f'gs://rgupta-ldsc/ld/UKBB.{anc... |
print('i am batman', end='\n')
print('hello world', end='\t\t')
print('this is cool\n', end=' ----- ')
print('i am still here')
| print('i am batman', end='\n')
print('hello world', end='\t\t')
print('this is cool\n', end=' ----- ')
print('i am still here') |
# Code generated by font_to_py.py.
# Font: Arial.ttf Char set: 0123456789:
# Cmd: ./font_to_py.py Arial.ttf 50 arial_50.py -x -c 0123456789:
version = '0.33'
def height():
return 50
def baseline():
return 49
def max_width():
return 37
def hmap():
return True
def reverse():
return False
def mon... | version = '0.33'
def height():
return 50
def baseline():
return 49
def max_width():
return 37
def hmap():
return True
def reverse():
return False
def monospaced():
return False
def min_ch():
return 48
def max_ch():
return 63
_font = b'%\x00\x00\x03\xfe\x00\x00\x00\x1f\xff\xc0\x00... |
def get_divisors(number: int) -> list:
# we only accept positive numbers
assert number >= 1, f'{number} Only positive numbers are allowed'
return [i for i in range(0, number + 1) if i % 2 == 0]
def run():
try:
number = int(input('Enter a number to calculate all divisors: '))
print(get... | def get_divisors(number: int) -> list:
assert number >= 1, f'{number} Only positive numbers are allowed'
return [i for i in range(0, number + 1) if i % 2 == 0]
def run():
try:
number = int(input('Enter a number to calculate all divisors: '))
print(get_divisors(number))
print('End of... |
#
# Copyright 2019 The Project Oak Authors
#
# 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 t... | load('@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl', 'action_config', 'feature', 'flag_group', 'flag_set', 'tool', 'tool_path')
load('@bazel_tools//tools/build_defs/cc:action_names.bzl', 'ACTION_NAMES')
all_link_actions = [ACTION_NAMES.cpp_link_executable, ACTION_NAMES.cpp_link_dynamic_library, ACTION_NAMES.cpp_... |
#
# Copyright (C) 2018 The Android Open Source Project
#
# 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 la... | model = model()
i1 = input('op1', 'TENSOR_FLOAT32', '{1, 2, 3, 1}')
i2 = parameter('op2', 'TENSOR_INT32', '{4, 2}', [0, 0, 0, 2, 1, 3, 0, 0])
i3 = output('op3', 'TENSOR_FLOAT32', '{1, 4, 7, 1}')
model = model.Operation('PAD', i1, i2).To(i3)
model = model.RelaxedExecution(True)
input0 = {i1: [1.0, 2.0, 3.0, 4.0, 5.0, 6.... |
__title__ = 'frashfeed-python'
__description__ = 'News feed for Alexa.'
__url__ = 'https://github.com/alexiob/flashfeed-python'
__version__ = '1.0.2'
__author__ = 'Alessandro Iob'
__author_email__ = 'alessandro.iob@gmail.com'
__license__ = 'MIT'
__copyright__ = 'Copyright 2019 Alessandro Iob'
| __title__ = 'frashfeed-python'
__description__ = 'News feed for Alexa.'
__url__ = 'https://github.com/alexiob/flashfeed-python'
__version__ = '1.0.2'
__author__ = 'Alessandro Iob'
__author_email__ = 'alessandro.iob@gmail.com'
__license__ = 'MIT'
__copyright__ = 'Copyright 2019 Alessandro Iob' |
with open("input.txt", "r") as f:
inp = [int(i) for i in f.readlines()]
# Part 1
n = sum([inp[i] > inp[i-1] for i in range(1, len(inp))])
print("Part 1:", n)
# Part 2
n2 = sum([inp[i] + inp[i+1] + inp[i+2] < inp[i+1] + inp[i+2] + inp[i+3] for i in range(len(inp) - 3)])
print("Part 2:",... | with open('input.txt', 'r') as f:
inp = [int(i) for i in f.readlines()]
n = sum([inp[i] > inp[i - 1] for i in range(1, len(inp))])
print('Part 1:', n)
n2 = sum([inp[i] + inp[i + 1] + inp[i + 2] < inp[i + 1] + inp[i + 2] + inp[i + 3] for i in range(len(inp) - 3)])
print('Part 2:', n2) |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
'''
This module contains the base class for our plots that support the
brushing & linking technique.
'''
class BrushableCanvas:
'''
Class to define the basic interface of a drawable area that supports
brushing & linking of its data instances.
'''
def __... | """
This module contains the base class for our plots that support the
brushing & linking technique.
"""
class Brushablecanvas:
"""
Class to define the basic interface of a drawable area that supports
brushing & linking of its data instances.
"""
def __init__(self, canvas_name, parent=None):
... |
syntax = r'^\+haunted(?: (?P<locations>.+))?$'
def haunted(caller, locations='here'):
locations = search(locations, kind=db.Room)
if search(caller, within=locations, kind=db.Character, not_within=[caller.character], flags=['dark', '!deaf']).count():
pemit(caller, "You feel some sort of presence.")... | syntax = '^\\+haunted(?: (?P<locations>.+))?$'
def haunted(caller, locations='here'):
locations = search(locations, kind=db.Room)
if search(caller, within=locations, kind=db.Character, not_within=[caller.character], flags=['dark', '!deaf']).count():
pemit(caller, 'You feel some sort of presence.')
... |
def rule(event):
# filter events; event type 11 is an actor_user changed user password
return event.get("event_type_id") == 11
def title(event):
return (
f"User [{event.get('actor_user_name', '<UNKNOWN_USER>')}] has exceeded the user"
f" account password change threshold"
)
| def rule(event):
return event.get('event_type_id') == 11
def title(event):
return f"User [{event.get('actor_user_name', '<UNKNOWN_USER>')}] has exceeded the user account password change threshold" |
#!/usr/bin/env python
DESCRIPTION = "Conti ransomware api hash with seed 0xE9FF0077"
TYPE = 'unsigned_int'
TEST_1 = 3760887415
def hash(data):
API_buffer = []
i = len(data) >> 3
count = 0
while i != 0:
for index in range(0, 8):
API_buffer.append(data[index + count])
coun... | description = 'Conti ransomware api hash with seed 0xE9FF0077'
type = 'unsigned_int'
test_1 = 3760887415
def hash(data):
api_buffer = []
i = len(data) >> 3
count = 0
while i != 0:
for index in range(0, 8):
API_buffer.append(data[index + count])
count += 8
i -= 1
... |
class Solution:
def strStr(self, haystack: str, needle: str) -> int:
h_len = len(haystack)
n_len = len(needle)
if (n_len == 0):
return 0
if n_len > h_len:
return -1
n_jump = [0] * n_len
i = 2
i_p = i - 1
s_p = 0
cnt = 0... | class Solution:
def str_str(self, haystack: str, needle: str) -> int:
h_len = len(haystack)
n_len = len(needle)
if n_len == 0:
return 0
if n_len > h_len:
return -1
n_jump = [0] * n_len
i = 2
i_p = i - 1
s_p = 0
cnt = 0
... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def rightSideView(self, root):
if not root:
return []
nodes = [root.val]
... | class Solution:
def right_side_view(self, root):
if not root:
return []
nodes = [root.val]
stack = [(root, 0)]
while stack:
(node, level) = stack.pop()
if level >= len(nodes):
nodes.append(node.val)
(left, right) = (nod... |
def plane():
print('Plane')
def car():
print('Car')
def main():
print('-' * 55)
plane()
car()
main()
| def plane():
print('Plane')
def car():
print('Car')
def main():
print('-' * 55)
plane()
car()
main() |
__author__ = 'shenoisz'
def get_object_list( args ):
csv = open( str( args ) , 'r')
lines = [ ]
for divier in csv.readlines( ):
fatias = divier.replace('\n', '').split('|')
lines.append( fatias )
csv.close( )
return lines
def get_object_dict( args ):
csv = open( str( args ) ,... | __author__ = 'shenoisz'
def get_object_list(args):
csv = open(str(args), 'r')
lines = []
for divier in csv.readlines():
fatias = divier.replace('\n', '').split('|')
lines.append(fatias)
csv.close()
return lines
def get_object_dict(args):
csv = open(str(args), 'r')
lines = [... |
'''Some helper functions to support `native-image` invocation within rules.
'''
load("//java:providers/JavaDependencyInfo.bzl", "JavaDependencyInfo")
load("//graalvm:common/extract/toolchain_info.bzl", "extract_graalvm_native_image_toolchain_info")
def _file_to_path(file):
return file.path
# TODO(dwtj): Consider... | """Some helper functions to support `native-image` invocation within rules.
"""
load('//java:providers/JavaDependencyInfo.bzl', 'JavaDependencyInfo')
load('//graalvm:common/extract/toolchain_info.bzl', 'extract_graalvm_native_image_toolchain_info')
def _file_to_path(file):
return file.path
def make_class_path_dep... |
#!/usr/bin/env python
# This tests a particular tricky case: the interplay of "black" wrap mode
# with fill color. Outside the s,t [0,1] range, it should be black, NOT
# fill color.
# Make an RGB grid for our test
command += (oiio_app("oiiotool")
+ OIIO_TESTSUITE_IMAGEDIR + "/grid.tif"
+ " ... | command += oiio_app('oiiotool') + OIIO_TESTSUITE_IMAGEDIR + '/grid.tif' + ' -ch R,G,B -o grid3.tif >> out.txt ;\n'
command += oiio_app('oiiotool') + OIIO_TESTSUITE_IMAGEDIR + '/grid.tif' + ' -ch R -o grid1.tif >> out.txt ;\n'
command += testtex_command('grid3.tif', ' -res 256 256 -automip ' + ' -wrap black -fill 0.5 -d... |
engine_id = ""
grid_node_address = ""
grid_gateway_address = ""
data_dir = ""
dataset_id = ""
| engine_id = ''
grid_node_address = ''
grid_gateway_address = ''
data_dir = ''
dataset_id = '' |
record = "linux"
cats = [
"cats/linux-kernel.cat"
]
cfgs = [
"cfgs/linux-kernel.cfg"
]
illustrative_tests = [
"tests/MP+relacq.litmus"
]
| record = 'linux'
cats = ['cats/linux-kernel.cat']
cfgs = ['cfgs/linux-kernel.cfg']
illustrative_tests = ['tests/MP+relacq.litmus'] |
cities = (
("Andaman and Nicobar Islands", (("Port Blair", "Port Blair"),)),
(
"Andhra Pradesh",
(
("Visakhapatnam", "Visakhapatnam"),
("Vijayawada", "Vijayawada"),
("Guntur", "Guntur"),
("Nellore", "Nellore"),
("Kurnool", "Kurnool"),
... | cities = (('Andaman and Nicobar Islands', (('Port Blair', 'Port Blair'),)), ('Andhra Pradesh', (('Visakhapatnam', 'Visakhapatnam'), ('Vijayawada', 'Vijayawada'), ('Guntur', 'Guntur'), ('Nellore', 'Nellore'), ('Kurnool', 'Kurnool'), ('Rajamahendravaram', 'Rajamahendravaram'), ('Tirupati', 'Tirupati'), ('Kadapa', 'Kadapa... |
#Q: Add all the natural numbers below one thousand that are multiples of 3 or 5.
#A: 233168
sum([i for i in xrange(1,1000) if i%3==0 or i%5==0])
| sum([i for i in xrange(1, 1000) if i % 3 == 0 or i % 5 == 0]) |
# -*- coding: utf-8 -*-
# Define here the models for your spider middleware
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/spider-middleware.html
class DianpingCrawlerSpiderMiddleware(object):
def process_request(self, request, spider):
cookies = spider.settings.get('COOKIES', {})
... | class Dianpingcrawlerspidermiddleware(object):
def process_request(self, request, spider):
cookies = spider.settings.get('COOKIES', {})
request.cookies.update(cookies) |
class PLAN_CMDS(object):
FETCH_PLAN = "fetch_plan"
FETCH_PROTOCOL = "fetch_protocol"
class TENSOR_SERIALIZATION(object):
TORCH = "torch"
NUMPY = "numpy"
TF = "tf"
ALL = "all"
class GATEWAY_ENDPOINTS(object):
SEARCH_TAGS = "/search"
SEARCH_MODEL = "/search-model"
SEARCH_ENCRYPTED_... | class Plan_Cmds(object):
fetch_plan = 'fetch_plan'
fetch_protocol = 'fetch_protocol'
class Tensor_Serialization(object):
torch = 'torch'
numpy = 'numpy'
tf = 'tf'
all = 'all'
class Gateway_Endpoints(object):
search_tags = '/search'
search_model = '/search-model'
search_encrypted_mo... |
FreeMonoBoldOblique12pt7bBitmaps = [
0x1C, 0xF3, 0xCE, 0x38, 0xE7, 0x1C, 0x61, 0x86, 0x00, 0x63, 0x8C, 0x00,
0xE7, 0xE7, 0xE6, 0xC6, 0xC6, 0xC4, 0x84, 0x03, 0x30, 0x19, 0x81, 0xDC,
0x0C, 0xE0, 0x66, 0x1F, 0xFC, 0xFF, 0xE1, 0x98, 0x0C, 0xC0, 0xEE, 0x06,
0x70, 0xFF, 0xCF, 0xFE, 0x1D, 0xC0, 0xCC, 0x06, 0x6... | free_mono_bold_oblique12pt7b_bitmaps = [28, 243, 206, 56, 231, 28, 97, 134, 0, 99, 140, 0, 231, 231, 230, 198, 198, 196, 132, 3, 48, 25, 129, 220, 12, 224, 102, 31, 252, 255, 225, 152, 12, 192, 238, 6, 112, 255, 207, 254, 29, 192, 204, 6, 96, 119, 3, 48, 0, 1, 0, 112, 12, 7, 241, 254, 113, 204, 17, 128, 63, 3, 240, 15,... |
# A list of applications to be added to INSTALLED_APPS.
ADD_INSTALLED_APPS = ['starlingx_dashboard']
FEATURE = ['starlingx_dashboard']
ADD_HEADER_SECTIONS = \
['starlingx_dashboard.dashboards.admin.active_alarms.views.BannerView', ]
ADD_SCSS_FILES = ['dashboard/scss/styles.scss',
'dashboard/scs... | add_installed_apps = ['starlingx_dashboard']
feature = ['starlingx_dashboard']
add_header_sections = ['starlingx_dashboard.dashboards.admin.active_alarms.views.BannerView']
add_scss_files = ['dashboard/scss/styles.scss', 'dashboard/scss/_host_topology.scss']
auto_discover_static_files = True |
#
# Generated by generate.py
#
class VMCompilerInfo:
def getWordList(self):
return ["@","c@","!","c!",">r","r>",";","[literal]","[bzero]","[halt]","[nop]","+","nand","2/","0=","[temp]","[codebase]","[dictionary]","cursor!","screen!","keyboard@","blockread@","[stackreset]","blockwrite!","0","1","2","-1","dup","dr... | class Vmcompilerinfo:
def get_word_list(self):
return ['@', 'c@', '!', 'c!', '>r', 'r>', ';', '[literal]', '[bzero]', '[halt]', '[nop]', '+', 'nand', '2/', '0=', '[temp]', '[codebase]', '[dictionary]', 'cursor!', 'screen!', 'keyboard@', 'blockread@', '[stackreset]', 'blockwrite!', '0', '1', '2', '-1', 'dup... |
# stack class (implemented in doubly-liunked list)
class Node(object):
# initialize node object
def __init__(self, value=0):
self.value = value
self.next = None
self.previous = None
# handle printing
def __str__(self):
return(f"{self.value}")
class Queue(object):
... | class Node(object):
def __init__(self, value=0):
self.value = value
self.next = None
self.previous = None
def __str__(self):
return f'{self.value}'
class Queue(object):
def __init__(self, node=None):
self.head = node
self.tail = node
def enqueue(self,... |
# Given an array of ints, return True if one of the first 4 elements in the
# array is a 9. The array length may be less than 4.
# array_front9([1, 2, 9, 3, 4]) --> True
# array_front9([1, 2, 3, 4, 9]) --> False
# array_front9([1, 2, 3, 4, 5]) --> False
def array_front9(nums):
return 9 in nums[:4]
print(array_fro... | def array_front9(nums):
return 9 in nums[:4]
print(array_front9([1, 2, 9, 3, 4]))
print(array_front9([1, 2, 3, 4, 9]))
print(array_front9([1, 2, 3, 4, 5])) |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | """Run list encoding utilities.
:since: pyglet 1.1
"""
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
class _Run(object):
def __init__(self, value, count):
self.value = value
self.count = count
def __repr__(self):
return 'Run(%r, %d)' % (self.value, self.count)
class Runl... |
def stage(ctx):
return {
"parent": "Tarball",
"triggers": {
"parent": True
},
"parameters": [],
"configs": [],
"jobs": [{
"name": "pytest agent",
"steps": [{
"tool": "shell",
"cmd": "sudo apt update &... | def stage(ctx):
return {'parent': 'Tarball', 'triggers': {'parent': True}, 'parameters': [], 'configs': [], 'jobs': [{'name': 'pytest agent', 'steps': [{'tool': 'shell', 'cmd': 'sudo apt update && sudo apt-get install -y python3-pip || ps axf', 'timeout': 300}, {'tool': 'shell', 'cmd': 'sudo pip3 install pytest'}, ... |
def startUP():
pass
def carmDown():
pass
| def start_up():
pass
def carm_down():
pass |
#global field?
gname='tristan in GGGGGG!!!'
class c(object):
cname='tristan in CCCCCCC!!!!'
def f(self):
fname='tristan in FFFFFF!!!'
print(fname)
print(self.cname)
print(gname)
def f2(self,test):
fname=test
print(fname)
| gname = 'tristan in GGGGGG!!!'
class C(object):
cname = 'tristan in CCCCCCC!!!!'
def f(self):
fname = 'tristan in FFFFFF!!!'
print(fname)
print(self.cname)
print(gname)
def f2(self, test):
fname = test
print(fname) |
# Xs and Os, Nobody Knows
# Create a function that takes a string, checks if it has the same number of "x"s and "o"s and returns either True or False.
# Return a boolean value (True or False).
# The string can contain any character.
# When no x and no o are in the string, return True.
def XO(txt):
return len(list(fi... | def xo(txt):
return len(list(filter(lambda x: x == 'x' or x == 'X', list(txt)))) == len(list(filter(lambda x: x == 'o' or x == 'O', list(txt))))
print(xo('ooxx'))
print(xo('ooxXm'))
print(xo('xooxx')) |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def middleNode(self, head: ListNode) -> ListNode:
slowptr = head
fastptr = head
while(fastptr and fastptr.next):
fastptr = fastptr.next.n... | class Listnode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def middle_node(self, head: ListNode) -> ListNode:
slowptr = head
fastptr = head
while fastptr and fastptr.next:
fastptr = fastptr.next.next
slowptr = slowptr.n... |
# config.py
# AWS IoT endpoint settings
HOST_NAME = "<URL>-ats.iot.us-east-1.amazonaws.com"
HOST_PORT = 8883
# Thing certs & keys
PRIVATE_KEY = "/home/pi/certs9000/private.pem.key"
DEVICE_CERT = "/home/pi/certs9000/certificate.pem.crt"
ROOT_CERT = "/home/pi/certs9000/root-CA.crt"
# Message settings
TOPIC_SENSOR = "$... | host_name = '<URL>-ats.iot.us-east-1.amazonaws.com'
host_port = 8883
private_key = '/home/pi/certs9000/private.pem.key'
device_cert = '/home/pi/certs9000/certificate.pem.crt'
root_cert = '/home/pi/certs9000/root-CA.crt'
topic_sensor = '$aws/things/CarPen9000/sensor'
topic_ask_sensor = '$aws/things/CarPen9000/askSensor'... |
def fiboarray(n):
fibo = [0,1]
for i in range (2,n):
fibo.append(fibo[i-1] + fibo[i-2])
return fibo
def fiboarray_extended(a,b):
max_fibo = fiboarray(max(abs(a),abs(b))+1)
output = []
for i in range (a,b):
if (i < 0):
output.append(-int(pow(-1,i)) * max_fibo[-i... | def fiboarray(n):
fibo = [0, 1]
for i in range(2, n):
fibo.append(fibo[i - 1] + fibo[i - 2])
return fibo
def fiboarray_extended(a, b):
max_fibo = fiboarray(max(abs(a), abs(b)) + 1)
output = []
for i in range(a, b):
if i < 0:
output.append(-int(pow(-1, i)) * max_fibo[... |
expected_output = {
"instance_id": {
4097: {"lisp": 0},
4099: {"lisp": 0},
4100: {"lisp": 0},
8188: {
"lisp": 0,
"site_name": {
"site_uci": {
"any-mac": {
"last_register": "never",
... | expected_output = {'instance_id': {4097: {'lisp': 0}, 4099: {'lisp': 0}, 4100: {'lisp': 0}, 8188: {'lisp': 0, 'site_name': {'site_uci': {'any-mac': {'last_register': 'never', 'up': 'no', 'who_last_registered': '--', 'inst_id': 8188}, '1416.9dff.e928/48': {'last_register': '2w1d', 'up': 'yes#', 'who_last_registered': '1... |
class SOFATrace:
data = []
name = []
title = []
color = []
x_field = []
y_field = []
highlight = None
| class Sofatrace:
data = []
name = []
title = []
color = []
x_field = []
y_field = []
highlight = None |
num = int(input())
def input_lines(number):
lines = set()
for _ in range(number):
lines.add(input())
return lines
def print_data(names):
for name in names:
print(name)
names = input_lines(num)
print_data(names) | num = int(input())
def input_lines(number):
lines = set()
for _ in range(number):
lines.add(input())
return lines
def print_data(names):
for name in names:
print(name)
names = input_lines(num)
print_data(names) |
class BaseColumnsProvider(object):
ROW_ID = 'row_id'
def get_columns_list_with_types(self):
dtypes_list = list()
dtypes_list.append((BaseColumnsProvider.ROW_ID, 'int32'))
return dtypes_list
| class Basecolumnsprovider(object):
row_id = 'row_id'
def get_columns_list_with_types(self):
dtypes_list = list()
dtypes_list.append((BaseColumnsProvider.ROW_ID, 'int32'))
return dtypes_list |
# Copyright (c) Open-MMLab. All rights reserved.
__version__ = '0.18.0'
short_version = __version__
| __version__ = '0.18.0'
short_version = __version__ |
def maxProfit(prices):
profit = 0
for i in range(len(prices)-1):
if prices[i] < prices[i+1]:
profit += (prices[i+1] - prices[i])
return profit
| def max_profit(prices):
profit = 0
for i in range(len(prices) - 1):
if prices[i] < prices[i + 1]:
profit += prices[i + 1] - prices[i]
return profit |
# Using the print function
# Simple usage
print("London")
print(100)
print(20.20)
# print with Variables
first_name = "John"
last_name = "Papa"
print(first_name, last_name, 1, 2, "Hello")
# Using +
print(first_name + last_name)
print(first_name + ", " +last_name)
# Inserting new line character & tab
print("Apples")... | print('London')
print(100)
print(20.2)
first_name = 'John'
last_name = 'Papa'
print(first_name, last_name, 1, 2, 'Hello')
print(first_name + last_name)
print(first_name + ', ' + last_name)
print('Apples')
print('Banana')
print('Mangoes')
print('-----')
print('Apples \nBanana \nMangoes')
print('-----')
print('Apples \tB... |
Text1 = "#"
Text2 = '''
\nadd_core = MSW
owner = MSW
controller = MSW
culture = minesweeper_culture
religion = animism
hre = no
base_tax = 0
base_production = 0
base_manpower = 0
trade_goods = copper\n'''
Text3 = "capital = \""
Text4 = '''"
is_city = yes'''
for i in range (5000, 5100):
stri = str(i)
out = Text1 + s... | text1 = '#'
text2 = '\n\nadd_core = MSW\nowner = MSW\ncontroller = MSW\nculture = minesweeper_culture\nreligion = animism\nhre = no\nbase_tax = 0\nbase_production = 0\nbase_manpower = 0\ntrade_goods = copper\n'
text3 = 'capital = "'
text4 = '"\nis_city = yes'
for i in range(5000, 5100):
stri = str(i)
out = Text... |
# file.py
def create_name():
return "new_file.txt"
def create_time():
return "today"
| def create_name():
return 'new_file.txt'
def create_time():
return 'today' |
#%% File
def write(text):
with open("./myFile.txt", "w") as file:
file.write(text)
def append(text):
with open("./myFile.txt", "a") as file:
file.write(text)
def readDirty():
file = open("./myFile.txt", "r")
content = file.readlines()
file.close()
return content
def read():
... | def write(text):
with open('./myFile.txt', 'w') as file:
file.write(text)
def append(text):
with open('./myFile.txt', 'a') as file:
file.write(text)
def read_dirty():
file = open('./myFile.txt', 'r')
content = file.readlines()
file.close()
return content
def read():
with o... |
def main():
while True:
# input
n = int(input())
if n:
xyrs = [[*map(int, input().split())] for _ in range(n)]
else:
return
# compute
# output
if __name__ == '__main__':
main()
| def main():
while True:
n = int(input())
if n:
xyrs = [[*map(int, input().split())] for _ in range(n)]
else:
return
if __name__ == '__main__':
main() |
'Check if string is of format a.(b+c)*'
print("Enter z to terminate.\n")
string = ""
while string != "z":
string = input("Enter the string to be checked: ")
count = 0
if string[0] == "a":
for i in range(1, len(string)):
if string[i] == "b" or string[i] == "c":
count += 1... | """Check if string is of format a.(b+c)*"""
print('Enter z to terminate.\n')
string = ''
while string != 'z':
string = input('Enter the string to be checked: ')
count = 0
if string[0] == 'a':
for i in range(1, len(string)):
if string[i] == 'b' or string[i] == 'c':
count +... |
def psychologist():
print('Please tell me your problems')
while True:
answer = (yield)
if answer is not None:
if answer.endswith('?'):
print("Don't ask yourself too much questions")
elif 'good' in answer:
print("Ahh that's good, go on")
... | def psychologist():
print('Please tell me your problems')
while True:
answer = (yield)
if answer is not None:
if answer.endswith('?'):
print("Don't ask yourself too much questions")
elif 'good' in answer:
print("Ahh that's good, go on")
... |
include_gcode_from("/home/michael/Documents/Cross1.ngc")
send_gcode_lines()
i = -2
include_gcode_from("/home/michael/Documents/CrossOutline.ngc",False)
comment("BEGINNING CrossOutline")
while i > -11:
move(0,0)
i -= 2
print("i is: {}".format(i))
if i < -11:
i = -11
setv("#1",i)
send_gco... | include_gcode_from('/home/michael/Documents/Cross1.ngc')
send_gcode_lines()
i = -2
include_gcode_from('/home/michael/Documents/CrossOutline.ngc', False)
comment('BEGINNING CrossOutline')
while i > -11:
move(0, 0)
i -= 2
print('i is: {}'.format(i))
if i < -11:
i = -11
setv('#1', i)
send_g... |
test = { 'name': 'q2a',
'points': 2,
'suites': [ { 'cases': [ {'code': '>>> # This test makes sure that fav_emojis has exactly 5 key-value pairs.;\n>>> len(fav_emojis) == 5\nTrue', 'hidden': False, 'locked': False},
{ 'code': '>>> # This test makes sure that fav_emoj... | test = {'name': 'q2a', 'points': 2, 'suites': [{'cases': [{'code': '>>> # This test makes sure that fav_emojis has exactly 5 key-value pairs.;\n>>> len(fav_emojis) == 5\nTrue', 'hidden': False, 'locked': False}, {'code': ">>> # This test makes sure that fav_emojis has the five necessary keys, and nothing else.;\n>>> so... |
class Floor:
def __init__(self, pos, height):
self.pos = pos
self.height = height
self.velocity = np.array([0,0,0])
self.actor = None | class Floor:
def __init__(self, pos, height):
self.pos = pos
self.height = height
self.velocity = np.array([0, 0, 0])
self.actor = None |
'''
acts as a model class for freq_ingest table. all the values are set and
get using the setter and getter.
'''
class Freq_Ingest(object):
'''
acts as a model class for freq_ingest table. all the values are set and
get using the setter and getter.
'''
def __init__(self, team_name=None, ... | """
acts as a model class for freq_ingest table. all the values are set and
get using the setter and getter.
"""
class Freq_Ingest(object):
"""
acts as a model class for freq_ingest table. all the values are set and
get using the setter and getter.
"""
def __init__(self, team_name=None, fr... |
#eleghei an leipei kapoio symvolo >,<,=
def check_if__miss_symbol (filename):
#filename='LP02.LTX'
keeptheprevious_number_in_string=None
counter_of_line=0
i=0
with open(filename, "r") as f:
data = f.readlines()
for line in data:
... | def check_if__miss_symbol(filename):
keeptheprevious_number_in_string = None
counter_of_line = 0
i = 0
with open(filename, 'r') as f:
data = f.readlines()
for line in data:
counter_of_line = counter_of_line + 1
for letter in line:
if letter == '\n'... |
class Player:
def __init__(self, name: str, hp: int, mp: int):
self.name = name
self.hp = hp
self.mp = mp
self.skills = {}
self.guild = 'Unaffiliated'
def add_skill(self, skill_name, mana_cost):
if skill_name in self.skills.keys():
return 'S... | class Player:
def __init__(self, name: str, hp: int, mp: int):
self.name = name
self.hp = hp
self.mp = mp
self.skills = {}
self.guild = 'Unaffiliated'
def add_skill(self, skill_name, mana_cost):
if skill_name in self.skills.keys():
return 'Skill alre... |
class Source:
'''
source class to define how news sources look
'''
def __init__(self,id,name,language,country):
self.id=id
self.name=name
self.language=language
self.country=country
| class Source:
"""
source class to define how news sources look
"""
def __init__(self, id, name, language, country):
self.id = id
self.name = name
self.language = language
self.country = country |
# Added at : 2016.8.3
# Author : 7sDream
# Usage : Target point(contain point and image pixel info).
__all__ = ['Target']
class Target(object):
def __init__(self, y, x, fill, contrast, point):
self._y = y
self._x = x
self._fill = fill
self._contrast = contrast
self._p... | __all__ = ['Target']
class Target(object):
def __init__(self, y, x, fill, contrast, point):
self._y = y
self._x = x
self._fill = fill
self._contrast = contrast
self._point = point
self._hard_zero = False
@property
def fill(self):
return self._fill
... |
_base_ = [
'../../_base_/models/r50.py',
'../../_base_/datasets/imagenet_sz224_4xbs64.py',
'../../_base_/default_runtime.py',
]
# model settings
model = dict(backbone=dict(norm_cfg=dict(type='SyncBN')))
# dataset settings
data = dict(
train=dict(
data_source=dict(
list_file='data/m... | _base_ = ['../../_base_/models/r50.py', '../../_base_/datasets/imagenet_sz224_4xbs64.py', '../../_base_/default_runtime.py']
model = dict(backbone=dict(norm_cfg=dict(type='SyncBN')))
data = dict(train=dict(data_source=dict(list_file='data/meta/ImageNet/train_labeled_1percent.txt')))
optimizer = dict(type='SGD', lr=0.1,... |
def twoCitySchedCost(costs):
result={'A':[],'B':[]}
costs.sort(key = lambda x: x[0]-x[1])
print(costs)
n=len(costs)//2
total = 0
for cost in costs[:n]:
total+=cost[0]
for cost in costs[n:]:
total+=cost[1]
return total
if __name__ =='__main__':
costs = ... | def two_city_sched_cost(costs):
result = {'A': [], 'B': []}
costs.sort(key=lambda x: x[0] - x[1])
print(costs)
n = len(costs) // 2
total = 0
for cost in costs[:n]:
total += cost[0]
for cost in costs[n:]:
total += cost[1]
return total
if __name__ == '__main__':
costs =... |
guests_count = int(input())
budget = int(input())
covert_price = guests_count * 20
if covert_price < budget:
money_left = budget - covert_price
fireworks_money = money_left * 0.4
donation_money = money_left - fireworks_money
print(f"Yes! {fireworks_money:.0f} lv are for fireworks and {donation_money:.0... | guests_count = int(input())
budget = int(input())
covert_price = guests_count * 20
if covert_price < budget:
money_left = budget - covert_price
fireworks_money = money_left * 0.4
donation_money = money_left - fireworks_money
print(f'Yes! {fireworks_money:.0f} lv are for fireworks and {donation_money:.0f... |
# this defines the CPU execution details
EXCEPTION_STACK = [ ]
def e_size():
'''get the size of the stack'''
return len(EXCEPTION_STACK)
def e_empty():
'''test whether the stack is empty'''
return not len(EXCEPTION_STACK)
def e_clear():
'''clear the stack'''
del EXCEPTION_STACK[:]
return... | exception_stack = []
def e_size():
"""get the size of the stack"""
return len(EXCEPTION_STACK)
def e_empty():
"""test whether the stack is empty"""
return not len(EXCEPTION_STACK)
def e_clear():
"""clear the stack"""
del EXCEPTION_STACK[:]
return
def e_push(e):
"""push a new exceptio... |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'alert_overlay',
'dependencies': [
'../../compiled_resources2.gyp:cr',
'../../compiled_resou... | {'targets': [{'target_name': 'alert_overlay', 'dependencies': ['../../compiled_resources2.gyp:cr', '../../compiled_resources2.gyp:util'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'array_data_model', 'dependencies': ['../../compiled_resources2.gyp:cr', '../compile... |
def string_strip(stringvalue: str):
return "".join(stringvalue.split())
def string_mask(stringvalue: str):
for char in stringvalue:
print(ord(char), end=' | ')
| def string_strip(stringvalue: str):
return ''.join(stringvalue.split())
def string_mask(stringvalue: str):
for char in stringvalue:
print(ord(char), end=' | ') |
reuse = False
weight_prefix = "model_"
FLIPXY = tf.constant([
[ 1., 0., 0., 0., 0.],
[ 0.,-1., 0., 0., 0.],
[ 0., 0.,-1., 0., 0.],
[ 0., 0., 0., 1., 0.],
[ 0., 0., 0., 0., 1.]] )
models_to_combine = [5, 8, 9, 11]
num_models = len(models_to_combine)
with tf.variable_scope("ENSA... | reuse = False
weight_prefix = 'model_'
flipxy = tf.constant([[1.0, 0.0, 0.0, 0.0, 0.0], [0.0, -1.0, 0.0, 0.0, 0.0], [0.0, 0.0, -1.0, 0.0, 0.0], [0.0, 0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 0.0, 1.0]])
models_to_combine = [5, 8, 9, 11]
num_models = len(models_to_combine)
with tf.variable_scope('ENSAI', reuse=reuse):
c... |
names = [
'andy',
'sue',
'fred',
'jim',
'carol'
]
assert names[0] == 'andy'
assert names[4] == 'carol'
assert names[-1] == 'carol'
assert names[-2] == 'jim'
assert names[0:2] == ['andy', 'sue']
assert names[1:2] == ['sue']
assert names[3:] == ['jim', 'carol']
assert names[-2:] == ['jim', 'c... | names = ['andy', 'sue', 'fred', 'jim', 'carol']
assert names[0] == 'andy'
assert names[4] == 'carol'
assert names[-1] == 'carol'
assert names[-2] == 'jim'
assert names[0:2] == ['andy', 'sue']
assert names[1:2] == ['sue']
assert names[3:] == ['jim', 'carol']
assert names[-2:] == ['jim', 'carol']
assert names[::-1] == ['... |
# Copyright 2010-2021, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and ... | {'variables': {'relative_dir': 'base', 'gen_out_dir': '<(SHARED_INTERMEDIATE_DIR)/<(relative_dir)'}, 'conditions': [['OS=="win"', {'targets': [{'target_name': 'win_util_test_dll', 'type': 'shared_library', 'sources': ['win_util_test_dll.cc', 'win_util_test_dll.def'], 'dependencies': ['base.gyp:base']}]}]], 'targets': [... |
__all__ = [
"dictutils",
"forwarder",
"main",
"rulecollection",
"ruleengine",
"ruleitem",
"ruleset",
"template",
"templateprocessor",
"transform",
"utils"
] | __all__ = ['dictutils', 'forwarder', 'main', 'rulecollection', 'ruleengine', 'ruleitem', 'ruleset', 'template', 'templateprocessor', 'transform', 'utils'] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.