content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# -*- coding: utf-8 -*-
"""
"""
#Function that checks whether a string can be converted into a float
def isfloat(value):
try:
float(value)
return True
except ValueError:
return False
#Function that checks whether a string can be converted into an integer
def isint(value):
try:
int... | """
"""
def isfloat(value):
try:
float(value)
return True
except ValueError:
return False
def isint(value):
try:
int(value)
return True
except ValueError:
return False |
winClass = window.get_active_class()
if winClass not in ("code.Code", "emacs.Emacs"):
# Regular window
keyboard.send_keys('<home>')
else:
# VS Code
keyboard.send_keys('<alt>+a') | win_class = window.get_active_class()
if winClass not in ('code.Code', 'emacs.Emacs'):
keyboard.send_keys('<home>')
else:
keyboard.send_keys('<alt>+a') |
""" Module to manage affiliate marketing links
Purpose: allow managing affiliate marketing links in one place
Author: Tom W. Hartung
Date: Winter, 2019
Copyright: (c) 2019 Tom W. Hartung, Groja.com, and JooMoo Websites LLC.
Reference:
"""
class AffiliateLinks:
"""
Use python dictionaries to make it easier ... | """ Module to manage affiliate marketing links
Purpose: allow managing affiliate marketing links in one place
Author: Tom W. Hartung
Date: Winter, 2019
Copyright: (c) 2019 Tom W. Hartung, Groja.com, and JooMoo Websites LLC.
Reference:
"""
class Affiliatelinks:
"""
Use python dictionaries to make it easier to... |
# GYP project file for TDesktop
{
'targets': [
{
'target_name': 'libtgvoip',
'type': 'static_library',
'dependencies': [],
'defines': [
'WEBRTC_APM_DEBUG_DUMP=0',
'TGVOIP_USE_DESKTOP_DSP',
'WEBRTC_NS_FLOAT',
],
'variables': {
... | {'targets': [{'target_name': 'libtgvoip', 'type': 'static_library', 'dependencies': [], 'defines': ['WEBRTC_APM_DEBUG_DUMP=0', 'TGVOIP_USE_DESKTOP_DSP', 'WEBRTC_NS_FLOAT'], 'variables': {'tgvoip_src_loc': '.', 'official_build_target%': '', 'linux_path_opus_include%': '<(DEPTH)/../../../Libraries/opus/include'}, 'includ... |
#!/usr/bin/env python
GLOBAL_ARGUMENTS = [
'property-id',
'start-date',
'end-date',
'ndays',
'domain',
'prefix',
]
def format_comma(d):
"""
Format a comma separated number.
"""
return '{:,d}'.format(int(d))
def format_duration(secs):
"""
Format a duration in seconds a... | global_arguments = ['property-id', 'start-date', 'end-date', 'ndays', 'domain', 'prefix']
def format_comma(d):
"""
Format a comma separated number.
"""
return '{:,d}'.format(int(d))
def format_duration(secs):
"""
Format a duration in seconds as minutes and seconds.
"""
secs = int(secs)... |
# Time: O(n * l^2)
# Space: O(n * l)
# Given a list of words, please write a program that returns
# all concatenated words in the given list of words.
#
# A concatenated word is defined as a string that is comprised entirely of
# at least two shorter words in the given array.
#
# Example:
# Input: ["cat","cats","cats... | class Solution(object):
def find_all_concatenated_words_in_a_dict(self, words):
"""
:type words: List[str]
:rtype: List[str]
"""
lookup = set(words)
result = []
for word in words:
dp = [False] * (len(word) + 1)
dp[0] = True
... |
def get_chunks(l, n, max_chunks=None):
"""
Returns a chunked version of list l with a maximum of n items in each chunk
:param iterable[T] l: list of items of type T
:param int n: max size of each chunk
:param int max_chunks: maximum number of chunks that can be returned. Pass none (the default) fo... | def get_chunks(l, n, max_chunks=None):
"""
Returns a chunked version of list l with a maximum of n items in each chunk
:param iterable[T] l: list of items of type T
:param int n: max size of each chunk
:param int max_chunks: maximum number of chunks that can be returned. Pass none (the default) for... |
print("####################################################")
print("#FILENAME:\t\ta1p3.py\t\t\t #")
print("#ASSIGNMENT:\t\tHomework Assignment 1 Pt. 3#")
print("#COURSE/SECTION:\tCIS 3389.251\t\t #")
print("#DUE DATE:\t\tWednesday, 12.February 2020#")
print("####################################################\n\... | print('####################################################')
print('#FILENAME:\t\ta1p3.py\t\t\t #')
print('#ASSIGNMENT:\t\tHomework Assignment 1 Pt. 3#')
print('#COURSE/SECTION:\tCIS 3389.251\t\t #')
print('#DUE DATE:\t\tWednesday, 12.February 2020#')
print('####################################################\n\n... |
description = ''
pages = ['header',
'checkout']
def setup(data):
pass
def test(data):
navigate('http://store.demoqa.com/')
click(header.go_to_checkout)
verify_text_in_element(checkout.title, 'Checkout')
capture('Checkout page is displayed')
def teardown(data):
pass
| description = ''
pages = ['header', 'checkout']
def setup(data):
pass
def test(data):
navigate('http://store.demoqa.com/')
click(header.go_to_checkout)
verify_text_in_element(checkout.title, 'Checkout')
capture('Checkout page is displayed')
def teardown(data):
pass |
# ENUM definitions
# Symbol type
SYMBOL_TYPE_SPOT = 'SPOT'
# Order status
ORDER_STATUS_NEW = 'NEW'
ORDER_STATUS_PARTIALLY_FILLED = 'PARTIALLY_FILLED'
ORDER_STATUS_FILLED = 'FILLED'
ORDER_STATUS_CANCELED = 'CANCELED'
ORDER_STATUS_PENDING_CANCEL = 'PENDING_CANCEL'
ORDER_STATUS_REJECTED = 'REJECTED'
ORDER_STATUS_EXPIRED ... | symbol_type_spot = 'SPOT'
order_status_new = 'NEW'
order_status_partially_filled = 'PARTIALLY_FILLED'
order_status_filled = 'FILLED'
order_status_canceled = 'CANCELED'
order_status_pending_cancel = 'PENDING_CANCEL'
order_status_rejected = 'REJECTED'
order_status_expired = 'EXPIRED'
order_type_limit = 'LIMIT'
order_type... |
# cases where DictAchievement should unlock
# >> CASE
{'name': 'John Doe', 'age': 24}
# >> CASE
{
'name': 'John Doe',
'age': 24
}
# >> CASE
func({'name': 'John Doe', 'age': 24})
| {'name': 'John Doe', 'age': 24}
{'name': 'John Doe', 'age': 24}
func({'name': 'John Doe', 'age': 24}) |
#!/usr/bin/env python3
# default arguments, assume a default value if one is not provided
def display_info(name, age='42'):
print('Name: ', name, 'Age', age)
display_info(age='56', name='Marc Wilson')
display_info(name='Marc Wilson')
| def display_info(name, age='42'):
print('Name: ', name, 'Age', age)
display_info(age='56', name='Marc Wilson')
display_info(name='Marc Wilson') |
#!/usr/bin/env python
'''
Copyright (C) 2019, WAFW00F Developers.
See the LICENSE file for copying permission.
'''
NAME = 'Malcare (Inactiv)'
def is_waf(self):
schemes = [
self.matchContent(r'firewall.{0,15}?powered.by.{0,15}?malcare.{0,15}?pro'),
self.matchContent('blocked because of malicious a... | """
Copyright (C) 2019, WAFW00F Developers.
See the LICENSE file for copying permission.
"""
name = 'Malcare (Inactiv)'
def is_waf(self):
schemes = [self.matchContent('firewall.{0,15}?powered.by.{0,15}?malcare.{0,15}?pro'), self.matchContent('blocked because of malicious activities')]
if any((i for i in scheme... |
n,k=map(int,input().split())
if k<n//2 or (n==1 and k!=0):
print(-1)
else:
if n==1:
print(1)
else:
x=r=k-(n-2)//2
while r<=x+n:
r+=x
ans=[r,x]
for i in range(2,n):
ans.append(ans[1]+i-1)
print(*ans) | (n, k) = map(int, input().split())
if k < n // 2 or (n == 1 and k != 0):
print(-1)
elif n == 1:
print(1)
else:
x = r = k - (n - 2) // 2
while r <= x + n:
r += x
ans = [r, x]
for i in range(2, n):
ans.append(ans[1] + i - 1)
print(*ans) |
class news_source:
'''
News Source Class to define News Source Objects
'''
def __init__(self, id, name, homepage_url, description):
self.id = id
self.name = name
self.homepage_url = homepage_url
self.description = description
# self.logo = logo
class Articles:
... | class News_Source:
"""
News Source Class to define News Source Objects
"""
def __init__(self, id, name, homepage_url, description):
self.id = id
self.name = name
self.homepage_url = homepage_url
self.description = description
class Articles:
"""
Articles class t... |
# Time: O(n)
# Space: O(1)
class Solution(object):
def numberOfLines(self, widths, S):
"""
:type widths: List[int]
:type S: str
:rtype: List[int]
"""
result = [1, 0]
for c in S:
w = widths[ord(c)-ord('a')]
result[1] += w
i... | class Solution(object):
def number_of_lines(self, widths, S):
"""
:type widths: List[int]
:type S: str
:rtype: List[int]
"""
result = [1, 0]
for c in S:
w = widths[ord(c) - ord('a')]
result[1] += w
if result[1] > 100:
... |
class MarkerPosition:
def __init__(self, markers_points, rotation_vector, translation_vector):
self.markers_points = markers_points
self.rotation_vector = rotation_vector
self.translation_vector = translation_vector
def set_markers_points(self, markers_points):
self.markers_poi... | class Markerposition:
def __init__(self, markers_points, rotation_vector, translation_vector):
self.markers_points = markers_points
self.rotation_vector = rotation_vector
self.translation_vector = translation_vector
def set_markers_points(self, markers_points):
self.markers_poi... |
def _ghc_paths_module_impl(ctx):
tools = ctx.toolchains["@rules_haskell//haskell:toolchain"].tools
ghc = tools.ghc
ctx.actions.run_shell(
inputs = [ghc],
outputs = [ctx.outputs.out],
command = """
cat > {out} << EOM
module GHC.Paths (
ghc, ghc_pkg, libdir, docdir
) wh... | def _ghc_paths_module_impl(ctx):
tools = ctx.toolchains['@rules_haskell//haskell:toolchain'].tools
ghc = tools.ghc
ctx.actions.run_shell(inputs=[ghc], outputs=[ctx.outputs.out], command='\n cat > {out} << EOM\nmodule GHC.Paths (\n ghc, ghc_pkg, libdir, docdir\n ) where\n\nghc, ghc_pkg, docdir, ... |
#import formatter
#import htmllib
url="http://www.cnn.com"
filehandle = urllib.urlopen(url)
#w = formatter.DumbWriter() # plain text
#f = formatter.AbstractFormatter(w)
#p = htmllib.HTMLParser(f)
#p.feed(filehandle.read())
#p.close()
#filehandle.close()
fromaddr = "ahouman2@hatswitch.crhc.illinois.edu"
msg =... | url = 'http://www.cnn.com'
filehandle = urllib.urlopen(url)
fromaddr = 'ahouman2@hatswitch.crhc.illinois.edu'
msg = mime_multipart()
msg['From'] = 'amir'
msg['To'] = 'asdsadad'
msg['Date'] = formatdate(localtime=True)
msg['Subject'] = 'salam'
text = 'saaalaaam'
msg.attach(mime_text(text))
part = mime_base('application'... |
def factI(n):
""" Assumes that n is an int > 0
Returns n!"""
result = 1
while n > 1:
result = result * n
n -= 1
return result
def factR(n):
""" Assumes that n is an int > 0
Returns n! """
if n == 1:
return n
else:
return n*factR(n-1)
| def fact_i(n):
""" Assumes that n is an int > 0
Returns n!"""
result = 1
while n > 1:
result = result * n
n -= 1
return result
def fact_r(n):
""" Assumes that n is an int > 0
Returns n! """
if n == 1:
return n
else:
return n * fact_r(n - 1) |
class WebPageCssSelect:
def __init__(self, url, ua_type, selector_name, value):
self.url = url
self.ua_type = ua_type
self.selector_name = selector_name
self.value = value
def output(self):
return self.url + ',' + self.ua_type + ',' + self.selector_name + ',' + self.value
| class Webpagecssselect:
def __init__(self, url, ua_type, selector_name, value):
self.url = url
self.ua_type = ua_type
self.selector_name = selector_name
self.value = value
def output(self):
return self.url + ',' + self.ua_type + ',' + self.selector_name + ',' + self.val... |
num = 10
num1 = 10
num2 = 20
num3 = 30
| num = 10
num1 = 10
num2 = 20
num3 = 30 |
#
# 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 you under the Apache License, Version 2.0 (the
# "License"); you may not... | class Context:
def __init__(self):
self.containers = []
def push(self, o):
self.containers.append(o)
def pop(self):
return self.containers.pop()
class Values:
def __init__(self, *values):
self.values = values
def validate(self, o, ctx):
if not o in self.... |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class PyTensorflow(Package):
"""TensorFlow is an Open Source Software Library for Machine Intelligence
This is a ... | class Pytensorflow(Package):
"""TensorFlow is an Open Source Software Library for Machine Intelligence
This is a wheel based recipe as opposed to source-based installation in
the upstream spack."""
homepage = 'https://www.tensorflow.org'
url = 'https://storage.googleapis.com/tensorflow/linux/gpu/ten... |
'''
https://leetcode.com/problems/longest-valid-parentheses/
'''
class Solution:
def longestValidParentheses(self, s: str) -> int:
stack=[-1]
maxValid=0
for i in range(0,len(s)):
if s[i]=="(": stack.append(i)
else:
stack.pop()
if stack=... | """
https://leetcode.com/problems/longest-valid-parentheses/
"""
class Solution:
def longest_valid_parentheses(self, s: str) -> int:
stack = [-1]
max_valid = 0
for i in range(0, len(s)):
if s[i] == '(':
stack.append(i)
else:
stack.pop... |
class Response:
def __init__(self, inst):
self.instance = inst
@property
def id(self):
return self.instance['status']
@property
def status(self):
return self.instance['status']
| class Response:
def __init__(self, inst):
self.instance = inst
@property
def id(self):
return self.instance['status']
@property
def status(self):
return self.instance['status'] |
NUM_ROWS = 10
NUM_COLS = 10
with open('input.txt') as file:
octopi = []
num_flashes = 0
for row in range(NUM_ROWS):
line = file.readline()
octopi.append([])
for col in range(NUM_COLS):
octopi[row].append(int(line[col]))
for step in range(100):
flashes = []
... | num_rows = 10
num_cols = 10
with open('input.txt') as file:
octopi = []
num_flashes = 0
for row in range(NUM_ROWS):
line = file.readline()
octopi.append([])
for col in range(NUM_COLS):
octopi[row].append(int(line[col]))
for step in range(100):
flashes = []
... |
FILTERS_KEY = 'FILTERS'
SAMPLE_RATE_METRIC_KEY = '_sample_rate'
SAMPLING_PRIORITY_KEY = '_sampling_priority_v1'
ANALYTICS_SAMPLE_RATE_KEY = '_dd1.sr.eausr'
ORIGIN_KEY = '_dd.origin'
HOSTNAME_KEY = '_dd.hostname'
ENV_KEY = 'env'
NUMERIC_TAGS = (ANALYTICS_SAMPLE_RATE_KEY, )
MANUAL_DROP_KEY = 'manual.drop'
MANUAL_KEEP_K... | filters_key = 'FILTERS'
sample_rate_metric_key = '_sample_rate'
sampling_priority_key = '_sampling_priority_v1'
analytics_sample_rate_key = '_dd1.sr.eausr'
origin_key = '_dd.origin'
hostname_key = '_dd.hostname'
env_key = 'env'
numeric_tags = (ANALYTICS_SAMPLE_RATE_KEY,)
manual_drop_key = 'manual.drop'
manual_keep_key ... |
def init(bot, data):
@bot.command()
async def add(ctx):
await ctx.send("Add Ludus to your server: <https://discordapp.com/api/oauth2/authorize?client_id=593828724001079297&permissions=124992&scope=bot>")
@bot.command()
async def github(ctx):
await ctx.send("Ludus is open source! You... | def init(bot, data):
@bot.command()
async def add(ctx):
await ctx.send('Add Ludus to your server: <https://discordapp.com/api/oauth2/authorize?client_id=593828724001079297&permissions=124992&scope=bot>')
@bot.command()
async def github(ctx):
await ctx.send('Ludus is open source! You ca... |
"""User provided customizations.
Here one changes the default arguments for compiling _gpaw.so (serial)
and gpaw-python (parallel).
Here are all the lists that can be modified:
* libraries
* library_dirs
* include_dirs
* extra_link_args
* extra_compile_args
* runtime_library_dirs
* extra_objects
* define_macros
* mp... | """User provided customizations.
Here one changes the default arguments for compiling _gpaw.so (serial)
and gpaw-python (parallel).
Here are all the lists that can be modified:
* libraries
* library_dirs
* include_dirs
* extra_link_args
* extra_compile_args
* runtime_library_dirs
* extra_objects
* define_macros
* mp... |
# -*- coding: utf-8 -*-
"""Top-level package for Spectrify."""
__author__ = """The Narrativ Company, Inc."""
__email__ = 'engineering@narrativ.com'
__version__ = '1.0.1'
| """Top-level package for Spectrify."""
__author__ = 'The Narrativ Company, Inc.'
__email__ = 'engineering@narrativ.com'
__version__ = '1.0.1' |
#! /usr/bin/env zxpy
~'echo Hello world!'
def print_file_count():
file_count = ~'ls -1 | wc -l'
~"echo -n 'file count is: '"
print(file_count)
print_file_count()
| ~'echo Hello world!'
def print_file_count():
file_count = ~'ls -1 | wc -l'
~"echo -n 'file count is: '"
print(file_count)
print_file_count() |
class Solution(object):
def __init__(self, nums):
"""
:type nums: List[int]
:type numsSize: int
"""
self.nums = nums
def pick(self, target):
"""
:type target: int
:rtype: int
"""
count = 0
ans = -1... | class Solution(object):
def __init__(self, nums):
"""
:type nums: List[int]
:type numsSize: int
"""
self.nums = nums
def pick(self, target):
"""
:type target: int
:rtype: int
"""
count = 0
ans = -1
for i i... |
def extractLasciviousImouto(item):
"""
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'].replace('-', '.'))
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if 'The Beast of the 17th District' in item['tags'] or 'the beast of the 17th district' in item['title'].l... | def extract_lascivious_imouto(item):
"""
"""
(vol, chp, frag, postfix) = extract_vol_chapter_fragment_postfix(item['title'].replace('-', '.'))
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if 'The Beast of the 17th District' in item['tags'] or 'the beast of the 17th di... |
## Capitalizes the first letter of a string.
## Capitalizes the fist letter of the sring and then adds it with rest of the string. Omit the lower_rest parameter to keep the rest of the string intact, or set it to true to convert to lowercase.
def capitalize(string, lower_rest=False):
return string[:1].upper() ... | def capitalize(string, lower_rest=False):
return string[:1].upper() + (string[1:].lower() if lower_rest else string[1:]) |
# Topological sorting of a directed ascylic graph
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (c) 2014-2019, Lars Asplund lars.anders.asplund@gmail.c... | """
Functionality to compute a dependency graph
"""
class Dependencygraph(object):
"""
A dependency graph
"""
def __init__(self):
self._forward = {}
self._backward = {}
self._nodes = []
def toposort(self):
"""
Perform a topological sort returning a list of ... |
# Rock, paper, scissors game
print("--------------------------------")
print(" Rock, Paper, Scissors v1")
print("--------------------------------")
player1 = input("Player 1, enter your name: ")
player2 = input("Player 2, enter your name: ")
rolls = ["rock", "paper", "scissors"]
roll1 = input(f"{player1}, enter y... | print('--------------------------------')
print(' Rock, Paper, Scissors v1')
print('--------------------------------')
player1 = input('Player 1, enter your name: ')
player2 = input('Player 2, enter your name: ')
rolls = ['rock', 'paper', 'scissors']
roll1 = input(f'{player1}, enter your roll [rock, paper, scissors]:... |
"""Constants for the Carson integration."""
DOMAIN = "carson"
UNLOCKED_TIMESPAN_SEC = 5
ATTRIBUTION = "provided by Eagle Eye"
CONF_LIST_FROM_EAGLE_EYE = "list_from_eagle_eye"
DEFAULT_CONF_LIST_FROM_EAGLE_EYE = False
| """Constants for the Carson integration."""
domain = 'carson'
unlocked_timespan_sec = 5
attribution = 'provided by Eagle Eye'
conf_list_from_eagle_eye = 'list_from_eagle_eye'
default_conf_list_from_eagle_eye = False |
# Copyright 2016 IBM 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 agreed t... | class Scorerconfigurationexception(Exception):
"""
Define exceptions to be used by various services.
ScorerConfigurationException: Raised if a Scorer is improperly configured
ScorerRuntimeException: Raised if a Scorer has a runtime error
"""
def __init__(self, message):
"""... |
class VkError(Exception):
def __init__(self, code, message, request_params):
super(VkError, self).__init__()
self.code = code
self.message = message
self.request_params = request_params
def __str__(self):
return 'VkError {}: {} (request_params: {})'.format(self.code, sel... | class Vkerror(Exception):
def __init__(self, code, message, request_params):
super(VkError, self).__init__()
self.code = code
self.message = message
self.request_params = request_params
def __str__(self):
return 'VkError {}: {} (request_params: {})'.format(self.code, se... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
print('''
.intel_syntax noprefix
.extern isr_common
''')
print('// Interrupt Service Routines')
for i in range(255):
print('''isr{0}:
cli
{1}
push {0}
jmp isr_common
'''.format(i,
'push 0' if i not in [8, 10, 11, 12, 13, 14, 17] else 'nop'... | print('\n.intel_syntax noprefix\n.extern isr_common\n')
print('// Interrupt Service Routines')
for i in range(255):
print('isr{0}:\n cli\n {1}\n push {0}\n jmp isr_common\n '.format(i, 'push 0' if i not in [8, 10, 11, 12, 13, 14, 17] else 'nop'))
print('\n\n// Vector table\n\n.section .data\n.global ... |
"""Find first and last position of elements in sorted arrays."""
"""First and last position in sorted arrays."""
def searchRange(nums, target):
"""Find first and last position."""
def midpoint(x, y):
"""Find mid point."""
return x + (y - x) // 2
lo, hi = 0, len(nums)-1
_max = -1
... | """Find first and last position of elements in sorted arrays."""
'First and last position in sorted arrays.'
def search_range(nums, target):
"""Find first and last position."""
def midpoint(x, y):
"""Find mid point."""
return x + (y - x) // 2
(lo, hi) = (0, len(nums) - 1)
_max = -1
... |
# This sample tests the logic that infers parameter types based on
# default argument values or annotated base class methods.
class Parent:
def func1(self, a: int, b: str) -> float:
...
class Child(Parent):
def func1(self, a, b):
reveal_type(self, expected_text="Self@Child")
reveal_t... | class Parent:
def func1(self, a: int, b: str) -> float:
...
class Child(Parent):
def func1(self, a, b):
reveal_type(self, expected_text='Self@Child')
reveal_type(a, expected_text='int')
reveal_type(b, expected_text='str')
return a
def func2(a, b=0, c=None):
reveal... |
#!/usr/bin/python3
class Solution:
def isPalindrome(self, x: int) -> bool:
if x < 0:
return False
s = str(x)
for i in range(int(len(s)/2)):
last = len(s) - i - 1
if s[i] != s[last]:
return False
return True
if __name__ == "__main_... | class Solution:
def is_palindrome(self, x: int) -> bool:
if x < 0:
return False
s = str(x)
for i in range(int(len(s) / 2)):
last = len(s) - i - 1
if s[i] != s[last]:
return False
return True
if __name__ == '__main__':
solution ... |
# *** DEFINE CONSTANTS ***
# DO NOT ADD TO VERSION CONTROL AFTER ENTERING PERSONAL INFO
# LOCATION WHERE BLOTTER FILE IS LOCATED (INPUT)
SRCPATH = "D:/financial/"
SRCFILE = "blotter.xlsx"
# OUTPUT DATA DESTINATION (WINDOWS FORMAT)
outpath = "D://financial//"
outpath_linux = "/mnt/d/financial/"
# OUTPUT FILE NAMES
ou... | srcpath = 'D:/financial/'
srcfile = 'blotter.xlsx'
outpath = 'D://financial//'
outpath_linux = '/mnt/d/financial/'
outfile = 'stock_data_output.xlsx'
out_screener = 'screener_output.xlsx'
hist_db_server = 'sqlite'
hist_db_name = 'hist.db'
hist_db_schema = 'db_schema.sql'
max_sector_pct = 0.2
max_stock_pct = 0.1
discoun... |
"""
https://leetcode.com/problems/reverse-integer/
"""
class Solution:
def reverse(self, x: int) -> int:
multiply = 1
upper_bound = 2**31-1
lower_bound = -2**31
if x < 0:
multiply = -1
value = int(str(abs(x))[::-1])
print(f"mult={multiply}, value={value},... | """
https://leetcode.com/problems/reverse-integer/
"""
class Solution:
def reverse(self, x: int) -> int:
multiply = 1
upper_bound = 2 ** 31 - 1
lower_bound = -2 ** 31
if x < 0:
multiply = -1
value = int(str(abs(x))[::-1])
print(f'mult={multiply}, value={... |
def get_num(capacity, p):
cell = []
for i in range(len(p) + 1):
cell.append([])
for j in range(capacity + 1):
cell[i].append(0)
for i in range(1, len(p) + 1):
for j in range(1, capacity + 1):
if p[i - 1] <= i:
cell[i][j] = max(p[i -1], cell[i]... | def get_num(capacity, p):
cell = []
for i in range(len(p) + 1):
cell.append([])
for j in range(capacity + 1):
cell[i].append(0)
for i in range(1, len(p) + 1):
for j in range(1, capacity + 1):
if p[i - 1] <= i:
cell[i][j] = max(p[i - 1], cell[i]... |
#!/usr/bin/env python
# examples of Church numerals
zero = lambda f: lambda x: x
one = lambda f: lambda x: f(x)
two = lambda f: lambda x: f(f(x))
three = lambda f: lambda x: f(f(f(x)))
four = lambda f: lambda x: f(f(f(f(x))))
five = lambda f: lambda x: f(f(f(f(f(x)))))
def to_intp(f):
print (f(lam... | zero = lambda f: lambda x: x
one = lambda f: lambda x: f(x)
two = lambda f: lambda x: f(f(x))
three = lambda f: lambda x: f(f(f(x)))
four = lambda f: lambda x: f(f(f(f(x))))
five = lambda f: lambda x: f(f(f(f(f(x)))))
def to_intp(f):
print(f(lambda x: x + 1)(0))
def to_int(f):
return f(lambda x: x + 1)(0)
tru... |
#!/usr/bin/env python3
# https://arc098.contest.atcoder.jp/tasks/arc098_a
n = int(input())
s = input()
a = [0] * n
if s[0] == 'W': a[0] = 1
for i in range(1, n):
c = s[i]
if c == 'E':
a[i] = a[i - 1]
else:
a[i] = a[i - 1] + 1
b = [0] * n
if s[n - 1] == 'E': b[n - 1] = 1
for i in range(n - 2,... | n = int(input())
s = input()
a = [0] * n
if s[0] == 'W':
a[0] = 1
for i in range(1, n):
c = s[i]
if c == 'E':
a[i] = a[i - 1]
else:
a[i] = a[i - 1] + 1
b = [0] * n
if s[n - 1] == 'E':
b[n - 1] = 1
for i in range(n - 2, -1, -1):
c = s[i]
if c == 'W':
b[i] = b[i + 1]
... |
#
# Copyright (c) 2013,2014, Oracle and/or its affiliates. All rights reserved.
#
# This program 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; version 2 of the License.
#
# This program is distributed in the... | """Errors raised within the MySQL Fabric library.
"""
class Error(Exception):
"""Base exception for all errors in the package.
"""
pass
class Notcallableerror(Error):
"""Exception raised when a callable was expected but not provided.
"""
pass
class Noteventerror(Error):
"""Exception raise... |
def reverse_string(string):
reverse = ''
for char in range(len(string) - 1, -1, -1):
reverse += string[char]
print(reverse)
| def reverse_string(string):
reverse = ''
for char in range(len(string) - 1, -1, -1):
reverse += string[char]
print(reverse) |
class RestException(Exception):
pass
class ResourceException(RestException):
pass
class RestServerException(RestException):
pass
| class Restexception(Exception):
pass
class Resourceexception(RestException):
pass
class Restserverexception(RestException):
pass |
class CreateAuth:
def __init__(self, repository):
self.auth_repository = repository
async def create(self):
return await self.auth_repository.create()
| class Createauth:
def __init__(self, repository):
self.auth_repository = repository
async def create(self):
return await self.auth_repository.create() |
length = int( input("Enter the length of rectagle: ") )
width = int( input("Enter the width of rectange: ") )
perimeter = 2 * (length + width)
area = length * width
print("Area: ", area, "square cm")
print("Perimeter:", perimeter, "cm")
| length = int(input('Enter the length of rectagle: '))
width = int(input('Enter the width of rectange: '))
perimeter = 2 * (length + width)
area = length * width
print('Area: ', area, 'square cm')
print('Perimeter:', perimeter, 'cm') |
def read_matrix():
(rows, columns) = map(int, input().split(" "))
matrix = []
for r in range(rows):
row = input().split(" ")
matrix.append(row)
return matrix, rows, columns
def subsqares_count(matrix,subsquare, rows, columns):
count = 0
for r in range(rows - (subsquare - 1)):
... | def read_matrix():
(rows, columns) = map(int, input().split(' '))
matrix = []
for r in range(rows):
row = input().split(' ')
matrix.append(row)
return (matrix, rows, columns)
def subsqares_count(matrix, subsquare, rows, columns):
count = 0
for r in range(rows - (subsquare - 1)):... |
DEBUG = True
APP_DIR = '/home/harish/django_projects/cinepura/'
STATIC_MEDIA_PREFIX = '/static_media/cinepura' | debug = True
app_dir = '/home/harish/django_projects/cinepura/'
static_media_prefix = '/static_media/cinepura' |
"""
'pass' or '...' (ellipsis) works as a placeholder for the programmer to write something later
"""
valor = True
if valor:
pass
else:
print('Bye')
print()
if valor:
...
else:
print('Bye')
| """
'pass' or '...' (ellipsis) works as a placeholder for the programmer to write something later
"""
valor = True
if valor:
pass
else:
print('Bye')
print()
if valor:
...
else:
print('Bye') |
def reverse_num(x: int) -> int :
if x == 0:
return 0
else:
num_temp = str(x)
tam = len(num_temp)
num_zeros = 0
if num_temp[0] == "-":
if num_temp[tam - 1] == "0":
dici = {"0": 0}
for value in num_temp[:1:-1]:
... | def reverse_num(x: int) -> int:
if x == 0:
return 0
else:
num_temp = str(x)
tam = len(num_temp)
num_zeros = 0
if num_temp[0] == '-':
if num_temp[tam - 1] == '0':
dici = {'0': 0}
for value in num_temp[:1:-1]:
... |
class BasicPagination:
items_per_page = 1
max_items_per_page = 100
def __init__(self,
pagination: dict = None,
items_per_page: int = None,
max_items_per_page: int = None):
pagination = pagination or {}
self.page = pagination.get('page', 0)
... | class Basicpagination:
items_per_page = 1
max_items_per_page = 100
def __init__(self, pagination: dict=None, items_per_page: int=None, max_items_per_page: int=None):
pagination = pagination or {}
self.page = pagination.get('page', 0)
self.max_items_per_page = max_items_per_page
... |
'''
This problem was recently asked by Apple:
You are given two singly linked lists. The lists intersect at some node. Find, and return the node. Note: the lists are non-cyclical.
Example:
A = 1 -> 2 -> 3 -> 4
B = 6 -> 3 -> 4
This should return 3 (you may assume that any nodes with the same value are the same nod... | """
This problem was recently asked by Apple:
You are given two singly linked lists. The lists intersect at some node. Find, and return the node. Note: the lists are non-cyclical.
Example:
A = 1 -> 2 -> 3 -> 4
B = 6 -> 3 -> 4
This should return 3 (you may assume that any nodes with the same value are the same node)... |
class Solution:
def climbStairs(self, n: int) -> int:
if n == 0:
return 0
if n == 1:
return 1
if n == 2:
return 2
"""
Approach #1:
- use a dp array and a helper function
- pretty intuitive
"""
dp = [-1 for _... | class Solution:
def climb_stairs(self, n: int) -> int:
if n == 0:
return 0
if n == 1:
return 1
if n == 2:
return 2
'\n Approach #1:\n - use a dp array and a helper function\n - pretty intuitive\n '
dp = [-1 for ... |
WELCOME_DIALOG_TEXT = (
"Welcome to NVDA dialog Welcome to NVDA! Most commands for controlling NVDA require you to hold "
"down the NVDA key while pressing other keys. By default, the numpad Insert and main Insert keys "
"may both be used as the NVDA key. You can also configure NVDA to use the Caps Lock as the ... | welcome_dialog_text = 'Welcome to NVDA dialog Welcome to NVDA! Most commands for controlling NVDA require you to hold down the NVDA key while pressing other keys. By default, the numpad Insert and main Insert keys may both be used as the NVDA key. You can also configure NVDA to use the Caps Lock as the NVDA key. Pres... |
__author__ = "NuoDB, Inc."
__copyright__ = "(C) Copyright NuoDB, Inc. 2019"
__license__ = "MIT"
__version__ = "1.0"
__maintainer__ = "NuoDB Drivers"
__email__ = "drivers@nuodb.com"
__status__ = "Production"
| __author__ = 'NuoDB, Inc.'
__copyright__ = '(C) Copyright NuoDB, Inc. 2019'
__license__ = 'MIT'
__version__ = '1.0'
__maintainer__ = 'NuoDB Drivers'
__email__ = 'drivers@nuodb.com'
__status__ = 'Production' |
class CurrentChangedEventManager(WeakEventManager):
""" Provides a System.Windows.WeakEventManager implementation so that you can use the "weak event listener" pattern to attach listeners for the System.ComponentModel.ICollectionView.CurrentChanged event. """
@staticmethod
def AddHandler(source,handler):
""" A... | class Currentchangedeventmanager(WeakEventManager):
""" Provides a System.Windows.WeakEventManager implementation so that you can use the "weak event listener" pattern to attach listeners for the System.ComponentModel.ICollectionView.CurrentChanged event. """
@staticmethod
def add_handler(source, handler):... |
class Color(object):
""" Represents an ARGB (alpha,red,green,blue) color. """
def Equals(self,obj):
"""
Equals(self: Color,obj: object) -> bool
Tests whether the specified object is a System.Drawing.Color structure and is equivalent to this
System.Drawing.Color structure.
... | class Color(object):
""" Represents an ARGB (alpha,red,green,blue) color. """
def equals(self, obj):
"""
Equals(self: Color,obj: object) -> bool
Tests whether the specified object is a System.Drawing.Color structure and is equivalent to this
System.Drawing.Color structure.
o... |
class Jaro:
def similarity(self, s, t):
if not s and not t:
return 1
if not s or not t:
return 0
if len(s) > len(t):
s, t = t, s
max_dist = (len(t) // 2) - 1
s_matched = []
t_matched = []
... | class Jaro:
def similarity(self, s, t):
if not s and (not t):
return 1
if not s or not t:
return 0
if len(s) > len(t):
(s, t) = (t, s)
max_dist = len(t) // 2 - 1
s_matched = []
t_matched = []
matches = 0
for (i, c) ... |
class Smartphone:
def gallary(self):
print("Gallary")
def browser(self):
print("Browser")
def app_store(self):
print("App Store")
x = Smartphone()
x.gallary()
x.browser()
x.gallary()
| class Smartphone:
def gallary(self):
print('Gallary')
def browser(self):
print('Browser')
def app_store(self):
print('App Store')
x = smartphone()
x.gallary()
x.browser()
x.gallary() |
class Solution:
"""
@param nums: The number array
@return: Return the single number
"""
def getSingleNumber(self, nums):
n = len(nums)
if n == 1:
return nums[0]
if nums[n // 2] == nums[n - n // 2]:
if n // 2 % 2 == 0:
return se... | class Solution:
"""
@param nums: The number array
@return: Return the single number
"""
def get_single_number(self, nums):
n = len(nums)
if n == 1:
return nums[0]
if nums[n // 2] == nums[n - n // 2]:
if n // 2 % 2 == 0:
return self.get... |
'''
@file ion/core/__init__.py
@mainpage Overview
@section intro Introduction
This is the repository that defines the COI services.
@note Initially, all ION services are defined here and later moved to
subsystem repositories.
COI services are intended to be deployed as part of the ION system launch.
Services are d... | """
@file ion/core/__init__.py
@mainpage Overview
@section intro Introduction
This is the repository that defines the COI services.
@note Initially, all ION services are defined here and later moved to
subsystem repositories.
COI services are intended to be deployed as part of the ION system launch.
Services are d... |
PATH_IMAGE = "img"
BACKGROUND_IMAGE = 'background'
LOOT_IMAGE = 'point_5'
GHOST_RED_IMAGE = 'ghost_red_30'
GHOST_BLUE_IMAGE = 'ghost_blue_30'
GHOST_PINK_IMAGE = 'ghost_pink_30'
GHOST_ORANGE_IMAGE = 'ghost_orange_30'
FONT_REGULAR = 'couriernew_regular.ttf'
FONT_BOLD = 'couriernew_bold.ttf'
PACMAN_SIZE = (30... | path_image = 'img'
background_image = 'background'
loot_image = 'point_5'
ghost_red_image = 'ghost_red_30'
ghost_blue_image = 'ghost_blue_30'
ghost_pink_image = 'ghost_pink_30'
ghost_orange_image = 'ghost_orange_30'
font_regular = 'couriernew_regular.ttf'
font_bold = 'couriernew_bold.ttf'
pacman_size = (30, 30)
ghost_s... |
"""
# @Time : 2020/9/17
# @Author : Jimou Chen
"""
def T(n):
if n == 1:
return 4
elif n > 1:
return 3 * T(n - 1)
def T(n):
if n == 1:
return 1
elif n > 1:
return 2 * T(n // 3) + n
print(T(5))
| """
# @Time : 2020/9/17
# @Author : Jimou Chen
"""
def t(n):
if n == 1:
return 4
elif n > 1:
return 3 * t(n - 1)
def t(n):
if n == 1:
return 1
elif n > 1:
return 2 * t(n // 3) + n
print(t(5)) |
'''
Created on Sat 04/04/2020 11:55:38
99 Bottles of Beer
@author: MarsCandyBars
'''
class BottlesOfBeer():
def __init__(self):
'''
Description:
This method provides attributes for the main lyrics
of the song to make looping cleaner.
Args:
None.
... | """
Created on Sat 04/04/2020 11:55:38
99 Bottles of Beer
@author: MarsCandyBars
"""
class Bottlesofbeer:
def __init__(self):
"""
Description:
This method provides attributes for the main lyrics
of the song to make looping cleaner.
Args:
None.
Re... |
class Library:
def __init__(self, id, books, signup_days, book_p_day):
self.id = id
self.books = books
self.signup_days = signup_days
self.book_p_day = book_p_day
def score(self, books_so_far):
possible_reward = sum([self.books[id] for id in self.books.keys() if id not ... | class Library:
def __init__(self, id, books, signup_days, book_p_day):
self.id = id
self.books = books
self.signup_days = signup_days
self.book_p_day = book_p_day
def score(self, books_so_far):
possible_reward = sum([self.books[id] for id in self.books.keys() if id not ... |
#Write a program that prompts for a file name, then opens that file and reads through the file, looking for lines of the form:
#X-DSPAM-Confidence: 0.8475
#Count these lines and extract the floating point values from each of the lines and compute the average of those values
#and produce an output as shown below. Do ... | fname = input('Enter file name: ')
fh = open(fname)
count = 0
add = 0
for line in fh:
if not line.startswith('X-DSPAM-Confidence:'):
continue
bnpos = line.find('0')
host = line[bnpos:]
fhost = float(host)
count = count + 1
add = add + fhost
print('Average spam confidence', add / count) |
'''
'''
__version__ = '0.1-dev'
device_config_name = 'Devices'
exp_config_name = 'experiment'
| """
"""
__version__ = '0.1-dev'
device_config_name = 'Devices'
exp_config_name = 'experiment' |
#
# Copyright 2015 Tickle Labs, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | class Localizedstring(object):
def __init__(self, source, localized=None, comment=None):
"""
:type source: str
:type localized: str
:type comment: str
:rtype: LocalizedString
"""
assert source, 'Source could not be none'
self.source = source
'... |
# Python code to demonstrate naive
# method to compute gcd ( Euclidean algo )
def computeGCD(x, y):
while(y):
x, y = y, x % y
return x
a = 60
b= 48
# prints 12
print ("The gcd of 60 and 48 is : ",end="")
print (computeGCD(60,48))
| def compute_gcd(x, y):
while y:
(x, y) = (y, x % y)
return x
a = 60
b = 48
print('The gcd of 60 and 48 is : ', end='')
print(compute_gcd(60, 48)) |
class Solution:
def intersection(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: List[int]
"""
return list(set(nums1) & set(nums2))
if __name__ == '__main__':
solution = Solution()
print(solution.intersection([1, 2,... | class Solution:
def intersection(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: List[int]
"""
return list(set(nums1) & set(nums2))
if __name__ == '__main__':
solution = solution()
print(solution.intersection([1, 2, 2, 1], [2, 2... |
"""Blank file for Python transversal.
This can be deleted or renamed to store the source code of your project.
"""
| """Blank file for Python transversal.
This can be deleted or renamed to store the source code of your project.
""" |
# URI Online Judge 2787
L = int(input())
C = int(input())
if L % 2 == 0:
if C % 2 == 0:
print(1)
else:
print(0)
else:
if C % 2 == 0:
print(0)
else:
print(1) | l = int(input())
c = int(input())
if L % 2 == 0:
if C % 2 == 0:
print(1)
else:
print(0)
elif C % 2 == 0:
print(0)
else:
print(1) |
def convert_string_to_int(list_a):
new_list = []
for item in list_a:
num = int(item)
new_list.append(num)
return new_list
str_num_list = input().split(",")
rotate_times = int(input())
int_list = convert_string_to_int(str_num_list)
len_of_list = len(int_list)
val = rotate_times % len_of... | def convert_string_to_int(list_a):
new_list = []
for item in list_a:
num = int(item)
new_list.append(num)
return new_list
str_num_list = input().split(',')
rotate_times = int(input())
int_list = convert_string_to_int(str_num_list)
len_of_list = len(int_list)
val = rotate_times % len_of_list
... |
class Publisher:
def __init__(self):
self.observers = []
def add(self, observer):
if observer not in self.observers:
self.observers.append(observer)
else:
print('Failed to add: {}'.format(observer))
def remove(self, observer):
try:
self.o... | class Publisher:
def __init__(self):
self.observers = []
def add(self, observer):
if observer not in self.observers:
self.observers.append(observer)
else:
print('Failed to add: {}'.format(observer))
def remove(self, observer):
try:
self.... |
Version = "5.6.5"
if __name__ == "__main__":
print (Version)
| version = '5.6.5'
if __name__ == '__main__':
print(Version) |
'''Implements /src/Resource/index.ts'''
class Resource:
''' Enum implemenation '''
class Types:
WOOD = 'wood'
COAL = 'coal'
URANIUM = 'uranium'
def __init__(self, type, amount) -> None:
self.type = type
self.amount = amount
| """Implements /src/Resource/index.ts"""
class Resource:
""" Enum implemenation """
class Types:
wood = 'wood'
coal = 'coal'
uranium = 'uranium'
def __init__(self, type, amount) -> None:
self.type = type
self.amount = amount |
class RNNConfig(object):
"""
Holds logistic regression model hyperparams.
:param height: image height
:type heights: int
:param width: image width
:type width: int
:param channels: image channels
:type channels: int
:param batch_size: batch size for training
:type batch_size: in... | class Rnnconfig(object):
"""
Holds logistic regression model hyperparams.
:param height: image height
:type heights: int
:param width: image width
:type width: int
:param channels: image channels
:type channels: int
:param batch_size: batch size for training
:type batch_size: in... |
t = int(input())
i=0
while i < t:
st = str(input())
length = len(st)
j = 0
cnt = 0
while j < length:
num = int(st[j])
#print(num)
if num == 4:
cnt = cnt + 1
j=j+1
print(cnt)
i=i+1 | t = int(input())
i = 0
while i < t:
st = str(input())
length = len(st)
j = 0
cnt = 0
while j < length:
num = int(st[j])
if num == 4:
cnt = cnt + 1
j = j + 1
print(cnt)
i = i + 1 |
#
# @lc app=leetcode id=693 lang=python3
#
# [693] Binary Number with Alternating Bits
#
# https://leetcode.com/problems/binary-number-with-alternating-bits/description/
#
# algorithms
# Easy (58.47%)
# Likes: 359
# Dislikes: 74
# Total Accepted: 52.4K
# Total Submissions: 89.1K
# Testcase Example: '5'
#
# Given... | class Solution:
def has_alternating_bits(self, n: int) -> bool:
b = list(bin(n)[2:])
if len(b) < 2:
return True
else:
return b[0] != b[1] and len(set(b[::2])) == 1 and (len(set(b[1::2])) == 1) |
# Copyright 2013 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': 'memconsumer',
'type': 'none',
'dependencies': [
'memconsumer_apk',
],
},
{
... | {'targets': [{'target_name': 'memconsumer', 'type': 'none', 'dependencies': ['memconsumer_apk']}, {'target_name': 'memconsumer_apk', 'type': 'none', 'variables': {'apk_name': 'MemConsumer', 'java_in_dir': 'java', 'resource_dir': 'java/res', 'native_lib_target': 'libmemconsumer'}, 'dependencies': ['libmemconsumer'], 'in... |
# https://leetcode.com/problems/contains-duplicate
class Solution:
def containsDuplicate(self, nums):
hs = set()
for num in nums:
hs.add(num)
return len(hs) != len(nums)
| class Solution:
def contains_duplicate(self, nums):
hs = set()
for num in nums:
hs.add(num)
return len(hs) != len(nums) |
class Emitter:
"""This class implements a simple event emitter.
Args:
emitterIsEnabled: enable callbacks execution?
Example usage::
callback = lambda message: print(message)
event = Emitter()
event.on('ready', callback)
event.emit('ready', 'Finished!')
"""
d... | class Emitter:
"""This class implements a simple event emitter.
Args:
emitterIsEnabled: enable callbacks execution?
Example usage::
callback = lambda message: print(message)
event = Emitter()
event.on('ready', callback)
event.emit('ready', 'Finished!')
"""
d... |
""" Class to count the inversion count using merge sort"""
class InversionCount:
def count(self, A: [int]) -> [int]:
""" Count and return the array containing the count of each element """
index_array = []
rc_arr = []
for ind in range(0, len(A)):
index_array.append(ind... | """ Class to count the inversion count using merge sort"""
class Inversioncount:
def count(self, A: [int]) -> [int]:
""" Count and return the array containing the count of each element """
index_array = []
rc_arr = []
for ind in range(0, len(A)):
index_array.append(ind)... |
#!/usr/bin/env python3
#
# Author:
# Tamas Jos (@skelsec)
#
class CommentStreamA:
def __init__(self):
self.data = None
@staticmethod
def parse(dir, buff):
csa = CommentStreamA()
buff.seek(dir.Location.Rva)
csa.data = buff.read(dir.Location.DataSize).decode()
return csa
def __str__(self):
return 'Co... | class Commentstreama:
def __init__(self):
self.data = None
@staticmethod
def parse(dir, buff):
csa = comment_stream_a()
buff.seek(dir.Location.Rva)
csa.data = buff.read(dir.Location.DataSize).decode()
return csa
def __str__(self):
return 'CommentA: %s' ... |
#
# PySNMP MIB module Nortel-MsCarrier-MscPassport-DataCollectionMIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-MsCarrier-MscPassport-DataCollectionMIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:20:12 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 ... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection) ... |
for i in range(1,101) :
if(i % 2 != 0):
pass
else:
print(i,"is even number") | for i in range(1, 101):
if i % 2 != 0:
pass
else:
print(i, 'is even number') |
class PriorityQueueBase:
''' abstract base class for a priority queue '''
class _Item:
__slots_ = '_key', '_value'
def __init__(self, k, v):
self._key = k
self._value = v
def __lt__(self, other):
return self._key < other._key
def is_empty(self... | class Priorityqueuebase:
""" abstract base class for a priority queue """
class _Item:
__slots_ = ('_key', '_value')
def __init__(self, k, v):
self._key = k
self._value = v
def __lt__(self, other):
return self._key < other._key
def is_empty(sel... |
class Solution:
"""
@param A : a list of integers
@param target : an integer to be inserted
@return : an integer
"""
def searchInsert(self, A, target):
# write your code here
l, r = 0, len(A) - 1
while l <= r:
m = (l + r) / 2
if A[m] == target:
... | class Solution:
"""
@param A : a list of integers
@param target : an integer to be inserted
@return : an integer
"""
def search_insert(self, A, target):
(l, r) = (0, len(A) - 1)
while l <= r:
m = (l + r) / 2
if A[m] == target:
return m
... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"example_func": "00_core.ipynb",
"process_data": "01_cli.ipynb",
"train": "01_cli.ipynb",
"evaluate": "01_cli.ipynb",
"reproduce": "01_cli.ipynb"}
modules = ["core.py",
... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'example_func': '00_core.ipynb', 'process_data': '01_cli.ipynb', 'train': '01_cli.ipynb', 'evaluate': '01_cli.ipynb', 'reproduce': '01_cli.ipynb'}
modules = ['core.py', 'cli.py']
doc_url = 'https://wm-semeru.github.io/mlproj_template/'
git_url = 'ht... |
class RPGinfo():
author = 'BigBoi'
def __init__(self,name):
self.title = name
def welcome(self):
print("Welcome to " + self.title)
@staticmethod
def info():
print("Made using my amazing powers and Raseberry Pi's awesome team")
@classmethod
def credits(c... | class Rpginfo:
author = 'BigBoi'
def __init__(self, name):
self.title = name
def welcome(self):
print('Welcome to ' + self.title)
@staticmethod
def info():
print("Made using my amazing powers and Raseberry Pi's awesome team")
@classmethod
def credits(cls, name):
... |
def previous_answer():
#1.
num1 = int(input("Please enter your number!"))
if num1 % 2 == 0:
print("Your number is EVEN number!")
else:
print("Your number is ODD number!")
#2.
num2 = int(input("Please enter second number!"))
num3 = int(input("Please enter third number!"))
... | def previous_answer():
num1 = int(input('Please enter your number!'))
if num1 % 2 == 0:
print('Your number is EVEN number!')
else:
print('Your number is ODD number!')
num2 = int(input('Please enter second number!'))
num3 = int(input('Please enter third number!'))
if num2 % num3 =... |
merge_tags = {
"StudyDate": 0x00080020,
"StudyTime": 0x00080030,
"AccessionNumber": 0x00080050,
"ReferringPhysicianName": 0x00080090,
"StudyInstanceUID": 0x0020000D,
"StudyID": 0x00200010,
"Modality": 0x00080060,
# "ModalitiesInStudy": ,
"SeriesInstanceUID": 0x0020000E,
"SeriesNu... | merge_tags = {'StudyDate': 524320, 'StudyTime': 524336, 'AccessionNumber': 524368, 'ReferringPhysicianName': 524432, 'StudyInstanceUID': 2097165, 'StudyID': 2097168, 'Modality': 524384, 'SeriesInstanceUID': 2097166, 'SeriesNumber': 2097169, 'SOPClassUID': 524310, 'SOPInstanceUID': 524312, 'PatientAge': 1052688, 'Patien... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.