content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
__title__ = "pyls-isort"
__version__ = "0.1.1"
__summary__ = "Isort plugin for python-language-server"
__uri__ = "https://github.com/paradoxxxzero/pyls-isort"
__author__ = "Florian Mounier"
__email__ = "paradoxxx.zero@gmail.com"
__license__ = "MIT"
__copyright__ = "Copyright 2017 %s" % __author__
| __title__ = 'pyls-isort'
__version__ = '0.1.1'
__summary__ = 'Isort plugin for python-language-server'
__uri__ = 'https://github.com/paradoxxxzero/pyls-isort'
__author__ = 'Florian Mounier'
__email__ = 'paradoxxx.zero@gmail.com'
__license__ = 'MIT'
__copyright__ = 'Copyright 2017 %s' % __author__ |
class Solutions(object):
def singleNumber(self, nums):
res = 0
for i in range(32):
bit_i_sum = 0
for num in nums:
bit_i_sum += (num >> i) & 1
res += (bit_i_sum % 3) << i
return res
if __name__ == '__main__':
print(Solutions().single... | class Solutions(object):
def single_number(self, nums):
res = 0
for i in range(32):
bit_i_sum = 0
for num in nums:
bit_i_sum += num >> i & 1
res += bit_i_sum % 3 << i
return res
if __name__ == '__main__':
print(solutions().singleNumber... |
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'voicex_dev', # Or path to database file if using sqlite3.
'USER': 'postgres', # Not used with sqlite3... | databases = {'default': {'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'voicex_dev', 'USER': 'postgres', 'PASSWORD': 'postgres', 'HOST': 'localhost', 'PORT': ''}}
logging = {'version': 1, 'disable_existing_loggers': True, 'formatters': {'standard': {'format': '[%(asctime)s] %(levelname)s [%(name)s:%(linen... |
#Why is the error and how to fix it?
#A: A TypeError menas you are using the wrong type to make an operation. Change print(a+b) to return a+b
def foo(a, b):
print(a + b)
x = foo(2, 3) * 10
| def foo(a, b):
print(a + b)
x = foo(2, 3) * 10 |
n=int(input('enter a program : '))
for i in range(n):
for j in range(n-1,i,-1):
print(' ',end=' ')
for k in range(0,i):
print(chr(65+k),end=' ')
print() | n = int(input('enter a program : '))
for i in range(n):
for j in range(n - 1, i, -1):
print(' ', end=' ')
for k in range(0, i):
print(chr(65 + k), end=' ')
print() |
notes = [4,5,3,3,1]
students=["Harry", "Ron","Hemrine", "Ginny", "Draco"]
for i in range(len(students)):
print(f'{students[i]} hat im Fach Zaubertranke die Note {notes[i]} erhalten.') | notes = [4, 5, 3, 3, 1]
students = ['Harry', 'Ron', 'Hemrine', 'Ginny', 'Draco']
for i in range(len(students)):
print(f'{students[i]} hat im Fach Zaubertranke die Note {notes[i]} erhalten.') |
class Thesis():
""" Used to define all the characteristics of a thesis.
Args:
thesis_id (int): thesis identifier
title (str): thesis title
authors (list): list of the authors who writed the thesis
advisors (list): list of advisors who helped this theses
url (str): url to... | class Thesis:
""" Used to define all the characteristics of a thesis.
Args:
thesis_id (int): thesis identifier
title (str): thesis title
authors (list): list of the authors who writed the thesis
advisors (list): list of advisors who helped this theses
url (str): url to t... |
#
# Automatically generated
#
class RTOpcodes(object):
pass
RTOpcodes.JSR = 0x00
RTOpcodes.IMMSHORT = 0x00
RTOpcodes.IMMLONG = 0x10
RTOpcodes.VARSHORT = 0x20
RTOpcodes.VARLONG = 0x30
RTOpcodes.ABS = 0x40
RTOpcodes.LDR = 0x80
RTOpcodes.AND = 0x81
RTOpcodes.ORR = 0x82
RTOpcodes.XOR = 0x83
RTOpcodes.ADD = 0x84
RTOpcod... | class Rtopcodes(object):
pass
RTOpcodes.JSR = 0
RTOpcodes.IMMSHORT = 0
RTOpcodes.IMMLONG = 16
RTOpcodes.VARSHORT = 32
RTOpcodes.VARLONG = 48
RTOpcodes.ABS = 64
RTOpcodes.LDR = 128
RTOpcodes.AND = 129
RTOpcodes.ORR = 130
RTOpcodes.XOR = 131
RTOpcodes.ADD = 132
RTOpcodes.SUB = 133
RTOpcodes.MLT = 134
RTOpcodes.DIV = ... |
"""django-sendgrid"""
VERSION = (1, 0, 1)
__version__ = ".".join(map(str, VERSION[0:3])) + "".join(VERSION[3:])
__author__ = "Ryan Balfanz"
__contact__ = "ryan@ryanbalfanz.net"
__homepage__ = "http://ryanbalfanz.github.com/django-sendgrid/"
__docformat__ = "restructuredtext"
# __license__ = "BSD (3 clause)"
| """django-sendgrid"""
version = (1, 0, 1)
__version__ = '.'.join(map(str, VERSION[0:3])) + ''.join(VERSION[3:])
__author__ = 'Ryan Balfanz'
__contact__ = 'ryan@ryanbalfanz.net'
__homepage__ = 'http://ryanbalfanz.github.com/django-sendgrid/'
__docformat__ = 'restructuredtext' |
"""
PASSENGERS
"""
numPassengers = 19150
passenger_arriving = (
(4, 5, 4, 9, 0, 2, 3, 0, 2, 1, 0, 1, 0, 4, 2, 4, 3, 4, 1, 2, 0, 0, 1, 1, 1, 0), # 0
(7, 6, 6, 3, 2, 3, 0, 1, 2, 1, 0, 1, 0, 2, 4, 2, 5, 5, 3, 2, 0, 3, 2, 1, 2, 0), # 1
(9, 5, 5, 2, 3, 1, 1, 2, 4, 3, 0, 0, 0, 6, 10, 2, 4, 5, 5, 2, 2, 2, 2, 1, 0, 0),... | """
PASSENGERS
"""
num_passengers = 19150
passenger_arriving = ((4, 5, 4, 9, 0, 2, 3, 0, 2, 1, 0, 1, 0, 4, 2, 4, 3, 4, 1, 2, 0, 0, 1, 1, 1, 0), (7, 6, 6, 3, 2, 3, 0, 1, 2, 1, 0, 1, 0, 2, 4, 2, 5, 5, 3, 2, 0, 3, 2, 1, 2, 0), (9, 5, 5, 2, 3, 1, 1, 2, 4, 3, 0, 0, 0, 6, 10, 2, 4, 5, 5, 2, 2, 2, 2, 1, 0, 0), (5, 2, 4, 2, 3,... |
# model settings
_base_ = './hv_pointpillars_secfpn_6x8_160e_kitti-3d-3class.py'
voxel_size = [0.16, 0.16, 4]
point_cloud_range = [0, -39.68, -3, 69.12, 39.68, 1]
model = dict(
voxel_encoder=dict(
type='PillarFeatureNet',
in_channels=4,
feat_channels=[64],
with_distance=False,
... | _base_ = './hv_pointpillars_secfpn_6x8_160e_kitti-3d-3class.py'
voxel_size = [0.16, 0.16, 4]
point_cloud_range = [0, -39.68, -3, 69.12, 39.68, 1]
model = dict(voxel_encoder=dict(type='PillarFeatureNet', in_channels=4, feat_channels=[64], with_distance=False, voxel_size=voxel_size, point_cloud_range=[0, -39.68, -3, 69.1... |
"""
This module contains third-party libraries that usually have different licensing than
Binary Refinery itself.
"""
| """
This module contains third-party libraries that usually have different licensing than
Binary Refinery itself.
""" |
def for_Q():
""" Pattern of Captital Alphabet: 'Q' using for loop"""
for i in range(7):
for j in range(6):
if i%4==0 and j in(1,2,3) or j%4==0 and i in(1,2,3) or i==j and i>1:
print('*',end=' ')
else:
... | def for_q():
""" Pattern of Captital Alphabet: 'Q' using for loop"""
for i in range(7):
for j in range(6):
if i % 4 == 0 and j in (1, 2, 3) or (j % 4 == 0 and i in (1, 2, 3)) or (i == j and i > 1):
print('*', end=' ')
else:
print(' ', end=' ')
... |
numstr=''
sumnum=0
strng=input('Enter a string:')
for a in strng:
if a.isdigit():
numstr+=a
sumnum+=int(a)
if sumnum==0:
print(strng,'has no digits.')
else:
print(strng,'has digits',numstr,'that sum to',sumnum)
| numstr = ''
sumnum = 0
strng = input('Enter a string:')
for a in strng:
if a.isdigit():
numstr += a
sumnum += int(a)
if sumnum == 0:
print(strng, 'has no digits.')
else:
print(strng, 'has digits', numstr, 'that sum to', sumnum) |
# -*- coding: utf-8 -*-
"""autoproto
A package for making the process of reading a binary packet much easier.
"""
__author__ = 'andreas@blixt.org (Andreas Blixt)'
__license__ = 'MIT'
__version__ = '0.1a'
| """autoproto
A package for making the process of reading a binary packet much easier.
"""
__author__ = 'andreas@blixt.org (Andreas Blixt)'
__license__ = 'MIT'
__version__ = '0.1a' |
#!/usr/bin/env python2
#!coding=utf-8
basic_command = [
('help', 'Show this help'),
('login', 'Login using Baidu account'),
('download', 'Download file from the Baidu pan link'),
('show', 'Show the Baidu pan real link and filename'),
('export', 'export link to aria2 json... | basic_command = [('help', 'Show this help'), ('login', 'Login using Baidu account'), ('download', 'Download file from the Baidu pan link'), ('show', 'Show the Baidu pan real link and filename'), ('export', 'export link to aria2 json-rpc'), ('config', 'save configuration to file')]
extended_usage = ''
def join_commands... |
#! /usr/bin/python2.7
"""Base 41 Data encoding"""
def base41_decode(input):
"""Decode a Base41 string.
input is the string to decode.
The decoded data is returned. A TypeError is raised if input
is not valid (odd number of chars, non-alphabet character present,
invalid word).
"""
rslt =... | """Base 41 Data encoding"""
def base41_decode(input):
"""Decode a Base41 string.
input is the string to decode.
The decoded data is returned. A TypeError is raised if input
is not valid (odd number of chars, non-alphabet character present,
invalid word).
"""
rslt = bytearray()
i = 0
... |
class Solution:
def findTheDifference(self, s: str, t: str) -> str:
result = 0
for char in s:
result ^= ord(char)
for char in t:
result ^= ord(char)
return chr(result) | class Solution:
def find_the_difference(self, s: str, t: str) -> str:
result = 0
for char in s:
result ^= ord(char)
for char in t:
result ^= ord(char)
return chr(result) |
#Given the year number. You need to check if this year is a leap year. If it is, print LEAP, otherwise print COMMON.
year = int(input("year=?"))
if year % 4 == 0 and year % 100 != 0:
print("It is a leap year!")
elif year % 400 == 0:
print("it is a leap year!")
else:
print("It is not a leap year")
| year = int(input('year=?'))
if year % 4 == 0 and year % 100 != 0:
print('It is a leap year!')
elif year % 400 == 0:
print('it is a leap year!')
else:
print('It is not a leap year') |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 7 09:39:00 2020
@author: Andrea Gerardo Russo, Biomedical Engineer
PhD candidate in Neuroscience
University of Salerno, Fisciano, Italy
"""
| """
Created on Fri Aug 7 09:39:00 2020
@author: Andrea Gerardo Russo, Biomedical Engineer
PhD candidate in Neuroscience
University of Salerno, Fisciano, Italy
""" |
def two_fer_va(name=None):
if name is None:
name = 'you'
return f'One for {name}, one for me.'
def two_fer_vb(name=None):
return f'One for {"you" if name is None else name}, one for me.'
def two_fer_vc(name=None):
return f'One for {name or "you"}, one for me.'
def two_fer_vd(name='you'):
... | def two_fer_va(name=None):
if name is None:
name = 'you'
return f'One for {name}, one for me.'
def two_fer_vb(name=None):
return f"One for {('you' if name is None else name)}, one for me."
def two_fer_vc(name=None):
return f"One for {name or 'you'}, one for me."
def two_fer_vd(name='you'):
... |
# Find the Ascii value of user input string.
# define ASCII_value() function with user-input string as argument.
def ASCII_value(charInput):
print("\nASCII value :", end = ' ')
#Getting each character of the user input string
for i in range(len(charInput)):
#Finding the ASCII value of ea... | def ascii_value(charInput):
print('\nASCII value :', end=' ')
for i in range(len(charInput)):
print(str(ord(charInput[i])), end=' ')
if __name__ == '__main__':
user_input = input('\nENTER ANY CHARACTER : ')
ascii_value(userInput) |
"""
Support for local Luftdaten sensors.
Copyright (c) 2019 Mario Villavecchia
Licensed under MIT. All rights reserved.
https://github.com/lichtteil/local_luftdaten/
"""
| """
Support for local Luftdaten sensors.
Copyright (c) 2019 Mario Villavecchia
Licensed under MIT. All rights reserved.
https://github.com/lichtteil/local_luftdaten/
""" |
n,k=map(int,input().split())
for i in range(1,10):
rem=(n*i)%10
if(rem==0 or rem==k):
print(i)
break
| (n, k) = map(int, input().split())
for i in range(1, 10):
rem = n * i % 10
if rem == 0 or rem == k:
print(i)
break |
student = {
"name": "Mark",
"student_id": 15163,
"feedback": None
}
student["last_name"] = "Kowalski"
try:
last_name = student["last_name"]
numbered_last_name = 3 + last_name
except KeyError:
print
except TypeError as error:
print("I can't add these two together!")
print(error)
print(... | student = {'name': 'Mark', 'student_id': 15163, 'feedback': None}
student['last_name'] = 'Kowalski'
try:
last_name = student['last_name']
numbered_last_name = 3 + last_name
except KeyError:
print
except TypeError as error:
print("I can't add these two together!")
print(error)
print('This code execut... |
# use your username and password
USERNAME = ''
PASSWORD = ''
# URL = 'http://192.168.168.6/sess/Start.aspx'
URL = 'http://pershiess.fasau.ac.ir/sess/Start.aspx'
# # Changing user agent to trick websites (for headless use)
# # with phantomjs (for headless use)
# DCAP = dict("")
# DCAP["phantomjs.page.settings.userAge... | username = ''
password = ''
url = 'http://pershiess.fasau.ac.ir/sess/Start.aspx' |
def generate_permutations(L,i=None,n=None):
if i==None:
i=0
if n==None:
n=len(L)-1
if i==n:
print(L)
else:
for j in range(i,n+1):
L[i],L[j]=L[j],L[i]
generate_permutations(L,i=i+1,n=n)
L[i],L[j]=L[j],L[i]
L=["a","b","c","d","e"]
generate_permutations(L)
| def generate_permutations(L, i=None, n=None):
if i == None:
i = 0
if n == None:
n = len(L) - 1
if i == n:
print(L)
else:
for j in range(i, n + 1):
(L[i], L[j]) = (L[j], L[i])
generate_permutations(L, i=i + 1, n=n)
(L[i], L[j]) = (L[j], ... |
def int_to_bit(n, nbits, lsb0=True):
'''
convert the integer into a bit string of the number of bits specified.
e.g. if n is in bit is "0111",
if nbits is 5 and lsb0 is True, then it's gonna be "00111".
if lsb0 is False, then its' gonna be "11100".
if nbits is less than n in bit, omit the bits.... | def int_to_bit(n, nbits, lsb0=True):
"""
convert the integer into a bit string of the number of bits specified.
e.g. if n is in bit is "0111",
if nbits is 5 and lsb0 is True, then it's gonna be "00111".
if lsb0 is False, then its' gonna be "11100".
if nbits is less than n in bit, omit the bits.... |
#py_binary_operations.py
base_10_number = 12
fmt = "{:<20} {:<30}"
print("Base 2 operations: left shift increases by powers of 2")
for i in range(3):
print(fmt.format("mybin_1000: ", bin(base_10_number << i)))
print()
print("Base 2 operations: right shift reduces by powers of 2")
for i in range(3):
print(... | base_10_number = 12
fmt = '{:<20} {:<30}'
print('Base 2 operations: left shift increases by powers of 2')
for i in range(3):
print(fmt.format('mybin_1000: ', bin(base_10_number << i)))
print()
print('Base 2 operations: right shift reduces by powers of 2')
for i in range(3):
print(fmt.format('mybin_1000: ', bin(... |
{
"targets": [
# the only purpose of this target is to share settings between celt
# and silk targets.
{
"target_name": "opus_common_settings",
"type": "none",
"direct_dependent_settings" : {
"include_dirs": [
"... | {'targets': [{'target_name': 'opus_common_settings', 'type': 'none', 'direct_dependent_settings': {'include_dirs': ['1.1/opus-1.1/include'], 'defines': ['USE_ALLOCA=', 'OPUS_BUILD']}}, {'target_name': 'celt', 'type': 'static_library', 'include_dirs': ['1.1/opus-1.1/celt'], 'sources': ['1.1/opus-1.1/celt/*.c'], 'sources... |
def max_point(strA, left, right):
if right < left:
return -1
mid = (left + right) // 2
if strA[mid] > strA[mid -1] and strA[mid] > strA[mid + 1]:
return strA[mid]
elif strA[mid] > strA[mid -1] and strA[mid] < strA[mid + 1]:
return max_point(strA, mid, right)
elif strA[mid] < strA[mid -1] and strA[mid] >... | def max_point(strA, left, right):
if right < left:
return -1
mid = (left + right) // 2
if strA[mid] > strA[mid - 1] and strA[mid] > strA[mid + 1]:
return strA[mid]
elif strA[mid] > strA[mid - 1] and strA[mid] < strA[mid + 1]:
return max_point(strA, mid, right)
elif strA[mid] ... |
palette = {
"none": "",
"text": "rgb(40, 40, 40)",
"comment": "rgb(130, 130, 130)",
"string": "rgb(30, 100, 0)",
"function": "rgb(50, 50, 200)",
"value": "rgb(200, 0, 0)",
"type": "rgb(0, 110, 120)",
"reserved": "rgb(80, 0, 0)",
"operator": "rgb(100, 100, 0)",
"call": "rgb(0, 50,... | palette = {'none': '', 'text': 'rgb(40, 40, 40)', 'comment': 'rgb(130, 130, 130)', 'string': 'rgb(30, 100, 0)', 'function': 'rgb(50, 50, 200)', 'value': 'rgb(200, 0, 0)', 'type': 'rgb(0, 110, 120)', 'reserved': 'rgb(80, 0, 0)', 'operator': 'rgb(100, 100, 0)', 'call': 'rgb(0, 50, 200)', 'bracket': 'rgb(100, 100, 200)', ... |
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
},
}
INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.messages',
'django.contrib.sites',
'djangocms_camerasli... | databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}}
installed_apps = ['django.contrib.contenttypes', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.messages', 'django.contrib.sites', 'djangocms_cameraslider', 'cms', 'easy_thumbnails', 'filer', 'menus', 'sekizai', 'treeb... |
class Agent(object):
def train(self, batch):
raise NotImplementedError
def act(self, observation):
raise NotImplementedError
| class Agent(object):
def train(self, batch):
raise NotImplementedError
def act(self, observation):
raise NotImplementedError |
# WARNING: Do not edit by hand, this file was generated by Crank:
#
# https://github.com/gocardless/crank
#
class BankDetailsLookup(object):
"""A thin wrapper around a bank_details_lookup, providing easy access to its
attributes.
Example:
bank_details_lookup = client.bank_details_lookups.get()
... | class Bankdetailslookup(object):
"""A thin wrapper around a bank_details_lookup, providing easy access to its
attributes.
Example:
bank_details_lookup = client.bank_details_lookups.get()
bank_details_lookup.id
"""
def __init__(self, attributes, api_response):
self.attributes = ... |
# this is a list of skills which are not one-lines
ACTIVE_SKILLS = [
"book_skill",
"christmas_new_year_skill",
"dff_coronavirus_skill",
"dummy_skill_dialog",
"emotion_skill",
"game_cooperative_skill",
"meta_script_skill",
"dff_movie_skill",
"news_api_skill",
"oscar_skill",
"p... | active_skills = ['book_skill', 'christmas_new_year_skill', 'dff_coronavirus_skill', 'dummy_skill_dialog', 'emotion_skill', 'game_cooperative_skill', 'meta_script_skill', 'dff_movie_skill', 'news_api_skill', 'oscar_skill', 'personal_info_skill', 'reddit_ner_skill', 'short_story_skill', 'superbowl_skill', 'valentines_dat... |
in_min=136818
in_max=685979
def includes_duplicates(num):
str_num = str(num)
for n in range(len(str_num) - 1):
if str_num[n] == str_num[n + 1]:
return True
return False
def monotonic_increase(num):
str_num = str(num)
for n in range(len(str_num) - 1):
if str_num[n + 1] < str_num[n]:
return False
return... | in_min = 136818
in_max = 685979
def includes_duplicates(num):
str_num = str(num)
for n in range(len(str_num) - 1):
if str_num[n] == str_num[n + 1]:
return True
return False
def monotonic_increase(num):
str_num = str(num)
for n in range(len(str_num) - 1):
if str_num[n + ... |
class Solution:
def findMaximumXOR(self, nums: List[int]) -> int:
mx = 0
for i in reversed(range(31)):
prefixes = set(num >> i for num in nums)
mx <<= 1
cand = mx + 1
for prefix in prefixes:
if (cand ^ prefix) in prefixes:
... | class Solution:
def find_maximum_xor(self, nums: List[int]) -> int:
mx = 0
for i in reversed(range(31)):
prefixes = set((num >> i for num in nums))
mx <<= 1
cand = mx + 1
for prefix in prefixes:
if cand ^ prefix in prefixes:
... |
class TreeNode:
def __init__(self, **kwargs):
self.children = dict()
def get(self, key):
return self.children.get(key, None)
def get_children(self, sort=False):
if sort:
return sorted(self.children.values())
return self.children.values()
def add(self, key, ... | class Treenode:
def __init__(self, **kwargs):
self.children = dict()
def get(self, key):
return self.children.get(key, None)
def get_children(self, sort=False):
if sort:
return sorted(self.children.values())
return self.children.values()
def add(self, key,... |
#add your reddit credentials here
username = "" #username
password = "" #password
client_id = "" #client id
client_secret = "" #client password
subreddits = "memes+dankmemes+me_irl" #subreddits you want to get memes from, it is important not to include spaces b/w '+'
min_upvotes = 150 #minimum number of upvotes
debug =... | username = ''
password = ''
client_id = ''
client_secret = ''
subreddits = 'memes+dankmemes+me_irl'
min_upvotes = 150
debug = True |
# 7. Perfect Number
# Write a function that receives an integer number and returns if this number is perfect or NOT.
# A perfect number is a positive integer that is equal to the sum of its proper positive divisors.
# That is the sum of its positive divisors excluding the number itself (also known as its aliquot sum).
... | def check_if_number_perfect(num):
proper_divisors = []
for digit in range(1, num):
if num % digit == 0:
proper_divisors.append(digit)
if sum(proper_divisors) == num:
return True
return False
number = int(input())
result = check_if_number_perfect(number)
if result:
print('... |
def conv_output_length(input_length, filter_size,
padding, stride, dilation=1):
if input_length is None:
return None
assert padding == "same"
output_length = input_length
return (output_length + stride - 1) // stride
def same_padding_length(input_length, filter_size, stri... | def conv_output_length(input_length, filter_size, padding, stride, dilation=1):
if input_length is None:
return None
assert padding == 'same'
output_length = input_length
return (output_length + stride - 1) // stride
def same_padding_length(input_length, filter_size, stride, dilation=1):
di... |
# This is sample in Python language for
# MCS - Most Common (Even/Uneven) Sum
# for given list, size and mode(even/uneven)
# created by https://github.com/trolit
# Press Shift+F10 to execute it.
def get_biggest_sum_depending_on_mode(list_numbers, var_size, var_mode):
# Use a breakpoint in the code line below to d... | def get_biggest_sum_depending_on_mode(list_numbers, var_size, var_mode):
list_numbers_length = len(list_numbers)
if var_size > list_numbers_length or var_size < 2 or (var_mode != 'even' and var_mode != 'uneven'):
print('Requirements not met.')
print()
return
list_numbers.sort(reverse... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
def print_color(code: int, message: str) -> None:
print(f"\033[{code}m{message}\033[00m")
def print_green(message: str) -> None:
pr... | def print_color(code: int, message: str) -> None:
print(f'\x1b[{code}m{message}\x1b[00m')
def print_green(message: str) -> None:
print_color(92, message)
def print_yellow(message: str) -> None:
print_color(93, message)
def print_cyan(message: str) -> None:
print_color(96, message)
def print_red(mess... |
# scoping.level.1.py
def my_function():
test = 1 # this is defined in the local scope of the function
print('my_function:', test)
test = 0 # this is defined in the global scope
my_function()
print('global:', test)
| def my_function():
test = 1
print('my_function:', test)
test = 0
my_function()
print('global:', test) |
_base_ = [
'../_base_/models/lcgn_config.py',
'../_base_/datasets/gqa_dataset.py',
'../_base_/schedules/schedule_vqa.py',
'../_base_/default_runtime.py'
] # yapf:disable
| _base_ = ['../_base_/models/lcgn_config.py', '../_base_/datasets/gqa_dataset.py', '../_base_/schedules/schedule_vqa.py', '../_base_/default_runtime.py'] |
#
class BaseConfig(object):
DEBUG = True
class TestConfig(BaseConfig):
DEBUG = False
TESTING = True
| class Baseconfig(object):
debug = True
class Testconfig(BaseConfig):
debug = False
testing = True |
class ArpeggioError(Exception):
"""
Base class for arpeggio errors.
"""
def __init__(self, message: str) -> None:
self.message = message
def __str__(self) -> str:
return repr(self.message)
class GrammarError(ArpeggioError):
"""
Error raised during parser building phase use... | class Arpeggioerror(Exception):
"""
Base class for arpeggio errors.
"""
def __init__(self, message: str) -> None:
self.message = message
def __str__(self) -> str:
return repr(self.message)
class Grammarerror(ArpeggioError):
"""
Error raised during parser building phase use... |
class Makieta:
def __init__(self, dane):
self.dane = dane
| class Makieta:
def __init__(self, dane):
self.dane = dane |
class Walking_HabitsBaseException(Exception):
pass
class InvalidLayoutError(Walking_HabitsBaseException):
pass
| class Walking_Habitsbaseexception(Exception):
pass
class Invalidlayouterror(Walking_HabitsBaseException):
pass |
"""
monobit.constants
(c) 2019--2021 Rob Hagemans
licence: https://opensource.org/licenses/MIT
"""
DEFAULT_FORMAT = 'yaff'
VERSION = '0.20'
CONVERTER_NAME = f'monobit v{VERSION}'
| """
monobit.constants
(c) 2019--2021 Rob Hagemans
licence: https://opensource.org/licenses/MIT
"""
default_format = 'yaff'
version = '0.20'
converter_name = f'monobit v{VERSION}' |
"""
Closes all the sub windows that are currently open in the Weasel GUI.
"""
def main(weasel):
weasel.close_subwindows()
| """
Closes all the sub windows that are currently open in the Weasel GUI.
"""
def main(weasel):
weasel.close_subwindows() |
"""
.. module:: check_is_version_string
:synopsis: Given a string, checks if it looks like a version string.
.. moduleauthor:: Scott W. Fleming <fleming@stsci.edu>
"""
#--------------------
def check_is_version_string(istring):
"""
Checks if the string looks like a version.
:param istring: The strin... | """
.. module:: check_is_version_string
:synopsis: Given a string, checks if it looks like a version string.
.. moduleauthor:: Scott W. Fleming <fleming@stsci.edu>
"""
def check_is_version_string(istring):
"""
Checks if the string looks like a version.
:param istring: The string to check.
:type ... |
text = """
Formula 1 is to abandon plans to race in the Americas this year, with new races at Imola, the Nurburgring and Algarve
now set to join the calendar. The sport's owner Liberty Media has been weighing up how best to fill out its schedule,
with the coronavirus pandemic still moving at different speeds around t... | text = "\nFormula 1 is to abandon plans to race in the Americas this year, with new races at Imola, the Nurburgring and Algarve \nnow set to join the calendar. The sport's owner Liberty Media has been weighing up how best to fill out its schedule, \nwith the coronavirus pandemic still moving at different speeds around ... |
# encoding: utf-8
MOCK_QUERY_RESULT = "QUERY_RESULT"
def mock_connection(execution_function=lambda x, y: None,
fetch_function=lambda x: None):
cursor = type('cursor', (object, ), {
'execute': execution_function,
'fetchall': fetch_function
})
def cursor_call(*args, **... | mock_query_result = 'QUERY_RESULT'
def mock_connection(execution_function=lambda x, y: None, fetch_function=lambda x: None):
cursor = type('cursor', (object,), {'execute': execution_function, 'fetchall': fetch_function})
def cursor_call(*args, **kwargs):
return cursor()
connection = type('connecti... |
b = bytes(range(20))
il = int.from_bytes(b, "little")
ib = int.from_bytes(b, "big")
print(il)
print(ib)
print(il.to_bytes(20, "little"))
| b = bytes(range(20))
il = int.from_bytes(b, 'little')
ib = int.from_bytes(b, 'big')
print(il)
print(ib)
print(il.to_bytes(20, 'little')) |
# coding: utf-8
class PVWattsError(Exception):
"""
Base class for PVWatts errors
"""
def __init__(self, message):
Exception.__init__(self, message)
class PVWattsValidationError(PVWattsError):
"""
Validation error on request
"""
def __init__(self, message):
PVWattsError.... | class Pvwattserror(Exception):
"""
Base class for PVWatts errors
"""
def __init__(self, message):
Exception.__init__(self, message)
class Pvwattsvalidationerror(PVWattsError):
"""
Validation error on request
"""
def __init__(self, message):
PVWattsError.__init__(self, ... |
# constants.py
# Copyright (c) 2013-2019 Pablo Acosta-Serafini
# See LICENSE for details
# pylint: disable=C0111,C0302,W0105
###
# Global variables
###
AXIS_TICKS_FONT_SIZE = 14
"""
Axis tick labels font size in points
:type: integer
"""
AXIS_LABEL_FONT_SIZE = 18
"""
Axis labels font size in points
:type: integer... | axis_ticks_font_size = 14
'\nAxis tick labels font size in points\n\n:type: integer\n'
axis_label_font_size = 18
'\nAxis labels font size in points\n\n:type: integer\n'
legend_scale = 1.5
'\nScale factor for panel legend. The legend font size in points is equal to the\naxis font size divided by the legend scale\n\n:typ... |
#
# PySNMP MIB module CISCO-ENTITY-PROVISIONING-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ENTITY-PROVISIONING-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:39:48 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ve... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection) ... |
le = [1,12,2,3,1,1,2,3,1,3,4,3,1,5,0,3,2,1,9,19,1,19,5,23,1,13,23,27,1,27,6,31,2,31,6,35,2,6,35,39,1,39,5,43,1,13,43,47,1,6,47,51,2,13,51,55,1,10,55,59,1,59,5,63,1,10,63,67,1,67,5,71,1,71,10,75,1,9,75,79,2,13,79,83,1,9,83,87,2,87,13,91,1,10,91,95,1,95,9,99,1,13,99,103,2,103,13,107,1,107,10,111,2,10,111,115,1,115,9,119,... | le = [1, 12, 2, 3, 1, 1, 2, 3, 1, 3, 4, 3, 1, 5, 0, 3, 2, 1, 9, 19, 1, 19, 5, 23, 1, 13, 23, 27, 1, 27, 6, 31, 2, 31, 6, 35, 2, 6, 35, 39, 1, 39, 5, 43, 1, 13, 43, 47, 1, 6, 47, 51, 2, 13, 51, 55, 1, 10, 55, 59, 1, 59, 5, 63, 1, 10, 63, 67, 1, 67, 5, 71, 1, 71, 10, 75, 1, 9, 75, 79, 2, 13, 79, 83, 1, 9, 83, 87, 2, 87, ... |
def tri_recursion(k):
if(k > 0):
result = k + tri_recursion(k - 1)
print(result,k)
else:
result = 0
return result
print("\n\nRecursion Example Results")
tri_recursion(6) | def tri_recursion(k):
if k > 0:
result = k + tri_recursion(k - 1)
print(result, k)
else:
result = 0
return result
print('\n\nRecursion Example Results')
tri_recursion(6) |
extracted_data = {"contractor": "",
"contractee": "",
"duration": None,
"intervalPayment": None,
"interval": None,
"amount": None,
"numberOfPerformanceObligations": 0,
"poi": []
... | extracted_data = {'contractor': '', 'contractee': '', 'duration': None, 'intervalPayment': None, 'interval': None, 'amount': None, 'numberOfPerformanceObligations': 0, 'poi': []} |
# Copyright (c) 2009 - 2015 Tropo, now part of Cisco
# Released under the MIT license. See the file LICENSE
# for the complete license
# --------------------------------------
# Sample Tropo app
# --------------------------------------
answer()
event=ask("where are you heading?",
{'repeat':3,'choices':"1st Floor ... | answer()
event = ask('where are you heading?', {'repeat': 3, 'choices': '1st Floor (first, house wares, 1), 2nd Floor (second, bed and bath, 2), 3rd Floor (third, sporting goods, 3)', 'timeout': 10.03456789, 'onChoice': lambda event: event.onChoice('1st Floor', lambda : say('Your destination is 1st Floor')) and event.o... |
try:
t=int(input())
for i in range(t):
n=int(input())
a=list(map(int,input().split()))
set1=list(set(a))
print(len(set1))
except:
pass | try:
t = int(input())
for i in range(t):
n = int(input())
a = list(map(int, input().split()))
set1 = list(set(a))
print(len(set1))
except:
pass |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, Chris Hoffman <choffman@chathamfinancial.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version ... | documentation = '\n---\nmodule: win_service\nversion_added: "1.7"\nshort_description: Manages Windows services\ndescription:\n - Manages Windows services\noptions:\n name:\n description:\n - Name of the service\n required: true\n default: null\n aliases: []\n start_mode:\n description:\n -... |
# File generated by contrib/scrape-ec2-sizes.py script - DO NOT EDIT manually
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to... | region_details = {'af-south-1': {'api_name': 'ec2_af_south', 'country': 'South Africa', 'endpoint': 'ec2.af-south-1.amazonaws.com', 'id': 'af-south-1', 'instance_types': [], 'signature_version': '4'}, 'ap-east-1': {'api_name': 'ec2_ap_east', 'country': 'Hong Kong', 'endpoint': 'ec2.ap-east-1.amazonaws.com', 'id': 'ap-e... |
#!/usr/bin/env python
# encoding: utf-8
name = "R_Addition_MultipleBond/groups"
shortDesc = u""
longDesc = u"""
The reaction site *3 should be a triplet, otherwise it will react via the 1+2_Cycloaddition family instead.
"""
template(reactants=["R_R", "YJ"], products=["RJ_R_Y"], ownReverse=False)
reverse = "Beta_Scis... | name = 'R_Addition_MultipleBond/groups'
short_desc = u''
long_desc = u'\nThe reaction site *3 should be a triplet, otherwise it will react via the 1+2_Cycloaddition family instead.\n'
template(reactants=['R_R', 'YJ'], products=['RJ_R_Y'], ownReverse=False)
reverse = 'Beta_Scission'
recipe(actions=[['CHANGE_BOND', '*1',... |
# SPDX-License-Identifier: GPL-3.0-only
def make_parser_struct(cpp_struct_value, all_enums, all_bitfields, all_used_structs, all_used_groups, hpp, struct_name, read_only, struct_title):
hpp.write(" private:\n".format(struct_name))
hpp.write(" std::vector<ParserStructValue> get_values_internal() overr... | def make_parser_struct(cpp_struct_value, all_enums, all_bitfields, all_used_structs, all_used_groups, hpp, struct_name, read_only, struct_title):
hpp.write(' private:\n'.format(struct_name))
hpp.write(' std::vector<ParserStructValue> get_values_internal() override;\n'.format(struct_name))
hpp.writ... |
# Copyright 2021 Zilliz. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | imagenet_default_mean = [0.485, 0.456, 0.406]
imagenet_default_std = [0.229, 0.224, 0.225]
def _cfg(url='', **kwargs):
return {'url': url, 'num_classes': 1000, 'input_size': (3, 224, 224), 'pool_size': None, 'crop_pct': 0.9, 'interpolation': 'bicubic', 'fixed_input_size': True, 'mean': IMAGENET_DEFAULT_MEAN, 'std'... |
lychrels = 0
for i in range(0, 10001):
s = str(i)
n = i
indicator = 0
for j in range(0, 50):
n = n + int(s[::-1])
s = str(n)
l = len(s)
if l % 2 == 0:
p1 = s[0:int(l/2)]
p2 = s[int(l/2):][::-1]
else:
p1 = s[0:int(l/2)+1]
... | lychrels = 0
for i in range(0, 10001):
s = str(i)
n = i
indicator = 0
for j in range(0, 50):
n = n + int(s[::-1])
s = str(n)
l = len(s)
if l % 2 == 0:
p1 = s[0:int(l / 2)]
p2 = s[int(l / 2):][::-1]
else:
p1 = s[0:int(l / 2) + 1]... |
# lowercased special tokens
UNK = '<unk>'
PAD = '<pad>'
START = '<bos>'
STOP = '<eos>'
# special tokens id (don't edit this order)
UNK_ID = 0
PAD_ID = 1
# this should be set later after building fields
TAGS_PAD_ID = 0
# output_dir
OUTPUT_DIR = 'runs'
# default filenames
CONFIG = 'config.json'
DATASET = 'dataset.tor... | unk = '<unk>'
pad = '<pad>'
start = '<bos>'
stop = '<eos>'
unk_id = 0
pad_id = 1
tags_pad_id = 0
output_dir = 'runs'
config = 'config.json'
dataset = 'dataset.torch'
model = 'model.torch'
optimizer = 'optim.torch'
scheduler = 'scheduler.torch'
trainer = 'trainer.torch'
vocab = 'vocab.torch'
predictions = 'predictions.t... |
def test_mysql_process(host):
assert host.service("my_db-mysql").is_running
assert host.service("my_db-mysql").is_enabled
def test_check_mysql_access(host):
assert host.run("mysql --protocol=tcp -h 127.0.0.1 -u u1 -P 13306 -ppassword1 db1").succeeded
assert host.run("mysql --protocol=tcp -h 127.0.0.1 -... | def test_mysql_process(host):
assert host.service('my_db-mysql').is_running
assert host.service('my_db-mysql').is_enabled
def test_check_mysql_access(host):
assert host.run('mysql --protocol=tcp -h 127.0.0.1 -u u1 -P 13306 -ppassword1 db1').succeeded
assert host.run('mysql --protocol=tcp -h 127.0.0.1 -... |
# This file contains all the constants in use by the tetration modules
# defining tetration constants
TETRATION_API_INVENTORY_TAG = '/inventory/tags'
TETRATION_API_ROLE = '/roles'
TETRATION_API_USER = '/users'
TETRATION_API_SENSORS = '/sensors'
TETRATION_API_INVENTORY_FILTER = '/filters/inventories'
TETRATION_API_SCOP... | tetration_api_inventory_tag = '/inventory/tags'
tetration_api_role = '/roles'
tetration_api_user = '/users'
tetration_api_sensors = '/sensors'
tetration_api_inventory_filter = '/filters/inventories'
tetration_api_scopes = '/app_scopes'
tetration_api_applications = '/applications'
tetration_api_application_policies = '/... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-Today OpenERP S.A. (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the term... | {'name': 'Social Network', 'version': '1.0', 'category': 'Social Network', 'sequence': 2, 'summary': 'Discussions, Mailing Lists, News', 'description': '\nBusiness oriented Social Networking\n===================================\nThe Social Networking module provides a unified social network abstraction layer allowing a... |
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def levelOrder(self, root):
"""
:type root: TreeNode
:rtype: List[List[int]]
"""
if not root:
... | class Treenode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def level_order(self, root):
"""
:type root: TreeNode
:rtype: List[List[int]]
"""
if not root:
return []
a = [root... |
def main():
print("I am a webscraper")
if __name__ == "__main__":
return main()
class Website(object):
#create a function that gets URL (def URL)
#create a function that turns HTML elements into an array of strings based on white space or '<> (def elements)
#create a function that uses REGEX to find links tha... | def main():
print('I am a webscraper')
if __name__ == '__main__':
return main()
class Website(object):
pass
class Page(Website):
pass
class Email(Page):
pass
class Name(Page):
pass
class Contact(Page):
pass |
# from https://linked.data.gov.au/dataset/bdr/conservation-status-taxa-wa
# in the sop_recipe_abis_model datagraphs
CONSERVATION_STATUS_TAXA = [
"https://test-idafd.biodiversity.org.au/name/afd/70162908",
"https://test-idafd.biodiversity.org.au/name/afd/70162916",
"https://test-idafd.biodiversity.org.au/nam... | conservation_status_taxa = ['https://test-idafd.biodiversity.org.au/name/afd/70162908', 'https://test-idafd.biodiversity.org.au/name/afd/70162916', 'https://test-idafd.biodiversity.org.au/name/afd/70164586', 'https://test-idafd.biodiversity.org.au/name/afd/70165201', 'https://test-idafd.biodiversity.org.au/name/afd/701... |
# -*- coding: utf-8 -*-
# Gruid Translator by Bruno Benkel
# To the extent possible under law, the person who associated CC0 with Gruid Translator has waived
# all copyright and related or neighboring rights to Gruid Translator.
"""
A list of constants used by the entire program. Mainly contains strings hardcoded as a... | """
A list of constants used by the entire program. Mainly contains strings hardcoded as are defined in
GEMC, with some additional stuff to help standardize the program.
"""
ihelp = 'path of the gemc file to be processed.'
thelp = 'length of each time step for the generated time series in ns.'
xhelp = "length of each r... |
#!/usr/bin/env python3
# simplified and faster method to calculate the Fibonacci dequence
a = 0
b = 1
count = 0
max_count = 10
while count < max_count:
count = count + 1
print(a, b, end=' ') # Notice the magic end=' '
a = a + b
b = a + b
print() # gets a new (empty) line
| a = 0
b = 1
count = 0
max_count = 10
while count < max_count:
count = count + 1
print(a, b, end=' ')
a = a + b
b = a + b
print() |
# 1. Invert Values
# Write a program that receives a single string containing numbers separated by a single space.
# Print a list containing the opposite of each number.
string = input()
list = string.split(" ")
list_numbers = numbers = [int(x) for x in list]
myneglist = [-x for x in list_numbers]
print(myneglist) | string = input()
list = string.split(' ')
list_numbers = numbers = [int(x) for x in list]
myneglist = [-x for x in list_numbers]
print(myneglist) |
"""
Config variables using in auth package
"""
LOGIN_METHODS = [
'email_login',
'guest_login',
'facebook_login',
'google_login',
'naver_login',
'kakao_login',
]
| """
Config variables using in auth package
"""
login_methods = ['email_login', 'guest_login', 'facebook_login', 'google_login', 'naver_login', 'kakao_login'] |
email_template = \
'''
Dear {salutation} {name},
Thank you for your letter. We are sorry that our {product} {verbed} in your
{room}. Please note that it should never be used in a {room}, especially
near any {animals}.
Send us your receipt and {amount} for shipping and handling. We will send
you another {product} tha... | email_template = '\nDear {salutation} {name},\n\nThank you for your letter. We are sorry that our {product} {verbed} in your\n{room}. Please note that it should never be used in a {room}, especially \nnear any {animals}.\n\nSend us your receipt and {amount} for shipping and handling. We will send\nyou another {product}... |
"""
Number Crunching
=============================================================================
Basic operations with numbers.
Example Run
-----------------------------------------------------------------------------
$ python3 numbers.py
2
1
9
...
References
-------------------------------------------------------... | """
Number Crunching
=============================================================================
Basic operations with numbers.
Example Run
-----------------------------------------------------------------------------
$ python3 numbers.py
2
1
9
...
References
-------------------------------------------------------... |
class Solution:
def minMeetingRooms(self, intervals: List[List[int]]) -> int:
if not intervals:
return 0
intervals.sort(key = lambda x : x[0])
occupiedRooms = []
heappush(occupiedRooms, intervals[0][1])
for interval in intervals[1:]:
if occupiedRooms[0... | class Solution:
def min_meeting_rooms(self, intervals: List[List[int]]) -> int:
if not intervals:
return 0
intervals.sort(key=lambda x: x[0])
occupied_rooms = []
heappush(occupiedRooms, intervals[0][1])
for interval in intervals[1:]:
if occupiedRooms[... |
EVAN = 'Evan'
CHALIE = 'Chalie'
JOHN = 'John'
BARRY = 'Barry'
SERVICE = 'Service'
JAKE = 'Jake'
COREY = 'Corey'
CHRIS = 'Chris'
SUB = 'Sub'
NOTAPP = 'NA'
ANGIESLIST = 'AL'
CONTRACTOR = 'CO'
GOOGLE = 'GO'
OLDCUST = 'OC'
OTHER = 'OT'
RECCO = 'RC'
REALTOR = 'RE'
WEBSITE = 'WS'
YELP = 'YL'
SOURCE_CHOICES = (
(NOTAPP,... | evan = 'Evan'
chalie = 'Chalie'
john = 'John'
barry = 'Barry'
service = 'Service'
jake = 'Jake'
corey = 'Corey'
chris = 'Chris'
sub = 'Sub'
notapp = 'NA'
angieslist = 'AL'
contractor = 'CO'
google = 'GO'
oldcust = 'OC'
other = 'OT'
recco = 'RC'
realtor = 'RE'
website = 'WS'
yelp = 'YL'
source_choices = ((NOTAPP, 'Not A... |
def fancy_divider(divider_length):
divider = ''
for i in range(divider_length):
if i % 2 == 0:
divider += '='
else:
divider += '-'
print(divider)
| def fancy_divider(divider_length):
divider = ''
for i in range(divider_length):
if i % 2 == 0:
divider += '='
else:
divider += '-'
print(divider) |
#
# PyUSB definitions
#
# Copyright (C) 2007 Pablo Bleyer Kocik
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any la... | ok = 0
invalid_handle = 1
device_not_found = 2
device_not_opened = 3
io_error = 4
insufficient_resources = 5
invalid_parameter = 6
invalid_baud_rate = 7
device_not_opened_for_erase = 8
device_not_opened_for_write = 9
failed_to_write_device = 10
eeprom_read_failed = 11
eeprom_write_failed = 12
eeprom_erase_failed = 13
e... |
load("@rules_maven_third_party//:import_external.bzl", import_external = "import_external")
def dependencies():
import_external(
name = "org_scala_lang_scala_compiler",
artifact = "org.scala-lang:scala-compiler:2.12.13",
artifact_sha256 = "ea971e004e2f15d3b7569eee8b559f220e23b9993e688bbe986... | load('@rules_maven_third_party//:import_external.bzl', import_external='import_external')
def dependencies():
import_external(name='org_scala_lang_scala_compiler', artifact='org.scala-lang:scala-compiler:2.12.13', artifact_sha256='ea971e004e2f15d3b7569eee8b559f220e23b9993e688bbe986f97938d1dc9f9', srcjar_sha256='22... |
PLUGIN_METADATA = {
'id': 'dimteleport',
'version': '1.0.0',
'name': 'dimTeleport',
'description': 'A plugin to teleport cross dimension easily',
'author': 'BlissfulAlloy79',
'dependencies': {
'mcdreforged': '>=1.0.0',
}
}
CMDS = [
'overworld',
'nether',
'end',
'ow',... | plugin_metadata = {'id': 'dimteleport', 'version': '1.0.0', 'name': 'dimTeleport', 'description': 'A plugin to teleport cross dimension easily', 'author': 'BlissfulAlloy79', 'dependencies': {'mcdreforged': '>=1.0.0'}}
cmds = ['overworld', 'nether', 'end', 'ow', 'n', 'e']
def on_info(server, info):
args = info.cont... |
# Eyetracker type
# EYETRACKER_TYPE = "IS4_Large_Peripheral" # 4C eyetracker
#EYETRACKER_TYPE = "Tobii T120" # Old eyetracker
EYETRACKER_TYPE = "simulation" # test
# EYETRACKER_TYPE = "Tobii Pro X3-120 EPU" # Tobii X3
SCREEN_SIZE_X = 1920
SCREEN_SIZE_Y = 1080
#Pilot condition
PILOT_CONDITION_TEXT_INTERVENTION = True... | eyetracker_type = 'simulation'
screen_size_x = 1920
screen_size_y = 1080
pilot_condition_text_intervention = True
pilot_condition_no_removal = True
pilot_mmd_subset = [5]
if PILOT_CONDITION_TEXT_INTERVENTION:
user_model_state_path = './database/user_model_state_ref_highlight.db'
else:
user_model_state_path = '.... |
# -*- coding:utf-8 -*-
# Copyright 2015 NEC Corporation. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
# you may not use this file except in compliance with the License... | class Conversiontable(object):
def __init__(self):
self.__connection_type_map = {}
self.__network_conversion_table = {}
self.__node_conversion_table = {}
self.__port_conversion_table = {}
self.__link_conversion_table = {}
self.__flow_conversion_table = {}
def ge... |
def handler(event, context):
return {
"statusCode": 200,
"headers": {
"Refresh": "0; url=mailto:hello@marvinengelmann.email",
}
} | def handler(event, context):
return {'statusCode': 200, 'headers': {'Refresh': '0; url=mailto:hello@marvinengelmann.email'}} |
class BaseModel:
def __init__(self, config):
self.config = config
self.model = None
def save(self, checkpoint_path):
if self.model is None:
raise Exception("You have to build the model first.")
print("Saving model...")
self.model.save_weights(checkpoint_path... | class Basemodel:
def __init__(self, config):
self.config = config
self.model = None
def save(self, checkpoint_path):
if self.model is None:
raise exception('You have to build the model first.')
print('Saving model...')
self.model.save_weights(checkpoint_path... |
command = input().split("#")
water = int(input())
command = ", ".join(command)
fire = command.split(" = ")
fire = ", ".join(fire)
fire_list = fire.split(", ")
cells = []
effort = 0
total_fire = 0
for index, item in enumerate(fire_list):
if item == "High":
fire = int(fire_list[index + 1])
if 81 <=... | command = input().split('#')
water = int(input())
command = ', '.join(command)
fire = command.split(' = ')
fire = ', '.join(fire)
fire_list = fire.split(', ')
cells = []
effort = 0
total_fire = 0
for (index, item) in enumerate(fire_list):
if item == 'High':
fire = int(fire_list[index + 1])
if 81 <= ... |
# Copyright (C) 2019 DLR
#
# All rights reserved. This program and the accompanying materials are made
# available under the terms of the 3-Clause BSD License which accompanies this
# distribution, and is available at
# https://opensource.org/licenses/BSD-3-Clause
#
# Contributors:
# Christoph Suerig <christoph.suerig@... | class Pddlfactsrepresentation:
def __init__(self, facts_string, obj_type_map, domain_name, problem_name):
"""
This is the representation of the pddl facts file (not completed yet.)
:param facts_string: The facts file content as string.
:param obj_type_map: A map, containing all obj... |
# Range Sum of BST
'''
Given the root node of a binary search tree, return the sum of values of all nodes with a value in the range [low, high].
Example 1:
Input: root = [10,5,15,3,7,null,18], low = 7, high = 15
Output: 32
Example 2:
Input: root = [10,5,15,3,7,13,18,1,null,6], low = 6, high = 10
Output: 23
... | """
Given the root node of a binary search tree, return the sum of values of all nodes with a value in the range [low, high].
Example 1:
Input: root = [10,5,15,3,7,null,18], low = 7, high = 15
Output: 32
Example 2:
Input: root = [10,5,15,3,7,13,18,1,null,6], low = 6, high = 10
Output: 23
Constraints:
The nu... |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def __str__(self):
if not self.next:
return str(self.val)
return f'{self.val}->{self.next}'
# TODO: This one took a while... come back and take another look
cl... | class Listnode:
def __init__(self, x):
self.val = x
self.next = None
def __str__(self):
if not self.next:
return str(self.val)
return f'{self.val}->{self.next}'
class Solution:
def merge_two_lists(self, l1: ListNode, l2: ListNode) -> ListNode:
if not l... |
def func(self):
self.info(self.rid, "get store")
users = []
for row in self.datastore.all():
email = row.data.get('email', None)
if not email:
continue
if not row.data['email'] in users:
users.append(email)
return users | def func(self):
self.info(self.rid, 'get store')
users = []
for row in self.datastore.all():
email = row.data.get('email', None)
if not email:
continue
if not row.data['email'] in users:
users.append(email)
return users |
#!/usr/bin/env python
# encoding: utf-8
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def addTwoNumbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
r = 0
hd... | class Listnode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def add_two_numbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
r = 0
hd = list_node(0)
p = No... |
def main() -> None:
s = input()
print("0" + s[:3])
if __name__ == "__main__":
main()
| def main() -> None:
s = input()
print('0' + s[:3])
if __name__ == '__main__':
main() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.